[Marble-commits] KDE/kdeedu/marble/src
Utku Aydın
utkuaydin34 at gmail.com
Sat Dec 25 22:47:56 CET 2010
SVN commit 1209213 by aydin:
Add map creation wizard
REVIEW: 6070
M +3 -0 ControlView.cpp
M +5 -0 ControlView.h
M +23 -0 QtMainWindow.cpp
M +10 -2 QtMainWindow.h
M +4 -0 lib/CMakeLists.txt
M +3 -0 lib/MapViewWidget.cpp
M +2 -0 lib/MapViewWidget.h
M +3 -0 lib/MapViewWidget.ui
A lib/MapWizard.cpp [License: LGPL]
A lib/MapWizard.h [License: LGPL]
A lib/MapWizard.ui
M +3 -0 lib/MarbleControlBox.cpp
M +4 -0 lib/MarbleControlBox.h
M +21 -2 lib/MarbleThemeSelectView.cpp
M +6 -0 lib/MarbleThemeSelectView.h
M +5 -0 marble.kcfg
M +31 -0 marble_part.cpp
M +5 -0 marble_part.h
--- trunk/KDE/kdeedu/marble/src/ControlView.cpp #1209212:1209213
@@ -79,6 +79,9 @@
// TODO: Creating a second MapThemeManager may not be the best solution here.
// MarbleModel also holds one with a QFileSystemWatcher.
m_mapThemeManager = new MapThemeManager;
+
+ connect( m_control, SIGNAL( showMapWizard() ), this, SIGNAL( showMapWizard() ) );
+ connect( m_control, SIGNAL( showUploadDialog() ), this, SIGNAL( showUploadDialog() ) );
}
ControlView::~ControlView()
--- trunk/KDE/kdeedu/marble/src/ControlView.h #1209212:1209213
@@ -104,6 +104,11 @@
* Start the configured external map editor (or update it if it is already running)
*/
void launchExternalMapEditor();
+
+ signals:
+ void showMapWizard();
+ void showUploadDialog();
+
private:
/**
* Try to reach an external application server at localhost:8111. If none is running,
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1209212:1209213
@@ -66,6 +66,7 @@
#include "PositionTracking.h"
#include "PositionProviderPlugin.h"
#include "PluginManager.h"
+#include "MapWizard.h"
// For zoom buttons on Maemo
#ifdef Q_WS_MAEMO_5
@@ -126,12 +127,14 @@
connect( m_controlView->marbleWidget(), SIGNAL( themeChanged( QString ) ),
this, SLOT( updateMapEditButtonVisibility( QString ) ) );
+ connect( m_controlView, SIGNAL( showMapWizard() ), this, SLOT( showMapWizard() ) );
setUpdatesEnabled( true );
m_position = NOT_AVAILABLE;
m_distance = marbleWidget()->distanceString();
m_clock = QLocale().toString( m_controlView->marbleWidget()->model()->clockDateTime().addSecs( m_controlView->marbleWidget()->model()->clockTimezone() ), QLocale::ShortFormat );
+ m_mapWizard = new MapWizard();
QTimer::singleShot( 0, this, SLOT( initObject() ) );
}
@@ -278,6 +281,10 @@
m_addBookmarkFolderAct->setStatusTip(tr("New Bookmark Folder"));
connect( m_addBookmarkFolderAct, SIGNAL( triggered() ), this, SLOT( openNewBookmarkFolderDialog() ) );
+ // Map Wizard action
+ m_mapWizardAct = new QAction( tr("&Create a New Map..."), this );
+ m_mapWizardAct->setStatusTip( tr( "A wizard guides you through the creation of your own map theme." ) );
+ connect( m_mapWizardAct, SIGNAL( triggered() ), SLOT( showMapWizard() ) );
}
void MainWindow::createMenus()
@@ -321,6 +328,7 @@
m_fileMenu->addAction(m_openAct);
m_fileMenu->addAction(m_downloadAct);
m_fileMenu->addAction( m_downloadRegionAction );
+ m_fileMenu->addAction( m_mapWizardAct );
m_fileMenu->addAction(m_exportMapAct);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_printAct);
@@ -988,6 +996,10 @@
}
settings.endGroup();
+ settings.beginGroup( "WmsService" );
+ m_mapWizard->setWmsServers( settings.value( "services" ).toStringList() );
+ settings.endGroup();
+
settings.beginGroup( "Plugins");
QString positionProvider = settings.value( "activePositionTrackingPlugin", QString() ).toString();
if ( !positionProvider.isEmpty() ) {
@@ -1101,7 +1113,12 @@
positionProvider = tracking->positionProviderPlugin()->nameId();
}
settings.setValue( "activePositionTrackingPlugin", positionProvider );
+ settings.endGroup();
+ settings.beginGroup( "WmsService" );
+ settings.setValue( "services", m_mapWizard->wmsServers() );
+ settings.endGroup();
+
// The config dialog has to write settings.
m_configDialog->writeSettings();
@@ -1326,4 +1343,10 @@
#endif // Q_WS_MAEMO_5
}
+void MainWindow::showMapWizard()
+{
+ m_mapWizard->fillServerCombobox();
+ m_mapWizard->show();
+}
+
#include "QtMainWindow.moc"
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.h #1209212:1209213
@@ -33,6 +33,7 @@
class QtMarbleConfigDialog;
class DownloadRegionDialog;
class RoutingWidget;
+class MapWizard;
class MainWindow : public QMainWindow
{
@@ -42,8 +43,12 @@
explicit MainWindow(const QString& marbleDataPath = QString(),
QWidget *parent=0);
- ControlView* marbleControl(){ return m_controlView; }
- MarbleWidget* marbleWidget(){ return m_controlView->marbleWidget(); }
+ ControlView* marbleControl() {
+ return m_controlView;
+ }
+ MarbleWidget* marbleWidget() {
+ return m_controlView->marbleWidget();
+ }
protected:
void closeEvent(QCloseEvent *event);
@@ -73,6 +78,7 @@
void showDownloadRegionDialog();
void printMapScreenShot();
void workOffline( bool );
+ void showMapWizard();
// Edit Menu
void copyMap();
@@ -130,6 +136,7 @@
TimeControlWidget* m_timeControlDialog;
QtMarbleConfigDialog *m_configDialog;
DownloadRegionDialog* m_downloadRegionDialog;
+ MapWizard* m_mapWizard;
/// Store plugin toolbar pointers so that they can be removed/updated later
QList<QToolBar*> m_pluginToolbars;
@@ -151,6 +158,7 @@
QAction *m_printAct;
QAction *m_workOfflineAct;
QAction *m_quitAct;
+ QAction *m_mapWizardAct;
// Edit Menu
QAction *m_copyMapAct;
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1209212:1209213
@@ -217,6 +217,8 @@
PrintOptionsWidget.cpp
ExternalEditorDialog.cpp
GoToDialog.cpp
+
+ MapWizard.cpp
)
set (marblewidget_UI
@@ -248,6 +250,7 @@
GoToDialog.ui
routing/RoutingSettingsWidget.ui
routing/RoutingProfileSettingsDialog.ui
+ MapWizard.ui
)
# FIXME: cleaner approach of src/lib/MarbleControlBox.* vs. marble.qrc
@@ -401,6 +404,7 @@
AbstractWorkerThread.h
LatLonEdit.h
+ MapWizard.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/marble
)
endif (APPLE AND QTONLY)
--- trunk/KDE/kdeedu/marble/src/lib/MapViewWidget.cpp #1209212:1209213
@@ -110,6 +110,9 @@
d->m_mapViewUi.celestialBodyComboBox->setModel( d->m_celestialList );
connect( d->m_mapViewUi.celestialBodyComboBox, SIGNAL( activated( const QString& ) ),
this, SLOT( selectCurrentMapTheme( const QString& ) ) );
+
+ connect( d->m_mapViewUi.marbleThemeSelectView, SIGNAL( showMapWizard() ), this, SIGNAL( showMapWizard() ) );
+ connect( d->m_mapViewUi.marbleThemeSelectView, SIGNAL( showUploadDialog() ), this, SIGNAL( showUploadDialog() ) );
}
MapViewWidget::~MapViewWidget()
--- trunk/KDE/kdeedu/marble/src/lib/MapViewWidget.h #1209212:1209213
@@ -61,6 +61,8 @@
Q_SIGNALS:
void selectMapTheme( const QString& );
void projectionSelected( Projection );
+ void showMapWizard();
+ void showUploadDialog();
private:
Q_DISABLE_COPY( MapViewWidget )
--- trunk/KDE/kdeedu/marble/src/lib/MapViewWidget.ui #1209212:1209213
@@ -125,6 +125,9 @@
<height>140</height>
</size>
</property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
<property name="whatsThis">
<string>Here you can choose the preferred map view from different topics.</string>
</property>
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1209212:1209213
@@ -100,6 +100,9 @@
//default
setCurrentLocationTabShown( true );
setFileViewTabShown( false );
+
+ connect( d->m_mapViewWidget, SIGNAL( showMapWizard() ), this, SIGNAL( showMapWizard() ) );
+ connect( d->m_mapViewWidget, SIGNAL( showUploadDialog() ), this, SIGNAL( showUploadDialog() ) );
}
MarbleControlBox::~MarbleControlBox()
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.h #1209212:1209213
@@ -132,6 +132,10 @@
*/
void setRoutingTabShown( bool show );
+Q_SIGNALS:
+ void showMapWizard();
+ void showUploadDialog();
+
private:
void setWidgetTabShown( QWidget * widget, int insertIndex,
bool show, QString &text );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleThemeSelectView.cpp #1209212:1209213
@@ -12,8 +12,10 @@
#include "MarbleThemeSelectView.h"
+#include "MapWizard.h"
#include "MarbleDebug.h"
#include <QtGui/QResizeEvent>
+#include <QtGui/QMenu>
using namespace Marble;
@@ -34,9 +36,10 @@
connect( this, SIGNAL( pressed( QModelIndex ) ),
SLOT( selectedMapTheme( QModelIndex ) ) );
+ connect(this, SIGNAL( customContextMenuRequested( QPoint) ),
+ SLOT( showContextMenu(QPoint)) );
}
-
void MarbleThemeSelectView::resizeEvent(QResizeEvent* event)
{
QListView::resizeEvent(event);
@@ -46,7 +49,6 @@
setGridSize(size);
}
-
void MarbleThemeSelectView::selectedMapTheme( QModelIndex index )
{
const QAbstractItemModel *model = index.model();
@@ -58,5 +60,22 @@
emit selectMapTheme( currentmaptheme );
}
+void MarbleThemeSelectView::mapWizard()
+{
+ emit showMapWizard();
+}
+void MarbleThemeSelectView::uploadDialog()
+{
+ emit showUploadDialog();
+}
+
+void MarbleThemeSelectView::showContextMenu(const QPoint& pos)
+{
+ QMenu menu;
+ menu.addAction( "&Create a New Map...", this, SLOT( mapWizard() ) );
+ menu.addAction( "&Upload Map...", this, SLOT( uploadDialog() ) );
+ menu.exec( mapToGlobal( pos ) );
+}
+
#include "MarbleThemeSelectView.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleThemeSelectView.h #1209212:1209213
@@ -41,9 +41,15 @@
private Q_SLOTS:
void selectedMapTheme( QModelIndex index );
+ void uploadDialog();
+ void mapWizard();
+ void showContextMenu(const QPoint& pos);
Q_SIGNALS:
void selectMapTheme( const QString& );
+ void showMapWizard();
+ void showUploadDialog();
+ //void
private:
Q_DISABLE_COPY( MarbleThemeSelectView )
--- trunk/KDE/kdeedu/marble/src/marble.kcfg #1209212:1209213
@@ -258,4 +258,9 @@
<default>true</default>
</entry>
</group>
+ <group name="WmsService">
+ <entry key="wmsServices" type="StringList" >
+ <default>false</default>
+ </entry>
+ </group>
</kcfg>
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1209212:1209213
@@ -47,6 +47,7 @@
#include <ktogglefullscreenaction.h>
#include <knewstuff3/knewstuffaction.h>
#include <knewstuff3/downloaddialog.h>
+#include <knewstuff3/uploaddialog.h>
#include <KStandardDirs>
#include <kdeprintdialog.h>
@@ -68,6 +69,7 @@
#include "MarbleLocale.h"
#include "MarbleModel.h"
#include "MarblePluginSettingsWidget.h"
+#include "MapWizard.h"
#include "NewFolderInfoDialog.h"
#include "routing/RoutingManager.h"
#include "routing/RoutingProfilesModel.h"
@@ -145,6 +147,8 @@
setXMLFile( "marble_part.rc" );
+ m_mapWizard = new MapWizard();
+
m_statusBarExtension = new KParts::StatusBarExtension( this );
m_statusBarExtension->statusBar()->setUpdatesEnabled( false );
@@ -171,6 +175,9 @@
m_controlView->marbleWidget()->goHome( Instant );
break;
}
+
+ connect( m_controlView, SIGNAL( showUploadDialog() ), this, SLOT( showUploadNewStuffDialog() ) );
+ connect( m_controlView, SIGNAL( showMapWizard() ), this, SLOT( showMapWizard() ) );
}
MarblePart::~MarblePart()
@@ -417,6 +424,9 @@
m_initialGraphicsSystem = (GraphicsSystem) MarbleSettings::graphicsSystem();
m_previousGraphicsSystem = m_initialGraphicsSystem;
+ // Map Wizard
+ m_mapWizard->setWmsServers( MarbleSettings::wmsServices() );
+
// Plugins
QHash<QString, int> pluginEnabled;
QHash<QString, int> pluginVisible;
@@ -609,6 +619,8 @@
MarbleSettings::setDateTime( m_controlView->marbleWidget()->model()->clockDateTime() );
MarbleSettings::setSpeedSlider( m_controlView->marbleWidget()->model()->clockSpeed() );
+ MarbleSettings::setWmsServices( m_mapWizard->wmsServers() );
+
// Plugins
QList<int> pluginEnabled;
QList<int> pluginVisible;
@@ -1131,6 +1143,19 @@
delete dialog;
}
+void MarblePart::showUploadNewStuffDialog()
+{
+ QString newStuffConfig = KStandardDirs::locate ( "data", "marble/marble.knsrc" );
+ kDebug() << "KNS config file:" << newStuffConfig;
+
+ QPointer<KNS3::UploadDialog> dialog( new KNS3::UploadDialog( newStuffConfig ) );
+ kDebug() << "Creating the archive";
+ dialog->setUploadFile( KUrl( m_mapWizard->createArchive( m_controlView->marbleWidget()->mapThemeId() ) ) );
+ dialog->exec();
+ m_mapWizard->deleteArchive( m_controlView->marbleWidget()->mapThemeId() );
+ delete dialog;
+}
+
// connect to expensive slots, only needed when the non modal dialog is show
void MarblePart::connectDownloadRegionDialog()
{
@@ -1201,6 +1226,12 @@
statusBarContextMenu.exec( statusBar->mapToGlobal( pos ));
}
+void MarblePart::showMapWizard()
+{
+ m_mapWizard->fillServerCombobox();
+ m_mapWizard->show();
+}
+
void MarblePart::editSettings()
{
if ( KConfigDialog::showDialog( "settings" ) )
--- trunk/KDE/kdeedu/marble/src/marble_part.h #1209212:1209213
@@ -44,6 +44,7 @@
class SunControlWidget;
class TimeControlWidget;
class GeoDataFolder;
+class MapWizard;
class MarblePart: public KParts::ReadOnlyPart
{
@@ -130,11 +131,13 @@
void setupStatusBar();
void showNewStuffDialog();
+ void showUploadNewStuffDialog();
void connectDownloadRegionDialog();
void disconnectDownloadRegionDialog();
void showDownloadRegionDialog();
void downloadRegion();
void showStatusBarContextMenu( const QPoint& pos );
+ void showMapWizard();
void editSettings();
@@ -196,6 +199,7 @@
SunControlWidget *m_sunControlDialog;
TimeControlWidget *m_timeControlDialog;
DownloadRegionDialog *m_downloadRegionDialog;
+ MapWizard *m_mapWizard;
// Actions for the GUI.
KAction *m_exportMapAction;
@@ -215,6 +219,7 @@
KAction *m_controlSunAction;
KAction *m_controlTimeAction;
KAction *m_lockFloatItemsAct;
+ KAction *m_mapWizardAct;
//Bookmark Menu
KAction *m_addBookmarkAction;
More information about the Marble-commits
mailing list