Skip to content

Commit d0f1190

Browse files
author
timlinux
committedJan 12, 2006
Moved some options logic out of qgisapp into qgsoptions
Added a checkbox for anti-aliasing (not wired in yet) Got rid of path calcs in favour of qgsapplication::foo() git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4660 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

5 files changed

+45
-34
lines changed

5 files changed

+45
-34
lines changed
 

‎src/gui/qgisapp.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4551,29 +4551,14 @@ void QgisApp::socketReadyRead()
45514551
void QgisApp::options()
45524552
{
45534553
QgsOptions *optionsDialog = new QgsOptions(this);
4554-
4555-
// add the themes to the combo box on the option dialog
4556-
QDir themeDir(mAppDir + "/share/qgis/themes");
4557-
themeDir.setFilter(QDir::Dirs);
4558-
QStringList dirs = themeDir.entryList("*");
4559-
for(int i=0; i < dirs.count(); i++)
4560-
{
4561-
if(dirs[i] != "." && dirs[i] != "..")
4562-
{
4563-
optionsDialog->addTheme(dirs[i]);
4564-
}
4565-
}
4566-
optionsDialog->setCurrentTheme();
45674554
if(optionsDialog->exec())
45684555
{
45694556
// set the theme if it changed
45704557
setTheme(optionsDialog->theme());
45714558
setupToolbarPopups(optionsDialog->theme());
4572-
45734559
// set the visible flag for new layers
45744560
mAddedLayersHidden = optionsDialog->newVisible();
45754561
}
4576-
45774562
}
45784563

45794564
void QgisApp::helpContents()

‎src/gui/qgsoptions.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* *
1717
***************************************************************************/
1818
/* $Id$ */
19+
#include "qgsapplication.h"
1920
#include "qgsoptions.h"
2021
#include "qgis.h"
2122
#include "qgisapp.h"
@@ -82,10 +83,22 @@ QgsOptions::QgsOptions(QWidget *parent, const char *name, bool modal) :
8283
txtGlobalWKT->setText(myProjString);
8384

8485
// populate combo box with ellipsoids
85-
mQGisSettingsDir = QDir::homeDirPath () + "/.qgis/";
8686
getEllipsoidList();
8787
QString myEllipsoidId = settings.readEntry("/qgis/measure/ellipsoid", "WGS84");
8888
cmbEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
89+
// add the themes to the combo box on the option dialog
90+
QDir myThemeDir(QgsApplication::themePath());
91+
myThemeDir.setFilter(QDir::Dirs);
92+
QStringList myDirList = myThemeDir.entryList("*");
93+
for(int i=0; i < myDirList.count(); i++)
94+
{
95+
if(myDirList[i] != "." && myDirList[i] != "..")
96+
{
97+
cmbTheme->insertItem(myDirList[i]);
98+
}
99+
}
100+
// set the theme combo
101+
cmbTheme->setCurrentText(settings.readEntry("/Themes","default"));
89102
}
90103

91104
//! Destructor
@@ -110,6 +123,7 @@ void QgsOptions::saveOptions()
110123
settings.writeEntry("/Map/identifyRadius", spinBoxIdentifyValue->value());
111124
settings.writeEntry("/qgis/hideSplash",cbxHideSplash->isChecked());
112125
settings.writeEntry("/qgis/new_layers_visible",!chkAddedVisibility->isChecked());
126+
settings.writeEntry("/qgis/enable_anti_aliasing",chkAntiAliasing->isChecked());
113127
if(cmbTheme->currentText().length() == 0)
114128
{
115129
settings.writeEntry("/Themes", "default");
@@ -150,18 +164,9 @@ void QgsOptions::on_cbxHideSplash_toggled( bool )
150164

151165
}
152166

153-
void QgsOptions::addTheme(QString item)
154-
{
155-
cmbTheme->insertItem(item);
156-
}
157167

158168

159169

160-
void QgsOptions::setCurrentTheme()
161-
{
162-
QSettings settings;
163-
cmbTheme->setCurrentText(settings.readEntry("/Themes","default"));
164-
}
165170

