[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2007-12-31 16:10:38
Message-ID: 1199117438.256891.19343.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 755180 by ingwa:

Fix bug 154700: Newly downloaded maps are not usable without restarting Marble 

TODO: make downloaded mapthemes uninstall when the user clicks
      "Uninstall". This may be a bug in GHNS, though, and this code
      should reflect deletions as well as additions.

BUGS: 154700



 M  +13 -3     ChangeLog  
 M  +2 -2      TODO  
 M  +2 -1      src/ControlView.h  
 M  +10 -12    src/lib/MapTheme.cpp  
 M  +12 -5     src/lib/MarbleControlBox.cpp  
 M  +8 -0      src/lib/MarbleControlBox.h  
 M  +1 -1      src/lib/MarbleModel.cpp  
 M  +15 -10    src/marble_part.cpp  


--- trunk/KDE/kdeedu/marble/ChangeLog #755179:755180
@@ -1,3 +1,14 @@
+2007-12-31    Inge Wallin  <inge@lysator.liu.se>
+
+	* src/ControlView.h (marbleControl): New function
+	* src/lib/MarbleControlBox.{h,cpp} (updateMapThemes): New function
+	(constructor): call updateMapThemes().
+	* src/marble_part.cpp (showNewStuffDialog): update the map themes 
+	list in the controlbox.
+	(misc): cleaning
+	* src/lib/MapTheme.cpp: cleaning
+	* src/lib/MarbleModel.cpp: cleaning	
+
 2007-12-31  Torsten Rahn  <rahn@kde.org>
 
     * src/plugins/navigator/CMakeLists.txt:
@@ -3,12 +14,11 @@
     - Fix MarbleNavigator Plugin
 
-2007-12-31  Torsten Rahn  <rahn@kde.org>
-
+    Icons for projection combobox:
     * src/marble.qrc:
     * src/lib/MarbleControlBox.ui:
     * src/icons/map-flat.png:
     * src/icons/map-globe.png:
-    - Icons for projection combobox
 
+
 2007-12-31  Torsten Rahn  <rahn@kde.org>
 
--- trunk/KDE/kdeedu/marble/TODO #755179:755180
@@ -20,9 +20,9 @@
 - Fix area visibility mapped to Legend          DONE
 - Fix order of Feature appearance               DONE
 - Fix MarbleNavigator Plugin                    DONE
-- Bug 154700                                    ingwa
+- Bug 154700                                    DONE
 - Disable Install button on Install in KNS      ingwa
-- KNS Url ?
+- KNS Url ?                                     ----
 - fix header file installation                  DONE
 
 Before Dec 31th:
--- trunk/KDE/kdeedu/marble/src/ControlView.h #755179:755180
@@ -36,7 +36,8 @@
     ControlView( QWidget * = 0 );
     virtual ~ControlView(){}
 
-    MarbleWidget  *marbleWidget() const { return m_marbleWidget; }
+    MarbleWidget      *marbleWidget()  const { return m_marbleWidget; }
+    MarbleControlBox  *marbleControl() const { return m_control;      }
 
     void zoomIn();
     void zoomOut();
--- trunk/KDE/kdeedu/marble/src/lib/MapTheme.cpp #755179:755180
@@ -38,9 +38,7 @@
         return -4;
     }
       
-    
-    QFile         file( path );
-
+    QFile  file( path );
     if ( !file.open( QIODevice::ReadOnly ) ) {
         qDebug() << QString("Could not open ") + path;
         return -1;
@@ -211,17 +209,17 @@
 
 QStringList MapTheme::findMapThemes( const QString& path )
 {
-    QDir  localPaths = QDir( MarbleDirs::localPath() + '/' + path );
-    QDir  sysdirs   = QDir( MarbleDirs::systemPath() + '/' + path );
+    QDir  localPaths = QDir( MarbleDirs::localPath()  + '/' + path );
+    QDir  sysdirs    = QDir( MarbleDirs::systemPath() + '/' + path );
 
     QStringList  localmappaths = localPaths.entryList( QStringList( "*" ),
-                                                      QDir::AllDirs
-                                                      | QDir::NoSymLinks
-                                                      | QDir::NoDotAndDotDot );
-    QStringList sysmappaths = sysdirs.entryList( QStringList( "*" ),
-                                                 QDir::AllDirs
-                                                 | QDir::NoSymLinks
-                                                 | QDir::NoDotAndDotDot );
+                                                       QDir::AllDirs
+                                                       | QDir::NoSymLinks
+                                                       | QDir::NoDotAndDotDot );
+    QStringList  sysmappaths = sysdirs.entryList( QStringList( "*" ),
+                                                  QDir::AllDirs
+                                                  | QDir::NoSymLinks
+                                                  | QDir::NoDotAndDotDot );
 
 
     QStringList  localmapdirs;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #755179:755180
@@ -55,8 +55,8 @@
     QWidget              *m_currentLocationWidget;
     QWidget              *m_fileViewWidget;
 
-    QStandardItemModel   *m_mapthememodel;
-    QSortFilterProxyModel *m_sortproxy;
+    QStandardItemModel     *m_mapthememodel;
+    QSortFilterProxyModel  *m_sortproxy;
 };
 
 
