-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
178 lines (150 loc) · 6.21 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/***************************************************************************
* Developer: Pauline123 <[email protected]>, (C) 2014
* Copyright (C) 2007 by Jean-Michel *
* *
* 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. *
* *
* 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 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "dvdread/dvd_reader.h"
#include "k9copy.h"
#include "k9common.h"
#if QT_VERSION >= 0x050000
#else
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#endif
#include "k9assistant.h"
#include "k9dialogs.h"
#include <QDBusAbstractAdaptor>
#include <QDBusVariant>
#include <QDBusConnection>
#include <QDBusError>
#include <QTimer>
#if QT_VERSION >= 0x050000
#include <QApplication>
#include <KAboutData>
#include <KLocalizedString>
#include <QCommandLineParser>
#include <QCommandLineOption>
#else
#include <KLocale>
#endif
#include "k9batch.h"
static const char description[] =
I18N_NOOP("A DVD Backup software for KDE");
static const char version[] = VERSION ;
int main(int argc, char **argv) {
k9batch batch;
if (batch.exec(argc,argv))
return 1;
#if QT_VERSION >= 0x050000
KAboutData about("k9copy", i18n("K9copy"), version,
i18n(description),
KAboutLicense::GPL,
i18n("<p>Copyright (C) 2014 Pauline123</p>"
"<p>(C) 2004-2011 Jean-Michel PETIT</p>"),
QStringLiteral("k9copy-reloaded.sourceforge.net"),
QString(i18n("<p>Please report bugs to:</p>")) + QStringLiteral("<p>[email protected]</p>"));
about.addAuthor(i18n("Pauline123"), i18n("developer"), "[email protected]", 0);
about.addAuthor(i18n("Jean-Michel PETIT"), i18n("developer"), "[email protected]", 0);
QList<KAboutPerson> people = about.authors();
about.addCredit(people[0].name(), people[0].task());
#else
KAboutData about("k9copy", 0, ki18n("k9copy"), version, ki18n(description),
KAboutData::License_GPL,
ki18n("<p>(C) 2014 Pauline123</p>"
"<p>(C) 2004-2011 Jean-Michel PETIT</p>"),
KLocalizedString(), 0,
about.addAuthor( ki18n("Pauline123"), KLocalizedString(), "[email protected]" );
about.addAuthor( ki18n("Jean-Michel PETIT"), KLocalizedString(), "[email protected]" );
about.setTranslator(ki18n("_: NAME OF TRANSLATORS\\nYour names")
,ki18n("_: EMAIL OF TRANSLATORS\\nYour emails"));
#endif
#if QT_VERSION >= 0x050000
QApplication app(argc, argv);
QCommandLineParser parser;
KAboutData::setApplicationData(about);
parser.addVersionOption();
parser.addHelpOption();
#else
KCmdLineArgs::init(argc, argv, &about);
#endif
#if QT_VERSION >= 0x050000
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("input"), i18n("input device"), QLatin1String("device")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("output"), i18n("output device"), QLatin1String("device")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("assistant"), i18n("the k9copy backup assistant")));
about.setupCommandLine(&parser);
parser.process(app);
about.processCommandLine(&parser);
#else
KCmdLineOptions options;
options.add( "input <device>", ki18n("input device"));
options.add("output <device>", ki18n("output device"));
options.add("dvdtitle <number>", ki18n("title to play"));
options.add("assistant", ki18n("the k9copy backup assistant"));
KCmdLineArgs::addCmdLineOptions( options );
#endif
// parser.addOption(QCommandLineOption(QStringList() << QLatin1String("+[URL]"), i18n( "Document to open" )));
#if QT_VERSION >= 0x050000
// QApplication app(argc, argv);
#else
KApplication app;
#endif
k9Tools::setMainThread();
if (app.isSessionRestored()) {
RESTORE(k9Copy);
} else {
// no session.. just start up normally
#if QT_VERSION >= 0x050000
QString InputOptionArg( parser.value("input"));
QString OutputOptionArg( parser.value("output"));
#else
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString InputOptionArg( args->getOption("input"));
QString OutputOptionArg( args->getOption("output"));
#endif
k9Config::checkCodecs();
#if QT_VERSION >= 0x050000
if (!parser.isSet("assistant")) {
#else
if (!args->isSet("assistant")) {
#endif
k9Copy *widget = new k9Copy;
if (InputOptionArg !="") {
widget->setInput( InputOptionArg);
widget->fileOpen();
}
if (OutputOptionArg !="")
widget->setOutput( OutputOptionArg);
if ((InputOptionArg !="") && (OutputOptionArg!=""))
widget->clone( InputOptionArg,OutputOptionArg);
widget->show();
} else {
k9Assistant *ast=k9Assistant::createAssistant();
if (InputOptionArg !="")
ast->setPath(InputOptionArg);
k9Dialogs::setMainWidget(ast);
QTimer::singleShot (10, ast, SLOT (run ()));
}
int res=app.exec();
k9Config config;
if (config.getPrefDelTmpFiles())
k9Tools::clearOutput();
return res;
}
}