[education/rkward] rkward: Fix some clazy warnings

Thomas Friedrichsmeier null at kde.org
Sun Jul 16 15:16:50 BST 2023


Git commit f455f2483220deaaa107f3e4ddc4faf6578081b4 by Thomas Friedrichsmeier.
Committed on 16/07/2023 at 14:16.
Pushed by tfry into branch 'master'.

Fix some clazy warnings

M  +1    -1    rkward/main.cpp
M  +1    -1    rkward/rbackend/rkrinterface.cpp
M  +14   -13   rkward/scriptbackends/rkcomponentscripting.h

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

diff --git a/rkward/main.cpp b/rkward/main.cpp
index e0e755d9c..5e67844fb 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -247,7 +247,7 @@ int main (int argc, char *argv[]) {
 	// Follow the example of kate, and use breeze theme on Windows and Mac, which appears to work best
 	QApplication::setStyle(QStringLiteral("breeze"));
 #else
-	if (!qgetenv("APPDIR").isEmpty()) { // see above for AppImage
+	if (qEnvironmentVariableIsSet("APPDIR")) { // see above for AppImage
 		QApplication::setStyle(QStringLiteral("breeze"));
 	}
 #endif
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 4317fb91d..a6dfeb9d0 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -380,7 +380,7 @@ void RInterface::handleRequest (RBackendRequest* request) {
 			RKSessionVars::setRVersion (command->stringVector ().value (0));
 		});
 
-		if (!qgetenv("APPDIR").isEmpty()) {
+		if (qEnvironmentVariableIsSet("APPDIR")) {
 			// Running inside an AppImage. As soon as R has started, it should behave as if running in the main (system) environment (esp. when calling helper binaries such as wget or gcc).
 			// Unset any paths starting with APPDIR, _except_ those inside R_HOME.
 			runStartupCommand(new RCommand("local({\n"
diff --git a/rkward/scriptbackends/rkcomponentscripting.h b/rkward/scriptbackends/rkcomponentscripting.h
index d1fcd84e0..ad7dd3f4a 100644
--- a/rkward/scriptbackends/rkcomponentscripting.h
+++ b/rkward/scriptbackends/rkcomponentscripting.h
@@ -1,6 +1,6 @@
 /*
 rkcomponentscripting - This file is part of the RKWard project. Created: Thu Jun 17 2010
-SPDX-FileCopyrightText: 2010-2013 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2010-2023 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
 */
@@ -36,22 +36,23 @@ public slots:
 	void componentChanged (RKComponent* changed);
 	void propertyChanged (RKComponentPropertyBase* changed);
 
+public:
 // these are meant to be called from the script
-	void include (const QString& filename);
-	void addChangeCommand (const QString& changed_id, const QString& command);
+	Q_INVOKABLE void include (const QString& filename);
+	Q_INVOKABLE void addChangeCommand (const QString& changed_id, const QString& command);
 /** @returns id of the command issued. */
-	QVariant doRCommand (const QString& command, const QString& callback);
+	Q_INVOKABLE QVariant doRCommand (const QString& command, const QString& callback);
 
-	QVariant getValue (const QString &id) const;
-	QVariant getString (const QString &id) const;
-	QVariant getBoolean (const QString &id) const;
-	QVariant getList (const QString &id) const;
-	void setValue (const QString &value, const QString &id);
-	void setListValue (const QStringList &value, const QString &id);
+	Q_INVOKABLE QVariant getValue (const QString &id) const;
+	Q_INVOKABLE QVariant getString (const QString &id) const;
+	Q_INVOKABLE QVariant getBoolean (const QString &id) const;
+	Q_INVOKABLE QVariant getList (const QString &id) const;
+	Q_INVOKABLE void setValue (const QString &value, const QString &id);
+	Q_INVOKABLE void setListValue (const QStringList &value, const QString &id);
 
-	QVariantList getObjectInfo (const QString &name);
-	QString getObjectParent (const QString &name);
-	QString getObjectChild (const QString &name);
+	Q_INVOKABLE QVariantList getObjectInfo (const QString &name);
+	Q_INVOKABLE QString getObjectParent (const QString &name);
+	Q_INVOKABLE QString getObjectChild (const QString &name);
 signals:
 	void haveError ();
 private slots:


More information about the rkward-tracker mailing list