MinetestMapperGUI/mainwindow.h

174 lines
4.4 KiB
C
Raw Normal View History

2015-05-13 07:49:49 -07:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtDebug>
2017-03-06 01:00:41 -08:00
#include <QActionGroup>
#include <QCloseEvent>
#include <QColorDialog>
2017-03-06 01:00:41 -08:00
#include <QDataWidgetMapper>
#include <QDate>
2015-05-31 00:17:24 -07:00
#include <QInputDialog>
2017-03-06 01:00:41 -08:00
#include <QMainWindow>
#include <QMessageBox>
#include <QProgressBar>
#include <QSettings>
2017-01-27 03:15:24 -08:00
#include <QStringListModel>
2019-03-24 09:11:25 -07:00
#include <QFileSystemModel>
2017-01-27 03:15:24 -08:00
#ifdef Q_OS_WIN
#include <QWinTaskbarButton>
2017-03-06 01:00:41 -08:00
#include <QWinTaskbarProgress>
#endif
2017-03-06 23:39:00 -08:00
#include "colorstxtwizard.h"
2017-03-06 01:00:41 -08:00
#include "configdialog.h"
2016-12-14 01:00:35 -08:00
#include "drawmapfigure.h"
#include "drawmapfiguretablemodel.h"
#include "figuredelegate.h"
2017-01-27 03:15:24 -08:00
#include "minetestmapperexe.h"
2019-03-21 19:24:03 -07:00
#include "translator.h"
2015-05-13 07:49:49 -07:00
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
2019-03-29 09:23:22 -07:00
explicit MainWindow(Translator *translator, QWidget *parent = nullptr);
2019-03-29 09:35:10 -07:00
~MainWindow() override;
2015-05-13 07:49:49 -07:00
enum class GeometryGranularity {
unspecified = -1,
pixel = 0,
block = 1
};
Q_ENUM(GeometryGranularity)
const QMetaEnum meGeometryGranularity = QMetaEnum::fromType<GeometryGranularity>();
enum class GeometrySizeMode {
automatic = 0,
fixed,
shrink
};
Q_ENUM(GeometrySizeMode)
const QMetaEnum meGeometrySizeMode = QMetaEnum::fromType<GeometrySizeMode>();
public slots:
void startColorsTxtAssistant();
2015-05-13 07:49:49 -07:00
protected:
2019-03-29 09:35:10 -07:00
void closeEvent(QCloseEvent* event) override;
2015-05-13 07:49:49 -07:00
// this event is called, when a new translator is loaded or the system language is changed
2019-03-29 09:35:10 -07:00
void changeEvent(QEvent*) override;
2015-05-13 07:49:49 -07:00
2019-03-29 09:35:10 -07:00
void showEvent(QShowEvent *event) override;
2015-05-13 07:49:49 -07:00
protected slots:
// this slot is called by the language menu actions
2017-03-06 01:00:41 -08:00
void slotLanguageChanged(QAction *action);
void slotProfileChanged(QAction *action);
2015-05-13 07:49:49 -07:00
private slots:
QString getOutputFileName();
2015-05-13 07:49:49 -07:00
void on_button_generate_clicked();
2017-01-27 03:15:24 -08:00
void readError(const QString &str);
2019-03-29 09:27:24 -07:00
void mapperInitialized();
2015-05-13 07:49:49 -07:00
void mapperFinisched(int exit);
void error(QProcess::ProcessError error);
2015-05-31 00:17:24 -07:00
void createProfilesMenu();
2015-05-13 07:49:49 -07:00
void writeSettings();
2017-01-27 03:15:24 -08:00
void writeProfile();
2015-05-13 07:49:49 -07:00
void readSettings();
2017-01-27 03:15:24 -08:00
void readProfile();
2015-05-13 07:49:49 -07:00
void on_browseWorld_clicked();
void on_saveImage_clicked();
void on_browseHeightmapNodes_clicked();
void on_browse_HeightmapColors_clicked();
void on_browseColorsTxt_clicked();
void on_actionAbout_MinetestMapperGUI_triggered();
void on_actionAbout_MinetestMapper_triggered();
void on_path_OutputImage_textChanged();
void on_button_cancel_clicked();
2015-05-31 00:17:24 -07:00
void on_actionNew_Profile_triggered();
2015-06-15 06:14:35 -07:00
void on_actionEdit_colors_txt_triggered();
void on_actionEdit_heightmap_nodes_txt_triggered();
void on_actionEdit_heightmap_colors_txt_triggered();
void on_drawScaleLeft_toggled(bool checked);
void on_drawScaleTop_toggled(bool checked);
void on_drawHeightscale_toggled(bool checked);
2015-07-02 09:04:54 -07:00
void on_tilecenter_clicked();
void on_tileorigin_clicked();
void on_actionPreferences_triggered();
2016-12-14 01:00:35 -08:00
void on_button_addFigure_clicked();
void on_figure_geometry_apply_clicked();
void on_button_deleteFigure_clicked();
void on_figureSelect_currentIndexChanged(int index);
void on_actionOpen_Terminal_triggered();
2019-03-24 09:11:25 -07:00
void on_treeView_activated(const QModelIndex &index);
void on_path_minetestWorlds_editingFinished();
void on_treeView_clicked(const QModelIndex &index);
void on_browseWorldsDir_clicked();
2015-05-13 07:49:49 -07:00
private:
Ui::MainWindow *ui;
QProgressBar *progressBar;
QProcess *myProcess;
2015-05-31 00:17:24 -07:00
QActionGroup *profileGroup;
#ifdef Q_OS_WIN
QWinTaskbarButton *taskbarButton;
QWinTaskbarProgress *taskbarProgress;
#endif
ConfigSettings currentSettings;
2019-03-29 09:27:24 -07:00
void finishUiInitialisation();
2015-05-13 07:49:49 -07:00
// creates the language menu dynamically from the content of m_langPath
2019-03-29 09:27:24 -07:00
void createLanguageMenu();
2015-05-13 07:49:49 -07:00
2019-03-21 19:24:03 -07:00
Translator *translator; // contains the translations for this application
QString currentProfile; //contains the name of current loaded profile
QString pathAppData; // Path where the settings should be stored.
QString pathProfiles; // path where the profiles should be stored.
QSettings *settings;
2017-01-27 03:15:24 -08:00
QSettings *profile;
QString getColorsTxtFilePath(QDir *appDir, QDir *worldDir);
2016-12-14 01:00:35 -08:00
DrawMapFigureTableModel *drawMapFigureTable;
QDataWidgetMapper *drawMapFigureTableMapper;
2017-01-27 03:15:24 -08:00
MinetestMapperExe *minetestMapper;
QStringListModel *backends = new QStringListModel();
2019-03-24 09:11:25 -07:00
QFileSystemModel *minetestWorldsModel = new QFileSystemModel();
2017-03-02 22:02:15 -08:00
2015-05-13 07:49:49 -07:00
};
#endif // MAINWINDOW_H