mobile: turn testqml into a std::string

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-02-28 20:07:39 +01:00
parent af94f21ea1
commit 5285243a40
3 changed files with 10 additions and 8 deletions

View file

@ -17,7 +17,7 @@ extern void show_computer_list();
int quit, force_root, ignore_bt;
#ifdef SUBSURFACE_MOBILE_DESKTOP
char *testqml = NULL;
std::string testqml;
#endif
/*
@ -169,8 +169,7 @@ extern "C" void parse_argument(const char *arg)
}
#elif SUBSURFACE_MOBILE_DESKTOP
if (strncmp(arg, "--testqml=", sizeof("--testqml=") - 1) == 0) {
testqml = (char *)malloc(strlen(arg) - sizeof("--testqml=") + 1);
strcpy(testqml, arg + sizeof("--testqml=") - 1);
testqml = arg + sizeof("--testqml=") - 1;
return;
}
#endif

View file

@ -10,9 +10,6 @@ extern "C" {
extern bool imported;
extern int quit, force_root, ignore_bt;
#ifdef SUBSURFACE_MOBILE_DESKTOP
extern char *testqml;
#endif
void setup_system_prefs(void);
void parse_argument(const char *arg);
@ -24,6 +21,12 @@ extern char *settings_suffix;
#ifdef __cplusplus
}
#ifdef SUBSURFACE_MOBILE_DESKTOP
#include <string>
extern std::string testqml;
#endif
#endif
#endif // SUBSURFACESTARTUP_H

View file

@ -133,8 +133,8 @@ void run_mobile_ui(double initial_font_size)
qmlRegisterUncreatableType<QMLManager>("org.subsurfacedivelog.mobile",1,0,"ExportType","Enum is not a type");
#ifdef SUBSURFACE_MOBILE_DESKTOP
if (testqml) {
QString fileLoad(testqml);
if (!testqml.empty()) {
QString fileLoad(testqml.c_str());
fileLoad += "/main.qml";
engine.load(QUrl(fileLoad));
} else {