diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:11:09 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:11:09 +0200 |
commit | 9cc790869ed3905c78c7eeeb0bb44f800b3f2af4 (patch) | |
tree | 1c085bbf2302be294866c4fc6e0d225f8abbc346 /library | |
parent | 3.14 (diff) | |
download | FreeFileSync-9cc790869ed3905c78c7eeeb0bb44f800b3f2af4.tar.gz FreeFileSync-9cc790869ed3905c78c7eeeb0bb44f800b3f2af4.tar.bz2 FreeFileSync-9cc790869ed3905c78c7eeeb0bb44f800b3f2af4.zip |
3.15
Diffstat (limited to 'library')
-rw-r--r-- | library/binary.cpp | 4 | ||||
-rw-r--r-- | library/custom_grid.cpp | 206 | ||||
-rw-r--r-- | library/db_file.cpp | 23 | ||||
-rw-r--r-- | library/dir_lock.cpp | 27 | ||||
-rw-r--r-- | library/error_log.cpp | 2 | ||||
-rw-r--r-- | library/icon_buffer.cpp | 1 | ||||
-rw-r--r-- | library/pch.h | 119 | ||||
-rw-r--r-- | library/process_xml.cpp | 16 | ||||
-rw-r--r-- | library/process_xml.h | 6 | ||||
-rw-r--r-- | library/statistics.cpp | 2 |
10 files changed, 159 insertions, 247 deletions
diff --git a/library/binary.cpp b/library/binary.cpp index 1b722702..72fc220a 100644 --- a/library/binary.cpp +++ b/library/binary.cpp @@ -68,8 +68,8 @@ private: bool ffs3::filesHaveSameContent(const Zstring& filename1, const Zstring& filename2, CompareCallback& callback) { - FileInput file1(filename1); //throw FileError() - FileInput file2(filename2); //throw FileError() + FileInput file1(filename1); //throw (FileError) + FileInput file2(filename2); //throw (FileError) BufferSize bufferSize; diff --git a/library/custom_grid.cpp b/library/custom_grid.cpp index 7b853138..d8ced2a3 100644 --- a/library/custom_grid.cpp +++ b/library/custom_grid.cpp @@ -15,10 +15,12 @@ #include "../ui/grid_view.h" #include "../synchronization.h" #include "../shared/custom_tooltip.h" +#include "../shared/i18n.h" #include <wx/dcclient.h> #include "icon_buffer.h" #include <wx/icon.h> #include <wx/tooltip.h> +#include <wx/settings.h> #ifdef FFS_WIN #include <wx/timer.h> @@ -155,13 +157,14 @@ public: virtual wxGridCellAttr* GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) { - const wxColour color = getRowColor(row); + const std::pair<wxColour, wxColour> color = getRowColor(row); //add color to some rows wxGridCellAttr* result = wxGridTableBase::GetAttr(row, col, kind); if (result) { - if (result->GetBackgroundColour() == color) + if (result->GetTextColour() == color.first && + result->GetBackgroundColour() == color.second) { return result; } @@ -175,7 +178,8 @@ public: else result = new wxGridCellAttr; //created with ref-count 1 - result->SetBackgroundColour(color); + result->SetTextColour (color.first); + result->SetBackgroundColour(color.second); return result; } @@ -206,7 +210,7 @@ protected: const GridView* gridDataView; //(very fast) access to underlying grid data :) private: - virtual const wxColour getRowColor(int row) = 0; //rows that are filtered out are shown in different color + virtual const std::pair<wxColour, wxColour> getRowColor(int row) = 0; //rows that are filtered out are shown in different color: <foreground, background> int lastNrRows; int lastNrCols; @@ -406,37 +410,48 @@ protected: private: - virtual const wxColour getRowColor(int row) //rows that are filtered out are shown in different color + virtual const std::pair<wxColour, wxColour> getRowColor(int row) //rows that are filtered out are shown in different color: <foreground, background> { + std::pair<wxColour, wxColour> result(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), + wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + const FileSystemObject* fsObj = getRawData(row); if (fsObj) { //mark filtered rows if (!fsObj->isActive()) - return COLOR_BLUE; - - //mark directories and symlinks - struct GetRowColor : public FSObjectVisitor { - virtual void visit(const FileMapping& fileObj) - { - rowColor = *wxWHITE; - } - virtual void visit(const SymLinkMapping& linkObj) - { - rowColor = COLOR_ORANGE; - } - virtual void visit(const DirMapping& dirObj) + result.first = *wxBLACK; + result.second = COLOR_BLUE; + } + else + { + //mark directories and symlinks + struct GetRowColor : public FSObjectVisitor { - rowColor = COLOR_GREY; - } + GetRowColor(wxColour& foreground, wxColour& background) : foreground_(foreground), background_(background) {} + + virtual void visit(const FileMapping& fileObj) {} + virtual void visit(const SymLinkMapping& linkObj) + { + foreground_ = *wxBLACK; + background_ = COLOR_ORANGE; + } + virtual void visit(const DirMapping& dirObj) + { + foreground_ = *wxBLACK; + background_ = COLOR_GREY; + } - wxColour rowColor; - } getCol; - fsObj->accept(getCol); - return getCol.rowColor; + private: + wxColour& foreground_; + wxColour& background_; + } getCol(result.first, result.second); + fsObj->accept(getCol); + } } - return *wxWHITE; + + return result; } std::vector<xmlAccess::ColumnTypes> columnPositions; @@ -516,62 +531,89 @@ public: } private: - virtual const wxColour getRowColor(int row) //rows that are filtered out are shown in different color + virtual const std::pair<wxColour, wxColour> getRowColor(int row) //rows that are filtered out are shown in different color: <foreground, background> { + std::pair<wxColour, wxColour> result(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), + wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + const FileSystemObject* fsObj = getRawData(row); if (fsObj) { //mark filtered rows if (!fsObj->isActive()) - return COLOR_BLUE; - - if (syncPreviewActive) //synchronization preview { - switch (fsObj->getSyncOperation()) //evaluate comparison result and sync direction - { - case SO_CREATE_NEW_LEFT: - case SO_DELETE_LEFT: - case SO_OVERWRITE_LEFT: - return COLOR_SYNC_BLUE; - case SO_COPY_METADATA_TO_LEFT: - return COLOR_SYNC_BLUE_LIGHT; - case SO_CREATE_NEW_RIGHT: - case SO_DELETE_RIGHT: - case SO_OVERWRITE_RIGHT: - return COLOR_SYNC_GREEN; - case SO_COPY_METADATA_TO_RIGHT: - return COLOR_SYNC_GREEN_LIGHT; - case SO_UNRESOLVED_CONFLICT: - return COLOR_YELLOW; - case SO_DO_NOTHING: - case SO_EQUAL: - return *wxWHITE; - } + result.first = *wxBLACK;; + result.second = COLOR_BLUE; } - else //comparison results view + else { - switch (fsObj->getCategory()) + if (syncPreviewActive) //synchronization preview { - case FILE_LEFT_SIDE_ONLY: - case FILE_RIGHT_SIDE_ONLY: - return COLOR_CMP_GREEN; - case FILE_LEFT_NEWER: - case FILE_RIGHT_NEWER: - return COLOR_CMP_BLUE; - case FILE_DIFFERENT: - return COLOR_CMP_RED; - case FILE_EQUAL: - return *wxWHITE; - case FILE_CONFLICT: - return COLOR_YELLOW; - case FILE_DIFFERENT_METADATA: - return COLOR_YELLOW_LIGHT; + switch (fsObj->getSyncOperation()) //evaluate comparison result and sync direction + { + case SO_DO_NOTHING: + case SO_EQUAL: + break;//usually white + case SO_CREATE_NEW_LEFT: + case SO_OVERWRITE_LEFT: + case SO_DELETE_LEFT: + result.first = *wxBLACK; + result.second = COLOR_SYNC_BLUE; + break; + case SO_COPY_METADATA_TO_LEFT: + result.first = *wxBLACK; + result.second = COLOR_SYNC_BLUE_LIGHT; + break; + case SO_CREATE_NEW_RIGHT: + case SO_OVERWRITE_RIGHT: + case SO_DELETE_RIGHT: + result.first = *wxBLACK; + result.second = COLOR_SYNC_GREEN; + break; + case SO_COPY_METADATA_TO_RIGHT: + result.first = *wxBLACK; + result.second = COLOR_SYNC_GREEN_LIGHT; + break; + case SO_UNRESOLVED_CONFLICT: + result.first = *wxBLACK; + result.second = COLOR_YELLOW; + break; + } + } + else //comparison results view + { + switch (fsObj->getCategory()) + { + case FILE_LEFT_SIDE_ONLY: + case FILE_RIGHT_SIDE_ONLY: + result.first = *wxBLACK; + result.second = COLOR_CMP_GREEN; + break; + case FILE_LEFT_NEWER: + case FILE_RIGHT_NEWER: + result.first = *wxBLACK; + result.second = COLOR_CMP_BLUE; + break; + case FILE_DIFFERENT: + result.first = *wxBLACK; + result.second = COLOR_CMP_RED; + break; + case FILE_EQUAL: + break;//usually white + case FILE_CONFLICT: + result.first = *wxBLACK; + result.second = COLOR_YELLOW; + break; + case FILE_DIFFERENT_METADATA: + result.first = *wxBLACK; + result.second = COLOR_YELLOW_LIGHT; + break; + } } } } - //fallback - return *wxWHITE; + return result; } bool syncPreviewActive; //determines wheter grid shall show compare result or sync preview @@ -1309,20 +1351,20 @@ void CustomGridRim::setTooltip(const wxMouseEvent& event) virtual void visit(const FileMapping& fileObj) { - tipMsg_ = zToWx(fileObj.getShortName<side>()) + wxT("\n") + + tipMsg_ = zToWx(fileObj.getRelativeName<side>()) + wxT("\n") + _("Size") + wxT(": ") + ffs3::formatFilesizeToShortString(fileObj.getFileSize<side>()) + wxT("\n") + _("Date") + wxT(": ") + ffs3::utcTimeToLocalString(fileObj.getLastWriteTime<side>()); } virtual void visit(const SymLinkMapping& linkObj) { - tipMsg_ = zToWx(linkObj.getShortName<side>()) + wxT("\n") + + tipMsg_ = zToWx(linkObj.getRelativeName<side>()) + wxT("\n") + _("Date") + wxT(": ") + ffs3::utcTimeToLocalString(linkObj.getLastWriteTime<side>()); } virtual void visit(const DirMapping& dirObj) { - tipMsg_ = zToWx(dirObj.getShortName<side>()); + tipMsg_ = zToWx(dirObj.getRelativeName<side>()); } wxString& tipMsg_; @@ -1857,7 +1899,6 @@ CustomGridMiddle::CustomGridMiddle(wxWindow* parent, GetGridWindow()->SetLayoutDirection(wxLayout_LeftToRight); //avoid mirroring this dialog in RTL languages like Hebrew or Arabic GetGridColLabelWindow()->SetLayoutDirection(wxLayout_LeftToRight); // - //connect events for dynamic selection of sync direction GetGridWindow()->Connect(wxEVT_MOTION, wxMouseEventHandler(CustomGridMiddle::OnMouseMovement), NULL, this); GetGridWindow()->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(CustomGridMiddle::OnLeaveWindow), NULL, this); @@ -2048,37 +2089,48 @@ void CustomGridMiddle::OnLeftMouseDown(wxMouseEvent& event) void CustomGridMiddle::OnLeftMouseUp(wxMouseEvent& event) { - const int rowEndFiltering = mousePosToCell(event.GetPosition()).first; + //int selRowEnd = mousePosToCell(event.GetPosition()).first; + //-> use visibly marked rows instead! with wxWidgets 2.8.12 there is no other way than IsInSelection() + int selRowEnd = -1; + if (0 <= selectionRowBegin && selectionRowBegin < GetNumberRows()) + { + for (int i = selectionRowBegin; i < GetNumberRows() && IsInSelection(i, 0); ++i) + selRowEnd = i; + + if (selRowEnd == selectionRowBegin) + for (int i = selectionRowBegin; i >= 0 && IsInSelection(i, 0); --i) + selRowEnd = i; + } - if (0 <= selectionRowBegin && 0 <= rowEndFiltering) + if (0 <= selectionRowBegin && 0 <= selRowEnd) { switch (selectionPos) { case BLOCKPOS_CHECK_BOX: { //create a custom event - FFSCheckRowsEvent evt(selectionRowBegin, rowEndFiltering); + FFSCheckRowsEvent evt(selectionRowBegin, selRowEnd); AddPendingEvent(evt); } break; case BLOCKPOS_LEFT: { //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_LEFT); + FFSSyncDirectionEvent evt(selectionRowBegin, selRowEnd, SYNC_DIR_LEFT); AddPendingEvent(evt); } break; case BLOCKPOS_MIDDLE: { //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_NONE); + FFSSyncDirectionEvent evt(selectionRowBegin, selRowEnd, SYNC_DIR_NONE); AddPendingEvent(evt); } break; case BLOCKPOS_RIGHT: { //create a custom event - FFSSyncDirectionEvent evt(selectionRowBegin, rowEndFiltering, SYNC_DIR_RIGHT); + FFSSyncDirectionEvent evt(selectionRowBegin, selRowEnd, SYNC_DIR_RIGHT); AddPendingEvent(evt); } break; diff --git a/library/db_file.cpp b/library/db_file.cpp index 180ab0a4..43ebf283 100644 --- a/library/db_file.cpp +++ b/library/db_file.cpp @@ -9,13 +9,13 @@ #include <wx/zstream.h> #include "../shared/global_func.h" #include "../shared/file_error.h" -#include <wx/intl.h> #include "../shared/string_conv.h" #include "../shared/file_handling.h" #include <wx/mstream.h> #include "../shared/serialize.h" #include "../shared/file_io.h" #include "../shared/loki/ScopeGuard.h" +#include "../shared/i18n.h" #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" @@ -36,7 +36,7 @@ const int FILE_FORMAT_VER = 5; class FileInputStreamDB : public FileInputStream { public: - FileInputStreamDB(const Zstring& filename) : //throw FileError() + FileInputStreamDB(const Zstring& filename) : //throw (FileError) FileInputStream(filename) { //read FreeFileSync file identifier @@ -54,7 +54,7 @@ private: class FileOutputStreamDB : public FileOutputStream { public: - FileOutputStreamDB(const Zstring& filename) : //throw FileError() + FileOutputStreamDB(const Zstring& filename) : //throw (FileError) FileOutputStream(filename) { //write FreeFileSync file identifier @@ -466,24 +466,11 @@ void ffs3::saveToDisk(const BaseDirMapping& baseMapping) //throw (FileError) dbEntriesLeft.second[dbEntriesRight.first] = dbEntryLeft; dbEntriesRight.second[dbEntriesLeft.first] = dbEntryRight; - - struct TryCleanUp //ensure cleanup if working with temporary failed! - { - static void tryDeleteFile(const Zstring& filename) //throw () - { - try - { - removeFile(filename); - } - catch (...) {} - } - }; - //write (temp-) files... - Loki::ScopeGuard guardTempFileLeft = Loki::MakeGuard(&TryCleanUp::tryDeleteFile, fileNameLeftTmp); + Loki::ScopeGuard guardTempFileLeft = Loki::MakeGuard(&ffs3::removeFile, fileNameLeftTmp); saveFile(dbEntriesLeft, fileNameLeftTmp); //throw (FileError) - Loki::ScopeGuard guardTempFileRight = Loki::MakeGuard(&TryCleanUp::tryDeleteFile, fileNameRightTmp); + Loki::ScopeGuard guardTempFileRight = Loki::MakeGuard(&ffs3::removeFile, fileNameRightTmp); saveFile(dbEntriesRight, fileNameRightTmp); //throw (FileError) //operation finished: rename temp files -> this should work transactionally: diff --git a/library/dir_lock.cpp b/library/dir_lock.cpp index ba515a31..521f1c6f 100644 --- a/library/dir_lock.cpp +++ b/library/dir_lock.cpp @@ -1,23 +1,23 @@ #include "dir_lock.h" -#include <wx/intl.h> -#include "../shared/string_conv.h" -#include "../shared/system_func.h" +#include <utility> #include <wx/utils.h> #include <wx/timer.h> +#include <wx/log.h> +#include <wx/msgdlg.h> +#include <boost/cstdint.hpp> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> +#include "../shared/string_conv.h" +#include "../shared/i18n.h" +#include "../shared/system_func.h" #include "../shared/boost_thread_wrap.h" //include <boost/thread.hpp> #include "../shared/loki/ScopeGuard.h" -#include <wx/msgdlg.h> #include "../shared/system_constants.h" #include "../shared/guid.h" #include "../shared/file_io.h" #include "../shared/assert_static.h" -#include <utility> #include "../shared/serialize.h" -#include <boost/cstdint.hpp> #include "../shared/build_info.h" -#include <wx/log.h> #ifdef FFS_WIN #include <tlhelp32.h> @@ -109,12 +109,11 @@ public: return; DWORD bytesWritten = 0; - ::WriteFile( - fileHandle, //__in HANDLE hFile, - buffer, //__out LPVOID lpBuffer, - 1, //__in DWORD nNumberOfBytesToRead, - &bytesWritten, //__out_opt LPDWORD lpNumberOfBytesWritten, - NULL); //__inout_opt LPOVERLAPPED lpOverlapped + ::WriteFile(fileHandle, //__in HANDLE hFile, + buffer, //__out LPVOID lpBuffer, + 1, //__in DWORD nNumberOfBytesToRead, + &bytesWritten, //__out_opt LPDWORD lpNumberOfBytesWritten, + NULL); //__inout_opt LPOVERLAPPED lpOverlapped #elif defined FFS_LINUX const int fileHandle = ::open(lockfilename_.c_str(), O_WRONLY | O_APPEND); //O_EXCL contains a race condition on NFS file systems: http://linux.die.net/man/2/open @@ -346,7 +345,7 @@ ProcessStatus getProcessStatus(const LockInformation::ProcessDescription& procDe void writeLockInfo(const Zstring& lockfilename) //throw (FileError) { //write GUID at the beginning of the file: this ID is a universal identifier for this lock (no matter what the path is, considering symlinks, distributed network, etc.) - FileOutputStream lockFile(lockfilename); //throw FileError() + FileOutputStream lockFile(lockfilename); //throw (FileError) LockInformation().toStream(lockFile); } diff --git a/library/error_log.cpp b/library/error_log.cpp index 1549c6b5..483d670b 100644 --- a/library/error_log.cpp +++ b/library/error_log.cpp @@ -6,7 +6,7 @@ // #include "error_log.h" #include <wx/datetime.h> -#include <wx/intl.h> +#include "../shared/i18n.h" using ffs3::ErrorLogging; diff --git a/library/icon_buffer.cpp b/library/icon_buffer.cpp index e346e4be..14883deb 100644 --- a/library/icon_buffer.cpp +++ b/library/icon_buffer.cpp @@ -10,6 +10,7 @@ #include <queue> #include <set> #include <wx/log.h> +#include "../shared/i18n.h" #ifdef FFS_WIN #include <wx/msw/wrapwin.h> //includes "windows.h" diff --git a/library/pch.h b/library/pch.h deleted file mode 100644 index fa384ce5..00000000 --- a/library/pch.h +++ /dev/null @@ -1,119 +0,0 @@ -// ************************************************************************** -// * 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-2011 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** -// -#ifndef FFS_PRECOMPILED_HEADER -#define FFS_PRECOMPILED_HEADER - -//pay attention when using this file: might cause issues! -#ifdef NDEBUG -do NOT use in release build! -#endif - - //##################################################### - // basic wxWidgets headers -#ifndef WX_PRECOMP -#define WX_PRECOMP -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4996) //"warning C4996: 'std::copy': Function call with parameters that may be unsafe" -#endif - -#include <wx/wxprec.h> - - //##################################################### - // #include other rarely changing headers here - - //STL headers -#include <string> -#include <vector> -#include <set> -#include <map> -#include <queue> -#include <deque> -#include <stack> -#include <list> -#include <algorithm> -#include <functional> -#include <iterator> -#include <numeric> -#include <memory> -#include <utility> -#include <fstream> -#include <iostream> -#include <sstream> -#include <new> -#include <stdexcept> - - //other wxWidgets headers -#include <wx/log.h> -#include <wx/grid.h> -#include <wx/animate.h> -#include <wx/app.h> -#include <wx/arrstr.h> -#include <wx/bitmap.h> -#include <wx/bmpbuttn.h> -#include <wx/button.h> -#include <wx/checkbox.h> -#include <wx/choice.h> -#include <wx/clipbrd.h> -#include <wx/cmdline.h> -#include <wx/colour.h> -#include <wx/config.h> -#include <wx/dc.h> -#include <wx/dialog.h> -#include <wx/dir.h> -#include <wx/dnd.h> -#include <wx/file.h> -#include <wx/filename.h> -#include <wx/filepicker.h> -#include <wx/font.h> -#include <wx/frame.h> -#include <wx/gauge.h> -#include <wx/gdicmn.h> -#include <wx/grid.h> -#include <wx/hyperlink.h> -#include <wx/icon.h> -#include <wx/image.h> -#include <wx/intl.h> -#include <wx/log.h> -#include <wx/menu.h> -#include <wx/msgdlg.h> -#include <wx/panel.h> -#include <wx/radiobut.h> -#include <wx/settings.h> -#include <wx/sizer.h> -#include <wx/statbmp.h> -#include <wx/statbox.h> -#include <wx/statline.h> -#include <wx/stattext.h> -#include <wx/stdpaths.h> -#include <wx/stopwatch.h> -#include <wx/stream.h> -#include <wx/string.h> -#include <wx/textctrl.h> -#include <wx/thread.h> -#include <wx/utils.h> -#include <wx/wfstream.h> -#include <wx/zipstrm.h> -#include <wx/scrolwin.h> -#include <wx/notebook.h> -#include <wx/help.h> -#include <wx/event.h> - - //other -#include "../shared/tinyxml/tinyxml.h" -#include <sys/stat.h> - - //Boost -#include <boost/shared_ptr.hpp> -#include <boost/scoped_array.hpp> - -#ifdef __WXMSW__ -#include <wx/msw/wrapwin.h> //includes "windows.h" -#endif //__WXMSW__ - -#endif //FFS_PRECOMPILED_HEADER diff --git a/library/process_xml.cpp b/library/process_xml.cpp index 79d233fc..9f95f5a3 100644 --- a/library/process_xml.cpp +++ b/library/process_xml.cpp @@ -6,11 +6,11 @@ // #include "process_xml.h" #include "../shared/xml_base.h" -#include <wx/intl.h> -#include <wx/filefn.h> +#include "../shared/i18n.h" #include "../shared/global_func.h" #include "../shared/standard_paths.h" #include "../shared/string_conv.h" +#include "../shared/file_handling.h" using namespace ffs3; using namespace xmlAccess; //functionally needed!!! @@ -52,7 +52,7 @@ bool writeXmlMainConfig(const MainConfiguration& mainCfg, TiXmlDocument& doc); void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlGuiConfig& config) { //load XML - if (!wxFileExists(filename)) + if (!fileExists(wxToZ(filename))) throw XmlError(wxString(_("File does not exist:")) + wxT("\n\"") + filename + wxT("\"")); TiXmlDocument doc; @@ -70,7 +70,7 @@ void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlGuiConfig& co void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlBatchConfig& config) { //load XML - if (!wxFileExists(filename)) + if (!fileExists(wxToZ(filename))) throw XmlError(wxString(_("File does not exist:")) + wxT("\n\"") + filename + wxT("\"")); TiXmlDocument doc; @@ -88,7 +88,7 @@ void xmlAccess::readConfig(const wxString& filename, xmlAccess::XmlBatchConfig& void xmlAccess::readConfig(xmlAccess::XmlGlobalSettings& config) { //load XML - if (!wxFileExists(getGlobalConfigFile())) + if (!fileExists(wxToZ(getGlobalConfigFile()))) throw XmlError(wxString(_("File does not exist:")) + wxT("\n\"") + getGlobalConfigFile() + wxT("\"")); TiXmlDocument doc; @@ -981,12 +981,6 @@ bool writeXmlGlobalSettings(const xmlAccess::XmlGlobalSettings& inputCfg, TiXmlD } -int xmlAccess::retrieveSystemLanguage() -{ - return wxLocale::GetSystemLanguage(); -} - - wxString xmlAccess::getGlobalConfigFile() { return ffs3::getConfigDir() + wxT("GlobalSettings.xml"); diff --git a/library/process_xml.h b/library/process_xml.h index dcd80327..589865a2 100644 --- a/library/process_xml.h +++ b/library/process_xml.h @@ -9,6 +9,7 @@ #include "../structures.h" #include "../shared/xml_error.h" +#include "../shared/i18n.h" namespace xmlAccess @@ -91,9 +92,6 @@ struct XmlBatchConfig }; -int retrieveSystemLanguage(); - - struct OptionalDialogs { OptionalDialogs() @@ -121,7 +119,7 @@ struct XmlGlobalSettings //--------------------------------------------------------------------- //Shared (GUI/BATCH) settings XmlGlobalSettings() : - programLanguage(retrieveSystemLanguage()), + programLanguage(ffs3::retrieveSystemLanguage()), copyLockedFiles(true), copyFilePermissions(false), fileTimeTolerance(2), //default 2s: FAT vs NTFS diff --git a/library/statistics.cpp b/library/statistics.cpp index c0bb2b25..cb68d1de 100644 --- a/library/statistics.cpp +++ b/library/statistics.cpp @@ -10,7 +10,7 @@ #include "../shared/global_func.h" #include "status_handler.h" #include "../shared/util.h" -#include <wx/intl.h> +#include "../shared/i18n.h" #include <limits> #include <wx/stopwatch.h> #include "../shared/assert_static.h" |