[rkward/frameworks] /: Add "activity" indicator to dynamic search lines.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Feb 15 20:24:11 UTC 2016


Git commit 4931b4fc66c558ad43608d071b2a2a767325719a by Thomas Friedrichsmeier.
Committed on 15/02/2016 at 20:21.
Pushed by tfry into branch 'frameworks'.

Add "activity" indicator to dynamic search lines.

Bug watchers: Note that this is the "framworks"-branch. Not something fixed for the KDE4 version.
The icon itself is not a terribly good choice, yet. But I could not find a KDE standard hourglass icon. Pointers / contributions welcome.
While at it, fix another broken icon.

BUG: 358942

M  +1    -4    TODO
M  +9    -1    rkward/misc/rkdynamicsearchline.cpp
M  +3    -1    rkward/misc/rkdynamicsearchline.h
M  +7    -4    rkward/misc/rkstandardicons.cpp
M  +2    -0    rkward/misc/rkstandardicons.h

http://commits.kde.org/rkward/4931b4fc66c558ad43608d071b2a2a767325719a

diff --git a/TODO b/TODO
index 68a2071..d85b105 100644
--- a/TODO
+++ b/TODO
@@ -4,16 +4,13 @@ All in all, this TODO list is mostly for internal purposes, and many parts may n
 
 KF5 port:
 Things to do:
-- Remove kde4libssupport classes
-- Adjust platform checks
-- Device window embedding / remove qwinhost
+- Device window embedding / remove qwinhost -> test / fix on Windows
 - Grep for "KF5 TODO"
 - Remove katepart status bar from all previews (including in wizard)
 - Replace Q_WS_* and Q_OS_X11 as appropriate
 Things to test at the end:
 - Everthing concerning loading / saving, from recent files, scripts, workspace, etc.
   - Moved installations, moved workspaces.
-- Window embedding
 Knwon issues to fix:
 - Initial window placement for plugins is completely borked. One way around this seems to be to inherit RKStandardComponentGUI from QDialog. Does that work for inline embedded plugins?
 - Initial window placement for plots is always 0, 0 on screen 1, apparently. The above workaround may not be available, here?
diff --git a/rkward/misc/rkdynamicsearchline.cpp b/rkward/misc/rkdynamicsearchline.cpp
index fd6b1a6..fe6032c 100644
--- a/rkward/misc/rkdynamicsearchline.cpp
+++ b/rkward/misc/rkdynamicsearchline.cpp
@@ -2,7 +2,7 @@
                           rkdynamicsearchline  -  description
                              -------------------
     begin                : Mon Nov 16 2015
-    copyright            : (C) 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2015-2016 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -18,7 +18,11 @@
 #include "rkdynamicsearchline.h"
 
 #include <klocale.h>
+
 #include <QSortFilterProxyModel>
+#include <QAction>
+
+#include "rkstandardicons.h"
 
 #include "../debug.h"
 
@@ -31,6 +35,8 @@ RKDynamicSearchLine::RKDynamicSearchLine (QWidget *parent) : QLineEdit (parent)
 	timer.setSingleShot (true);
 	connect (&timer, &QTimer::timeout, this, &RKDynamicSearchLine::delayedSearch);
 	connect (this, &QLineEdit::textChanged, this, &RKDynamicSearchLine::textChanged);
