mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
Manager: Reload VMs if the system directory has been changed
This commit is contained in:
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3080,3 +3080,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3025,3 +3025,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3024,3 +3024,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3024,3 +3024,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3024,3 +3024,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3036,3 +3036,6 @@ msgstr "П&еремотка вперёд"
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr "Перемотка вперёд"
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr "Чтобы изменить системную папку, остановите все запущенные машины."
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3025,3 +3025,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3023,3 +3023,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3025,3 +3025,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr ""
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr ""
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3017,3 +3017,6 @@ msgstr "快进(&F)"
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr "快进"
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -3024,3 +3024,6 @@ msgstr "快轉(&F)"
|
||||
|
||||
msgid "Fast forward"
|
||||
msgstr "快轉"
|
||||
|
||||
msgid "To change the system directory, stop all running machines."
|
||||
msgstr ""
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ signals:
|
||||
void updateStatusRight(const QString &text);
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
void startButtonPressed() const;
|
||||
void settingsButtonPressed();
|
||||
void restartButtonPressed() const;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user