2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Removing almost all animated over states in IconButton.

This commit is contained in:
John Preston
2016-11-01 15:46:34 +03:00
parent e08f5437a6
commit c932f3d9df
44 changed files with 435 additions and 307 deletions

View File

@@ -934,9 +934,13 @@ QByteArray iconMaskValueSize(int width, int height) {
return result;
}
QByteArray iconMaskValuePng(const QString &filepath) {
QByteArray iconMaskValuePng(QString filepath) {
QByteArray result;
auto inverted = filepath.endsWith("-invert");
if (inverted) {
filepath.chop(QLatin1String("-invert").size());
}
QImage png100x(filepath + ".png");
QImage png200x(filepath + "@2x.png");
png100x.setDevicePixelRatio(1.);
@@ -957,6 +961,10 @@ QByteArray iconMaskValuePng(const QString &filepath) {
common::logError(kErrorBadIconSize, filepath + ".png") << "bad icons size, 1x: " << png100x.width() << "x" << png100x.height() << ", 2x: " << png200x.width() << "x" << png200x.height();
return result;
}
if (inverted) {
png100x.invertPixels();
png200x.invertPixels();
}
QImage png125x = png200x.scaled(structure::data::pxAdjust(png100x.width(), 5), structure::data::pxAdjust(png100x.height(), 5), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
QImage png150x = png200x.scaled(structure::data::pxAdjust(png100x.width(), 6), structure::data::pxAdjust(png100x.height(), 6), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);

View File

@@ -822,16 +822,20 @@ QString ParsedFile::readMonoIconFilename() {
if (auto filename = readValue()) {
if (filename.type().tag == structure::TypeTag::String) {
auto filepath = QString::fromStdString(filename.String());
auto inverted = filepath.endsWith("-invert");
if (inverted) {
filepath.chop(QLatin1String("-invert").size());
}
for (const auto &path : options_.includePaths) {
QFileInfo fileinfo(path + '/' + filepath + ".png");
if (fileinfo.exists()) {
return path + '/' + filepath;
return path + '/' + filepath + (inverted ? "-invert" : "");
}
}
for (const auto &path : options_.includePaths) {
QFileInfo fileinfo(path + "/icons/" + filepath + ".png");
if (fileinfo.exists()) {
return path + "/icons/" + filepath;
return path + "/icons/" + filepath + (inverted ? "-invert" : "");
}
}
logError(common::kErrorFileNotFound) << "could not open icon file '" << filename.String() << "'";