Commit 59ca3b6d authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Remove more obsolete version checks

parent 914a44d2
......@@ -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:
......
......@@ -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));
......
......@@ -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]);
}
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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));
}
......
......@@ -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.
}
......
......@@ -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;
}
......
......@@ -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
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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 () {
......
......@@ -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)));
......
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