diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-06 21:45:41 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-06 21:45:41 +0200 |
| commit | cbc17bd39f4ef245183e5a54509ff3fbd4125ca6 (patch) | |
| tree | bf35bd5f6a64a22fe002316d0d311a3b5f4107ab | |
| parent | eb283439a68dfb70a075205859d891dca831626b (diff) | |
| download | kristall-cbc17bd39f4ef245183e5a54509ff3fbd4125ca6.tar.gz | |
Fixes bug in outline generation, adds application icon to mainwindow, adds more README, adds save settings on closing settings dialog.
| -rw-r--r-- | README.md | 34 | ||||
| -rw-r--r-- | browsertab.cpp | 3 | ||||
| -rw-r--r-- | documentoutlinemodel.cpp | 33 | ||||
| -rw-r--r-- | documentoutlinemodel.hpp | 4 | ||||
| -rw-r--r-- | icons.qrc | 1 | ||||
| -rw-r--r-- | icons/kristall.svg | 13 | ||||
| -rw-r--r-- | mainwindow.cpp | 8 | ||||
| -rw-r--r-- | mainwindow.hpp | 2 | ||||
| -rw-r--r-- | mainwindow.ui | 4 |
9 files changed, 88 insertions, 14 deletions
@@ -10,7 +10,7 @@ A high-quality visual cross-platform gemini browser. - `text/markdown` - `text/*` - `image/*` -- Outline generation +- [Outline generation](https://mq32.de/public/d3cdeb38c55ce8100a631bbf761e7bc17b6806bb.png) - Favourite Sites - Tabbed interface - Survives [ConMans torture suite](gemini://gemini.conman.org/test/torture/) @@ -24,6 +24,38 @@ A high-quality visual cross-platform gemini browser. - Windows - FreeBSD - NetBSD + - OpenBSD + +## Screenshots + +### Generates Outlines + + + +### Fully Customizable Site Theme + + + +## Build Instructions + +### Requirements + +- Latest Qt5 version with `widgets` and `network` modules + +### Build + +The usual Qt5 build process: + +```sh +mkdir build +cd build +qmake ../kristall.pro +make +``` + +Notes for OpenBSD: +- It seems like Qt wants `libzstd.so.3.1` instead of `libzstd.so.3.2`. Just symlink that file into the build directory +- Use `make` and not `gmake` to build the project. ## TODO - [ ] Survive full torture suite diff --git a/browsertab.cpp b/browsertab.cpp index dd8b3a7..6543c86 100644 --- a/browsertab.cpp +++ b/browsertab.cpp @@ -130,6 +130,8 @@ void BrowserTab::on_menu_button_clicked() if(dialog.exec() == QDialog::Accepted) { mainWindow->current_style = dialog.geminiStyle(); + + mainWindow->saveSettings(); } }); @@ -361,7 +363,6 @@ void BrowserTab::setErrorMessage(const QString &msg) void BrowserTab::pushToHistory(const QUrl &url) { - qDebug() << "push to history" << this->current_history_index << url; this->current_history_index = this->history.pushUrl(this->current_history_index, url); this->updateUI(); } diff --git a/documentoutlinemodel.cpp b/documentoutlinemodel.cpp index b44ceff..a47dafa 100644 --- a/documentoutlinemodel.cpp +++ b/documentoutlinemodel.cpp @@ -22,8 +22,8 @@ void DocumentOutlineModel::beginBuild() root = Node { nullptr, "<ROOT>", - 0, - QVector<Node> { }, + 0, 0, + QList<Node> { }, }; } @@ -32,8 +32,8 @@ void DocumentOutlineModel::appendH1(const QString &title) root.children.append(Node { &root, title, - 1, - QVector<Node> { }, + 1, 0, + QList<Node> { }, }); } @@ -43,16 +43,16 @@ void DocumentOutlineModel::appendH2(const QString &title) root.children.append(Node { &root, "<missing layer>", - 1, - QVector<Node> { }, + 1, 0, + QList<Node> { }, }); } auto & parent = root.children.last(); parent.children.append(Node { &parent, title, - 2, - QVector<Node> { }, + 2, parent.children.size() - 1, + QList<Node> { }, }); } @@ -63,6 +63,21 @@ void DocumentOutlineModel::appendH3(const QString &title) void DocumentOutlineModel::endBuild() { + for(auto const & h1 : this->root.children) + { + assert(h1.depth == 1); + assert(h1.parent == &this->root); + for(auto const & h2 : h1.children) + { + assert(h2.depth == 2); + assert(h2.parent == &h1); + for(auto const & h3 : h2.children) + { + assert(h3.depth == 3); + assert(h3.parent == &h2); + } + } + } endResetModel(); } @@ -97,7 +112,7 @@ QModelIndex DocumentOutlineModel::parent(const QModelIndex &child) const return QModelIndex(); return createIndex( - parent - parent->parent->children.data(), + parent->index, 0, reinterpret_cast<quintptr>(parent)); } diff --git a/documentoutlinemodel.hpp b/documentoutlinemodel.hpp index e10163b..2161c42 100644 --- a/documentoutlinemodel.hpp +++ b/documentoutlinemodel.hpp @@ -2,6 +2,7 @@ #define DOCUMENTOUTLINEMODEL_HPP #include <QAbstractItemModel> +#include <QList> class DocumentOutlineModel : public QAbstractItemModel @@ -39,7 +40,8 @@ private: Node * parent; QString title; int depth = 0; - QVector<Node> children; + int index = 0; + QList<Node> children; }; Node root; @@ -9,5 +9,6 @@ <file>icons/close.svg</file> <file>icons/format-font.svg</file> <file>icons/palette.svg</file> + <file>icons/kristall.svg</file> </qresource> </RCC> diff --git a/icons/kristall.svg b/icons/kristall.svg new file mode 100644 index 0000000..60be0f6 --- /dev/null +++ b/icons/kristall.svg @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + height="24" + width="24" + version="1.1"> + <path + d="M 3.1369986,7.8561215 6.2997316,2.8956626 17.476275,2.7919947 20.786815,7.9230405 11.777946,20.606669 Z" + style="fill:#7595ff" /> + <path + d="m 16,9 h 3 l -5,7 M 10,9 h 4 l -2,8 M 5,9 H 8.0000002 L 10,16 M 15,4 h 2 l 2,3 H 16 M 11,4 h 2 l 1,3 H 10 M 7,4 H 9 L 8,7 H 5 M 6,2 2,8 12,22 22,8 18,2 Z" /> +</svg> diff --git a/mainwindow.cpp b/mainwindow.cpp index 0010dba..3682891 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -41,8 +41,7 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { - this->favourites.save(settings); - this->current_style.save(settings); + this->saveSettings(); delete ui; } @@ -82,6 +81,11 @@ void MainWindow::setUrlPreview(const QUrl &url) } } +void MainWindow::saveSettings() +{ + this->favourites.save(settings); + this->current_style.save(settings); +} void MainWindow::on_browser_tabs_currentChanged(int index) { diff --git a/mainwindow.hpp b/mainwindow.hpp index 2e5d954..648f643 100644 --- a/mainwindow.hpp +++ b/mainwindow.hpp @@ -28,6 +28,8 @@ public: void setUrlPreview(QUrl const & url); + void saveSettings(); + public: FavouriteCollection favourites; diff --git a/mainwindow.ui b/mainwindow.ui index 652857a..04e6940 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -13,6 +13,10 @@ <property name="windowTitle"> <string>Kristall Browser</string> </property> + <property name="windowIcon"> + <iconset resource="icons.qrc"> + <normaloff>:/icons/kristall.svg</normaloff>:/icons/kristall.svg</iconset> + </property> <property name="tabShape"> <enum>QTabWidget::Rounded</enum> </property> |
