Add default directory DrawnMaps to put hand-drawn maps into
authorWuzzy <Wuzzy2@mail.ru>
Wed, 14 Mar 2018 23:55:13 +0100
changeset 13212 e9e4cc867b6e
parent 13211 667f28278aa4
child 13213 1ac1f5a91ec0
Add default directory DrawnMaps to put hand-drawn maps into
ChangeLog.txt
QTfrontend/main.cpp
QTfrontend/ui/page/pagedrawmap.cpp
QTfrontend/ui/widget/mapContainer.cpp
--- a/ChangeLog.txt	Wed Mar 14 23:02:39 2018 +0100
+++ b/ChangeLog.txt	Wed Mar 14 23:55:13 2018 +0100
@@ -19,7 +19,9 @@
  * When using seduction, only show “CENSORED” text in English locale
 
 Frontend:
+ + Migrate to Qt 5
  + Schemes are now stored in separate files under Schemes
+ + Add default directory DrawnMaps for hand-drawn maps
  + Lead player to training missions when starting Hedgewars the first time
  * Fix broken preview of team hats (e.g. cap_team)
 
--- a/QTfrontend/main.cpp	Wed Mar 14 23:02:39 2018 +0100
+++ b/QTfrontend/main.cpp	Wed Mar 14 23:55:13 2018 +0100
@@ -318,6 +318,7 @@
 
         // config/save paths
         checkForDir(cfgdir->absolutePath() + "/Demos");
+        checkForDir(cfgdir->absolutePath() + "/DrawnMaps");
         checkForDir(cfgdir->absolutePath() + "/Saves");
         checkForDir(cfgdir->absolutePath() + "/Screenshots");
         checkForDir(cfgdir->absolutePath() + "/Teams");
--- a/QTfrontend/ui/page/pagedrawmap.cpp	Wed Mar 14 23:02:39 2018 +0100
+++ b/QTfrontend/ui/page/pagedrawmap.cpp	Wed Mar 14 23:55:13 2018 +0100
@@ -22,9 +22,11 @@
 #include <QCheckBox>
 #include <QRadioButton>
 #include <QSpinBox>
+#include <QDir>
 
 #include "pagedrawmap.h"
 #include "drawmapwidget.h"
+#include "hwconsts.h"
 
 
 QLayout * PageDrawMap::bodyLayoutDefinition()
@@ -106,7 +108,8 @@
 
 void PageDrawMap::load()
 {
-    QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
+    QString loadDir = QDir(cfgdir->absolutePath() + "/DrawnMaps").absolutePath();
+    QString fileName = QFileDialog::getOpenFileName(this, tr("Load drawn map"), loadDir, tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
 
     if(!fileName.isEmpty())
         drawMapWidget->load(fileName);
@@ -114,7 +117,8 @@
 
 void PageDrawMap::save()
 {
-    QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save drawn map"), "./map.hwmap", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
+    QString saveDir = QDir(cfgdir->absolutePath() + "/DrawnMaps/map.hwmap").absolutePath();
+    QString fileName = QFileDialog::getSaveFileName(this, tr("Save drawn map"), saveDir, tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
 
     if(!fileName.isEmpty())
         drawMapWidget->save(fileName);
--- a/QTfrontend/ui/widget/mapContainer.cpp	Wed Mar 14 23:02:39 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Wed Mar 14 23:55:13 2018 +0100
@@ -1068,7 +1068,8 @@
 
 void HWMapContainer::loadDrawing()
 {
-    QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
+    QString loadDir = QDir(cfgdir->absolutePath() + "/DrawnMaps").absolutePath();
+    QString fileName = QFileDialog::getOpenFileName(this, tr("Load drawn map"), loadDir, tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
 
     if(fileName.isEmpty()) return;