[rkward/frameworks] /: Remove more obsolete version checks

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Nov 25 08:46:12 UTC 2015


Git commit 59ca3b6df1fb044d479ebb0829911f43317e640b by Thomas Friedrichsmeier.
Committed on 25/11/2015 at 08:02.
Pushed by tfry into branch 'frameworks'.

Remove more obsolete version checks

M  +0    -1    TODO
M  +0    -2    rkward/core/rkvariable.cpp
M  +0    -2    rkward/dataeditor/rktextmatrix.cpp
M  +0    -6    rkward/dataeditor/rkvareditmodel.cpp
M  +0    -4    rkward/dialogs/rkloadlibsdialog.cpp
M  +0    -2    rkward/plugin/rkcomponentmap.cpp
M  +0    -2    rkward/rbackend/rkrsupport.cpp
M  +0    -4    rkward/rbackend/rktransmitter.cpp
M  +1    -5    rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M  +1    -5    rkward/rkconsole.cpp
M  +2    -4    rkward/scriptbackends/qtscriptbackend.h
M  +0    -5    rkward/settings/rksettingsmoduleplugins.cpp
M  +1    -2    rkward/windows/rkcommandeditorwindow.cpp
M  +0    -2    rkward/windows/rkhelpsearchwindow.cpp
M  +0    -4    rkward/windows/rkhtmlwindow.cpp
M  +0    -11   rkward/windows/rkworkplaceview.cpp

http://commits.kde.org/rkward/59ca3b6df1fb044d479ebb0829911f43317e640b

diff --git a/TODO b/TODO
index 554cf25..f3e49da 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ KF5 port:
 Things to do:
 - Convert to new Signal / slot syntax
 - Remove kde4libssupport classes
-- Remove obsolete version checks
 - Adjust platform checks
 - Check for usages of i18n ("%1").arg(x), instead of i18n ("%1", x)
 Things to test at the end:
