-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Bittorrent Client using Qt and libtorrent. | ||
* Copyright (C) 2023-2024 Vladimir Golovnev <[email protected]> | ||
* Copyright (C) 2023-2025 Vladimir Golovnev <[email protected]> | ||
* Copyright (C) 2024 Jonathan Ketchker | ||
* Copyright (C) 2006 Christophe Dumez <[email protected]> | ||
* | ||
|
@@ -464,10 +464,7 @@ void OptionsDialog::saveBehaviorTabOptions() const | |
pref->setLocale(locale); | ||
|
||
#ifdef Q_OS_WIN | ||
if (const QVariant systemStyle = m_ui->comboStyle->currentData(); systemStyle.isValid()) | ||
pref->setStyle(systemStyle.toString()); | ||
else | ||
pref->setStyle(m_ui->comboStyle->currentText()); | ||
pref->setStyle(m_ui->comboStyle->currentData().toString()); | ||
#endif | ||
|
||
#ifdef QBT_HAS_COLORSCHEME_OPTION | ||
|
@@ -1716,18 +1713,20 @@ void OptionsDialog::initializeStyleCombo() | |
{ | ||
#ifdef Q_OS_WIN | ||
m_ui->labelStyleHint->setText(tr("%1 is recommended for best compatibility with Windows dark mode" | ||
, "Fusion is recommended for best compatibility with Windows dark mode").arg(u"Fusion"_s)); | ||
, "Fusion is recommended for best compatibility with Windows dark mode").arg(u"Fusion"_s)); | ||
m_ui->comboStyle->addItem(tr("System", "System default Qt style"), u"system"_s); | ||
m_ui->comboStyle->setItemData(0, tr("Let Qt decide the style for this system"), Qt::ToolTipRole); | ||
m_ui->comboStyle->insertSeparator(1); | ||
|
||
QStringList styleNames = QStyleFactory::keys(); | ||
std::sort(styleNames.begin(), styleNames.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>()); | ||
m_ui->comboStyle->addItems(styleNames); | ||
for (const QString &styleName : asConst(styleNames)) | ||
m_ui->comboStyle->addItem(styleName, styleName); | ||
|
||
const QString prefStyleName = Preferences::instance()->getStyle(); | ||
const QString selectedStyleName = prefStyleName.isEmpty() ? QApplication::style()->name() : prefStyleName; | ||
m_ui->comboStyle->setCurrentIndex(m_ui->comboStyle->findText(selectedStyleName, Qt::MatchFixedString)); | ||
const int styleIndex = m_ui->comboStyle->findData(selectedStyleName, Qt::UserRole, Qt::MatchFixedString); | ||
m_ui->comboStyle->setCurrentIndex(std::max(0, styleIndex)); | ||
#else | ||
m_ui->labelStyle->hide(); | ||
m_ui->comboStyle->hide(); | ||
|