[rkward/frameworks] /: Assorted KF5 porting
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Nov 13 13:20:53 UTC 2015
Git commit 7f250f0f630ead4ceda19af32ede7e5993dad6ba by Thomas Friedrichsmeier.
Committed on 13/11/2015 at 13:20.
Pushed by tfry into branch 'frameworks'.
Assorted KF5 porting
M +1 -1 CMakeLists.txt
M +1 -0 rkward/agents/CMakeLists.txt
M +0 -1 rkward/misc/rkxmlguisyncer.cpp
M +1 -1 rkward/plugin/CMakeLists.txt
M +1 -1 rkward/rbackend/CMakeLists.txt
M +3 -2 rkward/rbackend/rinterface.cpp
M +3 -2 rkward/rbackend/rkfrontendtransmitter.cpp
M +1 -2 rkward/rbackend/rksessionvars.cpp
M +5 -5 rkward/settings/rksettings.cpp
M +1 -1 rkward/settings/rksettingsmodulegeneral.cpp
M +3 -3 rkward/settings/rksettingsmoduleplugins.cpp
M +10 -35 rkward/windows/rkcommandeditorwindow.h
http://commits.kde.org/rkward/7f250f0f630ead4ceda19af32ede7e5993dad6ba
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10c2089..305ca7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ INCLUDE(ECMInstallIcons)
INCLUDE(FeatureSummary)
FIND_PACKAGE(Qt5 5.2 CONFIG REQUIRED COMPONENTS Widgets Core Xml Network WebKit Script)
-FIND_PACKAGE(KF5 5.0 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons KDELibs4Support)
+FIND_PACKAGE(KF5 5.0 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons KDELibs4Support WebKit)
IF(FORCE_PRETTY_MAKEFILE)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
diff --git a/rkward/agents/CMakeLists.txt b/rkward/agents/CMakeLists.txt
index 520355f..2630a45 100644
--- a/rkward/agents/CMakeLists.txt
+++ b/rkward/agents/CMakeLists.txt
@@ -14,3 +14,4 @@ SET(agents_STAT_SRCS
)
ADD_LIBRARY(agents STATIC ${agents_STAT_SRCS})
+TARGET_LINK_LIBRARIES(agents Qt5::Widgets KF5::KDELibs4Support)
\ No newline at end of file
diff --git a/rkward/misc/rkxmlguisyncer.cpp b/rkward/misc/rkxmlguisyncer.cpp
index 86370a2..ea1bf75 100644
--- a/rkward/misc/rkxmlguisyncer.cpp
+++ b/rkward/misc/rkxmlguisyncer.cpp
@@ -166,4 +166,3 @@ void RKXMLGUISyncerPrivate::guiFactoryDestroyed (QObject *object) {
affected_factories.remove (static_cast<KXMLGUIFactory*>(object));
}
-#include "rkxmlguisyncer_p.moc"
diff --git a/rkward/plugin/CMakeLists.txt b/rkward/plugin/CMakeLists.txt
index bf08e70..46edaf4 100644
--- a/rkward/plugin/CMakeLists.txt
+++ b/rkward/plugin/CMakeLists.txt
@@ -32,7 +32,7 @@ SET(plugin_STAT_SRCS
)
ADD_LIBRARY(plugin STATIC ${plugin_STAT_SRCS})
-
+TARGET_LINK_LIBRARIES(plugin Qt5::Widgets KF5::KDELibs4Support)
########### install files ###############
diff --git a/rkward/rbackend/CMakeLists.txt b/rkward/rbackend/CMakeLists.txt
index 58ea7c7..cc59049 100644
--- a/rkward/rbackend/CMakeLists.txt
+++ b/rkward/rbackend/CMakeLists.txt
@@ -44,7 +44,7 @@ SET (
rktransmitter.cpp
)
ADD_LIBRARY(rbackend STATIC ${rbackend_FRONTEND_SRCS})
-TARGET_LINK_LIBRARIES(rbackend rkgraphicsdevice.frontend Qt5::Widgets)
+TARGET_LINK_LIBRARIES(rbackend rkgraphicsdevice.frontend Qt5::Widgets KF5::TextEditor KF5::WebKit KF5::KDELibs4Support)
SET (
rbackend_BACKEND_SRCS
diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp
index e034b17..06b7d7c 100644
--- a/rkward/rbackend/rinterface.cpp
+++ b/rkward/rbackend/rinterface.cpp
@@ -810,10 +810,11 @@ void RInterface::processRBackendRequest (RBackendRequest *request) {
dialog_type = KMessageBox::Information;
if (!request->synchronous) { // non-modal dialogs are not supported out of the box by KMessageBox;
KDialog* dialog = new KDialog ();
- KMessageBox::createKMessageBox (dialog, QMessageBox::Information, message, QStringList (), QString (), 0, KMessageBox::Notify | KMessageBox::NoExec);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox (dialog);
+ buttonBox->setStandardButtons (QDialogButtonBox::Ok);
+ KMessageBox::createKMessageBox (dialog, buttonBox, QMessageBox::Information, message, QStringList (), QString (), 0, KMessageBox::Notify | KMessageBox::NoExec);
dialog->setWindowTitle (caption);
dialog->setAttribute (Qt::WA_DeleteOnClose);
- dialog->setButtons (KDialog::Ok);
dialog->show();
RKRBackendProtocolFrontend::setRequestCompleted (request);
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 9e6ff5a..b1abd09 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -24,6 +24,7 @@
#include "../rkglobals.h"
#include <klocale.h>
+#include <kglobal.h>
#include <krandom.h>
#include <kstandarddirs.h>
#include <QCoreApplication>
@@ -80,7 +81,7 @@ void RKFrontendTransmitter::run () {
QStringList env = QProcess::systemEnvironment ();
int index = env.indexOf (QRegExp("^LANGUAGE=.*", Qt::CaseInsensitive));
if (index >= 0) env.removeAt (index);
- env.append ("LANGUAGE=" + KGlobal::locale ()->language ());
+ env.append ("LANGUAGE=" + QLocale ().name ().section ('_', 0, 0));
backend->setEnvironment (env);
QStringList args;
@@ -88,7 +89,7 @@ void RKFrontendTransmitter::run () {
args.append ("--server-name=" + server->fullServerName ());
args.append ("--rkd-server-name=" + rkd_transmitter->serverName ());
args.append ("--data-dir=" + RKSettingsModuleGeneral::filesPath ());
- args.append ("--locale-dir=" + KGlobal::dirs()->findResourceDir ("locale", KGlobal::locale ()->language () + "/LC_MESSAGES/rkward.mo"));
+ args.append ("--locale-dir=" + KGlobal::dirs()->findResourceDir ("locale", QLocale ().name ().section ('_', 0, 0) + "/LC_MESSAGES/rkward.mo"));
connect (backend, SIGNAL (finished(int,QProcess::ExitStatus)), this, SLOT (backendExit(int)));
QString backend_executable = findBackendAtPath (QCoreApplication::applicationDirPath ());
if (backend_executable.isEmpty ()) backend_executable = findBackendAtPath (QCoreApplication::applicationDirPath () + "/rbackend"); // for running directly from the build-dir
diff --git a/rkward/rbackend/rksessionvars.cpp b/rkward/rbackend/rksessionvars.cpp
index c0d9e63..01f3b3f 100644
--- a/rkward/rbackend/rksessionvars.cpp
+++ b/rkward/rbackend/rksessionvars.cpp
@@ -26,7 +26,6 @@
#include <ktemporaryfile.h>
#include <kstandarddirs.h>
-#include <QLibraryInfo>
#include <QSysInfo>
#include "../debug.h"
@@ -124,7 +123,7 @@ QStringList RKSessionVars::frontendSessionInfo () {
lines.append ("RKWard version: " RKWARD_VERSION);
lines.append ("KDE version (runtime): " + QString (KDE::versionString ()));
lines.append ("KDE version (compile time): " KDE_VERSION_STRING);
- lines.append ("Qt build key: " + QLibraryInfo::buildKey ());
+ lines.append (QString ("Qt version (runtime): ") + qVersion ());
#if defined Q_WS_WIN
lines.append ("Windows runtime version (refer to QSysInfo documentation to translate code into human readable form): 0x" + QString::number (QSysInfo::windowsVersion (), 16));
#elif defined Q_WS_MAC
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index 7079282..84de73b 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -16,7 +16,7 @@
***************************************************************************/
#include "rksettings.h"
-#include <qlayout.h>
+#include <QPushButton>
#include <klocale.h>
#include <kapplication.h>
@@ -71,7 +71,7 @@ RKSettings::RKSettings (QWidget *parent) : KPageDialog (parent) {
setWindowTitle (i18n ("Settings"));
buttonBox ()->setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
// KF5 TODO: connect buttons
- enableButtonApply (false);
+ button (QDialogButtonBox::Apply)->setEnabled (false);
setAttribute (Qt::WA_DeleteOnClose, true);
@@ -133,7 +133,7 @@ void RKSettings::pageChange (KPageWidgetItem *current, KPageWidgetItem *) {
} else {
has_help = !(new_module->helpURL ().isEmpty ());
}
- enableButton (KDialog::Help, has_help);
+ button (QDialogButtonBox::Help)->setEnabled (has_help);
}
void RKSettings::slotButtonClicked (int button) {
@@ -172,12 +172,12 @@ void RKSettings::applyAll () {
tracker ()->signalSettingsChange (it.key ());
}
}
- enableButtonApply (false);
+ button (QDialogButtonBox::Apply)->setEnabled (false);
}
void RKSettings::enableApply () {
RK_TRACE (SETTINGS);
- enableButtonApply (true);
+ button (QDialogButtonBox::Apply)->setEnabled (true);
}
void RKSettings::loadSettings (KConfig *config) {
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index 3e424d6..c1c7488 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -254,7 +254,7 @@ void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
initial_dir_specification = checkAdjustLoadedPath (cg.readEntry ("initial dir spec", QString ()));
cg = config->group ("Logfiles");
- files_path = new_files_path = checkAdjustLoadedPath (cg.readEntry ("logfile dir", QDir ().homePath () + "/.rkward/"));
+ files_path = new_files_path = checkAdjustLoadedPath (cg.readEntry ("logfile dir", QString (QDir ().homePath () + "/.rkward/")));
cg = config->group ("Workplace");
workplace_save_mode = (WorkplaceSaveMode) cg.readEntry ("save mode", (int) SaveWorkplaceWithWorkspace);
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 533405e..8749515 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -440,11 +440,11 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role)
const RKSettingsModulePlugins::PluginMapStoredInfo &inf = plugin_maps[index.row ()];
if (role == Qt::BackgroundRole) {
- if (inf.broken_in_this_version) return Qt::red;
- if (inf.quirky_in_this_version) return Qt::yellow;
+ if (inf.broken_in_this_version) return QColor (Qt::red);
+ if (inf.quirky_in_this_version) return QColor (Qt::yellow);
return (QVariant ());
} else if (role == Qt::ForegroundRole) {
- if (inf.priority < RKSettingsModulePlugins::PriorityLow) return Qt::gray;
+ if (inf.priority < RKSettingsModulePlugins::PriorityLow) return QColor (Qt::gray);
} else if (role == Qt::ToolTipRole) {
const PluginMapMetaInfo &meta = const_cast<RKSettingsModulePluginsModel*> (this)->getPluginMapMetaInfo (inf.filename);
QString desc = meta.about->toHtml ();
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index 3cff07e..8666a7a 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -27,13 +27,10 @@
#include <ktexteditor/document.h>
#include <ktexteditor/codecompletionmodel.h>
#include <ktexteditor/codecompletioninterface.h>
-#if KDE_IS_VERSION(4,5,0)
-# include <ktexteditor/movingrange.h>
-# include <ktexteditor/movinginterface.h>
-#else
-# include <ktexteditor/smartrange.h>
-# include <ktexteditor/smartinterface.h>
-#endif
+#include <ktexteditor/codecompletionmodelcontrollerinterface.h>
+#include <ktexteditor/movingrange.h>
+#include <ktexteditor/movinginterface.h>
+
#include <kurl.h>
#include "../windows/rkmdiwindow.h"
@@ -102,38 +99,20 @@ private:
};
/** code completion model for RKCommandEditorWindow */
-#if KDE_VERSION_MAJOR != 4
-# error Adjust the versioning hack below!
-#endif
-// Unfortunately, MOC is not smart enough to understand the KDE_IS_VERSION macro
-#if KDE_VERSION_MINOR >= 2
-# include <ktexteditor/codecompletionmodelcontrollerinterface.h>
-# if KDE_VERSION_MINOR >= 5
-class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface3 {
- Q_OBJECT
- Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface3)
-public:
- KTextEditor::Range completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position);
- QString filterString (KTextEditor::View *, const KTextEditor::Range &, const KTextEditor::Cursor &) { return QString (); };
-# else
class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface {
Q_OBJECT
Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
public:
- KTextEditor::Range completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position);
- QString filterString (KTextEditor::View *, const KTextEditor::SmartRange &, const KTextEditor::Cursor &) { return QString (); };
-# endif
-#else
-class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel {
-#endif
-public:
explicit RKCodeCompletionModel (RKCommandEditorWindow* parent);
~RKCodeCompletionModel ();
+ KTextEditor::Range completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position) override;
+ QString filterString (KTextEditor::View *, const KTextEditor::Range &, const KTextEditor::Cursor &) override { return QString (); };
+
void updateCompletionList (const QString& symbol);
- void completionInvoked (KTextEditor::View *, const KTextEditor::Range &, InvocationType);
- void executeCompletionItem (KTextEditor::Document *document, const KTextEditor::Range &word, int row) const;
- QVariant data (const QModelIndex& index, int role=Qt::DisplayRole) const;
+ void completionInvoked (KTextEditor::View *, const KTextEditor::Range &, InvocationType) override;
+ void executeCompletionItem (KTextEditor::View *view, const KTextEditor::Range &word, const QModelIndex &index) const override;
+ QVariant data (const QModelIndex& index, int role=Qt::DisplayRole) const override;
bool isEmpty () const { return names.isEmpty (); };
private:
@@ -248,11 +227,7 @@ private:
KTextEditor::Document *m_doc;
KTextEditor::View *m_view;
KTextEditor::CodeCompletionInterface *cc_iface;
-#if KDE_IS_VERSION(4,5,0)
KTextEditor::MovingInterface *smart_iface;
-#else
- KTextEditor::SmartInterface *smart_iface;
-#endif
RKFunctionArgHinter *hinter;
RKCodeCompletionModel *completion_model;
More information about the rkward-tracker
mailing list