mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
refactor(ui): add WinUI stylesheet for Windows
- Introduced WinToolWidget for custom window management on Windows. - Implemented backdrop type settings for Windows in SettingsManager. - Enhanced SettingsWidget to allow selection of backdrop type. - Improved status balloon and toolbox widget styles for Windows. - Refined tab widget animations and styles for better visual feedback. - Fixed issues with loading and error widgets in ZLoadingWidget. - Updated welcome widget to support custom hyperlink colors. - General code cleanup and style adjustments across multiple files.
This commit is contained in:
+62
-4
@@ -37,14 +37,23 @@
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#ifdef WIN32
|
||||
#include "platform/windows/win_common.h"
|
||||
#include <QOperatingSystemVersion>
|
||||
#endif
|
||||
|
||||
SettingsWidget::SettingsWidget(QWidget *parent) : QDialog{parent}
|
||||
{
|
||||
#ifdef WIN32
|
||||
m_backDropTypeCombo = nullptr;
|
||||
#endif
|
||||
setupUI();
|
||||
loadSettings();
|
||||
connectSignals();
|
||||
// due to scrollbar add 10px on windows
|
||||
#ifdef WIN32
|
||||
resize(sizeHint().width() + 10, sizeHint().height());
|
||||
setupWinWindow(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -113,7 +122,26 @@ void SettingsWidget::setupUI()
|
||||
|
||||
themeLayout->addWidget(m_themeCombo);
|
||||
themeLayout->addStretch();
|
||||
generalLayout->addLayout(themeLayout);
|
||||
|
||||
#ifdef WIN32
|
||||
QOperatingSystemVersion osVersion = QOperatingSystemVersion::current();
|
||||
if (osVersion >= QOperatingSystemVersion::Windows11) {
|
||||
auto *backDropTypeLayout = new QHBoxLayout();
|
||||
backDropTypeLayout->addWidget(new QLabel("Backdrop Type:"));
|
||||
m_backDropTypeCombo = new QComboBox();
|
||||
|
||||
// "Auto" => no userData => means "no override"
|
||||
m_backDropTypeCombo->addItem("Auto");
|
||||
m_backDropTypeCombo->addItem("Mica", static_cast<int>(MICA));
|
||||
m_backDropTypeCombo->addItem("Mica Alt", static_cast<int>(MICA_ALT));
|
||||
m_backDropTypeCombo->addItem("Acrylic", static_cast<int>(ACRYLIC));
|
||||
|
||||
backDropTypeLayout->addWidget(m_backDropTypeCombo);
|
||||
backDropTypeLayout->addStretch();
|
||||
|
||||
generalLayout->addLayout(backDropTypeLayout);
|
||||
}
|
||||
#endif
|
||||
|
||||
scrollLayout->addWidget(generalGroup);
|
||||
|
||||
@@ -191,7 +219,6 @@ void SettingsWidget::setupUI()
|
||||
m_noHoldCheckbox = new QCheckBox("Allow New Connections to Take Over");
|
||||
airplayLayout->addWidget(m_noHoldCheckbox);
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
m_showV4L2CheckBox = new QCheckBox("Show V4L2 Button on AirPlay Widget");
|
||||
airplayLayout->addWidget(m_showV4L2CheckBox);
|
||||
@@ -302,6 +329,18 @@ void SettingsWidget::loadSettings()
|
||||
#ifdef __linux__
|
||||
m_showV4L2CheckBox->setChecked(sm->showV4L2());
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
if (m_backDropTypeCombo) {
|
||||
const int typeValue = static_cast<int>(sm->winBackdropType());
|
||||
const int index = m_backDropTypeCombo->findData(typeValue);
|
||||
if (index != -1) {
|
||||
m_backDropTypeCombo->setCurrentIndex(index);
|
||||
} else {
|
||||
m_backDropTypeCombo->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsWidget::connectSignals()
|
||||
@@ -356,14 +395,21 @@ void SettingsWidget::connectSignals()
|
||||
|
||||
connect(m_defaultJailbrokenRootPassword, &QLineEdit::textChanged, this,
|
||||
&SettingsWidget::onSettingChanged);
|
||||
connect(m_fpsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&SettingsWidget::onSettingChanged);
|
||||
connect(m_fpsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &SettingsWidget::onSettingChanged);
|
||||
connect(m_noHoldCheckbox, &QCheckBox::toggled, this,
|
||||
&SettingsWidget::onSettingChanged);
|
||||
#ifdef __linux__
|
||||
connect(m_showV4L2CheckBox, &QCheckBox::toggled, this,
|
||||
&SettingsWidget::onSettingChanged);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
if (m_backDropTypeCombo) {
|
||||
connect(m_backDropTypeCombo,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&SettingsWidget::onSettingChanged);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsWidget::onBrowseButtonClicked()
|
||||
@@ -457,6 +503,18 @@ void SettingsWidget::saveSettings()
|
||||
sm->setShowV4L2(m_showV4L2CheckBox->isChecked());
|
||||
#endif
|
||||
m_applyButton->setEnabled(false);
|
||||
|
||||
#ifdef WIN32
|
||||
if (m_backDropTypeCombo) {
|
||||
const QVariant data = m_backDropTypeCombo->currentData();
|
||||
if (!data.isValid()) {
|
||||
// Mica
|
||||
sm->setWinBackdropType(static_cast<WIN_BACKDROP>(2));
|
||||
} else {
|
||||
sm->setWinBackdropType(static_cast<WIN_BACKDROP>(data.toInt()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsWidget::resetToDefaults()
|
||||
|
||||
Reference in New Issue
Block a user