-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
executable file
·83 lines (60 loc) · 2.13 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
/*
CoreImage is image viewer
CoreImage 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; version 2
of the License.
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, see {http://www.gnu.org/licenses/}. */
#include "coreimage.h"
#include <QApplication>
#include <QFont>
#include <QStyleFactory>
#include <cprime/validityfunc.h>
#include <cprime/settingsmanage.h>
void startSetup()
{
QApplication::setStyle(QStyleFactory::create("Fusion"));
// set the requried folders
CPrime::ValidityFunc::setupFileFolder(CPrime::FileFolderSetup::MimeFile);
// if setting file not exist create one with defult
SettingsManage sm;
sm.createDefaultSettings();
// set a icon across all the apps
QIcon::setThemeName(sm.getThemeName());
// set one font style across all the apps
QFont fl (sm.getFontStyle(), 10, QFont::Normal);
QApplication::setFont(fl);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setAttribute(Qt::AA_EnableHighDpiScaling);
app.setQuitOnLastWindowClosed(true);
startSetup();
// Set application info
app.setOrganizationName("CoreBox");
app.setApplicationName("CoreImage");
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
const QString files = "[FILE1, FILE2,...]";
parser.addPositionalArgument("files", files, files);
parser.process(app);
QStringList args = parser.positionalArguments();
QStringList paths;
foreach (QString arg, args) {
QFileInfo info(arg);
paths.push_back(info.absoluteFilePath());
}
coreimage e;
if (paths.count()) {
e.sendFiles(paths);
}
e.show();
return app.exec();
}