-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
52 lines (38 loc) · 1.54 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
#include "git_version.h"
#include "mainwindow.h"
#include "shotwin.h"
#include <QApplication>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QSettings>
#include "initstaticplugins.h"
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationDomain("http://github.com/Osse/shotwin");
QCoreApplication::setOrganizationName("Øystein Walle");
QCoreApplication::setApplicationName("Shotwin");
QCoreApplication::setApplicationVersion(GIT_VERSION);
QSettings::setDefaultFormat(QSettings::IniFormat);
QCommandLineParser parser;
parser.setApplicationDescription(QObject::tr("Simple Qt-based view onto a Shotwell database."));
parser.addHelpOption();
parser.addVersionOption();
parser.addOptions({{{"d", "database"}, QObject::tr("Location of Shotwell database."), "database"},
{{"m", "add-map"}, QObject::tr("Add a picture path mapping."), "mapping"},
{{"n", "no-config"}, QObject::tr("Don't update config file.")},
{{"N", "no-use-config"}, QObject::tr("Don't read existing config file.")}});
parser.process(a);
Args args;
if (parser.isSet("database"))
args.database = parser.value("database");
if (parser.isSet("add-map"))
args.mapList = parser.values("add-map");
args.readConfig = !parser.isSet("no-config");
args.updateConfig = !parser.isSet("no-use-config");
Shotwin s;
MainWindow w(&s);
w.handleArgs(args);
w.show();
return a.exec();
}