[Marble-commits] KDE/kdeedu/marble/src
Jens-Michael Hoffmann
jensmh at gmx.de
Tue May 11 23:55:36 CEST 2010
SVN commit 1125661 by jmhoffmann:
Refactor MarblePart::showDownloadRegionDialog.
Move code to new method connectDownloadRegionDialog and provide corresponding
method disconnectDownloadRegionDialog. As the slot invocations are completely
unnecessary when the dialog is closed/hidden we want to have it disconnected
when unsued.
M +16 -5 marble_part.cpp
M +2 -0 marble_part.h
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1125660:1125661
@@ -972,12 +972,8 @@
//m_controlView->marbleControl()->updateMapThemes();
}
-void MarblePart::showDownloadRegionDialog()
+void MarblePart::connectDownloadRegionDialog()
{
- ViewportParams * const viewport = m_controlView->marbleWidget()->map()->viewParams()->viewport();
- MarbleModel * const model = m_controlView->marbleWidget()->map()->model();
- if ( !m_downloadRegionDialog ) {
- m_downloadRegionDialog = new DownloadRegionDialog( viewport, model );
connect( m_downloadRegionDialog, SIGNAL( accepted() ), SLOT( downloadRegion() ));
connect( m_downloadRegionDialog, SIGNAL( applied() ), SLOT( downloadRegion() ));
connect( m_controlView->marbleWidget(), SIGNAL( visibleLatLonAltBoxChanged( GeoDataLatLonAltBox )),
@@ -985,6 +981,21 @@
connect( m_controlView->marbleWidget(), SIGNAL( themeChanged( QString )),
m_downloadRegionDialog, SLOT( updateTextureLayer() ));
}
+
+void MarblePart::disconnectDownloadRegionDialog()
+{
+ disconnect( m_downloadRegionDialog, 0, this, 0 );
+ disconnect( m_controlView->marbleWidget(), 0, m_downloadRegionDialog, 0 );
+}
+
+void MarblePart::showDownloadRegionDialog()
+{
+ ViewportParams * const viewport = m_controlView->marbleWidget()->map()->viewParams()->viewport();
+ MarbleModel * const model = m_controlView->marbleWidget()->map()->model();
+ if ( !m_downloadRegionDialog ) {
+ m_downloadRegionDialog = new DownloadRegionDialog( viewport, model );
+ connectDownloadRegionDialog();
+ }
// FIXME: get allowed range from current map theme
m_downloadRegionDialog->setAllowedTileLevelRange( 0, 18 );
--- trunk/KDE/kdeedu/marble/src/marble_part.h #1125660:1125661
@@ -116,6 +116,8 @@
void setupStatusBar();
void showNewStuffDialog();
+ void connectDownloadRegionDialog();
+ void disconnectDownloadRegionDialog();
void showDownloadRegionDialog();
void downloadRegion();
void showStatusBarContextMenu( const QPoint& pos );
More information about the Marble-commits
mailing list