1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-05 11:24:15 +00:00

Merge pull request #6524 from Chocobo1/dpi

Opt-in DPI scaling
This commit is contained in:
sledgehammer999 2017-04-30 21:25:57 +03:00 committed by GitHub
commit 90c6bb6054
2 changed files with 33 additions and 18 deletions

View File

@ -122,25 +122,20 @@ Application::Application(const QString &id, int &argc, char **argv)
SettingsStorage::initInstance();
Preferences::initInstance();
if (m_commandLineArgs.webUiPort > 0) { // it will be -1 when user did not set any value
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
}
#if defined(Q_OS_MACX) && !defined(DISABLE_GUI)
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
// fix Mac OS X 10.9 (mavericks) font issue
// https://bugreports.qt-project.org/browse/QTBUG-32789
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
}
#endif
setApplicationName("qBittorrent");
initializeTranslation();
#ifndef DISABLE_GUI
#if !defined(DISABLE_GUI)
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WIN
#endif
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);
#endif // Q_OS_WIN
#endif // DISABLE_GUI
#endif
connect(this, SIGNAL(messageReceived(const QString &)), SLOT(processMessage(const QString &)));
connect(this, SIGNAL(aboutToQuit()), SLOT(cleanup()));

View File

@ -41,6 +41,7 @@
#include <QPen>
#include <QPushButton>
#include <QSplashScreen>
#ifdef QBT_STATIC_QT
#include <QtPlugin>
Q_IMPORT_PLUGIN(QICOPlugin)
@ -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[])
{
@ -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()) {
@ -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");
@ -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");
}
#endif // Q_OS_UNIX
#endif // DISABLE_GUI
void displayVersion()
{