+	working_indicator = new QAction (this);
+	working_indicator->setIcon (RKStandardIcons::getIcon (RKStandardIcons::StatusWaitingUpdating));
 }
 
 RKDynamicSearchLine::~RKDynamicSearchLine () {
@@ -40,6 +46,7 @@ RKDynamicSearchLine::~RKDynamicSearchLine () {
 void RKDynamicSearchLine::textChanged () {
 	RK_TRACE (MISC);
 	// KF5 TODO: Add activity indicator
+	addAction (working_indicator, QLineEdit::TrailingPosition);
 	timer.start (300);
 }
 
@@ -61,5 +68,6 @@ void RKDynamicSearchLine::delayedSearch () {
 
 	QRegExp filter (term, Qt::CaseInsensitive, allnum ? QRegExp::FixedString : QRegExp::RegExp2);
 	if (model) model->setFilterRegExp (filter);
+	removeAction (working_indicator);
 	emit (searchChanged (filter));
 }
diff --git a/rkward/misc/rkdynamicsearchline.h b/rkward/misc/rkdynamicsearchline.h
index c269672..10e2e1e 100644
--- a/rkward/misc/rkdynamicsearchline.h
+++ b/rkward/misc/rkdynamicsearchline.h
@@ -2,7 +2,7 @@
                           rkdynamicsearchline  -  description
                              -------------------
     begin                : Mon Nov 16 2015
-    copyright            : (C) 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2015-2016 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -23,6 +23,7 @@
 #include <QTimer>
 
 class QSortFilterProxyModel;
+class QAction;
 
 /** This class is mostly like KFilterProxySearchLine, except allowing us to filter using regexps.
  *  Also some internal differences, due to the fact that we don't have to hide implementation details as in a framework lib. */
@@ -42,6 +43,7 @@ private slots:
 	void delayedSearch ();
 private:
 	QTimer timer;
+	QAction *working_indicator;
 	QSortFilterProxyModel *model;
 };
 
diff --git a/rkward/misc/rkstandardicons.cpp b/rkward/misc/rkstandardicons.cpp
index ec6c43a..7a0c0a3 100644
--- a/rkward/misc/rkstandardicons.cpp
+++ b/rkward/misc/rkstandardicons.cpp
@@ -37,6 +37,9 @@ void RKStandardIcons::initIcons () {
 	instance->doInitIcons ();
 }
 
+// TODO: With number of items growing, we should probably use a lazy-loading approach, instead:
+//       if (!loaded[thing]) initIcon (thing);
+//       return icons[thing];
 void RKStandardIcons::doInitIcons () {
 	RK_TRACE (APP);
 
@@ -113,7 +116,7 @@ void RKStandardIcons::doInitIcons () {
 	icons[WindowCommandEditor] = QIcon::fromTheme("text-x-makefile");	// this may not be the most obvious choice, but it is not quite as awfully close to the data.frame editor icons as most other text icons
 	icons[WindowOutput] = QIcon::fromTheme("applications-education");
 	icons[WindowHelp] = QIcon::fromTheme("help-contents");
-	icons[WindowX11] = QIcon::fromTheme("x");
+	icons[WindowX11] = QIcon::fromTheme("applications-graphics");
 	icons[WindowObject] = QIcon::fromTheme("zoom-original");
 	icons[WindowConsole] = QIcon::fromTheme("utilities-terminal");
 	icons[WindowCommandLog] = QIcon::fromTheme("format-justify-left");
@@ -124,16 +127,16 @@ void RKStandardIcons::doInitIcons () {
 	icons[WindowDebugConsole] = QIcon::fromTheme("view-process-system");
 	icons[WindowCallstackViewer] = QIcon::fromTheme("view-sort-ascending");
 
+	// TODO: We really want an hourglass symbol, or similar, here.
+	icons[StatusWaitingUpdating] = QIcon::fromTheme ("system-search");
+
 	icons[DocumentPDF] = QIcon::fromTheme("application-pdf");
 
-	// KF5 TODO: The code below should work allright with QIcon::fromTheme
-/*	This does not work, as the icons are not really Null in this case, but some default icon. Any way to really test this?
 	RK_DO ({
 		for (int i = ActionRunAll; i < Last; ++i) {
 			if (icons[i].isNull ()) qDebug ("Icon %d could not be loaded", i);
 		}
 	}, MISC, DL_ERROR);
-*/
 }
 
 QIcon RKStandardIcons::iconForObject (const RObject* object) {
diff --git a/rkward/misc/rkstandardicons.h b/rkward/misc/rkstandardicons.h
index 164d173..ed4790a 100644
--- a/rkward/misc/rkstandardicons.h
+++ b/rkward/misc/rkstandardicons.h
@@ -113,6 +113,8 @@ public:
 		WindowDebugConsole,
 		WindowCallstackViewer,
 
+		StatusWaitingUpdating,
+
 		DocumentPDF,
 
 		Last	/**< not really an item, only the count of items available. Do not use. */



More information about the rkward-tracker mailing list