Setup DPI at startup

This commit is contained in:
Chocobo1 2017-03-20 14:11:49 +08:00 committed by sledgehammer999
commit e4a5b8d352
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2

View file

@ -40,6 +40,7 @@
#include <QPen> #include <QPen>
#include <QPushButton> #include <QPushButton>
#include <QSplashScreen> #include <QSplashScreen>
#ifdef QBT_STATIC_QT #ifdef QBT_STATIC_QT
#include <QtPlugin> #include <QtPlugin>
#ifdef QBT_USES_QT5 #ifdef QBT_USES_QT5
@ -120,15 +121,20 @@ struct QBtCommandLineParameters
} }
}; };
#ifndef DISABLE_GUI
void showSplashScreen();
#endif
void displayVersion(); void displayVersion();
void displayUsage(const QString &prg_name); void displayUsage(const QString &prg_name);
bool userAgreesWithLegalNotice(); bool userAgreesWithLegalNotice();
void displayBadArgMessage(const QString &message); void displayBadArgMessage(const QString &message);
QBtCommandLineParameters parseCommandLine(); QBtCommandLineParameters parseCommandLine();
#if !defined(DISABLE_GUI)
void showSplashScreen();
#if defined(Q_OS_UNIX)
void setupDpi();
#endif // Q_OS_UNIX
#endif // DISABLE_GUI
// Main // Main
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -141,6 +147,11 @@ int main(int argc, char *argv[])
macMigratePlists(); macMigratePlists();
#endif #endif
#if !defined(DISABLE_GUI) && defined(Q_OS_UNIX)
setupDpi();
#endif
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
migrateRSS(); migrateRSS();
#endif #endif
@ -379,7 +390,7 @@ void sigAbnormalHandler(int signum)
} }
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN) #endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
#ifndef DISABLE_GUI #if !defined(DISABLE_GUI)
void showSplashScreen() void showSplashScreen()
{ {
QPixmap splash_img(":/icons/skin/splash.png"); QPixmap splash_img(":/icons/skin/splash.png");
@ -393,7 +404,15 @@ void showSplashScreen()
QTimer::singleShot(1500, splash, SLOT(deleteLater())); QTimer::singleShot(1500, splash, SLOT(deleteLater()));
qApp->processEvents(); 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");
}
#endif // Q_OS_UNIX
#endif // DISABLE_GUI
void displayVersion() void displayVersion()
{ {