diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-08-23 12:53:45 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-09-05 23:07:42 +0300 |
commit | c7bb4ef3b9817d800809f0d3a52e96914aa2c7d8 (patch) | |
tree | bf8ddf8e13d0f652022aade80c63a0ec6d7b066c /src | |
parent | Add RekonqView_fake class (diff) | |
download | rekonq-c7bb4ef3b9817d800809f0d3a52e96914aa2c7d8.tar.xz |
Add placeholder menus to main window
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 29 | ||||
-rw-r--r-- | src/application_instance.cpp | 3 | ||||
-rw-r--r-- | src/rekonqwindow.cpp | 14 | ||||
-rw-r--r-- | src/rekonqwindow.ui | 97 | ||||
-rw-r--r-- | src/urlbar/urlbar.h | 1 |
5 files changed, 112 insertions, 32 deletions
diff --git a/src/application.cpp b/src/application.cpp index 88466d73..63263278 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -387,29 +387,20 @@ RekonqWindow *Application::newWindow() RekonqView *Application::newView(const QUrl &url, RekonqWindow *window) { + RekonqView *view = nullptr; + #ifdef QT_DEBUG - if (url.isEmpty()) { - auto *view = new RekonqView_fake(window); - if (window == nullptr) { - m_views.append(view); - view->show(); - } - else - window->addView(view); - return view; - } + if (url.isEmpty()) view = new RekonqView_fake(window); + else #endif - - RekonqPluginInterface *interface = nullptr; - for (const auto &plugin : m_plugins) - if (plugin->hasScheme(url.scheme())) { - interface = plugin->interface(); - break; + for (const auto &plugin : m_plugins) { + if (plugin->hasScheme(url.scheme())) { + view = plugin->interface()->view(url); + break; + } } - if (interface == nullptr) return nullptr; - - auto *view = interface->view(url); + if (view == nullptr) return view; Q_CHECK_PTR(view); // tab->installEventFilter(this); diff --git a/src/application_instance.cpp b/src/application_instance.cpp index 8c744d10..a82e9a72 100644 --- a/src/application_instance.cpp +++ b/src/application_instance.cpp @@ -9,6 +9,7 @@ * ============================================================ */ #include "application.hpp" +#include "rsettings.hpp" #include <QCommandLineParser> static const char *description = "A lightweight Web Browser based on Qt WebEngine"; @@ -49,7 +50,7 @@ void Application::parseCommandLine(quint32 instanceId, const QByteArray &message else { // create main window auto *window = newWindow(); - if (positionalArguments.isEmpty()) newView(QUrl(), window); + if (positionalArguments.isEmpty()) newView(m_settings->value("homepage").toUrl(), window); else for (const auto &url : positionalArguments) newView(QUrl::fromUserInput(url), window); } diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp index 34a8f5b5..4f3e57f1 100644 --- a/src/rekonqwindow.cpp +++ b/src/rekonqwindow.cpp @@ -29,12 +29,22 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re }); connect(ui->tabs, &TabBar::removeView, this, [this](RekonqView *view) { ui->views->removeWidget(view); }); - // connect actions + // connect menu actions + // file menu + connect(ui->actionQuit, &QAction::triggered, qApp, &QApplication::quit); + // edit menu + // view menu + // history menu + // bookmarks menu + // settings menu connect(ui->actionSettings, &QAction::triggered, this, [this]() { (new SettingsDialog(Application::instance()->settings(), this))->show(); }); connect(ui->actionTaskManager, &QAction::triggered, this, [this]() { (new TaskManager(this))->show(); }); + // help menu + connect(ui->actionAboutQt, &QAction::triggered, qApp, &QApplication::aboutQt); - connect(ui->newTab, &QToolButton::clicked, this, [this]() { Application::instance()->newView(QUrl(), this); }); + connect(ui->newTab, &QToolButton::clicked, this, + [this]() { Application::instance()->newView(QUrl("about:blank"), this); }); } RekonqWindow::~RekonqWindow() { delete ui; } diff --git a/src/rekonqwindow.ui b/src/rekonqwindow.ui index 1105f300..9e3986e1 100644 --- a/src/rekonqwindow.ui +++ b/src/rekonqwindow.ui @@ -16,7 +16,7 @@ <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QHBoxLayout" name="tabBarLayout"> <item> <widget class="TabBar" name="tabs" native="true"/> </item> @@ -30,10 +30,38 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="urlBarLayout"> + <item> + <widget class="QToolButton" name="back"> + <property name="text"> + <string>Back</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="forward"> + <property name="text"> + <string>Forward</string> + </property> + </widget> + </item> <item> <widget class="UrlBar" name="urlBar"/> </item> + <item> + <widget class="QToolButton" name="load"> + <property name="text"> + <string>Load</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="menu"> + <property name="text"> + <string>Menu</string> + </property> + </widget> + </item> </layout> </item> <item> @@ -47,19 +75,57 @@ <x>0</x> <y>0</y> <width>800</width> - <height>30</height> + <height>22</height> </rect> </property> - <widget class="QMenu" name="menurekonq"> + <widget class="QMenu" name="menuFile"> <property name="title"> - <string>rekonq</string> + <string>File</string> + </property> + <addaction name="actionQuit"/> + </widget> + <widget class="QMenu" name="menuEdit"> + <property name="title"> + <string>Edit</string> + </property> + </widget> + <widget class="QMenu" name="menuView"> + <property name="title"> + <string>View</string> </property> - <addaction name="actionTaskManager"/> - <addaction name="separator"/> - <addaction name="actionSettings"/> <addaction name="actionCloseWindow"/> </widget> - <addaction name="menurekonq"/> + <widget class="QMenu" name="menuHistory"> + <property name="title"> + <string>History</string> + </property> + </widget> + <widget class="QMenu" name="menuBookmarks"> + <property name="title"> + <string>Bookmarks</string> + </property> + </widget> + <widget class="QMenu" name="menuSettings"> + <property name="title"> + <string>Settings</string> + </property> + <addaction name="actionSettings"/> + <addaction name="separator"/> + <addaction name="actionTaskManager"/> + </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionAboutQt"/> + </widget> + <addaction name="menuFile"/> + <addaction name="menuEdit"/> + <addaction name="menuView"/> + <addaction name="menuHistory"/> + <addaction name="menuBookmarks"/> + <addaction name="menuSettings"/> + <addaction name="menuHelp"/> </widget> <widget class="QStatusBar" name="statusbar"/> <action name="actionTaskManager"> @@ -80,6 +146,19 @@ <string>Configure rekonq</string> </property> </action> + <action name="actionQuit"> + <property name="text"> + <string>&Quit</string> + </property> + <property name="shortcut"> + <string>Ctrl+Q</string> + </property> + </action> + <action name="actionAboutQt"> + <property name="text"> + <string>About Qt</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index cdfcc14f..da34151e 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -33,7 +33,6 @@ protected: }; // Definitions -class QProgressBar; typedef QList<IconButton *> IconButtonPointerList; class UrlBar : public QLineEdit { |