diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
commit | d2854834e18443876c8f75e0a7f3b88d1d549fc4 (patch) | |
tree | e967b628081e50abc7c34cd264e6586271c7e728 /RealtimeSync | |
parent | 4.1 (diff) | |
download | FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.gz FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.bz2 FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.zip |
4.2
Diffstat (limited to 'RealtimeSync')
-rw-r--r-- | RealtimeSync/RealtimeSync.cbp | 2 | ||||
-rw-r--r-- | RealtimeSync/RealtimeSync.vcxproj | 8 | ||||
-rw-r--r-- | RealtimeSync/application.cpp | 10 | ||||
-rw-r--r-- | RealtimeSync/application.h | 8 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.cpp | 15 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.cpp | 22 | ||||
-rw-r--r-- | RealtimeSync/makefile | 2 | ||||
-rw-r--r-- | RealtimeSync/resources.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/resources.h | 2 | ||||
-rw-r--r-- | RealtimeSync/tray_menu.cpp | 2 | ||||
-rw-r--r-- | RealtimeSync/xml_ffs.cpp | 4 | ||||
-rw-r--r-- | RealtimeSync/xml_proc.cpp | 6 |
12 files changed, 43 insertions, 40 deletions
diff --git a/RealtimeSync/RealtimeSync.cbp b/RealtimeSync/RealtimeSync.cbp index 5c14d918..c842e6bb 100644 --- a/RealtimeSync/RealtimeSync.cbp +++ b/RealtimeSync/RealtimeSync.cbp @@ -61,9 +61,11 @@ <Add option="-Winit-self" /> <Add option="-Wswitch-enum" /> <Add option="-Wmain" /> + <Add option="-std=c++0x" /> <Add option="-Wall" /> <Add option="-pipe" /> <Add option="-mthreads" /> + <Add option="-fno-omit-frame-pointer" /> <Add option="-std=gnu++0x" /> <Add option='-include "../zen/warn_static.h"' /> <Add option="-D__GNUWIN32__" /> diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index 81b51005..8c85de3b 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -100,7 +100,7 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile> <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>false</MultiProcessorCompilation> @@ -130,7 +130,7 @@ <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswud;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile> <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <MultiProcessorCompilation>false</MultiProcessorCompilation> @@ -163,7 +163,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -198,7 +198,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG</PreprocessorDefinitions> - <AdditionalIncludeDirectories>..;../zenXml;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;C:\Program Files\C++\wxWidgets-x64\include;C:\Program Files\C++\wxWidgets-x64\lib\vc_lib\mswu;C:\Program Files\C++\Boost</AdditionalIncludeDirectories> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <DisableSpecificWarnings>4100;4996;4267;4512</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index 55c2e9c3..2f1a8848 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -26,6 +26,7 @@ using namespace zen; IMPLEMENT_APP(Application); + bool Application::OnInit() { //do not call wxApp::OnInit() to avoid using default commandline parser @@ -45,7 +46,12 @@ void Application::OnStartApplication(wxIdleEvent& event) //if appname is not set, the default is the executable's name! SetAppName(wxT("FreeFileSync")); //use a different app name, to have "GetUserDataDir()" return the same directory as for FreeFileSync -#ifdef FFS_LINUX +#ifdef FFS_WIN + //Quote: "Best practice is that all applications call the process-wide SetErrorMode function with a parameter of + //SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application." + ::SetErrorMode(SEM_FAILCRITICALERRORS); + +#elif defined FFS_LINUX ::gtk_rc_parse((zen::utf8CvrtTo<std::string>(zen::getResourceDir()) + "styles.rc").c_str()); //remove inner border from bitmap buttons #endif @@ -98,7 +104,7 @@ int Application::OnRun() catch (const std::exception& e) //catch all STL exceptions { //unfortunately it's not always possible to display a message box in this erroneous situation, however (non-stream) file output always works! - wxFile safeOutput(zen::getConfigDir() + wxT("LastError.txt"), wxFile::write); + wxFile safeOutput(toWx(zen::getConfigDir()) + wxT("LastError.txt"), wxFile::write); safeOutput.Write(wxString::FromAscii(e.what())); wxSafeShowMessage(_("An exception occurred!") + L" - RTS", wxString::FromAscii(e.what())); diff --git a/RealtimeSync/application.h b/RealtimeSync/application.h index 6b5481ad..69a28ef9 100644 --- a/RealtimeSync/application.h +++ b/RealtimeSync/application.h @@ -8,7 +8,6 @@ #define REALTIMESYNCAPP_H #include <wx/app.h> -#include <memory> class Application : public wxApp { @@ -19,12 +18,7 @@ public: private: void OnStartApplication(wxIdleEvent& event); - - virtual wxLayoutDirection GetLayoutDirection() const //disable RTL languages for now... - { - return wxLayout_LeftToRight; - } - + //virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_LeftToRight; } }; #endif // REALTIMESYNCAPP_H diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp index a8514907..51229ebf 100644 --- a/RealtimeSync/gui_generated.cpp +++ b/RealtimeSync/gui_generated.cpp @@ -88,14 +88,11 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr m_staticText21->Wrap( -1 ); sbSizer41->Add( m_staticText21, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); - bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 40 ); + bSizer1->Add( sbSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 20 ); 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 ); - sbSizerDirToWatch = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Directories to watch") ), wxVERTICAL ); m_panelMainFolder = new wxPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -117,7 +114,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizer114->Add( bSizer781, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_txtCtrlDirectoryMain = new wxTextCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 300,-1 ), 0 ); bSizer114->Add( m_txtCtrlDirectoryMain, 1, wxALIGN_CENTER_VERTICAL, 5 ); m_dirPickerMain = new zen::DirPickerCtrl( m_panelMainFolder, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -139,9 +136,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizerFolders->Fit( m_scrolledWinFolders ); sbSizerDirToWatch->Add( m_scrolledWinFolders, 0, wxEXPAND, 5 ); - bSizer8->Add( sbSizerDirToWatch, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - bSizer1->Add( bSizer8, 0, wxEXPAND, 5 ); + bSizer1->Add( sbSizerDirToWatch, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panelMain, wxID_ANY, _("Command line") ), wxVERTICAL ); @@ -157,9 +152,9 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr 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 ); + sbSizer4->Add( m_spinCtrlDelay, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer1->Add( sbSizer4, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bSizer1->Add( sbSizer4, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp index 15623286..30e5f04e 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -65,9 +65,9 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) catch (const xmlAccess::FfsXmlError& error) { if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING) - wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); + wxMessageBox(error.toString(), _("Warning"), wxOK | wxICON_WARNING); else - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.toString(), _("Error"), wxOK | wxICON_ERROR); } const bool startWatchingImmediately = loadCfgSuccess && !cfgFileName.empty(); @@ -75,8 +75,14 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) setConfiguration(newConfig); setLastUsedConfig(currentConfigFile); //----------------------------------------------------------------------------------------- + //Layout(); + //Fit(); + + m_scrolledWinFolders->Fit(); //adjust scrolled window size + m_scrolledWinFolders->Layout(); //fix small layout problem + m_panelMain->Layout(); //adjust stuff inside scrolled window + Fit(); //adapt dialog size - Fit(); Center(); if (startWatchingImmediately) //start watch mode directly @@ -100,7 +106,7 @@ MainDialog::~MainDialog() } catch (const xmlAccess::FfsXmlError& error) { - wxMessageBox(error.msg().c_str(), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.toString().c_str(), _("Error"), wxOK | wxICON_ERROR); } } @@ -119,7 +125,7 @@ void MainDialog::OnQuit(wxCommandEvent& event) const wxString& MainDialog::lastConfigFileName() { - static wxString instance = zen::getConfigDir() + wxT("LastRun.ffs_real"); + static wxString instance = toWx(zen::getConfigDir()) + wxT("LastRun.ffs_real"); return instance; } @@ -222,7 +228,7 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event) } catch (const zen::FileError& error) { - wxMessageBox(error.msg().c_str(), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.toString().c_str(), _("Error"), wxOK | wxICON_ERROR); } } } @@ -239,10 +245,10 @@ void MainDialog::loadConfig(const wxString& filename) catch (const xmlAccess::FfsXmlError& error) { if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING) - wxMessageBox(error.msg(), _("Warning"), wxOK | wxICON_WARNING); + wxMessageBox(error.toString(), _("Warning"), wxOK | wxICON_WARNING); else { - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.toString(), _("Error"), wxOK | wxICON_ERROR); return; } } diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index 4cef8c62..a6552b41 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -2,7 +2,7 @@ APPNAME = RealtimeSync prefix = /usr BINDIR = $(DESTDIR)$(prefix)/bin -COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I.. -I../zenXml +COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I.. -include "../zen/i18n.h" COMMON_LINK_FLAGS = -O3 -pthread #default build diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index 2936b7dc..8566a9d6 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -23,7 +23,7 @@ const GlobalResources& GlobalResources::instance() GlobalResources::GlobalResources() { - wxFFileInputStream input(zen::getResourceDir() + wxT("Resources.zip")); + wxFFileInputStream input(toWx(zen::getResourceDir()) + wxT("Resources.zip")); if (input.IsOk()) //if not... we don't want to react too harsh here { //activate support for .png files diff --git a/RealtimeSync/resources.h b/RealtimeSync/resources.h index 4c41d47d..820ff6a3 100644 --- a/RealtimeSync/resources.h +++ b/RealtimeSync/resources.h @@ -27,7 +27,7 @@ private: GlobalResources(const GlobalResources&); //=delete GlobalResources& operator=(const GlobalResources&); //=delete -const wxBitmap& getImageInt(const wxString& name) const; + const wxBitmap& getImageInt(const wxString& name) const; std::map<wxString, wxBitmap> bitmaps; }; diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index 8d43cabc..0cfed18e 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -351,7 +351,7 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& } catch (const zen::FileError& error) { - wxMessageBox(error.msg(), _("Error"), wxOK | wxICON_ERROR); + wxMessageBox(error.toString(), _("Error"), wxOK | wxICON_ERROR); return RESUME; } diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp index 32ef3b39..e0433374 100644 --- a/RealtimeSync/xml_ffs.cpp +++ b/RealtimeSync/xml_ffs.cpp @@ -39,8 +39,8 @@ xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& bat std::transform(uniqueFolders.begin(), uniqueFolders.end(), std::back_inserter(output.directories), [](const Zstring & fn) { return toWx(fn); }); - output.commandline = wxT("\"") + zen::getLauncher() + wxT("\"") + - wxT(" \"") + filename + wxT("\""); + output.commandline = std::wstring(L"\"") + zen::getLauncher() + L"\"" + + L" \"" + filename + L"\""; return output; } diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp index 8e978aed..38ba2a17 100644 --- a/RealtimeSync/xml_proc.cpp +++ b/RealtimeSync/xml_proc.cpp @@ -42,19 +42,19 @@ bool isXmlTypeRTS(const XmlDoc& doc) //throw() void xmlAccess::readRealConfig(const wxString& filename, XmlRealConfig& config) { if (!fileExists(toZ(filename))) - throw FfsXmlError(_("File does not exist:") + "\n\"" + filename.c_str() + "\""); + throw FfsXmlError(_("File does not exist:") + L"\n\"" + toZ(filename) + L"\""); XmlDoc doc; loadXmlDocument(toZ(filename), doc); //throw (FfsXmlError) if (!isXmlTypeRTS(doc)) - throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename.c_str() + "\""); + throw FfsXmlError(_("Error parsing configuration file:") + L"\n\"" + toZ(filename) + L"\""); XmlIn in(doc); ::readConfig(in, config); if (in.errorsOccured()) - throw FfsXmlError(_("Error parsing configuration file:") + "\n\"" + filename.c_str() + "\"\n\n" + + throw FfsXmlError(_("Error parsing configuration file:") + L"\n\"" + toZ(filename) + L"\"\n\n" + getErrorMessageFormatted(in), FfsXmlError::WARNING); } |