Skip to content
Permalink
Browse files

Merge remote-tracking branch 'brushtyler/master'

Conflicts:
	src/providers/postgres/qgspostgresprovider.cpp
  • Loading branch information
brushtyler committed Oct 6, 2011
2 parents f09417d + dd6a594 commit 6ccb04e9b3569ae059b6bf8d88cbe6c654341021
@@ -228,8 +228,10 @@ public:
/** \brief Accessor for transparent band name mapping */
QString transparentBandName() const;

/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data? */
bool usesProvider();
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data?
* @deprecated in 2.0
*/
bool usesProvider() /Deprecated/;

/** \brief Accessor that returns the width of the (unclipped) raster */
int width();
@@ -375,8 +377,15 @@ public:
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
QPixmap paletteAsPixmap( int theBand = 1 );

/** \brief [ data provider interface ] Which provider is being used for this Raster Layer? */
QString providerKey() const;
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
* @note added in 2.0
*/
QString providerType() const;

/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
* @deprecated in 2.0
*/
QString providerKey() const /Deprecated/;

/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixel();
@@ -22,7 +22,7 @@ def name():
def description():
return "Integrate gdal tools into qgis"
def version():
return "Version 1.2.27"
return "Version 1.2.28"
def qgisMinimumVersion():
return "1.0"
def icon():
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/" >
<qresource prefix="/">
<file>icons/contour.png</file>
<file>icons/merge.png</file>
<file>icons/polygonize.png</file>
@@ -21,5 +21,7 @@
<file>icons/about.png</file>
<file>icons/dem.png</file>
<file>icons/projection-export.png</file>
<file>icons/edit.png</file>
<file>icons/reset.png</file>
</qresource>
</RCC>
@@ -10,6 +10,7 @@

from ui_dialogBase import Ui_GdalToolsDialog as Ui_Dialog
import GdalTools_utils as Utils
from .. import resources_rc

import os, platform

@@ -39,6 +40,12 @@ def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand):
self.setupUi(self)
self.arguments = QStringList()

self.editCmdBtn.setIcon( QIcon(":/icons/edit.png") )
self.connect(self.editCmdBtn, SIGNAL("toggled(bool)"), self.editCommand)
self.resetCmdBtn.setIcon( QIcon(":/icons/reset.png") )
self.connect(self.resetCmdBtn, SIGNAL("clicked()"), self.resetCommand)
self.editCommand( False )

self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject)
self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept)
self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help)
@@ -66,6 +73,32 @@ def setPluginCommand(self, cmd):
else:
self.helpFileName = cmd + ".html"


def editCommand(self, enabled):
if not self.commandIsEnabled():
return
self.editCmdBtn.setChecked( enabled )
self.resetCmdBtn.setEnabled( enabled )
self.textEditCommand.setReadOnly( not enabled )
self.controlsWidget.setEnabled( not enabled )
self.emit( SIGNAL("refreshArgs()") )

def resetCommand(self):
if not self.commandIsEditable():
return
self.emit( SIGNAL("refreshArgs()") )

def commandIsEditable(self):
return self.commandIsEnabled() and self.editCmdBtn.isChecked()

def setCommandViewerEnabled(self, enable):
if not enable:
self.editCommand( False )
self.commandWidget.setEnabled( enable )

def commandIsEnabled(self):
return self.commandWidget.isEnabled()

def reject(self):
if self.process.state() != QProcess.NotRunning:
ret = QMessageBox.warning(self, self.tr( "Warning" ), self.tr( "The command is still running. \nDo you want terminate it anyway?" ), QMessageBox.Yes | QMessageBox.No)
@@ -98,37 +131,27 @@ def onHelp(self):
url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName)
QDesktopServices.openUrl(url)

def setCommandViewerEnabled(self, enable):
self.textEditCommand.setEnabled( enable )

# called when a value in the plugin widget interface changed
def refreshArgs(self, args):
self.arguments = args

if not self.textEditCommand.isEnabled():
self.textEditCommand.setText(self.command)
if not self.commandIsEnabled():
self.textEditCommand.setPlainText(self.command)
else:
self.textEditCommand.setText(self.command + " " + Utils.escapeAndJoin(self.arguments))
self.textEditCommand.setPlainText(self.command + " " + Utils.escapeAndJoin(self.arguments))

# enables the OK button
def enableRun(self, enable = True):
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)

# start the command execution
def onRun(self):
self.process.start(self.command, self.arguments, QIODevice.ReadOnly)
self.enableRun(False)
self.setCursor(Qt.WaitCursor)

