From 6619bd5932917908e457bd34f928025af87811bf Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 10 Feb 2022 16:55:38 +0600 Subject: [PATCH 1/5] qt: Fix quote character in VM name on Windows --- src/qt/qt_mainwindow.cpp | 4 +++- src/qt/qt_progsettings.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 66f8d8b03..908976985 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -123,7 +123,9 @@ MainWindow::MainWindow(QWidget *parent) : this->setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, vid_resize != 1); this->setWindowFlag(Qt::WindowMaximizeButtonHint, vid_resize == 1); - this->setWindowTitle(QString("%1 - %2 %3").arg(vm_name, EMU_NAME, EMU_VERSION_FULL)); + QString vmname(vm_name); + if (vmname.last(1) == "\"" || vmname.last(1) == "'") vmname.truncate(vmname.size() - 1); + this->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection); diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index ac8ae0ed8..ac7391954 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -121,7 +121,9 @@ void ProgSettings::accept() reloadStrings(); update_mouse_msg(); main_window->ui->retranslateUi(main_window); - main_window->setWindowTitle(QString("%1 - %2 %3").arg(vm_name, EMU_NAME, EMU_VERSION_FULL)); + QString vmname(vm_name); + if (vmname.last(1) == "\"" || vmname.last(1) == "'") vmname.truncate(vmname.size() - 1); + main_window->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); QString msg = main_window->status->getMessage(); main_window->status.reset(new MachineStatus(main_window)); main_window->refreshMediaMenu(); From 263c1b7ec7876f7dad474dad5c633be0cdd1d7c7 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 10 Feb 2022 20:21:00 +0600 Subject: [PATCH 2/5] Fix compile error --- src/qt/qt_mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 908976985..e64d24e0c 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -124,7 +124,7 @@ MainWindow::MainWindow(QWidget *parent) : this->setWindowFlag(Qt::WindowMaximizeButtonHint, vid_resize == 1); QString vmname(vm_name); - if (vmname.last(1) == "\"" || vmname.last(1) == "'") vmname.truncate(vmname.size() - 1); + if (vmname.at(vmname.size() - 1) == '"' || vmname.at(vmname.size() - 1) == '\'') vmname.truncate(vmname.size() - 1); this->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection); From 3594d7d7faf19a78104558e8d3fdc5887c17d3ac Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 10 Feb 2022 20:25:25 +0600 Subject: [PATCH 3/5] Part 2 --- src/qt/qt_progsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index ac7391954..1cd179332 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -122,7 +122,7 @@ void ProgSettings::accept() update_mouse_msg(); main_window->ui->retranslateUi(main_window); QString vmname(vm_name); - if (vmname.last(1) == "\"" || vmname.last(1) == "'") vmname.truncate(vmname.size() - 1); + if (vmname.at(vmnames.size() - 1) == "\"" || vmname.at(vmnames.size() - 1) == "'") vmname.truncate(vmname.size() - 1); main_window->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); QString msg = main_window->status->getMessage(); main_window->status.reset(new MachineStatus(main_window)); From 3447d96fe095692cba903c9ca789db089785e1ff Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 10 Feb 2022 19:54:20 +0500 Subject: [PATCH 4/5] qt: clear the filename buffer in plat_tempfile --- src/qt/qt_platform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 960fe27bf..da1e6b8a4 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -258,7 +258,7 @@ plat_tempfile(char *bufp, char *prefix, char *suffix) name.append(QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss-zzzz")); if (suffix) name.append(suffix); - sprintf(&bufp[strlen(bufp)], "%s", name.toUtf8().data()); + strcpy(bufp, name.toUtf8().data()); } void plat_remove(char* path) From a349582388224fcfdd4373e9655967fdf5697e1e Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 10 Feb 2022 20:08:15 +0500 Subject: [PATCH 5/5] Fix a compile-breaking typo --- src/qt/qt_progsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index 1cd179332..6ccac7b51 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -122,7 +122,7 @@ void ProgSettings::accept() update_mouse_msg(); main_window->ui->retranslateUi(main_window); QString vmname(vm_name); - if (vmname.at(vmnames.size() - 1) == "\"" || vmname.at(vmnames.size() - 1) == "'") vmname.truncate(vmname.size() - 1); + if (vmname.at(vmname.size() - 1) == "\"" || vmname.at(vmname.size() - 1) == "'") vmname.truncate(vmname.size() - 1); main_window->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); QString msg = main_window->status->getMessage(); main_window->status.reset(new MachineStatus(main_window));