***************************************************************************/
#include <QHeaderView>
+#include <QMessageBox>
#include <QTableWidget>
#include "client.h"
SLOT(ignoredTableChanged(QTableWidgetItem * )));
connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected()));
+
+ // Warning icon
+ ui.coreUnsupportedIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16));
}
void CoreHighlightSettingsPage::coreConnectionStateChanged(bool state)
{
+ updateCoreSupportStatus(state);
setEnabled(state);
if (state) {
load();
#endif
}
+void CoreHighlightSettingsPage::updateCoreSupportStatus(bool state)
+{
+ // Assume connected state as enforced by the settings page UI
+ if (!state || Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights)) {
+ // Either disconnected or core supports highlights, enable highlight configuration and hide
+ // warning. Don't show the warning needlessly when disconnected.
+ ui.highlightsConfigWidget->setEnabled(true);
+ ui.coreUnsupportedWidget->setVisible(false);
+ } else {
+ // Core does not support highlights, show warning and disable highlight configuration
+ ui.highlightsConfigWidget->setEnabled(false);
+ ui.coreUnsupportedWidget->setVisible(true);
+ }
+}
+
void CoreHighlightSettingsPage::clientConnected()
{
connect(Client::highlightRuleManager(), SIGNAL(updated()), SLOT(revert()));
setChangedState(true);
}
+void CoreHighlightSettingsPage::on_coreUnsupportedDetails_clicked()
+{
+ // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing all
+ // spaces to non-breaking
+ const QString localHighlightsName = tr("Local Highlights").replace(" ", " ");
+
+ const QString remoteHighlightsMsgText =
+ QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>"
+ ).arg(tr("Your Quassel core is too old to support remote highlights"),
+ tr("You need a Quassel core v0.13.0 or newer to configure remote "
+ "highlights."),
+ tr("You can still configure highlights for this device only in "
+ "<i>%1</i>.").arg(localHighlightsName));
+
+ QMessageBox::warning(this,
+ tr("Remote Highlights unsupported"),
+ remoteHighlightsMsgText);
+}
+
void CoreHighlightSettingsPage::importRules() {
NotificationSettings notificationSettings;
}
bool CoreHighlightSettingsPage::isSelectable() const {
- return Client::isConnected() && Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights);
+ return Client::isConnected();
+ // We check for Quassel::Feature::CoreSideHighlights when loading this page, allowing us to show
+ // a friendly error message.
}
</property>
<layout class="QVBoxLayout">
<item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
+ <widget class="QFrame" name="coreUnsupportedWidget">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="lineWidth">
<number>0</number>
</property>
- <widget class="QWidget" name="highlightTab">
- <attribute name="title">
- <string>Highlight Rules</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="nickBox">
- <property name="title">
- <string>Highlight Nicks</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="coreUnsupportedIcon">
+ <property name="text">
+ <string notr="true">[icon]</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="coreUnsupportedLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Your Quassel core is too old to support remote highlights</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="coreUnsupportedDetails">
+ <property name="text">
+ <string>Details...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="highlightsConfigWidget" native="true">
+ <layout class="QVBoxLayout" name="highlightConfigLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="highlightTab">
+ <attribute name="title">
+ <string>Highlight Rules</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QComboBox" name="highlightNicksComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QComboBox::AdjustToContents</enum>
+ <widget class="QGroupBox" name="nickBox">
+ <property name="title">
+ <string>Highlight Nicks</string>
</property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QComboBox" name="highlightNicksComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="nicksCaseSensitive">
+ <property name="text">
+ <string>Case sensitive</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="nicksCaseSensitive">
- <property name="text">
- <string>Case sensitive</string>
- </property>
- <property name="checked">
- <bool>true</bool>
+ <widget class="QGroupBox" name="rulesBox">
+ <property name="title">
+ <string>Custom Highlights</string>
</property>
+ <layout class="QVBoxLayout" name="highlightLayout">
+ <item>
+ <widget class="QTableWidget" name="highlightTable">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <column>
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Rule</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>RegEx</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>CS</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Sender</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="highlightButtonBarLayout">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="highlightAdd">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="highlightRemove">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="highlightButtonBarSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="highlightImport">
+ <property name="toolTip">
+ <string>Import highlight rules configured in <i>Local Highlights</i></string>
+ </property>
+ <property name="text">
+ <string>Import Local</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
- </item>
- <item>
- <widget class="QGroupBox" name="rulesBox">
- <property name="title">
- <string>Custom Highlights</string>
- </property>
- <layout class="QVBoxLayout" name="highlightLayout">
+ <widget class="QWidget" name="ignoredTab">
+ <attribute name="title">
+ <string>Highlight Ignore Rules</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="QTableWidget" name="highlightTable">
- <property name="toolTip">
- <string/>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
+ <widget class="QGroupBox" name="ignoresBox">
+ <property name="title">
+ <string>Never Highlight For</string>
</property>
- <column>
- <property name="text">
- <string>Enabled</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Rule</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>RegEx</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>CS</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Sender</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Channel</string>
- </property>
- </column>
+ <layout class="QVBoxLayout" name="ignoredLayout">
+ <item>
+ <widget class="QTableWidget" name="ignoredTable">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <column>
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Rule</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>RegEx</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>CS</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Sender</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Channel</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="ignoredButtonBarLayout">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="ignoredAdd">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ignoredRemove">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="ignoredButtonBarSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="highlightButtonBarLayout">
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="highlightAdd">
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="highlightRemove">
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="highlightButtonBarSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="highlightImport">
- <property name="toolTip">
- <string>Import highlight rules configured in <i>Local Highlights</i></string>
- </property>
- <property name="text">
- <string>Import Local</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="ignoredTab">
- <attribute name="title">
- <string>Highlight Ignore Rules</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QGroupBox" name="ignoresBox">
- <property name="title">
- <string>Never Highlight For</string>
- </property>
- <layout class="QVBoxLayout" name="ignoredLayout">
- <item>
- <widget class="QTableWidget" name="ignoredTable">
- <property name="toolTip">
- <string/>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <column>
- <property name="text">
- <string>Enabled</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Rule</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>RegEx</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>CS</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Sender</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Channel</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="ignoredButtonBarLayout">
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="ignoredAdd">
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="ignoredRemove">
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="ignoredButtonBarSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
</layout>
</widget>
- </item>
- </layout>
- </widget>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>