2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35: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

@@ -1123,20 +1123,12 @@ bool Generator::writePxValuesInit() {
void initPxValues() {\n\
if (cRetina()) return;\n\
\n\
switch (cScale()) {\n";
for (int i = 1, scalesCount = _scales.size(); i < scalesCount; ++i) {
source_->stream() << "\tcase " << _scaleNames.at(i) << ":\n";
for (auto it = pxValues_.cbegin(), e = pxValues_.cend(); it != e; ++it) {
auto value = it.key();
int adjusted = structure::data::pxAdjust(value, _scales.at(i));
if (adjusted != value) {
source_->stream() << "\t\t" << pxValueName(value) << " = " << adjusted << ";\n";
}
}
source_->stream() << "\tbreak;\n";
const auto scale = cScale();\n";
for (auto it = pxValues_.cbegin(), e = pxValues_.cend(); it != e; ++it) {
auto value = it.key();
source_->stream() << "\t" << pxValueName(value) << " = ConvertScale(" << value << ", scale);\n";
}
source_->stream() << "\
}\n\
}\n\n";
return true;
}

View File

@@ -64,9 +64,6 @@ private:
QMap<QString, int> iconMasks_; // icon file -> index
std::map<QString, int, std::greater<QString>> paletteIndices_;
std::vector<int> _scales = { 4, 5, 6, 8 }; // scale / 4 gives our 1.00, 1.25, 1.50, 2.00
std::vector<const char *> _scaleNames = { "dbisOne", "dbisOneAndQuarter", "dbisOneAndHalf", "dbisTwo" };
};
} // namespace style

View File

@@ -59,13 +59,6 @@ inline bool operator!=(const Type &a, const Type &b) {
namespace data {
inline int pxAdjust(int value, int scale) {
if (value < 0) {
return -pxAdjust(-value, scale);
}
return qFloor((value * scale / 4.) + 0.1);
}
struct point {
int x, y;
};