aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-02-26 01:56:30 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-02-26 01:56:30 +0100
commit6855a74ff888f57a491e22d6042a7437b91e312b (patch)
treea5775ffcdedfa8d06c57a0d17b406dec324496cc /src
parentSettings QStringList (diff)
downloadsmolbote-6855a74ff888f57a491e22d6042a7437b91e312b.tar.xz
UI changes
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp2
-rw-r--r--src/mainwindow.cpp56
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/mainwindow.ui10
-rw-r--r--src/widgets/webviewtabbar.cpp12
5 files changed, 41 insertions, 40 deletions
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 <QMenu>
#include <QMenuBar>
-#include <QCloseEvent>
#include <QMessageBox>
#include "browser.h"
-#include "forms/profiledialog.h"
-#include <QApplication>
#include <QInputDialog>
#include <QWebEngineDownloadItem>
#include <QStatusBar>
@@ -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 <QWebEngineView>
#include "webengine/webengineprofile.h"
+#include "forms/profiledialog.h"
#include <QUrl>
#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 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget"/>
- <widget class="QMenuBar" name="menuBar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>26</height>
- </rect>
- </property>
- </widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionNew_Window">
<property name="text">
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);
});