MinetestMapperGUI/mainwindow.h

158 lines
4.2 KiB
C
Raw Normal View History

2015-05-13 07:49:49 -07:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
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>
2017-03-06 01:00:41 -08:00
#include <QTranslator>
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 "colorstxtassistant.h"
#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"
2015-05-13 07:49:49 -07:00
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
2017-03-02 22:02:15 -08:00
explicit MainWindow(bool portable, const QString &translationsPath, QTranslator *translator, QTranslator *qtTranslator, QWidget *parent = 0);
2015-05-13 07:49:49 -07:00
~MainWindow();
public slots:
void startColorsTxtAssistant();
2015-05-13 07:49:49 -07:00
protected:
void closeEvent(QCloseEvent* event);
2015-05-13 07:49:49 -07:00
// this event is called, when a new translator is loaded or the system language is changed
void changeEvent(QEvent*);
2017-01-27 03:15:24 -08:00
void showEvent(QShowEvent *event);
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);
void mapperInitialized(void);
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);
2017-03-02 22:02:15 -08:00
void switchTranslator(QTranslator *translator, const QString &prefix, const QLocale &locale);
void on_actionOpen_Terminal_triggered();
2015-05-13 07:49:49 -07:00
private:
bool portable;
2015-05-13 07:49:49 -07:00
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;
void finishUiInitialisation(void);
2015-05-13 07:49:49 -07:00
// loads a language by the given language shortcur (e.g. de, en)
2017-03-06 01:00:41 -08:00
void loadLanguage(const QString &rLanguage);
2015-05-13 07:49:49 -07:00
// creates the language menu dynamically from the content of m_langPath
void createLanguageMenu(void);
2017-03-02 22:02:15 -08:00
QTranslator *translator; // contains the translations for this application
QTranslator *qtTranslator; // contains the translations for qt
2015-05-13 07:49:49 -07:00
QString m_currLang; // contains the currently loaded language
2017-03-02 22:02:15 -08:00
QString translationsPath; // Path of language files. This is always fixed to /languages.
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 profile;
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();
2017-03-02 22:02:15 -08:00
2015-05-13 07:49:49 -07:00
};
#endif // MAINWINDOW_H