Remove code of past-end-of-line marble-mobile

parent 8f9a314e
project( marble-mobile )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}
${QT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../marble-ui
)
INCLUDE_DIRECTORIES(
${Qt5WebKitWidgets_INCLUDE_DIRS}
)
set( marblemobile_SRCS
main.cpp
MobileMainWindow.cpp
StackableWindow.cpp
)
add_definitions(-DMARBLE_MOBILE_VERSION_STRING="1.7.20")
add_executable( marble-mobile ${marblemobile_SRCS} )
target_link_libraries( marble-mobile ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTMAIN_LIBRARY} marbleui ${MARBLEWIDGET})
This diff is collapsed.
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2006-2010 Torsten Rahn <tackat@kde.org>
// Copyright 2007 Inge Wallin <ingwa@kde.org>
// Copyright 2011-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
//
#ifndef MARBLE_MAINWINDOW_H
#define MARBLE_MAINWINDOW_H
#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QVariantMap>
#include "MapThemeManager.h"
class QAction;
namespace Marble
{
class DownloadRegionDialog;
class GoToDialog;
class MarbleLegendBrowser;
class MarbleWidget;
class RoutingWidget;
class StackableWindow;
class MainWindow : public QMainWindow
{
Q_OBJECT
#ifdef Q_WS_MAEMO_5
enum Orientation {
OrientationAutorotate,
OrientationLandscape,
OrientationPortrait
};
#endif
public:
explicit MainWindow( const QString &marbleDataPath = QString(),
const QVariantMap &cmdLineSettings = QVariantMap(),
QWidget *parent = 0 );
MarbleWidget *marbleWidget();
void addGeoDataFile( const QString &path );
#ifdef Q_WS_MAEMO_5
Orientation orientation() const;
#endif
protected:
void closeEvent( QCloseEvent *event );
private Q_SLOTS:
void initObject( const QVariantMap &cmdLineSettings );
void fallBackToDefaultTheme();
void setWorkOffline( bool );
void setKineticScrollingEnabled( bool );
void setLegendShown( bool show );
// Settings Menu
#ifdef Q_WS_MAEMO_5
void setOrientation( Orientation orientation );
#endif
// Download region dialog
void downloadRegion();
void showBookmarkManagerDialog();
void showAboutMarbleDialog();
void showDownloadRegionDialog();
void showMapViewDialog();
void showRoutingDialog();
void showTrackingDialog();
void showGoToDialog();
private:
static QString readMarbleDataPath();
void readSettings( const QVariantMap &overrideSettings = QVariantMap() );
void writeSettings();
void initializeTrackingWidget();
MarbleWidget *const m_marbleWidget;
MarbleLegendBrowser *const m_legendBrowser;
DownloadRegionDialog *m_downloadRegionDialog;
QDialog *m_mapViewDialog;
StackableWindow *m_routingWindow;
StackableWindow *m_trackingWindow;
GoToDialog *m_gotoDialog;
RoutingWidget *m_routingWidget;
QAction *m_workOfflineAct;
QAction *m_kineticScrollingAction;
QAction *m_showLegendAct;
QNetworkAccessManager m_networkAccessManager;
MapThemeManager m_mapThemeManager;
QString m_lastFileOpenPath;
QStringList m_commandlineFilePaths;
};
} // namespace Marble
#endif
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Dennis Nienhüser <nienhueser@kde.org>
//
#include "StackableWindow.h"
namespace Marble {
StackableWindow::StackableWindow( QWidget *parent, Qt::WindowFlags flags ) :
QMainWindow( parent, flags )
{
#ifdef Q_WS_MAEMO_5
setAttribute( Qt::WA_Maemo5StackedWindow );
#endif // Q_WS_MAEMO_5
setWindowFlags( windowFlags() | Qt::Window );
}
void StackableWindow::closeEvent ( QCloseEvent *event )
{
emit aboutToClose();
QWidget::closeEvent( event );
}
}
#include "moc_StackableWindow.cpp"
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Dennis Nienhüser <nienhueser@kde.org>
//
#ifndef MARBLE_STACKABLEWINDOW_H
#define MARBLE_STACKABLEWINDOW_H
#include <QMainWindow>
namespace Marble
{
/**
* A main window that sets the WA_Maemo5StackedWindow attribute
* to serve as a stackable window on Maemo. It also emits a signal
* when closed.
*/
class StackableWindow : public QMainWindow
{
Q_OBJECT
public:
/** Constructor
* The passed parent should have the WA_Maemo5StackedWindow attribute
* set as well such that this window will appear as a child stackable
* window.
*/
explicit StackableWindow( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
Q_SIGNALS:
/** Emitted prior to the window being closed (hidden) */
void aboutToClose();
protected:
virtual void closeEvent ( QCloseEvent * event );
};
}
#endif
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2006-2007 Torsten Rahn <tackat@kde.org>
// Copyright 2007 Inge Wallin <ingwa@kde.org>
//
#include <QApplication>
#include <QFile>
#include <QDir>
#include <QLocale>
#include <QSettings>
#include <QTranslator>
#include <QProcessEnvironment>
#include "MobileMainWindow.h"
#include "GeoDataCoordinates.h"
#include "MarbleGlobal.h"
#include "MarbleDirs.h"
#include "MarbleDebug.h"
#include "MarbleLocale.h"
#include "MarbleWidget.h"
#include "MarbleTest.h"
#ifdef STATIC_BUILD
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qsvg)
#endif
#ifdef Q_OS_MACX
//for getting app bundle path
#include <ApplicationServices/ApplicationServices.h>
#endif
using namespace Marble;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName( "Marble Virtual Globe" );
app.setOrganizationName( "KDE" );
app.setOrganizationDomain( "kde.org" );
// Widget translation
#ifdef Q_WS_MAEMO_5
// Work around http://bugreports.qt-project.org/browse/QTBUG-1313
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString lang( "C" );
QStringList const locales = QStringList() << "LC_ALL" << "LC_MESSAGES" << "LANG" << "LANGUAGE";
foreach( const QString &locale, locales ) {
if ( env.contains( locale ) && !env.value( locale ).isEmpty() ) {
lang = env.value( locale, "C" );
break;
}
}
lang = lang.section( '_', 0, 0 );
#else
QString lang = QLocale::system().name().section('_', 0, 0);
#endif
QTranslator translator;
translator.load( "marble-" + lang, MarbleDirs::path(QString("lang") ) );
app.installTranslator(&translator);
// For non static builds on mac and win
// we need to be sure we can find the qt image
// plugins. In mac be sure to look in the
// application bundle...
#ifdef Q_WS_WIN
QApplication::addLibraryPath( QApplication::applicationDirPath()
+ QDir::separator() + "plugins" );
#endif
#ifdef Q_OS_MACX
QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus);
qDebug("Adding qt image plugins to plugin search path...");
CFURLRef myBundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFStringRef myMacPath = CFURLCopyFileSystemPath(myBundleRef, kCFURLPOSIXPathStyle);
const char *mypPathPtr = CFStringGetCStringPtr(myMacPath,CFStringGetSystemEncoding());
CFRelease(myBundleRef);
CFRelease(myMacPath);
QString myPath(mypPathPtr);
// if we are not in a bundle assume that the app is built
// as a non bundle app and that image plugins will be
// in system Qt frameworks. If the app is a bundle
// lets try to set the qt plugin search path...
if (myPath.contains(".app"))
{
myPath += "/Contents/plugins";
QApplication::addLibraryPath( myPath );
qDebug( "Added %s to plugin search path", qPrintable( myPath ) );
}
#endif
QString marbleDataPath;
int dataPathIndex=0;
QString mapThemeId;
QString coordinatesString;
QString distanceString;
const MarbleGlobal::Profiles profiles = MarbleGlobal::SmallScreen | MarbleGlobal::HighResolution;
QStringList args = QApplication::arguments();
if ( args.contains( "-h" ) || args.contains( "--help" ) ) {
qWarning() << "Usage: marble [options] [files]";
qWarning();
qWarning() << "[files] can be zero, one or more .kml and/or .gpx files to load and show.";
qWarning();
qWarning() << "general options:";
qWarning() << " --marbledatapath=<path> .... Overwrite the compile-time path to map themes and other data";
qWarning() << " --latlon=<coordinates> ..... Show map at given lat lon coordinates";
qWarning() << " --distance=<value> ......... Set the distance of the observer to the globe (in km)";
qWarning() << " --map=<id> ................. Use map id (e.g. \"earth/openstreetmap/openstreetmap.dgml\")";
qWarning();
qWarning() << "debug options:";
qWarning() << " --debug-info ............... write (more) debugging information to the console";
qWarning() << " --fps ...................... Show the paint performance (paint rate) in the top left corner";
qWarning() << " --runtimeTrace.............. Show the time spent and other debug info of each layer";
qWarning() << " --tile-id................... Write the identifier of texture tiles on top of them";
qWarning() << " --timedemo ................. Measure the paint performance while moving the map and quit";
return 0;
}
for ( int i = 1; i < args.count(); ++i ) {
const QString arg = args.at(i);
if ( arg == QLatin1String( "--debug-info" ) )
{
MarbleDebug::setEnabled( true );
}
else if ( arg.startsWith( QLatin1String( "--marbledatapath=" ), Qt::CaseInsensitive ) )
{
marbleDataPath = args.at(i).mid(17);
}
else if ( arg.compare( QLatin1String( "--marbledatapath" ), Qt::CaseInsensitive ) == 0 ) {
dataPathIndex = i + 1;
marbleDataPath = args.value( dataPathIndex );
++i;
}
else if ( arg.startsWith( QLatin1String( "--latlon=" ), Qt::CaseInsensitive ) )
{
coordinatesString = arg.mid(9);
}
else if ( arg.compare( QLatin1String( "--latlon" ), Qt::CaseInsensitive ) == 0 ) {
++i;
// TODO: misses an error check if there is a value at all
// and error reporting to user (problem also exists with marbledatapath)
coordinatesString = args.value( i );
}
else if ( arg.startsWith( QLatin1String( "--distance=" ), Qt::CaseInsensitive ) )
{
distanceString = arg.mid(11);
}
else if ( arg.compare( QLatin1String( "--distance" ), Qt::CaseInsensitive ) == 0 ) {
++i;
// TODO: misses an error check if there is a value at all
// and error reporting to user (problem also exists with marbledatapath)
distanceString = args.value( i );
}
else if ( arg.startsWith( QLatin1String( "--map=" ), Qt::CaseInsensitive ) )
{
mapThemeId = arg.mid(6);
}
else if ( arg.compare( QLatin1String( "--map" ), Qt::CaseInsensitive ) == 0 ) {
++i;
// TODO: misses an error check if there is a value at all
// and error reporting to user (problem also exists with marbledatapath)
mapThemeId = args.value( i );
}
}
MarbleGlobal::getInstance()->setProfiles( profiles );
MarbleLocale::MeasurementSystem const measurement =
(MarbleLocale::MeasurementSystem)QLocale::system().measurementSystem();
MarbleGlobal::getInstance()->locale()->setMeasurementSystem( measurement );
QVariantMap cmdLineSettings;
if ( !mapThemeId.isEmpty() ) {
cmdLineSettings.insert( QLatin1String("mapTheme"), QVariant(mapThemeId) );
}
if ( !coordinatesString.isEmpty() ) {
bool success = false;
const GeoDataCoordinates coordinates = GeoDataCoordinates::fromString(coordinatesString, success);
if ( success ) {
QVariantList lonLat;
lonLat << QVariant( coordinates.longitude(GeoDataCoordinates::Degree) )
<< QVariant( coordinates.latitude(GeoDataCoordinates::Degree) );
cmdLineSettings.insert( QLatin1String("lonlat"), QVariant(lonLat) );
}
}
if ( !distanceString.isEmpty() ) {
bool success = false;
const qreal distance = distanceString.toDouble(&success);
if ( success ) {
cmdLineSettings.insert( QLatin1String("distance"), QVariant(distance) );
}
}
MainWindow *window = new MainWindow( marbleDataPath, cmdLineSettings );
window->setAttribute( Qt::WA_DeleteOnClose, true );
// window->marbleWidget()->rotateTo( 0, 0, -90 );
// window->show();
for ( int i = 1; i < args.count(); ++i ) {
const QString arg = args.at(i);
if ( arg == "--timedemo" )
{
window->resize(900, 640);
MarbleTest marbleTest( window->marbleWidget() );
marbleTest.timeDemo();
return 0;
}
else if( arg == "--fps" ) {
window->marbleWidget()->setShowFrameRate( true );
}
else if ( arg == "--tile-id" )
{
window->marbleWidget()->setShowTileId(true);
}
else if( arg == "--runtimeTrace" ) {
window->marbleWidget()->setShowRuntimeTrace( true );
}
else if ( i != dataPathIndex && QFile::exists( arg ) ) {
window->addGeoDataFile( QFileInfo( arg ).absoluteFilePath() );
}
}
return app.exec();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment