Skip to content

Commit

Permalink
In progress...
Browse files Browse the repository at this point in the history
Implemented global selection colour and canvas colour default options in qgsoptions.
Still needs to be wired up in qgisapp so that these defaults are used where applicable.


git-svn-id: http://svn.osgeo.org/qgis/trunk@4672 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 12, 2006
1 parent 0b6ee77 commit 1a0a842
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 6 deletions.
38 changes: 38 additions & 0 deletions src/gui/qgsoptions.cpp
Expand Up @@ -24,6 +24,7 @@
#include "qgssvgcache.h"
#include <QFileDialog>
#include <QSettings>
#include <QColorDialog>
#include <cassert>
#include <iostream>
#include <sqlite3.h>
Expand Down Expand Up @@ -96,11 +97,38 @@ QgsOptions::QgsOptions(QWidget *parent, const char *name, bool modal) :
chkAntiAliasing->setChecked(settings.value("/qgis/enable_anti_aliasing").toBool());
chkAddedVisibility->setChecked(!settings.value("/qgis/new_layers_visible").toBool());
cbxHideSplash->setChecked(settings.value("/qgis/hideSplash").toBool());
//set the colour for selections
int myRed = settings.value("/qgis/default_selection_color_red",255).toInt();
int myGreen = settings.value("/qgis/default_selection_color_green",255).toInt();
int myBlue = settings.value("/qgis/default_selection_color_blue",255).toInt();
pbnSelectionColour->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
//set teh default color for canvas background
myRed = settings.value("/qgis/default_canvas_color_red",255).toInt();
myGreen = settings.value("/qgis/default_canvas_color_green",255).toInt();
myBlue = settings.value("/qgis/default_canvas_color_blue",255).toInt();
pbnCanvasColor->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
}

//! Destructor
QgsOptions::~QgsOptions(){}

void QgsOptions::on_pbnSelectionColour_clicked()
{
QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
if (color.isValid())
{
pbnSelectionColour->setPaletteBackgroundColor(color);
}
}

void QgsOptions::on_pbnCanvasColor_clicked()
{
QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
if (color.isValid())
{
pbnCanvasColor->setPaletteBackgroundColor(color);
}
}
void QgsOptions::themeChanged(const QString &newThemeName)
{
// Slot to change the theme as user scrolls through the choices
Expand Down Expand Up @@ -150,6 +178,16 @@ void QgsOptions::saveOptions()
settings.writeEntry("/Projections/defaultProjectionSRSID",(int)mGlobalSRSID);

settings.writeEntry("/qgis/measure/ellipsoid", getEllipsoidAcronym(cmbEllipsoid->currentText()));
//set the colour for selections
QColor myColor = pbnSelectionColour->paletteBackgroundColor();
int myRed = settings.writeEntry("/qgis/default_selection_color_red",myColor.red());
int myGreen = settings.writeEntry("/qgis/default_selection_color_green",myColor.green());
int myBlue = settings.writeEntry("/qgis/default_selection_color_blue",myColor.blue());
//set teh default color for canvas background
myColor = pbnCanvasColor->paletteBackgroundColor();
myRed = settings.writeEntry("/qgis/default_canvas_color_red",myColor.red());
myGreen = settings.writeEntry("/qgis/default_canvas_color_green",myColor.green());
myBlue = settings.writeEntry("/qgis/default_canvas_color_blue",myColor.blue());

//all done
accept();
Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgsoptions.h
Expand Up @@ -57,6 +57,15 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
* true.
*/
bool newVisible();
/*!
* Slot to select the default map selection colour
*/
void on_pbnSelectionColour_clicked();

/*!
* Slot to select the default map selection colour
*/
void on_pbnCanvasColor_clicked();
protected:
//! Populates combo box with ellipsoids
void getEllipsoidList();
Expand Down
67 changes: 61 additions & 6 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -41,7 +41,7 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
Expand All @@ -54,10 +54,10 @@
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox_9" >
<property name="title" >
<string>&amp;Splash screen</string>
<string>Default Map Appearance (Overridden by project properties)</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
Expand All @@ -66,10 +66,43 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Background Color:</string>
</property>
<property name="buddy" >
<cstring>pbnCanvasColor</cstring>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QToolButton" name="pbnCanvasColor" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QToolButton" name="pbnSelectionColour" >
<property name="minimumSize" >
<size>
<width>10</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="cbxHideSplash" >
<widget class="QLabel" name="textLabel1_9" >
<property name="text" >
<string>Hide splash screen at startup</string>
<string>Selection Color:</string>
</property>
<property name="buddy" >
<cstring>pbnSelectionColour</cstring>
</property>
</widget>
</item>
Expand Down Expand Up @@ -141,6 +174,28 @@
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>&amp;Splash screen</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="cbxHideSplash" >
<property name="text" >
<string>Hide splash screen at startup</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
Expand Down

0 comments on commit 1a0a842

Please sign in to comment.