[education/rkward/kf5] rkward: Remove version check and rkcompatibility
Thomas Friedrichsmeier
null at kde.org
Wed Apr 10 16:12:08 BST 2024
Git commit b0b289c62277b9230cb7825d00c06d27b3f674fa by Thomas Friedrichsmeier, on behalf of Carl Schwan.
Committed on 01/04/2024 at 11:45.
Pushed by tfry into branch 'kf5'.
Remove version check and rkcompatibility
M +1 -2 rkward/core/rkvariable.cpp
M +5 -4 rkward/dialogs/rkreadlinedialog.cpp
M +0 -1 rkward/misc/CMakeLists.txt
M +0 -4 rkward/misc/rkcommonfunctions.cpp
M +0 -9 rkward/misc/rkcommonfunctions.h
D +0 -29 rkward/misc/rkcompatibility.cpp
D +0 -43 rkward/misc/rkcompatibility.h
M +0 -5 rkward/misc/rkfindbar.cpp
M +0 -5 rkward/misc/rkoutputdirectory.cpp
M +3 -4 rkward/misc/rkspecialactions.cpp
M +2 -3 rkward/plugin/rkcomponentmeta.cpp
M +2 -3 rkward/plugin/rkcomponentproperties.cpp
M +1 -2 rkward/plugin/rkformula.cpp
M +2 -3 rkward/plugin/rkmatrixinput.cpp
M +2 -3 rkward/plugin/rkoptionset.cpp
M +1 -2 rkward/plugin/rkradio.cpp
M +5 -5 rkward/plugin/rkstandardcomponentgui.cpp
M +2 -3 rkward/plugin/rkvarslot.cpp
M +0 -4 rkward/rbackend/rkfrontendtransmitter.cpp
M +4 -8 rkward/rbackend/rkrbackend.cpp
M +0 -4 rkward/rbackend/rkrbackend.h
M +0 -4 rkward/rbackend/rkrbackendprotocol_frontend.cpp
M +2 -4 rkward/rbackend/rksessionvars.cpp
M +2 -3 rkward/rkconsole.cpp
M +1 -8 rkward/rkward.cpp
M +0 -16 rkward/settings/rkrecenturls.cpp
M +1 -2 rkward/settings/rksettingsmoduledebug.cpp
M +1 -2 rkward/settings/rksettingsmodulegeneral.cpp
M +2 -3 rkward/settings/rksettingsmodulegraphics.cpp
M +1 -2 rkward/settings/rksettingsmoduleplugins.cpp
M +0 -22 rkward/windows/rkcommandeditorwindow.cpp
M +0 -14 rkward/windows/rkfilebrowser.cpp
M +2 -7 rkward/windows/rkhtmlwindow.cpp
M +0 -12 rkward/windows/rkmdiwindow.cpp
M +0 -8 rkward/windows/rktoolwindowbar.cpp
M +2 -3 rkward/windows/rkwindowcatcher.cpp
M +1 -2 rkward/windows/rkworkplace.cpp
https://invent.kde.org/education/rkward/-/commit/b0b289c62277b9230cb7825d00c06d27b3f674fa
diff --git a/rkward/core/rkvariable.cpp b/rkward/core/rkvariable.cpp
index 025158943..4d14dac56 100644
--- a/rkward/core/rkvariable.cpp
+++ b/rkward/core/rkvariable.cpp
@@ -13,7 +13,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "rcontainerobject.h"
#include "robjectlist.h"
#include "../rbackend/rkrinterface.h"
-#include "../misc/rkcompatibility.h"
#include "rkmodificationtracker.h"
@@ -861,7 +860,7 @@ RKVariable::FormattingOptions RKVariable::parseFormattingOptionsString (const QS
formatting_options.precision_mode = FormattingOptions::PrecisionDefault;
formatting_options.precision = 0;
- QStringList list = string.split ('#', RKCompatibility::SkipEmptyParts());
+ QStringList list = string.split ('#', Qt::SkipEmptyParts);
QString option, parameter;
for (QStringList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) {
option = (*it).section (':', 0, 0);
diff --git a/rkward/dialogs/rkreadlinedialog.cpp b/rkward/dialogs/rkreadlinedialog.cpp
index 6984db02d..07d778c6d 100644
--- a/rkward/dialogs/rkreadlinedialog.cpp
+++ b/rkward/dialogs/rkreadlinedialog.cpp
@@ -7,9 +7,11 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "rkreadlinedialog.h"
-#include <qlineedit.h>
+#include <QApplication>
+#include <QScreen>
+#include <QLineEdit>
#include <QTextEdit>
-#include <qlabel.h>
+#include <QLabel>
#include <QScrollBar>
#include <QTimer>
#include <QVBoxLayout>
@@ -20,7 +22,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../rbackend/rcommand.h"
#include "../misc/rkdialogbuttonbox.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../debug.h"
@@ -36,7 +37,7 @@ RKReadLineDialog::RKReadLineDialog (QWidget *parent, const QString &caption, con
layout->addWidget (new QLabel (caption, this));
- int screen_width = RKCompatibility::availableGeometry(this).width();
+ int screen_width = screen() ? screen()->availableGeometry().width() : QApplication::primaryScreen()->availableGeometry().width();
QString context = command->fullOutput ();
if (!context.isEmpty ()) {
diff --git a/rkward/misc/CMakeLists.txt b/rkward/misc/CMakeLists.txt
index e50026b4e..4fa80d9dc 100644
--- a/rkward/misc/CMakeLists.txt
+++ b/rkward/misc/CMakeLists.txt
@@ -11,7 +11,6 @@ SET(misc_STAT_SRCS
xmlhelper.cpp
multistringselector.cpp
rkcommonfunctions.cpp
- rkcompatibility.cpp
rkprogresscontrol.cpp
rksaveobjectchooser.cpp
rkdummypart.cpp
diff --git a/rkward/misc/rkcommonfunctions.cpp b/rkward/misc/rkcommonfunctions.cpp
index aef31ebb6..6ca5bf050 100644
--- a/rkward/misc/rkcommonfunctions.cpp
+++ b/rkward/misc/rkcommonfunctions.cpp
@@ -177,12 +177,8 @@ namespace RKCommonFunctions {
rkward_data_dir = inside_build_tree;
return rkward_data_dir;
}
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
QStringList candidates = QStandardPaths::locateAll (QStandardPaths::AppDataLocation, "resource.ver");
candidates += QStandardPaths::locateAll (QStandardPaths::AppDataLocation, "rkward/resource.ver"); // Well, isn't this just silly? AppDataLocation may or may not contain the application name (on Mac)
-#else
- QStringList candidates = QStandardPaths::locateAll (QStandardPaths::GenericDataLocation, "resource.ver"); // Fails on Mac with unpatched Qt 5.10 (and before). See https://mail.kde.org/pipermail/kde-frameworks-devel/2018-May/063151.html
-#endif
for (int i = 0; i < candidates.size (); ++i) {
QFile resource_ver (candidates[i]);
if (resource_ver.open (QIODevice::ReadOnly) && (resource_ver.read (100).trimmed () == RKWARD_VERSION)) {
diff --git a/rkward/misc/rkcommonfunctions.h b/rkward/misc/rkcommonfunctions.h
index 7fd1b1244..17f16e761 100644
--- a/rkward/misc/rkcommonfunctions.h
+++ b/rkward/misc/rkcommonfunctions.h
@@ -53,15 +53,6 @@ namespace RKCommonFunctions {
QLabel* wordWrappedLabel (const QString &text);
/** create a QLabel that has wordwarp enabled, *and* clickable links (opened inside RKWard), in a single line of code. */
QLabel* linkedWrappedLabel (const QString &text);
-
-/** Porting aid: Qt::SplitBehaviorFlags was added in Qt 5.14, deprecating the previous flags in QString. Remove, once we depend on Qt >= 5.14 */
-#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
- inline Qt::SplitBehaviorFlags KeepEmptyParts() { return Qt::KeepEmptyParts; };
- inline Qt::SplitBehaviorFlags SkipEmptyParts() { return Qt::SkipEmptyParts; };
-#else
- inline QString::SplitBehavior KeepEmptyParts() { return QString::KeepEmptyParts; };
- inline QString::SplitBehavior SkipEmptyParts() { return QString::SkipEmptyParts; };
-#endif
};
#endif
diff --git a/rkward/misc/rkcompatibility.cpp b/rkward/misc/rkcompatibility.cpp
deleted file mode 100644
index 533e1dd45..000000000
--- a/rkward/misc/rkcompatibility.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-rkcommonfunctions - This file is part of the RKWard project. Created: Sat May 14 2022
-SPDX-FileCopyrightText: 2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
-SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
-SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "rkcompatibility.h"
-
-#include <QApplication>
-#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
-# include <QDesktopWidget>
-#else
-# include <QScreen>
-# include <QWidget>
-#endif
-
-namespace RKCompatibility {
- QRect availableGeometry(QWidget* for_widget) {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
- auto screen = for_widget->screen();
- if (screen) return screen->availableGeometry();
- return QApplication::primaryScreen()->availableGeometry();
-#else
- return ::QApplication::desktop()->availableGeometry(for_widget);
-#endif
- }
-};
-
diff --git a/rkward/misc/rkcompatibility.h b/rkward/misc/rkcompatibility.h
deleted file mode 100644
index c8afbd23e..000000000
--- a/rkward/misc/rkcompatibility.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-rkcommonfunctions - This file is part of the RKWard project. Created: Sat May 14 2022
-SPDX-FileCopyrightText: 2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
-SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
-SPDX-License-Identifier: GPL-2.0-or-later
-*/
-#ifndef RKCOMPATIBILTY_H
-#define RKCOMPATIBILTY_H
-
-#include <QRect>
-#include <QString>
-#include <QButtonGroup>
-
-class QWidget;
-
-/** Some helper functions / enums for the sole purpose of working around API changes while keeping compatibility across a wide range of Qt/KF versions.
-
-By their very nature, these functions are not meant to stay, but should be removed, as soon as the incompatibility falls outside the range of supported versions.
-
- at author Thomas Friedrichsmeier
-*/
-namespace RKCompatibility {
-//// NOTE: Functions / constants below are porting aids, to be removed, eventually. ////
-/** Small wrapper around QScreen::availableGeometry(), mostly to ease porting */
- QRect availableGeometry(QWidget *for_widget);
-
-/** Porting aid: Qt::SplitBehaviorFlags was added in Qt 5.14, deprecating the previous flags in QString. Remove, once we depend on Qt >= 5.14 */
-#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
- inline Qt::SplitBehaviorFlags KeepEmptyParts() { return Qt::KeepEmptyParts; };
- inline Qt::SplitBehaviorFlags SkipEmptyParts() { return Qt::SkipEmptyParts; };
-#else
- inline QString::SplitBehavior KeepEmptyParts() { return QString::KeepEmptyParts; };
- inline QString::SplitBehavior SkipEmptyParts() { return QString::SkipEmptyParts; };
-#endif
-
-#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
- inline void(QButtonGroup::* groupButtonClicked())(int) { return static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked); };
-#else
- inline void(QButtonGroup::* groupButtonClicked())(int) { return static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked); };
-#endif
-};
-
-#endif
diff --git a/rkward/misc/rkfindbar.cpp b/rkward/misc/rkfindbar.cpp
index 22b704d7c..5fb2de42c 100644
--- a/rkward/misc/rkfindbar.cpp
+++ b/rkward/misc/rkfindbar.cpp
@@ -38,13 +38,8 @@ RKFindBar::RKFindBar (QWidget* parent, bool custom) : QWidget (parent) {
term_edit = new KHistoryComboBox (this);
QString dummylong("This is quite a long search term by any standard, indeed");
QString dummyshort("A short search term");
-#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
term_edit->setMaximumWidth(fontMetrics().horizontalAdvance(dummylong));
term_edit->setMinimumWidth(fontMetrics().horizontalAdvance(dummyshort));
-#else
- term_edit->setMaximumWidth(fontMetrics().width(dummylong));
- term_edit->setMinimumWidth(fontMetrics().width(dummyshort));
-#endif
connect (term_edit, &KHistoryComboBox::editTextChanged, this, &RKFindBar::searchChanged);
connect (term_edit, static_cast<void (KHistoryComboBox::*)(const QString&)>(&KHistoryComboBox::returnPressed), this, &RKFindBar::forward);
regular_palette = term_edit->palette ();
diff --git a/rkward/misc/rkoutputdirectory.cpp b/rkward/misc/rkoutputdirectory.cpp
index 6b2093e56..5f1acf5a3 100644
--- a/rkward/misc/rkoutputdirectory.cpp
+++ b/rkward/misc/rkoutputdirectory.cpp
@@ -80,12 +80,7 @@ RKOutputDirectory* RKOutputDirectory::findOutputByWorkPath(const QString& workpa
if (workpath.endsWith("index.html")) {
QString wp = workpath;
-#if QT_VERSION >= QT_VERSION_CHECK(5,10,0)
return(outputs.value(wp.chopped(11))); // index.html, including pathsep
-#else
- wp.chop(11);
- return(outputs.value(wp));
-#endif
}
return nullptr;
}
diff --git a/rkward/misc/rkspecialactions.cpp b/rkward/misc/rkspecialactions.cpp
index 17c0af4cc..89708e19d 100644
--- a/rkward/misc/rkspecialactions.cpp
+++ b/rkward/misc/rkspecialactions.cpp
@@ -56,7 +56,6 @@ void RKPasteSpecialAction::doSpecialPaste() {
#include "rksaveobjectchooser.h"
#include "../rbackend/rkrinterface.h"
#include "../misc/rkprogresscontrol.h"
-#include "../misc/rkcompatibility.h"
RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : QDialog(parent) {
RK_TRACE (MISC);
@@ -94,7 +93,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
dimensionality_group->addButton (rbutton, DimDataFrame);
rbutton->setChecked (true);
group_layout->addWidget (rbutton);
- connect (dimensionality_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
+ connect (dimensionality_group, &QButtonGroup::idClicked, this, &RKPasteSpecialDialog::updateState);
rowlayout->addWidget (box);
const QMimeData* clipdata = QApplication::clipboard ()->mimeData ();
@@ -124,7 +123,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
separator_freefield = new QLineEdit (";", box);
h_layout->addWidget (separator_freefield);
group_layout->addLayout (h_layout);
- connect (separator_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
+ connect (separator_group, &QButtonGroup::idClicked, this, &RKPasteSpecialDialog::updateState);
rowlayout->addWidget (box);
rowlayout = new QHBoxLayout;
@@ -144,7 +143,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
rbutton = new QRadioButton (i18n ("Quote all values"), box);
quoting_group->addButton (rbutton, QuoteAll);
group_layout->addWidget (rbutton);
- connect (quoting_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
+ connect (quoting_group, &QButtonGroup::idClicked, this, &RKPasteSpecialDialog::updateState);
rowlayout->addWidget (box);
// Labels
diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp
index 6c4bf028c..85f1657d5 100644
--- a/rkward/plugin/rkcomponentmeta.cpp
+++ b/rkward/plugin/rkcomponentmeta.cpp
@@ -9,7 +9,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../misc/xmlhelper.h"
#include "../misc/rkmessagecatalog.h"
-#include "../misc/rkcompatibility.h"
#include "../rbackend/rksessionvars.h"
#include <KLocalizedString>
@@ -93,8 +92,8 @@ QString RKComponentAboutData::toHtml () const {
}
if (!translator_names.isNull ()) {
- QStringList tns = translator_names.split (QLatin1Char(','), RKCompatibility::KeepEmptyParts());
- QStringList tes = translator_emails.split (QLatin1Char(','), RKCompatibility::KeepEmptyParts());
+ QStringList tns = translator_names.split (QLatin1Char(','), Qt::KeepEmptyParts);
+ QStringList tes = translator_emails.split (QLatin1Char(','), Qt::KeepEmptyParts);
ret.append ("\n<p><b>" + i18n ("Translators:") + "</b></p>\n<p><ul>");
for (int i = 0; i < tns.size (); ++i) {
QString tn = tns.value (i);
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index cda17b800..046b0fb31 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -84,7 +84,6 @@ the specialized properties (e.g. RKComponentPropertyInt::intValue () always retu
#include "rkcomponentproperties.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include <KLocalizedString>
@@ -1011,13 +1010,13 @@ bool RKComponentPropertyRObjects::setValueList (const QStringList& values) {
bool RKComponentPropertyRObjects::setValue (const QString &value) {
RK_TRACE (PLUGIN);
- return setValueList (value.split (sep, RKCompatibility::SkipEmptyParts()));
+ return setValueList (value.split (sep, Qt::SkipEmptyParts));
}
bool RKComponentPropertyRObjects::isStringValid (const QString &value) {
RK_TRACE (PLUGIN);
- QStringList slist = value.split (sep, RKCompatibility::SkipEmptyParts());
+ QStringList slist = value.split (sep, Qt::SkipEmptyParts);
for (QStringList::const_iterator it = slist.cbegin (); it != slist.cend (); ++it) {
RObject *obj = RObjectList::getObjectList ()->findObject (*it);
diff --git a/rkward/plugin/rkformula.cpp b/rkward/plugin/rkformula.cpp
index a090d7ec4..7890d6330 100644
--- a/rkward/plugin/rkformula.cpp
+++ b/rkward/plugin/rkformula.cpp
@@ -22,7 +22,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../core/rcontainerobject.h"
#include "../misc/xmlhelper.h"
#include "../misc/rkstandardicons.h"
-#include "../misc/rkcompatibility.h"
#include "../debug.h"
@@ -66,7 +65,7 @@ RKFormula::RKFormula (const QDomElement &element, RKComponent *parent_component,
type_selector->addButton (button, (int) MainEffects);
vbox->addWidget (button = new QRadioButton (i18n ("Custom Model:"), this));
type_selector->addButton (button, (int) Custom);
- connect (type_selector, RKCompatibility::groupButtonClicked(), this, &RKFormula::typeChange);
+ connect (type_selector, &QButtonGroup::idClicked, this, &RKFormula::typeChange);
custom_model_widget = new QWidget (this);
QHBoxLayout *model_hbox = new QHBoxLayout (custom_model_widget);
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index 279dcccd8..bf0de4b67 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -17,7 +17,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../misc/rktableview.h"
#include "../dataeditor/rktextmatrix.h"
#include "../misc/xmlhelper.h"
-#include "../misc/rkcompatibility.h"
#include "../debug.h"
@@ -185,7 +184,7 @@ void RKMatrixInput::setColumnValue (int column, const QString& value) {
RK_TRACE (PLUGIN);
if (!expandStorageForColumn (column)) return;
- columns[column].storage = value.split ('\t', RKCompatibility::KeepEmptyParts());
+ columns[column].storage = value.split ('\t', Qt::KeepEmptyParts);
updateColumn (column);
Q_EMIT model->dataChanged (model->index(0, column), model->index(row_count->intValue() + trailing_rows, column));
}
@@ -334,7 +333,7 @@ void RKMatrixInput::tsvPropertyChanged () {
RK_TRACE (PLUGIN);
columns.clear ();
- QStringList coldata = fetchStringValue (tsv_data).split ('\n', RKCompatibility::KeepEmptyParts());
+ QStringList coldata = fetchStringValue (tsv_data).split ('\n', Qt::KeepEmptyParts);
for (int i = 0; i < coldata.size (); ++i) {
setColumnValue (i, coldata[i]);
}
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index 13f3b603f..c3cb8b1cd 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -18,7 +18,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "rkstandardcomponent.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkaccordiontable.h"
#include "../misc/rkstandardicons.h"
#include "../misc/xmlhelper.h"
@@ -191,7 +190,7 @@ QString serializeList (const QStringList &list) {
}
QStringList unserializeList (const QString &serial) {
- QStringList ret = serial.split ('\t', RKCompatibility::KeepEmptyParts());
+ QStringList ret = serial.split ('\t', Qt::KeepEmptyParts);
for (int i = 0; i < ret.size (); ++i) {
ret[i] = RKCommonFunctions::unescape (ret[i]);
}
@@ -211,7 +210,7 @@ QString serializeMap (const RKComponent::PropertyValueMap &map) {
RKComponent::PropertyValueMap unserializeMap (const QString &serial) {
RKComponent::PropertyValueMap ret;
- QStringList l = serial.split ('\t', RKCompatibility::KeepEmptyParts());
+ QStringList l = serial.split ('\t', Qt::KeepEmptyParts);
for (int i = 0; i < l.size (); ++i) {
QString &line = l[i];
int sep = line.indexOf ('=');
diff --git a/rkward/plugin/rkradio.cpp b/rkward/plugin/rkradio.cpp
index 492c24ff0..a49783283 100644
--- a/rkward/plugin/rkradio.cpp
+++ b/rkward/plugin/rkradio.cpp
@@ -17,7 +17,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include <KLocalizedString>
#include "../misc/xmlhelper.h"
-#include "../misc/rkcompatibility.h"
#include "../debug.h"
RKRadio::RKRadio (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKAbstractOptionSelector (parent_component, parent_widget) {
@@ -38,7 +37,7 @@ RKRadio::RKRadio (const QDomElement &element, RKComponent *parent_component, QWi
addOptionsAndInit (element);
vbox->addWidget (group_box);
- connect (group, RKCompatibility::groupButtonClicked(), this, &RKRadio::itemSelected);
+ connect (group, &QButtonGroup::idClicked, this, &RKRadio::itemSelected);
}
RKRadio::~RKRadio(){
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 2b0e458ad..7b491a65c 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -10,9 +10,10 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include <KLocalizedString>
#include <kactioncollection.h>
-#include <qtimer.h>
-#include <qpushbutton.h>
-#include <qlabel.h>
+#include <QApplication>
+#include <QTimer>
+#include <QPushButton>
+#include <QLabel>
#include <QCloseEvent>
#include <QCheckBox>
#include <QSplitter>
@@ -23,7 +24,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "rkcomponentmap.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkstandardicons.h"
#include "../misc/rkxmlguipreviewarea.h"
#include "../misc/rkstyle.h"
@@ -76,7 +76,7 @@ public:
setSizes (sizes);
if (QSplitter::window ()->isVisible ()) {
- QRect boundary = RKCompatibility::availableGeometry(this);
+ QRect boundary = screen() ? screen()->availableGeometry() : QApplication::primaryScreen()->availableGeometry();
int new_width = window->width ();
int new_height = window->height ();
int new_x = window->x ();
diff --git a/rkward/plugin/rkvarslot.cpp b/rkward/plugin/rkvarslot.cpp
index cd6d64605..d1e01632a 100644
--- a/rkward/plugin/rkvarslot.cpp
+++ b/rkward/plugin/rkvarslot.cpp
@@ -24,7 +24,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../debug.h"
#include "../misc/xmlhelper.h"
#include "../misc/rkstandardicons.h"
-#include "../misc/rkcompatibility.h"
RKVarSlot::RKVarSlot (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
RK_TRACE (PLUGIN);
@@ -98,8 +97,8 @@ RKVarSlot::RKVarSlot (const QDomElement &element, RKComponent *parent_component,
if (mode == Varslot) {
// initialize filters
- static_cast<RKComponentPropertyRObjects*> (available)->setClassFilter (xml->getStringAttribute (element, "classes", QString (), DL_INFO).split (' ', RKCompatibility::SkipEmptyParts()));
- static_cast<RKComponentPropertyRObjects*> (available)->setTypeFilter (xml->getStringAttribute (element, "types", QString (), DL_INFO).split (' ', RKCompatibility::SkipEmptyParts()));
+ static_cast<RKComponentPropertyRObjects*> (available)->setClassFilter (xml->getStringAttribute (element, "classes", QString (), DL_INFO).split (' ', Qt::SkipEmptyParts));
+ static_cast<RKComponentPropertyRObjects*> (available)->setTypeFilter (xml->getStringAttribute (element, "types", QString (), DL_INFO).split (' ', Qt::SkipEmptyParts));
static_cast<RKComponentPropertyRObjects*> (available)->setDimensionFilter (xml->getIntAttribute (element, "num_dimensions", 0, DL_INFO), xml->getIntAttribute (element, "min_length", 0, DL_INFO), xml->getIntAttribute (element, "max_length", INT_MAX, DL_INFO));
static_cast<RKComponentPropertyRObjects*> (available)->setObjectProblemsAreErrors (false);
}
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 5dfa2a5c7..8aa8309d1 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -155,13 +155,9 @@ void RKFrontendTransmitter::run () {
#endif
RK_DEBUG(RBACKEND, DL_DEBUG, "Starting backend. Timestamp %d", QDateTime::currentMSecsSinceEpoch(), token.length());
if (quirkmode) {
-#if QT_VERSION >= QT_VERSION_CHECK(5,10,0)
backend->setProgram(RKSessionVars::RBinary());
backend->setArguments(args);
backend->startDetached();
-#else
- QProcess::startDetached(RKSessionVars::RBinary(), args);
-#endif
} else {
backend->start(RKSessionVars::RBinary(), args, QIODevice::ReadOnly);
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index 520400d1e..dc9e19177 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -796,22 +796,18 @@ void RBusy (int busy) {
SEXP doUpdateLocale ();
// NOTE: stdout_stderr_mutex is recursive to support fork()s, better
-#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
-# define DUMMY_MUTEX_FLAGS
-#else
-# define DUMMY_MUTEX_FLAGS QMutex::Recursive
-#endif
+#define DUMMY_MUTEX_FLAGS
RKRBackend::RKRBackend() : stdout_stderr_mutex(DUMMY_MUTEX_FLAGS) {
RK_TRACE (RBACKEND);
- RK_ASSERT (this_pointer == 0);
+ RK_ASSERT (this_pointer == nullptr);
this_pointer = this;
doUpdateLocale ();
r_running = false;
- current_command = 0;
- pending_priority_command = 0;
+ current_command = nullptr;
+ pending_priority_command = nullptr;
stdout_stderr_fd = -1;
}
diff --git a/rkward/rbackend/rkrbackend.h b/rkward/rbackend/rkrbackend.h
index e96858b7b..80fc284c4 100644
--- a/rkward/rbackend/rkrbackend.h
+++ b/rkward/rbackend/rkrbackend.h
@@ -186,11 +186,7 @@ handleHistoricalSubstackRequest(). Exactly which requests get handled by which f
* @returns: true, if output was actually fetched (or no output was available), false, if the function gave up on a locked mutex. */
bool fetchStdoutStderr (bool forcibly);
/** public for technical reasons */
-#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
QRecursiveMutex stdout_stderr_mutex;
-#else
- QMutex stdout_stderr_mutex;
-#endif
void setPriorityCommand (RCommandProxy *command);
RCommandProxy *pending_priority_command;
diff --git a/rkward/rbackend/rkrbackendprotocol_frontend.cpp b/rkward/rbackend/rkrbackendprotocol_frontend.cpp
index 7181f1b50..f9630f0f0 100644
--- a/rkward/rbackend/rkrbackendprotocol_frontend.cpp
+++ b/rkward/rbackend/rkrbackendprotocol_frontend.cpp
@@ -31,11 +31,7 @@ RKRBackendProtocolFrontend::~RKRBackendProtocolFrontend () {
RK_ASSERT(_instance == this);
terminateBackend ();
RKFrontendTransmitter::instance ()->wait(1000); // Wait for thread to catch the backend's exit request, and exit()
-#if QT_VERSION > QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(RKFrontendTransmitter::instance(), &RKFrontendTransmitter::quit, Qt::QueuedConnection); // tell it to quit, otherwise
-#else
- QMetaObject::invokeMethod(RKFrontendTransmitter::instance(), "quit", Qt::QueuedConnection);
-#endif
RKFrontendTransmitter::instance ()->wait(3000); // Wait for thread to quit and clean up.
qApp->processEvents(QEventLoop::AllEvents, 500); // Not strictly needed, but avoids some mem leaks on exit by handling all posted BackendExit events
delete RKFrontendTransmitter::instance ();
diff --git a/rkward/rbackend/rksessionvars.cpp b/rkward/rbackend/rksessionvars.cpp
index 540f6b006..10638b3ce 100644
--- a/rkward/rbackend/rksessionvars.cpp
+++ b/rkward/rbackend/rksessionvars.cpp
@@ -13,9 +13,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../version.h"
#include <kcoreaddons_version.h>
-#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5,20,0)
-#include <kcoreaddons.h>
-#endif
+#include <KCoreAddons>
#include <QTemporaryFile>
#include <QStandardPaths>
@@ -23,7 +21,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../debug.h"
-RKSessionVars* RKSessionVars::_instance = 0;
+RKSessionVars* RKSessionVars::_instance = nullptr;
RKParsedVersion RKSessionVars::rkward_version(RKWARD_VERSION);
RKParsedVersion RKSessionVars::r_version;
QString RKSessionVars::r_version_string;
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 1ef5eed2d..ce104fc54 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -47,7 +47,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "settings/rksettingsmoduleconsole.h"
#include "settings/rkrecenturls.h"
#include "misc/rkcommonfunctions.h"
-#include "misc/rkcompatibility.h"
#include "misc/rkstandardicons.h"
#include "misc/rkstandardactions.h"
#include "core/robjectlist.h"
@@ -721,7 +720,7 @@ void RKConsole::userLoadHistory (const QUrl &_url) {
QFile file (filename);
if (!file.open (QIODevice::Text | QIODevice::ReadOnly)) return;
- setCommandHistory (QString (file.readAll ()).split ('\n', RKCompatibility::SkipEmptyParts()), false);
+ setCommandHistory (QString (file.readAll ()).split ('\n', Qt::SkipEmptyParts), false);
file.close ();
delete (tmpfile);
@@ -909,7 +908,7 @@ void RKConsole::pipeCommandThroughConsoleLocal (const QString &command_string) {
}
}
if (RKSettingsModuleConsole::addPipedCommandsToHistory() != RKSettingsModuleConsole::DontAdd) {
- QStringList lines = command_string.split ('\n', RKCompatibility::SkipEmptyParts());
+ QStringList lines = command_string.split ('\n', Qt::SkipEmptyParts);
if ((RKSettingsModuleConsole::addPipedCommandsToHistory() == RKSettingsModuleConsole::AlwaysAdd) || (lines.count () == 1)) {
for (int i = 0; i < lines.count (); ++i) {
commands_history.append (lines[i]);
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 88e39d1f3..5d874d4c8 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -54,7 +54,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "core/renvironmentobject.h"
#include "misc/rkstandardicons.h"
#include "misc/rkcommonfunctions.h"
-#include "misc/rkcompatibility.h"
#include "misc/rkxmlguisyncer.h"
#include "misc/rkdbusapi.h"
#include "misc/rkdialogbuttonbox.h"
@@ -607,15 +606,9 @@ void RKWardMainWindow::initActions() {
save_any_action = new KActionMenu (QIcon::fromTheme("document-save"), i18n ("Save..."), this);
actionCollection ()->addAction ("save_any", save_any_action);
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
open_any_action->setPopupMode(QToolButton::InstantPopup);
new_any_action->setPopupMode(QToolButton::InstantPopup);
save_any_action->setPopupMode(QToolButton::InstantPopup);
-#else
- open_any_action->setDelayed(false);
- new_any_action->setDelayed(false);
- save_any_action->setDelayed(false);
-#endif
save_any_action->addAction (fileSaveWorkspace);
save_any_action->addAction (fileSaveWorkspaceAs);
@@ -832,7 +825,7 @@ void RKWardMainWindow::readOptions () {
KConfigGroup cg = config->group ("General Options");
QSize size = cg.readEntry ("Geometry", QSize ());
if (size.isEmpty ()) {
- size = RKCompatibility::availableGeometry(this).size();
+ size = screen() ? screen()->availableGeometry().size() : QApplication::primaryScreen()->availableGeometry().size();
}
resize (size);
diff --git a/rkward/settings/rkrecenturls.cpp b/rkward/settings/rkrecenturls.cpp
index b282e0f8a..133e601b7 100644
--- a/rkward/settings/rkrecenturls.cpp
+++ b/rkward/settings/rkrecenturls.cpp
@@ -46,23 +46,7 @@ QUrl RKRecentUrls::mostRecentUrl(const QString& id) {
}
QList<QUrl> RKRecentUrls::allRecentUrls(const QString& id) {
-#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 93, 0)
- // KRecentFilesAction::urls() returns random order... Let's make an effort for a reasonable sorting.
- auto unsorted = action(id)->urls();
- auto list = action(id)->actions();
- QList<QUrl> ret;
- for (int i = list.size()-1; i >= 0; --i) {
- for (int j = 0; j < unsorted.size(); ++j) {
- if (list[i]->text().contains(unsorted[j].fileName())) {
- ret.append(unsorted.takeAt(j));
- break;
- }
- }
- }
- return ret + unsorted;
-#else
return action(id)->urls();
-#endif
}
RKRecentUrls* RKRecentUrls::notifier() {
diff --git a/rkward/settings/rksettingsmoduledebug.cpp b/rkward/settings/rksettingsmoduledebug.cpp
index 6553a17c3..0bf7a5eef 100644
--- a/rkward/settings/rksettingsmoduledebug.cpp
+++ b/rkward/settings/rksettingsmoduledebug.cpp
@@ -20,7 +20,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../misc/rkspinbox.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkstyle.h"
#include "../debug.h"
@@ -66,7 +65,7 @@ RKSettingsModuleDebug::RKSettingsModuleDebug (RKSettings *gui, QWidget *parent)
box_layout->addWidget (*it);
(*it)->setChecked (RK_Debug::RK_Debug_Flags & debug_flags_group->id (*it));
}
- connect (debug_flags_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleDebug::settingChanged);
+ connect (debug_flags_group, &QButtonGroup::idClicked, this, &RKSettingsModuleDebug::settingChanged);
main_vbox->addWidget (group);
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index 7630b5ba7..ccea0e091 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -22,7 +22,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../misc/getfilenamewidget.h"
#include "../misc/rkspinbox.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkstandardicons.h"
#include "../misc/rkstyle.h"
@@ -110,7 +109,7 @@ RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *pare
group_layout->addWidget (button);
workplace_save_chooser->addButton (button, DontSaveWorkplace);
if ((button = workplace_save_chooser->button (workplace_save_mode))) button->setChecked (true);
- connect (workplace_save_chooser, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGeneral::change);
+ connect (workplace_save_chooser, &QButtonGroup::idClicked, this, &RKSettingsModuleGeneral::change);
main_vbox->addWidget (group_box);
main_vbox->addSpacing (2*RKStyle::spacingHint ());
diff --git a/rkward/settings/rksettingsmodulegraphics.cpp b/rkward/settings/rksettingsmodulegraphics.cpp
index d979c129c..ca596eef2 100644
--- a/rkward/settings/rksettingsmodulegraphics.cpp
+++ b/rkward/settings/rksettingsmodulegraphics.cpp
@@ -24,7 +24,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../rbackend/rkrinterface.h"
#include "../misc/rkspinbox.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkstandardicons.h"
#include "../core/robject.h"
#include "../debug.h"
@@ -69,7 +68,7 @@ RKSettingsModuleGraphics::RKSettingsModuleGraphics (RKSettings *gui, QWidget *pa
"<p>The RKWard native device is the recommended choice for most users. This corresponds to the R command <i>RK()</i>.</p>"
"<p>The 'Platform default device' corresponds to one of <i>X11()</i>, <i>windows()</i>, or <i>quartz()</i>, depending on the platform.</p>"
"<p>You can also specify the name of a function such as <i>cairoDevice</i>.</p>"), group);
- connect (default_device_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGraphics::boxChanged);
+ connect (default_device_group, &QButtonGroup::idClicked, this, &RKSettingsModuleGraphics::boxChanged);
connect (default_device_other_edit, &QLineEdit::textChanged, this, &RKSettingsModuleGraphics::boxChanged);
h_layout1->addWidget (group);
@@ -99,7 +98,7 @@ RKSettingsModuleGraphics::RKSettingsModuleGraphics (RKSettings *gui, QWidget *pa
"<li>The original platform specific devices can be used unchanged, without the addition of RKWard specific features.</li></ul>"
"<p>Regardless of this setting, the original devices are always accessible as <i>grDevices::X11()</i>, etc.</p>"
"<p>Using a device on a platform where it is not defined (e.g. <i>Windows()</i> on Mac OS X) will always fall back to the <i>RK()</i> device.</p>"), group);
- connect (replace_standard_devices_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGraphics::boxChanged);
+ connect (replace_standard_devices_group, &QButtonGroup::idClicked, this, &RKSettingsModuleGraphics::boxChanged);
h_layout1->addWidget (group);
group = new QGroupBox(i18n("Default window size (for RK(), or embedded device windows)"));
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 126f05943..d747d57cc 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -26,7 +26,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../misc/rkstyle.h"
#include "../misc/multistringselector.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkspinbox.h"
#include "../misc/xmlhelper.h"
#include "../plugin/rkcomponentmap.h"
@@ -68,7 +67,7 @@ RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *pare
button_group->addButton (button, PreferWizard);
if ((button = button_group->button (interface_pref))) button->setChecked (true);
- connect (button_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModulePlugins::settingChanged);
+ connect (button_group, &QButtonGroup::idClicked, this, &RKSettingsModulePlugins::settingChanged);
main_vbox->addWidget (button_box);
main_vbox->addSpacing (2*RKStyle::spacingHint ());
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 6a7ee455a..2737ada8a 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -82,17 +82,9 @@ RKCommandEditorWindowPart::~RKCommandEditorWindowPart () {
QMap<QString, KTextEditor::Document*> RKCommandEditorWindow::unnamed_documents;
KTextEditor::Document* createDocument(bool with_signals) {
- if (with_signals) {
-#if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
- Q_EMIT KTextEditor::Editor::instance()->application()->aboutToCreateDocuments();
-#endif
- }
KTextEditor::Document* ret = KTextEditor::Editor::instance()->createDocument (RKWardMainWindow::getMain ());
if (with_signals) {
Q_EMIT KTextEditor::Editor::instance()->application()->documentCreated(ret);
-#if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
- Q_EMIT KTextEditor::Editor::instance()->application()->documentsCreated(QList<KTextEditor::Document*>() << ret);
-#endif
}
return ret;
}
@@ -307,16 +299,10 @@ RKCommandEditorWindow::~RKCommandEditorWindow () {
RK_ASSERT(views.at(0) == m_view);
if (visible_to_kateplugins) {
Q_EMIT KTextEditor::Editor::instance()->application()->documentWillBeDeleted(m_doc);
-#if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
- Q_EMIT KTextEditor::Editor::instance()->application()->aboutToDeleteDocuments(QList<KTextEditor::Document*>() << m_doc);
-#endif
}
m_doc->deleteLater();
if (visible_to_kateplugins) {
Q_EMIT KTextEditor::Editor::instance()->application()->documentDeleted(m_doc);
-#if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
- Q_EMIT KTextEditor::Editor::instance()->application()->documentsDeleted(QList<KTextEditor::Document*>() << m_doc);
-#endif
}
if (!delete_on_close.isEmpty ()) KIO::del (delete_on_close)->start ();
unnamed_documents.remove (_id);
@@ -369,11 +355,7 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
RKStandardActions::onlineHelp (this, this);
actionmenu_run_block = new KActionMenu (i18n ("Run block"), this);
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
actionmenu_run_block->setPopupMode(QToolButton::InstantPopup);
-#else
- actionmenu_run_block->setDelayed(false);
-#endif
ac->addAction ("run_block", actionmenu_run_block);
connect (actionmenu_run_block->menu(), &QMenu::aboutToShow, this, &RKCommandEditorWindow::clearUnusedBlocks);
actionmenu_mark_block = new KActionMenu (i18n ("Mark selection as block"), this);
@@ -390,11 +372,7 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
action_setwd_to_script->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionCDToScript));
KActionMenu* actionmenu_preview = new KActionMenu (QIcon::fromTheme ("view-preview"), i18n ("Preview"), this);
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
actionmenu_preview->setPopupMode(QToolButton::InstantPopup);
-#else
- actionmenu_preview->setDelayed (false);
-#endif
preview_modes = new QActionGroup (this);
actionmenu_preview->addAction (action_no_preview = new QAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete), i18n ("No preview"), preview_modes));
actionmenu_preview->addAction (new QAction (QIcon::fromTheme ("preview_math"), i18n ("R Markdown"), preview_modes));
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index f8d4a15d3..20db6c05e 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -107,34 +107,20 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : QWidget (parent) {
connect (RKWardMainWindow::getMain (), &RKWardMainWindow::aboutToQuitRKWard, this, &RKFileBrowserWidget::saveConfig);
layout->addWidget (dir);
-#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
- toolbar->addAction (dir->actionCollection ()->action ("up"));
- toolbar->addAction (dir->actionCollection ()->action ("back"));
- toolbar->addAction (dir->actionCollection ()->action ("forward"));
- toolbar->addAction (dir->actionCollection ()->action ("home"));
-#else
toolbar->addAction (dir->action (KDirOperator::Up));
toolbar->addAction (dir->action (KDirOperator::Back));
toolbar->addAction (dir->action (KDirOperator::Forward));
toolbar->addAction (dir->action (KDirOperator::Home));
-#endif
QAction* action = new QAction (QIcon::fromTheme ("folder-sync"), i18n ("Working directory"), this);
action->setToolTip (action->text ());
connect(action, &QAction::triggered, this, [=] () { follow_working_directory = true; syncToWD(); });
toolbar->addAction (action);
toolbar->addSeparator ();
-#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
- toolbar->addAction (dir->actionCollection ()->action ("short view"));
- toolbar->addAction (dir->actionCollection ()->action ("tree view"));
- toolbar->addAction (dir->actionCollection ()->action ("detailed view"));
-// toolbar->addAction (dir->actionCollection ()->action ("detailed tree view")); // should we have this as well? Trying to avoid crowding in the toolbar
-#else
toolbar->addAction (dir->action (KDirOperator::ShortView));
toolbar->addAction (dir->action (KDirOperator::TreeView));
toolbar->addAction (dir->action (KDirOperator::DetailedView));
// toolbar->addAction (dir->action (KDirOperator::DetailedTreeView)); // should we have this as well? Trying to avoid crowding in the toolbar
-#endif
fi_actions = new KFileItemActions (this);
rename_action = new QAction (i18n ("Rename"), this); // Oh my, why isn't there a standard action for this?
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 4124c509c..cf4e8b892 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -58,7 +58,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../settings/rksettings.h"
#include "../settings/rksettingsmoduleoutput.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkstandardactions.h"
#include "../misc/rkstandardicons.h"
#include "../misc/xmlhelper.h"
@@ -504,7 +503,7 @@ bool RKHTMLWindow::handleRKWardURL (const QUrl &url, RKHTMLWindow *window) {
if (path.startsWith ('/')) path = path.mid (1);
int sep = path.indexOf ('/');
// NOTE: These links may originate externally, even from untrusted sources. The submit mode *must* remain "ManualSubmit" for this reason!
- RKComponentMap::invokeComponent (path.left (sep), path.mid (sep+1).split ('\n', RKCompatibility::SkipEmptyParts()), RKComponentMap::ManualSubmit);
+ RKComponentMap::invokeComponent (path.left (sep), path.mid (sep+1).split ('\n', Qt::SkipEmptyParts), RKComponentMap::ManualSubmit);
} else if (url.host () == "rhelp") {
// TODO: find a nice solution to render this in the current window
QStringList spec = url.path ().mid (1).split ('/');
@@ -638,11 +637,7 @@ void RKHTMLWindow::mimeTypeJobFail (KJob* job) {
QUrl url = tj->url ();
if (!tj->redirectUrl ().isEmpty ()) url = tj->redirectUrl ();
KIO::TransferJob *secondchance = KIO::get (url, KIO::Reload);
-#if KIO_VERSION < QT_VERSION_CHECK(5,78,0)
- connect (secondchance, static_cast<void (KIO::TransferJob::*)(KIO::Job*, const QString&)>(&KIO::TransferJob::mimetype), this, &RKHTMLWindow::mimeTypeDetermined);
-#else
connect (secondchance, &KIO::TransferJob::mimeTypeFound, this, &RKHTMLWindow::mimeTypeDetermined);
-#endif
connect (secondchance, &KIO::TransferJob::result, this, &RKHTMLWindow::mimeTypeJobFail2);
}
}
@@ -1288,7 +1283,7 @@ QString RKHelpRenderer::prepareHelpLink (const QString &href, const QString &tex
QString RKHelpRenderer::componentPathToId (const QString &path) {
RK_TRACE (APP);
- QStringList path_segments = path.split ('/', RKCompatibility::SkipEmptyParts());
+ QStringList path_segments = path.split ('/', Qt::SkipEmptyParts);
if (path_segments.count () > 2) return 0;
if (path_segments.count () < 1) return 0;
if (path_segments.count () == 1) path_segments.push_front ("rkward");
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index 1518b8399..6c3e782b5 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -340,10 +340,6 @@ void RKMDIWindow::showStatusMessageNow() {
layout->setContentsMargins (10, 10, 10, 10);
status_popup = new KMessageWidget (status_popup_container);
status_popup->setCloseButtonVisible (true);
-#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(6,0,0)
- // see below
- status_popup->setWordWrap(true);
-#endif
status_popup->setMessageType (KMessageWidget::Warning);
layout->addWidget (status_popup);
layout->addStretch ();
@@ -363,15 +359,7 @@ void RKMDIWindow::showStatusMessageNow() {
}
if (status_popup->text () != status_message) {
if (status_popup->isVisible ()) status_popup->hide (); // otherwise, the KMessageWidget does not update geometry (KF5, 5.15.0)
-#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(6,0,0)
- // silly workaround: KMessageWidget does not specify top-alignment for its buttons unless in wordwrap mode.
- // we don't want actual word wrap, but we do want top alignment
- QString dummy = status_message;
- if (!dummy.startsWith("<")) dummy = "<p>" + dummy + "</p>";
- status_popup->setText (dummy.replace(" ", " "));
-#else
status_popup->setText (status_message);
-#endif
status_popup->animatedShow ();
}
} else {
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index beda6b991..62bcc493a 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -134,11 +134,7 @@ void RKToolWindowBar::addWidget (RKMDIWindow *window) {
window->tool_window_bar->removeWidget (window);
}
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5,13,0)
appendTab (window->windowIcon (), id, window->shortCaption ());
-#else
- appendTab (window->windowIcon ().pixmap (QSize (16, 16)), id, window->shortCaption ());
-#endif
window->tool_window_bar = this;
widget_to_id.insert (window, id);
@@ -304,11 +300,7 @@ bool RKToolWindowBar::eventFilter (QObject *obj, QEvent *ev) {
sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveUp), i18n ("Top Sidebar"));
sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveDown), i18n ("Bottom Sidebar"));
sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete), i18n ("Not shown in sidebar"));
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5,78,0)
connect(sel, &KSelectAction::indexTriggered, this, &RKToolWindowBar::moveToolWindow);
-#else
- connect (sel, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &RKToolWindowBar::moveToolWindow);
-#endif
menu.addAction (sel);
menu.exec (e->globalPos());
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 1f3916019..86075e6e5 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -27,7 +27,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "rkworkplace.h"
#include "../misc/rkstandardicons.h"
#include "../misc/rkcommonfunctions.h"
-#include "../misc/rkcompatibility.h"
#include "../debug.h"
RKWindowCatcher *RKWindowCatcher::_instance = 0;
@@ -346,8 +345,8 @@ void RKCaughtX11Window::doEmbed () {
}
// try to be helpful when the window is too large to fit on screen
- QRect dims = window ()->frameGeometry ();
- QRect avail = RKCompatibility::availableGeometry(window());
+ const QRect dims = window ()->frameGeometry ();
+ const QRect avail = window()->screen() ? window()->screen()->availableGeometry() : QApplication::primaryScreen()->availableGeometry();
if ((dims.width () > avail.width ()) || (dims.height () > avail.height ())) {
KMessageBox::information (this, i18n ("The current window appears too large to fit on the screen. If this happens regularly, you may want to adjust the default graphics window size in Settings->Configure RKWard->Onscreen Graphics."), i18n ("Large window"), "dont_ask_again_large_x11_window");
}
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 49bda5f62..fbce4f0cf 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -44,7 +44,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../rbackend/rkrinterface.h"
#include "../windows/rkwindowcatcher.h"
#include "../rbackend/rcommand.h"
-#include "../misc/rkcompatibility.h"
#include "../misc/rkoutputdirectory.h"
#include "../misc/rkxmlguipreviewarea.h"
#include "../rkward.h"
@@ -903,7 +902,7 @@ ItemSpecification parseItemDescription (const QString &description) {
RK_ASSERT (false);
return ret;
}
- ret.params = description.mid (typeend + 2, specstart - typeend - 2).split (':', RKCompatibility::SkipEmptyParts());
+ ret.params = description.mid (typeend + 2, specstart - typeend - 2).split (':', Qt::SkipEmptyParts);
ret.specification = description.mid (specstart + 2);
} else {
ret.specification = description.mid (typeend + 1);
More information about the rkward-tracker
mailing list