Skip to content

Commit

Permalink
UI tweaks to make Tim happier
Browse files Browse the repository at this point in the history
Command list saved to user settings
Clear command list button added
Removed some dead code


git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6806 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gsherman committed Mar 16, 2007
1 parent 127dfab commit f1a36f9
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 111 deletions.
12 changes: 1 addition & 11 deletions src/plugins/launcher/qgslauncherplugin.cpp
Expand Up @@ -97,13 +97,10 @@ void QgsLauncherPlugin::help()
//implement me!
}

// Slot called when the buffer menu item is activated
// Slot called when the run button is pushed
void QgsLauncherPlugin::run()
{
QgsLauncherPluginGui *myPluginGui=new QgsLauncherPluginGui(qgisMainWindowPointer,"Run...",true,0);
//listen for when the layer has been made so we can draw it
connect(myPluginGui, SIGNAL(drawRasterLayer(QString)), this, SLOT(drawRasterLayer(QString)));
connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)), this, SLOT(drawVectorLayer(QString,QString,QString)));
myPluginGui->show();
}
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
Expand All @@ -112,13 +109,6 @@ void QgsLauncherPlugin::drawRasterLayer(QString theQString)
{
qGisInterface->addRasterLayer(theQString);
}
//!draw a vector layer in the qui - intended to respond to signal sent by diolog when it as finished creating a layer
////needs to be given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
void QgsLauncherPlugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
{
qGisInterface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
}

// Unload the plugin by cleaning up the GUI
void QgsLauncherPlugin::unload()
{
Expand Down
15 changes: 10 additions & 5 deletions src/plugins/launcher/qgslauncherplugingui.cpp
Expand Up @@ -32,12 +32,12 @@ QgsLauncherPluginGui::QgsLauncherPluginGui( QWidget* parent ,
setupUi(this);
// populate the combobox from the settings file
QSettings settings;
int count = settings.readNumEntry("/qgis/launcher_plugin/command_count");
int count = settings.readNumEntry("launcher_plugin/command_count");
QString commandNum;
for(int i=0; i < count; i++)
{
// std::cerr << "Reading key /qgis/launcher_plugin/" << commandNum.setNum(i) << std::endl;
cmbCommands->insertItem(settings.readEntry("/qgis/launcher_plugin/command"
cmbCommands->insertItem(settings.readEntry("launcher_plugin/command"
+ commandNum.setNum(i)));
}
// Set flag to indicate first run is pending
Expand Down Expand Up @@ -82,7 +82,7 @@ void QgsLauncherPluginGui::runProgram()


// add the program to the combo list
// cmbCommands->insertItem(cmbCommands->currentText(), 0);
cmbCommands->insertItem(cmbCommands->currentText(), 0);
// If this is first time around, remove the default tab
if(firstRun)
{
Expand Down Expand Up @@ -159,14 +159,19 @@ void QgsLauncherPluginGui::cleanUp()
// Write out the command list to the settings file and then exit
QSettings settings;

settings.writeEntry("/qgis/launcher_plugin/command_count",
settings.writeEntry("launcher_plugin/command_count",
cmbCommands->count());
// write the commands in the combo box to the settings file (~/.qt/qgisrc)
for(int i = 0; i < cmbCommands->count(); i++)
{
QString commandNumber;
settings.writeEntry("/qgis/launcher_plugin/command"
settings.writeEntry("launcher_plugin/command"
+ commandNumber.setNum(i), cmbCommands->text(i));
}
reject();
}

void QgsLauncherPluginGui::on_btnClearCommandList_clicked()
{
cmbCommands->clear();
}
2 changes: 2 additions & 0 deletions src/plugins/launcher/qgslauncherplugingui.h
Expand Up @@ -47,6 +47,8 @@ public slots:
void processError(QProcess::ProcessError);
//! Slot to save the previous command list and close the dialog
void cleanUp();
//! Slot to clear the command list
void on_btnClearCommandList_clicked();

private:
//! QProcess object used to launch a program
Expand Down
178 changes: 83 additions & 95 deletions src/plugins/launcher/qgslauncherpluginguibase.ui
Expand Up @@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>294</height>
<width>476</width>
<height>307</height>
</rect>
</property>
<property name="windowTitle" >
Expand All @@ -22,123 +22,63 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="textLabel1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:12pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;">&lt;span style=" font-size:11pt;">Run an External Command or Program&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>21</width>
<width>221</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<item row="3" column="2" >
<widget class="QPushButton" name="pbnCancel" >
<property name="maximumSize" >
<size>
<width>91</width>
<width>62</width>
<height>25</height>
</size>
</property>
</spacer>
<property name="text" >
<string>&amp;Close</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="QTabWidget" name="tabOutput" >
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="textLabel1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Output</string>
</attribute>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="Q3TextEdit" name="txtOutput" >
<property name="font" >
<font>
<family>Bitstream Vera Sans Mono</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="textFormat" >
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap" >
<enum>Q3TextEdit::NoWrap</enum>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="pbnCancel" >
<property name="maximumSize" >
<property name="minimumSize" >
<size>
<width>62</width>
<height>25</height>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>&amp;Close</string>
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:12pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;">&lt;span style=" font-size:10pt;">Run an External Command or Program&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4" >
<item row="1" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
Expand Down Expand Up @@ -194,8 +134,8 @@ p, li { white-space: pre-wrap; }
<widget class="QPushButton" name="btnRun" >
<property name="maximumSize" >
<size>
<width>26</width>
<height>26</height>
<width>49</width>
<height>41</height>
</size>
</property>
<property name="toolTip" >
Expand All @@ -205,10 +145,7 @@ p, li { white-space: pre-wrap; }
<string>Run the selected program/command and display the output</string>
</property>
<property name="text" >
<string>Run</string>
</property>
<property name="icon" >
<iconset>icon.xpm</iconset>
<string>Run</string>
</property>
<property name="default" >
<bool>true</bool>
Expand All @@ -217,6 +154,57 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="2" column="0" colspan="3" >
<widget class="QTabWidget" name="tabOutput" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Output</string>
</attribute>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="Q3TextEdit" name="txtOutput" >
<property name="font" >
<font>
<family>Bitstream Vera Sans Mono</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="textFormat" >
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap" >
<enum>Q3TextEdit::NoWrap</enum>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="btnClearCommandList" >
<property name="text" >
<string>Clear Command List</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
Expand Down

0 comments on commit f1a36f9

Please sign in to comment.