diff options
author | Yaniv Kamay <ykamay@redhat.com> | 2009-12-28 16:39:00 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2009-12-28 16:44:38 +0200 |
commit | c57bcf6f4433446b858867712ece4abec4fb5c3d (patch) | |
tree | 02846084fc319a0d8ce82b11dd89b3fc8d5f9f92 /client | |
parent | 76fc1dd847b7cbfddaf7bab42eef858ade84317b (diff) | |
download | spice-c57bcf6f4433446b858867712ece4abec4fb5c3d.tar.gz spice-c57bcf6f4433446b858867712ece4abec4fb5c3d.tar.xz spice-c57bcf6f4433446b858867712ece4abec4fb5c3d.zip |
client: let PreLoginDialog save and restore LoginDialog
Diffstat (limited to 'client')
-rw-r--r-- | client/gui/gui.cpp | 28 | ||||
-rw-r--r-- | client/gui/gui.h | 1 |
2 files changed, 25 insertions, 4 deletions
diff --git a/client/gui/gui.cpp b/client/gui/gui.cpp index 1bbf3c42..4a63d5a9 100644 --- a/client/gui/gui.cpp +++ b/client/gui/gui.cpp @@ -212,6 +212,7 @@ public: CEGUI::System& gui_system() { return _gui.gui_system();} void set_dialog(Dialog* dialog) { _gui.set_dialog(dialog);} + void dettach() { _gui.dettach_dialog(this);} TabFactorys& get_factoris() { return _gui._tab_factorys;} bool message_box(MessageType type, const char *text, const ButtonsList& buttons, @@ -481,14 +482,19 @@ private: class PreLoginDialog: public TabDialog { public: - PreLoginDialog(GUI& gui); + PreLoginDialog(GUI& gui, LoginDialog* login_dialog); + virtual ~PreLoginDialog() { delete _login_dialog;} bool handle_back(const CEGUI::EventArgs& e); bool handle_quit(const CEGUI::EventArgs& e); + +private: + LoginDialog* _login_dialog; }; -PreLoginDialog::PreLoginDialog(GUI& gui) +PreLoginDialog::PreLoginDialog(GUI& gui, LoginDialog* login_dialog) : TabDialog(gui, false) + , _login_dialog (login_dialog) { try { @@ -509,7 +515,10 @@ PreLoginDialog::PreLoginDialog(GUI& gui) bool PreLoginDialog::handle_back(const CEGUI::EventArgs& e) { - set_dialog(new LoginDialog(_gui)); + ASSERT(_login_dialog); + LoginDialog* login_dialog = _login_dialog; + _login_dialog = NULL; + set_dialog(login_dialog); return true; } @@ -675,7 +684,8 @@ bool LoginDialog::handle_quit(const CEGUI::EventArgs& e) bool LoginDialog::handle_options(const CEGUI::EventArgs& e) { - set_dialog(new PreLoginDialog(_gui)); + dettach(); + set_dialog(new PreLoginDialog(_gui, this)); return true; } @@ -1054,6 +1064,16 @@ void GUI::set_dialog(Dialog* dialog) update_layer_area(); } +void GUI::dettach_dialog(Dialog* dialog) +{ + if (!dialog || _dialog != dialog) { + return; + } + gui_system().setGUISheet(NULL); + _dialog = NULL; + update_layer_area(); +} + void GUI::create_dialog() { switch (_state) { diff --git a/client/gui/gui.h b/client/gui/gui.h index 2e505b02..fd7e56ab 100644 --- a/client/gui/gui.h +++ b/client/gui/gui.h @@ -81,6 +81,7 @@ private: void init_cegui(); void conditional_update(); void set_dialog(Dialog* dialog); + void dettach_dialog(Dialog* dialog); private: Application& _app; |