aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-05-29 13:19:13 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-05-29 13:19:13 +0200
commit9711a507150a5b39cfa6e17ea6b4e79b6993cf4b (patch)
tree62dba57aa6ad5a9134d83c10e77c4d148b7ca1b4 /src/mainwindow
parentUpdate about dialog (diff)
downloadsmolbote-9711a507150a5b39cfa6e17ea6b4e79b6993cf4b.tar.xz
Add load profile actions to tab menu
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/widgets/tabwidget.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mainwindow/widgets/tabwidget.cpp b/src/mainwindow/widgets/tabwidget.cpp
index 9608efc..48a1cfb 100644
--- a/src/mainwindow/widgets/tabwidget.cpp
+++ b/src/mainwindow/widgets/tabwidget.cpp
@@ -12,6 +12,7 @@
#include <QContextMenuEvent>
#include <QMenu>
#include <QTabBar>
+#include "browser.h"
TabWidget::TabWidget(QWidget *parent)
: QTabWidget(parent)
@@ -19,7 +20,7 @@ TabWidget::TabWidget(QWidget *parent)
setStyleSheet("QTabBar::tab { width: 200px; }");
setTabsClosable(true);
- setTabBarAutoHide(true);
+ //setTabBarAutoHide(true);
setElideMode(Qt::ElideRight);
setMovable(true);
@@ -54,6 +55,24 @@ TabWidget::TabWidget(QWidget *parent)
deleteTab(i);
}
});
+
+ auto *loadProfile_menu = tabContextMenu->addMenu(tr("Load Profile"));
+ {
+ auto *browser = qobject_cast<Browser *>(qApp);
+ Q_CHECK_PTR(browser);
+
+ for(const QString &name : browser->profiles()) {
+ auto *profileAction = loadProfile_menu->addAction(name);
+ auto *profile = browser->profile(name);
+ Q_CHECK_PTR(profile);
+
+ connect(profileAction, &QAction::triggered, this, [this, profile]() {
+ int index = this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos()));
+ auto *view = qobject_cast<WebView *>(this->widget(index));
+ view->setProfile(profile);
+ });
+ }
+ }
}
TabWidget::~TabWidget()