diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5a8413cf..e42ed8fd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -486,7 +486,7 @@ jobs: swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}.run swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}.exe swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}.dmg - xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.7z + xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.zip swiftsymbols-allos-${{ needs.preBuild.outputs.version }}:swiftsymbols - name: Publish doxygen uses: actions/deploy-pages@v4 diff --git a/samples/hotkey/main.cpp b/samples/hotkey/main.cpp index 71ea65ba9..b20c89a49 100644 --- a/samples/hotkey/main.cpp +++ b/samples/hotkey/main.cpp @@ -16,7 +16,6 @@ using namespace swift::gui; //! main int main(int argc, char *argv[]) { - CGuiApplication::highDpiScreenSupport(); QApplication qa(argc, argv); CGuiApplication a("samplehotkey", swift::misc::CApplicationInfo::Sample, QPixmap()); swift::gui::components::CSettingsHotkeyComponent w; diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index db7e6afe3..0d95bbf76 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -378,9 +378,6 @@ add_library(gui SHARED components/remoteaircraftselector.cpp components/remoteaircraftselector.h components/remoteaircraftselector.ui - components/scalescreenfactor.cpp - components/scalescreenfactor.h - components/scalescreenfactor.ui components/selcalcodeselector.cpp components/selcalcodeselector.h components/selcalcodeselector.ui diff --git a/src/gui/components/scalescreenfactor.cpp b/src/gui/components/scalescreenfactor.cpp deleted file mode 100644 index f88c4c0eb..000000000 --- a/src/gui/components/scalescreenfactor.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -#include "scalescreenfactor.h" - -#include -#include - -#include "ui_scalescreenfactor.h" - -#include "gui/guiutility.h" - -namespace swift::gui::components -{ - CScaleScreenFactor::CScaleScreenFactor(QWidget *parent) : QFrame(parent), ui(new Ui::CScaleScreenFactor) - { - ui->setupUi(this); - this->setMinMax(50, 150); - - connect(ui->hs_Factor, &QSlider::valueChanged, this, &CScaleScreenFactor::onSliderChanged); - connect(ui->le_Factor, &QLineEdit::editingFinished, this, &CScaleScreenFactor::onEditFinished); - - const QString tt = QStringLiteral("Scaling only works on High DPI screens"); - this->setToolTip(tt); - } - - CScaleScreenFactor::~CScaleScreenFactor() {} - - void CScaleScreenFactor::setMinMax(int min, int max) - { - ui->hs_Factor->setMinimum(min); - ui->hs_Factor->setMaximum(max); - ui->le_Factor->setValidator(new QIntValidator(min, max, ui->le_Factor)); - - const QString tt = QStringLiteral("%1-%2").arg(min).arg(max); - ui->le_Factor->setToolTip(tt); - ui->le_Factor->setPlaceholderText(tt); - ui->hs_Factor->setToolTip(tt); - - const int v = (min + max) / 2; - ui->hs_Factor->setValue(v); - ui->le_Factor->setText(QString::number(v)); - } - - qreal CScaleScreenFactor::getScaleFactor() const { return 0.01 * ui->hs_Factor->value(); } - - QString CScaleScreenFactor::getScaleFactorAsString() const - { - const QString sf = QString::number(this->getScaleFactor(), 'f', 2); - return sf; - } - - void CScaleScreenFactor::onSliderChanged(int value) - { - const QString v = QString::number(value); - if (ui->le_Factor->text() == v) { return; } // avoid signal roundtrips - ui->le_Factor->setText(v); - } - - void CScaleScreenFactor::onEditFinished() - { - const QString v = ui->le_Factor->text(); - if (v.isEmpty()) { return; } - bool ok; - const int value = v.toInt(&ok); - if (!ok) { return; } - if (ui->hs_Factor->value() == value) { return; } // avoid signal roundtrips - ui->hs_Factor->setValue(value); - } -} // namespace swift::gui::components diff --git a/src/gui/components/scalescreenfactor.h b/src/gui/components/scalescreenfactor.h deleted file mode 100644 index 941816fff..000000000 --- a/src/gui/components/scalescreenfactor.h +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -//! \file - -#ifndef SWIFT_GUI_COMPONENTS_SCALESCREENFACTOR_H -#define SWIFT_GUI_COMPONENTS_SCALESCREENFACTOR_H - -#include -#include - -#include "gui/swiftguiexport.h" - -namespace Ui -{ - class CScaleScreenFactor; -} -namespace swift::gui::components -{ - /*! - * UI to scale screen factor - */ - class SWIFT_GUI_EXPORT CScaleScreenFactor : public QFrame - { - Q_OBJECT - - public: - //! Constructor - explicit CScaleScreenFactor(QWidget *parent = nullptr); - - //! Destructor - virtual ~CScaleScreenFactor() override; - - //! Minimum/maximum values - void setMinMax(int min, int max); - - //! Scale factor - qreal getScaleFactor() const; - - //! Scale factor as string - QString getScaleFactorAsString() const; - - private: - //! Slider value changed - void onSliderChanged(int value); - - //! Line edit change - void onEditFinished(); - - QScopedPointer ui; - }; -} // namespace swift::gui::components - -#endif // SWIFT_GUI_COMPONENTS_SCALESCREENFACTOR_H diff --git a/src/gui/components/scalescreenfactor.ui b/src/gui/components/scalescreenfactor.ui deleted file mode 100644 index 5da2c6b1a..000000000 --- a/src/gui/components/scalescreenfactor.ui +++ /dev/null @@ -1,69 +0,0 @@ - - - CScaleScreenFactor - - - - 0 - 0 - 165 - 24 - - - - Scale screen factor - - - Scaling works only on High DPI screens - - - - 1 - - - 1 - - - 1 - - - 1 - - - - - Scale: - - - - - - - 5 - - - - - - - 50 - - - 150 - - - 5 - - - 100 - - - Qt::Horizontal - - - - - - - - diff --git a/src/gui/guiapplication.cpp b/src/gui/guiapplication.cpp index 11b3e8ccb..cf971de04 100644 --- a/src/gui/guiapplication.cpp +++ b/src/gui/guiapplication.cpp @@ -105,7 +105,6 @@ namespace swift::gui { this->addWindowModeOption(); this->addWindowResetSizeOption(); - this->addWindowScaleSizeOption(); // notify when app goes down connect(qGuiApp, &QGuiApplication::lastWindowClosed, this, &CGuiApplication::gracefulShutdown); @@ -150,15 +149,6 @@ namespace swift::gui this->addParserOption(m_cmdWindowSizeReset); } - void CGuiApplication::addWindowScaleSizeOption() - { - // just added here to display it in help - // parseScaleFactor() is used since it is needed upfront (before application is created) - m_cmdWindowScaleSize = - QCommandLineOption("scale", QCoreApplication::translate("main", "Scale: number."), "scalevalue"); - this->addParserOption(m_cmdWindowScaleSize); - } - void CGuiApplication::addWindowStateOption() { m_cmdWindowStateMinimized = QCommandLineOption( @@ -287,28 +277,6 @@ namespace swift::gui void CGuiApplication::exit(int retcode) { CApplication::exit(retcode); } - void CGuiApplication::highDpiScreenSupport(const QString &scaleFactor) - { - // https://lists.qt-project.org/pipermail/development/2019-September/037434.html - // QSize s = CGuiUtility::physicalScreenSizeOs(); - QString sf = scaleFactor.trimmed().isEmpty() ? defaultScaleFactorString() : scaleFactor; - if (sf.contains('/')) - { - const double sfd = parseFraction(scaleFactor, -1); - sf = sfd < 0 ? "1.0" : QString::number(sfd, 'f', 8); - } - - sf = cleanNumber(sf); - - // qputenv("QT_ENABLE_HIGHDPI_SCALING", "1"); - QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor); - - const QByteArray sfa = sf.toLatin1(); - qputenv("QT_SCALE_FACTOR", sfa); - } - - bool CGuiApplication::isUsingHighDpiScreenSupport() { return CGuiUtility::isUsingHighDpiScreenSupport(); } - QScreen *CGuiApplication::currentScreen() { const QWidget *w = CGuiApplication::mainApplicationWidget(); @@ -455,53 +423,6 @@ namespace swift::gui } } - double CGuiApplication::parseScaleFactor(int argc, char *argv[]) - { - for (int i = 1; i < argc; ++i) - { - if (qstrcmp(argv[i], "--scale") == 0 || qstrcmp(argv[i], "-scale") == 0) - { - if (i + 1 >= argc) { return -1.0; } // no value - const QString factor(argv[i + 1]); - bool ok; - const double f = factor.toDouble(&ok); - return ok ? f : -1.0; - } - } - return -1.0; - } - - QString CGuiApplication::scaleFactor(int argc, char *argv[]) - { - for (int i = 1; i < argc; ++i) - { - if (qstrcmp(argv[i], "--scale") == 0 || qstrcmp(argv[i], "-scale") == 0) - { - if (i + 1 >= argc) { return QString(); } // no value - const QString factor(argv[i + 1]); - return factor.trimmed(); - } - } - return QString(); - } - - QString CGuiApplication::defaultScaleFactorString() - { - if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return "1.0"; } - - // On windows - // Qt 5.14.1 default is device ratio 3 - // Qt 5.14.0 default device ratio was 2 - - // 2/3 (0.66667) => device ratio 3 - // 0.75 => device ratio 2.25 - // 0.8 => device ratio 2.4 - // 1.00 => device ratio 3 - - // currently NOT used - return "1.0"; - } - void CGuiApplication::cmdLineErrorMessage(const QString &text, const QString &informativeText) const { QMessageBox errorBox(QMessageBox::Critical, QGuiApplication::applicationDisplayName(), "" + text + ""); diff --git a/src/gui/guiapplication.h b/src/gui/guiapplication.h index 086f4bfe1..97487bdb4 100644 --- a/src/gui/guiapplication.h +++ b/src/gui/guiapplication.h @@ -90,9 +90,6 @@ namespace swift::gui //! CMD line arguments (reset size store) void addWindowResetSizeOption(); - //! CMD line arguments (scale size on DPI screens) - void addWindowScaleSizeOption(); - //! Window state Qt::WindowState getWindowState() const; @@ -255,13 +252,6 @@ namespace swift::gui //! Exit application, perform graceful shutdown and exit static void exit(int retcode = 0); - //! Support for high DPI screens - //! \note Needs to be at the beginning of main - static void highDpiScreenSupport(const QString &scaleFactor = {}); - - //! Uses the high DPI support? - static bool isUsingHighDpiScreenSupport(); - //! Current screen static QScreen *currentScreen(); @@ -272,16 +262,6 @@ namespace swift::gui //! Bring any modal dialog to front static void modalWindowToFront(); - //! Parse scale factor if any - //! \deprecated using scaleFactor now - static double parseScaleFactor(int argc, char *argv[]); - - //! Get the scale factor - static QString scaleFactor(int argc, char *argv[]); - - //! Get a default scale factor - static QString defaultScaleFactorString(); - signals: //! Style sheet changed void styleSheetsChanged(); @@ -323,7 +303,6 @@ namespace swift::gui QCommandLineOption m_cmdWindowStateMinimized { "emptyMinimized" }; //!< window state (minimized) QCommandLineOption m_cmdWindowMode { "emptyWindowMode" }; //!< window mode (flags: frameless ...) QCommandLineOption m_cmdWindowSizeReset { "emptySizeReset" }; //!< window size reset - QCommandLineOption m_cmdWindowScaleSize { "emptyScale" }; //!< window scale size CStyleSheetUtility m_styleSheetUtility { this }; //!< style sheet utility bool m_uiSetupCompleted = false; //!< ui setup completed bool m_saveMainWidgetState = true; //!< save/restore main widget's state diff --git a/src/gui/guiutility.cpp b/src/gui/guiutility.cpp index e4acb3d7e..7d09b545c 100644 --- a/src/gui/guiutility.cpp +++ b/src/gui/guiutility.cpp @@ -797,7 +797,7 @@ namespace swift::gui QString CGuiUtility::metricsInfo() { - static const QString s("%1 %2 %3 | 80 chars: w%4 h%5 | 43 chars: w%6 h%7"); + static const QString s("%1 %2 | 80 chars: w%3 h%4 | 43 chars: w%5 h%6"); const QSizeF s80 = CGuiUtility::fontMetrics80Chars(); const QSizeF s43 = CGuiUtility::fontMetricsLazyDog43Chars(); @@ -811,21 +811,7 @@ namespace swift::gui desktop = QStringLiteral("Desktop w%1 w%2").arg(sd.width()).arg(sd.height()); ratio = QStringLiteral("ratio: %1").arg(mainWidget->devicePixelRatioF()); } - return s.arg(desktop) - .arg(CGuiUtility::isUsingHighDpiScreenSupport() ? "hi DPI" : "-") - .arg(ratio) - .arg(s80.width()) - .arg(s80.height()) - .arg(s43.width()) - .arg(s43.height()); - } - - bool CGuiUtility::isUsingHighDpiScreenSupport() - { - const QByteArray v = qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); - const QString vs(v); - const bool highDpi = stringToBool(vs); - return highDpi; + return s.arg(desktop).arg(ratio).arg(s80.width()).arg(s80.height()).arg(s43.width()).arg(s43.height()); } void CGuiUtility::forceStyleSheetUpdate(QWidget *widget) diff --git a/src/gui/guiutility.h b/src/gui/guiutility.h index 6a0ab7dd4..d560c2fba 100644 --- a/src/gui/guiutility.h +++ b/src/gui/guiutility.h @@ -254,9 +254,6 @@ namespace swift::gui //! Some info about font metrics static QString metricsInfo(); - //! Using high DPI screen support - static bool isUsingHighDpiScreenSupport(); - //! Forces a stylesheet update static void forceStyleSheetUpdate(QWidget *widget); diff --git a/src/swiftcore/main.cpp b/src/swiftcore/main.cpp index d8dbb7a85..2eb421ba9 100644 --- a/src/swiftcore/main.cpp +++ b/src/swiftcore/main.cpp @@ -20,7 +20,6 @@ using namespace swift::gui; int main(int argc, char *argv[]) { - CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv)); QApplication qa(argc, argv); Q_UNUSED(qa) // init of qa is required, but qa not used diff --git a/src/swiftdata/main.cpp b/src/swiftdata/main.cpp index 76c618766..e8d80900a 100644 --- a/src/swiftdata/main.cpp +++ b/src/swiftdata/main.cpp @@ -19,7 +19,6 @@ using namespace swift::gui; int main(int argc, char *argv[]) { - CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv)); QApplication qa(argc, argv); Q_UNUSED(qa) diff --git a/src/swiftguistandard/main.cpp b/src/swiftguistandard/main.cpp index 89b0ef012..bf56d1058 100644 --- a/src/swiftguistandard/main.cpp +++ b/src/swiftguistandard/main.cpp @@ -20,7 +20,6 @@ using namespace swift::core; int main(int argc, char *argv[]) { - CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv)); QApplication qa(argc, argv); Q_UNUSED(qa) // application init needed diff --git a/src/swiftlauncher/main.cpp b/src/swiftlauncher/main.cpp index 7d4614803..01b43ec09 100644 --- a/src/swiftlauncher/main.cpp +++ b/src/swiftlauncher/main.cpp @@ -35,7 +35,6 @@ void initDbCacheFromResourceFileIfRequired(CGuiApplication &a) int main(int argc, char *argv[]) { - CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv)); QApplication qa(argc, argv); // needed Q_UNUSED(qa) CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Launcher, CIcons::swiftLauncher1024()); diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index 44f7ea22c..a00766897 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -425,8 +425,6 @@ QString CSwiftLauncher::toCmdLine(const QString &exe, const QStringList &exeArgs void CSwiftLauncher::startButtonPressed() { const QObject *sender = QObject::sender(); - const qreal scaleFactor = ui->comp_Scale->getScaleFactor(); - CGuiApplication::highDpiScreenSupport(QString::number(scaleFactor, 'f', 4)); const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers(); const bool shift = km.testFlag(Qt::ShiftModifier); diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 7bd483596..278893c1c 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -735,16 +735,6 @@ - - - - QFrame::StyledPanel - - - QFrame::Raised - - - @@ -846,12 +836,6 @@
gui/components/abouthtmlcomponent.h
1 - - swift::gui::components::CScaleScreenFactor - QFrame -
gui/components/scalescreenfactor.h
- 1 -
rb_SwiftStandalone