diff --git a/Updater b/Updater index 5484663..55548e1 160000 --- a/Updater +++ b/Updater @@ -1 +1 @@ -Subproject commit 54846632f31748b548b39b85e50a3d792182f368 +Subproject commit 55548e1059e035d58dbaf0e66be2aa56ebdc5cc2 diff --git a/ZRCola/ZRCola.fbp b/ZRCola/ZRCola.fbp index 8eb05a9..3d94bc4 100644 --- a/ZRCola/ZRCola.fbp +++ b/ZRCola/ZRCola.fbp @@ -5833,7 +5833,7 @@ - + OnIdle @@ -6017,7 +6017,7 @@ 0 0 wxID_ANY - &Update + Quit and &Update... 0 @@ -6038,7 +6038,7 @@ 0 - + Exit this program and launch product update wxFILTER_NONE wxDefaultValidator @@ -6126,7 +6126,7 @@ 0 - + Close this window wxFILTER_NONE wxDefaultValidator @@ -6134,7 +6134,7 @@ - + OnClose diff --git a/ZRCola/locale/ZRCola.pot b/ZRCola/locale/ZRCola.pot index eeff895..d71bb9f 100644 --- a/ZRCola/locale/ZRCola.pot +++ b/ZRCola/locale/ZRCola.pot @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: ZRCola\n" -"POT-Creation-Date: 2016-06-01 18:55+0200\n" +"POT-Creation-Date: 2016-06-02 20:26+0200\n" "PO-Revision-Date: 2016-05-13 15:52+0200\n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" @@ -32,17 +32,17 @@ msgstr "© 2004-%s ZRC SAZU" msgid "ZRCola" msgstr "ZRCola" -#: zrcolachrreq.cpp:49 zrcolagui.cpp:963 +#: zrcolachrreq.cpp:49 zrcolagui.cpp:970 #, fuzzy msgid "Character" msgstr "Znak" -#: zrcolachrreq.cpp:58 zrcolagui.cpp:984 +#: zrcolachrreq.cpp:58 zrcolagui.cpp:991 #, fuzzy msgid "Context" msgstr "Kontekst" -#: zrcolachrreq.cpp:64 zrcolagui.h:355 +#: zrcolachrreq.cpp:64 zrcolagui.h:357 #, fuzzy msgid "Request a New Character" msgstr "Zahtevaj nov znak" @@ -71,14 +71,18 @@ msgstr "" "funkcionalnosti ne bo na voljo." #: zrcolafrm.cpp:351 +#, fuzzy msgid "http://zrcola-2.amebis.si/en/info/instructions/" -msgstr "" +msgstr "http://zrcola-2.amebis.si/info/instructions/" -#: zrcolafrm.cpp:373 +#: zrcolafrm.cpp:375 +#, fuzzy msgid "" "http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-" "Tipkovnica_2009-06-21.pdf" msgstr "" +"http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-" +"Tipkovnica_2009-06-21.pdf" #: zrcolagui.cpp:36 #, fuzzy @@ -196,21 +200,24 @@ msgid "&View" msgstr "Po&gled" #: zrcolagui.cpp:142 +#, fuzzy msgid "&Instructions..." -msgstr "" +msgstr "Navod&ila ..." #: zrcolagui.cpp:142 +#, fuzzy msgid "Open a web site with product instructions" -msgstr "" +msgstr "Odpri spletno stran z navodili izdelka" #: zrcolagui.cpp:146 #, fuzzy msgid "Keyboard &Shortcuts..." -msgstr "Bližnjice na tipkovnici" +msgstr "&Bližnjice na tipkovnici ..." #: zrcolagui.cpp:146 +#, fuzzy msgid "Open a list of keyboard shortcuts" -msgstr "" +msgstr "Odpri seznam bližnjic na tipkovnici" #: zrcolagui.cpp:152 #, fuzzy @@ -541,25 +548,35 @@ msgstr "Dnevnik" #: zrcolagui.cpp:926 #, fuzzy -msgid "&Update" -msgstr "&Posodobi" +msgid "Quit and &Update..." +msgstr "Za&ustavi in posodobi" -#: zrcolagui.cpp:931 +#: zrcolagui.cpp:928 +#, fuzzy +msgid "Exit this program and launch product update" +msgstr "Zaustavi ta program in zaženi posodobitev izdelka" + +#: zrcolagui.cpp:932 #, fuzzy msgid "&Close" msgstr "&Zapri" -#: zrcolagui.cpp:965 +#: zrcolagui.cpp:933 +#, fuzzy +msgid "Close this window" +msgstr "Zapri to okno" + +#: zrcolagui.cpp:972 #, fuzzy msgid "Enter the &character you would like to request:" msgstr "Vpišite &znak, ki ga želite zahtevati:" -#: zrcolagui.cpp:972 +#: zrcolagui.cpp:979 #, fuzzy msgid "Decomposed character to request" msgstr "Razstavljen znak, ki ga zahtevate" -#: zrcolagui.cpp:976 +#: zrcolagui.cpp:983 #, fuzzy msgid "" "Please, use the decomposed form.\n" @@ -570,19 +587,19 @@ msgstr "" "Za vnos znaka lahko uporavite ZRColine bližnjice na tipkovnici ali kopirate " "in prilepite iz okna z razstavljenim besedilom." -#: zrcolagui.cpp:986 +#: zrcolagui.cpp:993 #, fuzzy msgid "" "The &context, examples or short description why and where the character is " "required:" msgstr "&Kontekst, primeri oz. kratek opis zakaj in kje potrebujete novi znak:" -#: zrcolagui.cpp:992 +#: zrcolagui.cpp:999 #, fuzzy msgid "Additional notes for character request" msgstr "Dodatne opombe za zahtevo znaka" -#: zrcolagui.cpp:999 +#: zrcolagui.cpp:1006 #, fuzzy msgid "" "After clicking OK button, your e-mail application should open allowing you " @@ -611,6 +628,20 @@ msgstr "" msgid "Start ZRCola automatically on logon" msgstr "Samodejno zaženi ZRColo ob prijavi" +#: zrcolaupdater.cpp:94 +#, fuzzy +msgid "" +"This program will now close and the upgrade will be launched.\n" +"Are you sure?" +msgstr "" +"Ta program se bo zdaj zaprl in zagnala se bo posodobitev.\n" +"Ali ste prepričani?" + +#: zrcolaupdater.cpp:94 zrcolagui.h:328 +#, fuzzy +msgid "Product Update" +msgstr "Posodabljanje izdelka" + #: zrcolagui.h:277 #, fuzzy msgid "Settings" @@ -621,11 +652,6 @@ msgstr "Nastavitve" msgid "About ZRCola" msgstr "O ZRColi" -#: zrcolagui.h:326 -#, fuzzy -msgid "Product Update" -msgstr "Posodabljanje izdelka" - #: MSIBuild/En.Win32.Release.Feature-2.idtx:3 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3 #: MSIBuild/En.x64.Release.Feature-2.idtx:3 diff --git a/ZRCola/locale/de_DE.po b/ZRCola/locale/de_DE.po index 14313dc..b458ca7 100644 --- a/ZRCola/locale/de_DE.po +++ b/ZRCola/locale/de_DE.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: ZRCola\n" -"POT-Creation-Date: 2016-06-01 18:57+0200\n" -"PO-Revision-Date: 2016-06-01 18:57+0200\n" +"POT-Creation-Date: 2016-06-02 20:27+0200\n" +"PO-Revision-Date: 2016-06-02 20:27+0200\n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" "Language: de_DE\n" @@ -29,17 +29,17 @@ msgstr "" msgid "ZRCola" msgstr "ZRCola:." -#: zrcolachrreq.cpp:49 zrcolagui.cpp:963 +#: zrcolachrreq.cpp:49 zrcolagui.cpp:970 #, fuzzy msgid "Character" msgstr "Eingabe eines Zeichenstils" -#: zrcolachrreq.cpp:58 zrcolagui.cpp:984 +#: zrcolachrreq.cpp:58 zrcolagui.cpp:991 #, fuzzy msgid "Context" msgstr "Konnte den Kontext auf dem überlagerten Fenster nicht initialisieren." -#: zrcolachrreq.cpp:64 zrcolagui.h:355 +#: zrcolachrreq.cpp:64 zrcolagui.h:357 msgid "Request a New Character" msgstr "" @@ -64,7 +64,7 @@ msgstr "" msgid "http://zrcola-2.amebis.si/en/info/instructions/" msgstr "http://zrcola-2.amebis.si/de/info/instructions/" -#: zrcolafrm.cpp:373 +#: zrcolafrm.cpp:375 msgid "" "http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-" "Tipkovnica_2009-06-21.pdf" @@ -459,40 +459,49 @@ msgstr "&Log" #: zrcolagui.cpp:926 #, fuzzy -msgid "&Update" +msgid "Quit and &Update..." msgstr "Kann Benutzer-Konfigurationsdatei nicht aktualisieren." -#: zrcolagui.cpp:931 +#: zrcolagui.cpp:928 +msgid "Exit this program and launch product update" +msgstr "" + +#: zrcolagui.cpp:932 #, fuzzy msgid "&Close" msgstr "&Schließen" -#: zrcolagui.cpp:965 +#: zrcolagui.cpp:933 +#, fuzzy +msgid "Close this window" +msgstr "Fenster schließen" + +#: zrcolagui.cpp:972 msgid "Enter the &character you would like to request:" msgstr "" -#: zrcolagui.cpp:972 +#: zrcolagui.cpp:979 msgid "Decomposed character to request" msgstr "" -#: zrcolagui.cpp:976 +#: zrcolagui.cpp:983 msgid "" "Please, use the decomposed form.\n" "You can use ZRCola keyboard shortcuts to enter the character or Copy&&Paste " "it from the Decomposed window." msgstr "" -#: zrcolagui.cpp:986 +#: zrcolagui.cpp:993 msgid "" "The &context, examples or short description why and where the character is " "required:" msgstr "" -#: zrcolagui.cpp:992 +#: zrcolagui.cpp:999 msgid "Additional notes for character request" msgstr "" -#: zrcolagui.cpp:999 +#: zrcolagui.cpp:1006 msgid "" "After clicking OK button, your e-mail application should open allowing you " "to submit the new character request to ZRCola Editor.\n" @@ -511,6 +520,16 @@ msgstr "" msgid "Start ZRCola automatically on logon" msgstr "" +#: zrcolaupdater.cpp:94 +msgid "" +"This program will now close and the upgrade will be launched.\n" +"Are you sure?" +msgstr "" + +#: zrcolaupdater.cpp:94 zrcolagui.h:328 +msgid "Product Update" +msgstr "" + #: zrcolagui.h:277 msgid "Settings" msgstr "" @@ -519,10 +538,6 @@ msgstr "" msgid "About ZRCola" msgstr "" -#: zrcolagui.h:326 -msgid "Product Update" -msgstr "" - # Windows charset for this language (decimal) #: MSIBuild/En.Win32.Release.Feature-2.idtx:3 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3 diff --git a/ZRCola/locale/ru_RU.po b/ZRCola/locale/ru_RU.po index 7413427..9fdaa8f 100644 --- a/ZRCola/locale/ru_RU.po +++ b/ZRCola/locale/ru_RU.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: ZRCola\n" -"POT-Creation-Date: 2016-06-01 18:57+0200\n" -"PO-Revision-Date: 2016-06-01 18:57+0200\n" +"POT-Creation-Date: 2016-06-02 20:27+0200\n" +"PO-Revision-Date: 2016-06-02 20:27+0200\n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" "Language: ru_RU\n" @@ -30,16 +30,16 @@ msgstr "" msgid "ZRCola" msgstr "ZRCola:." -#: zrcolachrreq.cpp:49 zrcolagui.cpp:963 +#: zrcolachrreq.cpp:49 zrcolagui.cpp:970 #, fuzzy msgid "Character" msgstr "Skupine &znakov" -#: zrcolachrreq.cpp:58 zrcolagui.cpp:984 +#: zrcolachrreq.cpp:58 zrcolagui.cpp:991 msgid "Context" msgstr "" -#: zrcolachrreq.cpp:64 zrcolagui.h:355 +#: zrcolachrreq.cpp:64 zrcolagui.h:357 msgid "Request a New Character" msgstr "" @@ -63,7 +63,7 @@ msgstr "" msgid "http://zrcola-2.amebis.si/en/info/instructions/" msgstr "http://zrcola-2.amebis.si/ru/info/instructions/" -#: zrcolafrm.cpp:373 +#: zrcolafrm.cpp:375 msgid "" "http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-" "Tipkovnica_2009-06-21.pdf" @@ -435,39 +435,47 @@ msgid "Log" msgstr "" #: zrcolagui.cpp:926 -msgid "&Update" +msgid "Quit and &Update..." msgstr "" -#: zrcolagui.cpp:931 +#: zrcolagui.cpp:928 +msgid "Exit this program and launch product update" +msgstr "" + +#: zrcolagui.cpp:932 msgid "&Close" msgstr "" -#: zrcolagui.cpp:965 -msgid "Enter the &character you would like to request:" +#: zrcolagui.cpp:933 +msgid "Close this window" msgstr "" #: zrcolagui.cpp:972 +msgid "Enter the &character you would like to request:" +msgstr "" + +#: zrcolagui.cpp:979 msgid "Decomposed character to request" msgstr "" -#: zrcolagui.cpp:976 +#: zrcolagui.cpp:983 msgid "" "Please, use the decomposed form.\n" "You can use ZRCola keyboard shortcuts to enter the character or Copy&&Paste " "it from the Decomposed window." msgstr "" -#: zrcolagui.cpp:986 +#: zrcolagui.cpp:993 msgid "" "The &context, examples or short description why and where the character is " "required:" msgstr "" -#: zrcolagui.cpp:992 +#: zrcolagui.cpp:999 msgid "Additional notes for character request" msgstr "" -#: zrcolagui.cpp:999 +#: zrcolagui.cpp:1006 msgid "" "After clicking OK button, your e-mail application should open allowing you " "to submit the new character request to ZRCola Editor.\n" @@ -486,6 +494,16 @@ msgstr "" msgid "Start ZRCola automatically on logon" msgstr "" +#: zrcolaupdater.cpp:94 +msgid "" +"This program will now close and the upgrade will be launched.\n" +"Are you sure?" +msgstr "" + +#: zrcolaupdater.cpp:94 zrcolagui.h:328 +msgid "Product Update" +msgstr "" + #: zrcolagui.h:277 msgid "Settings" msgstr "" @@ -494,10 +512,6 @@ msgstr "" msgid "About ZRCola" msgstr "" -#: zrcolagui.h:326 -msgid "Product Update" -msgstr "" - # Windows charset for this language (decimal) #: MSIBuild/En.Win32.Release.Feature-2.idtx:3 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3 diff --git a/ZRCola/locale/sl_SI.po b/ZRCola/locale/sl_SI.po index dd1f94a..612c866 100644 --- a/ZRCola/locale/sl_SI.po +++ b/ZRCola/locale/sl_SI.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: ZRCola\n" -"POT-Creation-Date: 2016-06-01 18:56+0200\n" -"PO-Revision-Date: 2016-06-01 18:57+0200\n" +"POT-Creation-Date: 2016-06-02 20:26+0200\n" +"PO-Revision-Date: 2016-06-02 20:26+0200\n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" "Language: sl_SI\n" @@ -29,15 +29,15 @@ msgstr "© 2004-%s ZRC SAZU" msgid "ZRCola" msgstr "ZRCola" -#: zrcolachrreq.cpp:49 zrcolagui.cpp:963 +#: zrcolachrreq.cpp:49 zrcolagui.cpp:970 msgid "Character" msgstr "Znak" -#: zrcolachrreq.cpp:58 zrcolagui.cpp:984 +#: zrcolachrreq.cpp:58 zrcolagui.cpp:991 msgid "Context" msgstr "Kontekst" -#: zrcolachrreq.cpp:64 zrcolagui.h:355 +#: zrcolachrreq.cpp:64 zrcolagui.h:357 msgid "Request a New Character" msgstr "Zahtevaj nov znak" @@ -65,7 +65,7 @@ msgstr "" msgid "http://zrcola-2.amebis.si/en/info/instructions/" msgstr "http://zrcola-2.amebis.si/info/instructions/" -#: zrcolafrm.cpp:373 +#: zrcolafrm.cpp:375 msgid "" "http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-" "Tipkovnica_2009-06-21.pdf" @@ -450,23 +450,31 @@ msgid "Log" msgstr "Dnevnik" #: zrcolagui.cpp:926 -msgid "&Update" -msgstr "&Posodobi" +msgid "Quit and &Update..." +msgstr "Za&ustavi in posodobi ..." -#: zrcolagui.cpp:931 +#: zrcolagui.cpp:928 +msgid "Exit this program and launch product update" +msgstr "Zaustavi ta program in zaženi posodobitev izdelka" + +#: zrcolagui.cpp:932 msgid "&Close" msgstr "&Zapri" -#: zrcolagui.cpp:965 +#: zrcolagui.cpp:933 +msgid "Close this window" +msgstr "Zapri to okno" + +#: zrcolagui.cpp:972 msgid "Enter the &character you would like to request:" msgstr "Vpišite &znak, ki ga želite zahtevati:" -#: zrcolagui.cpp:972 +#: zrcolagui.cpp:979 msgid "Decomposed character to request" msgstr "Razstavljen znak, ki ga zahtevate" # Please use a double && for final "&" character -#: zrcolagui.cpp:976 +#: zrcolagui.cpp:983 msgid "" "Please, use the decomposed form.\n" "You can use ZRCola keyboard shortcuts to enter the character or Copy&&Paste " @@ -476,17 +484,17 @@ msgstr "" "Za vnos znaka lahko uporavite ZRColine bližnjice na tipkovnici ali kopirate " "in prilepite iz okna z razstavljenim besedilom." -#: zrcolagui.cpp:986 +#: zrcolagui.cpp:993 msgid "" "The &context, examples or short description why and where the character is " "required:" msgstr "&Kontekst, primeri oz. kratek opis zakaj in kje potrebujete novi znak:" -#: zrcolagui.cpp:992 +#: zrcolagui.cpp:999 msgid "Additional notes for character request" msgstr "Dodatne opombe za zahtevo znaka" -#: zrcolagui.cpp:999 +#: zrcolagui.cpp:1006 msgid "" "After clicking OK button, your e-mail application should open allowing you " "to submit the new character request to ZRCola Editor.\n" @@ -512,6 +520,18 @@ msgstr "" msgid "Start ZRCola automatically on logon" msgstr "Samodejno zaženi ZRColo ob prijavi" +#: zrcolaupdater.cpp:94 +msgid "" +"This program will now close and the upgrade will be launched.\n" +"Are you sure?" +msgstr "" +"Ta program se bo zdaj zaprl in zagnala se bo posodobitev.\n" +"Ali ste prepričani?" + +#: zrcolaupdater.cpp:94 zrcolagui.h:328 +msgid "Product Update" +msgstr "Posodabljanje izdelka" + #: zrcolagui.h:277 msgid "Settings" msgstr "Nastavitve" @@ -520,10 +540,6 @@ msgstr "Nastavitve" msgid "About ZRCola" msgstr "O ZRColi" -#: zrcolagui.h:326 -msgid "Product Update" -msgstr "Posodabljanje izdelka" - # Windows charset for this language (decimal) #: MSIBuild/En.Win32.Release.Feature-2.idtx:3 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3 diff --git a/ZRCola/zrcolagui.cpp b/ZRCola/zrcolagui.cpp index b97add3..9b99297 100644 --- a/ZRCola/zrcolagui.cpp +++ b/ZRCola/zrcolagui.cpp @@ -923,12 +923,15 @@ wxZRColaUpdaterBase::wxZRColaUpdaterBase( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizerButtons; bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); - m_buttonUpdate = new wxButton( this, wxID_ANY, _("&Update"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonUpdate = new wxButton( this, wxID_ANY, _("Quit and &Update..."), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonUpdate->Enable( false ); + m_buttonUpdate->SetToolTip( _("Exit this program and launch product update") ); bSizerButtons->Add( m_buttonUpdate, 0, wxALL, 5 ); m_buttonClose = new wxButton( this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonClose->SetToolTip( _("Close this window") ); + bSizerButtons->Add( m_buttonClose, 0, wxALL, 5 ); @@ -942,13 +945,17 @@ wxZRColaUpdaterBase::wxZRColaUpdaterBase( wxWindow* parent, wxWindowID id, const this->Centre( wxBOTH ); // Connect Events + this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaUpdaterBase::OnIdle ) ); m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaUpdaterBase::OnUpdate ), NULL, this ); + m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaUpdaterBase::OnClose ), NULL, this ); } wxZRColaUpdaterBase::~wxZRColaUpdaterBase() { // Disconnect Events + this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaUpdaterBase::OnIdle ) ); m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaUpdaterBase::OnUpdate ), NULL, this ); + m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaUpdaterBase::OnClose ), NULL, this ); } diff --git a/ZRCola/zrcolagui.h b/ZRCola/zrcolagui.h index 6528b94..c601c80 100644 --- a/ZRCola/zrcolagui.h +++ b/ZRCola/zrcolagui.h @@ -318,7 +318,9 @@ class wxZRColaUpdaterBase : public wxDialog wxButton* m_buttonClose; // Virtual event handlers, overide them in your derived class + virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); } virtual void OnUpdate( wxCommandEvent& event ) { event.Skip(); } + virtual void OnClose( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/ZRCola/zrcolaupdater.cpp b/ZRCola/zrcolaupdater.cpp index cb38947..7571c9e 100644 --- a/ZRCola/zrcolaupdater.cpp +++ b/ZRCola/zrcolaupdater.cpp @@ -28,6 +28,7 @@ wxZRColaUpdater::wxZRColaUpdater(wxWindow* parent) : m_logLevelOrig(wxLOG_Warning), m_logOrig(NULL), m_updater(NULL), + m_finished(false), wxZRColaUpdaterBase(parent) { // Setup logging. @@ -35,17 +36,17 @@ wxZRColaUpdater::wxZRColaUpdater(wxWindow* parent) : m_logLevelOrig = wxLog::GetLogLevel(); wxLog::SetLogLevel(wxLOG_Info); - // Connect events. - Connect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this); + //// Connect events. + //Connect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this); - // Launch Updater thread. + // Prepare Updater. ZRColaApp *app = (ZRColaApp*)wxTheApp; m_updater = new wxUpdCheckThread(app->m_locale.GetCanonicalName(), this); - if (m_updater->Run() != wxTHREAD_NO_ERROR) { - wxFAIL_MSG(wxT("Can't create the thread!")); - delete m_updater; - m_updater = NULL; - } + //if (m_updater->Run() != wxTHREAD_NO_ERROR) { + // wxFAIL_MSG(wxT("Can't create the thread!")); + // delete m_updater; + // m_updater = NULL; + //} } @@ -53,11 +54,12 @@ wxZRColaUpdater::~wxZRColaUpdater() { if (m_updater) { // Terminate the Updater thread. - m_updater->Delete(); + //m_updater->Delete(); + delete m_updater; } - // Disconnect events. - Disconnect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this); + //// Disconnect events. + //Disconnect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this); wxLog::SetLogLevel(m_logLevelOrig); if (m_logOrig) { @@ -67,11 +69,20 @@ wxZRColaUpdater::~wxZRColaUpdater() } -void wxZRColaUpdater::OnCheckComplete(wxThreadEvent& event) -{ - event.Skip(); +//void wxZRColaUpdater::OnCheckComplete(wxThreadEvent& event) +//{ +// event.Skip(); +// +// m_buttonUpdate->Enable(event.GetInt() == wxUpdCheckThread::wxUpdUpdateAvailable); +//} - m_buttonUpdate->Enable(event.GetInt() == wxUpdCheckThread::wxUpdUpdateAvailable); + +void wxZRColaUpdater::OnIdle(wxIdleEvent& event) +{ + if (!m_finished) { + m_buttonUpdate->Enable(m_updater->CheckForUpdate() == wxUpdCheckThread::wxUpdUpdateAvailable); + m_finished = true; + } } @@ -79,6 +90,21 @@ void wxZRColaUpdater::OnUpdate(wxCommandEvent& event) { event.Skip(); - if (m_updater) - m_updater->LaunchUpdate(); + if (m_updater) { + if (wxMessageBox(_("This program will now close and the upgrade will be launched.\nAre you sure?"), _("Product Update"), wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this) == wxYES) { + m_updater->LaunchUpdate(); + + Close(true); + ((ZRColaApp*)wxTheApp)->m_mainWnd->Close(); + } + } +} + + +void wxZRColaUpdater::OnClose(wxCommandEvent& event) +{ + if (m_updater) + m_updater->Abort(); + + event.Skip(); } diff --git a/ZRCola/zrcolaupdater.h b/ZRCola/zrcolaupdater.h index 9a180e0..69639ad 100644 --- a/ZRCola/zrcolaupdater.h +++ b/ZRCola/zrcolaupdater.h @@ -42,11 +42,14 @@ public: virtual ~wxZRColaUpdater(); protected: - void OnCheckComplete(wxThreadEvent& event); + //void OnCheckComplete(wxThreadEvent& event); + virtual void OnIdle(wxIdleEvent& event); virtual void OnUpdate(wxCommandEvent& event); + virtual void OnClose(wxCommandEvent& event); protected: wxLogLevel m_logLevelOrig; ///< Original log level wxLog *m_logOrig; ///< Original log wxUpdCheckThread *m_updater; ///< Updater thread + bool m_finished; ///< Is Updater finished? };