Skip to content
Permalink
Browse files
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 0595f746a03246daff94d4ab202c23a4d8a9215b
Showing with 48 additions and 16 deletions.
  1. +22 −2 src/app/qgsoptions.cpp
  2. +5 −0 src/app/qgsoptions.h
  3. +21 −14 src/ui/qgsoptionsbase.ui
@@ -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( '|' ) );
@@ -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 )
{
@@ -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(
@@ -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
@@ -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>
@@ -1751,7 +1758,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>554</width>
<height>717</height>
</rect>
</property>
@@ -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">
@@ -2192,7 +2199,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>583</width>
<height>618</height>
</rect>
</property>
@@ -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">
@@ -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">
@@ -2852,7 +2859,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<width>491</width>
<height>598</height>
</rect>
</property>
@@ -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>

0 comments on commit 0595f74

Please sign in to comment.