aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-12-25 23:58:38 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-12-25 23:58:38 +0100
commit478cdbbc5cc1c69a76e6f1054ce70f8ee0bb0a59 (patch)
tree8e7bc642665ce0ce30466f10a0af26947e969250
parentFix bookmarks context menu exec position (diff)
downloadsmolbote-478cdbbc5cc1c69a76e6f1054ce70f8ee0bb0a59.tar.xz
Rename TabWidget::deleteTab to TabWidget::removeTab
-rw-r--r--meson.build17
-rw-r--r--src/meson.build11
-rw-r--r--src/subwindow/subwindow.cpp2
-rw-r--r--src/subwindow/tabwidget.cpp17
-rw-r--r--src/subwindow/tabwidget.h4
5 files changed, 24 insertions, 27 deletions
diff --git a/meson.build b/meson.build
index 5452574..e5b542c 100644
--- a/meson.build
+++ b/meson.build
@@ -11,19 +11,26 @@ dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWi
dep_boost = dependency('boost', modules: ['program_options'])
# Breakpad
+if get_option('Breakpad').enabled()
dep_breakpad = declare_dependency(
compile_args: '-DBREAKPAD',
- dependencies: [dependency('breakpad-client', required: get_option('Breakpad')),
- dependency('threads', required: get_option('Breakpad'))]
+ dependencies: [dependency('breakpad-client'),
+ dependency('threads')]
)
+else
+ dep_breakpad = declare_dependency()
+endif
# KDE
+if get_option('Plasma').enabled()
dep_plasma = declare_dependency(
compile_args: '-DPLASMA',
- dependencies: [meson.get_compiler('cpp').find_library('KF5WindowSystem', required: get_option('Plasma')),
- meson.get_compiler('cpp').find_library('KF5Wallet', required: get_option('Plasma'))],
- include_directories: [include_directories('/usr/include/KF5/KWindowSystem'), include_directories('/usr/include/KF5/KWallet')]
+ dependencies: [ dependency('KF5WindowSystem', method: 'cmake'),
+ dependency('KF5Wallet', method: 'cmake')]
)
+else
+ dep_plasma = declare_dependency()
+endif
# add -DQT_NO_DEBUG to non-debug builds
if not get_option('debug')
diff --git a/src/meson.build b/src/meson.build
index 1fb4a98..f07a2ec 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -11,18 +11,9 @@ poi_moc = qt5.preprocess(
dependencies: dep_qt5
)
-optdepends = []
-if get_option('Breakpad').enabled()
- optdepends += dep_breakpad
-endif
-
-if get_option('Plasma').enabled()
- optdepends += dep_plasma
-endif
-
poi = executable(get_option('poiName'), install: true,
cpp_args: ['-DQAPPLICATION_CLASS=QApplication'],
- dependencies: [dep_qt5, dep_boost, dep_SingleApplication, dep_genheaders, optdepends,
+ dependencies: [dep_qt5, dep_boost, dep_SingleApplication, dep_genheaders, dep_breakpad, dep_plasma,
dep_about, dep_addressbar, dep_bookmarks, dep_configuration, dep_downloads, dep_urlfilter, dep_web],
include_directories: [include],
sources: ['main.cpp', 'builtins.cpp', 'crashhandler.cpp', poi_moc,
diff --git a/src/subwindow/subwindow.cpp b/src/subwindow/subwindow.cpp
index a83cf14..76eddb3 100644
--- a/src/subwindow/subwindow.cpp
+++ b/src/subwindow/subwindow.cpp
@@ -168,7 +168,7 @@ int SubWindow::addTab(const QUrl &url, WebProfile *profile)
void SubWindow::closeTab(int index)
{
- tabWidget->deleteTab(index);
+ tabWidget->removeTab(index);
}
void SubWindow::setCurrentTab(int index)
diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp
index 58e9b03..6951b7b 100644
--- a/src/subwindow/tabwidget.cpp
+++ b/src/subwindow/tabwidget.cpp
@@ -36,7 +36,7 @@ TabWidget::TabWidget(QWidget *parent)
setElideMode(Qt::ElideRight);
setMovable(true);
- connect(this, &TabWidget::tabCloseRequested, this, &TabWidget::deleteTab);
+ connect(this, &TabWidget::tabCloseRequested, this, &TabWidget::removeTab);
// when changing tabs, give focus to the widget
// otherwise when closing tabs, the tabwidget will retain focus
@@ -49,14 +49,14 @@ TabWidget::TabWidget(QWidget *parent)
tabContextMenu = new QMenu(this);
auto *closeTab = tabContextMenu->addAction(tr("Close Tab"));
connect(closeTab, &QAction::triggered, this, [this]() {
- deleteTab(this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos())));
+ removeTab(this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos())));
});
auto *closeTabsLeft = tabContextMenu->addAction(tr("Close Tabs left"));
connect(closeTabsLeft, &QAction::triggered, this, [this]() {
int idx = this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos()));
for(int i = idx - 1; i >= 0; --i) {
- deleteTab(i);
+ removeTab(i);
}
});
@@ -64,7 +64,7 @@ TabWidget::TabWidget(QWidget *parent)
connect(closeTabsRight, &QAction::triggered, this, [this]() {
int idx = this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos()));
for(int i = count() - 1; i > idx; --i) {
- deleteTab(i);
+ removeTab(i);
}
});
}
@@ -100,7 +100,7 @@ int TabWidget::addTab(WebView *view)
return idx;
}
-void TabWidget::deleteTab(int index)
+void TabWidget::removeTab(int index)
{
// deleting the widget automatically removes the tab?
WebView *w = qobject_cast<WebView *>(widget(index));
@@ -117,11 +117,8 @@ void TabWidget::deleteTab(int index)
m_closedTabs.dequeue();
}
- disconnect(w);
+ QTabWidget::removeTab(index);
delete w;
-
- if(count() == 0)
- parentWidget()->close();
}
int TabWidget::restoreLastTab()
@@ -171,7 +168,7 @@ void TabWidget::mousePressEvent(QMouseEvent *event)
if(event->button() == Qt::MiddleButton) {
int index = tabBar()->tabAt(event->pos());
if(index >= 0) {
- deleteTab(index);
+ removeTab(index);
}
event->accept();
return;
diff --git a/src/subwindow/tabwidget.h b/src/subwindow/tabwidget.h
index ef1930d..d615bcb 100644
--- a/src/subwindow/tabwidget.h
+++ b/src/subwindow/tabwidget.h
@@ -36,7 +36,7 @@ public:
public slots:
int addTab(WebView *view);
- void deleteTab(int index);
+ void removeTab(int index);
int restoreLastTab();
void restoreTabMenu(QMenu *menu);
@@ -45,6 +45,8 @@ protected:
void contextMenuEvent(QContextMenuEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
+
+
private:
QMenu *tabContextMenu;
QQueue<TabInformation> m_closedTabs;