mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Add interface scale (100%..150%) for Retina.
Fixes #69, fixes #3126, fixes #3789.
This commit is contained in:
@@ -95,28 +95,6 @@ DeclareSetting(int, ScreenScale);
|
||||
DeclareSetting(int, ConfigScale);
|
||||
DeclareSetting(QString, TimeFormat);
|
||||
|
||||
constexpr auto kInterfaceScaleAuto = 0;
|
||||
|
||||
inline int cEvalScale(int scale) {
|
||||
return (scale == kInterfaceScaleAuto) ? cScreenScale() : scale;
|
||||
}
|
||||
|
||||
inline int cScale() {
|
||||
return cEvalScale(cRealScale());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T ConvertScale(T value, int scale) {
|
||||
return (value < 0.)
|
||||
? (-ConvertScale(-value, scale))
|
||||
: T(std::round((float64(value) * scale / 100.) - 0.01));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T ConvertScale(T value) {
|
||||
return ConvertScale(value, cScale());
|
||||
}
|
||||
|
||||
inline void cChangeTimeFormat(const QString &newFormat) {
|
||||
if (!newFormat.isEmpty()) cSetTimeFormat(newFormat);
|
||||
}
|
||||
@@ -177,7 +155,6 @@ inline bool passcodeCanTry() {
|
||||
DeclareSetting(QStringList, SendPaths);
|
||||
DeclareSetting(QString, StartUrl);
|
||||
|
||||
DeclareSetting(bool, Retina);
|
||||
DeclareSetting(float64, RetinaFactor);
|
||||
DeclareSetting(int32, IntRetinaFactor);
|
||||
|
||||
@@ -206,3 +183,36 @@ DeclareSetting(int32, AutoDownloadPhoto);
|
||||
DeclareSetting(int32, AutoDownloadAudio);
|
||||
DeclareSetting(int32, AutoDownloadGif);
|
||||
DeclareSetting(bool, AutoPlayGif);
|
||||
|
||||
constexpr auto kInterfaceScaleAuto = 0;
|
||||
constexpr auto kInterfaceScaleMin = 100;
|
||||
constexpr auto kInterfaceScaleDefault = 100;
|
||||
constexpr auto kInterfaceScaleMax = 300;
|
||||
|
||||
inline int cEvalScale(int scale) {
|
||||
return (scale == kInterfaceScaleAuto) ? cScreenScale() : scale;
|
||||
}
|
||||
|
||||
inline int cScale() {
|
||||
return cEvalScale(cRealScale());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T ConvertScale(T value, int scale) {
|
||||
return (value < 0.)
|
||||
? (-ConvertScale(-value, scale))
|
||||
: T(std::round((float64(value) * scale / 100.) - 0.01));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T ConvertScale(T value) {
|
||||
return ConvertScale(value, cScale());
|
||||
}
|
||||
|
||||
inline void SetScaleChecked(int scale) {
|
||||
const auto checked = (scale == kInterfaceScaleAuto)
|
||||
? kInterfaceScaleAuto
|
||||
: snap(scale, kInterfaceScaleMin, kInterfaceScaleMax / cIntRetinaFactor());
|
||||
cSetConfigScale(checked);
|
||||
cSetRealScale(checked);
|
||||
}
|
||||
|
Reference in New Issue
Block a user