mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
* refactor: remove unnecessary includes in headers * fix: formatting * chore: changelog * fix: scrollbar * fix: suggestions and old appbase remains * fix: suggestion * fix: missing Qt forward declarations * fix: another qt include * fix: includes for precompiled-headers=off * Add missing `<memory>` includes * Add missing `#pragma once` * Fix tests Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "common/SignalVectorModel.hpp"
|
|
#include "util/QStringHash.hpp"
|
|
|
|
#include <unordered_map>
|
|
|
|
namespace chatterino {
|
|
|
|
class HotkeyController;
|
|
class Hotkey;
|
|
|
|
class HotkeyModel : public SignalVectorModel<std::shared_ptr<Hotkey>>
|
|
{
|
|
public:
|
|
HotkeyModel(QObject *parent);
|
|
|
|
protected:
|
|
// turn a vector item into a model row
|
|
virtual std::shared_ptr<Hotkey> getItemFromRow(
|
|
std::vector<QStandardItem *> &row,
|
|
const std::shared_ptr<Hotkey> &original) override;
|
|
|
|
// turns a row in the model into a vector item
|
|
virtual void getRowFromItem(const std::shared_ptr<Hotkey> &item,
|
|
std::vector<QStandardItem *> &row) override;
|
|
|
|
virtual int beforeInsert(const std::shared_ptr<Hotkey> &item,
|
|
std::vector<QStandardItem *> &row,
|
|
int proposedIndex) override;
|
|
|
|
virtual void afterRemoved(const std::shared_ptr<Hotkey> &item,
|
|
std::vector<QStandardItem *> &row,
|
|
int index) override;
|
|
|
|
friend class HotkeyController;
|
|
|
|
private:
|
|
std::tuple<int, int> getCurrentAndNextCategoryModelIndex(
|
|
const QString &category) const;
|
|
|
|
std::unordered_map<QString, int> categoryCount_;
|
|
};
|
|
|
|
} // namespace chatterino
|