2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Allow using any interface scale between 100%-300%.

This commit is contained in:
John Preston
2018-10-15 14:44:48 +03:00
parent 149639a53d
commit 19a9a990b6
30 changed files with 207 additions and 242 deletions

View File

@@ -541,7 +541,7 @@ enum {
dbiReplaceEmoji = 0x13,
dbiAskDownloadPath = 0x14,
dbiDownloadPathOld = 0x15,
dbiScale = 0x16,
dbiScaleOld = 0x16,
dbiEmojiTabOld = 0x17,
dbiRecentEmojiOldOld = 0x18,
dbiLoggedPhoneNumber = 0x19,
@@ -597,6 +597,7 @@ enum {
dbiTileBackground = 0x55,
dbiCacheSettings = 0x56,
dbiAnimationsDisabled = 0x57,
dbiScalePercent = 0x58,
dbiEncryptedWithSalt = 333,
dbiEncrypted = 444,
@@ -1364,24 +1365,45 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
cSetLastUpdateCheck(v);
} break;
case dbiScale: {
case dbiScaleOld: {
qint32 v;
stream >> v;
if (!_checkStreamStatus(stream)) return false;
DBIScale s = cRealScale();
switch (v) {
case dbisAuto: s = dbisAuto; break;
case dbisOne: s = dbisOne; break;
case dbisOneAndQuarter: s = dbisOneAndQuarter; break;
case dbisOneAndHalf: s = dbisOneAndHalf; break;
case dbisTwo: s = dbisTwo; break;
}
if (cRetina()) s = dbisOne;
const auto s = [&] {
if (cRetina()) {
return 100;
}
constexpr auto kAuto = 0;
constexpr auto kOne = 1;
constexpr auto kOneAndQuarter = 2;
constexpr auto kOneAndHalf = 3;
constexpr auto kTwo = 4;
switch (v) {
case kAuto: return kInterfaceScaleAuto;
case kOne: return 100;
case kOneAndQuarter: return 125;
case kOneAndHalf: return 150;
case kTwo: return 200;
}
return cRealScale();
}();
cSetConfigScale(s);
cSetRealScale(s);
} break;
case dbiScalePercent: {
qint32 v;
stream >> v;
if (!_checkStreamStatus(stream)) return false;
if (!v || (v >= 100 && v <= (cRetina() ? 150 : 300) && !(v % 25))) {
cSetConfigScale(v);
cSetRealScale(v);
}
} break;
case dbiLangOld: {
qint32 v;
stream >> v;
@@ -2555,7 +2577,7 @@ void writeSettings() {
data.stream << quint32(dbiSeenTrayTooltip) << qint32(cSeenTrayTooltip());
data.stream << quint32(dbiAutoUpdate) << qint32(cAutoUpdate());
data.stream << quint32(dbiLastUpdateCheck) << qint32(cLastUpdateCheck());
data.stream << quint32(dbiScale) << qint32(cConfigScale());
data.stream << quint32(dbiScalePercent) << qint32(cConfigScale());
data.stream << quint32(dbiDcOptions) << dcOptionsSerialized;
data.stream << quint32(dbiLoggedPhoneNumber) << cLoggedPhoneNumber();
data.stream << quint32(dbiTxtDomainString) << Global::TxtDomainString();