[Marble-commits] KDE/kdeedu/marble/src

Bastian Holst bastianholst at gmx.de
Wed May 26 18:29:14 CEST 2010


SVN commit 1130863 by bholst:

Marble command line arguments:
* Add --smallscreen --nosmallscreen to the command line parameters of marble's kde and qt version.
* Readd marbledatapath option for kde version.

 M  +0 -2      KdeMainWindow.cpp  
 M  +0 -2      QtMainWindow.cpp  
 M  +40 -1     kdemain.cpp  
 M  +2 -0      lib/global.cpp  
 M  +2 -1      lib/global.h  
 M  +15 -1     qtmain.cpp  


--- trunk/KDE/kdeedu/marble/src/KdeMainWindow.cpp #1130862:1130863
@@ -36,8 +36,6 @@
 MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
     : KXmlGuiWindow( parent )
 {
-    MarbleGlobal::getInstance()->setProfiles( MarbleGlobal::detectProfiles() );
-    
     m_part = new MarblePart( this, this, QStringList() << marbleDataPath );
 
     setCentralWidget( m_part->widget() );
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1130862:1130863
@@ -65,8 +65,6 @@
         QMainWindow(parent), m_sunControlDialog(0), m_downloadRegionAction( 0 ),
         m_downloadRegionDialog( 0 )
 {
-    MarbleGlobal::getInstance()->setProfiles( MarbleGlobal::detectProfiles() );
-
     setUpdatesEnabled( false );
     
     QString selectedPath = marbleDataPath.isEmpty() ? readMarbleDataPath() : marbleDataPath;
--- trunk/KDE/kdeedu/marble/src/kdemain.cpp #1130862:1130863
@@ -224,6 +224,8 @@
 
     KCmdLineArgs::init( argc, argv, &aboutData );
 
+    // Autodetect profiles
+    MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles();
     
     KCmdLineOptions  options;
     options.add( "debug-info", ki18n( "Enable debug output" ) );
@@ -234,19 +236,56 @@
     options.add( "enableFileView",
                  ki18n( "Enable tab to see gpxFileView" ) );
     options.add( "tile-id", ki18n( "Show tile id's" ) );
+    options.add( "marbledatapath \<data path>", ki18n( "Use a different directory which contains map data" ) );
+    if( profiles & MarbleGlobal::SmallScreen ) {
+        options.add( "nosmallscreen", ki18n( "Do not use the interface optimized for small screens" ) );
+    }
+    else {
+        options.add( "smallscreen", ki18n( "Use the interface optimized for small screens" ) );
+    }
+    if( profiles & MarbleGlobal::HighResolution ) {
+        options.add( "nohighresolution", ki18n( "Do not use the interface optimized for high resolutions" ) );
+    }
+    else {
+        options.add( "highresolution", ki18n( "Use the interface optimized for high resolutions" ) );
+    }
+    options.add( "+[file]", ki18n( "One or more placemark files to be opened" ) );
+
     KCmdLineArgs::addCmdLineOptions( options );
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
     KApplication app;
     KGlobal::locale()->insertCatalog( "marble_qt" );
 
+    
+
     if ( args->isSet( "debug-info" ) ) {
         MarbleDebug::enable = true;
     } else {
         MarbleDebug::enable = false;
     }
 
-    MainWindow *window = new MainWindow();
+    if ( args->isSet( "smallscreen" ) ) {
+        profiles |= MarbleGlobal::SmallScreen;
+    }
+    else {
+        profiles &= ~MarbleGlobal::SmallScreen;
+    }
+
+    if ( args->isSet( "highresolution" ) ) {
+        profiles |= MarbleGlobal::HighResolution;
+    }
+    else {
+        profiles &= ~MarbleGlobal::HighResolution;
+    }
+
+    MarbleGlobal::getInstance()->setProfiles( profiles );
+
+    QString marbleDataPath = args->getOption( "marbledatapath" );
+    if( marbleDataPath.isEmpty() ) {
+        marbleDataPath = QString();
+    }
+    MainWindow *window = new MainWindow( marbleDataPath );
     window->setAttribute( Qt::WA_DeleteOnClose, true );
     window->show();
 
--- trunk/KDE/kdeedu/marble/src/lib/global.cpp #1130862:1130863
@@ -58,9 +58,11 @@
     // Checking Qt for maemo flags to find out if we are on a small screen device.
 #ifdef Q_WS_HILDON // flag for Qt 4.5 (diablo and fremantle)
     profile |= MarbleGlobal::SmallScreen;
+    profile |= MarbleGlobal::HighResolution;
 #endif
 #ifdef Q_WS_MAEMO_5
     profile |= MarbleGlobal::SmallScreen;
+    profile |= MarbleGlobal::HighResolution;
 #endif
 
     return profile;
--- trunk/KDE/kdeedu/marble/src/lib/global.h #1130862:1130863
@@ -244,7 +244,8 @@
     
     enum Profile {
         Default = 0x0,
-        SmallScreen = 0x1
+        SmallScreen = 0x1,
+        HighResolution = 0x2
     };
     
     Q_DECLARE_FLAGS( Profiles, Profile )
--- trunk/KDE/kdeedu/marble/src/qtmain.cpp #1130862:1130863
@@ -84,18 +84,32 @@
 
     QString marbleDataPath;
     int dataPathIndex=0;
+    MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles();
 
     for ( int i = 1; i < argc; ++i ) {
         if ( strcmp( argv[ i ], "--debug-info" ) == 0 )
         {
             MarbleDebug::enable = true;
         }
-        if ( strcmp( argv[ i ], "--marbleDataPath" ) == 0 && i + 1 < argc )
+        else if ( strcmp( argv[ i ], "--marbledatapath" ) == 0 && i + 1 < argc )
         {
             dataPathIndex = i + 1;
             marbleDataPath = argv[ dataPathIndex ];
         }
+        else if ( strcmp( argv[ i ], "--smallscreen" ) == 0 ) {
+            profiles |= MarbleGlobal::SmallScreen;
     }
+        else if ( strcmp( argv[ i ], "--nosmallscreen" ) == 0 ) {
+            profiles &= ~MarbleGlobal::SmallScreen;
+        }
+        else if ( strcmp( argv[ i ], "--highresolution" ) == 0 ) {
+            profiles |= MarbleGlobal::HighResolution;
+        }
+        else if ( strcmp( argv[ i ], "--nohighresolution" ) == 0 ) {
+            profiles &= ~MarbleGlobal::HighResolution;
+        }
+    }
+    MarbleGlobal::getInstance()->setProfiles( profiles );
 
     MainWindow *window = new MainWindow( marbleDataPath );
     window->setAttribute( Qt::WA_DeleteOnClose, true );


More information about the Marble-commits mailing list