166171
void QgsOptions::on_btnFindBrowser_clicked()
167172
{
@@ -228,7 +233,7 @@ void QgsOptions::getEllipsoidList()
228233
sqlite3_stmt *myPreparedStatement;
229234
int myResult;
230235
//check the db is available
231-
myResult = sqlite3_open(QString(mQGisSettingsDir+"qgis.db").latin1(), &myDatabase);
236+
myResult = sqlite3_open(QString(QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
232237
if(myResult)
233238
{
234239
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -261,7 +266,7 @@ QString QgsOptions::getEllipsoidAcronym(QString theEllipsoidName)
261266
int myResult;
262267
QString myName;
263268
//check the db is available
264-
myResult = sqlite3_open(QString(mQGisSettingsDir+"qgis.db").latin1(), &myDatabase);
269+
myResult = sqlite3_open(QString(QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
265270
if(myResult)
266271
{
267272
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;
@@ -293,7 +298,7 @@ QString QgsOptions::getEllipsoidName(QString theEllipsoidAcronym)
293298
int myResult;
294299
QString myName;
295300
//check the db is available
296-
myResult = sqlite3_open(QString(mQGisSettingsDir+"qgis.db").latin1(), &myDatabase);
301+
myResult = sqlite3_open((QgsApplication::srsDbFilePath()+"qgis.db").latin1(), &myDatabase);
297302
if(myResult)
298303
{
299304
std::cout << "Can't open database: " << sqlite3_errmsg(myDatabase) << std::endl;

‎src/gui/qgsoptions.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,14 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
4343
QString theme();
4444

4545
public slots:
46-
//! Slot to change the theme this is handled when the user
47-
// activates or highlights a theme name in the drop-down list
48-
void themeChanged(const QString &);
4946
//! Slot called when user chooses to change the project wide projection.
5047
void on_pbnSelectProjection_clicked();
5148
void on_btnFindBrowser_clicked();
52-
void setCurrentTheme();
53-
void addTheme(QString item);
5449
void on_cbxHideSplash_toggled( bool );
5550
void saveOptions();
51+
//! Slot to change the theme this is handled when the user
52+
// activates or highlights a theme name in the drop-down list
53+
void themeChanged(const QString &);
5654

5755
/**
5856
* Return the desired state of newly added layers. If a layer
@@ -66,7 +64,6 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
6664

6765
QString getEllipsoidAcronym(QString theEllipsoidName);
6866
QString getEllipsoidName(QString theEllipsoidAcronym);
69-
QString mQGisSettingsDir;
7067

7168
private:
7269
//! Pointer to our parent

‎src/legend/qgslegend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ QgsLegend::QgsLegend(QgisApp* app, QWidget * parent, const char *name)
7171
setHeaderLabels(myList);
7272
//added by Tim to hide the header - header is unneccessary
7373
header()->setHidden(1);
74+
setRootIsDecorated(true);
75+
7476
}
7577

7678

‎src/ui/qgsoptionsbase.ui

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,28 @@
213213
<number>6</number>
214214
</property>
215215
<item row="2" column="0" >
216+
<widget class="QGroupBox" name="groupBox_8" >
217+
<property name="title" >
218+
<string>Anti-aliasing</string>
219+
</property>
220+
<layout class="QGridLayout" >
221+
<property name="margin" >
222+
<number>9</number>
223+
</property>
224+
<property name="spacing" >
225+
<number>6</number>
226+
</property>
227+
<item row="0" column="0" >
228+
<widget class="QCheckBox" name="chkAntiAliasing" >
229+
<property name="text" >
230+
<string>Make lines appear less jagged at the expense of some drawing performance</string>
231+
</property>
232+
</widget>
233+
</item>
234+
</layout>
235+
</widget>
236+
</item>
237+
<item row="3" column="0" >
216238
<spacer>
217239
<property name="orientation" >
218240
<enum>Qt::Vertical</enum>

0 commit comments

Comments
 (0)
Please sign in to comment.