#include "browser.h"
#include "browserwindow.h"
#include <QApplication>
QString getCommandLineUrlArgument()
{
const QStringList args = QCoreApplication::arguments();
if (args.count() > 1) {
const QString lastArg = args.last();
const bool isValidUrl = QUrl::fromUserInput(lastArg).isValid();
if (isValidUrl)
return lastArg;
}
return QString();
}
int main(int argc, char **argv)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
app.setWindowIcon(QIcon(QLatin1String(":simplebrowser.svg")));
BrowserWindow *window = new BrowserWindow();
Browser::instance().addWindow(window);
const QString url = getCommandLineUrlArgument();
if (!url.isEmpty())
window->loadPage(url);
else
window->loadHomePage();
return app.exec();
}