New event button refactor

This commit is contained in:
GriffinR
2025-03-02 18:05:33 -05:00
parent 87193158ae
commit edd2cce110
6 changed files with 99 additions and 167 deletions

View File

@@ -66,7 +66,6 @@ public:
Trigger, WeatherTrigger,
Sign, HiddenItem, SecretBase,
HealLocation,
Generic,
None,
};
@@ -168,7 +167,9 @@ public:
static QString groupToString(Event::Group group);
static QString typeToString(Event::Type type);
static Event::Type typeFromString(QString type);
static QString typeToJsonKey(Event::Type type);
static Event::Type typeFromJsonKey(QString type);
static QList<Event::Type> types();
// protected attributes
protected:

View File

@@ -9,31 +9,20 @@ class NewEventToolButton : public QToolButton
Q_OBJECT
public:
explicit NewEventToolButton(QWidget *parent = nullptr);
Event::Type getSelectedEventType();
QAction *newObjectAction;
QAction *newCloneObjectAction;
QAction *newWarpAction;
QAction *newHealLocationAction;
QAction *newTriggerAction;
QAction *newWeatherTriggerAction;
QAction *newSignAction;
QAction *newHiddenItemAction;
QAction *newSecretBaseAction;
public slots:
void newObject();
void newCloneObject();
void newWarp();
void newHealLocation();
void newTrigger();
void newWeatherTrigger();
void newSign();
void newHiddenItem();
void newSecretBase();
Event::Type getSelectedEventType() const { return this->selectedEventType; }
bool selectEventType(Event::Type type);
void setEventTypeVisible(Event::Type type, bool visible);
signals:
void newEventAdded(Event::Type);
private:
QMap<Event::Type,QAction*> typeToAction;
Event::Type selectedEventType;
void init();
QMenu* menu;
void addEventType(Event::Type type);
};
#endif // NEWEVENTTOOLBUTTON_H