porymap/include/ui/paletteeditor.h

66 lines
1.6 KiB
C
Raw Normal View History

2018-10-03 01:01:41 +01:00
#ifndef PALETTEEDITOR_H
#define PALETTEEDITOR_H
#include <QMainWindow>
#include <QSlider>
#include <QFrame>
#include <QLabel>
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<QList<QSlider*>> sliders;
QList<QFrame*> frames;
QList<QLabel*> rgbLabels;
QList<QToolButton *> pickButtons;
2018-10-03 01:01:41 +01:00
Tileset *primaryTileset;
Tileset *secondaryTileset;
QList<History<PaletteHistoryItem*>> palettesHistory;
2018-10-03 01:01:41 +01:00
void disableSliderSignals();
void enableSliderSignals();
void initColorSliders();
void refreshColorSliders();
void refreshColors();
void refreshColor(int);
void setColor(int);
void commitEditHistory(int paletteid);
void restoreWindowState();
void setColorsFromHistory(PaletteHistoryItem*, int);
void closeEvent(QCloseEvent*);
void pickColor(int i);
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