[rkward] rkward: More ebn / krazy fixes: use const-refs in foreach(), fix duplicate includes, normalizes some SIGNALs and SLOTS

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Feb 26 08:32:41 UTC 2015


Git commit 3ce7e23c1e139b34d984f83326b7e87e32174a7c by Thomas Friedrichsmeier.
Committed on 26/02/2015 at 08:31.
Pushed by tfry into branch 'master'.

More ebn / krazy fixes: use const-refs in foreach(), fix duplicate includes, normalizes some SIGNALs and SLOTS

M  +1    -1    rkward/misc/rkfindbar.cpp
M  +1    -1    rkward/misc/rkprogresscontrol.cpp
M  +0    -2    rkward/plugin/rkcomponentmap.cpp
M  +0    -2    rkward/plugin/rkstandardcomponent.cpp
M  +1    -1    rkward/rkconsole.cpp
M  +1    -1    rkward/settings/rksettingsmodulecommandeditor.cpp
M  +2    -2    rkward/settings/rksettingsmoduleplugins.cpp
M  +1    -1    rkward/settings/rksettingsmoduler.cpp
M  +1    -1    rkward/windows/detachedwindowcontainer.cpp
M  +0    -1    rkward/windows/rkcommandeditorwindow.h
M  +1    -1    rkward/windows/rkhtmlwindow.cpp
M  +1    -1    rkward/windows/rktoolwindowbar.cpp
M  +1    -1    rkward/windows/rktoplevelwindowgui.cpp
M  +1    -1    rkward/windows/rkworkplace.cpp

http://commits.kde.org/rkward/3ce7e23c1e139b34d984f83326b7e87e32174a7c

