From 5b14fc424462a5d3a5a509bd177c04e9cba2ce17 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Wed, 17 Jun 2020 01:29:30 +0200 Subject: Makes gemini protocol handler a bit more robust.Makes style preview a file in about: instead of hardcoding it. Starts to implement the options menu for redirection configuration. --- src/settingsdialog.cpp | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'src/settingsdialog.cpp') diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 7ef05fb..838d17c 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -102,6 +102,13 @@ SettingsDialog::SettingsDialog(QWidget *parent) : &QItemSelectionModel::currentChanged, this, &SettingsDialog::on_trusted_server_selection); + + this->ui->redirection_mode->clear(); + this->ui->redirection_mode->addItem("Ask for cross-scheme or cross-host redirection"); + this->ui->redirection_mode->addItem("Ask for cross-scheme redirection"); + this->ui->redirection_mode->addItem("Ask for cross-host redirection"); + this->ui->redirection_mode->addItem("Ask for all redirection"); + this->ui->redirection_mode->addItem("Silently redirect everything"); } SettingsDialog::~SettingsDialog() @@ -241,28 +248,11 @@ void SettingsDialog::setSslTrust(const SslTrust &trust) void SettingsDialog::reloadStylePreview() { - auto const document = R"gemini(# H1 Header -## H2 Header -### H3 Header -Plain text document here. -* List A -* List B -=> rela-link Same-Site Link -=> //foreign.host/ Foreign Site Link -=> https://foreign.host/ Cross-Protocol Link -> Multi-lined -> block quotes -``` - ▄▄▄ ██▀███ ▄▄▄█████▓ - ▒████▄ ▓██ ▒ ██▒▓ ██▒ ▓▒ - ▒██ ▀█▄ ▓██ ░▄█ ▒▒ ▓██░ ▒░ - ░██▄▄▄▄██ ▒██▀▀█▄ ░ ▓██▓ ░ - ▓█ ▓██▒░██▓ ▒██▒ ▒██▒ ░ - ▒▒ ▓▒█░░ ▒▓ ░▒▓░ ▒ ░░ - ▒ ▒▒ ░ ░▒ ░ ▒░ ░ - ░ ▒ ░░ ░ ░ - ░ ░ ░ -)gemini"; + QFile document_src { ":/about/style-preview.gemini" }; + bool ok = document_src.open(QFile::ReadOnly); + assert(ok and "failed to find style-preview.gemini!"); + + auto const document = document_src.readAll(); QString host = this->ui->preview_url->text(); if(host.length() == 0) @@ -335,6 +325,7 @@ void SettingsDialog::updateColor(QColor &input) void SettingsDialog::on_trusted_server_selection(const QModelIndex ¤t, const QModelIndex &previous) { + Q_UNUSED(previous); if(auto host = this->current_trust.trusted_hosts.get(current); host) { this->ui->trust_revoke_selected->setEnabled(true); } else { -- cgit v1.2.3