Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reorganize Options dialog
- Add Data Sources, Canvas/Legend sections
- Fix excess whitespace issue for list widget pane in QtDesigner and QGIS
- Switch GDAL drive table load to on current page name
  • Loading branch information
dakcarto committed Jan 17, 2013
1 parent a928d51 commit bfb2b7a
Show file tree
Hide file tree
Showing 3 changed files with 1,581 additions and 1,227 deletions.
29 changes: 22 additions & 7 deletions src/app/qgsoptions.cpp
Expand Up @@ -104,6 +104,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

// read the current browser and set it
QSettings settings;
// mOptionsListWidget width is fixed to takes up less space in QtDesigner
// revert it now unless the splitter's state hasn't been saved yet
mOptionsListWidget->setMaximumWidth(
settings.value( "/Windows/Options/splitState" ).isNull() ? 150 : 16777215 );

int identifyMode = settings.value( "/Map/identifyMode", 0 ).toInt();
cmbIdentifyMode->setCurrentIndex( cmbIdentifyMode->findData( identifyMode ) );
cbxAutoFeatureForm->setChecked( settings.value( "/Map/identifyAutoFeatureForm", false ).toBool() );
Expand Down Expand Up @@ -444,7 +449,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cmbIconSize->setCurrentIndex( cmbIconSize->findText( settings.value( "/IconSize", QGIS_ICON_SIZE ).toString() ) );

// set font size and family
blockSignals( true );
// TODO: move all stylesheet options blockSignals to separate method when implementing app stylesheet
spinFontSize->blockSignals( true );
mFontFamilyRadioQt->blockSignals( true );
mFontFamilyRadioCustom->blockSignals( true );
mFontFamilyComboBox->blockSignals( true );

spinFontSize->setValue( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() );
QString fontFamily = settings.value( "/fontFamily", QVariant( "QtDefault" ) ).toString();
bool isQtDefault = ( fontFamily == QString( "QtDefault" ) );
Expand All @@ -460,7 +470,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
}
delete tempFont;
}
blockSignals( false );
spinFontSize->blockSignals( false );
mFontFamilyRadioQt->blockSignals( false );
mFontFamilyRadioCustom->blockSignals( false );
mFontFamilyComboBox->blockSignals( false );

mMessageTimeoutSpnBx->setValue( settings.value( "/qgis/messageTimeout", 5 ).toInt() );

Expand Down Expand Up @@ -718,9 +731,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

// load gdal driver list only when gdal tab is first opened
mLoadedGdalDriverList = false;

// update option section frame state
on_mOptionsListWidget_currentRowChanged( currentIndx );
}

//! Destructor
Expand All @@ -735,6 +745,7 @@ QgsOptions::~QgsOptions()
void QgsOptions::showEvent( QShowEvent * e )
{
Q_UNUSED( e );
on_mOptionsStackedWidget_currentChanged( -1 );
updateVerticalTabs();
}

Expand All @@ -746,6 +757,8 @@ void QgsOptions::paintEvent( QPaintEvent * e )

void QgsOptions::updateVerticalTabs()
{
if ( mOptionsListWidget->maximumWidth() != 16777215 )
mOptionsListWidget->setMaximumWidth( 16777215 );
// auto-resize splitter for vert scrollbar without covering icons in icon-only mode
// TODO: mOptionsListWidget has fixed 32px wide icons for now, allow user-defined
// Note: called on splitter resize and dialog paint event, so only update when necessary
Expand Down Expand Up @@ -1539,10 +1552,12 @@ void QgsOptions::on_mClearCache_clicked()
#endif
}

void QgsOptions::on_mOptionsListWidget_currentRowChanged( int theIndx )
void QgsOptions::on_mOptionsStackedWidget_currentChanged( int theIndx )
{
Q_UNUSED( theIndx );
// load gdal driver list when gdal tab is first opened
if ( theIndx == 2 && ! mLoadedGdalDriverList )
if ( mOptionsStackedWidget->currentWidget()->objectName() == QString( "mOptionsPage_02" )
&& ! mLoadedGdalDriverList )
{
loadGdalDriverList();
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsoptions.h
Expand Up @@ -194,10 +194,10 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/
void on_pbnExportScales_clicked();

/** Auto slot executed when the active item in the option section list widget is changed
/** Auto slot executed when the active page in the option section widget is changed
* @note added in 1.9
*/
void on_mOptionsListWidget_currentRowChanged( int theIndx );
void on_mOptionsStackedWidget_currentChanged( int theIndx );

/** Slot to update widget of vertical tabs
* @note added in QGIS 1.9
Expand Down

0 comments on commit bfb2b7a

Please sign in to comment.