"""
try:
print "Debug: " + self.command + " " + unicode(Utils.escapeAndJoin(self.arguments))
except UnicodeEncodeError:
try:
print "Debug: " + self.command + " " + unicode(Utils.escapeAndJoin(self.arguments)).encode('cp866', 'replace')
except:
print "Debug: " + self.command + " " + unicode(Utils.escapeAndJoin(self.arguments)).encode('ascii', 'replace')
"""
if not self.commandIsEditable():
self.process.start(self.command, self.arguments, QIODevice.ReadOnly)
else:
self.process.start(self.textEditCommand.toPlainText(), QIODevice.ReadOnly)

# stop the command execution
def stop(self):
@@ -13,13 +13,15 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="pluginLayout">
<property name="margin">
<number>0</number>
</property>
</layout>
<widget class="QWidget" name="controlsWidget" native="true">
<layout class="QVBoxLayout" name="pluginLayout">
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="loadCheckBox">
@@ -29,19 +31,74 @@
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditCommand">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<widget class="QWidget" name="commandWidget" native="true">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QPlainTextEdit" name="textEditCommand">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="editCmdBtn">
<property name="toolTip">
<string>Edit</string>
</property>
<property name="text">
<string>Edit</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="resetCmdBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Reset</string>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
@@ -57,7 +114,6 @@
</layout>
</widget>
<tabstops>
<tabstop>textEditCommand</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
@@ -22,6 +22,7 @@ def __init__(self, iface, commandName, parent = None):
self.connect(self.base, SIGNAL("helpClicked()"), self.onHelp)

self.connect(self.base, SIGNAL("finished(bool)"), self.finished)
self.connect(self.base, SIGNAL("refreshArgs()"), self.someValueChanged)

def someValueChanged(self):
self.emit(SIGNAL("valuesChanged(const QStringList &)"), self.getArguments())
@@ -4738,7 +4738,7 @@ void QgisApp::fullHistogramStretch()
tr( "To perform a full histogram stretch, you need to have a raster layer selected." ) );
return;
}
if ( rlayer->providerKey() == "wms" )
if ( rlayer->providerType() == "wms" )
{
return;
}
@@ -270,7 +270,7 @@ void QgsIdentifyResults::addFeature( QgsRasterLayer *layer,
featItem->setData( 0, Qt::UserRole, -1 );
layItem->addChild( featItem );

if ( layer && layer->providerKey() == "wms" )
if ( layer && layer->providerType() == "wms" )
{
QTreeWidgetItem *attrItem = new QTreeWidgetItem( QStringList() << attributes.begin().key() << "" );
featItem->addChild( attrItem );
@@ -327,7 +327,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QgsRasterLayer *layer, int x, int
idPoint = toLayerCoordinates( layer, idPoint );
QString type;

if ( layer->providerKey() == "wms" )
if ( layer->providerType() == "wms" )
{
type = tr( "WMS layer" );

@@ -142,7 +142,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
{
QgsRasterLayer *rl = qobject_cast<QgsRasterLayer *>( currentLayer );

if ( rl && rl->providerKey() == "wms" )
if ( rl && rl->providerType() == "wms" )
{
type = tr( "WMS" );
}
@@ -38,7 +38,7 @@ void QgsTileScaleWidget::layerChanged( QgsMapLayer *layer )
mResolutions.clear();
mSlider->setDisabled( true );

if ( !rl || rl->providerKey() != "wms" )
if ( !rl || rl->providerType() != "wms" )
return;

QString uri = rl->source();
@@ -1994,7 +1994,7 @@ void QgsRasterLayer::populateHistogram( int theBandNo, int theBinCount, bool the
mDataProvider->populateHistogram( theBandNo, myRasterBandStats, theBinCount, theIgnoreOutOfRangeFlag, theHistogramEstimatedFlag );
}

QString QgsRasterLayer::providerKey() const
QString QgsRasterLayer::providerType() const
{
if ( mProviderKey.isEmpty() )
{
@@ -397,8 +397,10 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief Accessor for transparent band name mapping */
QString transparentBandName() const { return mTransparencyBandName; }

/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data? */
bool usesProvider();
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data?
* @deprecated in 2.0
*/
Q_DECL_DEPRECATED bool usesProvider();

/** \brief Accessor that returns the width of the (unclipped) raster */
int width() { return mWidth; }
@@ -546,8 +548,15 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
QPixmap paletteAsPixmap( int theBandNumber = 1 );

/** \brief [ data provider interface ] Which provider is being used for this Raster Layer? */
QString providerKey() const;
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
* @note added in 2.0
*/
QString providerType() const;

/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
* @deprecated use providerType()
*/
Q_DECL_DEPRECATED QString providerKey() const { return providerType(); }

/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixel();

0 comments on commit 6ccb04e

Please sign in to comment.
You can’t perform that action at this time.