aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2020-12-31 17:14:33 +1100
committerFelix Queißner <felix@ib-queissner.de>2020-12-31 10:57:55 +0100
commit40df924bc7289155a21a7c4ee901fc7c5e1673bd (patch)
tree112fce9c3d4598a1e10db2ba7bcc8fbf92bb1e91 /src
parent0ab1c12b436f4363d03ace1420b91cba1b9b0d50 (diff)
downloadkristall-40df924bc7289155a21a7c4ee901fc7c5e1673bd.tar.gz
Add preference for url bar styling
Diffstat (limited to 'src')
-rw-r--r--src/browsertab.cpp3
-rw-r--r--src/dialogs/settingsdialog.cpp16
-rw-r--r--src/dialogs/settingsdialog.hpp4
-rw-r--r--src/dialogs/settingsdialog.ui33
-rw-r--r--src/kristall.hpp1
-rw-r--r--src/main.cpp3
6 files changed, 59 insertions, 1 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index 549f41a..f98a0f2 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -1136,7 +1136,8 @@ void BrowserTab::updateUrlBarStyle()
// Set all text to default colour if url bar
// is focused, is at an internal location (like about:...),
// or has an invalid URL.
- if (this->ui->url_bar->hasFocus() ||
+ if (!kristall::options.fancy_urlbar ||
+ this->ui->url_bar->hasFocus() ||
!url.isValid() ||
this->is_internal_location ||
mainWindow->settings_visible)
diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp
index 6024a04..95fc0e9 100644
--- a/src/dialogs/settingsdialog.cpp
+++ b/src/dialogs/settingsdialog.cpp
@@ -218,6 +218,12 @@ void SettingsDialog::setOptions(const GenericSettings &options)
this->ui->hide_hidden_files->setChecked(true);
}
+ if(this->current_options.fancy_urlbar) {
+ this->ui->urlbarhl_fancy->setChecked(true);
+ } else {
+ this->ui->urlbarhl_none->setChecked(true);
+ }
+
this->ui->max_redirects->setValue(this->current_options.max_redirections);
this->ui->redirection_mode->setCurrentIndex(0);
@@ -620,6 +626,16 @@ void SettingsDialog::on_hide_hidden_files_clicked()
this->current_options.show_hidden_files_in_dirs = false;
}
+void SettingsDialog::on_urlbarhl_fancy_clicked()
+{
+ this->current_options.fancy_urlbar = true;
+}
+
+void SettingsDialog::on_urlbarhl_none_clicked()
+{
+ this->current_options.fancy_urlbar = false;
+}
+
void SettingsDialog::on_redirection_mode_currentIndexChanged(int index)
{
this->current_options.redirection_policy = GenericSettings::RedirectionWarning(this->ui->redirection_mode->itemData(index).toInt());
diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp
index 0334ecf..004cfd0 100644
--- a/src/dialogs/settingsdialog.hpp
+++ b/src/dialogs/settingsdialog.hpp
@@ -118,6 +118,10 @@ private slots:
void on_hide_hidden_files_clicked();
+ void on_urlbarhl_fancy_clicked();
+
+ void on_urlbarhl_none_clicked();
+
void on_redirection_mode_currentIndexChanged(int index);
void on_max_redirects_valueChanged(int arg1);
diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui
index 8a84c5f..eb47690 100644
--- a/src/dialogs/settingsdialog.ui
+++ b/src/dialogs/settingsdialog.ui
@@ -273,6 +273,37 @@
</layout>
</item>
<item row="8" column="0">
+ <widget class="QLabel" name="label_24">
+ <property name="text">
+ <string>URL bar highlights</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QRadioButton" name="urlbarhl_fancy">
+ <property name="text">
+ <string>Fancy</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">urlbarBtnGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="urlbarhl_none">
+ <property name="text">
+ <string>None</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">urlbarBtnGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="8" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Max. Number of Redirections</string>
@@ -954,6 +985,8 @@
<tabstop>scheme_error</tabstop>
<tabstop>show_hidden_files</tabstop>
<tabstop>hide_hidden_files</tabstop>
+ <tabstop>urlbarhl_fancy</tabstop>
+ <tabstop>urlbarhl_none</tabstop>
<tabstop>max_redirects</tabstop>
<tabstop>redirection_mode</tabstop>
<tabstop>network_timeout</tabstop>
diff --git a/src/kristall.hpp b/src/kristall.hpp
index 343a548..118a31c 100644
--- a/src/kristall.hpp
+++ b/src/kristall.hpp
@@ -39,6 +39,7 @@ struct GenericSettings
bool enable_text_decoration = false;
bool use_os_scheme_handler = false;
bool show_hidden_files_in_dirs = false;
+ bool fancy_urlbar = true;
TextDisplay gophermap_display = FormattedText;
int max_redirections = 5;
RedirectionWarning redirection_policy = WarnOnHostChange;
diff --git a/src/main.cpp b/src/main.cpp
index 3daeb95..780933f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -344,6 +344,8 @@ void GenericSettings::load(QSettings &settings)
show_hidden_files_in_dirs = settings.value("show_hidden_files_in_dirs", false).toBool();
+ fancy_urlbar = settings.value("fancy_urlbar", true).toBool();
+
max_redirections = settings.value("max_redirections", 5).toInt();
redirection_policy = RedirectionWarning(settings.value("redirection_policy ", WarnOnHostChange).toInt());
@@ -366,6 +368,7 @@ void GenericSettings::save(QSettings &settings) const
settings.setValue("gophermap_display", (gophermap_display == FormattedText) ? "rendered" : "text");
settings.setValue("use_os_scheme_handler", use_os_scheme_handler);
settings.setValue("show_hidden_files_in_dirs", show_hidden_files_in_dirs);
+ settings.setValue("fancy_urlbar", fancy_urlbar);
settings.setValue("max_redirections", max_redirections);
settings.setValue("redirection_policy", int(redirection_policy));
settings.setValue("network_timeout", network_timeout);