Author: mir3x
Date: Sat Dec 10 13:31:02 2016
New Revision: 34697

URL: http://svn.gna.org/viewcvs/freeciv?rev=34697&view=rev
Log:
Qt client - save map image to picture folder or storage folder

See patch #8042


Modified:
    trunk/client/gui-qt/menu.cpp

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=34697&r1=34696&r2=34697&view=diff
==============================================================================
--- trunk/client/gui-qt/menu.cpp        (original)
+++ trunk/client/gui-qt/menu.cpp        Sat Dec 10 13:31:02 2016
@@ -3211,6 +3211,7 @@
 {
   int current_width, current_height;
   int full_size_x, full_size_y;
+  QString path, storage_path;
   hud_message_box saved(gui()->central_wdg);
   bool map_saved;
   QString img_name;
@@ -3230,12 +3231,22 @@
     img_name = img_name + "-"
                 + QString(nation_plural_for_player(client_player()));
   }
+  storage_path = freeciv_storage_dir();
+  path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+  if (storage_path.isEmpty() == false && QDir(storage_path).isReadable()) {
+    img_name = storage_path + DIR_SEPARATOR + img_name;
+  } else if (path.isEmpty() == false) {
+    img_name = path + DIR_SEPARATOR + img_name;
+  } else {
+    img_name = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+               + DIR_SEPARATOR + img_name;
+  }
   map_saved = mapview.store->map_pixmap.save(img_name, "png");
   map_canvas_resized(current_width, current_height);
   saved.setStandardButtons(QMessageBox::Ok);
   saved.setDefaultButton(QMessageBox::Cancel);
   if (map_saved) {
-    saved.set_text_title("Image saved as " + img_name, _("Succeess"));
+    saved.set_text_title("Image saved as:\n" + img_name, _("Succeess"));
   } else {
     saved.set_text_title(_("Failed to save image of the map"), _("Error"));
   }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to