forked from fotowall/fotowall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
124 lines (106 loc) · 4.04 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/***************************************************************************
* *
* This file is part of the Fotowall project, *
* http://www.enricoros.com/opensource/fotowall *
* *
* Copyright (C) 2007-2008 by Enrico Ros <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "App/App.h"
#include "App/Settings.h"
#include "Shared/RenderOpts.h"
#include "Shared/VideoProvider.h"
#include <QApplication>
#include <QLibraryInfo>
#include <QLocale>
#include <QSettings>
#include <QStyle>
#include <QTime>
#include <QtPlugin>
#if defined(HAS_TRANSLATIONS)
# include <QTranslator>
#endif
#if defined(MOBILE_UI)
# include "App/MainWindowMobile.h"
# include <QFont>
#else
# include "App/MainWindow.h"
#endif
#if defined(Q_OS_SYMBIAN)
# include <aknappui.h>
# include <aknenv.h>
# include <eikappui.h>
# include <eikenv.h>
#endif
// init RenderOpts defaults
bool RenderOpts::LastMirrored = true;
bool RenderOpts::HQRendering = false;
bool RenderOpts::ARGBWindow = false;
bool RenderOpts::PDFExporting = false;
bool RenderOpts::OpenGLWindow = false;
bool RenderOpts::OxygenStyleQuirks = false;
bool VideoProvider::Disable = false;
QColor RenderOpts::hiColor;
int main(int argc, char ** args)
{
#if defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
// use the Raster GraphicsSystem on X11
QApplication::setGraphicsSystem("raster");
#endif
QApplication app(argc, args);
app.setApplicationName("Fotowall");
app.setApplicationVersion("1.0");
app.setOrganizationName("Enrico Ros");
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
app.setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
// Lock Symbian orientation
#ifdef Q_OS_SYMBIAN
// if (CAknAppUi* appUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()))
// appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
#endif
#if defined(HAS_TRANSLATIONS)
// translate fotowall + default-qt messages
QString locale;
QStringList arguments = app.arguments();
// Check for specified locale, or use the system one.
int pos = arguments.indexOf("-locale");
if(pos != -1 && pos < arguments.size() - 1)
locale = arguments.at(pos + 1);
else
locale = QLocale::system().name();
QTranslator translator;
translator.load(QString(":/translations/fotowall_%1").arg(locale));
app.installTranslator(&translator);
QTranslator qtTranslator;
qtTranslator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
#endif
App::settings = new Settings(app.arguments().contains("-clearconfig"));
RenderOpts::OxygenStyleQuirks = app.style()->objectName() == QLatin1String("oxygen");
RenderOpts::hiColor = app.palette().color(QPalette::Highlight);
VideoProvider::Disable = app.arguments().contains("-novideo");
// startup video early.. disabled for production
// VideoProvider::instance()->inputCount();
for(int i = 1; i < argc; i++)
if(App::isContentUrl(args[i])) App::settings->addCommandlineUrl(args[i]);
#if defined(MOBILE_UI)
QFont smallFont = app.font();
smallFont.setPointSize(6);
app.setFont(smallFont);
MainWindowMobile * mainWindow = new MainWindowMobile;
mainWindow->setFont(smallFont);
#else
MainWindow * mainWindow = new MainWindow;
#endif
int mainLoopResult = app.exec();
App::settings->sync();
delete mainWindow;
delete App::settings;
return mainLoopResult;
}