blob: a0ec78f02b360b392472d981a0ae413882364db6 (
plain)
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
|
#include "browser.h"
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName("qtwebenginebrowser");
app.setApplicationVersion("0.0.0");
QCommandLineParser parser;
parser.setApplicationDescription("Test browser using QtWebEngine");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("URL", "URL to open");
QCommandLineOption configOption(QStringList() << "c" << "config", "Set configuration file.", "PATH", "config.ini");
parser.addOption(configOption);
parser.process(app);
Browser instance(parser.value(configOption));
if(parser.positionalArguments().length() > 0) {
QUrl url = QUrl::fromUserInput(parser.positionalArguments().at(0));
if(url.isValid()) {
instance.addWindow(new MainWindow(&instance, url));
} else {
instance.addWindow(new MainWindow(&instance));
}
} else {
instance.addWindow(new MainWindow(&instance));
}
return app.exec();
}
|