1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-30 08:24:22 +00:00

Setup DPI at startup

This commit is contained in:
Chocobo1 2017-03-20 14:11:49 +08:00
parent 893ce32f1d
commit 6bcb07649e

View File

@ -41,6 +41,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>
Q_IMPORT_PLUGIN(QICOPlugin) Q_IMPORT_PLUGIN(QICOPlugin)
@ -89,13 +90,18 @@ const char *sysSigName[] = {
}; };
#endif #endif
#ifndef DISABLE_GUI
void showSplashScreen();
#endif
void displayVersion(); void displayVersion();
bool userAgreesWithLegalNotice(); bool userAgreesWithLegalNotice();
void displayBadArgMessage(const QString &message); 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 // Main
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -108,15 +114,21 @@ int main(int argc, char *argv[])
macMigratePlists(); macMigratePlists();
#endif #endif
#if !defined(DISABLE_GUI) && defined(Q_OS_UNIX)
setupDpi();
#endif
try { try {
// Create Application // Create Application
QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString(); QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
QScopedPointer<Application> app(new Application(appId, argc, argv)); QScopedPointer<Application> app(new Application(appId, argc, argv));
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
// after the application object creation because we need a profile to be set already // after the application object creation because we need a profile to be set already
// for the migration // for the migration
migrateRSS(); migrateRSS();
#endif #endif
const QBtCommandLineParameters &params = app->commandLineArgs(); const QBtCommandLineParameters &params = app->commandLineArgs();
if (!params.unknownParameter.isEmpty()) { if (!params.unknownParameter.isEmpty()) {
@ -280,7 +292,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");
@ -294,7 +306,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()
{ {