Author: jhinrichs
Date: Mon Apr 27 22:27:15 2009
New Revision: 35269

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35269&view=rev
Log:
Savegame reorganization Step 1: Providing a simpler interface to saving and 
loading.
Implement the savegame dialog for OOS messages.

Modified:
    trunk/data/gui/default/window/game_save_message.cfg
    trunk/src/gui/dialogs/game_save.cpp
    trunk/src/gui/dialogs/game_save.hpp
    trunk/src/gui/widgets/settings.cpp
    trunk/src/gui/widgets/settings.hpp
    trunk/src/savegame.cpp

Modified: trunk/data/gui/default/window/game_save_message.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/game_save_message.cfg?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/data/gui/default/window/game_save_message.cfg (original)
+++ trunk/data/gui/default/window/game_save_message.cfg Mon Apr 27 22:27:15 2009
@@ -136,8 +136,8 @@
                                                                        id = 
"ok"
                                                                        
definition = "default"
 
-                                                                       
size_text = _ "OK"
-                                                                       label = 
_ "OK"
+                                                                       
size_text = _ "Yes"
+                                                                       label = 
_ "Yes"
                                                                [/button]
 
                                                        [/column]
@@ -151,7 +151,7 @@
                                                                        id = 
"cancel"
                                                                        
definition = "default"
 
-                                                                       label = 
_ "Cancel"
+                                                                       label = 
_ "No"
                                                                [/button]
 
                                                        [/column]

Modified: trunk/src/gui/dialogs/game_save.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/game_save.cpp?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/src/gui/dialogs/game_save.cpp (original)
+++ trunk/src/gui/dialogs/game_save.cpp Mon Apr 27 22:27:15 2009
@@ -83,5 +83,23 @@
        tgame_save::pre_show(video, window);
 }
 
+tgame_save_oos::tgame_save_oos(const std::string& title, const std::string& 
filename, const std::string& message)
+       : tgame_save_message(title, filename, message),
+       btnIgnoreAll_(register_bool("ignore_all", false)),
+       ignore_all_(false)
+{}
+
+twindow* tgame_save_oos::build_window(CVideo& video)
+{
+       return build(video, get_id(GAME_SAVE_OOS));
+}
+
+void tgame_save_oos::post_show(twindow& window)
+{
+       tgame_save::post_show(window);
+
+       ignore_all_ = btnIgnoreAll_->get_widget_value(window);
+}
+
 } // namespace gui2
 

Modified: trunk/src/gui/dialogs/game_save.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/game_save.hpp?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/src/gui/dialogs/game_save.hpp (original)
+++ trunk/src/gui/dialogs/game_save.hpp Mon Apr 27 22:27:15 2009
@@ -31,13 +31,12 @@
        /** Inherited from tdialog. */
        void pre_show(CVideo& video, twindow& window);
 
+       /** Inherited from tdialog. */
+       void post_show(twindow& window);
+
 private:
        /** Inherited from tdialog. */
        twindow* build_window(CVideo& video);
-
-       /** Inherited from tdialog. */
-       void post_show(twindow& window);
-
 
        tfield_text* txtFilename_;
        std::string title_;
@@ -51,12 +50,30 @@
 
 private:
        /** Inherited from tgame_save. */
+       void pre_show(CVideo& video, twindow& window);
+
+       /** Inherited from tgame_save. */
        twindow* build_window(CVideo& video);
 
+       std::string message_;
+};
+
+class tgame_save_oos : public tgame_save_message
+{
+public:
+       tgame_save_oos(const std::string& title, const std::string& 
filename="", const std::string& message="");
+
+       const bool ignore_all() const { return ignore_all_; }
+
+private:
        /** Inherited from tgame_save. */
-       void pre_show(CVideo& video, twindow& window);
+       twindow* build_window(CVideo& video);
 
-       std::string message_;
+       /** Inherited from tdialog. */
+       void post_show(twindow& window);
+
+       tfield_bool* btnIgnoreAll_;
+       bool ignore_all_;
 };
 
 }

Modified: trunk/src/gui/widgets/settings.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/settings.cpp?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/src/gui/widgets/settings.cpp (original)
+++ trunk/src/gui/widgets/settings.cpp Mon Apr 27 22:27:15 2009
@@ -89,6 +89,7 @@
        window_type_list[TITLE_SCREEN] = "title_screen";
        window_type_list[GAME_SAVE] = "game_save";
        window_type_list[GAME_SAVE_MESSAGE] = "game_save_message";
+       window_type_list[GAME_SAVE_OOS] = "game_save_oos";
 #ifndef DISABLE_EDITOR2
        window_type_list[EDITOR_NEW_MAP] = "editor_new_map";
        window_type_list[EDITOR_GENERATE_MAP] = "editor_generate_map";

Modified: trunk/src/gui/widgets/settings.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/settings.hpp?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/src/gui/widgets/settings.hpp (original)
+++ trunk/src/gui/widgets/settings.hpp Mon Apr 27 22:27:15 2009
@@ -67,6 +67,7 @@
 #endif
        GAME_SAVE,                               /**< Save game dialog. */
        GAME_SAVE_MESSAGE,               /**< Save game dialog with additional 
message. */
+       GAME_SAVE_OOS,                   /**< Save game dialog for processing 
OOS. */
        COUNT                    /**<
                                  * The last one to hold the number of items 
and as
                                  * sentinel.

Modified: trunk/src/savegame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.cpp?rev=35269&r1=35268&r2=35269&view=diff
==============================================================================
--- trunk/src/savegame.cpp (original)
+++ trunk/src/savegame.cpp Mon Apr 27 22:27:15 2009
@@ -479,14 +479,21 @@
        int res = 0;
        int overwrite = 0;
        bool exit = true;
+       static bool ignore_all = false;
+       bool has_exit = true;
 
        do{ 
                try{
                        if (ask_for_filename){
                                std::string filename = filename_;
 
-                               if (has_exit_button)
-                                       res = dialogs::get_save_name_oos(gui, 
message, _("Name: "), &filename_, dialog_type, title_);
+                               if (has_exit){
+                                       gui2::tgame_save_oos dlg(title_, 
filename, message);
+                                       dlg.show(gui.video());
+                                       filename = dlg.filename();
+                                       ignore_all = dlg.ignore_all();
+                                       res = dlg.get_retval();
+                               }
                                else{
                                        if (dialog_type == gui::OK_CANCEL){
                                                gui2::tgame_save dlg(title_, 
filename);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to