forked from MrBesen/lolautoaccept
Tooltip for champrows
This commit is contained in:
parent
71853c65d6
commit
226c031ecf
|
@ -10,7 +10,7 @@ public:
|
||||||
explicit ChampRow(QListWidget *parent = nullptr);
|
explicit ChampRow(QListWidget *parent = nullptr);
|
||||||
~ChampRow();
|
~ChampRow();
|
||||||
|
|
||||||
void setChamp(const std::string& name, uint32_t id, QPixmap icon);
|
void setChamp(const DataDragon::ChampData& cd, QPixmap icon);
|
||||||
QString getChamp() const;
|
QString getChamp() const;
|
||||||
uint32_t getChampID() const;
|
uint32_t getChampID() const;
|
||||||
QPixmap getIcon();
|
QPixmap getIcon();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
void setChampions(const std::vector<std::string>& champs);
|
void setChampions(const std::vector<std::string>& champs);
|
||||||
|
|
||||||
void setDataDragon(DataDragon* dd);
|
void setDataDragon(DataDragon* dd);
|
||||||
void addChamp(const std::string& champname, uint32_t id, QPixmap icon);
|
void addChamp(const DataDragon::ChampData& cd, QPixmap icon);
|
||||||
|
|
||||||
void loadConfig(Config::StageConfig& c);
|
void loadConfig(Config::StageConfig& c);
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,15 @@ ChampRow* ChampionSearch::getSearchResult() {
|
||||||
void ChampionSearch::searchChanged(QString str) {
|
void ChampionSearch::searchChanged(QString str) {
|
||||||
Log::info << "champion search: " << str.toStdString();
|
Log::info << "champion search: " << str.toStdString();
|
||||||
|
|
||||||
auto champs = dd->getMatchingChamp(str.toStdString());
|
const std::vector<const DataDragon::ChampData*> champs = dd->getMatchingChamp(str.toStdString());
|
||||||
Log::info << "found " << champs.size() << " champs";
|
Log::info << "found " << champs.size() << " champs";
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
for(auto it : champs) {
|
for(auto cd : champs) {
|
||||||
dd->getImageAsnyc(it->id, [this, it](QPixmap img) {
|
dd->getImageAsnyc(cd->id, [this, cd](QPixmap img) {
|
||||||
auto cr = new ChampRow();
|
auto cr = new ChampRow();
|
||||||
cr->setChamp(it->name, it->key, img);
|
cr->setChamp(*cd, img);
|
||||||
ui->championList->addItem(cr);
|
ui->championList->addItem(cr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,15 @@ ChampRow::ChampRow(QListWidget* parent) : QListWidgetItem(parent) {
|
||||||
ChampRow::~ChampRow() {
|
ChampRow::~ChampRow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChampRow::setChamp(const std::string& name, uint32_t id, QPixmap icon) {
|
void ChampRow::setChamp(const DataDragon::ChampData& cd, QPixmap icon) {
|
||||||
setText(QString::fromStdString(name));
|
setText(QString::fromStdString(cd.name));
|
||||||
champid = id;
|
champid = cd.key;
|
||||||
this->icon = icon;
|
this->icon = icon;
|
||||||
setIcon(QIcon(icon));
|
setIcon(QIcon(icon));
|
||||||
|
|
||||||
|
#define QS(A) arg(QString::fromStdString(A))
|
||||||
|
setToolTip(QWidget::tr("Champion: %1\nType: %2\nTitle: %3\nID: %4").QS(cd.name).QS(cd.partype).QS(cd.title).arg(cd.key));
|
||||||
|
#undef QS
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ChampRow::getChamp() const {
|
QString ChampRow::getChamp() const {
|
||||||
|
|
|
@ -60,11 +60,11 @@ void StageSettings::setDataDragon(DataDragon* dd_) {
|
||||||
dd = dd_;
|
dd = dd_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StageSettings::addChamp(const std::string& champname, uint32_t id, QPixmap icon) {
|
void StageSettings::addChamp(const DataDragon::ChampData& cd, QPixmap icon) {
|
||||||
auto champr = new ChampRow();
|
auto champr = new ChampRow();
|
||||||
ui->championList->addItem(champr);
|
ui->championList->addItem(champr);
|
||||||
|
|
||||||
champr->setChamp(champname, id, icon);
|
champr->setChamp(cd, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StageSettings::loadConfig(Config::StageConfig& c) {
|
void StageSettings::loadConfig(Config::StageConfig& c) {
|
||||||
|
@ -112,7 +112,7 @@ void StageSettings::resolveAndAddChamp(const std::string& name, bool emitchange)
|
||||||
auto cd = dd->getBestMatchingChamp(name, &count);
|
auto cd = dd->getBestMatchingChamp(name, &count);
|
||||||
|
|
||||||
dd->getImageAsnyc(cd.id, [this, name, cd, emitchange](QPixmap img) {
|
dd->getImageAsnyc(cd.id, [this, name, cd, emitchange](QPixmap img) {
|
||||||
addChamp(name, cd.key, img);
|
addChamp(cd, img);
|
||||||
if(emitchange) {
|
if(emitchange) {
|
||||||
emit championsChanged();
|
emit championsChanged();
|
||||||
}
|
}
|
||||||
|
|
14
ts/de_DE.ts
14
ts/de_DE.ts
|
@ -109,6 +109,20 @@
|
||||||
<translation>Auto-Acceptor fehlgeschlagen!</translation>
|
<translation>Auto-Acceptor fehlgeschlagen!</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QWidget</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/champrow.cpp" line="16"/>
|
||||||
|
<source>Champion: %1
|
||||||
|
Type: %2
|
||||||
|
Title: %3
|
||||||
|
ID: %4</source>
|
||||||
|
<translation>Champion: %1
|
||||||
|
Typ: %2
|
||||||
|
Titel: %3
|
||||||
|
ID: %4</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>RuneDisplay</name>
|
<name>RuneDisplay</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
14
ts/en.ts
14
ts/en.ts
|
@ -109,6 +109,20 @@
|
||||||
<translation>Auto-Acceptor failed!</translation>
|
<translation>Auto-Acceptor failed!</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QWidget</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/champrow.cpp" line="16"/>
|
||||||
|
<source>Champion: %1
|
||||||
|
Type: %2
|
||||||
|
Title: %3
|
||||||
|
ID: %4</source>
|
||||||
|
<translation>Champion: %1
|
||||||
|
Type: %2
|
||||||
|
Title: %3
|
||||||
|
ID: %4</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>RuneDisplay</name>
|
<name>RuneDisplay</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
Loading…
Reference in New Issue