From fd88cec8f39f917a1f3cd0cf1bfca72af0ff42fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 11 Aug 2024 08:22:54 +0200 Subject: [PATCH] Disable custom interface scaling We should now handle DPI scaling correctly, ignore user setting. The setting was a ugly hack anyway, didn't work properly. --- src/app/GUI/Settings/generalsettingswidget.cpp | 18 +++++++++--------- src/app/GUI/Settings/generalsettingswidget.h | 4 ++-- src/app/main.cpp | 9 ++------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/app/GUI/Settings/generalsettingswidget.cpp b/src/app/GUI/Settings/generalsettingswidget.cpp index 627a2ee03..6d2d79b67 100644 --- a/src/app/GUI/Settings/generalsettingswidget.cpp +++ b/src/app/GUI/Settings/generalsettingswidget.cpp @@ -39,8 +39,8 @@ GeneralSettingsWidget::GeneralSettingsWidget(QWidget *parent) , mAutoBackup(nullptr) , mAutoSave(nullptr) , mAutoSaveTimer(nullptr) - , mDefaultInterfaceScaling(nullptr) - , mInterfaceScaling(nullptr) + //, mDefaultInterfaceScaling(nullptr) + //, mInterfaceScaling(nullptr) , mImportFileDir(nullptr) , mToolBarActionNew(nullptr) , mToolBarActionOpen(nullptr) @@ -90,7 +90,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(QWidget *parent) mProjectLayout->addWidget(mAutoSaveWidget); - const auto mScaleWidget = new QGroupBox(this); + /*const auto mScaleWidget = new QGroupBox(this); mScaleWidget->setObjectName("BlueBox"); mScaleWidget->setTitle(tr("Interface Scaling")); mScaleWidget->setContentsMargins(0, 0, 0, 0); @@ -123,7 +123,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(QWidget *parent) infoLabel->setText(tr("Changes here will require a restart of Friction.")); mScaleLayout->addWidget(infoLabel); - mGeneralLayout->addWidget(mScaleWidget); + mGeneralLayout->addWidget(mScaleWidget);*/ const auto mImportFileWidget = new QWidget(this); mImportFileWidget->setContentsMargins(0, 0, 0, 0); @@ -150,7 +150,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(QWidget *parent) eSizesUI::widget.add(mAutoBackup, [this](const int size) { mAutoBackup->setFixedHeight(size); mAutoSave->setFixedHeight(size); - mDefaultInterfaceScaling->setFixedHeight(size); + //mDefaultInterfaceScaling->setFixedHeight(size); }); } @@ -167,8 +167,8 @@ void GeneralSettingsWidget::applySettings() (mAutoSaveTimer->value() * 60) * 1000); MainWindow::sGetInstance()->updateAutoSaveBackupState(); - mSett.fDefaultInterfaceScaling = mDefaultInterfaceScaling->isChecked(); - mSett.fInterfaceScaling = mInterfaceScaling->value() * 0.01; + //mSett.fDefaultInterfaceScaling = mDefaultInterfaceScaling->isChecked(); + //mSett.fInterfaceScaling = mInterfaceScaling->value() * 0.01; mSett.fImportFileDirOpt = mImportFileDir->currentData().toInt(); mSett.fToolBarActionNew = mToolBarActionNew->isChecked(); @@ -197,8 +197,8 @@ void GeneralSettingsWidget::updateSettings(bool restore) if (ms < 60000) { ms = 60000; } mAutoSaveTimer->setValue((ms / 1000) / 60); - mDefaultInterfaceScaling->setChecked(mSett.fDefaultInterfaceScaling); - mInterfaceScaling->setValue(mDefaultInterfaceScaling->isChecked() ? 100 : 100 * mSett.fInterfaceScaling); + //mDefaultInterfaceScaling->setChecked(mSett.fDefaultInterfaceScaling); + //mInterfaceScaling->setValue(mDefaultInterfaceScaling->isChecked() ? 100 : 100 * mSett.fInterfaceScaling); mToolBarActionNew->setChecked(mSett.fToolBarActionNew); mToolBarActionOpen->setChecked(mSett.fToolBarActionOpen); diff --git a/src/app/GUI/Settings/generalsettingswidget.h b/src/app/GUI/Settings/generalsettingswidget.h index c0e0288ef..21c4e0faa 100644 --- a/src/app/GUI/Settings/generalsettingswidget.h +++ b/src/app/GUI/Settings/generalsettingswidget.h @@ -44,8 +44,8 @@ class GeneralSettingsWidget : public SettingsWidget QCheckBox *mAutoSave; QSpinBox *mAutoSaveTimer; - QCheckBox *mDefaultInterfaceScaling; - QSlider *mInterfaceScaling; + //QCheckBox *mDefaultInterfaceScaling; + //QSlider *mInterfaceScaling; QComboBox *mImportFileDir; diff --git a/src/app/main.cpp b/src/app/main.cpp index 65ddfb822..f3b9a18d7 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -160,14 +160,9 @@ int main(int argc, char *argv[]) OS_FONT = QApplication::font(); eSizesUI::font.setEvaluator([&settings]() { - qreal dpi = 1.0; - if (!settings.fDefaultInterfaceScaling) { - dpi = settings.fInterfaceScaling; - } else { - dpi = qApp->desktop()->logicalDpiX() / 96.0; //QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0 - } + qreal dpi = qApp->desktop()->logicalDpiX() / 96.0; //QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0 settings.fCurrentInterfaceDPI = dpi; - qDebug() << "DPI" << dpi; + qWarning() << "DPI:" << dpi; const auto fm = QFontMetrics(OS_FONT); const qreal scaling = qBound(0.5, dpi, 1.5); return qRound(fm.height()*scaling);