[rkward] rkward: Fix a bunch of EBN/krazy2 warnings

Thomas Friedrichsmeier null at kde.org
Sun Apr 15 08:58:16 UTC 2018


Git commit 2d2563aa4f71587504d01004ebffa6ad7ec598f8 by Thomas Friedrichsmeier.
Committed on 15/04/2018 at 08:58.
Pushed by tfry into branch 'master'.

Fix a bunch of EBN/krazy2 warnings

M  +1    -1    rkward/core/robject.h
M  +1    -1    rkward/dataeditor/twintable.cpp
M  +0    -1    rkward/misc/rkaccordiontable.cpp
M  +1    -1    rkward/misc/rkaccordiontable.h
M  +1    -1    rkward/misc/rkdynamicsearchline.h
M  +1    -1    rkward/misc/rkxmlguipreviewarea.cpp
M  +1    -1    rkward/plugin/rkcomponentmeta.cpp
M  +1    -1    rkward/plugin/rkmatrixinput.cpp
M  +5    -5    rkward/rbackend/rkrbackendprotocol_backend.cpp
M  +2    -1    rkward/rkward.cpp
M  +1    -1    rkward/settings/rksettingsmoduleplugins.cpp
M  +4    -2    rkward/windows/rkcommandeditorwindow.cpp
M  +0    -1    rkward/windows/rkcommandlog.cpp
M  +2    -2    rkward/windows/rkhtmlwindow.cpp
M  +3    -3    rkward/windows/rkworkplace.cpp

https://commits.kde.org/rkward/2d2563aa4f71587504d01004ebffa6ad7ec598f8

diff --git a/rkward/core/robject.h b/rkward/core/robject.h
index f93f5116..90a8cca0 100644
--- a/rkward/core/robject.h
+++ b/rkward/core/robject.h
@@ -152,7 +152,7 @@ public:
 	bool canRemove () const;
 /** returns true, if this object is inside the .GlobalEnv. The .GlobalEnv is not considered to be inside itself. */
 	bool isInGlobalEnv () const;
-/** returns the toplevel environment that this object is in. May the the same as the object. */
+/** returns the toplevel environment that this object is in. May the same as the object. */
 	REnvironmentObject *toplevelEnvironment () const;
 
 	void rename (const QString &new_short_name);
diff --git a/rkward/dataeditor/twintable.cpp b/rkward/dataeditor/twintable.cpp
index a43d44e1..1eb2a662 100644
--- a/rkward/dataeditor/twintable.cpp
+++ b/rkward/dataeditor/twintable.cpp
@@ -205,7 +205,7 @@ void TwinTable::setWindowStyleHint (const QString& hint) {
 		metaview->horizontalHeader ()->hide ();
 		metaview->setMinimumHeight (metaview->rowHeight (0));
 		// Now, I just don't understand QSplitter sizing, here... Despite stretch factors being set, metaview continues to be the first to grow.
-		// Forcing minimum heigt of dataview help allocating initial size to the dataview, though.
+		// Forcing minimum height of dataview helps allocating initial size to the dataview, though.
 		dataview->setMinimumHeight (dataview->rowHeight (0) * 5);
 	}
 	RKMDIWindow::setWindowStyleHint (hint);
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index ba6887b0..7d64f44b 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -246,7 +246,6 @@ public:
 	QIcon collapsed;
 };
 