diff --git a/rkward/misc/rkfindbar.cpp b/rkward/misc/rkfindbar.cpp
index 0e9c06a..5cc76d8 100644
--- a/rkward/misc/rkfindbar.cpp
+++ b/rkward/misc/rkfindbar.cpp
@@ -38,7 +38,7 @@ RKFindBar::RKFindBar (QWidget* parent, bool custom) : QWidget (parent) {
 	QToolButton* close_button = new QToolButton (this);
 	close_button->setIcon (KIcon ("dialog-close"));
 	close_button->setAutoRaise (true);   // makes it flat
-	connect (close_button, SIGNAL (clicked ()), this, SLOT (hide ()));
+	connect (close_button, SIGNAL (clicked()), this, SLOT (hide()));
 	mlayout->addWidget (close_button);
 
 	QHBoxLayout* slayout = new QHBoxLayout ();
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 71f890b..31da222 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -189,7 +189,7 @@ QString RKProgressControl::fullCommandOutput() {
 	RK_TRACE (MISC);
 
 	QString ret;
-	foreach (ROutput out, output_log) ret.append (out.output);
+	foreach (const ROutput& out, output_log) ret.append (out.output);
 	return ret;
 }
 
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index e853630..f4bcc2c 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -774,8 +774,6 @@ void RKComponentMap::setPluginStatus (const QStringList& ids, const QStringList&
 ///########################### END RKComponentMap ###############################
 ///########################### BEGIN RKComponentHandle ############################
 
-#include "rkstandardcomponent.h"
-
 RKComponentHandle::RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label) {
 	RK_TRACE (PLUGIN);
 
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index 0f384f5..91e9afc 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -511,8 +511,6 @@ void RKStandardComponent::addComponentToCurrentPage (RKComponent *component) {
 
 /////////////////////////////////////// RKComponentBuilder /////////////////////////////////////////
 
-#include "rkcomponentmap.h"
-
 #include <qpushbutton.h>
 
 RKComponentBuilder::RKComponentBuilder (RKComponent *parent_component, const QDomElement &document_element) {
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 949ae33..ff49737 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -804,7 +804,7 @@ QString RKConsole::cleanSelection (const QString &origin) {
 	QString ret;
 	ret.reserve (origin.length ());
 	QStringList lines = origin.split ('\n');
-	foreach (QString line, lines) {
+	foreach (const QString& line, lines) {
 		if (line.startsWith (nprefix)) {
 			ret.append (line.mid (nprefix.length ()));
 		} else if (line.startsWith (iprefix)) {
diff --git a/rkward/settings/rksettingsmodulecommandeditor.cpp b/rkward/settings/rksettingsmodulecommandeditor.cpp
index 301e2bd..4697393 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.cpp
+++ b/rkward/settings/rksettingsmodulecommandeditor.cpp
@@ -216,7 +216,7 @@ bool RKSettingsModuleCommandEditor::matchesScriptFileFilter (const QString &file
 	RK_TRACE (SETTINGS);
 
 	const QStringList exts = script_file_filter.split (' ');
-	foreach (const QString ext, exts) {
+	foreach (const QString& ext, exts) {
 		QRegExp reg (ext, Qt::CaseInsensitive, QRegExp::Wildcard);
 		if (reg.exactMatch (filename)) return true;
 	}
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 1a21f50..584417e 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -385,12 +385,12 @@ QStringList RKSettingsModulePlugins::findPluginMapsRecursive (const QString &bas
 	foreach (const QString &map, maps) ret.append (dir.absoluteFilePath (map));
 
 	QStringList subdirs = dir.entryList (QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
-	foreach (const QString subdir, subdirs) {
+	foreach (const QString& subdir, subdirs) {
 #if QT_VERSION >= 0x040500
 		ret.append (findPluginMapsRecursive (dir.absoluteFilePath (subdir)));
 #else
 		QStringList subs = findPluginMapsRecursive (dir.absoluteFilePath (subdir));
-		foreach (const QString sub, subs) ret.append (sub);
+		foreach (const QString& sub, subs) ret.append (sub);
 #endif
 	}
 
diff --git a/rkward/settings/rksettingsmoduler.cpp b/rkward/settings/rksettingsmoduler.cpp
index 35a2266..401f3f4 100644
--- a/rkward/settings/rksettingsmoduler.cpp
+++ b/rkward/settings/rksettingsmoduler.cpp
@@ -479,7 +479,7 @@ QString RKSettingsModuleRPackages::libLocsCommand () {
 	QString command = ".libPaths (unique (c (";
 	bool first = true;
 	QStringList ll = libraryLocations ();
-	foreach (const QString libloc, ll) {
+	foreach (const QString& libloc, ll) {
 		if (first) first = false;
 		else command.append (", ");
 		command.append (RObject::rQuote (libloc));
diff --git a/rkward/windows/detachedwindowcontainer.cpp b/rkward/windows/detachedwindowcontainer.cpp
index 76edeec..820a201 100644
--- a/rkward/windows/detachedwindowcontainer.cpp
+++ b/rkward/windows/detachedwindowcontainer.cpp
@@ -109,7 +109,7 @@ void DetachedWindowContainer::hideEmptyMenus (bool ignore) {
 	// remove empty menus (we had to define them in detachedwindowcontainer.rc in order to force a sane menu order)
 	QStringList menu_names;
 	menu_names << "file" << "device" << "history" << "edit" << "run" << "view" << "settings";
-	foreach (QString name, menu_names) {
+	foreach (const QString& name, menu_names) {
 		QMenu* menu = dynamic_cast<QMenu*>(guiFactory ()->container (name, this));
 		if (menu) menu->menuAction ()->setVisible (!menu->isEmpty ());
 	}
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index f28f7f9..9222651 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -102,7 +102,6 @@ private:
 };
 
 /** code completion model for RKCommandEditorWindow */
-#include <kdeversion.h>
 #if KDE_VERSION_MAJOR != 4
 #	error Adjust the versioning hack below!
 #endif
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 5b9d624..d4987e1 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -143,7 +143,7 @@ RKHTMLWindow::RKHTMLWindow (QWidget *parent, WindowMode mode) : RKMDIWindow (par
 	// We have to connect this in order to allow browsing.
 	connect (page, SIGNAL (pageInternalNavigation(QUrl)), this, SLOT (internalNavigation(QUrl)));
 	connect (page, SIGNAL (downloadRequested(QNetworkRequest)), this, SLOT (saveRequested(QNetworkRequest)));
-	connect (page, SIGNAL (printRequested(QWebFrame*)), this, SLOT(slotPrint ()));
+	connect (page, SIGNAL (printRequested(QWebFrame*)), this, SLOT(slotPrint()));
 	connect (view, SIGNAL (customContextMenuRequested(QPoint)), this, SLOT(makeContextMenu(QPoint)));
 
 	current_history_position = -1;
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index ba0285d..a6b0332 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -302,7 +302,7 @@ void RKToolWindowBar::contextMenuEvent (QContextMenuEvent* event) {
 	RK_TRACE (APP);
 
 	KMenu menu (this);
-	foreach (RKToolWindowList::ToolWindowRepresentation rep, RKToolWindowList::registeredToolWindows ()) {
+	foreach (const RKToolWindowList::ToolWindowRepresentation& rep, RKToolWindowList::registeredToolWindows ()) {
 		QAction *a = menu.addAction (rep.window->windowIcon (), rep.window->shortCaption ());
 		a->setCheckable (true);
 		a->setChecked (rep.window->tool_window_bar == this);
diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index aa29c3f..2a055ee 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -83,7 +83,7 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI (KXmlGuiWindow *for_window) : QObject (
 	next_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Tab);
 
 	KAction *action;
-	foreach (RKToolWindowList::ToolWindowRepresentation rep, RKToolWindowList::registeredToolWindows ()) {
+	foreach (const RKToolWindowList::ToolWindowRepresentation& rep, RKToolWindowList::registeredToolWindows ()) {
 		action = actionCollection ()->addAction ("window_show_" + rep.id, this, SLOT (toggleToolView()));
 		action->setText (i18n ("Show/Hide %1", rep.window->shortCaption ()));
 		action->setIcon (rep.window->windowIcon ());
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index ea3ffd5..797943b 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -222,7 +222,7 @@ void RKWorkplace::addWindow (RKMDIWindow *window, bool attached) {
 void RKWorkplace::placeToolWindows() {
 	RK_TRACE (APP);
 
-	foreach (const RKToolWindowList::ToolWindowRepresentation rep, RKToolWindowList::registeredToolWindows ()) {
+	foreach (const RKToolWindowList::ToolWindowRepresentation& rep, RKToolWindowList::registeredToolWindows ()) {
 		placeInToolWindowBar (rep.window, rep.default_placement);
 		getHistory ()->popLastWindow (rep.window);	// windows send a spurious activation signal triggered from KPartsManager::addPart(), so we pop them, again
 	}



More information about the rkward-tracker mailing list