From 43841c24b861d20f58e9a2a5f288f56c90d267e2 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 7 Jan 2007 22:54:04 +0000 Subject: [PATCH] Implemented a version checker that can automatically or manually check if there are any updates to Aegisub, and a few other tweaks. Originally committed to SVN as r736. --- aegisub/Makefile.am | 1 + aegisub/changelog.txt | 1 + aegisub/frame_main.cpp | 17 ++++++++++++++++- aegisub/frame_main.h | 1 + aegisub/frame_main_events.cpp | 27 ++++++++++++--------------- aegisub/main.cpp | 14 +++++++++++++- aegisub/main.h | 2 ++ aegisub/options.cpp | 1 + aegisub/version.cpp | 12 ++++++++++++ aegisub/version.h | 6 ++++++ aegisub/video_display.cpp | 9 ++++++++- 11 files changed, 73 insertions(+), 18 deletions(-) diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index c4ced848c..373d95dfe 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -64,6 +64,7 @@ aegisub_SOURCES = \ dialog_timing_processor.cpp \ dialog_tip.cpp \ dialog_translation.cpp \ + dialog_version_check.cpp drop.cpp \ export_clean_info.cpp \ export_fixstyle.cpp \ diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 98bbca7d6..80fee2fa3 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -79,6 +79,7 @@ Please visit http://aegisub.net to download latest version - Added options to toggle the display of the audio timeline and of the time over the mouse cursor. (AMZ) - Destination of screenshots can now be set in the options dialog. (AMZ) - Moved karaoke syllable text in audio display to the top instead of bottom, since it often covers important information in spectrum mode (jfs) +- Implemented a version checker that can automatically or manually check if there are any updates to Aegisub. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index e12a6e376..51feee277 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -67,6 +67,7 @@ #include "text_file_reader.h" #include "text_file_writer.h" #include "auto4_base.h" +#include "dialog_version_check.h" ///////////////////////// @@ -135,6 +136,17 @@ FrameMain::FrameMain (wxArrayString args) // Parse arguments LoadSubtitles(_T("")); LoadList(args); + + // Version checker + int option = Options.AsInt(_T("Auto check for updates")); + if (option == -1) { + int result = wxMessageBox(_("Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu."),_("Check for updates?"),wxYES_NO); + option = 0; + if (result == wxYES) option = 1; + Options.SetInt(_T("Auto check for updates"),option); + Options.Save(); + } + if (option == 1) DialogVersionCheck *checker = new DialogVersionCheck (this,true); } @@ -206,7 +218,9 @@ void FrameMain::InitToolbar () { #endif Toolbar->AddSeparator(); - // Misc + // Options + Toolbar->AddTool(Menu_Tools_Options,_("Options"),wxBITMAP(options_button),_("Configure Aegisub")); + Toolbar->AddTool(Menu_Tools_Hotkeys,_("Hotkeys"),wxBITMAP(hotkeys_button),_("Remap hotkeys")); Toolbar->AddTool(Grid_Toggle_Tags,_("Cycle Tag Hidding Mode"),wxBITMAP(toggle_tag_hiding),_("Cycle through tag-hiding modes")); // Update @@ -399,6 +413,7 @@ void FrameMain::InitMenu() { AppendBitmapMenuItem(helpMenu,Menu_Help_BugTracker, _("&Bug tracker..."), _("Visit Aegisub's bug tracker"),wxBITMAP(bugtracker_button)); AppendBitmapMenuItem (helpMenu,Menu_Help_IRCChannel, _("&IRC channel..."), _("Visit Aegisub's official IRC channel"), wxBITMAP(irc_button)); helpMenu->AppendSeparator(); + AppendBitmapMenuItem(helpMenu,Menu_Help_Check_Updates, _("&Check for Updates..."), _("Check to see if there is a new version of Aegisub available"),wxBITMAP(blank_button)); AppendBitmapMenuItem(helpMenu,Menu_Help_About, _("&About..."), _("About Aegisub"),wxBITMAP(about_button)); MenuBar->Append(helpMenu, _("&Help")); diff --git a/aegisub/frame_main.h b/aegisub/frame_main.h index 3276a9fd7..566cc5eea 100644 --- a/aegisub/frame_main.h +++ b/aegisub/frame_main.h @@ -141,6 +141,7 @@ private: void OnMenuOpen (wxMenuEvent &event); void OnExit(wxCommandEvent &WXUNUSED(event)); void OnAbout (wxCommandEvent &event); + void OnCheckUpdates (wxCommandEvent &event); void OnContents (wxCommandEvent &event); void OnWebsite (wxCommandEvent &event); void OnForums (wxCommandEvent &event); diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 2eead8bbc..ac2f1b3a5 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -83,6 +83,7 @@ #include "utils.h" #include "auto4_base.h" #include "dialog_automation.h" +#include "dialog_version_check.h" //////////////////// @@ -198,6 +199,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_MENU(Menu_Help_Forums, FrameMain::OnForums) EVT_MENU(Menu_Help_BugTracker, FrameMain::OnBugTracker) EVT_MENU(Menu_Help_IRCChannel, FrameMain::OnIRCChannel) + EVT_MENU(Menu_Help_Check_Updates, FrameMain::OnCheckUpdates) EVT_MENU(Menu_Help_About, FrameMain::OnAbout) EVT_MENU(Menu_View_Language, FrameMain::OnChooseLanguage) @@ -585,6 +587,13 @@ void FrameMain::OnAbout(wxCommandEvent &event) { } +////////////////////// +// Open check updates +void FrameMain::OnCheckUpdates(wxCommandEvent &event) { + DialogVersionCheck *check = new DialogVersionCheck(this,false); +} + + //////////////////// // Open help topics void FrameMain::OnContents(wxCommandEvent& WXUNUSED(event)) { @@ -606,33 +615,21 @@ void FrameMain::OnWebsite(wxCommandEvent& WXUNUSED(event)) { /////////////// // Open forums void FrameMain::OnForums(wxCommandEvent& WXUNUSED(event)) { - wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html")); - if (type) { - wxString command = type->GetOpenCommand(_T("http://www.malakith.net/aegisub/")); - if (!command.empty()) wxExecute(command); - } + AegisubApp::OpenURL(_T("http://www.malakith.net/aegisub/")); } /////////////////// // Open bugtracker void FrameMain::OnBugTracker(wxCommandEvent& WXUNUSED(event)) { - wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html")); - if (type) { - wxString command = type->GetOpenCommand(_T("http://www.malakith.net/aegibug/")); - if (!command.empty()) wxExecute(command); - } + AegisubApp::OpenURL(_T("http://www.malakith.net/aegibug/")); } //////////////////// // Open IRC channel void FrameMain::OnIRCChannel(wxCommandEvent& WXUNUSED(event)) { - wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html")); - if (type) { - wxString command = type->GetOpenCommand(_T("irc://irc.chatsociety.net/aegisub")); - if (!command.empty()) wxExecute(command); - } + AegisubApp::OpenURL(_T("irc://irc.chatsociety.net/aegisub")); } diff --git a/aegisub/main.cpp b/aegisub/main.cpp index 5097cade4..8d2fc9caf 100644 --- a/aegisub/main.cpp +++ b/aegisub/main.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "main.h" #include "frame_main.h" #include "options.h" @@ -344,6 +345,18 @@ void AegisubApp::GetFolderName () { folderName += _T("/"); } + +//////////// +// Open URL +void AegisubApp::OpenURL(wxString url) { + wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html")); + if (type) { + wxString command = type->GetOpenCommand(url); + if (!command.empty()) wxExecute(command); + } +} + + //////////////// // Apple events #ifdef __WXMAC__ @@ -391,4 +404,3 @@ void AegisubApp::OnKey(wxKeyEvent &event) { event.Skip(); } } - diff --git a/aegisub/main.h b/aegisub/main.h index 2748a4054..9ec2aa3f4 100644 --- a/aegisub/main.h +++ b/aegisub/main.h @@ -66,6 +66,8 @@ public: static wxString fullPath; static wxString folderName; + static AegisubApp* Get() { return (AegisubApp*) wxTheApp; } + static void OpenURL(wxString url); void GetFullPath(wxString arg); void GetFolderName(); diff --git a/aegisub/options.cpp b/aegisub/options.cpp index 514cde028..c6de0f9b5 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -81,6 +81,7 @@ void OptionsManager::LoadDefaults() { SetInt(_T("Recent aud max"),16); SetInt(_T("Recent find max"),16); SetInt(_T("Recent replace max"),16); + SetInt(_T("Auto Check for Updates"),-1); // File Save/Load SetModificationType(MOD_RESTART); diff --git a/aegisub/version.cpp b/aegisub/version.cpp index d740e4008..047ed0a71 100644 --- a/aegisub/version.cpp +++ b/aegisub/version.cpp @@ -127,3 +127,15 @@ wxString GetAegisubBuildTime() { wxString GetAegisubBuildCredit() { return versioninfo.BuildCredit; } + +bool GetIsOfficialRelease() { + return versioninfo.IsRelease; +} + +wxString GetVersionNumber() { + return versioninfo.VersionNumber; +} + +int GetSVNRevision() { + return versioninfo.SvnRev; +} diff --git a/aegisub/version.h b/aegisub/version.h index f7fbe5575..ed6239a99 100644 --- a/aegisub/version.h +++ b/aegisub/version.h @@ -43,3 +43,9 @@ wxString GetAegisubShortVersionString(); wxString GetAegisubBuildTime(); // Name of who built the binary wxString GetAegisubBuildCredit(); +// Is release? +bool GetIsOfficialRelease(); +// Version number +wxString GetVersionNumber(); +// Get SVN revision +int GetSVNRevision(); diff --git a/aegisub/video_display.cpp b/aegisub/video_display.cpp index a4fab2af0..07744ae80 100644 --- a/aegisub/video_display.cpp +++ b/aegisub/video_display.cpp @@ -397,12 +397,17 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { } // Hover + bool hasOverlay = false; if (x != mouse_x || y != mouse_y) { // Set coords mouse_x = x; mouse_y = y; + hasOverlay = true; + } - // Create backbuffer + // Has something to draw + if (hasOverlay) { + // Create backbuffer if needed bool needCreate = false; if (!backbuffer) needCreate = true; else if (backbuffer->GetWidth() != w || backbuffer->GetHeight() != h) { @@ -417,9 +422,11 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { // Draw frame dc.DrawBitmap(GetFrame(frame_n),0,0); + // Draw the control points for FexTracker DrawTrackingOverlay( dc ); + // Prepare grid dc.SetPen(wxPen(wxColour(255,255,255),1)); dc.SetLogicalFunction(wxINVERT);