diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index e1cec7005..f751df831 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index ddec0bc60..153c94d9d 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index fc78c76bd..f5bc66ff2 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 4ed3a4fbf..03d4f65de 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index b49a1411a..91c6d9106 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -3080,3 +3080,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index efa17fa4b..6db0fdd01 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 1a4b65df4..72a92c8bc 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 38f4672cb..43fe30b55 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index c3d793f13..44774dc96 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index a3c182f8e..5ba79be02 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index cec605d90..5e3b3225f 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 690bc8491..ecb726807 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index d35c292c6..6231a2d15 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index c1ac985e5..014c12c82 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index ec0cc9f87..d4a3ff580 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 8a432d6ca..f7db7363d 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 0cc722e84..0ebf59ba7 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index e1d8816c8..b3db8f3dc 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -3036,3 +3036,6 @@ msgstr "П&еремотка вперёд" msgid "Fast forward" msgstr "Перемотка вперёд" + +msgid "To change the system directory, stop all running machines." +msgstr "Чтобы изменить системную папку, остановите все запущенные машины." diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index b6172ee9c..672d8b68a 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 431685dec..0ad1d4e87 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 6005a49c6..9b6c07e9b 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index ede62240b..07f79d335 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 9644aa5fe..bf147cc4e 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 9c4f56d46..7f0e2b1dc 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index ea491586c..b4e9a7512 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -3017,3 +3017,6 @@ msgstr "快进(&F)" msgid "Fast forward" msgstr "快进" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index a27bc13c2..628ec8929 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -3024,3 +3024,6 @@ msgstr "快轉(&F)" msgid "Fast forward" msgstr "快轉" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 7337aa20f..e844b7da1 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -451,6 +451,56 @@ VMManagerMain::~VMManagerMain() delete vm_model; } +void +VMManagerMain::reload() +{ + // Disconnect and save the old selection mdoel to be deleted later + QItemSelectionModel *old_selection_model = ui->listView->selectionModel(); + disconnect(old_selection_model, &QItemSelectionModel::currentChanged, this, &VMManagerMain::currentSelectionChanged); + // Disconnect and delete the model and proxy model + disconnect(vm_model, &VMManagerModel::systemDataChanged, this, &VMManagerMain::modelDataChange); + disconnect(vm_model, &VMManagerModel::globalConfigurationChanged, this, nullptr); + delete proxy_model; + delete vm_model; + + // Reset the details view and toolbar to initial state + selected_sysconfig = new VMManagerSystem(); + vm_details->reset(); + emit selectionOrStateChanged(nullptr); + + // Create the new model and proxy model + vm_model = new VMManagerModel; + proxy_model = new StringListProxyModel(this); + proxy_model->setSourceModel(vm_model); + ui->listView->setModel(proxy_model); + // Delete the old selection model + delete old_selection_model; + + // Set up the new models + proxy_model->setSortCaseSensitivity(Qt::CaseInsensitive); + ui->listView->model()->sort(0, Qt::AscendingOrder); + connect(vm_model, &VMManagerModel::systemDataChanged, this, &VMManagerMain::modelDataChange); + connect(vm_model, &VMManagerModel::globalConfigurationChanged, this, []() { + vmm_main_window->updateSettings(); + }); + const QItemSelectionModel *selection_model = ui->listView->selectionModel(); + connect(selection_model, &QItemSelectionModel::currentChanged, this, &VMManagerMain::currentSelectionChanged); + + // Update the search completer + auto *completerModel = new QStringListModel(getSearchCompletionList(), ui->searchBar->completer()); + ui->searchBar->completer()->setModel(completerModel); + + // If machines are found, set the selection to the first one + if (proxy_model->rowCount(QModelIndex()) > 0) { + const QModelIndex first_index = proxy_model->index(0, 0); + ui->listView->setCurrentIndex(first_index); + emit selectionOrStateChanged(selected_sysconfig); + } + + // Notify the status bar + emit updateStatusRight(machineCountString()); +} + void VMManagerMain::updateGlobalSettings() { diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index c8e8822ad..f313fbb04 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -61,6 +61,7 @@ signals: void updateStatusRight(const QString &text); public slots: + void reload(); void startButtonPressed() const; void settingsButtonPressed(); void restartButtonPressed() const; diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 2155799f5..378c8cbcc 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -203,10 +203,18 @@ void VMManagerMainWindow::preferencesTriggered() { bool machinesRunning = (vmm->getActiveMachineCount() > 0); + auto old_vmm_path = QString(vmm_path_cfg); const auto prefs = new VMManagerPreferences(this, machinesRunning); if (prefs->exec() == QDialog::Accepted) { emit preferencesUpdated(); updateLanguage(); + + auto new_vmm_path = QString(vmm_path_cfg); + if (!machinesRunning && (new_vmm_path != old_vmm_path)) { + qDebug() << "Machine path changed: old path " << old_vmm_path << ", new path " << new_vmm_path; + strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path)); + vmm->reload(); + } } }