-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
115 lines (102 loc) · 3.31 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
/*
* Copyright (C) 2008 Ali Shah <[email protected]>
*
* This file is part of the Qlix project on http://berlios.de
*
* This file may be used under the terms of the GNU General Public
* License version 2.0 as published by the Free Software Foundation
* and appearing in the file COPYING included in the packaging of
* this file.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License version 2.0 for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
//#include <libmtp.h>
#include <QApplication>
#include <QPlastiqueStyle>
#include "widgets/QlixMainWindow.h"
#ifdef LINUX_SIGNALS
#include "linuxsignals.h"
#endif
MtpSubSystem _subSystem;
/**
* This function prints the version of all relevant libraries
**/
void printLibraryVersions()
{
fprintf(stderr, "LibMTP version: " LIBMTP_VERSION_STRING "\n");
fprintf(stderr, "TagLIB version: %d.%d.%d\n",
TAGLIB_MAJOR_VERSION, TAGLIB_MINOR_VERSION, TAGLIB_PATCH_VERSION);
}
/* Parse out command line options:
* --fix-playlists:
* --fix-albums:
* --simulate:
* --debug:
*/
CommandLineOptions ParseCommandLineOptions(unsigned int argc, char* argv[])
{
bool AutoFixPlaylists = false;
bool AutoFixAlbums = false;
bool SimulateTransfers = false;
bool DebugOutput = false;
for (unsigned int i =0; i < argc; i ++)
{
QString str(argv[i]);
str = str.toLower();
if (str == "--fix-playlists")
{
AutoFixPlaylists = true;
cerr << "Automatically fixing bad playlists" << endl;
}
else if (str == "--fix-albums")
{
AutoFixAlbums = true;
cerr << "Automatically fixing bad albums" << endl;
}
else if (str == "--simulate")
{
SimulateTransfers = true;
cerr << "Simulating device transfers" << endl;
}
else if (str == "--debug")
{
DebugOutput = true;
cerr << "Debug output enabled" << endl;
}
}
return CommandLineOptions(AutoFixPlaylists, AutoFixAlbums, SimulateTransfers, DebugOutput);
}
int main(int argc, char* argv[])
{
installSignalHandlers();
printLibraryVersions();
/** Setup Application information, used for settings */
QCoreApplication::setOrganizationName("OSS");
QCoreApplication::setOrganizationDomain("github.com/ahshah/Qlix");
QCoreApplication::setApplicationName("Qlix");
/** Setup QSettings */
QSettings settings;
QString ret = settings.value("DefaultDevice").toString();
/** Setup QApplication */
QApplication app(argc, argv);
/* Plastique doesn't look so great on OSX */
#ifdef LINUX_UI
app.setStyle("Plastique");
#endif
/** Grab AutoFix options */
CommandLineOptions opts = ParseCommandLineOptions(argc, argv);
_subSystem.SetAutoFixOptions(opts);
/** Let the games begin! **/
Q_INIT_RESOURCE(Qlix);
QlixMainWindow qmw(&_subSystem);
qmw.show();
app.exec();
return 0;
}