aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-27 00:28:03 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-27 00:28:03 +0200
commitad15a056672f049cf8302fc7a0a94b71f42db356 (patch)
tree3dafbbd36648ba664dc836fff6bf5e42bd274c77
parenta2d567a95e388e946cae8b0a5e30a7428f12eba4 (diff)
downloadkristall-ad15a056672f049cf8302fc7a0a94b71f42db356.tar.gz
Allows middle-clicking to close tabs.
-rw-r--r--ROADMAP.md3
-rw-r--r--src/kristall.pro4
-rw-r--r--src/mainwindow.ui55
-rw-r--r--src/widgets/browsertabbar.cpp18
-rw-r--r--src/widgets/browsertabbar.hpp15
-rw-r--r--src/widgets/browsertabwidget.cpp8
-rw-r--r--src/widgets/browsertabwidget.hpp16
7 files changed, 102 insertions, 17 deletions
diff --git a/ROADMAP.md b/ROADMAP.md
index 803ea09..0663652 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -26,6 +26,7 @@ This document contains TODO items for planned Kristall releases as well as some
- [ ] Allow import of themes
- [ ] File extension is `.kthm`
- [ ] Direct preview instead of importing it as a preset. Allow user to save preset then manually
+ - [ ] Make gss (gemini style sheets) a subset of cascading style sheets
- [ ] Recognize home directories with /~home and such and add "substyles"
- [ ] [Add favicon support](gemini://mozz.us/files/rfc_gemini_favicon.gmi)
- [ ] Add auto-generated "favicons"
@@ -40,7 +41,7 @@ This document contains TODO items for planned Kristall releases as well as some
- [ ] Ctrl-F search in documents
- [ ] Add "view source" option to show original document
- [ ] Implement graphic fingerprint display instead of hex-based one
-- [ ] `<krixano>` xq, I have a feature request for Kristall - the ability to middle click a tab to close it.
+- [x] `<krixano>` xq, I have a feature request for Kristall - the ability to middle click a tab to close it.
- [ ] `<krixano>` Also, middle clicking links to open them in new tab
- [ ] Support "offline files"
- [ ] Allow manually caching a file to be visited when no internet connection is
diff --git a/src/kristall.pro b/src/kristall.pro
index 43316cc..e50db0e 100644
--- a/src/kristall.pro
+++ b/src/kristall.pro
@@ -69,6 +69,8 @@ SOURCES += \
mainwindow.cpp \
renderers/markdownrenderer.cpp \
renderers/textstyleinstance.cpp \
+ widgets/browsertabbar.cpp \
+ widgets/browsertabwidget.cpp \
widgets/mediaplayer.cpp \
mimeparser.cpp \
protocolhandler.cpp \
@@ -109,6 +111,8 @@ HEADERS += \
mainwindow.hpp \
renderers/markdownrenderer.hpp \
renderers/textstyleinstance.hpp \
+ widgets/browsertabbar.hpp \
+ widgets/browsertabwidget.hpp \
widgets/mediaplayer.hpp \
mimeparser.hpp \
protocolhandler.hpp \
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index f7ac5cb..886bd89 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -35,7 +35,7 @@
<number>0</number>
</property>
<item>
- <widget class="QTabWidget" name="browser_tabs">
+ <widget class="BrowserTabWidget" name="browser_tabs">
<property name="currentIndex">
<number>-1</number>
</property>
@@ -58,7 +58,8 @@
<widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="outline_window">
<property name="windowIcon">
- <iconset theme="table-of-contents"/>
+ <iconset theme="table-of-contents">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="windowTitle">
<string>Document Outline</string>
@@ -95,7 +96,8 @@
</widget>
<widget class="QDockWidget" name="bookmarks_window">
<property name="windowIcon">
- <iconset theme="bookmarks"/>
+ <iconset theme="bookmarks">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="windowTitle">
<string>Bookmarks</string>
@@ -125,7 +127,8 @@
</widget>
<widget class="QDockWidget" name="history_window">
<property name="windowIcon">
- <iconset theme="history"/>
+ <iconset theme="history">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="windowTitle">
<string>History</string>
@@ -210,7 +213,8 @@
</widget>
<action name="actionAbout">
<property name="icon">
- <iconset theme="info"/>
+ <iconset theme="info">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>About...</string>
@@ -218,7 +222,8 @@
</action>
<action name="actionQuit">
<property name="icon">
- <iconset theme="close"/>
+ <iconset theme="close">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Quit</string>
@@ -234,7 +239,8 @@
</action>
<action name="actionClose_Tab">
<property name="icon">
- <iconset theme="close"/>
+ <iconset theme="close">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Close Tab</string>
@@ -245,7 +251,8 @@
</action>
<action name="actionSettings">
<property name="icon">
- <iconset theme="settings"/>
+ <iconset theme="settings">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Settings</string>
@@ -253,7 +260,8 @@
</action>
<action name="actionBackward">
<property name="icon">
- <iconset theme="navigate-back"/>
+ <iconset theme="navigate-back">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Backward</string>
@@ -264,7 +272,8 @@
</action>
<action name="actionForward">
<property name="icon">
- <iconset theme="navigate-forward"/>
+ <iconset theme="navigate-forward">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Foreward</string>
@@ -275,7 +284,8 @@
</action>
<action name="actionRefresh">
<property name="icon">
- <iconset theme="refresh"/>
+ <iconset theme="refresh">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Refresh</string>
@@ -295,7 +305,8 @@
</action>
<action name="actionSave_as">
<property name="icon">
- <iconset theme="save"/>
+ <iconset theme="save">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Save as...</string>
@@ -321,7 +332,8 @@
</action>
<action name="actionGo_to_home">
<property name="icon">
- <iconset theme="home"/>
+ <iconset theme="home">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Go to home</string>
@@ -332,7 +344,8 @@
</action>
<action name="actionHelp">
<property name="icon">
- <iconset theme="help"/>
+ <iconset theme="help">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Help</string>
@@ -343,7 +356,8 @@
</action>
<action name="actionChangelog">
<property name="icon">
- <iconset theme="changelog"/>
+ <iconset theme="changelog">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Changelog</string>
@@ -351,13 +365,22 @@
</action>
<action name="actionManage_Certificates">
<property name="icon">
- <iconset theme="certificate"/>
+ <iconset theme="certificate">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Manage Certificates…</string>
</property>
</action>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>BrowserTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>widgets/browsertabwidget.hpp</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
<resources>
<include location="icons.qrc"/>
</resources>
diff --git a/src/widgets/browsertabbar.cpp b/src/widgets/browsertabbar.cpp
new file mode 100644
index 0000000..503157f
--- /dev/null
+++ b/src/widgets/browsertabbar.cpp
@@ -0,0 +1,18 @@
+#include "browsertabbar.hpp"
+
+#include <QMouseEvent>
+
+BrowserTabBar::BrowserTabBar(QWidget *parent) :
+ QTabBar(parent)
+{
+
+}
+
+void BrowserTabBar::mouseReleaseEvent(QMouseEvent *event)
+{
+ if(event->button() == Qt::MiddleButton) {
+ emit tabCloseRequested(this->tabAt(event->pos()));
+ } else {
+ QTabBar::mousePressEvent(event);
+ }
+}
diff --git a/src/widgets/browsertabbar.hpp b/src/widgets/browsertabbar.hpp
new file mode 100644
index 0000000..f1cd49b
--- /dev/null
+++ b/src/widgets/browsertabbar.hpp
@@ -0,0 +1,15 @@
+#ifndef BROWSERTABS_HPP
+#define BROWSERTABS_HPP
+
+#include <QTabBar>
+
+class BrowserTabBar : public QTabBar
+{
+ Q_OBJECT
+public:
+ explicit BrowserTabBar(QWidget * parent);
+
+ void mouseReleaseEvent(QMouseEvent *event) override;
+};
+
+#endif // BROWSERTABS_HPP
diff --git a/src/widgets/browsertabwidget.cpp b/src/widgets/browsertabwidget.cpp
new file mode 100644
index 0000000..7419c52
--- /dev/null
+++ b/src/widgets/browsertabwidget.cpp
@@ -0,0 +1,8 @@
+#include "browsertabwidget.hpp"
+
+#include "browsertabbar.hpp"
+
+BrowserTabWidget::BrowserTabWidget(QWidget *parent) : QTabWidget(parent)
+{
+ this->setTabBar(new BrowserTabBar(this));
+}
diff --git a/src/widgets/browsertabwidget.hpp b/src/widgets/browsertabwidget.hpp
new file mode 100644
index 0000000..dd4142c
--- /dev/null
+++ b/src/widgets/browsertabwidget.hpp
@@ -0,0 +1,16 @@
+#ifndef BROWSERTABWIDGET_HPP
+#define BROWSERTABWIDGET_HPP
+
+#include <QTabWidget>
+
+class BrowserTabWidget : public QTabWidget
+{
+ Q_OBJECT
+public:
+ explicit BrowserTabWidget(QWidget *parent = nullptr);
+
+signals:
+
+};
+
+#endif // BROWSERTABWIDGET_HPP