Reflect language and color scheme changes in global config in manager and all its VMs
This commit is contained in:
@@ -515,6 +515,10 @@ main_thread_fn()
|
|||||||
|
|
||||||
static std::thread *main_thread;
|
static std::thread *main_thread;
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
WindowsDarkModeFilter* vmm_dark_mode_filter = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -657,6 +661,8 @@ main(int argc, char *argv[])
|
|||||||
const auto vmm_main_window = new VMManagerMainWindow();
|
const auto vmm_main_window = new VMManagerMainWindow();
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
darkModeFilter.get()->setWindow(vmm_main_window);
|
darkModeFilter.get()->setWindow(vmm_main_window);
|
||||||
|
// HACK
|
||||||
|
vmm_dark_mode_filter = darkModeFilter.get();
|
||||||
#endif
|
#endif
|
||||||
vmm_main_window->show();
|
vmm_main_window->show();
|
||||||
});
|
});
|
||||||
@@ -843,6 +849,7 @@ main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
QObject::connect(main_window, &MainWindow::vmmRunningStateChanged, &manager_socket, &VMManagerClientSocket::clientRunningStateChanged);
|
QObject::connect(main_window, &MainWindow::vmmRunningStateChanged, &manager_socket, &VMManagerClientSocket::clientRunningStateChanged);
|
||||||
QObject::connect(main_window, &MainWindow::vmmConfigurationChanged, &manager_socket, &VMManagerClientSocket::configurationChanged);
|
QObject::connect(main_window, &MainWindow::vmmConfigurationChanged, &manager_socket, &VMManagerClientSocket::configurationChanged);
|
||||||
|
QObject::connect(main_window, &MainWindow::vmmGlobalConfigurationChanged, &manager_socket, &VMManagerClientSocket::globalConfigurationChanged);
|
||||||
main_window->installEventFilter(&manager_socket);
|
main_window->installEventFilter(&manager_socket);
|
||||||
|
|
||||||
manager_socket.sendWinIdMessage(main_window->winId());
|
manager_socket.sendWinIdMessage(main_window->winId());
|
||||||
|
|||||||
@@ -2244,7 +2244,9 @@ void
|
|||||||
MainWindow::on_actionPreferences_triggered()
|
MainWindow::on_actionPreferences_triggered()
|
||||||
{
|
{
|
||||||
ProgSettings progsettings(this);
|
ProgSettings progsettings(this);
|
||||||
progsettings.exec();
|
if (progsettings.exec() == QDialog::Accepted) {
|
||||||
|
emit vmmGlobalConfigurationChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ signals:
|
|||||||
|
|
||||||
void vmmRunningStateChanged(VMManagerProtocol::RunningState state);
|
void vmmRunningStateChanged(VMManagerProtocol::RunningState state);
|
||||||
void vmmConfigurationChanged();
|
void vmmConfigurationChanged();
|
||||||
|
void vmmGlobalConfigurationChanged();
|
||||||
public slots:
|
public slots:
|
||||||
void showSettings();
|
void showSettings();
|
||||||
void hardReset();
|
void hardReset();
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ ProgSettings::accept()
|
|||||||
connect(main_window, &MainWindow::updateStatusBarTip, main_window->status.get(), &MachineStatus::updateTip);
|
connect(main_window, &MainWindow::updateStatusBarTip, main_window->status.get(), &MachineStatus::updateTip);
|
||||||
connect(main_window, &MainWindow::statusBarMessage, main_window->status.get(), &MachineStatus::message, Qt::QueuedConnection);
|
connect(main_window, &MainWindow::statusBarMessage, main_window->status.get(), &MachineStatus::message, Qt::QueuedConnection);
|
||||||
mouse_sensitivity = mouseSensitivity;
|
mouse_sensitivity = mouseSensitivity;
|
||||||
|
config_save_global();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "86box/plat.h"
|
#include "86box/plat.h"
|
||||||
|
#include "86box/config.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
VMManagerClientSocket::VMManagerClientSocket(QObject* obj) : server_connected(false)
|
VMManagerClientSocket::VMManagerClientSocket(QObject* obj) : server_connected(false)
|
||||||
@@ -183,6 +184,15 @@ VMManagerClientSocket::jsonReceived(const QJsonObject &json)
|
|||||||
case VMManagerProtocol::ManagerMessage::RequestStatus:
|
case VMManagerProtocol::ManagerMessage::RequestStatus:
|
||||||
qDebug("Status request command received from manager");
|
qDebug("Status request command received from manager");
|
||||||
break;
|
break;
|
||||||
|
case VMManagerProtocol::ManagerMessage::GlobalConfigurationChanged:
|
||||||
|
{
|
||||||
|
config_load_global();
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
void selectDarkMode();
|
||||||
|
selectDarkMode();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
qDebug("Unknown client message type received:");
|
qDebug("Unknown client message type received:");
|
||||||
qDebug() << json;
|
qDebug() << json;
|
||||||
@@ -248,6 +258,12 @@ VMManagerClientSocket::clientRunningStateChanged(VMManagerProtocol::RunningState
|
|||||||
sendMessageWithObject(VMManagerProtocol::ClientMessage::RunningStateChanged, extra_object);
|
sendMessageWithObject(VMManagerProtocol::ClientMessage::RunningStateChanged, extra_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerClientSocket::globalConfigurationChanged() const
|
||||||
|
{
|
||||||
|
sendMessage(VMManagerProtocol::ClientMessage::GlobalConfigurationChanged);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerClientSocket::configurationChanged() const
|
VMManagerClientSocket::configurationChanged() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void clientRunningStateChanged(VMManagerProtocol::RunningState state) const;
|
void clientRunningStateChanged(VMManagerProtocol::RunningState state) const;
|
||||||
void configurationChanged() const;
|
void configurationChanged() const;
|
||||||
|
void globalConfigurationChanged() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString server_name;
|
QString server_name;
|
||||||
|
|||||||
@@ -31,10 +31,13 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include "qt_vmmanager_main.hpp"
|
#include "qt_vmmanager_main.hpp"
|
||||||
|
#include "qt_vmmanager_mainwindow.hpp"
|
||||||
#include "ui_qt_vmmanager_main.h"
|
#include "ui_qt_vmmanager_main.h"
|
||||||
#include "qt_vmmanager_model.hpp"
|
#include "qt_vmmanager_model.hpp"
|
||||||
#include "qt_vmmanager_addmachine.hpp"
|
#include "qt_vmmanager_addmachine.hpp"
|
||||||
|
|
||||||
|
extern VMManagerMainWindow* vmm_main_window;
|
||||||
|
|
||||||
// https://stackoverflow.com/a/36460740
|
// https://stackoverflow.com/a/36460740
|
||||||
bool copyPath(QString sourceDir, QString destinationDir, bool overWriteDirectory)
|
bool copyPath(QString sourceDir, QString destinationDir, bool overWriteDirectory)
|
||||||
{
|
{
|
||||||
@@ -348,6 +351,10 @@ illegal_chars:
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(vm_model, &VMManagerModel::globalConfigurationChanged, this, [this] () {
|
||||||
|
vmm_main_window->updateSettings();
|
||||||
|
});
|
||||||
|
|
||||||
// Initial default details view
|
// Initial default details view
|
||||||
vm_details = new VMManagerDetails(ui->detailsArea);
|
vm_details = new VMManagerDetails(ui->detailsArea);
|
||||||
ui->detailsArea->layout()->addWidget(vm_details);
|
ui->detailsArea->layout()->addWidget(vm_details);
|
||||||
@@ -400,6 +407,12 @@ VMManagerMain::~VMManagerMain() {
|
|||||||
delete vm_model;
|
delete vm_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerMain::updateGlobalSettings()
|
||||||
|
{
|
||||||
|
vmm_main_window->updateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerMain::currentSelectionChanged(const QModelIndex ¤t,
|
VMManagerMain::currentSelectionChanged(const QModelIndex ¤t,
|
||||||
const QModelIndex &previous)
|
const QModelIndex &previous)
|
||||||
@@ -768,6 +781,10 @@ VMManagerMain::onPreferencesUpdated()
|
|||||||
if (oldRegexSearch != regexSearch) {
|
if (oldRegexSearch != regexSearch) {
|
||||||
ui->searchBar->clear();
|
ui->searchBar->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm_model) {
|
||||||
|
vm_model->sendGlobalConfigurationChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public slots:
|
|||||||
void shutdownForceButtonPressed() const;
|
void shutdownForceButtonPressed() const;
|
||||||
void searchSystems(const QString &text) const;
|
void searchSystems(const QString &text) const;
|
||||||
void newMachineWizard();
|
void newMachineWizard();
|
||||||
|
void updateGlobalSettings();
|
||||||
void deleteSystem(VMManagerSystem *sysconfig);
|
void deleteSystem(VMManagerSystem *sysconfig);
|
||||||
void addNewSystem(const QString &name, const QString &dir, const QString &displayName = QString(), const QString &configFile = {});
|
void addNewSystem(const QString &name, const QString &dir, const QString &displayName = QString(), const QString &configFile = {});
|
||||||
#if __GNUC__ >= 11
|
#if __GNUC__ >= 11
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "qt_vmmanager_mainwindow.hpp"
|
#include "qt_vmmanager_mainwindow.hpp"
|
||||||
#include "qt_vmmanager_main.hpp"
|
#include "qt_vmmanager_main.hpp"
|
||||||
#include "qt_vmmanager_preferences.hpp"
|
#include "qt_vmmanager_preferences.hpp"
|
||||||
|
#include "qt_vmmanager_windarkmodefilter.hpp"
|
||||||
#include "ui_qt_vmmanager_mainwindow.h"
|
#include "ui_qt_vmmanager_mainwindow.h"
|
||||||
#if EMU_BUILD_NUM != 0
|
#if EMU_BUILD_NUM != 0
|
||||||
# include "qt_updatecheckdialog.hpp"
|
# include "qt_updatecheckdialog.hpp"
|
||||||
@@ -32,6 +33,15 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
extern void config_load_global();
|
||||||
|
extern void config_save_global();
|
||||||
|
}
|
||||||
|
|
||||||
|
VMManagerMainWindow* vmm_main_window = nullptr;
|
||||||
|
extern WindowsDarkModeFilter* vmm_dark_mode_filter;
|
||||||
|
|
||||||
VMManagerMainWindow::
|
VMManagerMainWindow::
|
||||||
VMManagerMainWindow(QWidget *parent)
|
VMManagerMainWindow(QWidget *parent)
|
||||||
: ui(new Ui::VMManagerMainWindow)
|
: ui(new Ui::VMManagerMainWindow)
|
||||||
@@ -41,6 +51,8 @@ VMManagerMainWindow(QWidget *parent)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
vmm_main_window = this;
|
||||||
|
|
||||||
// Connect signals from the VMManagerMain widget
|
// Connect signals from the VMManagerMain widget
|
||||||
connect(vmm, &VMManagerMain::selectionChanged, this, &VMManagerMainWindow::vmmSelectionChanged);
|
connect(vmm, &VMManagerMain::selectionChanged, this, &VMManagerMainWindow::vmmSelectionChanged);
|
||||||
|
|
||||||
@@ -118,6 +130,7 @@ VMManagerMainWindow(QWidget *parent)
|
|||||||
connect(this, &VMManagerMainWindow::languageUpdated, vmm, &VMManagerMain::onLanguageUpdated);
|
connect(this, &VMManagerMainWindow::languageUpdated, vmm, &VMManagerMain::onLanguageUpdated);
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
connect(this, &VMManagerMainWindow::darkModeUpdated, vmm, &VMManagerMain::onDarkModeUpdated);
|
connect(this, &VMManagerMainWindow::darkModeUpdated, vmm, &VMManagerMain::onDarkModeUpdated);
|
||||||
|
connect(this, &VMManagerMainWindow::preferencesUpdated, [this] () { vmm_dark_mode_filter->reselectDarkMode(); });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -187,6 +200,14 @@ VMManagerMainWindow::preferencesTriggered()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerMainWindow::updateSettings()
|
||||||
|
{
|
||||||
|
config_load_global();
|
||||||
|
emit preferencesUpdated();
|
||||||
|
updateLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerMainWindow::saveSettings() const
|
VMManagerMainWindow::saveSettings() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class VMManagerMainWindow final : public QMainWindow
|
|||||||
public:
|
public:
|
||||||
explicit VMManagerMainWindow(QWidget *parent = nullptr);
|
explicit VMManagerMainWindow(QWidget *parent = nullptr);
|
||||||
~VMManagerMainWindow() override;
|
~VMManagerMainWindow() override;
|
||||||
|
void updateSettings();
|
||||||
signals:
|
signals:
|
||||||
void preferencesUpdated();
|
void preferencesUpdated();
|
||||||
void languageUpdated();
|
void languageUpdated();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ VMManagerModel::VMManagerModel() {
|
|||||||
for ( const auto& each_config : machines_vec) {
|
for ( const auto& each_config : machines_vec) {
|
||||||
machines.append(each_config);
|
machines.append(each_config);
|
||||||
connect(each_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
|
connect(each_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
|
||||||
|
connect(each_config, &VMManagerSystem::globalConfigurationChanged, this, &VMManagerModel::globalConfigurationChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ VMManagerModel::addConfigToModel(VMManagerSystem *system_config)
|
|||||||
beginInsertRows(QModelIndex(), this->rowCount(QModelIndex()), this->rowCount(QModelIndex()));
|
beginInsertRows(QModelIndex(), this->rowCount(QModelIndex()), this->rowCount(QModelIndex()));
|
||||||
machines.append(system_config);
|
machines.append(system_config);
|
||||||
connect(system_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
|
connect(system_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
|
||||||
|
connect(system_config, &VMManagerSystem::globalConfigurationChanged, this, &VMManagerModel::globalConfigurationChanged);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +179,16 @@ VMManagerModel::getProcessStats()
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerModel::sendGlobalConfigurationChanged()
|
||||||
|
{
|
||||||
|
for (auto& system: machines) {
|
||||||
|
if (system->getProcessStatus() != VMManagerSystem::ProcessStatus::Stopped) {
|
||||||
|
system->sendGlobalConfigurationChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
VMManagerModel::getActiveMachineCount()
|
VMManagerModel::getActiveMachineCount()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,8 +60,10 @@ public:
|
|||||||
QMap<VMManagerSystem::ProcessStatus, int> getProcessStats();
|
QMap<VMManagerSystem::ProcessStatus, int> getProcessStats();
|
||||||
int getActiveMachineCount();
|
int getActiveMachineCount();
|
||||||
void refreshConfigs();
|
void refreshConfigs();
|
||||||
|
void sendGlobalConfigurationChanged();
|
||||||
signals:
|
signals:
|
||||||
void systemDataChanged();
|
void systemDataChanged();
|
||||||
|
void globalConfigurationChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<VMManagerSystem *> machines;
|
QVector<VMManagerSystem *> machines;
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
#include "qt_vmmanager_config.hpp"
|
#include "qt_vmmanager_config.hpp"
|
||||||
#include "ui_qt_vmmanager_preferences.h"
|
#include "ui_qt_vmmanager_preferences.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
#include "qt_vmmanager_windarkmodefilter.hpp"
|
||||||
|
extern WindowsDarkModeFilter* vmm_dark_mode_filter;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
#include <86box/config.h>
|
#include <86box/config.h>
|
||||||
@@ -66,7 +71,13 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences)
|
|||||||
const auto useRegexSearch = config->getStringValue("regex_search").toInt();
|
const auto useRegexSearch = config->getStringValue("regex_search").toInt();
|
||||||
ui->regexSearchCheckBox->setChecked(useRegexSearch);
|
ui->regexSearchCheckBox->setChecked(useRegexSearch);
|
||||||
|
|
||||||
|
ui->radioButtonSystem->setChecked(color_scheme == 0);
|
||||||
|
ui->radioButtonLight->setChecked(color_scheme == 1);
|
||||||
|
ui->radioButtonDark->setChecked(color_scheme == 2);
|
||||||
|
|
||||||
|
#ifndef Q_OS_WINDOWS
|
||||||
|
ui->groupBoxColorScheme->setHidden(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VMManagerPreferences::~
|
VMManagerPreferences::~
|
||||||
@@ -95,6 +106,7 @@ VMManagerPreferences::accept()
|
|||||||
|
|
||||||
strncpy(vmm_path_cfg, QDir::cleanPath(ui->systemDirectory->text()).toUtf8().constData(), sizeof(vmm_path_cfg) - 1);
|
strncpy(vmm_path_cfg, QDir::cleanPath(ui->systemDirectory->text()).toUtf8().constData(), sizeof(vmm_path_cfg) - 1);
|
||||||
lang_id = ui->comboBoxLanguage->currentData().toInt();
|
lang_id = ui->comboBoxLanguage->currentData().toInt();
|
||||||
|
color_scheme = (ui->radioButtonSystem->isChecked()) ? 0 : (ui->radioButtonLight->isChecked() ? 1 : 2);
|
||||||
config_save_global();
|
config_save_global();
|
||||||
|
|
||||||
#if EMU_BUILD_NUM != 0
|
#if EMU_BUILD_NUM != 0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>475</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -103,10 +103,40 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxColorScheme">
|
||||||
|
<property name="title">
|
||||||
|
<string>Color scheme</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonSystem">
|
||||||
|
<property name="text">
|
||||||
|
<string>System</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Light</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonDark">
|
||||||
|
<property name="text">
|
||||||
|
<string>Dark</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -119,10 +149,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ VMManagerProtocol::getClientMessageType(const QJsonObject &json_document)
|
|||||||
return VMManagerProtocol::ClientMessage::ConfigurationChanged;
|
return VMManagerProtocol::ClientMessage::ConfigurationChanged;
|
||||||
} else if (message_type == "WinIdMessage") {
|
} else if (message_type == "WinIdMessage") {
|
||||||
return VMManagerProtocol::ClientMessage::WinIdMessage;
|
return VMManagerProtocol::ClientMessage::WinIdMessage;
|
||||||
|
} else if (message_type == "GlobalConfigurationChanged") {
|
||||||
|
return VMManagerProtocol::ClientMessage::GlobalConfigurationChanged;
|
||||||
}
|
}
|
||||||
return VMManagerProtocol::ClientMessage::UnknownMessage;
|
return VMManagerProtocol::ClientMessage::UnknownMessage;
|
||||||
}
|
}
|
||||||
@@ -119,6 +121,8 @@ VMManagerProtocol::getManagerMessageType(const QJsonObject &json_document)
|
|||||||
return VMManagerProtocol::ManagerMessage::RequestShutdown;
|
return VMManagerProtocol::ManagerMessage::RequestShutdown;
|
||||||
} if (message_type == "ForceShutdown") {
|
} if (message_type == "ForceShutdown") {
|
||||||
return VMManagerProtocol::ManagerMessage::ForceShutdown;
|
return VMManagerProtocol::ManagerMessage::ForceShutdown;
|
||||||
|
} if (message_type == "GlobalConfigurationChanged") {
|
||||||
|
return VMManagerProtocol::ManagerMessage::GlobalConfigurationChanged;
|
||||||
}
|
}
|
||||||
return VMManagerProtocol::ManagerMessage::UnknownMessage;
|
return VMManagerProtocol::ManagerMessage::UnknownMessage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
ResetVM,
|
ResetVM,
|
||||||
RequestShutdown,
|
RequestShutdown,
|
||||||
ForceShutdown,
|
ForceShutdown,
|
||||||
|
GlobalConfigurationChanged,
|
||||||
UnknownMessage,
|
UnknownMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@ public:
|
|||||||
RunningStateChanged,
|
RunningStateChanged,
|
||||||
ConfigurationChanged,
|
ConfigurationChanged,
|
||||||
WinIdMessage,
|
WinIdMessage,
|
||||||
|
GlobalConfigurationChanged,
|
||||||
UnknownMessage,
|
UnknownMessage,
|
||||||
};
|
};
|
||||||
Q_ENUM(ClientMessage);
|
Q_ENUM(ClientMessage);
|
||||||
|
|||||||
@@ -189,6 +189,10 @@ VMManagerServerSocket::jsonReceived(const QJsonObject &json)
|
|||||||
qDebug("Configuration change received from client");
|
qDebug("Configuration change received from client");
|
||||||
emit configurationChanged();
|
emit configurationChanged();
|
||||||
break;
|
break;
|
||||||
|
case VMManagerProtocol::ClientMessage::GlobalConfigurationChanged:
|
||||||
|
qDebug("Global configuration change received from client");
|
||||||
|
emit globalConfigurationChanged();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug("Unknown client message type received:");
|
qDebug("Unknown client message type received:");
|
||||||
qDebug() << json;
|
qDebug() << json;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ signals:
|
|||||||
void windowStatusChanged(int status);
|
void windowStatusChanged(int status);
|
||||||
void runningStatusChanged(VMManagerProtocol::RunningState state);
|
void runningStatusChanged(VMManagerProtocol::RunningState state);
|
||||||
void configurationChanged();
|
void configurationChanged();
|
||||||
|
void globalConfigurationChanged();
|
||||||
void winIdReceived(WId id);
|
void winIdReceived(WId id);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@ VMManagerSystem::startServer() {
|
|||||||
connect(socket_server, &VMManagerServerSocket::windowStatusChanged, this, &VMManagerSystem::windowStatusChangeReceived);
|
connect(socket_server, &VMManagerServerSocket::windowStatusChanged, this, &VMManagerSystem::windowStatusChangeReceived);
|
||||||
connect(socket_server, &VMManagerServerSocket::runningStatusChanged, this, &VMManagerSystem::runningStatusChangeReceived);
|
connect(socket_server, &VMManagerServerSocket::runningStatusChanged, this, &VMManagerSystem::runningStatusChangeReceived);
|
||||||
connect(socket_server, &VMManagerServerSocket::configurationChanged, this, &VMManagerSystem::configurationChangeReceived);
|
connect(socket_server, &VMManagerServerSocket::configurationChanged, this, &VMManagerSystem::configurationChangeReceived);
|
||||||
|
connect(socket_server, &VMManagerServerSocket::globalConfigurationChanged, this, &VMManagerSystem::globalConfigurationChanged);
|
||||||
connect(socket_server, &VMManagerServerSocket::winIdReceived, this, [this] (WId id) { this->id = id; });
|
connect(socket_server, &VMManagerServerSocket::winIdReceived, this, [this] (WId id) { this->id = id; });
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1124,6 +1125,12 @@ VMManagerSystem::getDisplayValue(Display::Name key)
|
|||||||
return (display_table.contains(key)) ? display_table[key] : "";
|
return (display_table.contains(key)) ? display_table[key] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerSystem::sendGlobalConfigurationChanged()
|
||||||
|
{
|
||||||
|
socket_server->serverSendMessage(VMManagerProtocol::ManagerMessage::GlobalConfigurationChanged);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerSystem::shutdownRequestButtonPressed()
|
VMManagerSystem::shutdownRequestButtonPressed()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public slots:
|
|||||||
void shutdownForceButtonPressed();
|
void shutdownForceButtonPressed();
|
||||||
void cadButtonPressed();
|
void cadButtonPressed();
|
||||||
void reloadConfig();
|
void reloadConfig();
|
||||||
|
void sendGlobalConfigurationChanged();
|
||||||
public:
|
public:
|
||||||
QDateTime timestamp();
|
QDateTime timestamp();
|
||||||
void setIcon(const QString &newIcon);
|
void setIcon(const QString &newIcon);
|
||||||
@@ -157,6 +158,7 @@ signals:
|
|||||||
void itemDataChanged();
|
void itemDataChanged();
|
||||||
void clientProcessStatusChanged();
|
void clientProcessStatusChanged();
|
||||||
void configurationChanged(const QString &uuid);
|
void configurationChanged(const QString &uuid);
|
||||||
|
void globalConfigurationChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|||||||
@@ -38,6 +38,48 @@
|
|||||||
|
|
||||||
static bool NewDarkMode = FALSE;
|
static bool NewDarkMode = FALSE;
|
||||||
|
|
||||||
|
void
|
||||||
|
WindowsDarkModeFilter::reselectDarkMode()
|
||||||
|
{
|
||||||
|
bool OldDarkMode = NewDarkMode;
|
||||||
|
|
||||||
|
if (!util::isWindowsLightTheme()) {
|
||||||
|
QFile f(":qdarkstyle/dark/darkstyle.qss");
|
||||||
|
|
||||||
|
if (!f.exists())
|
||||||
|
printf("Unable to set stylesheet, file not found\n");
|
||||||
|
else {
|
||||||
|
f.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
QTextStream ts(&f);
|
||||||
|
qApp->setStyleSheet(ts.readAll());
|
||||||
|
}
|
||||||
|
QPalette palette(qApp->palette());
|
||||||
|
palette.setColor(QPalette::Link, Qt::white);
|
||||||
|
palette.setColor(QPalette::LinkVisited, Qt::lightGray);
|
||||||
|
qApp->setPalette(palette);
|
||||||
|
window->resize(window->size());
|
||||||
|
|
||||||
|
NewDarkMode = TRUE;
|
||||||
|
} else {
|
||||||
|
qApp->setStyleSheet("");
|
||||||
|
QPalette palette(qApp->palette());
|
||||||
|
palette.setColor(QPalette::Link, Qt::blue);
|
||||||
|
palette.setColor(QPalette::LinkVisited, Qt::magenta);
|
||||||
|
qApp->setPalette(palette);
|
||||||
|
window->resize(window->size());
|
||||||
|
NewDarkMode = FALSE;
|
||||||
|
}
|
||||||
|
window->updateDarkMode();
|
||||||
|
|
||||||
|
if (NewDarkMode != OldDarkMode) QTimer::singleShot(1000, [this] () {
|
||||||
|
BOOL DarkMode = NewDarkMode;
|
||||||
|
DwmSetWindowAttribute((HWND) window->winId(),
|
||||||
|
DWMWA_USE_IMMERSIVE_DARK_MODE,
|
||||||
|
(LPCVOID) &DarkMode,
|
||||||
|
sizeof(DarkMode));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowsDarkModeFilter::setWindow(VMManagerMainWindow *window)
|
WindowsDarkModeFilter::setWindow(VMManagerMainWindow *window)
|
||||||
{
|
{
|
||||||
@@ -54,44 +96,7 @@ WindowsDarkModeFilter::nativeEventFilter(const QByteArray &eventType, void *mess
|
|||||||
if ((((void *) msg->lParam) != nullptr) &&
|
if ((((void *) msg->lParam) != nullptr) &&
|
||||||
(wcscmp(L"ImmersiveColorSet", (wchar_t*)msg->lParam) == 0) &&
|
(wcscmp(L"ImmersiveColorSet", (wchar_t*)msg->lParam) == 0) &&
|
||||||
color_scheme == 0) {
|
color_scheme == 0) {
|
||||||
|
reselectDarkMode();
|
||||||
bool OldDarkMode = NewDarkMode;
|
|
||||||
|
|
||||||
if (!util::isWindowsLightTheme()) {
|
|
||||||
QFile f(":qdarkstyle/dark/darkstyle.qss");
|
|
||||||
|
|
||||||
if (!f.exists())
|
|
||||||
printf("Unable to set stylesheet, file not found\n");
|
|
||||||
else {
|
|
||||||
f.open(QFile::ReadOnly | QFile::Text);
|
|
||||||
QTextStream ts(&f);
|
|
||||||
qApp->setStyleSheet(ts.readAll());
|
|
||||||
}
|
|
||||||
QPalette palette(qApp->palette());
|
|
||||||
palette.setColor(QPalette::Link, Qt::white);
|
|
||||||
palette.setColor(QPalette::LinkVisited, Qt::lightGray);
|
|
||||||
qApp->setPalette(palette);
|
|
||||||
window->resize(window->size());
|
|
||||||
|
|
||||||
NewDarkMode = TRUE;
|
|
||||||
} else {
|
|
||||||
qApp->setStyleSheet("");
|
|
||||||
QPalette palette(qApp->palette());
|
|
||||||
palette.setColor(QPalette::Link, Qt::blue);
|
|
||||||
palette.setColor(QPalette::LinkVisited, Qt::magenta);
|
|
||||||
qApp->setPalette(palette);
|
|
||||||
window->resize(window->size());
|
|
||||||
NewDarkMode = FALSE;
|
|
||||||
}
|
|
||||||
window->updateDarkMode();
|
|
||||||
|
|
||||||
if (NewDarkMode != OldDarkMode) QTimer::singleShot(1000, [this] () {
|
|
||||||
BOOL DarkMode = NewDarkMode;
|
|
||||||
DwmSetWindowAttribute((HWND) window->winId(),
|
|
||||||
DWMWA_USE_IMMERSIVE_DARK_MODE,
|
|
||||||
(LPCVOID) &DarkMode,
|
|
||||||
sizeof(DarkMode));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
WindowsDarkModeFilter() = default;
|
WindowsDarkModeFilter() = default;
|
||||||
void setWindow(VMManagerMainWindow *window);
|
void setWindow(VMManagerMainWindow *window);
|
||||||
bool nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) override;
|
bool nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) override;
|
||||||
|
void reselectDarkMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VMManagerMainWindow *window;
|
VMManagerMainWindow *window;
|
||||||
|
|||||||
Reference in New Issue
Block a user