X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fchatviewsettingspage.cpp;h=f1a074f7d321f944ea6766d351bcabbb47dd125a;hp=76780b15a7519ab0b7827b6db2196e3f5ae4bdff;hb=158443f71d48215eea8b47b836b61afd77654b78;hpb=3f354bcce2cecfe88a46de90cbf94ffd1bc7c506 diff --git a/src/qtui/settingspages/chatviewsettingspage.cpp b/src/qtui/settingspages/chatviewsettingspage.cpp index 76780b15..f1a074f7 100644 --- a/src/qtui/settingspages/chatviewsettingspage.cpp +++ b/src/qtui/settingspages/chatviewsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,29 +15,76 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "chatviewsettingspage.h" -#include "colorbutton.h" +#include "chatviewsettings.h" +#include "client.h" #include "qtui.h" #include "qtuistyle.h" +#include "uistyle.h" ChatViewSettingsPage::ChatViewSettingsPage(QWidget *parent) - : SettingsPage(tr("Interface"), tr("Chat View"), parent) + : SettingsPage(tr("Interface"), tr("Chat View"), parent) { - ui.setupUi(this); + ui.setupUi(this); -#ifndef HAVE_WEBKIT - ui.showWebPreview->hide(); - ui.showWebPreview->setEnabled(false); +#if !defined HAVE_WEBKIT && !defined HAVE_WEBENGINE + ui.showWebPreview->hide(); + ui.showWebPreview->setEnabled(false); #endif - initAutoWidgets(); + // Handle UI dependent on core feature flags here + // FIXME remove with protocol v11 + if (!Client::isCoreFeatureEnabled(Quassel::Feature::SynchronizedMarkerLine)) { + ui.autoMarkerLine->setEnabled(false); + ui.autoMarkerLine->setChecked(true); + ui.autoMarkerLine->setToolTip(tr("You need at least version 0.6 of Quassel Core to use this feature")); + } + if (!Client::isCoreFeatureEnabled(Quassel::Feature::SenderPrefixes)) { + // Sender prefixes are not supported, disallow toggling + ui.senderPrefixComboBox->setEnabled(false); + // Split up the message to allow re-using translations: + // [Original tool-tip] + // [Bold 'does not support feature' message] + // [Specific version needed and feature details] + ui.senderPrefixComboBox->setToolTip( + QString("%2
%3").arg( + tr("Your Quassel core does not support this feature"), + tr("You need a Quassel core v0.13.0 or newer in order to show sender " + "modes before nicknames."))); + } + initAutoWidgets(); + initSenderPrefixComboBox(); } -void ChatViewSettingsPage::save() { - SettingsPage::save(); - QtUi::style()->generateSettingsQss(); - QtUi::style()->reload(); + +void ChatViewSettingsPage::initSenderPrefixComboBox() +{ + // Fill combobox with sender prefix modes + // Do not change ComboBox ordering without also adjusting chatviewsettingspage.ui "defaultValue" + // and UiStyle::SenderPrefixMode + ui.senderPrefixComboBox->addItem(tr("No modes"), + static_cast(UiStyle::SenderPrefixMode::NoModes)); + ui.senderPrefixComboBox->addItem(tr("Highest mode"), + static_cast(UiStyle::SenderPrefixMode::HighestMode)); + ui.senderPrefixComboBox->addItem(tr("All modes"), + static_cast(UiStyle::SenderPrefixMode::AllModes)); +} + + +void ChatViewSettingsPage::save() +{ + bool needsStyleReload = SettingsPage::hasChanged(ui.customChatViewFont) + || SettingsPage::hasChanged(ui.chatViewFont); + + // Save the general settings + SettingsPage::save(); + + // Update the stylesheet if fonts are changed + if (needsStyleReload) { + QtUi::style()->generateSettingsQss(); + QtUi::style()->reload(); + } }