Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add checkbox to filter non-QGIS-specific vars from current env vars t…
…able
  • Loading branch information
dakcarto committed Jan 5, 2013
1 parent 8d582ad commit 0595f74
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
24 changes: 22 additions & 2 deletions src/app/qgsoptions.cpp
Expand Up @@ -121,7 +121,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
mCustomVariablesTable->setEnabled( false );
}
QStringList customVarsList = settings.value( "qgis/customEnvVars", "" ).toStringList();
mCustomVariablesTable->clearContents();
foreach ( const QString &varStr, customVarsList )
{
int pos = varStr.indexOf( QLatin1Char( '|' ) );
Expand Down Expand Up @@ -155,7 +154,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
mCurrentVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH );
QMap<QString, QString> sysVarsMap = QgsApplication::systemEnvVars();
QStringList currentVarsList = QProcess::systemEnvironment();
mCurrentVariablesTable->clearContents();

foreach ( const QString &varStr, currentVarsList )
{
Expand Down Expand Up @@ -1368,6 +1366,28 @@ void QgsOptions::on_mRemoveCustomVarBtn_clicked()
mCustomVariablesTable->removeRow( mCustomVariablesTable->currentRow() );
}

void QgsOptions::on_mCurrentVariablesQGISChxBx_toggled( bool qgisSpecific )
{
for ( int i = mCurrentVariablesTable->rowCount() - 1; i >= 0; --i )
{
if ( qgisSpecific )
{
QString itmTxt = mCurrentVariablesTable->item( i, 0 )->text();
if ( !itmTxt.startsWith( "QGIS", Qt::CaseInsensitive ) )
mCurrentVariablesTable->hideRow( i );
}
else
{
mCurrentVariablesTable->showRow( i );
}
}
if ( mCurrentVariablesTable->rowCount() > 0 )
{
mCurrentVariablesTable->sortByColumn( 0, Qt::AscendingOrder );
mCurrentVariablesTable->resizeColumnToContents( 0 );
}
}

void QgsOptions::on_mBtnAddPluginPath_clicked()
{
QString myDir = QFileDialog::getExistingDirectory(
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsoptions.h
Expand Up @@ -127,6 +127,11 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/
void on_mRemoveCustomVarBtn_clicked();

/** Slot to filter out current environment variables not specific to QGIS
* @note added in QGIS 1.9
*/
void on_mCurrentVariablesQGISChxBx_toggled( bool qgisSpecific );

/* Let the user add a path to the list of search paths
* used for finding user Plugin libs.
* @note added in QGIS 1.7
Expand Down
35 changes: 21 additions & 14 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -1133,6 +1133,13 @@
</column>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mCurrentVariablesQGISChxBx">
<property name="text">
<string>Show only QGIS-specific variables</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1751,7 +1758,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>554</width>
<height>717</height>
</rect>
</property>
Expand Down Expand Up @@ -2111,8 +2118,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>786</width>
<height>588</height>
<width>307</width>
<height>96</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_10">
Expand Down Expand Up @@ -2192,7 +2199,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>583</width>
<height>618</height>
</rect>
</property>
Expand Down Expand Up @@ -2568,8 +2575,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>786</width>
<height>588</height>
<width>618</width>
<height>417</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
Expand Down Expand Up @@ -2755,8 +2762,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>786</width>
<height>588</height>
<width>525</width>
<height>571</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_17">
Expand Down Expand Up @@ -2852,7 +2859,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>491</width>
<height>598</height>
</rect>
</property>
Expand Down Expand Up @@ -3093,17 +3100,17 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
Expand Down

0 comments on commit 0595f74

Please sign in to comment.