Skip to content

Commit

Permalink
Amend previously ommited docking feature of patch #2673.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13544 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mmassing committed May 21, 2010
1 parent 164caa5 commit a875ca5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/plugins/georeferencer/qgsgeorefconfigdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,21 @@ void QgsGeorefConfigDialog::readSettings()
{
mShowCoordsCheckBox->setChecked( false );
}

if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
{
mShowDockedCheckBox->setChecked( true );
}
else
{
mShowDockedCheckBox->setChecked( false );
}
}

void QgsGeorefConfigDialog::writeSettings()
{
QSettings s;
s.setValue( "/Plugin-GeoReferencer/Config/ShowId", mShowIDsCheckBox->isChecked() );
s.setValue( "/Plugin-GeoReferencer/Config/ShowCoords", mShowCoordsCheckBox->isChecked() );
s.setValue( "/Plugin-GeoReferencer/Config/ShowDocked", mShowDockedCheckBox->isChecked() );
}
13 changes: 10 additions & 3 deletions src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
<property name="title">
<string>Point tip</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="mShowIDsCheckBox">
<property name="text">
<string>Show IDs</string>
</property>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QCheckBox" name="mShowCoordsCheckBox">
<property name="text">
<string>Show coords</string>
Expand All @@ -38,6 +38,13 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="mShowDockedCheckBox">
<property name="text">
<string>Show Georeferencer window docked</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand Down
40 changes: 40 additions & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
, mMapCoordsDialog( 0 )
, mUseZeroForTrans( false )
, mLoadInQgis( false )
, mDock( 0 )
{
setupUi( this );

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

mCanvas->clearExtentHistory(); // reset zoomnext/zoomlast

QSettings s;
if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
{
dockThisWindow( true );
}
}

void QgsGeorefPluginGui::dockThisWindow( bool dock )
{
if ( mDock )
{
setParent( 0 );
show();
mIface->removeDockWidget( mDock );
mDock->setWidget( 0 );
delete mDock;
mDock = 0;
}

if ( dock )
{
mDock = new QgsGeorefDockWidget( tr( "Georeferencer" ), mIface->mainWindow() );
mDock->setWidget( this );
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock );
}
}

QgsGeorefPluginGui::~QgsGeorefPluginGui()
Expand All @@ -123,6 +151,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
delete mToolAddPoint;
delete mToolDeletePoint;
delete mToolMovePoint;
delete mDock;
}

// ----------------------------- protected --------------------------------- //
Expand Down Expand Up @@ -568,6 +597,17 @@ void QgsGeorefPluginGui::showGeorefConfigDialog()
{
mCanvas->refresh();
mIface->mapCanvas()->refresh();
QSettings s;
//update dock state
bool dock = s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool();
if ( dock && !mDock )
{
dockThisWindow( true );
}
else if ( !dock && mDock )
{
dockThisWindow( false );
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
void logRequaredGCPs();
void clearGCPData();

/**Docks / undocks this window*/
void dockThisWindow( bool dock );


QMenu *mPanelMenu;
QMenu *mToolbarMenu;
Expand Down Expand Up @@ -207,5 +210,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
bool mExtentsChangedRecursionGuard;
bool mGCPsDirty;
bool mLoadInQgis;

QDockWidget* mDock;
};
#endif

0 comments on commit a875ca5

Please sign in to comment.