Skip to content

Commit a875ca5

Browse files
author
mmassing
committed
Amend previously ommited docking feature of patch #2673.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13544 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 164caa5 commit a875ca5

File tree

4 files changed

+65
-3
lines changed

4 files changed

+65
-3
lines changed

src/plugins/georeferencer/qgsgeorefconfigdialog.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,21 @@ void QgsGeorefConfigDialog::readSettings()
7070
{
7171
mShowCoordsCheckBox->setChecked( false );
7272
}
73+
74+
if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
75+
{
76+
mShowDockedCheckBox->setChecked( true );
77+
}
78+
else
79+
{
80+
mShowDockedCheckBox->setChecked( false );
81+
}
7382
}
7483

7584
void QgsGeorefConfigDialog::writeSettings()
7685
{
7786
QSettings s;
7887
s.setValue( "/Plugin-GeoReferencer/Config/ShowId", mShowIDsCheckBox->isChecked() );
7988
s.setValue( "/Plugin-GeoReferencer/Config/ShowCoords", mShowCoordsCheckBox->isChecked() );
89+
s.setValue( "/Plugin-GeoReferencer/Config/ShowDocked", mShowDockedCheckBox->isChecked() );
8090
}

src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
<property name="title">
2020
<string>Point tip</string>
2121
</property>
22-
<layout class="QHBoxLayout" name="horizontalLayout">
23-
<item>
22+
<layout class="QGridLayout" name="gridLayout">
23+
<item row="0" column="0">
2424
<widget class="QCheckBox" name="mShowIDsCheckBox">
2525
<property name="text">
2626
<string>Show IDs</string>
2727
</property>
2828
</widget>
2929
</item>
30-
<item>
30+
<item row="1" column="0">
3131
<widget class="QCheckBox" name="mShowCoordsCheckBox">
3232
<property name="text">
3333
<string>Show coords</string>
@@ -38,6 +38,13 @@
3838
</widget>
3939
</item>
4040
<item row="1" column="0">
41+
<widget class="QCheckBox" name="mShowDockedCheckBox">
42+
<property name="text">
43+
<string>Show Georeferencer window docked</string>
44+
</property>
45+
</widget>
46+
</item>
47+
<item row="2" column="0">
4148
<widget class="QDialogButtonBox" name="buttonBox">
4249
<property name="orientation">
4350
<enum>Qt::Horizontal</enum>

src/plugins/georeferencer/qgsgeorefplugingui.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
8686
, mMapCoordsDialog( 0 )
8787
, mUseZeroForTrans( false )
8888
, mLoadInQgis( false )
89+
, mDock( 0 )
8990
{
9091
setupUi( this );
9192

@@ -104,6 +105,33 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
104105
mActionLinkQGisToGeoref->setEnabled( false );
105106

106107
mCanvas->clearExtentHistory(); // reset zoomnext/zoomlast
108+
109+
QSettings s;
110+
if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
111+
{
112+
dockThisWindow( true );
113+
}
114+
}
115+
116+
void QgsGeorefPluginGui::dockThisWindow( bool dock )
117+
{
118+
if ( mDock )
119+
{
120+
setParent( 0 );
121+
show();
122+
mIface->removeDockWidget( mDock );
123+
mDock->setWidget( 0 );
124+
delete mDock;
125+
mDock = 0;
126+
}
127+
128+
if ( dock )
129+
{
130+
mDock = new QgsGeorefDockWidget( tr( "Georeferencer" ), mIface->mainWindow() );
131+
mDock->setWidget( this );
132+
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
133+
mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock );
134+
}
107135
}
108136

109137
QgsGeorefPluginGui::~QgsGeorefPluginGui()
@@ -123,6 +151,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
123151
delete mToolAddPoint;
124152
delete mToolDeletePoint;
125153
delete mToolMovePoint;
154+
delete mDock;
126155
}
127156

128157
// ----------------------------- protected --------------------------------- //
@@ -568,6 +597,17 @@ void QgsGeorefPluginGui::showGeorefConfigDialog()
568597
{
569598
mCanvas->refresh();
570599
mIface->mapCanvas()->refresh();
600+
QSettings s;
601+
//update dock state
602+
bool dock = s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool();
603+
if ( dock && !mDock )
604+
{
605+
dockThisWindow( true );
606+
}
607+
else if ( !dock && mDock )
608+
{
609+
dockThisWindow( false );
610+
}
571611
}
572612
}
573613

src/plugins/georeferencer/qgsgeorefplugingui.h

+5
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
159159
void logRequaredGCPs();
160160
void clearGCPData();
161161

162+
/**Docks / undocks this window*/
163+
void dockThisWindow( bool dock );
164+
162165

163166
QMenu *mPanelMenu;
164167
QMenu *mToolbarMenu;
@@ -207,5 +210,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
207210
bool mExtentsChangedRecursionGuard;
208211
bool mGCPsDirty;
209212
bool mLoadInQgis;
213+
214+
QDockWidget* mDock;
210215
};
211216
#endif

0 commit comments

Comments
 (0)