2018-10-03 01:01:41 +01:00
|
|
|
#ifndef PALETTEEDITOR_H
|
|
|
|
#define PALETTEEDITOR_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2024-10-01 07:20:26 +01:00
|
|
|
|
|
|
|
#include "colorinputwidget.h"
|
2018-10-03 01:01:41 +01:00
|
|
|
#include "project.h"
|
2018-10-06 00:38:11 +01:00
|
|
|
#include "history.h"
|
2018-10-03 01:01:41 +01:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class PaletteEditor;
|
|
|
|
}
|
|
|
|
|
2018-10-06 00:38:11 +01:00
|
|
|
class PaletteHistoryItem {
|
|
|
|
public:
|
|
|
|
QList<QRgb> colors;
|
|
|
|
PaletteHistoryItem(QList<QRgb> colors) {
|
|
|
|
this->colors = colors;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-10-03 01:01:41 +01:00
|
|
|
class PaletteEditor : public QMainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-03-23 09:14:38 +00:00
|
|
|
explicit PaletteEditor(Project*, Tileset*, Tileset*, int paletteId, QWidget *parent = nullptr);
|
2018-10-03 01:01:41 +01:00
|
|
|
~PaletteEditor();
|
|
|
|
void setPaletteId(int);
|
2019-01-06 15:43:18 +00:00
|
|
|
void setTilesets(Tileset*, Tileset*);
|
2018-10-03 01:01:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::PaletteEditor *ui;
|
|
|
|
Project *project = nullptr;
|
2024-10-01 07:20:26 +01:00
|
|
|
QList<ColorInputWidget*> colorInputs;
|
2022-07-05 05:47:58 +01:00
|
|
|
|
2018-10-03 01:01:41 +01:00
|
|
|
Tileset *primaryTileset;
|
|
|
|
Tileset *secondaryTileset;
|
2022-07-05 05:47:58 +01:00
|
|
|
|
2018-10-06 00:38:11 +01:00
|
|
|
QList<History<PaletteHistoryItem*>> palettesHistory;
|
2022-07-05 05:47:58 +01:00
|
|
|
|
2024-10-01 07:20:26 +01:00
|
|
|
Tileset* getTileset(int paletteId);
|
|
|
|
void refreshColorInputs();
|
2024-10-04 18:36:50 +01:00
|
|
|
void commitEditHistory();
|
2024-10-01 07:20:26 +01:00
|
|
|
void commitEditHistory(int paletteId);
|
2020-09-25 13:12:13 +01:00
|
|
|
void restoreWindowState();
|
2020-09-16 02:43:52 +01:00
|
|
|
void closeEvent(QCloseEvent*);
|
2018-10-03 01:01:41 +01:00
|
|
|
|
2022-07-03 16:50:00 +01:00
|
|
|
void setRgb(int index, QRgb rgb);
|
2024-10-01 07:20:26 +01:00
|
|
|
void setPalette(int paletteId, const QList<QRgb> &palette);
|
2022-07-03 16:50:00 +01:00
|
|
|
|
2022-07-07 04:34:52 +01:00
|
|
|
void setBitDepth(int bits);
|
|
|
|
int bitDepth = 24;
|
|
|
|
|
2024-10-01 07:20:26 +01:00
|
|
|
static const int numColors = 16;
|
2022-07-01 03:38:11 +01:00
|
|
|
|
2018-10-03 01:01:41 +01:00
|
|
|
signals:
|
|
|
|
void closed();
|
|
|
|
void changedPaletteColor();
|
|
|
|
void changedPalette(int);
|
|
|
|
private slots:
|
|
|
|
void on_spinBox_PaletteId_valueChanged(int arg1);
|
2018-10-06 00:38:11 +01:00
|
|
|
void on_actionUndo_triggered();
|
|
|
|
void on_actionRedo_triggered();
|
2019-01-05 17:20:33 +00:00
|
|
|
void on_actionImport_Palette_triggered();
|
2018-10-03 01:01:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PALETTEEDITOR_H
|