diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:09:24 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:09:24 +0200 |
commit | b5f042a6c132c1b97cf03c4615bab966c23f57d2 (patch) | |
tree | 1cb057a0ffd51264bb3c9807e2133505ce312eb1 /ui | |
parent | 3.11 (diff) | |
download | FreeFileSync-b5f042a6c132c1b97cf03c4615bab966c23f57d2.tar.gz FreeFileSync-b5f042a6c132c1b97cf03c4615bab966c23f57d2.tar.bz2 FreeFileSync-b5f042a6c132c1b97cf03c4615bab966c23f57d2.zip |
3.12
Diffstat (limited to 'ui')
-rw-r--r-- | ui/batch_status_handler.cpp | 26 | ||||
-rw-r--r-- | ui/batch_status_handler.h | 2 | ||||
-rw-r--r-- | ui/check_version.cpp | 17 | ||||
-rw-r--r-- | ui/gui_generated.cpp | 23 | ||||
-rw-r--r-- | ui/gui_generated.h | 41 | ||||
-rw-r--r-- | ui/gui_status_handler.cpp | 7 | ||||
-rw-r--r-- | ui/gui_status_handler.h | 2 | ||||
-rw-r--r-- | ui/main_dlg.cpp | 126 | ||||
-rw-r--r-- | ui/main_dlg.h | 4 | ||||
-rw-r--r-- | ui/progress_indicator.cpp | 24 | ||||
-rw-r--r-- | ui/progress_indicator.h | 3 | ||||
-rw-r--r-- | ui/small_dlgs.cpp | 6 |
12 files changed, 150 insertions, 131 deletions
diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index c3dfc8df..1bcc4b33 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -22,9 +22,9 @@ using namespace ffs3; class LogFile { public: - LogFile(const wxString& logfileDirectory, const wxString& batchFilename) //throw (FileError&) + LogFile(const wxString& logfileDirectory, const wxString& jobName) //throw (FileError&) { - const wxString logfileName = findUniqueLogname(logfileDirectory, batchFilename); + const wxString logfileName = findUniqueLogname(logfileDirectory, jobName); logFile.Open(logfileName, wxT("w")); if (!logFile.IsOpened()) @@ -66,17 +66,7 @@ public: } private: - static wxString extractJobName(const wxString& batchFilename) - { - using namespace common; - - const wxString shortName = batchFilename.AfterLast(FILE_NAME_SEPARATOR); //returns the whole string if seperator not found - const wxString jobName = shortName.BeforeLast(wxChar('.')); //returns empty string if seperator not found - return jobName.IsEmpty() ? shortName : jobName; - } - - - static wxString findUniqueLogname(const wxString& logfileDirectory, const wxString& batchFilename) + static wxString findUniqueLogname(const wxString& logfileDirectory, const wxString& jobName) { using namespace common; @@ -95,7 +85,7 @@ private: wxString logfileName = zToWx(logfileDir); //add prefix - logfileName += extractJobName(batchFilename) + wxT(" "); + logfileName += jobName + wxT(" "); //add timestamp wxString timeNow = wxDateTime::Now().FormatISOTime(); @@ -118,7 +108,7 @@ private: //############################################################################################################################## BatchStatusHandler::BatchStatusHandler(bool runSilent, - const wxString& batchFilename, + const wxString& jobName, const wxString* logfileDirectory, const xmlAccess::OnError handleError, const SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode @@ -129,13 +119,13 @@ BatchStatusHandler::BatchStatusHandler(bool runSilent, handleError_(handleError), currentProcess(StatusHandler::PROCESS_NONE), returnValue(returnVal), - syncStatusFrame(*this, NULL, runSilent) + syncStatusFrame(*this, NULL, runSilent, jobName) { if (logfileDirectory) { try { - logFile.reset(new LogFile(*logfileDirectory, batchFilename)); + logFile.reset(new LogFile(*logfileDirectory, jobName)); } catch (ffs3::FileError& error) { @@ -216,7 +206,7 @@ inline void BatchStatusHandler::reportInfo(const Zstring& text) { if (currentProcess == StatusHandler::PROCESS_SYNCHRONIZING && logFile.get()) //write file transfer information to log - errorLog.logInfo(zToWx(text)); + errorLog.logInfo(zToWx(text)); //avoid spamming with file copy info: visually identifying warning messages has priority! however when saving to a log file wee need this info syncStatusFrame.setStatusText_NoUpdate(text); } diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h index bc4c5bde..ca32aa81 100644 --- a/ui/batch_status_handler.h +++ b/ui/batch_status_handler.h @@ -21,7 +21,7 @@ class BatchStatusHandler : public StatusHandler { public: BatchStatusHandler(bool runSilent, //defines: -start minimized and -quit immediately when finished - const wxString& batchFilename, + const wxString& jobName, const wxString* logfileDirectory, //optional: enable logging if available const xmlAccess::OnError handleError, const ffs3::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode diff --git a/ui/check_version.cpp b/ui/check_version.cpp index d9f892d9..cd1d4c48 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -95,15 +95,8 @@ bool newerVersionExists(const wxString& onlineVersion) if (online.empty() || online[0] == 0) //onlineVersion may be "This website has been moved..." In this case better check for an update return true; - current.resize(std::max(current.size(), online.size())); - online. resize(std::max(current.size(), online.size())); - - typedef std::vector<size_t>::const_iterator VerIter; - const std::pair<VerIter, VerIter> mm = std::mismatch (current.begin(), current.end(), - online.begin()); - - return mm.first == current.end() ? false : //both versions match - *mm.first < *mm.second; + return std::lexicographical_compare(current.begin(), current.end(), + online.begin(), online.end()); } @@ -120,7 +113,7 @@ void ffs3::checkForUpdateNow() { const int rv = wxMessageBox(wxString(_("A newer version of FreeFileSync is available:")) + wxT(" v") + onlineVersion + wxT(". ") + _("Download now?"), _("Information"), wxYES_NO | wxICON_QUESTION); if (rv == wxYES) - wxLaunchDefaultBrowser(wxT("http://sourceforge.net/project/showfiles.php?group_id=234430")); + wxLaunchDefaultBrowser(wxT("http://sourceforge.net/projects/freefilesync/files/")); } else wxMessageBox(_("FreeFileSync is up to date!"), _("Information"), wxICON_INFORMATION); @@ -139,7 +132,7 @@ void ffs3::checkForUpdatePeriodically(long& lastUpdateCheck) if (lastUpdateCheck == 0) { QuestionDlg* const messageDlg = new QuestionDlg(NULL, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO, wxString(_("Do you want FreeFileSync to automatically check for updates every week?")) + wxT("\n") + _("(Requires an Internet connection!)")); @@ -166,7 +159,7 @@ void ffs3::checkForUpdatePeriodically(long& lastUpdateCheck) { const int rv = wxMessageBox(wxString(_("A newer version of FreeFileSync is available:")) + wxT(" v") + onlineVersion + wxT(". ") + _("Download now?"), _("Information"), wxYES_NO | wxICON_QUESTION); if (rv == wxYES) - wxLaunchDefaultBrowser(wxT("http://sourceforge.net/project/showfiles.php?group_id=234430")); + wxLaunchDefaultBrowser(wxT("http://sourceforge.net/projects/freefilesync/files/")); } } } diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index e39d8705..b830b0be 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -51,7 +51,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menuItem4 = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("CTRL-Q"), wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItem4 ); - m_menubar1->Append( m_menuFile, _("&File") ); + m_menubar1->Append( m_menuFile, _("&Program") ); m_menuAdvanced = new wxMenu(); m_menuLanguages = new wxMenu(); @@ -1317,7 +1317,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); m_checkBoxSilent = new wxCheckBox( m_panelOverview, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxSilent->SetToolTip( _("Run minimized and write status information to a logfile") ); + m_checkBoxSilent->SetToolTip( _("Start minimized and write status information to a logfile") ); sbSizer24->Add( m_checkBoxSilent, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 14 ); @@ -2101,7 +2101,9 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - m_animationControl1 = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( 45,45 )); + m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE ); + m_animationControl1->SetMinSize( wxSize( 45,45 ) ); + bSizer42->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); @@ -2230,7 +2232,10 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer28->Add( bSizerSpeed, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerSpeed->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer28->Add( bSizerSpeed, 1, wxALIGN_CENTER_VERTICAL, 5 ); bSizer28->Add( 0, 0, 1, 0, 5 ); @@ -2257,6 +2262,9 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerRemTime = new wxBoxSizer( wxHORIZONTAL ); + + bSizerRemTime->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText21->Wrap( -1 ); m_staticText21->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -2269,7 +2277,7 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerRemTime->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer28->Add( bSizerRemTime, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer28->Add( bSizerRemTime, 1, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); bSizer27->Add( bSizer28, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 ); @@ -2627,8 +2635,9 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer108->Add( 30, 0, 1, wxEXPAND, 5 ); - m_animationControl1 = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation); + m_animationControl1 = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( -1,-1 ), wxAC_DEFAULT_STYLE ); m_animationControl1->SetToolTip( _("Donate with PayPal") ); + m_animationControl1->SetMinSize( wxSize( 48,48 ) ); bSizer108->Add( m_animationControl1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); diff --git a/ui/gui_generated.h b/ui/gui_generated.h index 22bddfb1..cbcce489 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -228,6 +228,7 @@ class MainDialogGenerated : public wxFrame wxPanel* m_panelRight; MainDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + ~MainDialogGenerated(); }; @@ -257,7 +258,7 @@ class FolderPairGenerated : public wxPanel wxTextCtrl* m_directoryRight; wxDirPickerCtrl* m_dirPickerRight; - FolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + FolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); ~FolderPairGenerated(); }; @@ -286,7 +287,7 @@ class BatchFolderPairGenerated : public wxPanel wxDirPickerCtrl* m_dirPickerRight; wxBitmapButton* m_bpButtonAltSyncCfg; - BatchFolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + BatchFolderPairGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); ~BatchFolderPairGenerated(); }; @@ -368,7 +369,7 @@ class BatchDlgGenerated : public wxDialog wxDirPickerCtrl* m_dirPickerRight; wxBitmapButton* m_bpButtonAltSyncCfg; - BatchDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create a batch job"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + BatchDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create a batch job"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~BatchDlgGenerated(); }; @@ -408,7 +409,7 @@ class CompareStatusGenerated : public wxPanel public: - CompareStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + CompareStatusGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); ~CompareStatusGenerated(); }; @@ -492,7 +493,7 @@ class SyncCfgDlgGenerated : public wxDialog public: - SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); ~SyncCfgDlgGenerated(); }; @@ -530,7 +531,7 @@ class CmpCfgDlgGenerated : public wxDialog public: - CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Comparison settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); ~CmpCfgDlgGenerated(); }; @@ -571,11 +572,13 @@ class SyncStatusDlgGenerated : public wxFrame wxStaticText* m_staticText108; wxStaticText* m_staticTextSpeed; + wxButton* m_buttonOK; wxButton* m_buttonPause; wxButton* m_buttonAbort; wxBoxSizer* bSizerRemTime; + wxStaticText* m_staticText21; wxStaticText* m_staticTextTimeRemaining; @@ -592,6 +595,7 @@ class SyncStatusDlgGenerated : public wxFrame wxGauge* m_gauge1; SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 638,350 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + ~SyncStatusDlgGenerated(); }; @@ -642,7 +646,7 @@ class HelpDlgGenerated : public wxDialog public: - HelpDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 579,543 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + HelpDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 579,543 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~HelpDlgGenerated(); }; @@ -696,7 +700,7 @@ class AboutDlgGenerated : public wxDialog public: - AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); ~AboutDlgGenerated(); }; @@ -728,7 +732,7 @@ class ErrorDlgGenerated : public wxDialog public: - ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 421,228 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); ~ErrorDlgGenerated(); }; @@ -760,7 +764,7 @@ class WarningDlgGenerated : public wxDialog public: wxStaticBitmap* m_bitmap10; - WarningDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Warning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 421,231 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + WarningDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Warning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 460,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); ~WarningDlgGenerated(); }; @@ -792,7 +796,7 @@ class QuestionDlgGenerated : public wxDialog public: - QuestionDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Question"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 420,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + QuestionDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Question"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 420,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); ~QuestionDlgGenerated(); }; @@ -827,7 +831,7 @@ class DeleteDlgGenerated : public wxDialog public: - DeleteDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Confirm"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 553,336 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DeleteDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Confirm"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 553,336 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); ~DeleteDlgGenerated(); }; @@ -879,7 +883,7 @@ class FilterDlgGenerated : public wxDialog public: - FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~FilterDlgGenerated(); }; @@ -911,7 +915,7 @@ class CustomizeColsDlgGenerated : public wxDialog public: - CustomizeColsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Customize columns"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + CustomizeColsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Customize columns"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); ~CustomizeColsDlgGenerated(); }; @@ -958,7 +962,7 @@ class GlobalSettingsDlgGenerated : public wxDialog public: - GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~GlobalSettingsDlgGenerated(); }; @@ -1005,7 +1009,7 @@ class SyncPreviewDlgGenerated : public wxDialog public: - SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization Preview"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization Preview"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); ~SyncPreviewDlgGenerated(); }; @@ -1024,6 +1028,7 @@ class PopupFrameGenerated1 : public wxFrame wxStaticText* m_staticTextMain; PopupFrameGenerated1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxSTATIC_BORDER ); + ~PopupFrameGenerated1(); }; @@ -1052,7 +1057,7 @@ class SearchDialogGenerated : public wxDialog public: - SearchDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + SearchDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); ~SearchDialogGenerated(); }; diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 81f4de6e..218f5cdc 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -222,8 +222,8 @@ void CompareStatusHandler::abortThisProcess() //######################################################################################################## -SyncStatusHandler::SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors) : - syncStatusFrame(*this, parentDlg, false), +SyncStatusHandler::SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors, const wxString& jobName) : + syncStatusFrame(*this, parentDlg, false, jobName), ignoreErrors(ignoreAllErrors) {} @@ -269,6 +269,9 @@ SyncStatusHandler::~SyncStatusHandler() inline void SyncStatusHandler::reportInfo(const Zstring& text) { + //if (currentProcess == StatusHandler::PROCESS_SYNCHRONIZING) + //errorLog.logInfo(zToWx(text)); -> don't spam with file copy info: visually identifying warning messages has priority! + syncStatusFrame.setStatusText_NoUpdate(text); } diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h index d6c03399..c44e257b 100644 --- a/ui/gui_status_handler.h +++ b/ui/gui_status_handler.h @@ -48,7 +48,7 @@ private: class SyncStatusHandler : public StatusHandler { public: - SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors); + SyncStatusHandler(wxTopLevelWindow* parentDlg, bool ignoreAllErrors, const wxString& jobName); ~SyncStatusHandler(); virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID); diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index 0f2c83b5..5fa6aee7 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -51,6 +51,9 @@ #include "batch_config.h" #include "../shared/check_exist.h" #include <wx/display.h> +#include <wx/app.h> +#include <boost/bind.hpp> + using namespace ffs3; using ffs3::CustomLocale; @@ -492,6 +495,9 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, m_gridRight->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGridRightButtonEvent), NULL, this); m_gridMiddle->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGridMiddleButtonEvent), NULL, this); + //register global hotkeys (without explicit menu entry) + wxTheApp->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::OnGlobalKeyEvent), NULL, this); + Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this); Connect(wxEVT_SIZE, wxSizeEventHandler(MainDialog::OnResize), NULL, this); Connect(wxEVT_MOVE, wxSizeEventHandler(MainDialog::OnResize), NULL, this); @@ -598,20 +604,17 @@ void MainDialog::readGlobalSettings() m_gridRight->setColumnAttributes(globalSettings->gui.columnAttribRight); //load list of last used configuration files (in reverse order) - for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.cfgFileHistory.rbegin(); - i != globalSettings->gui.cfgFileHistory.rend(); - ++i) - addFileToCfgHistory(*i); + std::for_each(globalSettings->gui.cfgFileHistory.rbegin(), globalSettings->gui.cfgFileHistory.rend(), + boost::bind(&MainDialog::addFileToCfgHistory, this, _1)); //load list of last used folders - for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.folderHistoryLeft.rbegin(); - i != globalSettings->gui.folderHistoryLeft.rend(); - ++i) - addLeftFolderToHistory(*i); - for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.folderHistoryRight.rbegin(); - i != globalSettings->gui.folderHistoryRight.rend(); - ++i) - addRightFolderToHistory(*i); + std::for_each(globalSettings->gui.folderHistoryLeft.rbegin(), + globalSettings->gui.folderHistoryLeft.rend(), + boost::bind(&MainDialog::addLeftFolderToHistory, this, _1)); + + std::for_each(globalSettings->gui.folderHistoryRight.rbegin(), + globalSettings->gui.folderHistoryRight.rend(), + boost::bind(&MainDialog::addRightFolderToHistory, this, _1)); //show/hide file icons m_gridLeft->enableFileIcons(globalSettings->gui.showFileIconsLeft); @@ -856,6 +859,7 @@ private: } MainDialog* const mainDlg; + const size_t totalObjToDelete; bool abortRequested; @@ -881,6 +885,7 @@ void MainDialog::deleteSelectedFiles() int totalDeleteCount = 0; + wxWindow* oldFocus = wxWindow::FindFocus(); if (ffs3::showDeleteDialog(compRefLeft, compRefRight, @@ -904,12 +909,11 @@ void MainDialog::deleteSelectedFiles() compRefRight, globalSettings->gui.deleteOnBothSides, globalSettings->gui.useRecyclerForManualDeletion, - getCurrentConfiguration().mainCfg, statusHandler); } catch (ffs3::AbortThisProcess&) {} - //remove rows that empty: just a beautification, invalid rows shouldn't cause issues + //remove rows that are empty: just a beautification, invalid rows shouldn't cause issues gridDataView->removeInvalidRows(); //redraw grid neccessary to update new dimensions and for UI-Backend data linkage @@ -919,6 +923,9 @@ void MainDialog::deleteSelectedFiles() m_gridMiddle->ClearSelection(); m_gridRight-> ClearSelection(); } + + if (oldFocus) + oldFocus->SetFocus(); //restore focus before deletion } } @@ -1171,19 +1178,15 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) case 'C': case WXK_INSERT: //CTRL + C || CTRL + INS copySelectionToClipboard(m_gridLeft); - break; + return; // -> swallow event! don't allow default grid commands! case 'A': //CTRL + A m_gridLeft->SelectAll(); - break; - - case 'F': //CTRL + F - ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); - break; + return; case WXK_NUMPAD_ADD: //CTRL + '+' m_gridLeft->autoSizeColumns(); - break; + return; } else if (event.AltDown()) @@ -1194,14 +1197,14 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) wxCommandEvent dummy; OnContextSyncDirLeft(dummy); } - break; + return; case WXK_RIGHT: //ALT + -> { wxCommandEvent dummy; OnContextSyncDirRight(dummy); } - break; + return; case WXK_UP: /* ALT + /|\ */ case WXK_DOWN: /* ALT + \|/ */ @@ -1209,7 +1212,7 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) wxCommandEvent dummy; OnContextSyncDirNone(dummy); } - break; + return; } else @@ -1218,14 +1221,14 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) case WXK_DELETE: case WXK_NUMPAD_DELETE: deleteSelectedFiles(); - break; + return; case WXK_SPACE: { wxCommandEvent dummy; OnContextFilterTemp(dummy); } - break; + return; case WXK_RETURN: case WXK_NUMPAD_ENTER: @@ -1233,15 +1236,10 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) wxCommandEvent dummy(wxEVT_NULL, externalAppIDFirst); //open with first external application OnContextOpenWith(dummy); } - break; - - case WXK_F3: //F3 - case WXK_NUMPAD_F3: // - ffs3::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); - break; + return; } - //event.Skip(); -> swallow event! don't allow default grid commands! + event.Skip(); //unknown keypress: propagate } @@ -1250,12 +1248,15 @@ void MainDialog::onGridMiddleButtonEvent(wxKeyEvent& event) const int keyCode = event.GetKeyCode(); if (event.ControlDown()) - { - if (keyCode == 67 || keyCode == WXK_INSERT) //CTRL + C || CTRL + INS + switch (keyCode) + { + case 'C': + case WXK_INSERT: //CTRL + C || CTRL + INS copySelectionToClipboard(m_gridMiddle); - } + return; + } - //event.Skip(); -> swallow event! don't allow default grid commands! + event.Skip(); //unknown keypress: propagate } @@ -1269,19 +1270,15 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) case 'C': case WXK_INSERT: //CTRL + C || CTRL + INS copySelectionToClipboard(m_gridRight); - break; + return; case 'A': //CTRL + A m_gridRight->SelectAll(); - break; - - case 'F': //CTRL + F - ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); - break; + return; case WXK_NUMPAD_ADD: //CTRL + '+' m_gridRight->autoSizeColumns(); - break; + return; } else if (event.AltDown()) @@ -1292,14 +1289,14 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) wxCommandEvent dummy; OnContextSyncDirLeft(dummy); } - break; + return; case WXK_RIGHT: //ALT + -> { wxCommandEvent dummy; OnContextSyncDirRight(dummy); } - break; + return; case WXK_UP: /* ALT + /|\ */ case WXK_DOWN: /* ALT + \|/ */ @@ -1307,7 +1304,7 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) wxCommandEvent dummy; OnContextSyncDirNone(dummy); } - break; + return; } else @@ -1316,14 +1313,14 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) case WXK_DELETE: case WXK_NUMPAD_DELETE: deleteSelectedFiles(); - break; + return; case WXK_SPACE: { wxCommandEvent dummy; OnContextFilterTemp(dummy); } - break; + return; case WXK_RETURN: case WXK_NUMPAD_ENTER: @@ -1331,19 +1328,39 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) wxCommandEvent dummy(wxEVT_NULL, externalAppIDFirst); //open with first external application OnContextOpenWith(dummy); } - break; + return; + } + + event.Skip(); //unknown keypress: propagate +} + +void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events without explicit menu entry :) +{ + const int keyCode = event.GetKeyCode(); + + if (event.ControlDown()) + switch (keyCode) + { + case 'F': //CTRL + F + ffs3::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); + return; //-> swallow event! + } + else if (event.AltDown()) + ; + else + switch (keyCode) + { case WXK_F3: //F3 case WXK_NUMPAD_F3: // ffs3::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); - break; + return; //-> swallow event! } - //event.Skip(); -> swallow event! don't allow default grid commands! + event.Skip(); } - //------------------------------------------------------------ //temporal variables used by exclude via context menu struct SelectedExtension : public wxObject @@ -2890,7 +2907,7 @@ void MainDialog::OnStartSync(wxCommandEvent& event) //PERF_START; //class handling status updates and error messages - SyncStatusHandler statusHandler(this, currentCfg.ignoreErrors); + SyncStatusHandler statusHandler(this, currentCfg.ignoreErrors, ffs3::extractJobName(currentConfigFileName)); //check if there are files/folders to be sync'ed at all if (!synchronizationNeeded(gridDataView->getDataTentative())) @@ -3891,3 +3908,4 @@ bool MainDialog::SyncPreview::synchronizationIsEnabled() const { return synchronizationEnabled; } + diff --git a/ui/main_dlg.h b/ui/main_dlg.h index 34a1fdb2..68310065 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -14,13 +14,10 @@ #include <map> #include <set> -class CompareStatusHandler; -class DirectoryNameMainImpl; class CustomGrid; class FFSCheckRowsEvent; class FFSSyncDirectionEvent; class IconUpdater; -class ManualDeletionHandler; class DirectoryPair; class DirectoryPairFirst; class CompareStatus; @@ -159,6 +156,7 @@ private: void OnContextRimLabelRight( wxGridEvent& event); void OnContextMiddle( wxGridEvent& event); void OnContextMiddleLabel( wxGridEvent& event); + void OnGlobalKeyEvent( wxKeyEvent& event); //context menu handler methods void OnContextFilterTemp(wxCommandEvent& event); diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index 346403ee..e5cfa879 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -384,7 +384,7 @@ void CompareStatus::CompareStatusImpl::updateStatusPanelNow() class SyncStatus::SyncStatusImpl : public SyncStatusDlgGenerated { public: - SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow); + SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow, const wxString& jobName); ~SyncStatusImpl(); void resetGauge(int totalObjectsToProcess, wxLongLong totalDataToProcess); @@ -410,6 +410,7 @@ private: bool currentProcessIsRunning(); void showProgressExternally(const wxString& progressText, float percent = 0); //percent may already be included in progressText + const wxString jobName_; wxStopWatch timeElapsed; StatusHandler* processStatusHandler; @@ -445,8 +446,8 @@ private: //redirect to implementation -SyncStatus::SyncStatus(StatusHandler& updater, wxTopLevelWindow* parentWindow, bool startSilent) : - pimpl(new SyncStatusImpl(updater, parentWindow)) +SyncStatus::SyncStatus(StatusHandler& updater, wxTopLevelWindow* parentWindow, bool startSilent, const wxString& jobName) : + pimpl(new SyncStatusImpl(updater, parentWindow, jobName)) { if (startSilent) pimpl->minimizeToTray(); @@ -509,7 +510,7 @@ void SyncStatus::processHasFinished(SyncStatusID id, const wxString& finalMessag //######################################################################################## -SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow) : +SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow, const wxString& jobName) : SyncStatusDlgGenerated(parentWindow, wxID_ANY, parentWindow ? wxString(wxEmptyString) : (wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")), @@ -517,6 +518,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin parentWindow ? wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT : //wxTAB_TRAVERSAL is needed for standard button handling: wxID_OK/wxID_CANCEL wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL), + jobName_(jobName), processStatusHandler(&updater), mainDialog(parentWindow), totalObjects(0), @@ -702,26 +704,28 @@ void SyncStatus::SyncStatusImpl::updateStatusDialogNow() const float percent = totalData == 0 ? 0 : currentData.ToDouble() * 100 / totalData.ToDouble(); //write status information to systray, taskbar, parent title ect. + + const wxString postFix = jobName_.empty() ? wxString() : (wxT(" - \"") + jobName_ + wxT("\"")); switch (currentStatus) { case SyncStatus::SCANNING: - showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...")); + showProgressExternally(numberToStringSep(scannedObjects) + wxT(" - ") + _("Scanning...") + postFix); break; case SyncStatus::COMPARING_CONTENT: - showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content..."), percent); + showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Comparing content...") + postFix, percent); break; case SyncStatus::SYNCHRONIZING: - showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Synchronizing..."), percent); + showProgressExternally(formatPercentage(currentData, totalData) + wxT(" - ") + _("Synchronizing...") + postFix, percent); break; case SyncStatus::PAUSE: - showProgressExternally((totalData != 0 ? formatPercentage(currentData, totalData) + wxT(" - ") : wxString()) + _("Paused"), percent); + showProgressExternally((totalData != 0 ? formatPercentage(currentData, totalData) + wxT(" - ") : wxString()) + _("Paused") + postFix, percent); break; case SyncStatus::ABORTED: - showProgressExternally(_("Aborted"), percent); + showProgressExternally(_("Aborted") + postFix, percent); break; case SyncStatus::FINISHED_WITH_SUCCESS: case SyncStatus::FINISHED_WITH_ERROR: - showProgressExternally(_("Completed"), percent); + showProgressExternally(_("Completed") + postFix, percent); break; } diff --git a/ui/progress_indicator.h b/ui/progress_indicator.h index 4bd9861b..bb5a287c 100644 --- a/ui/progress_indicator.h +++ b/ui/progress_indicator.h @@ -40,7 +40,8 @@ class SyncStatus public: SyncStatus(StatusHandler& updater, wxTopLevelWindow* parentWindow, //may be NULL - bool startSilent); + bool startSilent, + const wxString& jobName); ~SyncStatus(); wxWindow* getAsWindow(); //convenience! don't abuse! diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index 3d63db47..e582142c 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -451,16 +451,14 @@ DefaultReturnCode::Response ffs3::showDeleteDialog(const std::vector<ffs3::FileS { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; - DeleteDialog* confirmDeletion = new DeleteDialog(NULL, + DeleteDialog confirmDeletion(NULL, rowsOnLeft, rowsOnRight, deleteOnBothSides, useRecycleBin, totalDeleteCount); - if (confirmDeletion->ShowModal() == DeleteDialog::BUTTON_OKAY) + if (confirmDeletion.ShowModal() == DeleteDialog::BUTTON_OKAY) rv = DefaultReturnCode::BUTTON_OKAY; - - confirmDeletion->Destroy(); return rv; } //######################################################################################## |