[Marble-commits] KDE/kdeedu/marble

Bastian Holst bastianholst at gmx.de
Wed Mar 24 11:08:56 CET 2010


SVN commit 1106954 by bholst:

Some steps to a better user interface for marble on maemo:
* corrected font painting in MapScaleFloatItem
* cleaned up menus on MIDs (which removes some features, they will definately come back)


 M  +2 -0      data/CMakeLists.txt  
 AM            data/svg/marble-logo-32dpi.png  
 AM            data/svg/marble-logo-inverted-32dpi.png  
 M  +34 -4     src/QtMainWindow.cpp  
 M  +9 -1      src/lib/MarbleAboutDialog.cpp  
 M  +13 -3     src/plugins/render/mapscale/MapScaleFloatItem.cpp  


--- trunk/KDE/kdeedu/marble/data/CMakeLists.txt #1106953:1106954
@@ -25,7 +25,9 @@
 svg/compass.svg
 svg/marble-logo.svg
 svg/marble-logo.png
+svg/marble-logo-32dpi.png
 svg/marble-logo-72dpi.png
+svg/marble-logo-inverted-32dpi.png
 svg/marble-logo-inverted-72dpi.png
 svg/application-x-marble.svg
 svg/application-x-marble.png
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1106953:1106954
@@ -208,6 +208,12 @@
 
 void MainWindow::createMenus()
 {
+    // Do not create too many menu entries on a MID
+    // FIXME: Some of these options should come back.
+    if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+        return;
+    }
+    
     m_fileMenu = menuBar()->addMenu(tr("&File"));
     m_fileMenu->addAction(m_openAct);
     m_fileMenu->addAction(m_downloadAct);
@@ -276,8 +282,15 @@
 }
 
 void MainWindow::createInfoBoxesMenu()
-{
+{    
     m_infoBoxesMenu->clear();
+    
+    // Do not create too many menu entries on a MID
+    // FIXME: Set up another way of switching the plugins on and off.
+    if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+        return;
+    }
+    
     m_infoBoxesMenu->addAction(m_lockFloatItemsAct);
     m_infoBoxesMenu->addSeparator();
 
@@ -295,6 +308,12 @@
 {
     m_onlineServicesMenu->clear();
     
+    // Do not create too many menu entries on a MID
+    // FIXME: Set up another way of switching the plugins on and off.
+    if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+        return;
+    }
+    
     QList<RenderPlugin *> renderPluginList = m_controlView->marbleWidget()->renderPlugins();
     
     QList<RenderPlugin *>::const_iterator i = renderPluginList.constBegin();
@@ -310,13 +329,19 @@
 }
 
 void MainWindow::createPluginMenus()
-{
-    //Remove and delete toolbars if they exist
+{    
+    // Remove and delete toolbars if they exist
     while( !m_pluginToolbars.isEmpty() ) {
         QToolBar* tb = m_pluginToolbars.takeFirst();
         this->removeToolBar(tb);
         delete tb;
     }
+    
+    // Do not create too many menu entries on a MID
+    // FIXME: Set up another way of switching the plugins on and off.
+    if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+        return;
+    }
 
     //remove and delete old menus if they exist
     while(  !m_pluginMenus.isEmpty() ) {
@@ -671,7 +696,12 @@
          resize(settings.value("size", QSize(640, 480)).toSize());
          move(settings.value("pos", QPoint(200, 200)).toPoint());
          showFullScreen(settings.value("fullScreen", false ).toBool());
-         showSideBar(settings.value("sideBar", true ).toBool());
+         if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+             showSideBar(settings.value("sideBar", false ).toBool());
+         }
+         else {
+             showSideBar(settings.value("sideBar", true ).toBool());
+         }
          showStatusBar(settings.value("statusBar", false ).toBool());
          show();
          showClouds(settings.value("showClouds", true ).toBool());
--- trunk/KDE/kdeedu/marble/src/lib/MarbleAboutDialog.cpp #1106953:1106954
@@ -27,6 +27,7 @@
 
 #include <QtCore/QFile>
 #include <QtGui/QTextFrame>
+#include <QtGui/QTabWidget>
 #include <QtCore/QTextStream>
 #include <QtGui/QPixmap>
 
@@ -57,7 +58,14 @@
     d->dataLoaded = false;
     d->licenseLoaded = false;
 
-    d->uiWidget.m_pMarbleLogoLabel->setPixmap( QPixmap( MarbleDirs::path("svg/marble-logo-72dpi.png") ) );
+    if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+        d->uiWidget.m_pMarbleTitleLabel->hide();
+        d->uiWidget.m_pMarbleLogoLabel->hide();
+    }
+    else {
+        d->uiWidget.m_pMarbleLogoLabel->setPixmap( 
+                QPixmap( MarbleDirs::path("svg/marble-logo-72dpi.png") ) );
+    }
     d->uiWidget.m_pMarbleVersionLabel->setText( tr("Version %1").arg(MARBLE_VERSION_STRING) );
 
     connect( d->uiWidget.tabWidget, SIGNAL( currentChanged( int ) ), 
--- trunk/KDE/kdeedu/marble/src/plugins/render/mapscale/MapScaleFloatItem.cpp #1106953:1106954
@@ -98,7 +98,8 @@
             && m_scaleInitDone ) )
     {
         int fontHeight     = QFontMetrics( font() ).ascent();
-        setSize( QSizeF( viewport->width() / 2, 2 * padding() + fontHeight + 3 + m_scaleBarHeight ) );
+        setSize( QSizeF( viewport->width() / 2,
+                         2 * padding() + fontHeight + 3 + m_scaleBarHeight ) );
 
         m_leftBarMargin  = QFontMetrics( font() ).boundingRect( "0" ).width() / 2;
         m_rightBarMargin = QFontMetrics( font() ).boundingRect( "0000" ).width() / 2;
@@ -190,14 +191,23 @@
                 intervalStr.setNum( j * m_valueInterval / 1000 );                
             }
 
+        painter->setFont( font() );
+
         if ( j == 0 ) {
             painter->drawText( 0, fontHeight, "0 " + m_unit );
             lastStringEnds = QFontMetrics( font() ).width( "0 " + m_unit );
             continue;
         }
 
-        currentStringBegin = ( j * m_pixelInterval 
-                               - QFontMetrics( font() ).width( intervalStr ) / 2 );
+        if( j == m_bestDivisor ) {
+            currentStringBegin = ( j * m_pixelInterval 
+                                   - QFontMetrics( font() ).boundingRect( intervalStr ).width() );
+        }
+        else {
+            currentStringBegin = ( j * m_pixelInterval 
+                                   - QFontMetrics( font() ).width( intervalStr ) / 2 );
+        }
+        
         if ( lastStringEnds < currentStringBegin ) {
             painter->drawText( currentStringBegin, fontHeight, intervalStr );
             lastStringEnds = currentStringBegin + QFontMetrics( font() ).width( intervalStr );


More information about the Marble-commits mailing list