mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
TabManager: Add an option to use it as main tabbar replacement.
- Note: in `TabBar::setVisible()` we didn't need to check `(visible && m_window->isFullScreen())` because tabbar's visibility in fullscreen mode is managed by m_navigationContainer.
This commit is contained in:
parent
ceca46e836
commit
33553a049a
|
@ -47,6 +47,7 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
|
||||||
, m_clickedTab(0)
|
, m_clickedTab(0)
|
||||||
, m_normalTabWidth(0)
|
, m_normalTabWidth(0)
|
||||||
, m_activeTabWidth(0)
|
, m_activeTabWidth(0)
|
||||||
|
, m_forceHidden(false)
|
||||||
{
|
{
|
||||||
setObjectName("tabbar");
|
setObjectName("tabbar");
|
||||||
setElideMode(Qt::ElideRight);
|
setElideMode(Qt::ElideRight);
|
||||||
|
@ -97,7 +98,9 @@ TabWidget* TabBar::tabWidget() const
|
||||||
|
|
||||||
void TabBar::setVisible(bool visible)
|
void TabBar::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (visible && m_window->isFullScreen()) {
|
if (m_forceHidden) {
|
||||||
|
hideTabPreview(false);
|
||||||
|
ComboTabBar::setVisible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +112,12 @@ void TabBar::setVisible(bool visible)
|
||||||
ComboTabBar::setVisible(visible);
|
ComboTabBar::setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabBar::setForceHidden(bool hidden)
|
||||||
|
{
|
||||||
|
m_forceHidden = hidden;
|
||||||
|
setVisible(!m_forceHidden);
|
||||||
|
}
|
||||||
|
|
||||||
void TabBar::overflowChanged(bool overflowed)
|
void TabBar::overflowChanged(bool overflowed)
|
||||||
{
|
{
|
||||||
// Make sure close buttons on inactive tabs are hidden
|
// Make sure close buttons on inactive tabs are hidden
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
TabWidget* tabWidget() const;
|
TabWidget* tabWidget() const;
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
void setForceHidden(bool hidden);
|
||||||
|
|
||||||
void overrideTabTextColor(int index, QColor color);
|
void overrideTabTextColor(int index, QColor color);
|
||||||
void restoreTabTextColor(int index);
|
void restoreTabTextColor(int index);
|
||||||
|
@ -108,6 +109,8 @@ private:
|
||||||
|
|
||||||
QColor m_originalTabTextColor;
|
QColor m_originalTabTextColor;
|
||||||
QPoint m_dragStartPosition;
|
QPoint m_dragStartPosition;
|
||||||
|
|
||||||
|
bool m_forceHidden;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABBAR_H
|
#endif // TABBAR_H
|
||||||
|
|
|
@ -4,16 +4,19 @@ os2: TARGET = TabManPl
|
||||||
|
|
||||||
SOURCES += tabmanagerplugin.cpp \
|
SOURCES += tabmanagerplugin.cpp \
|
||||||
tabmanagerwidget.cpp \
|
tabmanagerwidget.cpp \
|
||||||
tabmanagerwidgetcontroller.cpp
|
tabmanagerwidgetcontroller.cpp \
|
||||||
|
tabmanagersettings.cpp
|
||||||
|
|
||||||
HEADERS += tabmanagerplugin.h \
|
HEADERS += tabmanagerplugin.h \
|
||||||
tabmanagerwidget.h \
|
tabmanagerwidget.h \
|
||||||
tabmanagerwidgetcontroller.h
|
tabmanagerwidgetcontroller.h \
|
||||||
|
tabmanagersettings.h
|
||||||
|
|
||||||
RESOURCES += tabmanagerplugin.qrc
|
RESOURCES += tabmanagerplugin.qrc
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
tabmanagerwidget.ui
|
tabmanagerwidget.ui \
|
||||||
|
tabmanagersettings.ui
|
||||||
|
|
||||||
TRANSLATIONS = \
|
TRANSLATIONS = \
|
||||||
translations/fa_IR.ts
|
translations/fa_IR.ts
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include "pluginproxy.h"
|
#include "pluginproxy.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "sidebar.h"
|
#include "sidebar.h"
|
||||||
|
#include "tabwidget.h"
|
||||||
|
#include "tabbar.h"
|
||||||
|
#include "tabmanagersettings.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
@ -36,7 +39,9 @@ TabManagerPlugin::TabManagerPlugin()
|
||||||
: QObject()
|
: QObject()
|
||||||
, m_controller(0)
|
, m_controller(0)
|
||||||
, m_tabManagerWidget(0)
|
, m_tabManagerWidget(0)
|
||||||
|
, m_viewType(Undefined)
|
||||||
, m_initState(false)
|
, m_initState(false)
|
||||||
|
, m_asTabBarReplacement(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +51,7 @@ PluginSpec TabManagerPlugin::pluginSpec()
|
||||||
spec.name = "Tab Manager";
|
spec.name = "Tab Manager";
|
||||||
spec.info = "Simple yet powerful tab manager for QupZilla";
|
spec.info = "Simple yet powerful tab manager for QupZilla";
|
||||||
spec.description = "Adds ability to managing tabs and windows";
|
spec.description = "Adds ability to managing tabs and windows";
|
||||||
spec.version = "0.4.1";
|
spec.version = "0.5.0";
|
||||||
spec.author = "Razi Alavizadeh <s.r.alavizadeh@gmail.com>";
|
spec.author = "Razi Alavizadeh <s.r.alavizadeh@gmail.com>";
|
||||||
spec.icon = QPixmap(":tabmanager/data/tabmanager.png");
|
spec.icon = QPixmap(":tabmanager/data/tabmanager.png");
|
||||||
spec.hasSettings = true;
|
spec.hasSettings = true;
|
||||||
|
@ -59,7 +64,7 @@ void TabManagerPlugin::init(InitState state, const QString &settingsPath)
|
||||||
Q_UNUSED(state)
|
Q_UNUSED(state)
|
||||||
|
|
||||||
m_controller = new TabManagerWidgetController(this);
|
m_controller = new TabManagerWidgetController(this);
|
||||||
connect(mApp->plugins(), SIGNAL(mainWindowCreated(BrowserWindow*)), m_controller, SLOT(mainWindowCreated(BrowserWindow*)));
|
connect(mApp->plugins(), SIGNAL(mainWindowCreated(BrowserWindow*)), this, SLOT(mainWindowCreated(BrowserWindow*)));
|
||||||
connect(mApp->plugins(), SIGNAL(mainWindowDeleted(BrowserWindow*)), m_controller, SLOT(mainWindowDeleted(BrowserWindow*)));
|
connect(mApp->plugins(), SIGNAL(mainWindowDeleted(BrowserWindow*)), m_controller, SLOT(mainWindowDeleted(BrowserWindow*)));
|
||||||
connect(mApp->plugins(), SIGNAL(webPageCreated(WebPage*)), m_controller, SIGNAL(requestRefreshTree()));
|
connect(mApp->plugins(), SIGNAL(webPageCreated(WebPage*)), m_controller, SIGNAL(requestRefreshTree()));
|
||||||
connect(mApp->plugins(), SIGNAL(webPageDeleted(WebPage*)), m_controller, SIGNAL(requestRefreshTree(WebPage*)));
|
connect(mApp->plugins(), SIGNAL(webPageDeleted(WebPage*)), m_controller, SIGNAL(requestRefreshTree(WebPage*)));
|
||||||
|
@ -71,21 +76,19 @@ void TabManagerPlugin::init(InitState state, const QString &settingsPath)
|
||||||
QSettings settings(s_settingsPath + QL1S("/tabmanager.ini"), QSettings::IniFormat);
|
QSettings settings(s_settingsPath + QL1S("/tabmanager.ini"), QSettings::IniFormat);
|
||||||
settings.beginGroup("View");
|
settings.beginGroup("View");
|
||||||
m_controller->setGroupType(TabManagerWidget::GroupType(settings.value("GroupType", TabManagerWidget::GroupByWindow).toInt()));
|
m_controller->setGroupType(TabManagerWidget::GroupType(settings.value("GroupType", TabManagerWidget::GroupByWindow).toInt()));
|
||||||
m_controller->setViewType(TabManagerWidgetController::ViewType(settings.value("ViewType", TabManagerWidgetController::ShowAsWindow).toInt()));
|
m_viewType = ViewType(settings.value("ViewType", ShowAsWindow).toInt());
|
||||||
|
m_asTabBarReplacement = settings.value("AsTabBarReplacement", false).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
setAsTabBarReplacement(m_asTabBarReplacement);
|
||||||
insertManagerWidget();
|
insertManagerWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabManagerPlugin::unload()
|
void TabManagerPlugin::unload()
|
||||||
{
|
{
|
||||||
// save settings
|
saveSettings();
|
||||||
QSettings settings(s_settingsPath + QL1S("/tabmanager.ini"), QSettings::IniFormat);
|
|
||||||
settings.beginGroup("View");
|
|
||||||
settings.setValue("GroupType", m_controller->groupType());
|
|
||||||
settings.setValue("ViewType", m_controller->viewType());
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
|
setTabBarVisible(true);
|
||||||
removeManagerWidget();
|
removeManagerWidget();
|
||||||
|
|
||||||
delete m_controller;
|
delete m_controller;
|
||||||
|
@ -105,40 +108,13 @@ QTranslator* TabManagerPlugin::getTranslator(const QString &locale)
|
||||||
|
|
||||||
void TabManagerPlugin::showSettings(QWidget* parent)
|
void TabManagerPlugin::showSettings(QWidget* parent)
|
||||||
{
|
{
|
||||||
bool ok;
|
TabManagerSettings* settings = new TabManagerSettings(this, parent);
|
||||||
QString viewType = QInputDialog::getItem(parent, tr("Tab Manager View Type"),
|
settings->exec();
|
||||||
tr("<p>Please select view type:<br />"
|
|
||||||
"<b>Note:</b> The \"<i>Window</i>\" type is recommended for managing lots of windows/tabs")
|
|
||||||
, QStringList() << tr("SideBar") << tr("Window")
|
|
||||||
, m_controller->viewType(), false, &ok, Qt::WindowStaysOnTopHint);
|
|
||||||
TabManagerWidgetController::ViewType type;
|
|
||||||
if (viewType == tr("SideBar")) {
|
|
||||||
type = TabManagerWidgetController::ShowAsSideBar;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
type = TabManagerWidgetController::ShowAsWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok && type != m_controller->viewType()) {
|
|
||||||
removeManagerWidget();
|
|
||||||
m_controller->setViewType(type);
|
|
||||||
insertManagerWidget();
|
|
||||||
|
|
||||||
if (type == TabManagerWidgetController::ShowAsSideBar) {
|
|
||||||
mApp->getWindow()->sideBarManager()->showSideBar("TabManager");
|
|
||||||
}
|
|
||||||
else if (type == TabManagerWidgetController::ShowAsWindow) {
|
|
||||||
// add statusbar icon
|
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
|
||||||
m_controller->addStatusBarIcon(window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabManagerPlugin::populateExtensionsMenu(QMenu* menu)
|
void TabManagerPlugin::populateExtensionsMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
if (m_controller->viewType() == TabManagerWidgetController::ShowAsWindow) {
|
if (viewType() == ShowAsWindow) {
|
||||||
QAction* showAction = m_controller->createMenuAction();
|
QAction* showAction = m_controller->createMenuAction();
|
||||||
showAction->setParent(menu);
|
showAction->setParent(menu);
|
||||||
showAction->setCheckable(false);
|
showAction->setCheckable(false);
|
||||||
|
@ -149,10 +125,10 @@ void TabManagerPlugin::populateExtensionsMenu(QMenu* menu)
|
||||||
|
|
||||||
void TabManagerPlugin::insertManagerWidget()
|
void TabManagerPlugin::insertManagerWidget()
|
||||||
{
|
{
|
||||||
if (m_controller->viewType() == TabManagerWidgetController::ShowAsSideBar) {
|
if (viewType() == ShowAsSideBar) {
|
||||||
SideBarManager::addSidebar("TabManager", m_controller);
|
SideBarManager::addSidebar("TabManager", m_controller);
|
||||||
}
|
}
|
||||||
else if (m_controller->viewType() == TabManagerWidgetController::ShowAsWindow) {
|
else if (viewType() == ShowAsWindow) {
|
||||||
if (!m_tabManagerWidget) {
|
if (!m_tabManagerWidget) {
|
||||||
m_tabManagerWidget = m_controller->createTabManagerWidget(mApp->getWindow(), 0, true);
|
m_tabManagerWidget = m_controller->createTabManagerWidget(mApp->getWindow(), 0, true);
|
||||||
m_tabManagerWidget->setWindowFlags(Qt::Window);
|
m_tabManagerWidget->setWindowFlags(Qt::Window);
|
||||||
|
@ -161,19 +137,43 @@ void TabManagerPlugin::insertManagerWidget()
|
||||||
|
|
||||||
if (m_initState) {
|
if (m_initState) {
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
foreach (BrowserWindow* window, mApp->windows()) {
|
||||||
m_controller->mainWindowCreated(window, false);
|
mainWindowCreated(window, false);
|
||||||
|
}
|
||||||
|
m_initState = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManagerPlugin::mainWindowCreated(BrowserWindow* window, bool refresh)
|
||||||
|
{
|
||||||
|
if (window) {
|
||||||
|
window->tabWidget()->tabBar()->setForceHidden(m_asTabBarReplacement);
|
||||||
|
|
||||||
|
if (m_viewType == ShowAsWindow) {
|
||||||
|
m_controller->addStatusBarIcon(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_initState = false;
|
connect(window->tabWidget(), SIGNAL(currentChanged(int)), m_controller, SIGNAL(requestRefreshTree()));
|
||||||
|
connect(window->tabWidget(), SIGNAL(pinStateChanged(int,bool)), m_controller, SIGNAL(pinStateChanged(int,bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (refresh) {
|
||||||
|
m_controller->emitRefreshTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManagerPlugin::setTabBarVisible(bool visible)
|
||||||
|
{
|
||||||
|
foreach (BrowserWindow* window, mApp->windows()) {
|
||||||
|
window->tabWidget()->tabBar()->setForceHidden(!visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabManagerPlugin::removeManagerWidget()
|
void TabManagerPlugin::removeManagerWidget()
|
||||||
{
|
{
|
||||||
if (m_controller->viewType() == TabManagerWidgetController::ShowAsSideBar) {
|
if (viewType() == ShowAsSideBar) {
|
||||||
SideBarManager::removeSidebar("TabManager");
|
SideBarManager::removeSidebar("TabManager");
|
||||||
}
|
}
|
||||||
else if (m_controller->viewType() == TabManagerWidgetController::ShowAsWindow) {
|
else if (viewType() == ShowAsWindow) {
|
||||||
// remove statusbar icon
|
// remove statusbar icon
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
foreach (BrowserWindow* window, mApp->windows()) {
|
||||||
m_controller->removeStatusBarIcon(window);
|
m_controller->removeStatusBarIcon(window);
|
||||||
|
@ -185,7 +185,56 @@ void TabManagerPlugin::removeManagerWidget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TabManagerPlugin::ViewType TabManagerPlugin::viewType()
|
||||||
|
{
|
||||||
|
return m_viewType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManagerPlugin::setViewType(ViewType type)
|
||||||
|
{
|
||||||
|
if (m_viewType != type) {
|
||||||
|
removeManagerWidget();
|
||||||
|
m_viewType = type;
|
||||||
|
insertManagerWidget();
|
||||||
|
|
||||||
|
if (!m_initState) {
|
||||||
|
if (m_viewType == ShowAsSideBar) {
|
||||||
|
mApp->getWindow()->sideBarManager()->showSideBar("TabManager");
|
||||||
|
}
|
||||||
|
else if (m_viewType == ShowAsWindow) {
|
||||||
|
// add statusbar icon
|
||||||
|
foreach (BrowserWindow* window, mApp->windows()) {
|
||||||
|
m_controller->addStatusBarIcon(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString TabManagerPlugin::settingsPath()
|
QString TabManagerPlugin::settingsPath()
|
||||||
{
|
{
|
||||||
return s_settingsPath;
|
return s_settingsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabManagerPlugin::saveSettings()
|
||||||
|
{
|
||||||
|
QSettings settings(s_settingsPath + QL1S("/tabmanager.ini"), QSettings::IniFormat);
|
||||||
|
settings.beginGroup("View");
|
||||||
|
settings.setValue("GroupType", m_controller->groupType());
|
||||||
|
settings.setValue("ViewType", viewType());
|
||||||
|
settings.setValue("AsTabBarReplacement", asTabBarReplacement());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TabManagerPlugin::asTabBarReplacement() const
|
||||||
|
{
|
||||||
|
return m_asTabBarReplacement;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManagerPlugin::setAsTabBarReplacement(bool yes)
|
||||||
|
{
|
||||||
|
m_asTabBarReplacement = yes;
|
||||||
|
setTabBarVisible(!m_asTabBarReplacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,19 +48,38 @@ public:
|
||||||
void showSettings(QWidget* parent = 0);
|
void showSettings(QWidget* parent = 0);
|
||||||
void populateExtensionsMenu(QMenu* menu);
|
void populateExtensionsMenu(QMenu* menu);
|
||||||
|
|
||||||
|
enum ViewType {
|
||||||
|
ShowAsSideBar = 0,
|
||||||
|
ShowAsWindow = 1,
|
||||||
|
Undefined = -1
|
||||||
|
};
|
||||||
|
|
||||||
void removeManagerWidget();
|
void removeManagerWidget();
|
||||||
|
|
||||||
|
ViewType viewType();
|
||||||
|
void setViewType(ViewType type);
|
||||||
|
|
||||||
static QString settingsPath();
|
static QString settingsPath();
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
|
bool asTabBarReplacement() const;
|
||||||
|
void setAsTabBarReplacement(bool yes);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void insertManagerWidget();
|
void insertManagerWidget();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void mainWindowCreated(BrowserWindow* window, bool refresh = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setTabBarVisible(bool visible);
|
||||||
|
|
||||||
TabManagerWidgetController* m_controller;
|
TabManagerWidgetController* m_controller;
|
||||||
TabManagerWidget* m_tabManagerWidget;
|
TabManagerWidget* m_tabManagerWidget;
|
||||||
static QString s_settingsPath;
|
static QString s_settingsPath;
|
||||||
QString m_viewType;
|
ViewType m_viewType;
|
||||||
bool m_initState;
|
bool m_initState;
|
||||||
|
bool m_asTabBarReplacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABMANAGERPLUGIN_H
|
#endif // TABMANAGERPLUGIN_H
|
||||||
|
|
32
src/plugins/TabManager/tabmanagersettings.cpp
Normal file
32
src/plugins/TabManager/tabmanagersettings.cpp
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#include "tabmanagersettings.h"
|
||||||
|
#include "ui_tabmanagersettings.h"
|
||||||
|
#include "tabmanagerplugin.h"
|
||||||
|
|
||||||
|
TabManagerSettings::TabManagerSettings(TabManagerPlugin* plugin, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::TabManagerSettings),
|
||||||
|
m_plugin(plugin)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->sidebarRadio->setChecked(m_plugin->viewType() == TabManagerPlugin::ShowAsSideBar);
|
||||||
|
ui->windowRadio->setChecked(m_plugin->viewType() != TabManagerPlugin::ShowAsSideBar);
|
||||||
|
ui->checkBox->setChecked(m_plugin->asTabBarReplacement());
|
||||||
|
|
||||||
|
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
TabManagerSettings::~TabManagerSettings()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManagerSettings::accept()
|
||||||
|
{
|
||||||
|
m_plugin->setViewType(ui->sidebarRadio->isChecked() ? TabManagerPlugin::ShowAsSideBar : TabManagerPlugin::ShowAsWindow);
|
||||||
|
m_plugin->setAsTabBarReplacement(ui->checkBox->isChecked());
|
||||||
|
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
27
src/plugins/TabManager/tabmanagersettings.h
Normal file
27
src/plugins/TabManager/tabmanagersettings.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef TABMANAGERSETTINGS_H
|
||||||
|
#define TABMANAGERSETTINGS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class TabManagerSettings;
|
||||||
|
}
|
||||||
|
class TabManagerPlugin;
|
||||||
|
|
||||||
|
class TabManagerSettings : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TabManagerSettings(TabManagerPlugin* plugin, QWidget *parent = 0);
|
||||||
|
~TabManagerSettings();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void accept();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::TabManagerSettings* ui;
|
||||||
|
TabManagerPlugin* m_plugin;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TABMANAGERSETTINGS_H
|
91
src/plugins/TabManager/tabmanagersettings.ui
Normal file
91
src/plugins/TabManager/tabmanagersettings.ui
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TabManagerSettings</class>
|
||||||
|
<widget class="QDialog" name="TabManagerSettings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>237</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Tab Manager Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>View</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Please select view type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="sidebarRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>SideBar</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="windowRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">Note:</span> The &quot;Window&quot; type is recommended for managing lots of windows/tabs.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use TabManager plugin as replacement for main TabBar.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -21,6 +21,7 @@
|
||||||
#include "browserwindow.h"
|
#include "browserwindow.h"
|
||||||
#include "tabwidget.h"
|
#include "tabwidget.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
|
#include "tabbar.h"
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
TabManagerWidgetController::TabManagerWidgetController(QObject* parent)
|
TabManagerWidgetController::TabManagerWidgetController(QObject* parent)
|
||||||
: SideBarInterface(parent)
|
: SideBarInterface(parent)
|
||||||
, m_defaultTabManager(0)
|
, m_defaultTabManager(0)
|
||||||
, m_viewType(ShowAsWindow)
|
|
||||||
, m_groupType(TabManagerWidget::GroupByWindow)
|
, m_groupType(TabManagerWidget::GroupByWindow)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -92,16 +92,6 @@ QWidget* TabManagerWidgetController::createStatusBarIcon(BrowserWindow* mainWind
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
TabManagerWidgetController::ViewType TabManagerWidgetController::viewType()
|
|
||||||
{
|
|
||||||
return m_viewType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabManagerWidgetController::setViewType(ViewType type)
|
|
||||||
{
|
|
||||||
m_viewType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
TabManagerWidget::GroupType TabManagerWidgetController::groupType()
|
TabManagerWidget::GroupType TabManagerWidgetController::groupType()
|
||||||
{
|
{
|
||||||
return m_groupType;
|
return m_groupType;
|
||||||
|
@ -163,19 +153,6 @@ void TabManagerWidgetController::removeStatusBarIcon(BrowserWindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabManagerWidgetController::mainWindowCreated(BrowserWindow* window, bool refresh)
|
|
||||||
{
|
|
||||||
if (window) {
|
|
||||||
addStatusBarIcon(window);
|
|
||||||
connect(window->tabWidget(), SIGNAL(currentChanged(int)), this, SIGNAL(requestRefreshTree()));
|
|
||||||
connect(window->tabWidget(), SIGNAL(pinStateChanged(int,bool)), this, SIGNAL(pinStateChanged(int,bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refresh) {
|
|
||||||
emit requestRefreshTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabManagerWidgetController::mainWindowDeleted(BrowserWindow* window)
|
void TabManagerWidgetController::mainWindowDeleted(BrowserWindow* window)
|
||||||
{
|
{
|
||||||
removeStatusBarIcon(window);
|
removeStatusBarIcon(window);
|
||||||
|
@ -231,3 +208,8 @@ void TabManagerWidgetController::showSideBySide()
|
||||||
defaultTabManager()->activateWindow();
|
defaultTabManager()->activateWindow();
|
||||||
defaultTabManager()->raise();
|
defaultTabManager()->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabManagerWidgetController::emitRefreshTree()
|
||||||
|
{
|
||||||
|
emit requestRefreshTree();
|
||||||
|
}
|
||||||
|
|
|
@ -27,11 +27,6 @@ class TabManagerWidgetController : public SideBarInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum ViewType {
|
|
||||||
ShowAsSideBar = 0,
|
|
||||||
ShowAsWindow = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit TabManagerWidgetController(QObject* parent = 0);
|
explicit TabManagerWidgetController(QObject* parent = 0);
|
||||||
~TabManagerWidgetController();
|
~TabManagerWidgetController();
|
||||||
|
|
||||||
|
@ -41,9 +36,6 @@ public:
|
||||||
|
|
||||||
QWidget* createStatusBarIcon(BrowserWindow* mainWindow);
|
QWidget* createStatusBarIcon(BrowserWindow* mainWindow);
|
||||||
|
|
||||||
ViewType viewType();
|
|
||||||
void setViewType(ViewType type);
|
|
||||||
|
|
||||||
TabManagerWidget::GroupType groupType();
|
TabManagerWidget::GroupType groupType();
|
||||||
TabManagerWidget* createTabManagerWidget(BrowserWindow* mainClass, QWidget* parent = 0, bool defaultWidget = false);
|
TabManagerWidget* createTabManagerWidget(BrowserWindow* mainClass, QWidget* parent = 0, bool defaultWidget = false);
|
||||||
|
|
||||||
|
@ -54,14 +46,13 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setGroupType(TabManagerWidget::GroupType type);
|
void setGroupType(TabManagerWidget::GroupType type);
|
||||||
void mainWindowCreated(BrowserWindow* window, bool refresh = true);
|
|
||||||
void mainWindowDeleted(BrowserWindow* window);
|
void mainWindowDeleted(BrowserWindow* window);
|
||||||
void raiseTabManager();
|
void raiseTabManager();
|
||||||
void showSideBySide();
|
void showSideBySide();
|
||||||
|
void emitRefreshTree();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabManagerWidget* m_defaultTabManager;
|
TabManagerWidget* m_defaultTabManager;
|
||||||
ViewType m_viewType;
|
|
||||||
TabManagerWidget::GroupType m_groupType;
|
TabManagerWidget::GroupType m_groupType;
|
||||||
|
|
||||||
QHash<BrowserWindow*, QWidget*> m_statusBarIcons;
|
QHash<BrowserWindow*, QWidget*> m_statusBarIcons;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user