[education/rkward/kf5] rkward: Assorted minor changes while reviewing the full Qt6 changeset

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit fb19ea7d25685d72ea906c9545604689b8b64d3b by Thomas Friedrichsmeier.
Committed on 07/04/2024 at 13:28.
Pushed by tfry into branch 'kf5'.

Assorted minor changes while reviewing the full Qt6 changeset

M  +5    -7    rkward/agents/rkprintagent.cpp
M  +1    -1    rkward/core/renvironmentobject.cpp
M  +1    -1    rkward/core/rkmodificationtracker.h
M  +1    -1    rkward/core/robjectlist.cpp
M  +2    -2    rkward/dataeditor/rkvareditmodel.cpp
M  +3    -3    rkward/misc/rkxmlguisyncer.cpp
M  +1    -1    rkward/plugin/rkcomponentproperties.cpp
M  +1    -1    rkward/rbackend/rkfrontendtransmitter.cpp
M  +1    -2    rkward/rbackend/rkrbackend.cpp
M  +1    -0    rkward/rbackend/rksessionvars.cpp
M  +2    -2    rkward/rkconsole.cpp
M  +5    -5    rkward/windows/rkhtmlwindow.cpp

https://invent.kde.org/education/rkward/-/commit/fb19ea7d25685d72ea906c9545604689b8b64d3b

diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 6d7136a93..b031623c3 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -13,7 +13,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QUrl>
 
 #include <KMessageBox>
-#include <kio_version.h>
 #include <KIO/OpenUrlJob>
 #include <KIO/JobUiDelegate>
 #include <KIO/JobUiDelegateFactory>
@@ -51,7 +50,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 		KMessageBox::error(RKWardMainWindow::getMain(), i18n("No service was found to provide a KDE print dialog for PostScript files. We will try to open a generic PostScript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n("Unable to open KDE print dialog"));
 
 		// fallback: If we can't find a proper part, try to invoke a standalone PS reader, instead
-		auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file), "application/postscript");
+		auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file), QStringLiteral("application/postscript"));
 		job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, RKWardMainWindow::getMain()));
 		job->setDeleteTemporaryFile(delete_file);
 		job->start();
@@ -60,18 +59,17 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 
 	auto provider = result.plugin;
 	QAction *printaction = provider->action("print");
-	if (!printaction) printaction = provider->action ("file_print");
+	if (!printaction) printaction = provider->action("file_print");
 	if (!printaction) {
-		QAction *a = new QAction (provider);
-		bool ok = connect (a, SIGNAL (triggered()), provider, SLOT (slotPrint()));
+		QAction *a = new QAction(provider);
+		bool ok = connect(a, SIGNAL(triggered()), provider, SLOT(slotPrint()));
 		if (ok) printaction = a;
 	}
-	if (!(printaction && provider->openUrl (QUrl::fromLocalFile (file)))) {
+	if (!(printaction && provider->openUrl(QUrl::fromLocalFile(file)))) {
 		RK_DEBUG (APP, DL_WARNING, "No print action in postscript provider");
 		delete provider;
 		provider = nullptr;
 	}
-	
 
 	RKPrintAgent *agent = new RKPrintAgent(file, provider, delete_file);
 
diff --git a/rkward/core/renvironmentobject.cpp b/rkward/core/renvironmentobject.cpp
index cb5b496ae..cc620cf80 100644
--- a/rkward/core/renvironmentobject.cpp
+++ b/rkward/core/renvironmentobject.cpp
@@ -28,7 +28,7 @@ REnvironmentObject::REnvironmentObject (RContainerObject *parent, const QString
 			type |= PackageEnv;
 		}
 	} else if (parent == nullptr) {
-		RK_ASSERT (name == ".GlobalEnv");
+		RK_ASSERT(name == QStringLiteral(".GlobalEnv"));
 		type |= ToplevelEnv | GlobalEnv;
 	}
 }
diff --git a/rkward/core/rkmodificationtracker.h b/rkward/core/rkmodificationtracker.h
index 4a2575521..18d4fd246 100644
--- a/rkward/core/rkmodificationtracker.h
+++ b/rkward/core/rkmodificationtracker.h
@@ -105,7 +105,7 @@ public:
 
 
 /**
-This class takes care of propagating object-modifications to all editors/variable-browsers etc. that need to know about them. For instance, if an object was removed in the R-workspace, the RObjectList will notify the RKModificationTracker. The modification tracker will then find out, whether there are editor(s) currently editing the removed object. If so, it will prompt the user what to do. Or, if an object is renamed in an editor, the RKModificationTracker will find out, whether the object is opened in further editors (not possible, yet) and tell those to update accordingly. It will further Q_EMIT signals so the RObjectBrowser and RKVarselector(s) can update their object-lists.
+This class takes care of propagating object-modifications to all editors/variable-browsers etc. that need to know about them. For instance, if an object was removed in the R-workspace, the RObjectList will notify the RKModificationTracker. The modification tracker will then find out, whether there are editor(s) currently editing the removed object. If so, it will prompt the user what to do. Or, if an object is renamed in an editor, the RKModificationTracker will find out, whether the object is opened in further editors (not possible, yet) and tell those to update accordingly. It will further emit signals so the RObjectBrowser and RKVarselector(s) can update their object-lists.
 
 @author Thomas Friedrichsmeier
 */
