diff options
| author | Xavier Del Campo <xavi.dcr@gmail.com> | 2017-02-04 14:49:08 +0100 |
|---|---|---|
| committer | Xavier Del Campo <xavi.dcr@gmail.com> | 2017-02-04 14:49:08 +0100 |
| commit | 189ecf754d0c8131464bfdff98fb56e7752556b1 (patch) | |
| tree | 89e7d02128bbc7b2d3f5c19a3da14ec14291982a /Source/MapEditor/mainwindow.cpp | |
Initial commit
Diffstat (limited to 'Source/MapEditor/mainwindow.cpp')
| -rwxr-xr-x | Source/MapEditor/mainwindow.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Source/MapEditor/mainwindow.cpp b/Source/MapEditor/mainwindow.cpp new file mode 100755 index 0000000..58c37f6 --- /dev/null +++ b/Source/MapEditor/mainwindow.cpp @@ -0,0 +1,81 @@ +#include "mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+
+ connect(ui->LoadMap_Btn, SIGNAL(released()), this, SLOT(onLoadMap()));
+
+ ui->openGLWidget->
+
+ appSettings();
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::onLoadMap(void)
+{
+ QString path = QFileDialog::getOpenFileName(this,
+ "Open map file",
+ _last_dir,
+ "Map files (*.LVL)");
+
+ QFile f(path);
+
+ if(checkFile(f) == false)
+ {
+ return;
+ }
+
+ QDataStream txt(&f);
+
+
+}
+
+bool MainWindow::checkFile(QFile& f)
+{
+ QFileInfo fi(f);
+
+ if(fi.exists() == false)
+ {
+ return false;
+ }
+
+ if(f.open(QFile::ReadWrite) == false)
+ {
+ return false;
+ }
+
+ QDir d(fi.absoluteFilePath());
+
+ _last_dir = d.absolutePath();
+
+ return true;
+}
+
+void MainWindow::appSettings(void)
+{
+ QSettings set("./settings.ini",QSettings::IniFormat);
+
+ set.beginGroup("app_settings");
+
+ _last_dir = set.value("last_dir").toString();
+
+ set.endGroup();
+}
+
+void MainWindow::closeEvent(QCloseEvent*)
+{
+ QSettings set("./settings.ini",QSettings::IniFormat);
+
+ set.beginGroup("app_settings");
+
+ set.setValue("last_dir",_last_dir);
+
+ set.endGroup();
+}
|
