mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-17 20:41:33 -07:00
[Room][UserList] Introduce style delegate for user list
- Allow users to set a card name and parameters as their background banner - Allow mods to white/blacklist cards - Allow toggling back to the old display style Took 7 minutes Took 28 seconds Took 2 minutes Took 2 minutes
This commit is contained in:
parent
bdb0f12f66
commit
aff93a4435
35 changed files with 1977 additions and 26 deletions
|
|
@ -7,6 +7,8 @@
|
|||
#include <QChar>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLoggingCategory>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
|
|
@ -681,6 +683,30 @@ ServerInfo_User Servatrice_DatabaseInterface::evalUserQueryResult(const QSqlQuer
|
|||
if (!clientid.isEmpty()) {
|
||||
result.set_clientid(clientid.toStdString());
|
||||
}
|
||||
|
||||
const QString cardArtParamsJson = query->value(12).toString();
|
||||
if (!cardArtParamsJson.isEmpty()) {
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(cardArtParamsJson.toUtf8());
|
||||
if (doc.isObject()) {
|
||||
const QJsonObject obj = doc.object();
|
||||
auto *cap = result.mutable_card_art_params();
|
||||
if (obj.contains("card_name")) {
|
||||
cap->set_card_name(obj["card_name"].toString().toStdString());
|
||||
}
|
||||
if (obj.contains("marginPctL")) {
|
||||
cap->set_margin_pct_l(obj["marginPctL"].toDouble(0.33));
|
||||
}
|
||||
if (obj.contains("marginPctR")) {
|
||||
cap->set_margin_pct_r(obj["marginPctR"].toDouble(0.02));
|
||||
}
|
||||
if (obj.contains("verticalOffset")) {
|
||||
cap->set_vertical_offset(obj["verticalOffset"].toDouble(0.35));
|
||||
}
|
||||
if (obj.contains("zoom")) {
|
||||
cap->set_zoom(obj["zoom"].toDouble(1.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -698,7 +724,7 @@ ServerInfo_User Servatrice_DatabaseInterface::getUserData(const QString &name, b
|
|||
|
||||
QSqlQuery *query = prepareQuery("select id, name, admin, country, privlevel, leftPawnColorOverride, "
|
||||
"rightPawnColorOverride, realname, avatar_bmp, registrationDate, "
|
||||
"email, clientid from {prefix}_users where "
|
||||
"email, clientid, card_art_params from {prefix}_users where "
|
||||
"name = :name and active = 1");
|
||||
query->bindValue(":name", name);
|
||||
if (!execSqlQuery(query)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue