diff options
author | Alexander V. Wolf <alex.v.wolf@gmail.com> | 2022-05-20 18:31:51 +0700 |
---|---|---|
committer | Alexander V. Wolf <alex.v.wolf@gmail.com> | 2022-05-20 18:31:51 +0700 |
commit | 159ba32e8ab795107889a74893f226bffcc4dcff (patch) | |
tree | ddb24b87d7e6ed22c1c7d878c1601aabb77c5dbe | |
parent | 388de48682fb8bb8376814afc14efb346bf82959 (diff) |
fix a few warnings and building Stellarium with scripting
-rw-r--r-- | src/scripting/StelScriptMgr.cpp | 18 | ||||
-rw-r--r-- | src/scripting/StelScriptMgr.hpp | 28 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/scripting/StelScriptMgr.cpp b/src/scripting/StelScriptMgr.cpp index d4ee9e4a8c..063e35a49f 100644 --- a/src/scripting/StelScriptMgr.cpp +++ b/src/scripting/StelScriptMgr.cpp @@ -421,7 +421,7 @@ QString StelScriptMgr::runningScriptId() const return scriptFileName; } -QString StelScriptMgr::getHeaderSingleLineCommentText(const QString& s, const QString& id, const QString& notFoundText) const +QString StelScriptMgr::getHeaderSingleLineCommentText(const QString& s, const QString& id, const QString& notFoundText) { QFile file(StelFileMgr::findFile("scripts/" + s, StelFileMgr::File)); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -451,7 +451,7 @@ QString StelScriptMgr::getHeaderSingleLineCommentText(const QString& s, const QS return notFoundText; } -QString StelScriptMgr::getHtmlDescription(const QString &s, bool generateDocumentTags) const +QString StelScriptMgr::getHtmlDescription(const QString &s, bool generateDocumentTags) { QString html; if (generateDocumentTags) @@ -492,33 +492,33 @@ QString StelScriptMgr::getHtmlDescription(const QString &s, bool generateDocumen return html; } -QString StelScriptMgr::getName(const QString& s) const +QString StelScriptMgr::getName(const QString& s) { return getHeaderSingleLineCommentText(s, "Name", s); } -QString StelScriptMgr::getAuthor(const QString& s) const +QString StelScriptMgr::getAuthor(const QString& s) { return getHeaderSingleLineCommentText(s, "Author"); } -QString StelScriptMgr::getLicense(const QString& s) const +QString StelScriptMgr::getLicense(const QString& s) { return getHeaderSingleLineCommentText(s, "License", ""); } -QString StelScriptMgr::getVersion(const QString& s) const +QString StelScriptMgr::getVersion(const QString& s) { return getHeaderSingleLineCommentText(s, "Version", ""); } -QString StelScriptMgr::getShortcut(const QString& s) const +QString StelScriptMgr::getShortcut(const QString& s) { return getHeaderSingleLineCommentText(s, "Shortcut", ""); } -QString StelScriptMgr::getDescription(const QString& s) const +QString StelScriptMgr::getDescription(const QString& s) { QFile file(StelFileMgr::findFile("scripts/" + s, StelFileMgr::File)); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -730,7 +730,7 @@ void StelScriptMgr::resumeScript() agent->setPauseScript(false); } -double StelScriptMgr::getScriptRate() const +double StelScriptMgr::getScriptRate() { return engine->globalObject().property("scriptRateReadOnly").toNumber(); } diff --git a/src/scripting/StelScriptMgr.hpp b/src/scripting/StelScriptMgr.hpp index 4f71da61d7..255f416594 100644 --- a/src/scripting/StelScriptMgr.hpp +++ b/src/scripting/StelScriptMgr.hpp @@ -79,21 +79,21 @@ public: //! @note use this sparingly and with caution, and only add one object per class! void addObject(QObject *obj); - //! Define JS classes Vec3f, Vec3d + //! Define JS classes Vec3f, Vec3d static void defVecClasses(QScriptEngine *engine); - //! Permit access to StelScriptMainAPI's methods + //! Permit access to StelScriptMainAPI's methods const QMetaObject * getMetaOfStelMainScriptAPI(){ return mainAPI->metaObject(); } - //! Accessor to QEventLoop - QEventLoop* getWaitEventLoop(){ return waitEventLoop; } + //! Accessor to QEventLoop + QEventLoop* getWaitEventLoop(){ return waitEventLoop; } public slots: //! Returns a HTML description of the specified script. //! Includes name, author, description... //! @param s the file name of the script whose HTML description is to be returned. //! @param generateDocumentTags if true, the main wrapping document tags (\<html\>\<body\>...\</body\>\</html\>) are also generated - QString getHtmlDescription(const QString& s, bool generateDocumentTags=true) const; + QString getHtmlDescription(const QString& s, bool generateDocumentTags=true); //! Gets a single line name of the script. //! @param s the file name of the script whose name is to be returned. @@ -101,7 +101,7 @@ public slots: //! such comment is found, the file name will be returned. If the file //! is not found or cannot be opened for some reason, an Empty string //! will be returned. - QString getName(const QString& s) const; + QString getName(const QString& s); //! Gets the name of the script Author //! @param s the file name of the script whose name is to be returned. @@ -109,7 +109,7 @@ public slots: //! such comment is found, "" is returned. If the file //! is not found or cannot be opened for some reason, an Empty string //! will be returned. - QString getAuthor(const QString& s) const; + QString getAuthor(const QString& s); //! Gets the licensing terms for the script //! @param s the file name of the script whose name is to be returned. @@ -117,7 +117,7 @@ public slots: //! such comment is found, "" is returned. If the file //! is not found or cannot be opened for some reason, an Empty string //! will be returned. - QString getLicense(const QString& s) const; + QString getLicense(const QString& s); //! Gets the version of the script //! @param s the file name of the script whose name is to be returned. @@ -125,7 +125,7 @@ public slots: //! such comment is found, "" is returned. If the file //! is not found or cannot be opened for some reason, an Empty string //! will be returned. - QString getVersion(const QString& s) const; + QString getVersion(const QString& s); //! Gets a description of the script. //! @param s the file name of the script whose name is to be returned. @@ -134,7 +134,7 @@ public slots: //! is found. If no such comment is found, QString("") is returned. //! If the file is not found or cannot be opened for some reason, an //! Empty string will be returned. - QString getDescription(const QString& s) const; + QString getDescription(const QString& s); //! Gets the default shortcut of the script. //! @param s the file name of the script whose name is to be returned. @@ -142,7 +142,7 @@ public slots: //! If no such comment is found, QString("") is returned. //! If the file is not found or cannot be opened for some reason, an //! Empty string will be returned. - QString getShortcut(const QString& s) const; + QString getShortcut(const QString& s); //! Run the script located in the given file. In essence, this calls prepareScript and runPreprocessedScript. //! @note This is a blocking call! The event queue is held up by calls of QCoreApplication::processEvents(). @@ -204,7 +204,7 @@ public slots: //! Get the rate at which the script is running as a multiple of the normal //! execution rate. - double getScriptRate() const; + double getScriptRate(); //! cause the emission of the scriptDebug signal. This is so that functions in //! StelMainScriptAPI can explicitly send information to the ScriptConsole @@ -263,14 +263,14 @@ private: //! @param notFoundText the text to be returned if the key is not found //! @return the text following the id and : on a comment line near the top of //! the script file (i.e. before there is a non-comment line). - QString getHeaderSingleLineCommentText(const QString& s, const QString& id, const QString& notFoundText="") const; + QString getHeaderSingleLineCommentText(const QString& s, const QString& id, const QString& notFoundText=""); QScriptEngine* engine; //! The thread in which scripts are run StelMainScriptAPI *mainAPI; //! The QEventLoop for wait and waitFor - QEventLoop* waitEventLoop; + QEventLoop* waitEventLoop; QString scriptFileName; |