-#include <QPainter>
 #include <QScrollBar>
 #include <QHeaderView>
 RKAccordionTable::RKAccordionTable (QWidget* parent) : QTreeView (parent) {
diff --git a/rkward/misc/rkaccordiontable.h b/rkward/misc/rkaccordiontable.h
index 629af4f0..324fb18f 100644
--- a/rkward/misc/rkaccordiontable.h
+++ b/rkward/misc/rkaccordiontable.h
@@ -26,7 +26,7 @@ class RKAccordionDummyModel;
 class RKAccordionTable : public QTreeView {
 	Q_OBJECT
 public:
-	RKAccordionTable (QWidget *parent);
+	explicit RKAccordionTable (QWidget *parent);
 	~RKAccordionTable ();
 
 	QWidget *editorWidget () const { return editor_widget; };
diff --git a/rkward/misc/rkdynamicsearchline.h b/rkward/misc/rkdynamicsearchline.h
index 10e2e1e0..121161df 100644
--- a/rkward/misc/rkdynamicsearchline.h
+++ b/rkward/misc/rkdynamicsearchline.h
@@ -30,7 +30,7 @@ class QAction;
 class RKDynamicSearchLine : public QLineEdit {
 	Q_OBJECT
 public:
-	RKDynamicSearchLine (QWidget *parent);
+	explicit RKDynamicSearchLine (QWidget *parent);
 	virtual ~RKDynamicSearchLine ();
 
 /** If a model is set, will call setFilterRegExp() when the search string is changed. */
diff --git a/rkward/misc/rkxmlguipreviewarea.cpp b/rkward/misc/rkxmlguipreviewarea.cpp
index b50962a3..d9140bc0 100644
--- a/rkward/misc/rkxmlguipreviewarea.cpp
+++ b/rkward/misc/rkxmlguipreviewarea.cpp
@@ -107,7 +107,7 @@ void RKXMLGUIPreviewArea::prepareMenu () {
 		if (menu_empty) continue;
 
 		QWidgetAction *act = new QWidgetAction (this);
-		QLabel *lab = new QLabel ("<b>" + entries[i]->text ().replace ('&', "") + "</b>");
+		QLabel *lab = new QLabel ("<b>" + entries[i]->text ().remove ('&') + "</b>");
 		lab->setAlignment (Qt::AlignCenter);
 		act->setDefaultWidget (lab);
 		menu->addAction (act);
diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp
index 1c99eacc..54ab3a6f 100644
--- a/rkward/plugin/rkcomponentmeta.cpp
+++ b/rkward/plugin/rkcomponentmeta.cpp
@@ -201,7 +201,7 @@ QString numericVersionToString (quint32 numeric) {
 		ret.append (QString::number (ver_part));
 		if (i > 0) ret.append ('.');
 	}
-	if (ret.endsWith (".0")) ret.chop (2);	// HACK: Don't print more than three verison parts, unless the fourth is non-zero
+	if (ret.endsWith (QLatin1String (".0"))) ret.chop (2);	// HACK: Don't print more than three verison parts, unless the fourth is non-zero
 	return ret;
 }
 
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index 5d3bf5eb..e0a2345f 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -127,7 +127,7 @@ QVariant RKMatrixInput::value (const QString& modifier) {
 			ret.append ("\tc (" + makeColumnString (i, ", ") + ')');
 		}
 		return QString ("cbind (\n" + ret.join (",\n") + "\n)");
-	} else if (modifier.startsWith ("row.")) {
+	} else if (modifier.startsWith (QLatin1String ("row."))) {
 		bool ok;
 		int row = modifier.mid (4).toInt (&ok);
 		if ((row >= 0) && ok) {
diff --git a/rkward/rbackend/rkrbackendprotocol_backend.cpp b/rkward/rbackend/rkrbackendprotocol_backend.cpp
index 7492ca1c..df549c12 100644
--- a/rkward/rbackend/rkrbackendprotocol_backend.cpp
+++ b/rkward/rbackend/rkrbackendprotocol_backend.cpp
@@ -94,15 +94,15 @@
 		QString data_dir, locale_dir;
 		QStringList args = app.arguments ();
 		for (int i = 1; i < args.count (); ++i) {
-			if (args[i].startsWith ("--debug-level")) {
+			if (args[i].startsWith (QLatin1String ("--debug-level"))) {
 				RK_Debug::RK_Debug_Level = args[i].section ('=', 1).toInt ();
-			} else if (args[i].startsWith ("--server-name")) {
+			} else if (args[i].startsWith (QLatin1String ("--server-name"))) {
 				servername = QUrl::fromPercentEncoding (args[i].section ('=', 1).toUtf8 ());
-			} else if (args[i].startsWith ("--data-dir")) {
+			} else if (args[i].startsWith (QLatin1String ("--data-dir"))) {
 				data_dir = QUrl::fromPercentEncoding (args[i].section ('=', 1).toUtf8 ());
-			} else if (args[i].startsWith ("--locale-dir")) {
+			} else if (args[i].startsWith (QLatin1String ("--locale-dir"))) {
 				locale_dir = QUrl::fromPercentEncoding (args[i].section ('=', 1).toUtf8 ());
-			} else if (args[i].startsWith ("--rkd-server-name")) {
+			} else if (args[i].startsWith (QLatin1String ("--rkd-server-name"))) {
 				rkd_server_name = QUrl::fromPercentEncoding (args[i].section ('=', 1).toUtf8 ());
 			} else {
 				printf ("unknown argument %s", qPrintable (args[i]));
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 3fe00a3d..47d447ac 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -15,6 +15,8 @@
  *                                                                         *
  ***************************************************************************/
 
+#include "rkward.h"
+
 // include files for QT
 #include <qtimer.h>
 #include <QDesktopWidget>
@@ -44,7 +46,6 @@
 #include <KConfigGroup>
 
 // application specific includes
-#include "rkward.h"
 #include "core/rkmodificationtracker.h"
 #include "plugin/rkcomponentmap.h"
 #include "settings/rksettings.h"
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 241c141b..01a02a78 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -224,7 +224,7 @@ QString RKSettingsModulePlugins::findPluginMapById (const QString &id) {
 		if (known_plugin_maps[i].id == id) return known_plugin_maps[i].filename;
 	}
 	// for "rkward::" namespace, try a little harded:
-	if (id.startsWith ("rkward::")) {
+	if (id.startsWith (QLatin1String ("rkward::"))) {
 		QFileInfo info (RKCommonFunctions::getRKWardDataDir () + '/' + id.mid (8));
 		if (info.isReadable ()) return info.absoluteFilePath ();
 	}
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 0f7cfe97..40f5e470 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -196,7 +196,9 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl _url,
 
 	connect (m_doc, &KTextEditor::Document::documentUrlChanged, this, &RKCommandEditorWindow::updateCaption);
 	connect (m_doc, &KTextEditor::Document::modifiedChanged, this, &RKCommandEditorWindow::updateCaption);                // of course most of the time this causes a redundant call to updateCaption. Not if a modification is undone, however.
+#ifdef __GNUC__'
 #warning remove this in favor of KTextEditor::Document::restore()
+#endif
 	connect (m_doc, &KTextEditor::Document::modifiedChanged, this, &RKCommandEditorWindow::autoSaveHandlerModifiedChanged);
 	connect (m_doc, &KTextEditor::Document::textChanged, this, &RKCommandEditorWindow::autoSaveHandlerTextChanged);
 	connect (m_view, &KTextEditor::View::selectionChanged, this, &RKCommandEditorWindow::selectionChanged);
@@ -1283,9 +1285,9 @@ void RKCommandHighlighter::setHighlighting (KTextEditor::Document *doc, Highligh
 	else if (mode == RInteractiveSession) mode_string = "R interactive session";
 	else {
 		QString fn = doc->url ().fileName ().toLower ();
-		if (fn.endsWith (".pluginmap") || fn.endsWith (".rkh") || fn.endsWith (".xml") || fn.endsWith (".inc")) {
+		if (fn.endsWith (QLatin1String (".pluginmap")) || fn.endsWith (QLatin1String (".rkh")) || fn.endsWith (QLatin1String (".xml")) || fn.endsWith (QLatin1String (".inc"))) {
 			mode_string = "XML";
-		} else if (fn.endsWith (".js")) {
+		} else if (fn.endsWith (QLatin1String (".js"))) {
 			mode_string = "JavaScript";
 		} else {
 			return;
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index e96e1fad..1cac1076 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -266,7 +266,6 @@ void RKCommandLogView::selectAll () {
 #include <kxmlguifactory.h>
 #include <QAction>
 #include <QGuiApplication>
-#include <QFontDatabase>
 
 RKCommandLogPart::RKCommandLogPart (RKCommandLog *for_log) : KParts::Part (0) {
 	RK_TRACE (APP);
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index f9e6eb43..d2dfdb51 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -377,14 +377,14 @@ bool RKHTMLWindow::openURL (const QUrl &url) {
 		return ok;
 	}
 
-	if (url_change_is_from_history || url.scheme ().toLower ().startsWith ("help")) {	// handle help pages, and any page that we have previously handled (from history)
+	if (url_change_is_from_history || url.scheme ().toLower ().startsWith (QLatin1String ("help"))) {	// handle help pages, and any page that we have previously handled (from history)
 		changeURL (url);
 		page->load (url);
 		return true;
 	}
 
 	// special casing for R's dynamic help pages. These should be considered local, even though they are served through http
-	if (url.scheme ().toLower ().startsWith ("http")) {
+	if (url.scheme ().toLower ().startsWith (QLatin1String ("http"))) {
 		QString host = url.host ();
 		if ((host == "127.0.0.1") || (host == "localhost") || host == QHostInfo::localHostName ()) {
 			KIO::TransferJob *job = KIO::get (url, KIO::Reload);
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 9cac2794..3988da86 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -415,7 +415,7 @@ bool RKWorkplace::openAnyUrl (const QUrl &url, const QString &known_mimetype, bo
 			openHelpWindow (url, true);
 			return true;	// TODO
 		}
-		if (url.fileName ().toLower ().endsWith (".rdata") || url.fileName ().toLower ().endsWith (".rda")) {
+		if (url.fileName ().toLower ().endsWith (QLatin1String (".rdata")) || url.fileName ().toLower ().endsWith (QLatin1String (".rda"))) {
 			RKWardMainWindow::getMain ()->askOpenWorkspace (url);
 			return true;	// TODO
 		}
@@ -921,11 +921,11 @@ void RKWorkplace::restoreWorkplace (const QStringList &description) {
 		// apply generic window parameters
 		if (win) {
 			for (int p = 0; p < spec.params.size (); ++p) {
-				if (spec.params[p].startsWith ("sidebar")) {
+				if (spec.params[p].startsWith (QLatin1String ("sidebar"))) {
 					int position = spec.params[p].section (',', 1).toInt ();
 					placeInToolWindowBar (win, position);
 				}
-				if (spec.params[p].startsWith ("detached")) {
+				if (spec.params[p].startsWith (QLatin1String ("detached"))) {
 					QStringList geom = spec.params[p].split (',');
 					win->hide ();
 					win->setGeometry (geom.value (1).toInt (), geom.value (2).toInt (), geom.value (3).toInt (), geom.value (4).toInt ());



More information about the rkward-tracker mailing list