From 6855a74ff888f57a491e22d6042a7437b91e312b Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 26 Feb 2017 01:56:30 +0100 Subject: UI changes --- data/icon.svg | 37 ---------------------------- data/poi.svg | 17 +++++++++++++ data/resources.qrc | 2 +- smolbote.qbs | 1 - src/browser.cpp | 2 +- src/mainwindow.cpp | 56 +++++++++++++++++++++++++------------------ src/mainwindow.h | 1 + src/mainwindow.ui | 10 -------- src/widgets/webviewtabbar.cpp | 12 +++++----- test/config.toml | 55 +++++++++++++++++++++++++++++------------- 10 files changed, 97 insertions(+), 96 deletions(-) delete mode 100644 data/icon.svg create mode 100644 data/poi.svg diff --git a/data/icon.svg b/data/icon.svg deleted file mode 100644 index a2ae055..0000000 --- a/data/icon.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - Vector Toks, the Lanix Penguin - - - - - - image/svg+xml - - Vector Toks, the Lanix Penguin - 2015-08-01 - - - IBPX, originally by reddit.com/u/creed10 - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/poi.svg b/data/poi.svg new file mode 100644 index 0000000..b7d17ca --- /dev/null +++ b/data/poi.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/data/resources.qrc b/data/resources.qrc index c29d7fe..9387efe 100644 --- a/data/resources.qrc +++ b/data/resources.qrc @@ -1,5 +1,5 @@ - icon.svg + poi.svg diff --git a/smolbote.qbs b/smolbote.qbs index 31cb6b3..47c54d8 100644 --- a/smolbote.qbs +++ b/smolbote.qbs @@ -52,7 +52,6 @@ Project { } files: [ - "data/icon.svg", "data/resources.qrc", "src/browser.cpp", "src/browser.h", diff --git a/src/browser.cpp b/src/browser.cpp index f709e1e..4b49cbe 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -120,7 +120,7 @@ void Browser::setConfigPath(const QString &path) { if(path.isEmpty()) { // set default config path - m_settings = new Settings(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.toml"); + m_settings = new Settings(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/poi.conf"); } else { // set custom config path m_settings = new Settings(path); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6870a65..30751d5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -22,11 +22,8 @@ #include "ui_mainwindow.h" #include #include -#include #include #include "browser.h" -#include "forms/profiledialog.h" -#include #include #include #include @@ -41,25 +38,25 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : urlLineEdit(new UrlLineEdit(navigationToolBar)), progressBar(new LoadingBar(this)) { - // Load profile and connect its signals - loadProfile(sSettings->value("general.profile").toString()); - + // set up UI ui->setupUi(this); - resize(sSettings->value("window.width", 800).toInt(), sSettings->value("window.height", 600).toInt()); + + QMenuBar *menuBar = new QMenuBar(this); + menuBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); // Browser menu - QMenu *browserMenu = new QMenu(qApp->applicationName(), ui->menuBar); - ui->menuBar->addMenu(browserMenu); - browserMenu->addAction(tr("New Window"), this, SLOT(handleNewWindow()), QKeySequence(tr("Ctrl+N"))); - browserMenu->addAction(tr("New Tab"), this, SLOT(addNewTab()), QKeySequence(tr("Ctrl+T"))); + QMenu *browserMenu = new QMenu(qApp->applicationName(), menuBar); + menuBar->addMenu(browserMenu); + browserMenu->addAction(tr("New Window"), this, SLOT(handleNewWindow()), QKeySequence::fromString(sSettings->value("window.shortcuts.windowNew").toString())); + browserMenu->addAction(tr("New Tab"), this, SLOT(addNewTab()), QKeySequence::fromString(sSettings->value("window.shortcuts.tabNew").toString())); browserMenu->addSeparator(); browserMenu->addAction(tr("About"), this, SLOT(about()), QKeySequence(tr("F1"))); browserMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt())); - browserMenu->addAction(tr("Quit"), qApp, SLOT(quit()), QKeySequence(tr("Ctrl+Q"))); + browserMenu->addAction(tr("Quit"), qApp, SLOT(quit()), QKeySequence::fromString(sSettings->value("window.shortcuts.windowClose").toString())); // Tools menu - QMenu *toolsMenu = new QMenu(tr("Tools"), ui->menuBar); - ui->menuBar->addMenu(toolsMenu); + QMenu *toolsMenu = new QMenu(tr("Tools"), menuBar); + menuBar->addMenu(toolsMenu); QAction *downloadsAction = toolsMenu->addAction(tr("Downloads"), Browser::instance()->downloads(), SLOT(show())); downloadsAction->setShortcut(QKeySequence::fromString(sSettings->value("downloads.dialogShortcut").toString())); QAction *bookmarksAction = toolsMenu->addAction(tr("Bookmarks"), Browser::instance()->bookmarks(), SLOT(show())); @@ -68,31 +65,39 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : toolsMenu->addAction(tr("Blocker"), blocklistManager, SLOT(show())); // Profile menu - QMenu *profileMenu = new QMenu(tr("Profile"), ui->menuBar); - ui->menuBar->addMenu(profileMenu); + QMenu *profileMenu = new QMenu(tr("Profile"), menuBar); + menuBar->addMenu(profileMenu); profileMenu->addAction(tr("View profile"), this, SLOT(execProfileEditor())); profileMenu->addAction(tr("Load profile"), this, SLOT(loadProfileGUI())); //profileMenu->addAction(tr("Settings")); //profileMenu->addAction(tr("Cookies")); - navigationToolBar->setMovable(sSettings->value("ui.navtoolbarMovable", true).toBool()); - this->addToolBar(Qt::TopToolBarArea, navigationToolBar); - this->addToolBarBreak(Qt::TopToolBarArea); - tabToolBar->setMovable(sSettings->value("ui.tabtoolbarMovable", true).toBool()); + // Add the toolbars + // tabToolBar: main menu and tab list + tabToolBar->setMovable(sSettings->value("window.ui.tabtoolbarMovable", true).toBool()); + tabToolBar->addWidget(menuBar); + tabToolBar->addWidget(tabBar); this->addToolBar(Qt::TopToolBarArea, tabToolBar); + this->addToolBarBreak(Qt::TopToolBarArea); + // navigationToolBar: address bar + navigationToolBar->setMovable(sSettings->value("window.ui.navtoolbarMovable", true).toBool()); navigationToolBar->addWidget(urlLineEdit); - connect(urlLineEdit, SIGNAL(returnPressed()), this, SLOT(handleUrlChanged())); + this->addToolBar(Qt::TopToolBarArea, navigationToolBar); - tabToolBar->addWidget(tabBar); + // connect signals + connect(urlLineEdit, SIGNAL(returnPressed()), this, SLOT(handleUrlChanged())); connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*))); + // Load profile + loadProfile(sSettings->value("general.profile").toString()); + // loading bar ui->statusBar->addPermanentWidget(progressBar); // shortcuts QAction *focusAddressAction = new QAction(this); - focusAddressAction->setShortcut(QKeySequence::fromString(sSettings->value("shortcuts.focusAddress").toString())); + focusAddressAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.focusAddress").toString())); connect(focusAddressAction, SIGNAL(triggered(bool)), this, SLOT(focusAddress())); addAction(focusAddressAction); @@ -101,6 +106,11 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : } else { addNewTab(sSettings->value("general.homepage", QUrl("about:blank")).toUrl()); } + + resize(sSettings->value("window.width", 800).toInt(), sSettings->value("window.height", 600).toInt()); + if(sSettings->value("window.maximized", false).toBool()) { + showMaximized(); + } } MainWindow::MainWindow(const QStringList urlList, QWidget *parent) : diff --git a/src/mainwindow.h b/src/mainwindow.h index e7fb6c6..afc5537 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -26,6 +26,7 @@ #include "widgets/urllineedit.h" #include #include "webengine/webengineprofile.h" +#include "forms/profiledialog.h" #include #include "widgets/webviewtabbar.h" #include "webengine/urlinterceptor.h" diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 5a9c403..24266d7 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -14,16 +14,6 @@ MainWindow - - - - 0 - 0 - 400 - 26 - - - diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp index 745a7a5..fa8a0e8 100644 --- a/src/widgets/webviewtabbar.cpp +++ b/src/widgets/webviewtabbar.cpp @@ -32,25 +32,25 @@ WebViewTabBar::WebViewTabBar(QWidget *parent) : connect(this, SIGNAL(currentChanged(int)), this, SLOT(handleCurrentChanged(int))); connect(this, SIGNAL(tabMoved(int,int)), this, SLOT(updateVectorArrangement(int,int))); - if(sSettings->contains("shortcuts.tabClose")) { + if(sSettings->contains("window.shortcuts.tabClose")) { QAction *tabCloseAction = new QAction(this); - tabCloseAction->setShortcut(QKeySequence::fromString(sSettings->value("shortcuts.tabClose").toString())); + tabCloseAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabClose").toString())); connect(tabCloseAction, &QAction::triggered, [this]() { this->handleTabClose(currentIndex()); }); addAction(tabCloseAction); } - if(sSettings->contains("shortcuts.tabLeft")) { + if(sSettings->contains("window.shortcuts.tabLeft")) { QAction *tabLeftAction = new QAction(this); - tabLeftAction->setShortcut(QKeySequence::fromString(sSettings->value("shortcuts.tabLeft").toString())); + tabLeftAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabLeft").toString())); connect(tabLeftAction, &QAction::triggered, [this]() { this->setCurrentIndex(currentIndex()-1); }); addAction(tabLeftAction); } - if(sSettings->contains("shortcuts.tabRight")) { + if(sSettings->contains("window.shortcuts.tabRight")) { QAction *tabRightAction = new QAction(this); - tabRightAction->setShortcut(QKeySequence::fromString(sSettings->value("shortcuts.tabRight").toString())); + tabRightAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.tabRight").toString())); connect(tabRightAction, &QAction::triggered, [this]() { this->setCurrentIndex(currentIndex()+1); }); diff --git a/test/config.toml b/test/config.toml index c64509c..7542755 100644 --- a/test/config.toml +++ b/test/config.toml @@ -1,36 +1,57 @@ +# +# poi.conf +# +# See https://gitlab.com/xiannox/smolbote/wikis/settings for options +# + +# Browser: application-wide settings [browser] singleInstance=true localSocket="smolbote-singlelock" +#lastSession="~settings/session.ini" + +# Main window settings +[window] +height=720 +width=1280 +maximized=true +title="$title — smolbote [$profile]" + +# Main window shortcuts +[window.shortcuts] +focusAddress="F4" +tabNew="Ctrl+T" +tabClose="Ctrl+X" +tabLeft="Shift+Left" +tabRight="Shift+Right" +windowNew="Ctrl+N" +windowClose="Ctrl+Q" + +# Main window UI +[window.ui] +navtoolbarMovable=false +tabtoolbarMovable=false +# General [general] homepage="https://duckduckgo.com" newtab="about:blank" profile="Default" +#search="https://duckduckgo.com/?q=$search&kp=-1" +# URL blocker [blocker] dialogShortcut="Ctrl+Shift+A" -path="" -subscriptions=[] +path="blocklist.txt" +#subscriptions=[] +# Bookmark manager [bookmarks] dialogShortcut="Ctrl+Shift+B" path="bookmarks.xbel" +# Download manager [downloads] dialogShortcut="Ctrl+Shift+D" path="~/Downloads" - -[window] -height=720 -width=1280 -title="$title — smolbote [$profile]" - -[shortcuts] -focusAddress="F4" -tabClose="Ctrl+X" -tabLeft="Shift+Left" -tabRight="Shift+Right" - -[ui] -navtoolbarMovable=false -tabtoolbarMovable=false +auto=false -- cgit v1.2.1