{
SettingsPage *sp = qobject_cast<SettingsPage *>(item->data(0, SettingsPageRole).value<QObject *>());
Q_ASSERT(sp);
- item->setDisabled(!Client::isConnected() && sp->needsCoreConnection());
+ bool disabledDueToConnection = !Client::isConnected() && sp->needsCoreConnection();
+ bool disabledDueToOwnChoice = !sp->isSelectable();
+ item->setDisabled(disabledDueToConnection || disabledDueToOwnChoice);
}
#include "qtui.h"
CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent)
- : SettingsPage(tr("Interface"), tr("Core-Side Highlights"), parent)
+ : SettingsPage(tr("Interface"), tr("Remote Highlights"), parent)
{
ui.setupUi(this);
setChangedState(false);
load();
}
+
+bool CoreHighlightSettingsPage::isSelectable() const {
+ return Client::isConnected() && Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights);
+}
bool hasDefaults() const override;
+ bool isSelectable() const override;
+
public slots:
void save() override;
void load() override;
#include "highlightsettingspage.h"
+#include "client.h"
#include "qtui.h"
#include "uisettings.h"
#include <QHeaderView>
HighlightSettingsPage::HighlightSettingsPage(QWidget *parent)
- : SettingsPage(tr("Interface"), tr("Highlight"), parent)
+ : SettingsPage(tr("Interface"), tr("Local Highlights"), parent)
{
ui.setupUi(this);
ui.highlightTable->verticalHeader()->hide();
return false;
}
+
+bool HighlightSettingsPage::isSelectable() const {
+ return !Client::isConnected() || !Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights);
+}
bool hasDefaults() const;
+ bool isSelectable() const override;
+
public slots:
void save();
void load();
*/
inline virtual bool needsCoreConnection() const { return false; }
+ /**
+ * Whether the settingspage should be selectable or not, in a given situation
+ * Used for pages that should only be visible if certain features are available (or not).
+ * @return
+ */
+ inline virtual bool isSelectable() const { return true; }
+
//! The key this settings page stores its values under
/** This needs to be overriden to enable automatic loading/saving/hasChanged checking of widgets.
* The child widgets' values will be stored in client settings under this key. Every widget that