mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 01:25:33 -07:00
Merge pull request #6544 from lemondrops/manager-toolbar
Manager: Toolbar and other improvements
This commit is contained in:
@@ -780,10 +780,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->actionUpdate_mouse_every_CPU_frame->setChecked(true);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true);
|
||||
ui->actionTake_screenshot->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
if (!vnc_enabled)
|
||||
video_setblit(qt_blit);
|
||||
|
||||
@@ -811,10 +807,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
mtr_stop();
|
||||
mtr_shutdown();
|
||||
};
|
||||
# ifdef Q_OS_MACOS
|
||||
ui->actionBegin_trace->setShortcutVisibleInContextMenu(true);
|
||||
ui->actionEnd_trace->setShortcutVisibleInContextMenu(true);
|
||||
# endif
|
||||
static bool trace = false;
|
||||
connect(ui->actionBegin_trace, &QAction::triggered, this, [this] {
|
||||
if (trace)
|
||||
|
||||
@@ -354,9 +354,6 @@
|
||||
<property name="text">
|
||||
<string>&Hard reset</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCtrl_Alt_Del">
|
||||
<property name="icon">
|
||||
@@ -372,12 +369,6 @@
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+F12</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCtrl_Alt_Esc">
|
||||
<property name="icon">
|
||||
@@ -387,9 +378,6 @@
|
||||
<property name="text">
|
||||
<string>Ctrl+Alt+&Esc</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPause">
|
||||
<property name="icon">
|
||||
@@ -399,9 +387,6 @@
|
||||
<property name="text">
|
||||
<string>&Pause</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
@@ -422,9 +407,6 @@
|
||||
<property name="menuRole">
|
||||
<enum>QAction::NoRole</enum>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFullscreen">
|
||||
<property name="text">
|
||||
@@ -753,9 +735,6 @@
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+F11</string>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMute_Unmute">
|
||||
<property name="text">
|
||||
@@ -833,9 +812,6 @@
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnd_trace">
|
||||
<property name="text">
|
||||
@@ -847,9 +823,6 @@
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderer_options">
|
||||
<property name="text">
|
||||
|
||||
@@ -199,6 +199,8 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig)
|
||||
disconnect(configureButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::launchSettings);
|
||||
disconnect(cadButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::cadButtonPressed);
|
||||
|
||||
disconnect(sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerDetails::onConfigUpdated);
|
||||
|
||||
sysconfig = passed_sysconfig;
|
||||
connect(resetButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::restartButtonPressed);
|
||||
connect(stopButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::shutdownForceButtonPressed);
|
||||
@@ -234,9 +236,18 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig)
|
||||
disconnect(sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerDetails::updateProcessStatus);
|
||||
connect(sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerDetails::updateProcessStatus);
|
||||
|
||||
connect(sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerDetails::onConfigUpdated);
|
||||
|
||||
updateProcessStatus();
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerDetails::onConfigUpdated(VMManagerSystem *passed_sysconfig)
|
||||
{
|
||||
updateConfig(passed_sysconfig);
|
||||
updateScreenshots(passed_sysconfig);
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,7 @@ private slots:
|
||||
void saveNotes() const;
|
||||
void nextScreenshot();
|
||||
void previousScreenshot();
|
||||
void onConfigUpdated(VMManagerSystem *passed_sysconfig);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
@@ -246,7 +246,7 @@ VMManagerListViewDelegateStyle::statusBox(const QStyleOptionViewItem &option,
|
||||
qreal
|
||||
VMManagerListViewDelegateStyle::statusFontPointSize(const QFont &f) const
|
||||
{
|
||||
return 0.75 * f.pointSize();
|
||||
return 0.9 * f.pointSize();
|
||||
// return 1*f.pointSize();
|
||||
}
|
||||
|
||||
|
||||
@@ -404,7 +404,7 @@ illegal_chars:
|
||||
ui->listView->setCurrentIndex(first_index);
|
||||
}
|
||||
|
||||
connect(ui->listView, &QListView::doubleClicked, this, &VMManagerMain::startButtonPressed);
|
||||
connect(ui->listView, &QListView::activated, this, &VMManagerMain::startButtonPressed);
|
||||
|
||||
// Load and apply settings
|
||||
loadSettings();
|
||||
@@ -423,9 +423,11 @@ illegal_chars:
|
||||
completer->setModel(completerModel);
|
||||
ui->searchBar->setCompleter(completer);
|
||||
|
||||
// Set initial status bar after the event loop starts
|
||||
QTimer::singleShot(0, this, [this] {
|
||||
// Set initial status bar after the event loop starts
|
||||
emit updateStatusRight(machineCountString());
|
||||
// Tell the mainwindow to enable the toolbar buttons if needed
|
||||
emit selectionOrStateChanged((this->proxy_model->rowCount(QModelIndex()) > 0) ? selected_sysconfig : nullptr);
|
||||
});
|
||||
|
||||
#if EMU_BUILD_NUM != 0
|
||||
@@ -456,22 +458,21 @@ VMManagerMain::currentSelectionChanged(const QModelIndex ¤t,
|
||||
if (!current.isValid())
|
||||
return;
|
||||
|
||||
/* hack to prevent strange segfaults when adding a machine after
|
||||
removing all machines previously */
|
||||
if (selected_sysconfig->config_signal_connected == true) {
|
||||
disconnect(selected_sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerMain::onConfigUpdated);
|
||||
selected_sysconfig->config_signal_connected = false;
|
||||
}
|
||||
disconnect(selected_sysconfig->process, &QProcess::stateChanged, this, &VMManagerMain::vmStateChange);
|
||||
disconnect(selected_sysconfig, &VMManagerSystem::windowStatusChanged, this, &VMManagerMain::vmStateChange);
|
||||
disconnect(selected_sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerMain::vmStateChange);
|
||||
|
||||
const auto mapped_index = proxy_model->mapToSource(current);
|
||||
selected_sysconfig = vm_model->getConfigObjectForIndex(mapped_index);
|
||||
vm_details->updateData(selected_sysconfig);
|
||||
if (selected_sysconfig->config_signal_connected == false) {
|
||||
connect(selected_sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerMain::onConfigUpdated);
|
||||
selected_sysconfig->config_signal_connected = true;
|
||||
}
|
||||
|
||||
// Emit that the selection changed, include with the process state
|
||||
emit selectionChanged(current, selected_sysconfig->process->state());
|
||||
emit selectionOrStateChanged(selected_sysconfig);
|
||||
|
||||
connect(selected_sysconfig->process, &QProcess::stateChanged, this, &VMManagerMain::vmStateChange);
|
||||
connect(selected_sysconfig, &VMManagerSystem::windowStatusChanged, this, &VMManagerMain::vmStateChange);
|
||||
connect(selected_sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerMain::vmStateChange);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -528,17 +529,13 @@ VMManagerMain::shutdownForceButtonPressed() const
|
||||
selected_sysconfig->shutdownForceButtonPressed();
|
||||
}
|
||||
|
||||
// This function doesn't appear to be needed any longer
|
||||
void
|
||||
VMManagerMain::refresh()
|
||||
VMManagerMain::cadButtonPressed() const
|
||||
{
|
||||
const auto current_index = ui->listView->currentIndex();
|
||||
emit selectionChanged(current_index, selected_sysconfig->process->state());
|
||||
if (!currentSelectionIsValid())
|
||||
return;
|
||||
|
||||
// if(!selected_sysconfig->config_file.path().isEmpty()) {
|
||||
if (!selected_sysconfig->isValid()) {
|
||||
// what was happening here?
|
||||
}
|
||||
selected_sysconfig->cadButtonPressed();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -593,12 +590,6 @@ VMManagerMain::currentSelectionIsValid() const
|
||||
return ui->listView->currentIndex().isValid() && selected_sysconfig->isValid();
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerMain::onConfigUpdated(const QString &uuid)
|
||||
{
|
||||
if (selected_sysconfig->uuid == uuid)
|
||||
vm_details->updateData(selected_sysconfig);
|
||||
}
|
||||
// Used from MainWindow during app exit to obtain and persist the current selection
|
||||
QString
|
||||
VMManagerMain::getCurrentSelection() const
|
||||
@@ -737,11 +728,14 @@ VMManagerMain::deleteSystem(VMManagerSystem *sysconfig)
|
||||
delete sysconfig;
|
||||
|
||||
if (vm_model->rowCount(QModelIndex()) <= 0) {
|
||||
selected_sysconfig = new VMManagerSystem();
|
||||
/* no machines left - get rid of the last machine's leftovers */
|
||||
ui->detailsArea->layout()->removeWidget(vm_details);
|
||||
delete vm_details;
|
||||
vm_details = new VMManagerDetails();
|
||||
ui->detailsArea->layout()->addWidget(vm_details);
|
||||
/* tell the mainwindow to disable the toolbar buttons */
|
||||
emit selectionOrStateChanged(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -815,6 +809,15 @@ VMManagerMain::modelDataChange()
|
||||
emit updateStatusRight(machineCountString(states));
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerMain::vmStateChange()
|
||||
{
|
||||
if (!currentSelectionIsValid())
|
||||
return;
|
||||
|
||||
emit selectionOrStateChanged(selected_sysconfig);
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerMain::onPreferencesUpdated()
|
||||
{
|
||||
@@ -834,6 +837,7 @@ VMManagerMain::onLanguageUpdated()
|
||||
{
|
||||
vm_model->refreshConfigs();
|
||||
modelDataChange();
|
||||
ui->searchBar->setPlaceholderText(tr("Search"));
|
||||
/* Hack to work around details widgets not being re-translatable
|
||||
without going through layers of abstraction */
|
||||
ui->detailsArea->layout()->removeWidget(vm_details);
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
Settings,
|
||||
};
|
||||
signals:
|
||||
void selectionChanged(const QModelIndex ¤tSelection, QProcess::ProcessState processState);
|
||||
void selectionOrStateChanged(VMManagerSystem *sysconfig);
|
||||
void updateStatusLeft(const QString &text);
|
||||
void updateStatusRight(const QString &text);
|
||||
|
||||
@@ -67,6 +67,7 @@ public slots:
|
||||
void pauseButtonPressed() const;
|
||||
void shutdownRequestButtonPressed() const;
|
||||
void shutdownForceButtonPressed() const;
|
||||
void cadButtonPressed() const;
|
||||
void searchSystems(const QString &text) const;
|
||||
void newMachineWizard();
|
||||
void updateGlobalSettings();
|
||||
@@ -83,7 +84,6 @@ public slots:
|
||||
#ifdef Q_OS_WINDOWS
|
||||
void onDarkModeUpdated();
|
||||
#endif
|
||||
void onConfigUpdated(const QString &uuid);
|
||||
int getActiveMachineCount();
|
||||
|
||||
QList<int> getPaneSizes() const;
|
||||
@@ -106,7 +106,6 @@ private:
|
||||
// const QItemSelection &deselected);
|
||||
void currentSelectionChanged(const QModelIndex ¤t,
|
||||
const QModelIndex &previous);
|
||||
void refresh();
|
||||
void updateDisplayName(const QModelIndex &index);
|
||||
void loadSettings();
|
||||
[[nodiscard]] bool currentSelectionIsValid() const;
|
||||
@@ -116,6 +115,7 @@ private:
|
||||
#endif
|
||||
void showTextFileContents(const QString &title, const QString &path);
|
||||
private slots:
|
||||
void vmStateChange();
|
||||
#if EMU_BUILD_NUM != 0
|
||||
void backgroundUpdateCheckComplete(const UpdateCheck::UpdateResult &result);
|
||||
void backgroundUpdateCheckError(const QString &errorMsg);
|
||||
|
||||
@@ -60,6 +60,19 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchBar">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="sizePolicy">
|
||||
@@ -76,19 +89,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchBar">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="detailsArea" native="true">
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
#include "qt_progsettings.hpp"
|
||||
#include "qt_util.hpp"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QStringListModel>
|
||||
#include <QCompleter>
|
||||
#include <QCloseEvent>
|
||||
#include <QDesktopServices>
|
||||
|
||||
@@ -49,8 +46,11 @@ VMManagerMainWindow::
|
||||
|
||||
vmm_main_window = this;
|
||||
|
||||
runIcon = QIcon(":/menuicons/qt/icons/run.ico");
|
||||
pauseIcon = QIcon(":/menuicons/qt/icons/pause.ico");
|
||||
|
||||
// Connect signals from the VMManagerMain widget
|
||||
connect(vmm, &VMManagerMain::selectionChanged, this, &VMManagerMainWindow::vmmSelectionChanged);
|
||||
connect(vmm, &VMManagerMain::selectionOrStateChanged, this, &VMManagerMainWindow::vmmStateChanged);
|
||||
|
||||
setWindowTitle(tr("%1 VM Manager").arg(EMU_NAME));
|
||||
setCentralWidget(vmm);
|
||||
@@ -61,6 +61,7 @@ VMManagerMainWindow::
|
||||
connect(ui->actionSettings, &QAction::triggered, vmm, &VMManagerMain::settingsButtonPressed);
|
||||
connect(ui->actionHard_Reset, &QAction::triggered, vmm, &VMManagerMain::restartButtonPressed);
|
||||
connect(ui->actionForce_Shutdown, &QAction::triggered, vmm, &VMManagerMain::shutdownForceButtonPressed);
|
||||
connect(ui->actionCtrl_Alt_Del, &QAction::triggered, vmm, &VMManagerMain::cadButtonPressed);
|
||||
|
||||
// Set up menu actions
|
||||
// (Disable this if the EMU_BUILD_NUM == 0)
|
||||
@@ -70,48 +71,22 @@ VMManagerMainWindow::
|
||||
connect(ui->actionCheck_for_updates, &QAction::triggered, this, &VMManagerMainWindow::checkForUpdatesTriggered);
|
||||
#endif
|
||||
|
||||
// TODO: Remove all of this (all the way to END REMOVE) once certain the search will no longer be in the toolbar.
|
||||
// BEGIN REMOVE
|
||||
// Everything is still setup here for it but it is all hidden. None of it will be
|
||||
// needed if the search stays in VMManagerMain
|
||||
ui->actionStartPause->setEnabled(true);
|
||||
ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico"));
|
||||
// Set up the toolbar
|
||||
ui->actionStartPause->setEnabled(false);
|
||||
ui->actionStartPause->setIcon(runIcon);
|
||||
ui->actionStartPause->setText(tr("Start"));
|
||||
ui->actionStartPause->setToolTip(tr("Start"));
|
||||
ui->actionHard_Reset->setEnabled(false);
|
||||
ui->actionForce_Shutdown->setEnabled(false);
|
||||
ui->actionCtrl_Alt_Del->setEnabled(false);
|
||||
ui->actionSettings->setEnabled(false);
|
||||
|
||||
const auto searchBar = new QLineEdit();
|
||||
searchBar->setMinimumWidth(150);
|
||||
searchBar->setPlaceholderText(tr("Search"));
|
||||
searchBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||
searchBar->setClearButtonEnabled(true);
|
||||
// Spacer to make the search go all the way to the right
|
||||
const auto spacer = new QWidget();
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
ui->toolBar->addWidget(spacer);
|
||||
ui->toolBar->addWidget(searchBar);
|
||||
// Connect signal for search
|
||||
connect(searchBar, &QLineEdit::textChanged, vmm, &VMManagerMain::searchSystems);
|
||||
// Preferences
|
||||
connect(ui->actionPreferences, &QAction::triggered, this, &VMManagerMainWindow::preferencesTriggered);
|
||||
|
||||
// Create a completer for the search bar
|
||||
auto *completer = new QCompleter(this);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
completer->setFilterMode(Qt::MatchContains);
|
||||
// Get the completer list
|
||||
const auto allStrings = vmm->getSearchCompletionList();
|
||||
// Set up the completer
|
||||
auto *completerModel = new QStringListModel(allStrings, completer);
|
||||
completer->setModel(completerModel);
|
||||
searchBar->setCompleter(completer);
|
||||
#ifdef Q_OS_WINDOWS
|
||||
ui->toolBar->setBackgroundRole(QPalette::Light);
|
||||
#endif
|
||||
ui->toolBar->setVisible(false);
|
||||
// END REMOVE
|
||||
|
||||
// Status bar widgets
|
||||
statusLeft->setAlignment(Qt::AlignLeft);
|
||||
@@ -131,6 +106,11 @@ VMManagerMainWindow::
|
||||
|
||||
{
|
||||
auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
ui->actionHide_tool_bar->setChecked(!!config->getStringValue("hide_tool_bar").toInt());
|
||||
if (ui->actionHide_tool_bar->isChecked())
|
||||
ui->toolBar->setVisible(false);
|
||||
else
|
||||
config->setStringValue("hide_tool_bar", "0");
|
||||
if (!!config->getStringValue("window_remember").toInt()) {
|
||||
QString coords = config->getStringValue("window_coordinates");
|
||||
if (!coords.isEmpty()) {
|
||||
@@ -176,29 +156,47 @@ VMManagerMainWindow::~VMManagerMainWindow()
|
||||
= default;
|
||||
|
||||
void
|
||||
VMManagerMainWindow::vmmSelectionChanged(const QModelIndex ¤tSelection, const QProcess::ProcessState processState) const
|
||||
VMManagerMainWindow::vmmStateChanged(const VMManagerSystem *sysconfig) const
|
||||
{
|
||||
if (processState == QProcess::Running) {
|
||||
ui->actionStartPause->setEnabled(true);
|
||||
ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/pause.ico"));
|
||||
ui->actionStartPause->setText(tr("Pause"));
|
||||
ui->actionStartPause->setToolTip(tr("Pause"));
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed);
|
||||
connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed);
|
||||
ui->actionHard_Reset->setEnabled(true);
|
||||
ui->actionForce_Shutdown->setEnabled(true);
|
||||
ui->actionCtrl_Alt_Del->setEnabled(true);
|
||||
} else {
|
||||
ui->actionStartPause->setEnabled(true);
|
||||
ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico"));
|
||||
ui->actionStartPause->setText(tr("Start"));
|
||||
ui->actionStartPause->setToolTip(tr("Start"));
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed);
|
||||
connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed);
|
||||
if (sysconfig == nullptr) {
|
||||
// This doubles both as a safety check and a way to disable
|
||||
// all machine-related buttons when no machines are present
|
||||
ui->actionStartPause->setEnabled(false);
|
||||
ui->actionSettings->setEnabled(false);
|
||||
ui->actionHard_Reset->setEnabled(false);
|
||||
ui->actionForce_Shutdown->setEnabled(false);
|
||||
ui->actionCtrl_Alt_Del->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
const bool running = sysconfig->process->state() == QProcess::ProcessState::Running;
|
||||
|
||||
if (running) {
|
||||
if (sysconfig->getProcessStatus() == VMManagerSystem::ProcessStatus::Running) {
|
||||
ui->actionStartPause->setIcon(pauseIcon);
|
||||
ui->actionStartPause->setText(tr("Pause"));
|
||||
ui->actionStartPause->setToolTip(tr("Pause"));
|
||||
} else {
|
||||
ui->actionStartPause->setIcon(runIcon);
|
||||
ui->actionStartPause->setText(tr("Continue"));
|
||||
ui->actionStartPause->setToolTip(tr("Continue"));
|
||||
}
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed);
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed);
|
||||
connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed);
|
||||
} else {
|
||||
ui->actionStartPause->setIcon(runIcon);
|
||||
ui->actionStartPause->setText(tr("Start"));
|
||||
ui->actionStartPause->setToolTip(tr("Start"));
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed);
|
||||
disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed);
|
||||
connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed);
|
||||
}
|
||||
|
||||
ui->actionStartPause->setEnabled(!sysconfig->window_obscured);
|
||||
ui->actionSettings->setEnabled(!sysconfig->window_obscured);
|
||||
ui->actionHard_Reset->setEnabled(sysconfig->window_obscured ? false : running);
|
||||
ui->actionForce_Shutdown->setEnabled(sysconfig->window_obscured ? false : running);
|
||||
ui->actionCtrl_Alt_Del->setEnabled(sysconfig->window_obscured ? false : running);
|
||||
}
|
||||
void
|
||||
VMManagerMainWindow::preferencesTriggered()
|
||||
@@ -224,6 +222,7 @@ VMManagerMainWindow::saveSettings() const
|
||||
const auto currentSelection = vmm->getCurrentSelection();
|
||||
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
config->setStringValue("last_selection", currentSelection);
|
||||
config->setStringValue("hide_tool_bar", (ui->toolBar->isVisible() ? "0" : "1"));
|
||||
if (!!config->getStringValue("window_remember").toInt()) {
|
||||
config->setStringValue("window_coordinates", QString::asprintf("%i, %i, %i, %i", this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
||||
config->setStringValue("window_maximized", this->isMaximized() ? "1" : "");
|
||||
@@ -294,6 +293,15 @@ VMManagerMainWindow::setStatusRight(const QString &text) const
|
||||
statusRight->setText(text);
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerMainWindow::on_actionHide_tool_bar_triggered()
|
||||
{
|
||||
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
int isHidden = config->getStringValue("hide_tool_bar").toInt();
|
||||
ui->toolBar->setVisible(!!isHidden);
|
||||
config->setStringValue("hide_tool_bar", (isHidden ? "0" : "1"));
|
||||
}
|
||||
|
||||
#if EMU_BUILD_NUM != 0
|
||||
void
|
||||
VMManagerMainWindow::checkForUpdatesTriggered()
|
||||
|
||||
@@ -45,6 +45,8 @@ private:
|
||||
void saveSettings() const;
|
||||
QLabel *statusLeft;
|
||||
QLabel *statusRight;
|
||||
QIcon runIcon;
|
||||
QIcon pauseIcon;
|
||||
|
||||
public slots:
|
||||
void setStatusLeft(const QString &text) const;
|
||||
@@ -55,7 +57,8 @@ public slots:
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void vmmSelectionChanged(const QModelIndex ¤tSelection, QProcess::ProcessState processState) const;
|
||||
void vmmStateChanged(const VMManagerSystem *sysconfig) const;
|
||||
void on_actionHide_tool_bar_triggered();
|
||||
void preferencesTriggered();
|
||||
#if EMU_BUILD_NUM != 0
|
||||
void checkForUpdatesTriggered();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>86Box VM Manager</string>
|
||||
<string notr="true">86Box VM Manager</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
@@ -23,6 +23,9 @@
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::PreventContextMenu</enum>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuTools">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
@@ -38,6 +41,12 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
<addaction name="actionHide_tool_bar"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
@@ -47,6 +56,7 @@
|
||||
<addaction name="actionAbout_Qt"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
@@ -56,22 +66,25 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
<string notr="true">toolBar</string>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::PreventContextMenu</enum>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::TopToolBarArea</set>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonIconOnly</enum>
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
@@ -88,9 +101,6 @@
|
||||
<addaction name="actionSettings"/>
|
||||
</widget>
|
||||
<action name="actionStartPause">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/qt/icons/run.ico</normaloff>:/menuicons/qt/icons/run.ico</iconset>
|
||||
@@ -101,9 +111,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHard_Reset">
|
||||
<property name="icon">
|
||||
@@ -116,9 +123,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Hard reset</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionForce_Shutdown">
|
||||
<property name="enabled">
|
||||
@@ -137,9 +141,6 @@
|
||||
<property name="visible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCtrl_Alt_Del">
|
||||
<property name="enabled">
|
||||
@@ -156,13 +157,7 @@
|
||||
<string>Ctrl+Alt+Del</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSettings">
|
||||
@@ -179,14 +174,11 @@
|
||||
<property name="menuRole">
|
||||
<enum>QAction::NoRole</enum>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Machine">
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/settings/qt/icons/86Box-yellow.ico</normaloff>:/settings/qt/icons/86Box-yellow.ico</iconset>
|
||||
<normaloff>:/menuicons/qt/icons/new_vm.ico</normaloff>:/menuicons/qt/icons/new_vm.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New machine...</string>
|
||||
@@ -195,6 +187,17 @@
|
||||
<string>New machine...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHide_tool_bar">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide &toolbar</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Hide tool bar</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreferences">
|
||||
<property name="text">
|
||||
<string>&Preferences...</string>
|
||||
@@ -206,21 +209,6 @@
|
||||
<enum>QAction::PreferencesRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStart">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/menuicons/qt/icons/run.ico</normaloff>:/menuicons/qt/icons/run.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Start</string>
|
||||
</property>
|
||||
<property name="iconVisibleInMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheck_for_updates">
|
||||
<property name="text">
|
||||
<string>&Check for updates...</string>
|
||||
|
||||
@@ -305,15 +305,13 @@ void
|
||||
VMManagerSystem::generateSearchTerms()
|
||||
{
|
||||
searchTerms.clear();
|
||||
for (const auto &config_key : config_hash.keys()) {
|
||||
// searchTerms.append(config_hash[config_key].values());
|
||||
// brute force temporarily don't add paths
|
||||
for (const auto &value : config_hash[config_key].values()) {
|
||||
if (!value.startsWith("/"))
|
||||
searchTerms.append(value);
|
||||
}
|
||||
}
|
||||
searchTerms.append(display_table.values());
|
||||
#if 0
|
||||
for (const auto &value : display_table.values())
|
||||
if (value.contains(";"))
|
||||
searchTerms.append(value.split(';'));
|
||||
else
|
||||
searchTerms.append(value);
|
||||
#endif
|
||||
searchTerms.append(displayName);
|
||||
searchTerms.append(config_name);
|
||||
QRegularExpression whitespaceRegex("\\s+");
|
||||
@@ -440,14 +438,17 @@ VMManagerSystem::launchMainProcess()
|
||||
process->start();
|
||||
updateTimestamp();
|
||||
|
||||
disconnect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), nullptr, nullptr);
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
[=](const int exitCode, const QProcess::ExitStatus exitStatus) {
|
||||
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
||||
qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus;
|
||||
QMessageBox::critical(this, tr("Virtual machine crash"),
|
||||
tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString::number(exitCode)));
|
||||
tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString("%1 (0x%2)").arg(QString::number(exitCode), QString::number(exitCode, 16))));
|
||||
return;
|
||||
}
|
||||
|
||||
configurationChangeReceived();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -501,6 +502,7 @@ VMManagerSystem::launchSettings()
|
||||
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
|
||||
process->start();
|
||||
|
||||
disconnect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), nullptr, nullptr);
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
[=](const int exitCode, const QProcess::ExitStatus exitStatus) {
|
||||
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
||||
@@ -1239,8 +1241,9 @@ void
|
||||
VMManagerSystem::configurationChangeReceived()
|
||||
{
|
||||
reloadConfig();
|
||||
emit configurationChanged(this->uuid);
|
||||
emit configurationChanged(this);
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerSystem::reloadConfig()
|
||||
{
|
||||
|
||||
@@ -138,7 +138,6 @@ public:
|
||||
QProcess *process = new QProcess();
|
||||
|
||||
bool window_obscured;
|
||||
bool config_signal_connected = false;
|
||||
|
||||
QString getDisplayValue(VMManager::Display::Name key);
|
||||
QFileInfoList getScreenshots();
|
||||
@@ -158,7 +157,7 @@ signals:
|
||||
void windowStatusChanged();
|
||||
void itemDataChanged();
|
||||
void clientProcessStatusChanged();
|
||||
void configurationChanged(const QString &uuid);
|
||||
void configurationChanged(VMManagerSystem *sysconfig);
|
||||
void globalConfigurationChanged();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user