diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:09:45 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:09:45 +0200 |
commit | 88c8801298cbf6fec9cdce254c7b3cb9e066a421 (patch) | |
tree | 35a35acf48eb227bac30abc8f87ea9b1c3c57b68 /RealtimeSync | |
parent | 3.12 (diff) | |
download | FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.gz FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.tar.bz2 FreeFileSync-88c8801298cbf6fec9cdce254c7b3cb9e066a421.zip |
3.13
Diffstat (limited to 'RealtimeSync')
-rw-r--r-- | RealtimeSync/RealtimeSync.cbp | 3 | ||||
-rw-r--r-- | RealtimeSync/RealtimeSync.vcxproj | 2 | ||||
-rw-r--r-- | RealtimeSync/application.cpp | 5 | ||||
-rw-r--r-- | RealtimeSync/application.h | 10 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.cpp | 441 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.h | 150 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.cpp | 75 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.h | 7 | ||||
-rw-r--r-- | RealtimeSync/makefile | 3 | ||||
-rw-r--r-- | RealtimeSync/notify.cpp | 4 | ||||
-rw-r--r-- | RealtimeSync/notify.h | 2 | ||||
-rw-r--r-- | RealtimeSync/pch.h | 2 | ||||
-rw-r--r-- | RealtimeSync/resource.rc | 2 | ||||
-rw-r--r-- | RealtimeSync/resources.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/resources.h | 2 | ||||
-rw-r--r-- | RealtimeSync/tray_menu.cpp | 34 | ||||
-rw-r--r-- | RealtimeSync/tray_menu.h | 4 | ||||
-rw-r--r-- | RealtimeSync/watcher.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/watcher.h | 8 | ||||
-rw-r--r-- | RealtimeSync/xml_ffs.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/xml_ffs.h | 2 | ||||
-rw-r--r-- | RealtimeSync/xml_proc.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/xml_proc.h | 2 |
23 files changed, 413 insertions, 353 deletions
diff --git a/RealtimeSync/RealtimeSync.cbp b/RealtimeSync/RealtimeSync.cbp index 4dd1addb..3bf0f88e 100644 --- a/RealtimeSync/RealtimeSync.cbp +++ b/RealtimeSync/RealtimeSync.cbp @@ -79,7 +79,6 @@ </ResourceCompiler> <Linker> <Add option="-mthreads" /> - <Add option="-Wl,--enable-auto-import" /> <Add library="libkernel32.a" /> <Add library="libuser32.a" /> <Add library="libuuid.a" /> @@ -145,6 +144,7 @@ <Unit filename="..\shared\localization.h" /> <Unit filename="..\shared\long_path_prefix.cpp" /> <Unit filename="..\shared\long_path_prefix.h" /> + <Unit filename="..\shared\privilege.cpp" /> <Unit filename="..\shared\shadow.cpp" /> <Unit filename="..\shared\standard_paths.cpp" /> <Unit filename="..\shared\standard_paths.h" /> @@ -154,6 +154,7 @@ <Unit filename="..\shared\tinyxml\tinyxml.cpp" /> <Unit filename="..\shared\tinyxml\tinyxmlerror.cpp" /> <Unit filename="..\shared\tinyxml\tinyxmlparser.cpp" /> + <Unit filename="..\shared\util.cpp" /> <Unit filename="..\shared\xml_base.cpp" /> <Unit filename="..\shared\xml_base.h" /> <Unit filename="..\structures.cpp" /> diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index 858c909b..e16e892f 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -238,12 +238,14 @@ <ClCompile Include="..\shared\help_provider.cpp" /> <ClCompile Include="..\shared\localization.cpp" /> <ClCompile Include="..\shared\long_path_prefix.cpp" /> + <ClCompile Include="..\shared\privilege.cpp" /> <ClCompile Include="..\shared\shadow.cpp" /> <ClCompile Include="..\shared\standard_paths.cpp" /> <ClCompile Include="..\shared\system_func.cpp" /> <ClCompile Include="..\shared\tinyxml\tinyxml.cpp" /> <ClCompile Include="..\shared\tinyxml\tinyxmlerror.cpp" /> <ClCompile Include="..\shared\tinyxml\tinyxmlparser.cpp" /> + <ClCompile Include="..\shared\util.cpp" /> <ClCompile Include="..\shared\xml_base.cpp" /> <ClCompile Include="..\shared\zstring.cpp" /> <ClCompile Include="..\structures.cpp" /> diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index d3a1f0e0..55e46fc6 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "application.h" @@ -14,6 +14,7 @@ #include "../shared/standard_paths.h" #include <wx/file.h> #include "../shared/string_conv.h" +#include <wx/log.h> #ifdef FFS_LINUX #include <gtk/gtk.h> @@ -92,7 +93,7 @@ int Application::OnRun() wxFile safeOutput(ffs3::getConfigDir() + wxT("LastError.txt"), wxFile::write); safeOutput.Write(wxString::FromAscii(e.what())); - wxMessageBox(wxString::FromAscii(e.what()), _("An exception occurred!"), wxOK | wxICON_ERROR); + wxSafeShowMessage(_("An exception occurred!"), wxString::FromAscii(e.what())); return -9; } diff --git a/RealtimeSync/application.h b/RealtimeSync/application.h index 00b6a4ec..a8a931e0 100644 --- a/RealtimeSync/application.h +++ b/RealtimeSync/application.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef REALTIMESYNCAPP_H @@ -20,10 +20,10 @@ public: private: void OnStartApplication(wxIdleEvent& event); - virtual wxLayoutDirection GetLayoutDirection() const //disable RTL languages for now... -{ - return wxLayout_LeftToRight; -} + virtual wxLayoutDirection GetLayoutDirection() const //disable RTL languages for now... + { + return wxLayout_LeftToRight; + } }; diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp index 6b15a5eb..d87b536c 100644 --- a/RealtimeSync/gui_generated.cpp +++ b/RealtimeSync/gui_generated.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -13,232 +13,235 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 420,440 ), wxDefaultSize ); - - m_menubar1 = new wxMenuBar( 0 ); - m_menuFile = new wxMenu(); - wxMenuItem* m_menuItem14; - m_menuItem14 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("CTRL-S"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItem14 ); - - wxMenuItem* m_menuItem13; - m_menuItem13 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("CTRL-L"), wxEmptyString, wxITEM_NORMAL ); - m_menuFile->Append( m_menuItem13 ); - - m_menuFile->AppendSeparator(); - - wxMenuItem* m_menuItem4; - 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_menuHelp = new wxMenu(); - wxMenuItem* m_menuItemContent; - m_menuItemContent = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Content") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemContent ); - - m_menuHelp->AppendSeparator(); - - m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("SHIFT-F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemAbout ); - - m_menubar1->Append( m_menuHelp, _("&Help") ); - - this->SetMenuBar( m_menubar1 ); - - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - m_panelMain = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer( wxVERTICAL ); - - - bSizer1->Add( 0, 10, 0, 0, 5 ); - - wxStaticBoxSizer* sbSizer41; - sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - m_staticText2 = new wxStaticText( m_panelMain, wxID_ANY, _("Usage:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText2->Wrap( -1 ); - m_staticText2->SetFont( wxFont( 10, 74, 90, 90, true, wxEmptyString ) ); - - sbSizer41->Add( m_staticText2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText3 = new wxStaticText( m_panelMain, wxID_ANY, _("1. Select directories to monitor."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText3->Wrap( -1 ); - sbSizer41->Add( m_staticText3, 0, wxLEFT, 10 ); - - m_staticText4 = new wxStaticText( m_panelMain, wxID_ANY, _("2. Enter a command line."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText4->Wrap( -1 ); - sbSizer41->Add( m_staticText4, 0, wxLEFT, 10 ); - - m_staticText5 = new wxStaticText( m_panelMain, wxID_ANY, _("3. Press 'Start'."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText5->Wrap( -1 ); - sbSizer41->Add( m_staticText5, 0, wxLEFT, 10 ); - - m_staticline3 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizer41->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_staticText21 = new wxStaticText( m_panelMain, wxID_ANY, _("The command line is executed each time:\n- all directories become available (e.g. USB stick insert)\n- files within these directories or subdirectories are modified"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - sbSizer41->Add( m_staticText21, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 40 ); - - m_staticline2 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer1->Add( m_staticline2, 0, wxTOP|wxBOTTOM|wxEXPAND, 10 ); - - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer5; - sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Directories to watch") ), wxVERTICAL ); - - m_panelMainFolder = new wxPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer781; - bSizer781 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonAddFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonAddFolder->SetToolTip( _("Add folder") ); - - m_bpButtonAddFolder->SetToolTip( _("Add folder") ); - - bSizer781->Add( m_bpButtonAddFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonRemoveTopFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") ); - - m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") ); - - bSizer781->Add( m_bpButtonRemoveTopFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer114->Add( bSizer781, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer114->Add( m_txtCtrlDirectoryMain, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerMain = new wxDirPickerCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPickerMain->SetToolTip( _("Select a folder") ); - - bSizer114->Add( m_dirPickerMain, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelMainFolder->SetSizer( bSizer114 ); - m_panelMainFolder->Layout(); - bSizer114->Fit( m_panelMainFolder ); - sbSizer5->Add( m_panelMainFolder, 0, wxEXPAND, 5 ); - - m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); - m_scrolledWinFolders->SetScrollRate( 5, 5 ); - bSizerFolders = new wxBoxSizer( wxVERTICAL ); - - m_scrolledWinFolders->SetSizer( bSizerFolders ); - m_scrolledWinFolders->Layout(); - bSizerFolders->Fit( m_scrolledWinFolders ); - sbSizer5->Add( m_scrolledWinFolders, 0, wxEXPAND, 5 ); - - bSizer8->Add( sbSizer5, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer1->Add( bSizer8, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer3; - sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Command line") ), wxVERTICAL ); - - m_textCtrlCommand = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer3->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM, 5 ); - - bSizer1->Add( sbSizer3, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Minimum Idle Time") ), wxVERTICAL ); - - m_spinCtrlDelay = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); - m_spinCtrlDelay->SetToolTip( _("Idle time between detection of last change and execution of command line in seconds") ); - - sbSizer4->Add( m_spinCtrlDelay, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); - - bSizer1->Add( sbSizer4, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_staticline1 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - - m_buttonStart = new wxButtonWithImage( m_panelMain, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1,40 ), 0 ); - m_buttonStart->SetDefault(); - m_buttonStart->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); - - bSizer1->Add( m_buttonStart, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonCancel = new wxButton( m_panelMain, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,0 ), 0 ); - bSizer1->Add( m_buttonCancel, 0, 0, 5 ); - - m_panelMain->SetSizer( bSizer1 ); - m_panelMain->Layout(); - bSizer1->Fit( m_panelMain ); - bSizerMain->Add( m_panelMain, 1, wxEXPAND, 5 ); - - this->SetSizer( bSizerMain ); - this->Layout(); - bSizerMain->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) ); - this->Connect( m_menuItem14->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnSaveConfig ) ); - this->Connect( m_menuItem13->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnLoadConfig ) ); - this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnQuit ) ); - this->Connect( m_menuItemContent->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) ); - this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) ); - m_bpButtonAddFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this ); - m_bpButtonRemoveTopFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this ); - m_buttonStart->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnQuit ), NULL, this ); + this->SetSizeHints( wxSize( 420,440 ), wxDefaultSize ); + + m_menubar1 = new wxMenuBar( 0 ); + m_menuFile = new wxMenu(); + wxMenuItem* m_menuItem14; + m_menuItem14 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("S&ave configuration...") ) + wxT('\t') + wxT("CTRL-S"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItem14 ); + + wxMenuItem* m_menuItem13; + m_menuItem13 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("&Load configuration...") ) + wxT('\t') + wxT("CTRL-L"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItem13 ); + + wxMenuItem* m_separator1; + m_separator1 = m_menuFile->AppendSeparator(); + + wxMenuItem* m_menuItem4; + 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_menuHelp = new wxMenu(); + wxMenuItem* m_menuItemContent; + m_menuItemContent = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Content") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemContent ); + + wxMenuItem* m_separator2; + m_separator2 = m_menuHelp->AppendSeparator(); + + m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("SHIFT-F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemAbout ); + + m_menubar1->Append( m_menuHelp, _("&Help") ); + + this->SetMenuBar( m_menubar1 ); + + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_panelMain = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + + bSizer1->Add( 0, 10, 0, 0, 5 ); + + wxStaticBoxSizer* sbSizer41; + sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + m_staticText2 = new wxStaticText( m_panelMain, wxID_ANY, _("Usage:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + m_staticText2->SetFont( wxFont( 10, 74, 90, 90, true, wxEmptyString ) ); + + sbSizer41->Add( m_staticText2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticText3 = new wxStaticText( m_panelMain, wxID_ANY, _("1. Select directories to monitor."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + sbSizer41->Add( m_staticText3, 0, wxLEFT, 10 ); + + m_staticText4 = new wxStaticText( m_panelMain, wxID_ANY, _("2. Enter a command line."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText4->Wrap( -1 ); + sbSizer41->Add( m_staticText4, 0, wxLEFT, 10 ); + + m_staticText5 = new wxStaticText( m_panelMain, wxID_ANY, _("3. Press 'Start'."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5->Wrap( -1 ); + sbSizer41->Add( m_staticText5, 0, wxLEFT, 10 ); + + m_staticline3 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + sbSizer41->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_staticText21 = new wxStaticText( m_panelMain, wxID_ANY, _("The command line is executed each time:\n- all directories become available (e.g. USB stick insert)\n- files within these directories or subdirectories are modified"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + sbSizer41->Add( m_staticText21, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 40 ); + + m_staticline2 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer1->Add( m_staticline2, 0, wxTOP|wxBOTTOM|wxEXPAND, 10 ); + + wxBoxSizer* bSizer8; + bSizer8 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer5; + sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Directories to watch") ), wxVERTICAL ); + + m_panelMainFolder = new wxPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer114; + bSizer114 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer781; + bSizer781 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonAddFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonAddFolder->SetToolTip( _("Add folder") ); + + m_bpButtonAddFolder->SetToolTip( _("Add folder") ); + + bSizer781->Add( m_bpButtonAddFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bpButtonRemoveTopFolder = new wxBitmapButton( m_panelMainFolder, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") ); + + m_bpButtonRemoveTopFolder->SetToolTip( _("Remove folder") ); + + bSizer781->Add( m_bpButtonRemoveTopFolder, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer114->Add( bSizer781, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer114->Add( m_txtCtrlDirectoryMain, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerMain = new wxDirPickerCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPickerMain->SetToolTip( _("Select a folder") ); + + bSizer114->Add( m_dirPickerMain, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_panelMainFolder->SetSizer( bSizer114 ); + m_panelMainFolder->Layout(); + bSizer114->Fit( m_panelMainFolder ); + sbSizer5->Add( m_panelMainFolder, 0, wxEXPAND, 5 ); + + m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_scrolledWinFolders->SetScrollRate( 5, 5 ); + bSizerFolders = new wxBoxSizer( wxVERTICAL ); + + m_scrolledWinFolders->SetSizer( bSizerFolders ); + m_scrolledWinFolders->Layout(); + bSizerFolders->Fit( m_scrolledWinFolders ); + sbSizer5->Add( m_scrolledWinFolders, 0, wxEXPAND, 5 ); + + bSizer8->Add( sbSizer5, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer1->Add( bSizer8, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer3; + sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Command line") ), wxVERTICAL ); + + m_textCtrlCommand = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer3->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM, 5 ); + + bSizer1->Add( sbSizer3, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Minimum Idle Time [seconds]") ), wxVERTICAL ); + + m_spinCtrlDelay = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 ); + m_spinCtrlDelay->SetToolTip( _("Idle time between detection of last change and execution of command line in seconds") ); + + sbSizer4->Add( m_spinCtrlDelay, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer1->Add( sbSizer4, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_staticline1 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); + + m_buttonStart = new wxButtonWithImage( m_panelMain, wxID_ANY, _("Start"), wxDefaultPosition, wxSize( -1,40 ), 0 ); + m_buttonStart->SetDefault(); + m_buttonStart->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Arial Black") ) ); + + bSizer1->Add( m_buttonStart, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonCancel = new wxButton( m_panelMain, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,0 ), 0 ); + bSizer1->Add( m_buttonCancel, 0, 0, 5 ); + + m_panelMain->SetSizer( bSizer1 ); + m_panelMain->Layout(); + bSizer1->Fit( m_panelMain ); + bSizerMain->Add( m_panelMain, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) ); + this->Connect( m_menuItem14->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnSaveConfig ) ); + this->Connect( m_menuItem13->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnLoadConfig ) ); + this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnQuit ) ); + this->Connect( m_menuItemContent->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) ); + this->Connect( m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) ); + m_bpButtonAddFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this ); + m_bpButtonRemoveTopFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this ); + m_buttonStart->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnQuit ), NULL, this ); } MainDlgGenerated::~MainDlgGenerated() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnSaveConfig ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnLoadConfig ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnQuit ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) ); - m_bpButtonAddFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this ); - m_bpButtonRemoveTopFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this ); - m_buttonStart->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this ); - m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnQuit ), NULL, this ); + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnSaveConfig ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnLoadConfig ) ); + this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnQuit ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) ); + this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) ); + m_bpButtonAddFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this ); + m_bpButtonRemoveTopFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this ); + m_buttonStart->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnQuit ), NULL, this ); + } FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { - wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - - m_bpButtonRemoveFolder = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); - m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") ); - - m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") ); - - bSizer114->Add( m_bpButtonRemoveFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer20; - bSizer20 = new wxBoxSizer( wxHORIZONTAL ); - - m_txtCtrlDirectory = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer20->Add( m_txtCtrlDirectory, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - m_dirPicker->SetToolTip( _("Select a folder") ); - - bSizer20->Add( m_dirPicker, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer114->Add( bSizer20, 1, 0, 5 ); - - this->SetSizer( bSizer114 ); - this->Layout(); - bSizer114->Fit( this ); + wxBoxSizer* bSizer114; + bSizer114 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonRemoveFolder = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 19,21 ), wxBU_AUTODRAW ); + m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") ); + + m_bpButtonRemoveFolder->SetToolTip( _("Remove folder") ); + + bSizer114->Add( m_bpButtonRemoveFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxHORIZONTAL ); + + m_txtCtrlDirectory = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer20->Add( m_txtCtrlDirectory, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); + m_dirPicker->SetToolTip( _("Select a folder") ); + + bSizer20->Add( m_dirPicker, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer114->Add( bSizer20, 1, 0, 5 ); + + this->SetSizer( bSizer114 ); + this->Layout(); + bSizer114->Fit( this ); } FolderGenerated::~FolderGenerated() diff --git a/RealtimeSync/gui_generated.h b/RealtimeSync/gui_generated.h index 2b00d1bc..a0760448 100644 --- a/RealtimeSync/gui_generated.h +++ b/RealtimeSync/gui_generated.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -39,72 +39,102 @@ class wxButtonWithImage; /////////////////////////////////////////////////////////////////////////////// /// Class MainDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class MainDlgGenerated : public wxFrame +class MainDlgGenerated : public wxFrame { - private: - - protected: - wxMenuBar* m_menubar1; - wxMenu* m_menuFile; - wxMenu* m_menuHelp; - wxMenuItem* m_menuItemAbout; - wxBoxSizer* bSizerMain; - wxPanel* m_panelMain; - - wxStaticText* m_staticText2; - wxStaticText* m_staticText3; - wxStaticText* m_staticText4; - wxStaticText* m_staticText5; - wxStaticLine* m_staticline3; - wxStaticText* m_staticText21; - wxStaticLine* m_staticline2; - wxPanel* m_panelMainFolder; - wxBitmapButton* m_bpButtonAddFolder; - wxBitmapButton* m_bpButtonRemoveTopFolder; - wxTextCtrl* m_txtCtrlDirectoryMain; - wxScrolledWindow* m_scrolledWinFolders; - wxBoxSizer* bSizerFolders; - wxTextCtrl* m_textCtrlCommand; - wxSpinCtrl* m_spinCtrlDelay; - wxStaticLine* m_staticline1; - wxButtonWithImage* m_buttonStart; - wxButton* m_buttonCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnSaveConfig( wxCommandEvent& event ){ event.Skip(); } - virtual void OnLoadConfig( wxCommandEvent& event ){ event.Skip(); } - virtual void OnQuit( wxCommandEvent& event ){ event.Skip(); } - virtual void OnShowHelp( wxCommandEvent& event ){ event.Skip(); } - virtual void OnMenuAbout( wxCommandEvent& event ){ event.Skip(); } - virtual void OnAddFolder( wxCommandEvent& event ){ event.Skip(); } - virtual void OnRemoveTopFolder( wxCommandEvent& event ){ event.Skip(); } - virtual void OnStart( wxCommandEvent& event ){ event.Skip(); } - - - public: - wxDirPickerCtrl* m_dirPickerMain; - MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("RealtimeSync - Automated Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - ~MainDlgGenerated(); - +private: + +protected: + wxMenuBar* m_menubar1; + wxMenu* m_menuFile; + wxMenu* m_menuHelp; + wxMenuItem* m_menuItemAbout; + wxBoxSizer* bSizerMain; + wxPanel* m_panelMain; + + wxStaticText* m_staticText2; + wxStaticText* m_staticText3; + wxStaticText* m_staticText4; + wxStaticText* m_staticText5; + wxStaticLine* m_staticline3; + wxStaticText* m_staticText21; + wxStaticLine* m_staticline2; + wxPanel* m_panelMainFolder; + wxBitmapButton* m_bpButtonAddFolder; + wxBitmapButton* m_bpButtonRemoveTopFolder; + wxTextCtrl* m_txtCtrlDirectoryMain; + wxScrolledWindow* m_scrolledWinFolders; + wxBoxSizer* bSizerFolders; + wxTextCtrl* m_textCtrlCommand; + wxSpinCtrl* m_spinCtrlDelay; + wxStaticLine* m_staticline1; + wxButtonWithImage* m_buttonStart; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) + { + event.Skip(); + } + virtual void OnSaveConfig( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnLoadConfig( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnQuit( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnShowHelp( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnMenuAbout( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnAddFolder( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnRemoveTopFolder( wxCommandEvent& event ) + { + event.Skip(); + } + virtual void OnStart( wxCommandEvent& event ) + { + event.Skip(); + } + + +public: + wxDirPickerCtrl* m_dirPickerMain; + + MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("RealtimeSync - Automated Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + + ~MainDlgGenerated(); + }; /////////////////////////////////////////////////////////////////////////////// /// Class FolderGenerated /////////////////////////////////////////////////////////////////////////////// -class FolderGenerated : public wxPanel +class FolderGenerated : public wxPanel { - private: - - protected: - - public: - wxBitmapButton* m_bpButtonRemoveFolder; - wxTextCtrl* m_txtCtrlDirectory; - wxDirPickerCtrl* m_dirPicker; - FolderGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); - ~FolderGenerated(); - +private: + +protected: + +public: + wxBitmapButton* m_bpButtonRemoveFolder; + wxTextCtrl* m_txtCtrlDirectory; + wxDirPickerCtrl* m_dirPicker; + + FolderGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~FolderGenerated(); + }; #endif //__gui_generated__ diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp index 3f22dcc3..d832b0aa 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -1,14 +1,13 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "main_dlg.h" #include "resources.h" #include "../shared/custom_button.h" #include "../shared/standard_paths.h" -//#include "functions.h" #include <wx/msgdlg.h> #include <wx/wupdlock.h> #include "watcher.h" @@ -22,12 +21,12 @@ #include "../shared/assert_static.h" #include "../shared/build_info.h" #include "../shared/help_provider.h" +#include "../shared/util.h" using namespace ffs3; -MainDialog::MainDialog(wxDialog *dlg, - const wxString& cfgFilename) +MainDialog::MainDialog(wxDialog *dlg, const wxString& cfgFileName) : MainDlgGenerated(dlg) { wxWindowUpdateLocker dummy(this); //avoid display distortion @@ -45,31 +44,17 @@ MainDialog::MainDialog(wxDialog *dlg, //prepare drag & drop dirNameFirst.reset(new ffs3::DirectoryName(m_panelMainFolder, m_dirPickerMain, m_txtCtrlDirectoryMain)); - //load config values + //--------------------------- load config values ------------------------------------ xmlAccess::XmlRealConfig newConfig; - bool startWatchingImmediately = false; + const wxString currentConfigFile = cfgFileName.empty() ? lastConfigFileName() : cfgFileName; - if (cfgFilename.empty()) + bool loadCfgSuccess = false; + if (!cfgFileName.empty() || wxFileExists(lastConfigFileName())) try { - rts::readRealOrBatchConfig(lastConfigFileName(), newConfig); - } - catch (const xmlAccess::XmlError& error) - { - if (wxFileExists(lastConfigFileName())) //show error only if it's a parsing problem - { - if (error.getSeverity() == xmlAccess::XmlError::WARNING) - wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); - else - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); - } - } - else - try - { - rts::readRealOrBatchConfig(cfgFilename, newConfig); - startWatchingImmediately = true; + rts::readRealOrBatchConfig(currentConfigFile, newConfig); + loadCfgSuccess = true; } catch (const xmlAccess::XmlError& error) { @@ -79,7 +64,11 @@ MainDialog::MainDialog(wxDialog *dlg, wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); } + const bool startWatchingImmediately = loadCfgSuccess && !cfgFileName.empty(); + setConfiguration(newConfig); + setLastUsedConfig(currentConfigFile); + //----------------------------------------------------------------------------------------- Fit(); Center(); @@ -181,9 +170,7 @@ void MainDialog::OnStart(wxCommandEvent& event) Hide(); - wxWindowDisabler dummy; //avoid unwanted re-entrance in the following process - - switch (rts::startDirectoryMonitor(currentCfg)) + switch (rts::startDirectoryMonitor(currentCfg, ffs3::extractJobName(currentConfigFileName))) { case rts::QUIT: { @@ -202,7 +189,11 @@ void MainDialog::OnStart(wxCommandEvent& event) void MainDialog::OnSaveConfig(wxCommandEvent& event) { - const wxString defaultFileName = wxT("Realtime.ffs_real"); + wxString defaultFileName = currentConfigFileName.empty() ? wxT("Realtime.ffs_real") : currentConfigFileName; + //attention: currentConfigFileName may be an imported *.ffs_batch file! We don't want to overwrite it with a GUI config! + if (defaultFileName.EndsWith(wxT(".ffs_batch"))) + defaultFileName.Replace(wxT(".ffs_batch"), wxT(".ffs_real"), false); + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("RealtimeSync configuration")) + wxT(" (*.ffs_real)|*.ffs_real"), wxFD_SAVE); if (filePicker->ShowModal() == wxID_OK) @@ -212,19 +203,16 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event) if (wxFileExists(newFileName)) { wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\""), _("Warning") , wxOK | wxCANCEL); - if (messageDlg->ShowModal() != wxID_OK) - { - OnSaveConfig(event); //retry - return; - } + return OnSaveConfig(event); //retry } + //write config to XML const xmlAccess::XmlRealConfig currentCfg = getConfiguration(); - - try //write config to XML + try { writeRealConfig(currentCfg, newFileName); + setLastUsedConfig(newFileName); } catch (const ffs3::FileError& error) { @@ -254,6 +242,23 @@ void MainDialog::loadConfig(const wxString& filename) } setConfiguration(newConfig); + setLastUsedConfig(filename); +} + + +void MainDialog::setLastUsedConfig(const wxString& filename) +{ + //set title + if (filename == lastConfigFileName()) + { + SetTitle(_("RealtimeSync - Automated Synchronization")); + currentConfigFileName.clear(); + } + else + { + SetTitle(wxString(wxT("RealtimeSync - ")) + filename); + currentConfigFileName = filename; + } } diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h index 22c39146..7f052e39 100644 --- a/RealtimeSync/main_dlg.h +++ b/RealtimeSync/main_dlg.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef REALTIMESYNCMAIN_H @@ -44,7 +44,7 @@ private: class MainDialog: public MainDlgGenerated { public: - MainDialog(wxDialog *dlg, const wxString& cfgFilename); + MainDialog(wxDialog *dlg, const wxString& cfgFileName); ~MainDialog(); void loadConfig(const wxString& filename); @@ -64,6 +64,7 @@ private: void setConfiguration(const xmlAccess::XmlRealConfig& cfg); xmlAccess::XmlRealConfig getConfiguration(); + void setLastUsedConfig(const wxString& filename); void layoutAsync(); //call Layout() asynchronously @@ -76,6 +77,8 @@ private: std::auto_ptr<ffs3::DirectoryName> dirNameFirst; std::vector<DirectoryPanel*> dirNamesExtra; //additional pairs to the standard pair + + wxString currentConfigFileName; }; #endif // REALTIMESYNCMAIN_H diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index e60ca3bf..a445b922 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -7,7 +7,7 @@ FFS_CPPFLAGS = -Wall -pipe -DNDEBUG -DwxUSE_UNICODE `wx-config --cxxflags --debu LINKFLAGS = `wx-config --libs --debug=no --unicode=yes` -lboost_thread -O3 -pthread #static build used for precompiled release -ifeq ($(BUILD),static) +ifeq ($(BUILD),release) FFS_CPPFLAGS = -Wall -pipe -DNDEBUG -DwxUSE_UNICODE `wx-config --cxxflags --debug=no --unicode=yes --static=yes` `pkg-config --cflags gtk+-2.0` -DFFS_LINUX -DTIXML_USE_STL -O3 -pthread LINKFLAGS = `wx-config --libs --debug=no --unicode=yes --static=yes` /usr/local/lib/libboost_thread.a -O3 -pthread endif @@ -23,6 +23,7 @@ FILE_LIST+=xml_proc.cpp FILE_LIST+=xml_ffs.cpp FILE_LIST+=../library/process_xml.cpp FILE_LIST+=../structures.cpp +FILE_LIST+=../shared/util.cpp FILE_LIST+=../shared/check_exist.cpp FILE_LIST+=../shared/localization_no_BOM.cpp FILE_LIST+=../shared/inotify/inotify-cxx.cpp diff --git a/RealtimeSync/notify.cpp b/RealtimeSync/notify.cpp index c87c15fc..182b7cd0 100644 --- a/RealtimeSync/notify.cpp +++ b/RealtimeSync/notify.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "notify.h" @@ -199,7 +199,7 @@ public: { const DWORD lastError = ::GetLastError(); if (lastError != ERROR_CALL_NOT_IMPLEMENTED && //fail on SAMBA share: this shouldn't be a showstopper! - lastError != ERROR_SERVICE_SPECIFIC_ERROR) //neither should be fail for "Pogoplug" mapped network drives + lastError != ERROR_SERVICE_SPECIFIC_ERROR) //neither should be fail for "Pogoplug" mapped network drives throw ffs3::FileError(wxString(wxT("Could not register device removal notifications:")) + wxT("\n\n") + ffs3::getLastErrorFormatted(lastError)); } else diff --git a/RealtimeSync/notify.h b/RealtimeSync/notify.h index 07d74f2a..1f7a204a 100644 --- a/RealtimeSync/notify.h +++ b/RealtimeSync/notify.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef NOTIFY_H_INCLUDED diff --git a/RealtimeSync/pch.h b/RealtimeSync/pch.h index 53076de8..9894b1c5 100644 --- a/RealtimeSync/pch.h +++ b/RealtimeSync/pch.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef RTS_PRECOMPILED_HEADER diff --git a/RealtimeSync/resource.rc b/RealtimeSync/resource.rc index f3dfb090..dcdb6ad1 100644 --- a/RealtimeSync/resource.rc +++ b/RealtimeSync/resource.rc @@ -20,7 +20,7 @@ BEGIN VALUE "FileVersion", VER_FREEFILESYNC_STR VALUE "ProductName", "RealtimeSync\0" VALUE "ProductVersion", VER_FREEFILESYNC_STR - VALUE "LegalCopyright", "(c) 2008 - 2010 ZenJu\0" + VALUE "LegalCopyright", "(c) 2008 - 2011 ZenJu\0" END END BLOCK "VarFileInfo" diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index b6e35c38..f966d4fa 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "resources.h" diff --git a/RealtimeSync/resources.h b/RealtimeSync/resources.h index 5a9f780b..1237c811 100644 --- a/RealtimeSync/resources.h +++ b/RealtimeSync/resources.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef RESOURCES_H_INCLUDED diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index 9c0db35a..c85df169 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "tray_menu.h" @@ -29,7 +29,7 @@ using namespace rts; class TrayIconHolder : private wxEvtHandler { public: - TrayIconHolder(); + TrayIconHolder(const wxString& jobname); ~TrayIconHolder(); void doUiRefreshNow(); @@ -61,6 +61,8 @@ private: bool m_abortRequested; bool m_resumeRequested; + + const wxString jobName_; //RTS job name, may be empty }; @@ -113,9 +115,10 @@ private: //############################################################################################################## -TrayIconHolder::TrayIconHolder() : +TrayIconHolder::TrayIconHolder(const wxString& jobname) : m_abortRequested(false), - m_resumeRequested(false) + m_resumeRequested(false), + jobName_(jobname) { trayMenu = new RtsTrayIcon(this); //not in initialization list: give it a valid parent object! @@ -146,7 +149,8 @@ void TrayIconHolder::showIconActive() #elif defined FFS_LINUX realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_linux.png"))); //use a 22x22 bitmap for perfect fit #endif - trayMenu->SetIcon(realtimeIcon, wxString(wxT("RealtimeSync")) + wxT(" - ") + _("Monitoring active...")); + const wxString postFix = jobName_.empty() ? wxString() : (wxT("\n\"") + jobName_ + wxT("\"")); + trayMenu->SetIcon(realtimeIcon, _("Monitoring active...") + postFix); } @@ -158,7 +162,8 @@ void TrayIconHolder::showIconWaiting() #elif defined FFS_LINUX realtimeIcon.CopyFromBitmap(GlobalResources::getInstance().getImageByName(wxT("RTS_tray_waiting_linux.png"))); //use a 22x22 bitmap for perfect fit #endif - trayMenu->SetIcon(realtimeIcon, wxString(wxT("RealtimeSync")) + wxT(" - ") + _("Waiting for all directories to become available...")); + const wxString postFix = jobName_.empty() ? wxString() : (wxT("\n\"") + jobName_ + wxT("\"")); + trayMenu->SetIcon(realtimeIcon, _("Waiting for missing directories...") + postFix); } @@ -231,7 +236,9 @@ class StartSyncNowException {}; class WaitCallbackImpl : public rts::WaitCallback { public: - WaitCallbackImpl() : nextSyncStart_(std::numeric_limits<long>::max()) {} + WaitCallbackImpl(const wxString& jobname) : + trayIcon(jobname), + nextSyncStart_(std::numeric_limits<long>::max()) {} void notifyAllDirectoriesExist() { @@ -279,13 +286,13 @@ watcher.h (low level wait for directory changes) */ -rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& config) +rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& config, const wxString& jobname) { const std::vector<Zstring> dirList = convert(config.directories); try { - WaitCallbackImpl callback; + WaitCallbackImpl callback(jobname); if (config.commandline.empty()) throw ffs3::FileError(_("Command line is empty!")); @@ -296,7 +303,14 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& while (true) { - wxExecute(config.commandline, wxEXEC_SYNC); //execute command + //execute command + { + //by default wxExecute uses a zero sized dummy window as a hack to keep focus which leaves a useless empty icon in ALT-TAB list + //=> use wxEXEC_NODISABLE and roll our own window disabler! (see comment in app.cpp: void *wxGUIAppTraits::BeforeChildWaitLoop()) + wxWindowDisabler dummy; //disables all top level windows + wxExecute(config.commandline, wxEXEC_SYNC | wxEXEC_NODISABLE); + } + wxLog::FlushActive(); //show wxWidgets error messages (if any) callback.scheduleNextSync(std::numeric_limits<long>::max()); //next sync not scheduled (yet) diff --git a/RealtimeSync/tray_menu.h b/RealtimeSync/tray_menu.h index 048fda60..01fbba17 100644 --- a/RealtimeSync/tray_menu.h +++ b/RealtimeSync/tray_menu.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef TRAYMENU_H_INCLUDED @@ -19,7 +19,7 @@ enum MonitorResponse QUIT }; -MonitorResponse startDirectoryMonitor(const xmlAccess::XmlRealConfig& config); +MonitorResponse startDirectoryMonitor(const xmlAccess::XmlRealConfig& config, const wxString& jobname); //jobname may be empty } diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp index d03c98b8..029b2d00 100644 --- a/RealtimeSync/watcher.cpp +++ b/RealtimeSync/watcher.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "watcher.h" diff --git a/RealtimeSync/watcher.h b/RealtimeSync/watcher.h index dc579edc..7208e7fb 100644 --- a/RealtimeSync/watcher.h +++ b/RealtimeSync/watcher.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef WATCHER_H_INCLUDED @@ -30,9 +30,9 @@ public: //wait until changes are detected or if a directory is not available (anymore) enum WaitResult { - CHANGE_DETECTED, - CHANGE_DIR_MISSING - }; + CHANGE_DETECTED, + CHANGE_DIR_MISSING +}; WaitResult waitForChanges(const std::vector<Zstring>& dirNames, WaitCallback* statusHandler); //throw(FileError) //wait until all directories become available (again) diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp index 864ceff9..be798efc 100644 --- a/RealtimeSync/xml_ffs.cpp +++ b/RealtimeSync/xml_ffs.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "xml_ffs.h" diff --git a/RealtimeSync/xml_ffs.h b/RealtimeSync/xml_ffs.h index cef11c9f..69e6e7a9 100644 --- a/RealtimeSync/xml_ffs.h +++ b/RealtimeSync/xml_ffs.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef XMLFREEFILESYNC_H_INCLUDED diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp index 273a687f..ca217b44 100644 --- a/RealtimeSync/xml_proc.cpp +++ b/RealtimeSync/xml_proc.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #include "xml_proc.h" diff --git a/RealtimeSync/xml_proc.h b/RealtimeSync/xml_proc.h index 3e6c0c0a..70a879a8 100644 --- a/RealtimeSync/xml_proc.h +++ b/RealtimeSync/xml_proc.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // #ifndef XMLPROCESSING_H_INCLUDED |