diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:01:29 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:01:29 +0200 |
commit | 9a2a524f1e311853d08050be2dcdddc09ac7759a (patch) | |
tree | d8e4a24169fce88c2d89931d58514889a0bcb0ea /RealtimeSync | |
parent | 2.3 (diff) | |
download | FreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.tar.gz FreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.tar.bz2 FreeFileSync-9a2a524f1e311853d08050be2dcdddc09ac7759a.zip |
3.0
Diffstat (limited to 'RealtimeSync')
-rw-r--r-- | RealtimeSync/functions.cpp | 8 | ||||
-rw-r--r-- | RealtimeSync/mainDialog.cpp | 17 | ||||
-rw-r--r-- | RealtimeSync/makefile | 4 | ||||
-rw-r--r-- | RealtimeSync/resources.cpp | 6 | ||||
-rw-r--r-- | RealtimeSync/watcher.cpp | 15 | ||||
-rw-r--r-- | RealtimeSync/xmlFreeFileSync.cpp | 13 |
6 files changed, 38 insertions, 25 deletions
diff --git a/RealtimeSync/functions.cpp b/RealtimeSync/functions.cpp index f966187e..e5e3f5f5 100644 --- a/RealtimeSync/functions.cpp +++ b/RealtimeSync/functions.cpp @@ -2,14 +2,16 @@ #include <wx/textctrl.h> #include <wx/filepicker.h> //#include "../shared/globalFunctions.h" +#include "../shared/stringConv.h" #include "../shared/fileHandling.h" +using namespace FreeFileSync; void RealtimeSync::setDirectoryName(const wxString& dirname, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker) { txtCtrl->SetValue(dirname); - const Zstring leftDirFormatted = FreeFileSync::getFormattedDirectoryName(dirname.c_str()); - if (wxDirExists(leftDirFormatted.c_str())) - dirPicker->SetPath(leftDirFormatted.c_str()); + const Zstring leftDirFormatted = FreeFileSync::getFormattedDirectoryName(wxToZ(dirname)); + if (dirExists(leftDirFormatted)) + dirPicker->SetPath(zToWx(leftDirFormatted)); } diff --git a/RealtimeSync/mainDialog.cpp b/RealtimeSync/mainDialog.cpp index cb1cbf86..d849eee5 100644 --- a/RealtimeSync/mainDialog.cpp +++ b/RealtimeSync/mainDialog.cpp @@ -12,6 +12,9 @@ #include "../shared/fileHandling.h" #include "xmlFreeFileSync.h" #include "../shared/systemConstants.h" +#include "../shared/stringConv.h" + +using namespace FreeFileSync; MainDialog::MainDialog(wxDialog *dlg, const wxString& cfgFilename) @@ -75,8 +78,8 @@ MainDialog::MainDialog(wxDialog *dlg, const wxString& cfgFilename) if (startWatchingImmediately) //start watch mode directly { - wxCommandEvent dummy(wxEVT_COMMAND_BUTTON_CLICKED); - this->OnStart(dummy); + wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); + this->OnStart(dummy2); } } @@ -111,9 +114,9 @@ void MainDialog::OnQuit(wxCommandEvent &event) const wxString& MainDialog::lastConfigFileName() { - static wxString instance = FreeFileSync::getConfigDir().EndsWith(wxString(globalFunctions::FILE_NAME_SEPARATOR)) ? + static wxString instance = FreeFileSync::getConfigDir().EndsWith(zToWx(globalFunctions::FILE_NAME_SEPARATOR)) ? FreeFileSync::getConfigDir() + wxT("LastRun.ffs_real") : - FreeFileSync::getConfigDir() + globalFunctions::FILE_NAME_SEPARATOR + wxT("LastRun.ffs_real"); + FreeFileSync::getConfigDir() + zToWx(globalFunctions::FILE_NAME_SEPARATOR) + wxT("LastRun.ffs_real"); return instance; } @@ -249,9 +252,9 @@ void MainDialog::setConfiguration(const xmlAccess::XmlRealConfig& cfg) //fill top folder m_txtCtrlDirectoryMain->SetValue(*cfg.directories.begin()); - const wxString dirFormatted = FreeFileSync::getFormattedDirectoryName(cfg.directories.begin()->c_str()).c_str(); - if (wxDirExists(dirFormatted)) - m_dirPickerMain->SetPath(dirFormatted); + const Zstring dirFormatted = FreeFileSync::getFormattedDirectoryName(wxToZ(*cfg.directories.begin())); + if (dirExists(dirFormatted)) + m_dirPickerMain->SetPath(zToWx(dirFormatted)); //fill additional folders addFolder(std::vector<wxString>(cfg.directories.begin() + 1, cfg.directories.end())); diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index 81f41b16..054bd3c1 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -1,5 +1,5 @@ -CPPFLAGS=-Wall -pipe -DNDEBUG `wx-config --cppflags` `pkg-config --cflags gtk+-2.0` -DFFS_LINUX -DTIXML_USE_STL -DZSTRING_CHAR -O3 -pthread -c -I../shared/boost_1_40_0 -LINKFLAGS=`wx-config --libs` -O3 -pthread +CPPFLAGS=-Wall -pipe -DNDEBUG -DwxUSE_UNICODE `wx-config --cxxflags --debug=no --unicode=yes` `pkg-config --cflags gtk+-2.0` -DFFS_LINUX -DTIXML_USE_STL -DZSTRING_CHAR -O3 -pthread -c -I../shared/boost_1_40_0 +LINKFLAGS=`wx-config --libs --debug=no --unicode=yes` -O3 -pthread FILE_LIST= #internal list of all *.cpp files needed for compilation FILE_LIST+=application.cpp diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index 979b5ecb..37a0bb43 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -4,10 +4,12 @@ #include <wx/image.h> #include <wx/icon.h> #include <memory> -//#include "../shared/globalFunctions.h" +#include "../shared/stringConv.h" #include "../shared/standardPaths.h" #include "../shared/systemConstants.h" +using namespace FreeFileSync; + const GlobalResources& GlobalResources::getInstance() { @@ -40,7 +42,7 @@ GlobalResources::~GlobalResources() void GlobalResources::load() const { - wxFFileInputStream input(FreeFileSync::getInstallationDir() + globalFunctions::FILE_NAME_SEPARATOR + wxT("Resources.dat")); + wxFFileInputStream input(FreeFileSync::getInstallationDir() + zToWx(globalFunctions::FILE_NAME_SEPARATOR) + wxT("Resources.dat")); if (input.IsOk()) //if not... we don't want to react too harsh here { //activate support for .png files diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp index 4949f01a..7aaa189d 100644 --- a/RealtimeSync/watcher.cpp +++ b/RealtimeSync/watcher.cpp @@ -4,6 +4,7 @@ #include <wx/intl.h> #include <wx/filefn.h> #include "../shared/fileHandling.h" +#include "../shared/stringConv.h" #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" @@ -15,6 +16,8 @@ #include "../shared/fileTraverser.h" #endif +using namespace FreeFileSync; + #ifdef FFS_WIN class ChangeNotifications @@ -130,14 +133,14 @@ void RealtimeSync::waitForChanges(const std::vector<wxString>& dirNames, WaitCal //add all subdirectories for (std::vector<wxString>::const_iterator i = dirNames.begin(); i != dirNames.end(); ++i) { - const Zstring formattedDir = FreeFileSync::getFormattedDirectoryName(i->c_str()); + const Zstring formattedDir = FreeFileSync::getFormattedDirectoryName(wxToZ(*i)); if (formattedDir.empty()) throw FreeFileSync::FileError(_("Please fill all empty directory fields.")); else if (!FreeFileSync::dirExists(formattedDir)) throw FreeFileSync::FileError(wxString(_("Directory does not exist:")) + wxT("\n") + - wxT("\"") + formattedDir + wxT("\"") + wxT("\n\n") + + wxT("\"") + zToWx(formattedDir) + wxT("\"") + wxT("\n\n") + FreeFileSync::getLastErrorFormatted()); fullDirList.push_back(formattedDir.c_str()); @@ -170,8 +173,8 @@ void RealtimeSync::waitForChanges(const std::vector<wxString>& dirNames, WaitCal } catch (const InotifyException& e) { - const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + *i + wxT("\""); - throw FreeFileSync::FileError(errorMessage + wxT("\n\n") + e.GetMessage().c_str()); + const wxString errorMessage = wxString(_("Could not initialize directory monitoring:")) + wxT("\n\"") + zToWx(i->c_str()) + wxT("\""); + throw FreeFileSync::FileError(errorMessage + wxT("\n\n") + zToWx(e.GetMessage().c_str())); } } @@ -188,11 +191,11 @@ void RealtimeSync::waitForChanges(const std::vector<wxString>& dirNames, WaitCal } catch (const InotifyException& e) { - throw FreeFileSync::FileError(wxString(_("Error when monitoring directories.")) + wxT("\n\n") + e.GetMessage().c_str()); + throw FreeFileSync::FileError(wxString(_("Error when monitoring directories.")) + wxT("\n\n") + zToWx(e.GetMessage().c_str())); } catch (const std::exception& e) { - throw FreeFileSync::FileError(wxString(_("Error when monitoring directories.")) + wxT("\n\n") + e.what()); + throw FreeFileSync::FileError(wxString(_("Error when monitoring directories.")) + wxT("\n\n") + zToWx(e.what())); } #endif } diff --git a/RealtimeSync/xmlFreeFileSync.cpp b/RealtimeSync/xmlFreeFileSync.cpp index b3c11d50..dc352135 100644 --- a/RealtimeSync/xmlFreeFileSync.cpp +++ b/RealtimeSync/xmlFreeFileSync.cpp @@ -4,10 +4,13 @@ #include "../shared/zstring.h" #include "functions.h" #include "../shared/xmlBase.h" +#include "../shared/stringConv.h" //include FreeFileSync xml headers #include "../library/processXml.h" +using namespace FreeFileSync; + #ifdef FFS_WIN struct CmpNoCase @@ -31,20 +34,20 @@ xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& bat #endif //add main folders - uniqueFolders.insert(batchCfg.mainCfg.mainFolderPair.leftDirectory.c_str()); - uniqueFolders.insert(batchCfg.mainCfg.mainFolderPair.rightDirectory.c_str()); + uniqueFolders.insert(zToWx(batchCfg.mainCfg.mainFolderPair.leftDirectory)); + uniqueFolders.insert(zToWx(batchCfg.mainCfg.mainFolderPair.rightDirectory)); //additional folders for (std::vector<FreeFileSync::FolderPairEnh>::const_iterator i = batchCfg.mainCfg.additionalPairs.begin(); i != batchCfg.mainCfg.additionalPairs.end(); ++i) { - uniqueFolders.insert(i->leftDirectory.c_str()); - uniqueFolders.insert(i->rightDirectory.c_str()); + uniqueFolders.insert(zToWx(i->leftDirectory)); + uniqueFolders.insert(zToWx(i->rightDirectory)); } output.directories.insert(output.directories.end(), uniqueFolders.begin(), uniqueFolders.end()); - output.commandline = FreeFileSync::getInstallationDir() + globalFunctions::FILE_NAME_SEPARATOR + wxT("FreeFileSync.exe ") + + output.commandline = FreeFileSync::getInstallationDir() + zToWx(globalFunctions::FILE_NAME_SEPARATOR) + wxT("FreeFileSync.exe ") + wxT("\"") + filename + wxT("\""); return output; |