• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • apps
  • marble-touch
src/apps/marble-touch/main.cpp
Go to the documentation of this file.
1 // This file is part of the Marble Virtual Globe.
2 //
3 // This program is free software licensed under the GNU LGPL. You can
4 // find a copy of this license in LICENSE.txt in the top directory of
5 // the source code.
6 //
7 // Copyright 2011 Daniel Marth <danielmarth@gmx.at>
8 
9 // A QML-interface of Marble for the Meego operating system.
10 
11 #include <QApplication>
12 #if QT_VERSION < 0x050000
13  #include <QtDeclarative>
14  typedef QDeclarativeView QQuickView;
15 #else
16  #include <QQuickView>
17  #include <QtQml/qqml.h>
18 #endif
19 #include "MarbleDebug.h"
20 #include "MarbleGlobal.h"
21 
22 using namespace Marble;
23 
24 int main( int argc, char *argv[] )
25 {
26  QApplication app( argc, argv );
27  app.setApplicationName( "Marble Touch" );
28  app.setOrganizationName( "KDE" );
29  app.setOrganizationDomain( "kde.org" );
30 
31  app.setProperty( "NoMStyle", true );
32 
33  //MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles();
35  MarbleGlobal::Profiles profiles = MarbleGlobal::SmallScreen | MarbleGlobal::HighResolution;
36 
37  QStringList args = QApplication::arguments();
38  if ( args.contains( "-h" ) || args.contains( "--help" ) ) {
39  qWarning() << "Usage: marble-touch [options]";
40  qWarning();
41  qWarning() << "general options:";
42  qWarning() << " --portrait ................. Force a rotation by 90 degree";
43  qWarning() << " --debug-info ............... write (more) debugging information to the console";
44  qWarning();
45  qWarning() << "profile options (note that marble should automatically detect which profile to use. Override that with the options below):";
46  qWarning() << " --smallscreen .............. Enforce the profile for devices with small screens (e.g. smartphones)";
47  qWarning() << " --highresolution ........... Enforce the profile for devices with high resolution (e.g. desktop computers)";
48  qWarning() << " --nosmallscreen ............ Deactivate the profile for devices with small screens (e.g. smartphones)";
49  qWarning() << " --nohighresolution ......... Deactivate the profile for devices with high resolution (e.g. desktop computers)";
50 
51  return 0;
52  }
53 
54  bool portraitMode = false;
55  for ( int i = 1; i < args.count(); ++i ) {
56  QString const arg = args.at( i );
57 
58  if ( arg == "--debug-info" ) {
59  MarbleDebug::setEnabled( true );
60  }
61  else if ( arg == "--portrait" ) {
62  portraitMode = true;
63  }
64  else if ( arg == "--smallscreen" ) {
65  profiles |= MarbleGlobal::SmallScreen;
66  }
67  else if ( arg == "--nosmallscreen" ) {
68  profiles &= ~MarbleGlobal::SmallScreen;
69  }
70  else if ( arg == "--highresolution" ) {
71  profiles |= MarbleGlobal::HighResolution;
72  }
73  else if ( arg == "--nohighresolution" ) {
74  profiles &= ~MarbleGlobal::HighResolution;
75  }
76  }
77 
78  MarbleGlobal::getInstance()->setProfiles( profiles );
79 
80  // Create main window based on QML.
81  QQuickView view;
82  view.setSource( QUrl( "qrc:/main.qml" ) );
83 
84 #ifdef __arm__
85  // Window takes up full screen on arm (mobile) devices.
86  view.showFullScreen();
87 #else
88  if ( portraitMode ) {
89  view.resize( view.initialSize().height(), view.initialSize().width() );
90 #if QT_VERSION < 0x050000
91  view.setTransform( QTransform().rotate( 90 ) );
92 #endif
93  } else {
94  view.resize( view.initialSize().width(), view.initialSize().height() );
95  }
96  view.show();
97 #endif
98 
99  return app.exec();
100 }
Marble::MarbleGlobal::setProfiles
void setProfiles(Profiles profiles)
Definition: MarbleGlobal.cpp:52
Marble::MarbleGlobal::HighResolution
Definition: MarbleGlobal.h:269
MarbleDebug.h
main
int main(int argc, char *argv[])
Definition: src/apps/marble-touch/main.cpp:24
QQuickView
QDeclarativeView QQuickView
Definition: src/apps/marble-touch/main.cpp:14
MarbleGlobal.h
Marble::MarbleGlobal::SmallScreen
Definition: MarbleGlobal.h:268
Marble::MarbleGlobal::getInstance
static MarbleGlobal * getInstance()
Definition: MarbleGlobal.cpp:37
Marble::MarbleGlobal
Definition: MarbleGlobal.h:258
Marble::MarbleDebug::setEnabled
static void setEnabled(bool enabled)
setEnabled Toggle debug information output generation
Definition: MarbleDebug.cpp:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal