Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/common_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
os: macos-14
build: true
build_installer: true
qmake_extra: "CONFIG+=noPch CONFIG+=ccache CONFIG+=no-sanitizers CONFIG+=silent CONFIG+=warn_off"
qmake_extra: "CONFIG+=noPch CONFIG+=ccache CONFIG+=sanitizer CONFIG+=sanitize_undefined CONFIG+=sanitize_address CONFIG+=silent CONFIG+=warn_off"
trik_python3_version_minor: 11
tests: true
secrets: inherit
Expand Down Expand Up @@ -145,6 +145,7 @@ jobs:
build_installer: true
need_deploy: false
qmake_extra: "CONFIG+=tests CONFIG+=noPch CONFIG+=ccache CONFIG+=sanitizer CONFIG+=sanitize_undefined CONFIG+=sanitize_address"
tests: true
gcc_version: 13
trik_qt_version: 5.15
trik_python3_version_minor: 11
Expand All @@ -159,8 +160,7 @@ jobs:
container_name: rockylinux:8
build: true
build_installer: true
tests: true
qmake_extra: "CONFIG+=noPch CONFIG+=ccache CONFIG+=no-sanitizers CONFIG+=warn_off"
qmake_extra: "CONFIG+=noPch CONFIG+=ccache CONFIG+=sanitizer CONFIG+=sanitize_undefined CONFIG+=sanitize_address"
gcc_version: 13
trik_qt_version: 5.15
trik_python3_version_minor: 11
Expand Down
11 changes: 8 additions & 3 deletions plugins/robots/checker/twoDModelRunner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <QtCore/QDirIterator>
#include <QtWidgets/QApplication>
#include <qrkernel/logging.h>
#include <sanitizers/sanitizers.h>
#include <qrkernel/platformInfo.h>
#include "runner.h"

Expand All @@ -42,7 +43,7 @@ bool loadTranslators(const QString &locale)
bool hasTranslations = false;
while (directories.hasNext()) {
for (auto &&translatorFile : QDir(directories.next()).entryInfoList(QDir::Files)) {
QTranslator *translator = new QTranslator(qApp);
auto *translator = new QTranslator(qApp);
translator->load(translatorFile.absoluteFilePath());
QCoreApplication::installTranslator(translator);
hasTranslations = true;
Expand All @@ -68,7 +69,7 @@ void setDefaultLocale()
int main(int argc, char *argv[])
{
qReal::PlatformInfo::enableHiDPISupport();
qsrand(time(0));
qsrand(time(nullptr));
QScopedPointer<QApplication> app(new QApplication(argc, argv));
QCoreApplication::setApplicationName("2D-model");
QCoreApplication::setApplicationVersion(interpreterCore::Customizer::trikStudioVersion());
Expand All @@ -83,6 +84,10 @@ int main(int argc, char *argv[])
const QDir logsDir(qReal::PlatformInfo::invariantSettingsPath("pathToLogs"));
if (logsDir.mkpath(logsDir.absolutePath())) {
logger.addLogTarget(logsDir.filePath("2d-model.log"), maxLogSize, 2);
#ifdef HAS_SANITIZER_INTERFACE
const auto sanitizersPath = logsDir.filePath("sanitizer.log").toLocal8Bit();
initSanitizerPath(sanitizersPath.constData());
#endif
}
QLOG_INFO() << "------------------- APPLICATION STARTED --------------------";
QLOG_INFO() << "Running on" << QSysInfo::prettyProductName() << QSysInfo::currentCpuArchitecture();
Expand Down Expand Up @@ -129,7 +134,7 @@ int main(int argc, char *argv[])
, QObject::tr("The complete file path, including the filename"\
", to save the generated JavaScript or Python code.")
, "path-to-save-code", QString());
QCommandLineOption generateModeOption("generate-mode", QObject::tr("Select \"python\" or \"javascript\".")
QCommandLineOption generateModeOption("generate-mode", QObject::tr(R"(Select "python" or "javascript".)")
, "generate-mode", "javascript");
QCommandLineOption directScriptExecutionPathOption("script-path"
, QObject::tr("The path to the Python or JavaScript file that will be used for interpretation.")
Expand Down
2 changes: 2 additions & 0 deletions plugins/robots/checker/twoDModelRunner/twoDModelRunner.pro
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ SOURCES += \
$$PWD/main.cpp \
$$PWD/runner.cpp \
$$PWD/reporter.cpp \

include($$PWD/../../../../sanitizers/sanitizers.pri)
23 changes: 13 additions & 10 deletions qrgui/mainWindow/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License. */

#include <time.h>
#include <ctime>

#include <QtCore/QtPlugin>
#include <QtCore/QTranslator>
Expand All @@ -23,10 +23,9 @@

#include <qrkernel/logging.h>
#include <qrkernel/platformInfo.h>

#include <sanitizers/sanitizers.h>
#include "mainWindow/mainWindow.h"
#include "thirdparty/windowsmodernstyle.h"

#include "qrealApplication.h"

using namespace qReal;
Expand All @@ -46,6 +45,7 @@ static void loadTranslators(QLocale &locale)
static const auto qtAppsTranslationsDir = PlatformInfo::invariantSettingsPath("pathToTranslations");

for (auto &&module: qtModules) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
auto *t = new QTranslator(qApp);
if (t->load(locale, module, "_", qtAppsTranslationsDir)) {
QCoreApplication::installTranslator(t);
Expand All @@ -60,8 +60,9 @@ static void loadTranslators(QLocale &locale)
QDir translationsDirectory(PlatformInfo::invariantSettingsPath("pathToTranslations") + "/" + language);
QDirIterator directories(translationsDirectory, QDirIterator::Subdirectories);
while (directories.hasNext()) {
for (const QFileInfo &translatorFile : QDir(directories.next()).entryInfoList(QDir::Files)) {
QTranslator *translator = new QTranslator(qApp);
for (auto &&translatorFile : QDir(directories.next()).entryInfoList(QDir::Files)) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
auto *translator = new QTranslator(qApp);
translator->load(translatorFile.absoluteFilePath());
QCoreApplication::installTranslator(translator);
}
Expand Down Expand Up @@ -107,11 +108,11 @@ int main(int argc, char *argv[])

if (app->arguments().contains("--version"))
{
QTextStream(stdout) << versionInfo() << endl;
QTextStream(stdout) << versionInfo() << Qt::endl;
return 0;
}

qsrand(time(0));
qsrand(time(nullptr));
setDefaultLocale(app->arguments().contains("--no-locale"));

const QString defaultPlatformConfigPath = PlatformInfo::defaultPlatformConfigPath();
Expand All @@ -128,7 +129,7 @@ int main(int argc, char *argv[])
SettingsManager::instance()->loadSettings(settingsFileName);
}

for (const QString &argument : app->arguments()) {
for (auto &&argument : app->arguments()) {
if (argument.endsWith(".qrs") || argument.endsWith(".qrs'") || argument.endsWith(".qrs\"")) {
fileToOpen = argument;
break;
Expand All @@ -140,15 +141,17 @@ int main(int argc, char *argv[])
if (logsDir.mkpath(logsDir.absolutePath())) {
logger.addLogTarget(logsDir.filePath("qreal.log"), maxLogSize, 2);
logger.removeDefaultInitialLogTarget();
#ifdef HAS_SANITIZER_INTERFACE
const auto sanitizersPath = logsDir.filePath("sanitizer.log").toLocal8Bit();
initSanitizerPath(sanitizersPath.constData());
#endif
}

QLOG_INFO() << "------------------- APPLICATION STARTED --------------------";
QLOG_INFO() << "Version:" << versionInfo();
QLOG_INFO() << "Running on" << QSysInfo::prettyProductName() << QSysInfo::currentCpuArchitecture()
<< "/ Kernel: " << QSysInfo::kernelType() << QSysInfo::kernelVersion();
QLOG_INFO() << "Arguments:" << app->arguments();
for (auto &&i: dpiInfo) { QLOG_INFO() << i ; }

QApplication::setStyle(QStyleFactory::create("Fusion"));

QScopedPointer<MainWindow> window(new MainWindow(fileToOpen));
Expand Down
1 change: 1 addition & 0 deletions qrgui/mainWindow/mainWindow.pro
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@ macx {

DISTFILES += lsan.supp
include(scriptAPI/scriptAPI.pri)
include($$PWD/../../sanitizers/sanitizers.pri)
copyToDestdir($$PWD/lsan.supp, now)

34 changes: 17 additions & 17 deletions qrtranslations/es/plugins/robots/checker/twoDModelRunner_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="30"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="31"/>
<source>Emulates robot`s behaviour on TRIK Studio 2D model separately from programming environment. Passed .qrs will be interpreted just like when &apos;Run&apos; button was pressed in TRIK Studio.
In background mode the session will be terminated just after the execution ended and return code will then contain binary information about program correctness.Example:
</source>
Expand All @@ -13,82 +13,82 @@ En modo de fondo, la sesión finalizará inmediatamente tras la ejecución, y el
</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="102"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="107"/>
<source>Save file to be interpreted.</source>
<translation>Archivo guardado que será interpretado.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="103"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="108"/>
<source>Run emulation in background.</source>
<translation>Ejecutar la emulación en segundo plano.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="105"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="110"/>
<source>A path to file where checker results will be written (JSON).</source>
<translation>Ruta al archivo donde se escribirán los resultados del comprobador (JSON).</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="108"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="113"/>
<source>A path to file where robot`s trajectory will be written. The writing will not be performed not immediately, each trajectory point will be written just when obtained by checker, so FIFOs are recommended to be targets for this option.</source>
<translation>Ruta al archivo donde se escribirá la trayectoria del robot. La escritura no se realizará de forma inmediata; cada punto de la trayectoria se registrará tan pronto como sea obtenido por el comprobador, por lo que se recomienda usar archivos FIFO como destino para esta opción.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="112"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="117"/>
<source>Inputs for JavaScript solution.</source>
<translation>Entradas para la solución en JavaScript.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="114"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="119"/>
<source>Set to &quot;script&quot; for execution of js/py from the project or set to &quot;diagram&quot; for block diagram.</source>
<translation>Establezca &quot;script&quot; para ejecutar scripts js/py del proyecto o &quot;diagram&quot; para diagramas de bloques.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="118"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="123"/>
<source>Speed factor, try from 5 to 20, or even 1000 (at your own risk!).</source>
<translation>Factor de velocidad, pruebe desde 5 hasta 20, o incluso 1000 (¡bajo su propio riesgo!).</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="121"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="126"/>
<source>Close the window and exit if the diagram/script finishes without errors.</source>
<translation>Cerrar la ventana y salir si el diagrama/escritura finaliza sin errores.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="124"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="129"/>
<source>Close the window and exit after diagram/script finishes.</source>
<translation>Cerrar la ventana y salir tras finalizar el diagrama/escritura.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="126"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="131"/>
<source>Shows robot&apos;s console.</source>
<translation>Muestra la consola del robot.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="127"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="132"/>
<source>Shows robot&apos;s display.</source>
<translation>Muestra la pantalla del robot.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="129"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="134"/>
<source>The complete file path, including the filename, to save the generated JavaScript or Python code.</source>
<translation>La ruta completa del archivo, incluyendo el nombre, para guardar el código JavaScript o Python generado.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="132"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="137"/>
<source>Select &quot;python&quot; or &quot;javascript&quot;.</source>
<translation>Seleccione &quot;python&quot; o &quot;javascript&quot;.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="135"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="140"/>
<source>The path to the Python or JavaScript file that will be used for interpretation.</source>
<translation>La ruta al archivo Python o JavaScript que se utilizará para la interpretación.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="138"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="143"/>
<source>Do not run the interpretation in any mode, this is a parameter that is only used to generate a file.</source>
<translation>No ejecutar la interpretación en ningún modo; este parámetro solo se utiliza para generar un archivo.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="141"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="146"/>
<source>Add a delay in milliseconds after executing the script before closing the window</source>
<translation>Añadir un retraso en milisegundos tras ejecutar el script antes de cerrar la ventana</translation>
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<context>
<name>QObject</name>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="+30"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="+31"/>
<source>Emulates robot`s behaviour on TRIK Studio 2D model separately from programming environment. Passed .qrs will be interpreted just like when &apos;Run&apos; button was pressed in TRIK Studio.
In background mode the session will be terminated just after the execution ended and return code will then contain binary information about program correctness.Example:
</source>
<translation>Émule le comportement du robot sur le modèle 2D TRIK Studio séparément de l&apos;environnement de programmation. Le fichier .qrs sera interprété comme si le bouton &apos;Executer&apos; était appuyé dans TRIK Studio.</translation>
</message>
<message>
<location line="+72"/>
<location line="+76"/>
<source>Save file to be interpreted.</source>
<translation>Le fichier de sauvegarde à interpréter.</translation>
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<translation type="vanished">Эмулирует поведение робота на 2D модели TRIK Studio отдельно от редактора программ. Указанный файл сохранения .qrs будет исполнен, как в случае нажатия на кнопку &quot;Запуск&quot; в среде.</translation>
</message>
<message>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="+30"/>
<location filename="../../../../../plugins/robots/checker/twoDModelRunner/main.cpp" line="+31"/>
<source>Emulates robot`s behaviour on TRIK Studio 2D model separately from programming environment. Passed .qrs will be interpreted just like when &apos;Run&apos; button was pressed in TRIK Studio.
In background mode the session will be terminated just after the execution ended and return code will then contain binary information about program correctness.Example:
</source>
Expand All @@ -17,7 +17,7 @@ In background mode the session will be terminated just after the execution ended
</translation>
</message>
<message>
<location line="+72"/>
<location line="+76"/>
<source>Save file to be interpreted.</source>
<translation>Файл сохранения, который будет исполнен.</translation>
</message>
Expand Down
Loading
Loading