lolautoaccept/include/runepagelist.h

45 lines
985 B
C++

#pragma once
#include <vector>
#include <QListWidget>
#include "clientapi.h"
#include "config.h"
namespace Ui {
class RunePageList;
}
class DropEvent;
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();
constexpr void setClient(bool b) { isClient = b; }
constexpr void setOther(QListWidget* other) { this->other = other; }
void loadRunePages(const std::vector<ClientAPI::RunePage>& pages);
void loadRunePages(const std::vector<std::shared_ptr<Config::RunePageConfig>>& pages);
signals:
void runepageChanged(int id, QString name, const RunePage& rp);
protected:
virtual void dropEvent(QDropEvent* event) override;
private:
void addRunepageItem(QString name, int id, const ::RunePage& rp, bool isCurrent = false);
Ui::RunePageList* ui;
QListWidget* other = nullptr;
bool isClient;
};