diff options
-rw-r--r-- | src/main.cpp | 3 | ||||
-rw-r--r-- | src/slxbrowser.cpp | 4 | ||||
-rw-r--r-- | src/slxbrowser.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1504cba..6bd0897 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,11 +38,13 @@ int main(int argc, char** argv) parser.addPositionalArgument("url", "URL to load."); QCommandLineOption ignoreSsl("insecure", "Ignore SSL errors."); QCommandLineOption fullscreen("fullscreen", "Run browser in full screen."); + QCommandLineOption maximized("maximized", "Maximize window on startup"); QCommandLineOption reloadInterval("reload-interval", "Reload displayed page every X seconds.", "seconds"); QCommandLineOption whitelist("whitelist", "Path to a file of allowed URLs. Mutually exclusive with blacklist.", "file"); QCommandLineOption blacklist("blacklist", "Path to a file of disallowed URLs. Mutually exclusive with whitelist.", "file"); parser.addOption(ignoreSsl); parser.addOption(fullscreen); + parser.addOption(maximized); parser.addOption(reloadInterval); parser.addOption(whitelist); parser.addOption(blacklist); @@ -59,6 +61,7 @@ int main(int argc, char** argv) BrowserSettings settings; settings.url = list[0]; settings.fullscreen = parser.isSet(fullscreen); + settings.maximized = parser.isSet(maximized); settings.ignoreSslErrors = parser.isSet(ignoreSsl); settings.reloadInterval = parser.value(reloadInterval).toInt(); if (parser.isSet(whitelist)) { diff --git a/src/slxbrowser.cpp b/src/slxbrowser.cpp index aee94b2..9c7eb03 100644 --- a/src/slxbrowser.cpp +++ b/src/slxbrowser.cpp @@ -13,7 +13,7 @@ static QRegularExpression urlListToRegExp(const QStringList &list); SlxBrowser::SlxBrowser(BrowserSettings settings) : QMainWindow(nullptr), _settings(settings), - _unsupportedUri(false), + _unsupportedUri(false), _blockedSite(false), _lastPageLoad(0), _activity(false), @@ -24,6 +24,8 @@ SlxBrowser::SlxBrowser(BrowserSettings settings) if (_settings.fullscreen) { this->showFullScreen(); this->setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); + } else if (_settings.maximized) { + this->showMaximized(); } //QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWidget *w = new QWidget; diff --git a/src/slxbrowser.h b/src/slxbrowser.h index 16c5da2..1192b7c 100644 --- a/src/slxbrowser.h +++ b/src/slxbrowser.h @@ -15,6 +15,7 @@ struct BrowserSettings { QString url; bool fullscreen; + bool maximized; bool ignoreSslErrors; int reloadInterval; bool isWhitelist; |