diff --git a/rkward/core/robjectlist.cpp b/rkward/core/robjectlist.cpp
index e085f9347..5941b4f66 100644
--- a/rkward/core/robjectlist.cpp
+++ b/rkward/core/robjectlist.cpp
@@ -38,7 +38,7 @@ RObjectList::RObjectList() : RContainerObject(nullptr, QString()) {
 	type = RObject::Workspace;
 	name = "search()";
 
-	globalenv = new REnvironmentObject(nullptr, ".GlobalEnv");
+	globalenv = new REnvironmentObject(nullptr, QStringLiteral(".GlobalEnv"));
 	globalenv->updateFromR(nullptr);
 
    // TODO: Do we really need tracker notification at this stage?
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index fbb8a089b..51e661361 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -187,7 +187,7 @@ bool RKVarEditModel::insertRows (int row, int count, const QModelIndex& parent)
 	beginInsertRows (QModelIndex (), row, row+count-1);
 	doInsertRowsInBackend (row, count);
 	for (int i=0; i < objects.size (); ++i) {
-// TODO: this does not Q_EMIT any data change notifications to other editors
+// TODO: this does not emit any data change notifications to other editors
 		objects[i]->insertRows (row, count);
 	}
 	endInsertRows ();
@@ -210,7 +210,7 @@ bool RKVarEditModel::removeRows (int row, int count, const QModelIndex& parent)
 	beginRemoveRows (QModelIndex (), row, lastrow);
 	doRemoveRowsInBackend (row, lastrow - row + 1);
 	for (int i=0; i < objects.size (); ++i) {
-// TODO: this does not Q_EMIT any data change notifications to other editors
+// TODO: this does not emit any data change notifications to other editors
 		objects[i]->removeRows (row, lastrow);
 	}
 	endRemoveRows ();
diff --git a/rkward/misc/rkxmlguisyncer.cpp b/rkward/misc/rkxmlguisyncer.cpp
index f3a3f0bce..67021d8c2 100644
--- a/rkward/misc/rkxmlguisyncer.cpp
+++ b/rkward/misc/rkxmlguisyncer.cpp
@@ -50,9 +50,9 @@ void RKXMLGUISyncer::watchXMLGUIClientUIrc (KXMLGUIClient *client, bool recursiv
 	}
 
 	if (recursive) {
-		const auto childs = client->childClients ();
-		for (KXMLGUIClient *child : childs) {
-			watchXMLGUIClientUIrc (child, true);
+		const auto children = client->childClients();
+		for (KXMLGUIClient *child : children) {
+			watchXMLGUIClientUIrc(child, true);
 		}
 	}
 }
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 1f53e62a9..6665f3b7e 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -53,7 +53,7 @@ Currently these modifiers are known (but check the sources if in doubt):
 See RKComponentPropertyConvert
 
 \section RKComponentPropertyInternals Internal workings
-RKComponentProperties are QObjects, and communicate with each other via signals and slots. On each change they Q_EMIT a RKComponentPropertyBase::valueChanged (RKComponentPropertyBase *) signal with a pointer to self as parameter.
+RKComponentProperties are QObjects, and communicate with each other via signals and slots. On each change they emit a RKComponentPropertyBase::valueChanged (RKComponentPropertyBase *) signal with a pointer to self as parameter.
 
 Properties can be connected to each other using RKComponentPropertyBase::connectToGovernor (). The calling property will connect to the governor's valueChange () signal, and keep itself in sync.
 
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 8aa8309d1..b5aaee8fe 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -122,7 +122,7 @@ void RKFrontendTransmitter::run () {
 #endif
 
 	args.append (QStringLiteral("--debug-level=") + QString::number (RK_Debug::RK_Debug_Level));
-	// NOTE: QProQByteArray(cess quotes its arguments, *but* properly passing all spaces and quotes through the R CMD wrapper, seems near(?) impossible on Windows. Instead, we use percent encoding, internally.
+	// NOTE: QProcess quotes its arguments, *but* properly passing all spaces and quotes through the R CMD wrapper, seems near(?) impossible on Windows. Instead, we use percent encoding, internally.
 	args.append (QStringLiteral("--server-name=") + server->fullServerName ().toUtf8 ().toPercentEncoding ());
 	args.append (QStringLiteral("--rkd-server-name=") + rkd_transmitter->serverName ().toUtf8 ().toPercentEncoding ());
 	args.append (QStringLiteral("--data-dir=") + RKSettingsModuleGeneral::filesPath ().toUtf8 ().toPercentEncoding ());
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index 2dc847853..5b3518669 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -796,8 +796,7 @@ void RBusy (int busy) {
 
 SEXP doUpdateLocale ();
 // NOTE: stdout_stderr_mutex is recursive to support fork()s, better
-#define DUMMY_MUTEX_FLAGS
-RKRBackend::RKRBackend() : stdout_stderr_mutex(DUMMY_MUTEX_FLAGS) {
+RKRBackend::RKRBackend() : stdout_stderr_mutex() {
 	RK_TRACE (RBACKEND);
 
 	RK_ASSERT (this_pointer == nullptr);
diff --git a/rkward/rbackend/rksessionvars.cpp b/rkward/rbackend/rksessionvars.cpp
index 10638b3ce..dd8fe89fc 100644
--- a/rkward/rbackend/rksessionvars.cpp
+++ b/rkward/rbackend/rksessionvars.cpp
@@ -86,6 +86,7 @@ QStringList RKSessionVars::frontendSessionInfo () {
 	lines.append (QString ("Qt version (runtime): ") + qVersion ());
 	lines.append ("Qt version (compile time): " QT_VERSION_STR);
 	lines.append ("Using QWebEngine for HTML rendering");
+	lines.append(QStringLiteral("Running on: ") + QSysInfo::prettyProductName());
 	lines.append ("Local config directory: " + QStandardPaths::writableLocation (QStandardPaths::GenericConfigLocation));
 	lines.append ("RKWard storage directory: " + RKSettingsModuleGeneral::filesPath ());
 	lines.append ("Backend version (as known to the frontend): " + r_version_string);
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index aee316a53..98b5d7d42 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -90,7 +90,7 @@ RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKM
 	}
 
 	doc = editor->createDocument (this);
-	// even though the R Console is not really a document window, it is for it to be constructed with a proper main window.
+	// even though the R Console is not really a document window, it is important for it to be constructed with a proper main window.
 	// E.g. argument hints don't get the correct window parent, otherwise
 	view = doc->createView (this, RKWardMainWindow::getMain()->katePluginIntegration()->mainWindow ()->mainWindow());
 	layout->addWidget (view);
@@ -905,7 +905,7 @@ void RKConsole::pipeCommandThroughConsoleLocal (const QString &command_string) {
 	activate (false);
 	if (isBusy () && (!previous_chunk_was_piped)) {
 		int res = KMessageBox::questionTwoActionsCancel (this, i18n ("You have configured RKWard to pipe script editor commands through the R Console. However, another command is currently active in the console. Do you want to append it to the command in the console, or do you want to reset the console, first? Press cancel if you do not wish to run the new command, now."), i18n ("R Console is busy"), KGuiItem (i18n ("Append")), KGuiItem (i18n ("Reset, then submit")));
-		if (res == KMessageBox::Cancel) {
+		if (res == KMessageBox::SecondaryAction) {
 			resetConsole ();
 		} else if (res != KMessageBox::PrimaryAction) {
 			return;
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 7ebd59d35..845fa7179 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -181,9 +181,9 @@ friend class RKHTMLWindow;
 class RKWebView : public QWebEngineView {
 public:
 	RKWebView (QWidget *parent) : QWebEngineView (parent) {};
-	void print (QPrinter *printer) {
-		if (!page ()) return;
-        QWebEngineView::forPage(page ())->print (printer);
+	void print(QPrinter *printer) {
+		if (!page()) return;
+		QWebEngineView::forPage(page())->print(printer);
 	};
 protected:
 	bool eventFilter(QObject *, QEvent *event) override {
@@ -771,7 +771,7 @@ void RKHTMLWindow::zoomOut () {
 void RKHTMLWindow::setTextEncoding (QStringConverter::Encoding encoding) {
 	RK_TRACE (APP);
 
-    QStringEncoder converter(encoding);
+	QStringEncoder converter(encoding);
 	page->settings ()->setDefaultTextEncoding (converter.name ());
 	view->reload ();
 }
@@ -825,7 +825,7 @@ void RKHTMLWindow::flushOutput () {
 	}
 
 	// TODO: remove legacy code below, eventually
-	int res = KMessageBox::questionTwoActions (this, i18n ("Do you really want to clear the output? This will also remove all image files used in the output. It will not be possible to restore it."), i18n ("Flush output?"), KStandardGuiItem::clear(), KStandardGuiItem::cancel());
+	int res = KMessageBox::questionTwoActions(this, i18n ("Do you really want to clear the output? This will also remove all image files used in the output. It will not be possible to restore it."), i18n("Flush output?"), KStandardGuiItem::clear(), KStandardGuiItem::cancel());
 	if (res==KMessageBox::PrimaryAction) {
 		QFile out_file (current_url.toLocalFile ());
 		RCommand *c = new RCommand ("rk.flush.output (" + RCommand::rQuote (out_file.fileName ()) + ", ask=FALSE)\n", RCommand::App);



More information about the rkward-tracker mailing list