Added and deployed a default_title_string var

This commit is contained in:
Charles Dang 2016-01-03 05:23:45 +11:00
parent 3c5e6cbdb6
commit 64a5ae6851
5 changed files with 10 additions and 17 deletions

View file

@ -145,7 +145,6 @@ context_manager::context_manager(editor_display& gui, const config& game_config)
, auto_update_transitions_(preferences::editor::auto_update_transitions())
, map_contexts_()
, clipboard_()
, default_window_title_(_("The Battle for Wesnoth") + " - " + game_config::revision)
{
if (default_dir_.empty()) {
default_dir_ = filesystem::get_dir(filesystem::get_user_data_dir() + "/editor");
@ -165,9 +164,9 @@ context_manager::~context_manager()
// Restore default window title
#if !SDL_VERSION_ATLEAST(2, 0, 0)
SDL_WM_SetCaption(default_window_title_.c_str(), NULL);
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
#else
CVideo::set_window_title(default_window_title_);
CVideo::set_window_title(game_config::default_title_string);
#endif
}
@ -1027,7 +1026,7 @@ void context_manager::set_window_title()
map_name = get_map_context().is_pure_map() ? _("New Map") : _("New Scenario");
}
const std::string& wm_title_string = map_name + " - " + default_window_title_;
const std::string& wm_title_string = map_name + " - " + game_config::default_title_string;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
#else

View file

@ -307,9 +307,6 @@ private:
/** Clipboard map_fragment -- used for copy-paste. */
map_fragment clipboard_;
/** The default window title outside the editor */
std::string default_window_title_;
};
}

View file

@ -58,6 +58,8 @@ namespace game_config
#else
const std::string revision = VERSION;
#endif
const std::string default_title_string = _("The Battle for Wesnoth") + " - " + revision;
std::string wesnoth_program_dir;
bool debug = false, debug_lua = false, editor = false,
ignore_replay_errors = false, mp_debug = false, exit_at_end = false,

View file

@ -40,6 +40,7 @@ namespace game_config
extern unsigned lobby_refresh;
extern const std::string version;
extern const std::string revision;
extern const std::string default_title_string;
extern std::string default_terrain;
inline int kill_xp(int level)

View file

@ -393,9 +393,7 @@ bool game_launcher::init_video()
video_.init_window();
// Set window title and icon
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::revision;
CVideo::set_window_title(wm_title_string);
CVideo::set_window_title(game_config::default_title_string);
#if !(defined(__APPLE__))
surface icon(image::get_image("icons/icon-game.png", image::UNSCALED));
@ -418,9 +416,7 @@ bool game_launcher::init_video()
return true;
}
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::revision;
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
#if !(defined(__APPLE__))
surface icon(image::get_image("icons/icon-game.png", image::UNSCALED));
@ -1067,12 +1063,10 @@ bool game_launcher::change_language()
if (dlg.get_retval() != gui2::twindow::OK) return false;
if (!(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test)) {
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::revision;
#if SDL_VERSION_ATLEAST(2, 0, 0)
CVideo::set_window_title(wm_title_string);
CVideo::set_window_title(game_config::default_title_string);
#else
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
#endif
}