[Marble-commits] KDE/kdeedu/marble/src
Jens-Michael Hoffmann
jensmh at gmx.de
Tue May 11 23:55:25 CEST 2010
SVN commit 1125654 by jmhoffmann:
Show DownloadRegionDialog non modal.
Works as before. For now it does not react to changes of the visible region.
Also, an "Apply" button would make sense now.
M +22 -10 marble_part.cpp
M +3 -0 marble_part.h
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1125653:1125654
@@ -95,6 +95,7 @@
MarblePart::MarblePart( QWidget *parentWidget, QObject *parent, const QStringList &arguments )
: KParts::ReadOnlyPart( parent ),
m_sunControlDialog( 0 ),
+ m_downloadRegionDialog( 0 ),
m_pluginModel( 0 ),
m_configDialog( 0 ),
m_positionLabel( 0 ),
@@ -140,6 +141,7 @@
{
writeSettings();
+ delete m_downloadRegionDialog;
// Check whether this delete is really needed.
delete m_configDialog;
}
@@ -973,24 +975,34 @@
{
ViewportParams * const viewport = m_controlView->marbleWidget()->map()->viewParams()->viewport();
MarbleModel * const model = m_controlView->marbleWidget()->map()->model();
- QPointer<DownloadRegionDialog> dialog = new DownloadRegionDialog( viewport,
- model->textureMapper() );
+ if ( !m_downloadRegionDialog ) {
+ m_downloadRegionDialog = new DownloadRegionDialog( viewport, model->textureMapper() );
+ connect( m_downloadRegionDialog, SIGNAL( accepted() ), SLOT( downloadRegion() ));
+ //connect( m_downloadRegionDialog, SIGNAL( applied() ), SLOT( downloadRegion() ));
+ //connect( widget, SIGNAL( viewportChanged() ), m_downloadRegionDialog, SLOT( updateViewport() ));
+ //connect( this, SIGNAL( mapThemeChanged() ),
+ }
// FIXME: get allowed range from current map theme
- dialog->setAllowedTileLevelRange( 0, 18 );
+ m_downloadRegionDialog->setAllowedTileLevelRange( 0, 18 );
+
+ m_downloadRegionDialog->show();
+ m_downloadRegionDialog->raise();
+ m_downloadRegionDialog->activateWindow();
+}
+
+void MarblePart::downloadRegion()
+{
+ Q_ASSERT( m_downloadRegionDialog );
QString const mapThemeId = m_controlView->marbleWidget()->mapThemeId();
QString const sourceDir = mapThemeId.left( mapThemeId.lastIndexOf( '/' ));
- kDebug() << "showDownloadRegionDialog mapThemeId:" << mapThemeId << sourceDir;
-
- if ( dialog->exec() == QDialog::Accepted ) {
+ kDebug() << "downloadRegion mapThemeId:" << mapThemeId << sourceDir;
// FIXME: use lazy evaluation to not generate up to 100k tiles in one go
// this can take considerable time even on very fast systems
// in contrast generating the TileIds on the fly when they are needed
// does not seem to affect download speed.
- TileCoordsPyramid const pyramid = dialog->region();
- model->downloadRegion( sourceDir, pyramid );
+ TileCoordsPyramid const pyramid = m_downloadRegionDialog->region();
+ m_controlView->marbleWidget()->map()->model()->downloadRegion( sourceDir, pyramid );
}
- delete dialog;
-}
void MarblePart::showStatusBarContextMenu( const QPoint& pos )
{
--- trunk/KDE/kdeedu/marble/src/marble_part.h #1125653:1125654
@@ -35,6 +35,7 @@
{
class ControlView;
+class DownloadRegionDialog;
class SunControlWidget;
class MarblePart: public KParts::ReadOnlyPart
@@ -116,6 +117,7 @@
void setupStatusBar();
void showNewStuffDialog();
void showDownloadRegionDialog();
+ void downloadRegion();
void showStatusBarContextMenu( const QPoint& pos );
void editSettings();
@@ -166,6 +168,7 @@
// All the functionality is provided by this widget.
ControlView *m_controlView; // MarbleControlBox and MarbleWidget
SunControlWidget *m_sunControlDialog;
+ DownloadRegionDialog *m_downloadRegionDialog;
// Actions for the GUI.
KAction *m_exportMapAction;
More information about the Marble-commits
mailing list