Add edit-undo history for tileset palette changes

This commit is contained in:
Marcus Huderle
2018-10-05 18:38:11 -05:00
parent 7a47c64509
commit bbfecba1ba
3 changed files with 89 additions and 1 deletions

View File

@@ -6,11 +6,20 @@
#include <QFrame>
#include <QLabel>
#include "project.h"
#include "history.h"
namespace Ui {
class PaletteEditor;
}
class PaletteHistoryItem {
public:
QList<QRgb> colors;
PaletteHistoryItem(QList<QRgb> colors) {
this->colors = colors;
}
};
class PaletteEditor : public QMainWindow {
Q_OBJECT
public:
@@ -26,6 +35,7 @@ private:
QList<QLabel*> rgbLabels;
Tileset *primaryTileset;
Tileset *secondaryTileset;
QList<History<PaletteHistoryItem*>> palettesHistory;
void disableSliderSignals();
void enableSliderSignals();
void initColorSliders();
@@ -33,6 +43,8 @@ private:
void refreshColors();
void refreshColor(int);
void setColor(int);
void commitEditHistory();
void setColorsFromHistory(PaletteHistoryItem*, int);
signals:
void closed();
@@ -40,6 +52,8 @@ signals:
void changedPalette(int);
private slots:
void on_spinBox_PaletteId_valueChanged(int arg1);
void on_actionUndo_triggered();
void on_actionRedo_triggered();
};
#endif // PALETTEEDITOR_H