Commit 2d2563aa authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Fix a bunch of EBN/krazy2 warnings

parent b0c43c78
......@@ -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);
......
......@@ -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);
......
......@@ -246,7 +246,6 @@ public:
QIcon collapsed;
};
#include <QPainter>
#include <QScrollBar>
#include <QHeaderView>
RKAccordionTable::RKAccordionTable (QWidget* parent) : QTreeView (parent) {
......
......@@ -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; };
......
......@@ -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. */
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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]));
......
......@@ -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"
......
......@@ -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 ();
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 ());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment