[QGIS Commit] r14778 - in trunk/qgis/src: app ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 28 12:23:08 EST 2010


Author: jef
Date: 2010-11-28 09:23:07 -0800 (Sun, 28 Nov 2010)
New Revision: 14778

Modified:
   trunk/qgis/src/app/qgsprojectproperties.cpp
   trunk/qgis/src/app/qgsprojectproperties.h
   trunk/qgis/src/app/qgssnappingdialog.cpp
   trunk/qgis/src/app/qgssnappingdialog.h
   trunk/qgis/src/ui/qgsprojectpropertiesbase.ui
   trunk/qgis/src/ui/qgssnappingdialogbase.ui
Log:
apply #3258

Modified: trunk/qgis/src/app/qgsprojectproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.cpp	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/app/qgsprojectproperties.cpp	2010-11-28 17:23:07 UTC (rev 14778)
@@ -107,29 +107,6 @@
   myColor = QColor( myRedInt, myGreenInt, myBlueInt );
   pbnCanvasColor->setColor( myColor );
 
-  //read the digitizing settings
-  int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
-  if ( topologicalEditing != 0 )
-  {
-    mEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
-  }
-  else
-  {
-    mEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
-  }
-
-  bool avoidIntersectionListOk;
-  mAvoidIntersectionsSettings.clear();
-  QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
-  if ( avoidIntersectionListOk )
-  {
-    QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
-    for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
-    {
-      mAvoidIntersectionsSettings.insert( *avoidIt );
-    }
-  }
-
   QgsMapLayer* currentLayer = 0;
 
   QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
@@ -325,20 +302,6 @@
   QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() );
   QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() );
 
-  //write the digitizing settings
-  int topologicalEditingEnabled = ( mEnableTopologicalEditingCheckBox->checkState() == Qt::Checked ) ? 1 : 0;
-  QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );
-
-  //store avoid intersection layers
-  QStringList avoidIntersectionList;
-  QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
-  for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
-  {
-    avoidIntersectionList.append( *avoidIt );
-  }
-  QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );
-
-
   QStringList noIdentifyLayerList;
   for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ )
   {
@@ -389,16 +352,6 @@
   }
 }
 
-void QgsProjectProperties::on_mAvoidIntersectionsPushButton_clicked()
-{
-  QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
-  if ( d.exec() == QDialog::Accepted )
-  {
-    d.enabledLayers( mAvoidIntersectionsSettings );
-  }
-}
-
-
 void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
 {
   btnGrpMapUnits->setEnabled( state == Qt::Unchecked );

Modified: trunk/qgis/src/app/qgsprojectproperties.h
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.h	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/app/qgsprojectproperties.h	2010-11-28 17:23:07 UTC (rev 14778)
@@ -89,11 +89,6 @@
      */
     void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
 
-    /*!
-      *
-      */
-    void on_mAvoidIntersectionsPushButton_clicked();
-
     void on_cbxProjectionEnabled_stateChanged( int state );
 
     /*!
@@ -112,9 +107,6 @@
   private:
     QgsMapCanvas* mMapCanvas;
 
-    /**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
-    QSet<QString> mAvoidIntersectionsSettings;
-
     /*!
      * Function to save dialog window state
      */

Modified: trunk/qgis/src/app/qgssnappingdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgssnappingdialog.cpp	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/app/qgssnappingdialog.cpp	2010-11-28 17:23:07 UTC (rev 14778)
@@ -16,12 +16,14 @@
  ***************************************************************************/
 
 #include "qgssnappingdialog.h"
+#include "qgsavoidintersectionsdialog.h"
 #include "qgsmapcanvas.h"
 #include "qgsmaplayer.h"
 #include "qgsvectorlayer.h"
 #include "qgsmaplayerregistry.h"
 #include "qgisapp.h"
 #include "qgsproject.h"
+#include "qgslogger.h"
 #include <QCheckBox>
 #include <QDoubleValidator>
 #include <QComboBox>
@@ -36,7 +38,7 @@
     QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
         : QDockWidget( title, parent, flags )
     {
-      setObjectName( "Snapping Options" ); // set object name so the position can be saved
+      setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved
     }
 
     virtual void closeEvent( QCloseEvent * ev )
@@ -54,7 +56,7 @@
   bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool();
   if ( myDockFlag )
   {
-    mDock = new QgsSnappingDock( tr( "Snapping Options" ), QgisApp::instance() );
+    mDock = new QgsSnappingDock( tr( "Snapping and Digitizing Options" ), QgisApp::instance() );
     mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
     mDock->setWidget( this );
     connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
@@ -67,6 +69,7 @@
     connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
   }
   connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( connectUpdate( QgsMapLayer * ) ) );
+  connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ) ) );
 
   update();
 
@@ -87,6 +90,29 @@
 {
 }
 
