porymap/include/ui/paletteeditor.h

67 lines
1.5 KiB
C
Raw Permalink Normal View History

2018-10-03 01:01:41 +01:00
#ifndef PALETTEEDITOR_H
#define PALETTEEDITOR_H
#include <QMainWindow>
#include "colorinputwidget.h"
2018-10-03 01:01:41 +01:00
#include "project.h"
#include "history.h"
2018-10-03 01:01:41 +01:00
namespace Ui {
class PaletteEditor;
}
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:
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;
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
QList<History<PaletteHistoryItem*>> palettesHistory;
2022-07-05 05:47:58 +01:00
Tileset* getTileset(int paletteId);
void refreshColorInputs();
2024-10-04 18:36:50 +01:00
void commitEditHistory();
void commitEditHistory(int paletteId);
void restoreWindowState();
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);
void setPalette(int paletteId, const QList<QRgb> &palette);
2022-07-03 16:50:00 +01:00
void setBitDepth(int bits);
int bitDepth = 24;
static const int numColors = 16;
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);
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionImport_Palette_triggered();
2018-10-03 01:01:41 +01:00
};
#endif // PALETTEEDITOR_H