mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 23:55:12 +00:00
Add interface scale (100%..150%) for Retina.
Fixes #69, fixes #3126, fixes #3789.
This commit is contained in:
@@ -461,14 +461,18 @@ void launch() {
|
||||
|
||||
const auto dpi = Application::primaryScreen()->logicalDotsPerInch();
|
||||
LOG(("Primary screen DPI: %1").arg(dpi));
|
||||
if (dpi <= 108) { // 0-96-108
|
||||
cSetScreenScale(100);
|
||||
} else if (dpi <= 132) { // 108-120-132
|
||||
cSetScreenScale(125);
|
||||
} else if (dpi <= 168) { // 132-144-168
|
||||
cSetScreenScale(150);
|
||||
} else { // 168-192-inf
|
||||
cSetScreenScale(200);
|
||||
if (dpi <= 108) {
|
||||
cSetScreenScale(100); // 100%: 96 DPI (0-108)
|
||||
} else if (dpi <= 132) {
|
||||
cSetScreenScale(125); // 125%: 120 DPI (108-132)
|
||||
} else if (dpi <= 168) {
|
||||
cSetScreenScale(150); // 150%: 144 DPI (132-168)
|
||||
} else if (dpi <= 216) {
|
||||
cSetScreenScale(200); // 200%: 192 DPI (168-216)
|
||||
} else if (dpi <= 264) {
|
||||
cSetScreenScale(250); // 250%: 240 DPI (216-264)
|
||||
} else {
|
||||
cSetScreenScale(300); // 300%: 288 DPI (264-inf)
|
||||
}
|
||||
|
||||
auto devicePixelRatio = application()->devicePixelRatio();
|
||||
@@ -480,11 +484,9 @@ void launch() {
|
||||
LOG(("Environmental variables: QT_AUTO_SCREEN_SCALE_FACTOR='%1'").arg(QString::fromLatin1(qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR"))));
|
||||
LOG(("Environmental variables: QT_SCREEN_SCALE_FACTORS='%1'").arg(QString::fromLatin1(qgetenv("QT_SCREEN_SCALE_FACTORS"))));
|
||||
}
|
||||
cSetRetina(true);
|
||||
cSetRetinaFactor(devicePixelRatio);
|
||||
cSetIntRetinaFactor(int32(cRetinaFactor()));
|
||||
cSetConfigScale(100);
|
||||
cSetRealScale(100);
|
||||
cSetScreenScale(kInterfaceScaleDefault);
|
||||
}
|
||||
|
||||
application()->createMessenger();
|
||||
|
Reference in New Issue
Block a user