Skip to content

Commit

Permalink
Setup DPI at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobo1 committed Apr 30, 2017
1 parent 893ce32 commit 6bcb076
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/app/main.cpp
Expand Up @@ -41,6 +41,7 @@
#include <QPen>
#include <QPushButton>
#include <QSplashScreen>

#ifdef QBT_STATIC_QT
#include <QtPlugin>
Q_IMPORT_PLUGIN(QICOPlugin)
Expand Down Expand Up @@ -89,13 +90,18 @@ const char *sysSigName[] = {
};
#endif

#ifndef DISABLE_GUI
void showSplashScreen();
#endif
void displayVersion();
bool userAgreesWithLegalNotice();
void displayBadArgMessage(const QString &message);

#if !defined(DISABLE_GUI)
void showSplashScreen();

#if defined(Q_OS_UNIX)
void setupDpi();
#endif // Q_OS_UNIX
#endif // DISABLE_GUI

// Main
int main(int argc, char *argv[])
{
Expand All @@ -108,15 +114,21 @@ int main(int argc, char *argv[])
macMigratePlists();
#endif

#if !defined(DISABLE_GUI) && defined(Q_OS_UNIX)
setupDpi();
#endif

try {
// Create Application
QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
QScopedPointer<Application> app(new Application(appId, argc, argv));

#ifndef DISABLE_GUI
// after the application object creation because we need a profile to be set already
// for the migration
migrateRSS();
#endif

const QBtCommandLineParameters &params = app->commandLineArgs();

if (!params.unknownParameter.isEmpty()) {
Expand Down Expand Up @@ -280,7 +292,7 @@ void sigAbnormalHandler(int signum)
}
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)

#ifndef DISABLE_GUI
#if !defined(DISABLE_GUI)
void showSplashScreen()
{
QPixmap splash_img(":/icons/skin/splash.png");
Expand All @@ -294,7 +306,15 @@ void showSplashScreen()
QTimer::singleShot(1500, splash, SLOT(deleteLater()));
qApp->processEvents();
}
#endif

#if defined(Q_OS_UNIX)
void setupDpi()
{
if (qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");

This comment has been minimized.

Copy link
@yate

yate Jul 25, 2017

I think this should be set to 0 by default, based on the issues presented in #6935

}
#endif // Q_OS_UNIX
#endif // DISABLE_GUI

void displayVersion()
{
Expand Down

0 comments on commit 6bcb076

Please sign in to comment.