Subclassed options dialog to add theme capability

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@1491 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2004-05-29 00:18:11 +00:00
parent 9563631900
commit d0b5e4506c
2 changed files with 113 additions and 0 deletions

61
src/qgsoptions.cpp Normal file
View File

@ -0,0 +1,61 @@
/***************************************************************************
qgsoptions.cpp
Set user options and preferences
-------------------
begin : May 28, 2004
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#include <qsettings.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include "qgsoptions.h"
#include "qgisapp.h"
/**
* \class QgsOptions - Set user options and preferences
* Constructor
*/
QgsOptions::QgsOptions(QWidget *parent, const char *name) : QgsOptionsBase(parent, name)
{
qparent = parent;
// read the current browser and set it
QSettings settings;
QString browser = settings.readEntry("/qgis/browser");
cmbBrowser->setCurrentText(browser);
// set the show splash option
int identifyValue = settings.readNumEntry("/qgis/map/identifyRadius");
spinBoxIdentifyValue->setValue(identifyValue);
bool hideSplashFlag = false;
if (settings.readEntry("/qgis/hideSplash")=="true")
{
hideSplashFlag =true;
}
cbxHideSplash->setChecked(hideSplashFlag);
// set the current theme
cmbTheme->setCurrentText(settings.readEntry("/qgis/theme"));
}
//! Destructor
QgsOptions::~QgsOptions(){}
void QgsOptions::themeChanged(const QString &newThemeName)
{
// Slot to change the theme as user scrolls through the choices
QString newt = newThemeName;
((QgisApp*)qparent)->setTheme(newt);
}
QString QgsOptions::theme()
{
// returns the current theme (as selected in the cmbTheme combo box)
return cmbTheme->currentText();
}

52
src/qgsoptions.h Normal file
View File

@ -0,0 +1,52 @@
/***************************************************************************
qgsoptions.h
Set user options and preferences
-------------------
begin : May 28, 2004
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSOPTIONS_H
#define QGSOPTIONS_H
class QString;
#include "qgsoptionsbase.uic.h"
/**
* \class QgsOptions
* \brief Set user options and preferences
*/
class QgsOptions :public QgsOptionsBase{
Q_OBJECT;
public:
/**
* Constructor
* @param parent Parent widget (usually a QgisApp)
* @param name name for the widget
*/
QgsOptions(QWidget *parent=0, const char *name=0);
//! Destructor
~QgsOptions();
/**
* Return the currently selected theme
* @return theme name (a directory name in the themes directory)
*/
QString theme();
public slots:
//! Slot to change the theme this is handled when the user
// activates or highlights a theme name in the drop-down list
void themeChanged(const QString &);
private:
//! Pointer to our parent
QWidget *qparent;
};
#endif // #ifndef QGSOPTIONS_H