diff --git a/rkward/core/rkvariable.cpp b/rkward/core/rkvariable.cpp
index b65d963..81ce44a 100644
--- a/rkward/core/rkvariable.cpp
+++ b/rkward/core/rkvariable.cpp
@@ -58,9 +58,7 @@ void RKVariable::setVarType (RObject::RDataType new_type, bool sync) {
 	if (data) {
 		// quick and dirty approach! TODO: make more efficient
 		QStringList list;
-#if QT_VERSION >= 0x040700
 		list.reserve (getLength ());
-#endif
 		bool labelled = (new_type == DataCharacter);
 		for (int i=0; i < getLength (); ++i) list.append (getText (i, labelled));
 
diff --git a/rkward/dataeditor/rktextmatrix.cpp b/rkward/dataeditor/rktextmatrix.cpp
index 541f970..3ea51c6 100644
--- a/rkward/dataeditor/rktextmatrix.cpp
+++ b/rkward/dataeditor/rktextmatrix.cpp
@@ -170,9 +170,7 @@ QStringList RKTextMatrix::getColumn (int col) const {
 	}
 
 	QStringList ret;
-#if QT_VERSION >= 0x040700
 	ret.reserve (rows.size ());
-#endif
 	for (int i = 0; i < rows.size (); ++i) {
 		ret.append (rows[i][col]);
 	}
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index ab5bff9..fefd156 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -144,9 +144,7 @@ void RKVarEditModel::scheduleReset () {
 	if (!reset_scheduled) {
 		reset_scheduled = true;
 		QTimer::singleShot (0, this, SLOT (doResetNow()));
-#if QT_VERSION >= 0x040600
 		beginResetModel ();
-#endif
 	}
 }
 
@@ -155,11 +153,7 @@ void RKVarEditModel::doResetNow () {
 	RK_ASSERT (reset_scheduled);
 
 	reset_scheduled = false;
-#if QT_VERSION >= 0x040600
 	endResetModel ();
-#else
-	reset ();
-#endif
 }
 
 void RKVarEditModel::objectDataChanged (RObject* object, const RObject::ChangeSet *changes) {
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index a294185..ae64764 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -490,11 +490,7 @@ void LoadUnloadWidget::rCommandDone (RCommand *command) {
 			QTreeWidgetItem* item = new QTreeWidgetItem (loaded_view);
 			item->setText (0, data.at (i));
 			if (RKSettingsModuleRPackages::essentialPackages ().contains (data.at (i))) {
-#if QT_VERSION >= 0x040400
 				item->setFlags (Qt::NoItemFlags);
-#else
-				item->setFlags (0);
-#endif
 			}
 		}
 		loaded_view->resizeColumnToContents (0);
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index 4244015..22e678b 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -738,9 +738,7 @@ QStringList RKComponentMap::listPlugins () {
 	RK_TRACE (PLUGIN);
 
 	QStringList ret;
-#if QT_VERSION >= 0x040700
 	ret.reserve (components.size () * 4);
-#endif
 	for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) {
 		// RKComponentMap (in contrast to other contexts) will also contain plugins not added to the menu,
 		// and is listed separately, for this reason
diff --git a/rkward/rbackend/rkrsupport.cpp b/rkward/rbackend/rkrsupport.cpp
index c76324c..dba9cd9 100644
--- a/rkward/rbackend/rkrsupport.cpp
+++ b/rkward/rbackend/rkrsupport.cpp
@@ -102,9 +102,7 @@ QStringList RKRSupport::SEXPToStringList (SEXP from_exp) {
 	// format already good? Avoid coercion (and associated copying)
 	int count = Rf_length (from_exp);
 	QStringList list;
-#if QT_VERSION >= 0x040700
 	list.reserve (count);
-#endif
 	for (int i = 0; i < count; ++i) {
 		SEXP dummy = STRING_ELT (from_exp, i);
 
diff --git a/rkward/rbackend/rktransmitter.cpp b/rkward/rbackend/rktransmitter.cpp
index 80cb8ec..b840161 100644
--- a/rkward/rbackend/rktransmitter.cpp
+++ b/rkward/rbackend/rktransmitter.cpp
@@ -83,9 +83,7 @@ ROutputList* RKRBackendSerializer::unserializeOutput (QDataStream &stream) {
 	ROutputList *ret = new ROutputList ();
 	qint32 len;
 	stream >> len;
-#if QT_VERSION >= 0x040700
 	ret->reserve (len);
-#endif
 
 	for (qint32 i = 0; i < len; ++i) {
 		ROutput* out = new ROutput;
@@ -143,9 +141,7 @@ RData* RKRBackendSerializer::unserializeData (QDataStream &stream) {
 		RData::RDataStorage data;
 		qint32 len;
 		stream >> len;
-#if QT_VERSION >= 0x040700
 		data.reserve (len);
-#endif
 		for (qint32 i = 0; i < len; ++i) {
 			data.append (unserializeData (stream));
 		}
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index 9e9c4cc..245a07d 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -124,13 +124,9 @@ void RKGraphicsDevice::clear (const QColor& col) {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	if (painter.isActive ()) painter.end ();
-#if QT_VERSION >= 0x040800
 	if (col.isValid ()) area.fill (col);
 	else area.fill (QColor (255, 255, 255, 255));
-#else
-	if (col.isValid ()) area.fill (col.rgb ());
-	else area.fill (qRgb (255, 255, 255));
-#endif
+
 	updateNow ();
 	setClip (area.rect ());	// R's devX11.c resets clip on clear, so we do this, too.
 }
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index c76f10a..8c34c11 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -783,11 +783,7 @@ void RKConsole::userSaveHistory (const QUrl &_url) {
 
 	QUrl url = _url;
 	if (url.isEmpty ()) {
-		url = KFileDialog::getSaveUrl (QUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select filename to save command history")
-#if KDE_IS_VERSION(4,4,0)
-		                                    , KFileDialog::ConfirmOverwrite
-#endif
-		                                   );
+		url = KFileDialog::getSaveUrl (QUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select filename to save command history"), KFileDialog::ConfirmOverwrite);
 		if (url.isEmpty ()) return;
 	}
 
diff --git a/rkward/scriptbackends/qtscriptbackend.h b/rkward/scriptbackends/qtscriptbackend.h
index ffc59b1..f913c01 100644
--- a/rkward/scriptbackends/qtscriptbackend.h
+++ b/rkward/scriptbackends/qtscriptbackend.h
@@ -105,12 +105,10 @@ private:
 	bool sleeping;
 };
 
-#if QT_VERSION >= 0x040700
-#	define USE_Q_SCRIPT_PROGRAM
-#	include <QScriptProgram>
+#define USE_Q_SCRIPT_PROGRAM
+#include <QScriptProgram>
 namespace RKPrecompiledQtScripts {
 	bool loadCommonScript (QScriptEngine *engine, QString scriptfile);
 };
-#endif
 
 #endif
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 8749515..3e9e3ea 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -386,12 +386,7 @@ QStringList RKSettingsModulePlugins::findPluginMapsRecursive (const QString &bas
 
 	QStringList subdirs = dir.entryList (QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
 	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);
-#endif
 	}
 
 	return ret;
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index d2fea57..7309474 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -1015,10 +1015,9 @@ void RKCodeCompletionModel::updateCompletionList (const QString& symbol) {
 	int count = map.size ();
 	icons.clear ();
 	names.clear ();
-#if QT_VERSION >= 0x040700
 	icons.reserve (count);
 	names.reserve (count);
-#endif
+
 	// copy the map to two lists. For one thing, we need an int indexable storage, for another, caching this information is safer
 	// in case objects are removed while the completion mode is active.
 	for (RObject::RObjectSearchMap::const_iterator it = map.constBegin (); it != map.constEnd (); ++it) {
diff --git a/rkward/windows/rkhelpsearchwindow.cpp b/rkward/windows/rkhelpsearchwindow.cpp
index 9f1ab28..d597eff 100644
--- a/rkward/windows/rkhelpsearchwindow.cpp
+++ b/rkward/windows/rkhelpsearchwindow.cpp
@@ -228,9 +228,7 @@ void RKHelpSearchWindow::updateInstalledPackages () {
 	packagesList->clear ();
 	packagesList->addItem (i18n("All installed packages"));
 	packagesList->addItem (i18n("All loaded packages"));
-#if QT_VERSION >= 0x040400
 	packagesList->insertSeparator (2);
-#endif
 	packagesList->addItems (RKSessionVars::instance ()->installedPackages ());
 
 	int index = 0;
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 4e6fde0..16c0937 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -194,11 +194,7 @@ void RKHTMLWindow::selectionChanged () {
 		return;
 	}
 
-#if QT_VERSION >= 0x040800
 	part->run_selection->setEnabled (view->hasSelection ());
-#else
-	part->run_selection->setEnabled (!view->selectedText ().isEmpty ());
-#endif
 }
 
 void RKHTMLWindow::runSelection () {
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index 1c7c56e..fce1c81 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -49,21 +49,10 @@ RKWorkplaceView::RKWorkplaceView (QWidget *parent) : KTabWidget (parent) {
 	close_button->adjustSize ();
 	setCornerWidget (close_button, Qt::TopRightCorner);
 
-#if KDE_IS_VERSION(4,1,0)
-#	if QT_VERSION >= 0x040500
 	setTabsClosable (true);
 	connect (this, SIGNAL (tabCloseRequested(int)), this, SLOT (closePage(int)));
-#	else
-	setCloseButtonEnabled (true);
-	connect (this, SIGNAL (closeRequest(QWidget*)), this, SLOT (closePage(QWidget*)));
-#	endif
-#endif
 
-#if QT_VERSION >= 0x040500
 	setMovable (true);
-#else
-	setTabReorderingEnabled (true);	// the KDE function is deprecated sind Qt 4.5 / KDE 4.4
-#endif
 
 	tabBar ()->setContextMenuPolicy (Qt::CustomContextMenu);
 	connect (tabBar (), SIGNAL (customContextMenuRequested(QPoint)), this, SLOT (showContextMenu(QPoint)));



More information about the rkward-tracker mailing list