-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
124 lines (110 loc) · 4.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
/**
* Log2Log Chat Log Converter
* Execution
* Main File
*
* @author Deltik
* @author igordcard
*
* License:
* This file is part of Log2Log.
*
* Log2Log 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 3 of the License, or
* (at your option) any later version.
*
* Log2Log 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 Log2Log. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <QApplication>
#include <QtCore>
#include "log2log.h"
#include <iostream>
#include "update.h"
#include "conversionconsole.h"
#define N + "/n" +
#define println(a) cout << a << "\n"
using namespace std;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Command Line Processor
QStringList cmdArgs = QCoreApplication::arguments();
bool argsTriggered = false;
if (cmdArgs.size() > 1)
argsTriggered = true;
for (int i = 0; i < cmdArgs.size(); i ++)
{
// Extract
QString argument = cmdArgs[i];
// ARGUMENT: Help
if (argument == "-h" ||
argument == "/h")
argsTriggered = true;
// ARGUMENT: Version
if (argument == "-v")
{
string output = "Log2Log Chat Log Converter ";
output += VERSION;
println(output);
return 0;
}
// ARGUMENT: License
if (argument == "-l" ||
argument == "--license")
{
cout << "Log2Log Chat Log Converter ";
println(VERSION);
println("");
println("Log2Log 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 3 of the License, or (at your option) any later version.");
println("");
println("Log2Log 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.");
println("");
println("You should have received a copy of the GNU General Public License along with Log2Log. If not, see <http://www.gnu.org/licenses/>.");
println("");
return 0;
}
// ARGUMENT: No Interface Mode
if (argument == "-i" ||
argument == "--no-interface")
{
ConversionConsole c(cmdArgs);
return a.exec();
}
}
if (argsTriggered)
{
println("Log2Log Chat Log Converter");
println("");
println("Usage:");
println(" log2log [options] [-f FROM] [-t TO] [-s SOURCE] [-d DESTINATION]");
println("");
println("Help Options:");
println(" -h, --help This help text");
println(" -v, --version Show version information and exit");
println(" -l, --license Show license information and exit");
println("");
println("Application Options:");
println(" -i, --no-interface Run without a user interface");
println(" -f, --from `From` format converter name");
println(" -t, --to `To` format converter name");
println(" -s, --source Chat log source URI");
println(" -d, --destination Chat log destination URI");
println(" -su, --source-username Chat log source username");
println(" -sp, --source-password Chat log source password");
println(" -du, --destination-username Chat log destination username");
println(" -dp, --destination-password Chat log destination password");
return 0;
}
// GUI Execution
Log2Log w;
w.show();
return a.exec();
}