Skip to content

Commit

Permalink
Theme/Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 11, 2024
1 parent a897bb0 commit 130d8d2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
5 changes: 3 additions & 2 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ int main(int argc, char *argv[])

OS_FONT = QApplication::font();
eSizesUI::font.setEvaluator([&settings]() {
qreal dpi = qApp->desktop()->logicalDpiX() / 96.0; //QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0
qreal dpi = qApp->desktop()->logicalDpiX() / 96.0;
settings.fCurrentInterfaceDPI = dpi;
qWarning() << "DPI:" << dpi;
qWarning() << "Desktop logicalDpiX:" << dpi;
qWarning() << "Desktop PixelRatioF:" << qApp->desktop()->devicePixelRatioF();
const auto fm = QFontMetrics(OS_FONT);
const qreal scaling = qBound(0.5, dpi, 1.5);
return qRound(fm.height()*scaling);
Expand Down
10 changes: 0 additions & 10 deletions src/core/themesupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,6 @@ const QString ThemeSupport::getThemeStyle(int iconSize)
css = stylesheet.readAll();
stylesheet.close();
}
#ifdef Q_OS_WIN
css.replace("/scalable/actions/go-up.svg",
"/%7x%7/actions/go-up.png");
css.replace("/scalable/actions/go-down.svg",
"/%7x%7/actions/go-down.png");
css.replace("/scalable/actions/dialog-ok.svg",
"/%7x%7/actions/dialog-ok.png");
css.replace("/scalable/actions/dialog-cancel.svg",
"/%7x%7/actions/dialog-cancel.png");
#endif
return css.arg(getThemeButtonBaseColor().name(),
getThemeButtonBorderColor().name(),
getThemeBaseDarkerColor().name(),
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/build_ci.bat
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ set OUTPUT_DIR="%CWD%\build\output\friction-%VERSION%"
mkdir "%OUTPUT_DIR%"
mkdir "%OUTPUT_DIR%\audio"
mkdir "%OUTPUT_DIR%\platforms"
mkdir "%OUTPUT_DIR%\imageformats"

copy "%CWD%\build\src\core\%BDIR%\frictioncore.dll" "%OUTPUT_DIR%\"
copy "%CWD%\build\src\ui\%BDIR%\frictionui.dll" "%OUTPUT_DIR%\"
Expand All @@ -76,6 +77,7 @@ copy "%SDK_DIR%\bin\Qt5Xml.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\qscintilla2_qt5.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\plugins\audio\qtaudio_wasapi.dll" "%OUTPUT_DIR%\audio\"
copy "%SDK_DIR%\plugins\platforms\qwindows.dll" "%OUTPUT_DIR%\platforms\"
copy "%SDK_DIR%\plugins\imageformats\qsvg.dll" "%OUTPUT_DIR%\imageformats\"
copy "%SDK_DIR%\bin\avcodec-58.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\avdevice-58.dll" "%OUTPUT_DIR%\"
copy "%SDK_DIR%\bin\avformat-58.dll" "%OUTPUT_DIR%\"
Expand Down
5 changes: 3 additions & 2 deletions src/ui/widgets/aboutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ AboutWidget::AboutWidget(QWidget *parent)

const auto mTopLabel = new QLabel(this);

int logoSize = 96;
QString label = QString::fromUtf8("<div style=\"margin: 0; padding: 0; text-align: center; font-weight: normal;\">"
"<img src=\":/icons/hicolor/%5x%5/apps/%4.png\" width=\"%2\" height=\"%2\">"
"<h1 style=\"font-weight: normal; margin-top: 0; padding-top: 0;\">%3<br><span style=\"font-size: large;\">%1</span></h1>"
"</div>").arg(AppSupport::getAppVersion(),
QString::number(ThemeSupport::getIconSize(96).width()),
QString::number(ThemeSupport::getIconSize(logoSize).width()),
AppSupport::getAppDisplayName(),
AppSupport::getAppID(),
QString::number(ThemeSupport::getIconSize(96 * 2).width()));
QString::number(ThemeSupport::getIconSize(qRound(logoSize * devicePixelRatioF())).width()));
const auto buildInfo = AppSupport::getAppBuildInfo(true);
if (!buildInfo.isEmpty()) {
label.append(buildInfo);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/welcomedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ WelcomeDialog::WelcomeDialog(QMenu *recentMenu,
QString::number(ThemeSupport::getIconSize(logoSize).width()),
AppSupport::getAppDisplayName(),
AppSupport::getAppID(),
QString::number(ThemeSupport::getIconSize(logoSize * 2).width())));
QString::number(ThemeSupport::getIconSize(qRound(logoSize * devicePixelRatioF())).width())));

const auto buttonWid = new QWidget(this);
buttonWid->setContentsMargins(0, 0, 0, 0);
Expand Down

0 comments on commit 130d8d2

Please sign in to comment.