@@ -135,9 +135,8 @@
     connect( d->uiWidget.locationListView, SIGNAL( centerOn( const QModelIndex& ) ),
              this,                         SLOT( mapCenterOnSignal( const \
QModelIndex& ) ) );  
-    QStringList          mapthemedirs  = MapTheme::findMapThemes( "maps/earth" );
-    d->m_mapthememodel = MapTheme::mapThemeModel( mapthemedirs );
-    d->uiWidget.marbleThemeSelectView->setModel( d->m_mapthememodel );
+    d->m_mapthememodel = 0;
+    updateMapThemes();
 
     connect( d->uiWidget.marbleThemeSelectView, SIGNAL( selectMapTheme( const \
                QString& ) ),
              this,                              SIGNAL( selectMapTheme( const \
QString& ) ) ); @@ -153,6 +152,14 @@
     delete d;
 }
 
+
+void MarbleControlBox::updateMapThemes()
+{
+    QStringList  mapthemedirs = MapTheme::findMapThemes( "maps/earth" );
+    d->m_mapthememodel = MapTheme::mapThemeModel( mapthemedirs );
+    d->uiWidget.marbleThemeSelectView->setModel( d->m_mapthememodel );
+}
+
 void MarbleControlBox::updateButtons( int value )
 {
     if ( value <= d->uiWidget.zoomSlider->minimum() ) {
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.h #755179:755180
@@ -107,6 +107,14 @@
      * @return the minimum zoom level set in the widget.
      */
     int minimumZoom() const;
+
+    /**
+     * @brief Update the list of Map Themes.
+     *
+     * This should be called after the user has installed a new map
+     * theme, e.g. after he/she used GHNS.
+     */
+    void updateMapThemes();
 	
  Q_SIGNALS:
     /**
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #755179:755180
@@ -41,7 +41,7 @@
  public:
     // View and paint stuff
     MapTheme            *m_maptheme;
-    QString             m_selectedMap;
+    QString              m_selectedMap;
     TextureColorizer    *m_texcolorizer;
 
     HttpDownloadManager *m_downloadManager;
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #755179:755180
@@ -264,9 +264,11 @@
 
     // Action: Get hot new stuff
     m_newStuffAction = KNS::standardAction(QString(), this, \
                SLOT(showNewStuffDialog()), actionCollection(), "new_stuff");
-///@todo enable the name and status tip when string freeze is lifted
-//     m_newStuffAction = KNS::standardAction(i18n("Maps..."), this, \
                SLOT(showNewStuffDialog()), actionCollection(), "new_stuff");
-//     m_newStuffAction->setStatusTip(i18n("&Download new maps"));
+    // FIXME: Enable the name and status tip when string freeze is lifted.
+#if 0
+    m_newStuffAction = KNS::standardAction( i18n("Maps..."), this, \
SLOT(showNewStuffDialog()), actionCollection(), "new_stuff"); +    \
m_newStuffAction->setStatusTip(i18n("&Download new maps")); +#endif
     m_newStuffAction->setShortcut( Qt::CTRL + Qt::Key_N );
 
     KStandardAction::showStatusbar( this, SLOT( showStatusBar( bool ) ), \
actionCollection() ); @@ -330,24 +332,27 @@
     m_statusBarExtension->addStatusBarItem( m_distanceLabel, -1, false );
 
     connect( m_controlView->marbleWidget(), SIGNAL( mouseMoveGeoPosition( QString ) \
                ),
-              this, SLOT( showPosition( QString ) ) );
+             this,                          SLOT( showPosition( QString ) ) );
     connect( m_controlView->marbleWidget(), SIGNAL( distanceChanged( QString ) ),
-              this, SLOT( showDistance( QString ) ) );
+             this,                          SLOT( showDistance( QString ) ) );
 
     updateStatusBar();
 }
 
 void MarblePart::showNewStuffDialog()
 {
-    QString newStuffConfig = KStandardDirs::locate ("data", "marble/marble.knsrc");
+    QString  newStuffConfig = KStandardDirs::locate ( "data", 
+                                                      "marble/marble.knsrc" );
     kDebug() << "KNS config file:" << newStuffConfig;
 
-    KNS::Engine engine;
-    bool ret = engine.init(newStuffConfig);
-    if(ret)
-    {
+    KNS::Engine  engine;
+    bool         ret = engine.init( newStuffConfig );
+    if ( ret ) {
         KNS::Entry::List entries = engine.downloadDialogModal(0);
     }
+
+    // Update the map theme widget by updating the model.
+    m_controlView->marbleControl()->updateMapThemes();
 }
 
 #include "marble_part.moc"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic