[rkward-cvs] [rkward/development/plugin_management_to_loadlibs] rkward/settings: Don't show "hidden" pluginmaps as checkable.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Dec 31 21:02:47 UTC 2014


Git commit c5440c8c7a6dd1602fae4874818eedb91081149b by Thomas Friedrichsmeier.
Committed on 31/12/2014 at 20:12.
Pushed by tfry into branch 'development/plugin_management_to_loadlibs'.

Don't show "hidden" pluginmaps as checkable.
For now, they are still shown, though, as it might make some sense to be able to add / replace them. To be reconsidered.

M  +6    -1    rkward/settings/rksettingsmoduleplugins.cpp
M  +2    -2    rkward/settings/rksettingsmoduleplugins.h

http://commits.kde.org/rkward/c5440c8c7a6dd1602fae4874818eedb91081149b

diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index f3720f4..0d6ca52 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -441,6 +441,8 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role)
 		if (inf.broken_in_this_version) return Qt::red;
 		if (inf.quirky_in_this_version) return Qt::yellow;
 		return (QVariant ());
+	} else if (role == Qt::ForegroundRole) {
+		if (inf.priority < RKSettingsModulePlugins::PriorityLow) return Qt::gray;
 	} else if (role == Qt::ToolTipRole) {
 		const PluginMapMetaInfo &meta = const_cast<RKSettingsModulePluginsModel*> (this)->getPluginMapMetaInfo (inf.filename);
 		QString desc = meta.about->toHtml ();
@@ -454,6 +456,7 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role)
 
 	if (col == COLUMN_CHECKED) {
 		if (role == Qt::CheckStateRole) {
+			if (inf.priority < RKSettingsModulePlugins::PriorityLow) return QVariant ();
 			return (inf.active ? Qt::Checked : Qt::Unchecked);
 		}
 	} else if (col == COLUMN_ID) {
@@ -484,7 +487,9 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role)
 Qt::ItemFlags RKSettingsModulePluginsModel::flags (const QModelIndex& index) const {
 	// RK_TRACE (SETTINGS);
 	Qt::ItemFlags flags = QAbstractItemModel::flags (index);
-	if (index.isValid () && (index.column () == COLUMN_CHECKED)) flags |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
+	if (index.isValid () && (index.column () == COLUMN_CHECKED)) {
+		if (plugin_maps[index.row ()].priority > RKSettingsModulePlugins::PriorityHidden) flags |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
+	}
 	return flags;
 }
 
diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h
index 36227b6..91998ce 100644
--- a/rkward/settings/rksettingsmoduleplugins.h
+++ b/rkward/settings/rksettingsmoduleplugins.h
@@ -69,6 +69,8 @@ public:
 	static bool markPluginMapAsQuirky (const QString &map);
 	/** Clears the broken or quirky flags. E.g. after the map was loaded, successfully */
 	static void markPluginMapAsWorking (const QString &map);
+
+	enum PluginMapPriority { PriorityHidden = 0, PriorityLow, PriorityMedium, PriorityHigh };
 	/** Helper struct used by RKSettingsModulePlugins to keep track of plugin map files. */
 	struct PluginMapStoredInfo {
 		PluginMapStoredInfo (const QString &_filename) : filename (_filename), active (false), broken_in_this_version (false), quirky_in_this_version (false) {};
@@ -86,8 +88,6 @@ public:
 public slots:
 	void settingChanged ();
 private:
-	enum PluginMapPriority { PriorityHidden = 0, PriorityLow, PriorityMedium, PriorityHigh };
-
 	RKMultiStringSelectorV2 *map_choser;
 	RKSettingsModulePluginsModel *map_model;
 	QButtonGroup *button_group;





More information about the rkward-tracker mailing list