porymap/include/ui/gridsettingsdialog.h

60 lines
1.5 KiB
C
Raw Normal View History

2024-09-27 16:31:55 +01:00
#ifndef GRIDSETTINGSDIALOG_H
#define GRIDSETTINGSDIALOG_H
#include <QDialog>
#include <QAbstractButton>
2024-09-28 03:19:52 +01:00
#include "settings.h"
2024-09-27 16:31:55 +01:00
namespace Ui {
class GridSettingsDialog;
}
class GridSettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit GridSettingsDialog(GridSettings *settings = nullptr, QWidget *parent = nullptr);
~GridSettingsDialog();
signals:
void changedGridSettings();
private:
Ui::GridSettingsDialog *ui;
GridSettings *settings;
GridSettings originalSettings;
2024-09-29 00:28:07 +01:00
bool dimensionsLinked = true;
bool offsetsLinked = true;
2024-09-27 16:31:55 +01:00
void reset(bool force = false);
2024-09-29 00:28:07 +01:00
void setWidth(int value);
void setHeight(int value);
void setOffsetX(int value);
void setOffsetY(int value);
2024-09-27 16:31:55 +01:00
private slots:
void dialogButtonClicked(QAbstractButton *button);
void on_spinBox_Width_valueChanged(int value);
void on_spinBox_Height_valueChanged(int value);
void on_spinBox_X_valueChanged(int value);
void on_spinBox_Y_valueChanged(int value);
2024-09-28 03:19:52 +01:00
void on_comboBox_Style_currentIndexChanged(int index);
2024-09-28 08:50:51 +01:00
void onColorChanged(QRgb color);
2024-09-27 16:31:55 +01:00
};
inline bool operator==(const struct GridSettings &a, const struct GridSettings &b) {
return a.width == b.width
&& a.height == b.height
&& a.offsetX == b.offsetX
&& a.offsetY == b.offsetY
&& a.style == b.style
&& a.color == b.color;
}
inline bool operator!=(const struct GridSettings &a, const struct GridSettings &b) {
return !(operator==(a, b));
}
#endif // GRIDSETTINGSDIALOG_H