2023-04-23 19:13:49 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
|
|
|
#include "clientapi.h"
|
2023-04-23 23:54:09 +02:00
|
|
|
#include "config.h"
|
2023-06-11 20:10:11 +02:00
|
|
|
#include "datadragon.h"
|
2023-04-30 16:20:13 +02:00
|
|
|
#include "runeaspekt.h"
|
|
|
|
#include "runestyle.h"
|
2023-04-23 19:13:49 +02:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class RunePageList;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DropEvent;
|
2023-05-01 22:36:11 +02:00
|
|
|
class ClientAPI;
|
2023-04-23 19:13:49 +02:00
|
|
|
|
|
|
|
class RunePageList : public QListWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
static const uint32_t RoleId = Qt::UserRole;
|
|
|
|
static const uint32_t RolePointer = Qt::UserRole + 1;
|
|
|
|
|
|
|
|
explicit RunePageList(QWidget* parent = nullptr);
|
|
|
|
~RunePageList();
|
|
|
|
|
2023-05-01 22:36:11 +02:00
|
|
|
constexpr void setIsClient(bool b) { isClient = b; }
|
|
|
|
constexpr void setClient(ClientAPI& client) { this->client = &client; }
|
2023-04-23 19:13:49 +02:00
|
|
|
constexpr void setOther(QListWidget* other) { this->other = other; }
|
2023-05-01 01:23:08 +02:00
|
|
|
constexpr void setDataDragon(DataDragon& dd) { this->dd = ⅆ }
|
2023-04-23 19:13:49 +02:00
|
|
|
|
|
|
|
void loadRunePages(const std::vector<ClientAPI::RunePage>& pages);
|
2023-04-23 23:54:09 +02:00
|
|
|
void loadRunePages(const std::vector<std::shared_ptr<Config::RunePageConfig>>& pages);
|
|
|
|
|
2023-04-30 16:20:13 +02:00
|
|
|
void setRuneInfos(const std::vector<RuneAspekt>& runeInfo, const std::vector<RuneStyle>& runeStyles);
|
|
|
|
|
2023-04-23 23:54:09 +02:00
|
|
|
signals:
|
|
|
|
void runepageChanged(int id, QString name, const RunePage& rp);
|
2023-04-30 16:20:13 +02:00
|
|
|
void runepageDeleted(int id);
|
2023-04-23 19:13:49 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void dropEvent(QDropEvent* event) override;
|
|
|
|
|
2023-04-30 16:20:13 +02:00
|
|
|
private slots:
|
|
|
|
void itemChangedCallback(QListWidgetItem* item);
|
|
|
|
void openContextMenu(const QPoint&);
|
|
|
|
void deleteCurrentItem();
|
2023-05-01 22:36:11 +02:00
|
|
|
void editCurrentItem();
|
|
|
|
void duplicateCurrentItem();
|
2023-05-02 21:31:17 +02:00
|
|
|
void exportCurrentItem();
|
|
|
|
void importItem();
|
2023-04-30 16:20:13 +02:00
|
|
|
|
2023-04-23 19:13:49 +02:00
|
|
|
private:
|
2023-04-30 16:20:13 +02:00
|
|
|
void clearItems();
|
2023-04-23 23:54:09 +02:00
|
|
|
void addRunepageItem(QString name, int id, const ::RunePage& rp, bool isCurrent = false);
|
2023-06-11 20:10:11 +02:00
|
|
|
const DataDragon::ChampData& findChamp(const QString& name);
|
2023-04-23 23:54:09 +02:00
|
|
|
|
2023-04-30 16:20:13 +02:00
|
|
|
QString getRuneDescription(const ::RunePage& runepage);
|
|
|
|
QString getRuneText(uint32_t id);
|
|
|
|
QString getRuneStyleByID(uint32_t id);
|
|
|
|
|
|
|
|
const std::vector<RuneAspekt>* runeInfo = nullptr;
|
|
|
|
const std::vector<RuneStyle>* runeStyles = nullptr;
|
|
|
|
|
2023-04-23 19:13:49 +02:00
|
|
|
Ui::RunePageList* ui;
|
|
|
|
QListWidget* other = nullptr;
|
2023-05-01 01:23:08 +02:00
|
|
|
DataDragon* dd = nullptr;
|
2023-05-01 22:36:11 +02:00
|
|
|
ClientAPI* client = nullptr;
|
2023-04-23 19:13:49 +02:00
|
|
|
bool isClient;
|
|
|
|
};
|