Skip to content

Commit

Permalink
Provide the enhancement in ticket #207 (option of whether to
Browse files Browse the repository at this point in the history
ask the user to save a project when exiting, etc).


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6381 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jan 2, 2007
1 parent 6185a19 commit 3339af5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/gui/qgisapp.cpp
Expand Up @@ -4391,7 +4391,7 @@ void QgisApp::setExtent(QgsRect theRect)

int QgisApp::saveDirty()
{
int answer = 0;
int answer(QMessageBox::No);
mMapCanvas->freeze(true);

#ifdef QGISDEBUG
Expand All @@ -4418,7 +4418,10 @@ int QgisApp::saveDirty()
}
#endif

if ((QgsProject::instance()->dirty() || (mMapCanvas->isDirty()) && mMapCanvas->layerCount() > 0))
QSettings settings;
bool askThem = settings.value("qgis/askToSaveProjectChanges", true).toBool();

if (askThem && (QgsProject::instance()->dirty() || (mMapCanvas->isDirty()) && mMapCanvas->layerCount() > 0))
{
// flag project as dirty since dirty state of canvas is reset if "dirty"
// is based on a zoom or pan
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgsoptions.cpp
Expand Up @@ -130,6 +130,8 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
pbnMeasureColour->setColor( QColor(myRed,myGreen,myBlue) );

capitaliseCheckBox->setChecked(settings.value("qgis/capitaliseLayerName", QVariant(false)).toBool());

chbAskToSaveProjectChanges->setChecked(settings.value("qgis/askToSaveProjectChanges", QVariant(true)).toBool());

cmbWheelAction->setCurrentIndex(settings.value("/qgis/wheel_action", 0).toInt());
spinZoomFactor->setValue(settings.value("/qgis/zoom_factor", 2).toDouble());
Expand Down Expand Up @@ -189,6 +191,7 @@ void QgsOptions::saveOptions()
settings.writeEntry("/qgis/enable_anti_aliasing",chkAntiAliasing->isChecked());
settings.writeEntry("/qgis/use_qimage_to_render", !(chkUseQPixmap->isChecked()));
settings.setValue("qgis/capitaliseLayerName", capitaliseCheckBox->isChecked());
settings.setValue("qgis/askToSaveProjectChanges", chbAskToSaveProjectChanges->isChecked());

if(cmbTheme->currentText().length() == 0)
{
Expand Down
56 changes: 52 additions & 4 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>590</width>
<height>454</height>
<height>463</height>
</rect>
</property>
<property name="windowTitle" >
Expand All @@ -31,8 +31,56 @@
<item row="0" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabGeneral" >
<attribute name="title" >
<string>&amp;General</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_11" >
<property name="title" >
<string>General</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="chbAskToSaveProjectChanges" >
<property name="text" >
<string>Ask to save project changes when required</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAppearance" >
<attribute name="title" >
<string>&amp;Appearance</string>
Expand Down Expand Up @@ -258,7 +306,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<widget class="QWidget" name="tabRendering" >
<attribute name="title" >
<string>&amp;Rendering</string>
</attribute>
Expand Down Expand Up @@ -603,7 +651,7 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<widget class="QWidget" name="tabProjection" >
<attribute name="title" >
<string>Pro&amp;jection</string>
</attribute>
Expand Down

0 comments on commit 3339af5

Please sign in to comment.