[rkward] /: Better status feedback when filtering installed / installable packages.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Feb 11 10:39:44 UTC 2016


Git commit 322e840709ae25aa72b22fc276d1c2c406620dc1 by Thomas Friedrichsmeier.
Committed on 11/02/2016 at 10:36.
Pushed by tfry into branch 'master'.

Better status feedback when filtering installed / installable packages.
- Display number of packages matching filter in each category
- If there are no matching packages in a category, hide expand/collapse indicator
- Automatically expand "new" and "updatable" (but not "installed") package categories when filter changes
- NOT YET added a status indicator. This will have wait for frameworks / KF5

CCBUG: 358942

M  +1    -0    ChangeLog
M  +12   -2    rkward/dialogs/rkloadlibsdialog.cpp
M  +1    -0    rkward/misc/rkdynamicsearchline.cpp

http://commits.kde.org/rkward/322e840709ae25aa72b22fc276d1c2c406620dc1

diff --git a/ChangeLog b/ChangeLog
index 89067ed..081ec39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Provide better status feedback when searching / filtering among installable packages
 - Add access to basic menu items for docked previews
 - Move preview controls to the button-column of dialogs                                            TODO document, polish
 - Add preview to Sort data-, Subset data, and Recode categorical data-plugins
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 7eb658f..b5d16f2 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -2,7 +2,7 @@
                           rkloadlibsdialog  -  description
                              -------------------
     begin                : Mon Sep 6 2004
-    copyright            : (C) 2004 - 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2004 - 2016 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -651,7 +651,13 @@ public:
 				RK_ASSERT (false);
 				return;
 			}
-			v4->icon = table->isExpanded (index) ? expanded : collapsed;
+			int ccount = index.model ()->rowCount (index);
+			v4->text = v4->text + " (" + QString::number (ccount) + ')';
+			if (ccount) {
+				v4->icon = table->isExpanded (index) ? expanded : collapsed;
+			} else {
+				v4->icon = QIcon ();    // empty dummy icon to reserve space
+			}
 			v4->features |= QStyleOptionViewItemV2::HasDecoration;
 			v4->font.setBold (true);
 			v4->backgroundBrush = table->palette ().mid ();
@@ -705,6 +711,8 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge
 	filter_edit = new RKDynamicSearchLine (this);
 	RKCommonFunctions::setTips (i18n ("<p>You can limit the packages displayed in the list to with names or titles matching a filter string.</p>") + filter_edit->regexpTip (), label, filter_edit);
 	filter_edit->setModelToFilter (model);
+	// NOTE: Although the search line sets the filter in the model, automatically, we connect it, here, in order to expand new and updateable sections, when the filter changes.
+	connect (filter_edit, SIGNAL (searchChanged(QRegExp)), this, SLOT (filterChanged()));    // KF5 TODO
 	rkward_packages_only = new QCheckBox (i18n ("Show only packages providing RKWard dialogs"), this);
 	RKCommonFunctions::setTips (i18n ("<p>Some but not all R packages come with plugins for RKWard. That means they provide a graphical user-interface in addition to R functions. Check this box to show only such packages.</p><p></p>"), rkward_packages_only);
 	connect (rkward_packages_only, SIGNAL(stateChanged(int)), this, SLOT (filterChanged()));
@@ -769,6 +777,8 @@ void InstallPackagesWidget::filterChanged () {
 	RK_TRACE (DIALOGS);
 
 	model->setRKWardOnly (rkward_packages_only->isChecked ());
+	packages_view->expand (model->mapFromSource (packages_status->index(RKRPackageInstallationStatus::UpdateablePackages, 0)));
+	packages_view->expand (model->mapFromSource (packages_status->index(RKRPackageInstallationStatus::NewPackages, 0)));
 	// NOTE: filter string already set by RKDynamicSearchLine
 }
 
diff --git a/rkward/misc/rkdynamicsearchline.cpp b/rkward/misc/rkdynamicsearchline.cpp
index 0bcbe04..bcff72a 100644
--- a/rkward/misc/rkdynamicsearchline.cpp
+++ b/rkward/misc/rkdynamicsearchline.cpp
@@ -39,6 +39,7 @@ RKDynamicSearchLine::~RKDynamicSearchLine () {
 
 void RKDynamicSearchLine::textChanged () {
 	RK_TRACE (MISC);
+	// KF5 TODO: Add activity indicator
 	timer.start (300);
 }
 



More information about the rkward-tracker mailing list