+void QgsSnappingDialog::on_cbxEnableTopologicalEditingCheckBox_stateChanged( int state )
+{
+  int topologicalEditingEnabled = ( state == Qt::Checked ) ? 1 : 0;
+  QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );
+}
+
+void QgsSnappingDialog::on_mAvoidIntersectionsPushButton_clicked()
+{
+  QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
+  if ( d.exec() == QDialog::Accepted )
+  {
+    d.enabledLayers( mAvoidIntersectionsSettings );
+    //store avoid intersection layers
+    QStringList avoidIntersectionList;
+    QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
+    for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
+    {
+      avoidIntersectionList.append( *avoidIt );
+    }
+    QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );
+  }
+}
+
 void QgsSnappingDialog::closeEvent( QCloseEvent* event )
 {
   QDialog::closeEvent( event );
@@ -201,6 +227,29 @@
     cbxUnits->setCurrentIndex( toleranceUnitList[idx].toInt() );
   }
 
+  // read the digitizing settings
+  int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
+  if ( topologicalEditing != 0 )
+  {
+    cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
+  }
+  else
+  {
+    cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
+  }
+
+  bool avoidIntersectionListOk;
+  mAvoidIntersectionsSettings.clear();
+  QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
+  if ( avoidIntersectionListOk )
+  {
+    QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
+    for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
+    {
+      mAvoidIntersectionsSettings.insert( *avoidIt );
+    }
+  }
+
   if ( myDockFlag )
   {
     for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i )

Modified: trunk/qgis/src/app/qgssnappingdialog.h
===================================================================
--- trunk/qgis/src/app/qgssnappingdialog.h	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/app/qgssnappingdialog.h	2010-11-28 17:23:07 UTC (rev 14778)
@@ -48,11 +48,15 @@
     //! connect to the layers destroyed() and then update()
     void connectUpdate( QgsMapLayer* theMapLayer );
 
+    void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int );
+    void on_mAvoidIntersectionsPushButton_clicked();
+
   protected:
     /**Constructor
     @param canvas pointer to the map canvas (for detecting which vector layers are loaded
     */
     //QgsSnappingDialog( QgsMapCanvas* canvas );
+
     /**
      * Handle closing of the window
      * @param event unused
@@ -64,6 +68,9 @@
     /**Default constructor forbidden*/
     QgsSnappingDialog();
 
+    /**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
+    QSet<QString> mAvoidIntersectionsSettings;
+
     /**Used to query the loaded layers*/
     QgsMapCanvas* mMapCanvas;
 

Modified: trunk/qgis/src/ui/qgsprojectpropertiesbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsprojectpropertiesbase.ui	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/ui/qgsprojectpropertiesbase.ui	2010-11-28 17:23:07 UTC (rev 14778)
@@ -23,7 +23,7 @@
    <item row="0" column="0">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>1</number>
+      <number>0</number>
      </property>
      <property name="iconSize">
       <size>
@@ -285,35 +285,6 @@
          </layout>
         </widget>
        </item>
-       <item row="3" column="0">
-        <widget class="QGroupBox" name="grpDigitizing">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="title">
-          <string>Digitizing</string>
-         </property>
-         <layout class="QGridLayout" name="gridLayout_1">
-          <item row="0" column="0">
-           <widget class="QCheckBox" name="mEnableTopologicalEditingCheckBox">
-            <property name="text">
-             <string>Enable topological editing</string>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="0">
-           <widget class="QPushButton" name="mAvoidIntersectionsPushButton">
-            <property name="text">
-             <string>Avoid intersections of new polygons...</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab2">
@@ -422,8 +393,6 @@
   <tabstop>radAutomatic</tabstop>
   <tabstop>radManual</tabstop>
   <tabstop>spinBoxDP</tabstop>
-  <tabstop>mEnableTopologicalEditingCheckBox</tabstop>
-  <tabstop>mAvoidIntersectionsPushButton</tabstop>
   <tabstop>cbxProjectionEnabled</tabstop>
   <tabstop>twIdentifyLayers</tabstop>
   <tabstop>tabWidget</tabstop>

Modified: trunk/qgis/src/ui/qgssnappingdialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgssnappingdialogbase.ui	2010-11-28 17:22:46 UTC (rev 14777)
+++ trunk/qgis/src/ui/qgssnappingdialogbase.ui	2010-11-28 17:23:07 UTC (rev 14778)
@@ -13,14 +13,8 @@
   <property name="windowTitle">
    <string>Snapping options</string>
   </property>
-  <layout class="QGridLayout">
-   <property name="margin">
-    <number>9</number>
-   </property>
-   <property name="spacing">
-    <number>6</number>
-   </property>
-   <item row="0" column="0">
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
     <widget class="QTreeWidget" name="mLayerTreeWidget">
      <property name="indentation">
       <number>0</number>
@@ -55,7 +49,31 @@
      </column>
     </widget>
    </item>
-   <item row="1" column="0">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QCheckBox" name="cbxEnableTopologicalEditingCheckBox">
+       <property name="text">
+        <string>Enable topological editing</string>
+       </property>
+       <property name="checked">
+        <bool>false</bool>
+       </property>
+       <property name="tristate">
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="mAvoidIntersectionsPushButton">
+       <property name="text">
+        <string>Avoid intersections of new polygons...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
     <widget class="QDialogButtonBox" name="mButtonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>



More information about the QGIS-commit mailing list