[VDE] Deck Analytics Widgets overhaul (#6463)

* [VDE] Deck Analytics Widgets overhaul

Took 2 minutes

Took 3 minutes

Took 3 minutes

* Qt5 version guards.

Took 33 minutes


Took 3 seconds

* Include QtMath

Took 3 minutes

Took 8 seconds

* Use getCards()

Took 4 minutes

* Non pointer stuff

Took 52 seconds

* Add a newline to the tooltip

Took 2 minutes

Took 27 seconds

* Fix build failure on macOS 15

* Rename some things.

Took 17 minutes

Took 11 seconds


Took 18 seconds

* Address overloads, fix default configuration.

Took 1 hour 9 minutes

Took 8 seconds

* Fix mana curve default config.

Took 4 minutes

* Namespace to Qt libs

Took 5 minutes

* Selection overlay is transparent for mouse events.

Took 2 minutes

* Brace initialize.

Took 8 minutes

* Debian 11.

Took 5 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: RickyRister <ricky.rister.wang@gmail.com>
This commit is contained in:
BruebachL 2025-12-31 19:45:49 +01:00 committed by GitHub
parent 36d8280765
commit df9a8b2272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 4372 additions and 394 deletions

View file

@ -21,6 +21,43 @@ inline color convertQColorToColor(const QColor &c)
result.set_b(c.blue());
return result;
}
namespace GameSpecificColors
{
namespace MTG
{
inline QColor colorHelper(const QString &name)
{
static const QMap<QString, QColor> colorMap = {
{"W", QColor(245, 245, 220)},
{"U", QColor(80, 140, 255)},
{"B", QColor(60, 60, 60)},
{"R", QColor(220, 60, 50)},
{"G", QColor(70, 160, 70)},
{"Creature", QColor(70, 130, 180)},
{"Instant", QColor(138, 43, 226)},
{"Sorcery", QColor(199, 21, 133)},
{"Enchantment", QColor(218, 165, 32)},
{"Artifact", QColor(169, 169, 169)},
{"Planeswalker", QColor(210, 105, 30)},
{"Land", QColor(110, 80, 50)},
};
if (colorMap.contains(name))
return colorMap[name];
if (name.length() == 1 && colorMap.contains(name.toUpper()))
return colorMap[name.toUpper()];
uint h = qHash(name);
int r = 100 + (h % 120);
int g = 100 + ((h >> 8) % 120);
int b = 100 + ((h >> 16) % 120);
return QColor(r, g, b);
}
} // namespace MTG
} // namespace GameSpecificColors
#endif
inline color makeColor(int r, int g, int b)

View file

@ -15,6 +15,20 @@ template <typename T> T *findParentOfType(const QObject *obj)
}
return nullptr;
}
static inline void clearLayoutRec(QLayout *l)
{
if (!l)
return;
QLayoutItem *it;
while ((it = l->takeAt(0)) != nullptr) {
if (QWidget *w = it->widget())
w->deleteLater();
if (QLayout *sub = it->layout())
clearLayoutRec(sub);
delete it;
}
}
} // namespace QtUtils
#endif // COCKATRICE_QT_UTILS_H