mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
This commit is contained in:
parent
8dbdd24c8e
commit
b29bd9e070
272 changed files with 13378 additions and 9535 deletions
|
|
@ -15,7 +15,8 @@ QPixmap PhasePixmapGenerator::generatePixmap(int height, QString name)
|
|||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
||||
QPixmap pixmap = QPixmap("theme:phases/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmap pixmap =
|
||||
QPixmap("theme:phases/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
|
|
@ -31,14 +32,14 @@ QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool hi
|
|||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
||||
QPixmap pixmap = QPixmap("theme:counters/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if(pixmap.isNull())
|
||||
{
|
||||
QPixmap pixmap =
|
||||
QPixmap("theme:counters/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (pixmap.isNull()) {
|
||||
name = "general";
|
||||
if (highlight)
|
||||
name.append("_highlight");
|
||||
pixmap = QPixmap("theme:counters/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
pixmap =
|
||||
QPixmap("theme:counters/" + name).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
pmCache.insert(key, pixmap);
|
||||
|
|
@ -58,9 +59,10 @@ QPixmap PingPixmapGenerator::generatePixmap(int size, int value, int max)
|
|||
if ((max == -1) || (value == -1))
|
||||
color = Qt::black;
|
||||
else
|
||||
color.setHsv(120 * (1.0 - ((double) value / max)), 255, 255);
|
||||
color.setHsv(120 * (1.0 - ((double)value / max)), 255, 255);
|
||||
|
||||
QRadialGradient g(QPointF((double) pixmap.width() / 2, (double) pixmap.height() / 2), qMin(pixmap.width(), pixmap.height()) / 2.0);
|
||||
QRadialGradient g(QPointF((double)pixmap.width() / 2, (double)pixmap.height() / 2),
|
||||
qMin(pixmap.width(), pixmap.height()) / 2.0);
|
||||
g.setColorAt(0, color);
|
||||
g.setColorAt(1, Qt::transparent);
|
||||
painter.fillRect(0, 0, pixmap.width(), pixmap.height(), QBrush(g));
|
||||
|
|
@ -74,7 +76,7 @@ QMap<int, QPixmap> PingPixmapGenerator::pmCache;
|
|||
|
||||
QPixmap GenderPixmapGenerator::generatePixmap(int height)
|
||||
{
|
||||
ServerInfo_User::Gender gender = ServerInfo_User::GenderUnknown;
|
||||
ServerInfo_User::Gender gender = ServerInfo_User::GenderUnknown;
|
||||
|
||||
int key = gender * 100000 + height;
|
||||
if (pmCache.contains(key))
|
||||
|
|
@ -83,8 +85,8 @@ QPixmap GenderPixmapGenerator::generatePixmap(int height)
|
|||
QString genderStr;
|
||||
genderStr = "unknown";
|
||||
|
||||
|
||||
QPixmap pixmap = QPixmap("theme:genders/" + genderStr).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmap pixmap =
|
||||
QPixmap("theme:genders/" + genderStr).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
}
|
||||
|
|
@ -100,7 +102,8 @@ QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countr
|
|||
return pmCache.value(key);
|
||||
|
||||
int width = height * 2;
|
||||
QPixmap pixmap = QPixmap("theme:countries/" + countryCode.toLower()).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmap pixmap = QPixmap("theme:countries/" + countryCode.toLower())
|
||||
.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
QPainter painter(&pixmap);
|
||||
painter.setPen(Qt::black);
|
||||
|
|
@ -114,7 +117,7 @@ QMap<QString, QPixmap> CountryPixmapGenerator::pmCache;
|
|||
|
||||
QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags userLevel, bool isBuddy, QString privLevel)
|
||||
{
|
||||
|
||||
|
||||
QString key = QString::number(height * 10000) + ":" + (int)userLevel + ":" + (int)isBuddy + ":" + privLevel;
|
||||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
|
@ -137,15 +140,15 @@ QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags user
|
|||
|
||||
if (isBuddy)
|
||||
levelString.append("_buddy");
|
||||
|
||||
QPixmap pixmap = QPixmap("theme:userlevels/" + levelString).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
QPixmap pixmap = QPixmap("theme:userlevels/" + levelString)
|
||||
.scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QMap<QString, QPixmap> UserLevelPixmapGenerator::pmCache;
|
||||
|
||||
|
||||
QPixmap LockPixmapGenerator::generatePixmap(int height)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue