mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-09 16:19:43 +00:00
Do not depend on QPixmap and QGuiApplication in MetaStyle.
Signed-off-by: Eduardo Sánchez Muñoz <eduardosanchezmunoz@gmail.com> (github: eduardosm)
This commit is contained in:
parent
166e99c0bd
commit
465b9f9a4a
@ -26,7 +26,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPainter>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
@ -24,14 +24,12 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPainter>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
using std::string;
|
||||
using std::cout;
|
||||
|
@ -453,7 +453,6 @@ static const int variants[] = { 0, 2, 3, 4 }, variantsCount = sizeof(variants) /
|
||||
static const char *variantNames[] = { "dbisOne", "dbisOneAndQuarter", "dbisOneAndHalf", "dbisTwo" };
|
||||
|
||||
static const char *variantPostfixes[] = { "", "_125x", "_150x", "_200x" };
|
||||
QPixmap *spriteMax = 0;
|
||||
QImage *variantSprites = 0;
|
||||
int *spriteWidths = 0;
|
||||
QImage *variantGrids = 0;
|
||||
@ -853,8 +852,7 @@ ScalarValue prepareSprite(int variant, const char *&text, const char *end) {
|
||||
QImage lastCopy = variantSprites[variantsCount - 1].copy(adjustPx(varLast, sprite.x(), true), adjustPx(varLast, sprite.y(), true), adjustPx(varLast, sprite.width(), true), adjustPx(varLast, sprite.height(), true));
|
||||
for (int i = 1; i < variantsCount - 1; ++i) {
|
||||
QPainter p(&variantSprites[i]);
|
||||
QPixmap copy = QPixmap::fromImage(lastCopy.scaled(adjustPx(variants[i], sprite.width(), true), adjustPx(variants[i], sprite.height(), true), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
||||
p.drawPixmap(QPoint(adjustPx(variants[i], sprite.x(), true), adjustPx(variants[i], sprite.y(), true)), copy);
|
||||
p.drawImage(QPoint(adjustPx(variants[i], sprite.x(), true), adjustPx(variants[i], sprite.y(), true)), lastCopy.scaled(adjustPx(variants[i], sprite.width(), true), adjustPx(variants[i], sprite.height(), true), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
for (int i = 0; i < variantsCount; ++i) {
|
||||
@ -1398,9 +1396,6 @@ bool genStyles(const QString &classes_in, const QString &classes_out, const QStr
|
||||
variantSprites[variantsCount - 1] = QImage(spriteLast);
|
||||
spriteWidths[variantsCount - 1] = variantSprites[variantsCount - 1].width();
|
||||
|
||||
QPixmap spriteMaxPix = QPixmap::fromImage(variantSprites[variantsCount - 1], Qt::ColorOnly);
|
||||
spriteMax = &spriteMaxPix;
|
||||
|
||||
if (!variantSprites[0].width() || !variantSprites[0].height()) {
|
||||
cout << "Could not open input sprite file '" << sprite0.toUtf8().constData() << "'!\n";
|
||||
QCoreApplication::exit(1);
|
||||
|
@ -29,7 +29,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
using std::string;
|
||||
|
@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
QObject *taskImpl = new GenStyles(classes_in, classes_out, styles_in, styles_out, path_to_sprites);
|
||||
|
||||
QGuiApplication a(argc, argv);
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
QObject::connect(taskImpl, SIGNAL(finished()), &a, SLOT(quit()));
|
||||
QTimer::singleShot(0, taskImpl, SLOT(run()));
|
||||
|
Loading…
Reference in New Issue
Block a user