summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:41 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:41 +0200
commitd6301fca6b78db52d0d98f8e0799aba175ad2e59 (patch)
tree0380aac034e0d70ee058db07900d80ff20cfc81e /lib
parent5.7 (diff)
downloadFreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.tar.gz
FreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.tar.bz2
FreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.zip
5.8
Diffstat (limited to 'lib')
-rw-r--r--lib/Batch.icobin139831 -> 134332 bytes
-rw-r--r--lib/FreeFileSync.icobin132167 -> 132428 bytes
-rw-r--r--lib/ShadowCopy/LockFile.cpp2
-rw-r--r--lib/ShadowCopy/dll_main.cpp2
-rw-r--r--lib/ShadowCopy/shadow.cpp4
-rw-r--r--lib/ShadowCopy/shadow.h22
-rw-r--r--lib/SyncDB.icobin145378 -> 133875 bytes
-rw-r--r--lib/Thumbnail/dll_main.cpp2
-rw-r--r--lib/Thumbnail/thumbnail.cpp2
-rw-r--r--lib/Thumbnail/thumbnail.h10
-rw-r--r--lib/binary.cpp7
-rw-r--r--lib/binary.h2
-rw-r--r--lib/db_file.cpp9
-rw-r--r--lib/db_file.h2
-rw-r--r--lib/dir_exist_async.h2
-rw-r--r--lib/dir_lock.cpp2
-rw-r--r--lib/dir_lock.h2
-rw-r--r--lib/error_log.h2
-rw-r--r--lib/ffs_paths.h2
-rw-r--r--lib/generate_logfile.h4
-rw-r--r--lib/hard_filter.cpp2
-rw-r--r--lib/hard_filter.h2
-rw-r--r--lib/help_provider.h2
-rw-r--r--lib/icon_buffer.cpp4
-rw-r--r--lib/icon_buffer.h2
-rw-r--r--lib/localization.cpp79
-rw-r--r--lib/localization.h7
-rw-r--r--lib/norm_filter.h2
-rw-r--r--lib/parallel_scan.cpp6
-rw-r--r--lib/parallel_scan.h2
-rw-r--r--lib/parse_lng.h4
-rw-r--r--lib/parse_plural.h173
-rw-r--r--lib/perf_check.cpp4
-rw-r--r--lib/perf_check.h2
-rw-r--r--lib/process_xml.cpp83
-rw-r--r--lib/process_xml.h22
-rw-r--r--lib/resolve_path.cpp70
-rw-r--r--lib/resolve_path.h2
-rw-r--r--lib/resources.cpp8
-rw-r--r--lib/resources.h6
-rw-r--r--lib/return_codes.h11
-rw-r--r--lib/shadow.cpp2
-rw-r--r--lib/shadow.h2
-rw-r--r--lib/soft_filter.h35
-rw-r--r--lib/status_handler.cpp2
-rw-r--r--lib/status_handler.h2
-rw-r--r--lib/status_handler_impl.h2
-rw-r--r--lib/versioning.cpp6
-rw-r--r--lib/versioning.h4
-rw-r--r--lib/xml_base.cpp2
-rw-r--r--lib/xml_base.h2
51 files changed, 338 insertions, 292 deletions
diff --git a/lib/Batch.ico b/lib/Batch.ico
index 7b33067a..14e2bb10 100644
--- a/lib/Batch.ico
+++ b/lib/Batch.ico
Binary files differ
diff --git a/lib/FreeFileSync.ico b/lib/FreeFileSync.ico
index b87789a7..02925b10 100644
--- a/lib/FreeFileSync.ico
+++ b/lib/FreeFileSync.ico
Binary files differ
diff --git a/lib/ShadowCopy/LockFile.cpp b/lib/ShadowCopy/LockFile.cpp
index 701b84ec..a09e7f94 100644
--- a/lib/ShadowCopy/LockFile.cpp
+++ b/lib/ShadowCopy/LockFile.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
diff --git a/lib/ShadowCopy/dll_main.cpp b/lib/ShadowCopy/dll_main.cpp
index 95d14910..4665154a 100644
--- a/lib/ShadowCopy/dll_main.cpp
+++ b/lib/ShadowCopy/dll_main.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp
index 3bc2df87..93026039 100644
--- a/lib/ShadowCopy/shadow.cpp
+++ b/lib/ShadowCopy/shadow.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "shadow.h"
@@ -152,7 +152,7 @@ shadow::ShadowHandle shadow::createShadowCopy(const wchar_t* volumeName)
try
{
ShadowData result = ::createShadowCopy(volumeName); //shadow handle owned by caller! throw ComError
- return new ShadowData(result);
+ return new ShadowData(result); //std::bad_alloc?
}
catch (const zen::ComError& e)
{
diff --git a/lib/ShadowCopy/shadow.h b/lib/ShadowCopy/shadow.h
index 8f35c728..e68b2655 100644
--- a/lib/ShadowCopy/shadow.h
+++ b/lib/ShadowCopy/shadow.h
@@ -1,16 +1,16 @@
// **************************************************************************
// * 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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
-#ifndef SHADOWCOPY_H
-#define SHADOWCOPY_H
+#ifndef SHADOWCOPY_H_14837413434
+#define SHADOWCOPY_H_14837413434
#ifdef SHADOWDLL_EXPORTS
-#define SHADOWDLL_API extern "C" __declspec(dllexport)
+#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport)
#else
-#define SHADOWDLL_API extern "C" __declspec(dllimport)
+#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport)
#endif
#include <zen/build_info.h>
@@ -30,18 +30,18 @@ struct ShadowData;
typedef ShadowData* ShadowHandle;
//volumeName *must* end with "\"
-SHADOWDLL_API
+DLL_FUNCTION_DECLARATION
ShadowHandle createShadowCopy(const wchar_t* volumeName); //returns nullptr on failure!
//release the backupHandle after shadow copy is not needed anymore!
-SHADOWDLL_API
+DLL_FUNCTION_DECLARATION
void releaseShadowCopy(ShadowHandle handle);
-SHADOWDLL_API
+DLL_FUNCTION_DECLARATION
const wchar_t* getShadowVolume(ShadowHandle handle); //never fails, returns shadowVolName, never ending with "\"
//get last error message if any of the functions above fail
-SHADOWDLL_API
+DLL_FUNCTION_DECLARATION
const wchar_t* getLastError(); //no nullptr check required!
//##########################################################################################
@@ -89,4 +89,6 @@ const wchar_t* getDllName()
}
}
-#endif //SHADOWCOPY_H
+#undef DLL_FUNCTION_DECLARATION
+
+#endif //SHADOWCOPY_H_14837413434
diff --git a/lib/SyncDB.ico b/lib/SyncDB.ico
index eee91c14..6fc5d264 100644
--- a/lib/SyncDB.ico
+++ b/lib/SyncDB.ico
Binary files differ
diff --git a/lib/Thumbnail/dll_main.cpp b/lib/Thumbnail/dll_main.cpp
index 95d14910..4665154a 100644
--- a/lib/Thumbnail/dll_main.cpp
+++ b/lib/Thumbnail/dll_main.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
diff --git a/lib/Thumbnail/thumbnail.cpp b/lib/Thumbnail/thumbnail.cpp
index 50c4f2a8..0c7162b9 100644
--- a/lib/Thumbnail/thumbnail.cpp
+++ b/lib/Thumbnail/thumbnail.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "thumbnail.h"
diff --git a/lib/Thumbnail/thumbnail.h b/lib/Thumbnail/thumbnail.h
index 9328b4f0..b2be2239 100644
--- a/lib/Thumbnail/thumbnail.h
+++ b/lib/Thumbnail/thumbnail.h
@@ -1,11 +1,11 @@
// **************************************************************************
// * 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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
-#ifndef TASKBAR_SEVEN_DLL_H
-#define TASKBAR_SEVEN_DLL_H
+#ifndef THUMBNAIL_DLL_HEADER_487108471324
+#define THUMBNAIL_DLL_HEADER_487108471324
#ifdef THUMBNAIL_DLL_EXPORTS
#define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport)
@@ -65,4 +65,6 @@ const char funName_getIconByIndex[] = "getIconByIndex";
inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"Thumbnail_x64.dll" : L"Thumbnail_Win32.dll"; }
}
-#endif //TASKBAR_SEVEN_DLL_H
+#undef DLL_FUNCTION_DECLARATION
+
+#endif //THUMBNAIL_DLL_HEADER_487108471324
diff --git a/lib/binary.cpp b/lib/binary.cpp
index ec22c60f..b9e3028d 100644
--- a/lib/binary.cpp
+++ b/lib/binary.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "binary.h"
@@ -14,6 +14,8 @@
using namespace zen;
+namespace
+{
inline
void setMinSize(std::vector<char>& buffer, size_t minSize)
{
@@ -21,9 +23,6 @@ void setMinSize(std::vector<char>& buffer, size_t minSize)
buffer.resize(minSize);
}
-
-namespace
-{
class BufferSize
{
public:
diff --git a/lib/binary.h b/lib/binary.h
index 2c985de5..83409e19 100644
--- a/lib/binary.h
+++ b/lib/binary.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef BINARY_H_INCLUDED
diff --git a/lib/db_file.cpp b/lib/db_file.cpp
index 3c61137b..8821fc66 100644
--- a/lib/db_file.cpp
+++ b/lib/db_file.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "db_file.h"
@@ -414,7 +414,7 @@ class UpdateLastSynchronousState
/*
1. filter by file name does *not* create a new hierarchy, but merely gives a different *view* on the existing file hierarchy
=> only update database entries matching this view!
- 2. Symlink handling *does* create a new (asymmetric) hierarchies during comparison
+ 2. Symlink handling *does* create a new (asymmetric) hierarchy during comparison
=> update all database entries!
*/
public:
@@ -741,10 +741,9 @@ void zen::saveLastSynchronousState(const BaseDirMapping& baseMapping) //throw Fi
if (streamIterRightOld != streamListRight.end())
streamListRight.erase(streamIterRightOld);
- //create/update DirInfo-streams
+ //create new session data
const std::string sessionID = zen::generateGUID();
- //fill in new
streamListLeft [sessionID] = std::move(updatedStreamLeft);
streamListRight[sessionID] = std::move(updatedStreamRight);
@@ -762,6 +761,6 @@ void zen::saveLastSynchronousState(const BaseDirMapping& baseMapping) //throw Fi
renameFile(dbNameLeftTmp, dbNameLeft); //
renameFile(dbNameRightTmp, dbNameRight); //
- guardTempFileLeft. dismiss(); //no need to delete temp file anymore
+ guardTempFileLeft. dismiss(); //no need to delete temp files anymore
guardTempFileRight.dismiss(); //
}
diff --git a/lib/db_file.h b/lib/db_file.h
index 469cd3fa..c080081c 100644
--- a/lib/db_file.h
+++ b/lib/db_file.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef DBFILE_H_INCLUDED
diff --git a/lib/dir_exist_async.h b/lib/dir_exist_async.h
index 7e18d210..a02facad 100644
--- a/lib/dir_exist_async.h
+++ b/lib/dir_exist_async.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef DIR_EXIST_HEADER_08173281673432158067342132467183267
diff --git a/lib/dir_lock.cpp b/lib/dir_lock.cpp
index 469af262..da119f88 100644
--- a/lib/dir_lock.cpp
+++ b/lib/dir_lock.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "dir_lock.h"
#include <utility>
diff --git a/lib/dir_lock.h b/lib/dir_lock.h
index b1fc1a06..85b9058e 100644
--- a/lib/dir_lock.h
+++ b/lib/dir_lock.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef DIR_LOCK_H_INCLUDED
#define DIR_LOCK_H_INCLUDED
diff --git a/lib/error_log.h b/lib/error_log.h
index 2ccb4d84..2971f746 100644
--- a/lib/error_log.h
+++ b/lib/error_log.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef ERROR_LOG_89734181783491324134
diff --git a/lib/ffs_paths.h b/lib/ffs_paths.h
index 1a67af5c..2aef2322 100644
--- a/lib/ffs_paths.h
+++ b/lib/ffs_paths.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef STANDARDPATHS_H_INCLUDED
diff --git a/lib/generate_logfile.h b/lib/generate_logfile.h
index d1537311..651b93cb 100644
--- a/lib/generate_logfile.h
+++ b/lib/generate_logfile.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef GEN_LOGFILE_H_93172643216748973216458732165415
@@ -10,7 +10,7 @@
#include <zen/error_log.h>
#include <zen/file_io.h>
#include <zen/serialize.h>
-#include <wx+/format_unit.h>
+#include <zen/format_unit.h>
#include "ffs_paths.h"
diff --git a/lib/hard_filter.cpp b/lib/hard_filter.cpp
index 8fe0f7f4..5664da83 100644
--- a/lib/hard_filter.cpp
+++ b/lib/hard_filter.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "hard_filter.h"
diff --git a/lib/hard_filter.h b/lib/hard_filter.h
index 57132e7f..e47047a0 100644
--- a/lib/hard_filter.h
+++ b/lib/hard_filter.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef FFS_FILTER_H_INCLUDED
diff --git a/lib/help_provider.h b/lib/help_provider.h
index d35e04c2..15ae4f60 100644
--- a/lib/help_provider.h
+++ b/lib/help_provider.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef HELPPROVIDER_H_INCLUDED
diff --git a/lib/icon_buffer.cpp b/lib/icon_buffer.cpp
index dd449229..60f6cbe4 100644
--- a/lib/icon_buffer.cpp
+++ b/lib/icon_buffer.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "icon_buffer.h"
@@ -379,7 +379,7 @@ IconHolder getGenericDirectoryIcon(IconBuffer::IconSize sz)
//---------------------- Shared Data -------------------------
-struct WorkLoad
+class WorkLoad
{
public:
Zstring extractNextFile() //context of worker thread, blocking
diff --git a/lib/icon_buffer.h b/lib/icon_buffer.h
index 7bbf3432..75bf54c8 100644
--- a/lib/icon_buffer.h
+++ b/lib/icon_buffer.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef ICONBUFFER_H_INCLUDED
diff --git a/lib/localization.cpp b/lib/localization.cpp
index 83bc60d2..64c8b0f3 100644
--- a/lib/localization.cpp
+++ b/lib/localization.cpp
@@ -1,33 +1,30 @@
// **************************************************************************
// * 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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "localization.h"
-#include <fstream>
+//#include <fstream>
#include <map>
#include <list>
#include <iterator>
-//#include <wx/ffile.h>
-#include <wx/intl.h>
-#include <wx/msgdlg.h>
-#include "parse_plural.h"
-#include "parse_lng.h"
-#include <wx+/format_unit.h>
#include <zen/string_tools.h>
#include <zen/file_traverser.h>
-#include "ffs_paths.h"
#include <zenxml/io.h>
#include <zen/i18n.h>
+#include <zen/format_unit.h>
+#include <wx/intl.h>
+//#include <wx/msgdlg.h>
+#include "parse_plural.h"
+#include "parse_lng.h"
+#include "ffs_paths.h"
using namespace zen;
namespace
{
-//global objects
-
class FFSLocale : public TranslationHandler
{
public:
@@ -68,7 +65,6 @@ private:
};
-
FFSLocale::FFSLocale(const wxString& filename, wxLanguage languageId) : langId_(languageId) //throw lngfile::ParsingError, PluralForm::ParsingError
{
std::string inputStream;
@@ -109,7 +105,7 @@ FFSLocale::FFSLocale(const wxString& filename, wxLanguage languageId) : langId_(
transMappingPl.insert(std::make_pair(std::make_pair(singular, plural), plFormsWide));
}
- pluralParser.reset(new PluralForm(copyStringTo<Wstring>(header.pluralDefinition))); //throw PluralForm::ParsingError
+ pluralParser.reset(new PluralForm(header.pluralDefinition)); //throw PluralForm::ParsingError
}
}
@@ -165,7 +161,7 @@ ExistingTranslations::ExistingTranslations()
newEntry.languageID = wxLANGUAGE_ENGLISH_US;
newEntry.languageName = L"English (US)";
newEntry.languageFile = L"";
- newEntry.translatorName = L"ZenJu";
+ newEntry.translatorName = L"Zenju";
newEntry.languageFlag = L"usa.png";
locMapping.push_back(newEntry);
}
@@ -339,33 +335,45 @@ wxLanguage mapLanguageDialect(wxLanguage language)
return language;
}
}
-}
-class CustomLocale
+//global wxWidgets localization: sets up C localization runtime as well!
+class wxWidgetsLocale
{
public:
- CustomLocale(int selectedLng)
+ static void init(wxLanguage lng)
{
+ locale.reset(); //avoid global locale lifetime overlap! wxWidgets cannot handle this and will crash!
+ locale.reset(new wxLocale);
+
const wxLanguageInfo* sysLngInfo = wxLocale::GetLanguageInfo(wxLocale::GetSystemLanguage());
- const wxLanguageInfo* selLngInfo = wxLocale::GetLanguageInfo(selectedLng);
+ const wxLanguageInfo* selLngInfo = wxLocale::GetLanguageInfo(lng);
const bool sysLangIsRTL = sysLngInfo ? sysLngInfo->LayoutDirection == wxLayout_RightToLeft : false;
const bool selectedLangIsRTL = selLngInfo ? selLngInfo->LayoutDirection == wxLayout_RightToLeft : false;
if (sysLangIsRTL == selectedLangIsRTL)
- loc.Init(wxLANGUAGE_DEFAULT); //use sys-lang to preserve sub-language specific rules (e.g. german swiss number punctation)
+ locale->Init(wxLANGUAGE_DEFAULT); //use sys-lang to preserve sub-language specific rules (e.g. german swiss number punctation)
else
- loc.Init(selectedLng);
+ locale->Init(lng); //have to use the supplied language to enable RTL layout different than user settings
+ locLng = lng;
}
+
+ static wxLanguage getLanguage() { return locLng; }
+
private:
- wxLocale loc; //required for RTL language support (and nothing else)
+ static std::unique_ptr<wxLocale> locale;
+ static wxLanguage locLng;
};
+std::unique_ptr<wxLocale> wxWidgetsLocale::locale;
+wxLanguage wxWidgetsLocale::locLng = wxLANGUAGE_UNKNOWN;
+}
-void zen::setLanguage(int language)
+void zen::setLanguage(int language) //throw FileError
{
- if (language == getLanguage()) return; //support polling
+ if (language == getLanguage() && wxWidgetsLocale::getLanguage() == language)
+ return; //support polling
//(try to) retrieve language file
wxString languageFile;
@@ -377,31 +385,28 @@ void zen::setLanguage(int language)
break;
}
- //handle RTL swapping: we need wxWidgets to do this
- static std::unique_ptr<CustomLocale> dummy;
- dummy.reset(); //avoid global locale lifetime overlap! wxWidgets cannot handle this and will crash!
- dummy.reset(new CustomLocale(languageFile.empty() ? wxLANGUAGE_ENGLISH : language));
-
- //reset to english language; in case of error show error message just once
- zen::setTranslator();
-
//load language file into buffer
- if (!languageFile.empty()) //if languageFile is empty texts will be english per default
+ if (languageFile.empty()) //if languageFile is empty, texts will be english by default
+ zen::setTranslator();
+ else
try
{
zen::setTranslator(new FFSLocale(languageFile, static_cast<wxLanguage>(language))); //throw lngfile::ParsingError, PluralForm::ParsingError
}
catch (lngfile::ParsingError& e)
{
- wxMessageBox(replaceCpy(replaceCpy(replaceCpy(_("Error parsing file %x, row %y, column %z."),
- L"%x", fmtFileName(toZ(languageFile))),
- L"%y", numberTo<std::wstring>(e.row)),
- L"%z", numberTo<std::wstring>(e.col)), _("Error"), wxOK | wxICON_ERROR);
+ throw FileError(replaceCpy(replaceCpy(replaceCpy(_("Error parsing file %x, row %y, column %z."),
+ L"%x", fmtFileName(toZ(languageFile))),
+ L"%y", numberTo<std::wstring>(e.row)),
+ L"%z", numberTo<std::wstring>(e.col)));
}
catch (PluralForm::ParsingError&)
{
- wxMessageBox(L"Invalid Plural Form", _("Error"), wxOK | wxICON_ERROR);
+ throw FileError(L"Invalid Plural Form");
}
+
+ //handle RTL swapping: we need wxWidgets to do this
+ wxWidgetsLocale::init(languageFile.empty() ? wxLANGUAGE_ENGLISH : static_cast<wxLanguage>(language));
}
diff --git a/lib/localization.h b/lib/localization.h
index a4430467..125be0fd 100644
--- a/lib/localization.h
+++ b/lib/localization.h
@@ -1,14 +1,15 @@
// **************************************************************************
// * 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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef MISC_H_INCLUDED
#define MISC_H_INCLUDED
-#include <wx/string.h>
#include <vector>
+#include <zen/file_error.h>
+#include <wx/string.h>
namespace zen
{
@@ -33,7 +34,7 @@ private:
std::vector<Entry> locMapping;
};
-void setLanguage(int language);
+void setLanguage(int language); //throw FileError
int getLanguage();
int retrieveSystemLanguage();
}
diff --git a/lib/norm_filter.h b/lib/norm_filter.h
index aeefa8a1..2d878da2 100644
--- a/lib/norm_filter.h
+++ b/lib/norm_filter.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef NORM_FILTER_H_INCLUDED
diff --git a/lib/parallel_scan.cpp b/lib/parallel_scan.cpp
index 6e7a6368..e8b13003 100644
--- a/lib/parallel_scan.cpp
+++ b/lib/parallel_scan.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "parallel_scan.h"
@@ -17,10 +17,6 @@
using namespace zen;
-#ifndef BOOST_HAS_THREADS
-#error just some paranoia check...
-#endif
-
namespace
{
diff --git a/lib/parallel_scan.h b/lib/parallel_scan.h
index 41712a55..f04d51b4 100644
--- a/lib/parallel_scan.h
+++ b/lib/parallel_scan.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef PARALLEL_SCAN_H_INCLUDED
diff --git a/lib/parse_lng.h b/lib/parse_lng.h
index 3cbadf65..5eb135a3 100644
--- a/lib/parse_lng.h
+++ b/lib/parse_lng.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef PARSE_LNG_HEADER_INCLUDED
@@ -33,7 +33,7 @@ typedef std::map <SingularPluralPair, PluralForms> TranslationPluralMap; //(sing
struct TransHeader
{
std::string languageName; //display name: "English (UK)"
- std::string translatorName; //"ZenJu"
+ std::string translatorName; //"Zenju"
std::string localeName; //ISO 639 language code + ISO 3166 country code, e.g. "en_GB", or "en_US"
std::string flagFile; //"england.png"
int pluralCount; //2
diff --git a/lib/parse_plural.h b/lib/parse_plural.h
index d3473821..2b78de89 100644
--- a/lib/parse_plural.h
+++ b/lib/parse_plural.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef PARSE_PLURAL_H_INCLUDED
@@ -12,7 +12,6 @@
#include <functional>
#include <zen/string_base.h>
-
//http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
//http://translate.sourceforge.net/wiki/l10n/pluralforms
/*
@@ -50,9 +49,9 @@ multiplicative-expression:
multiplicative-expression % pm-expression
pm-expression:
- N
- Number
- ( Expression )
+ variable-number-n-expression
+ constant-number-expression
+ ( expression )
*/
@@ -71,58 +70,55 @@ struct Expr : public Expression
template <class StlOp>
struct BinaryExp : public Expr<typename StlOp::result_type>
{
- typedef const Expr<typename StlOp::first_argument_type> SourceExp;
+ typedef const Expr<typename StlOp::first_argument_type > ExpLhs;
+ typedef const Expr<typename StlOp::second_argument_type> ExpRhs;
- BinaryExp(const SourceExp& lhs, const SourceExp& rhs, StlOp biop) : lhs_(lhs), rhs_(rhs), biop_(biop) {}
+ BinaryExp(const ExpLhs& lhs, const ExpRhs& rhs, StlOp biop) : lhs_(lhs), rhs_(rhs), biop_(biop) {}
virtual typename StlOp::result_type eval() const { return biop_(lhs_.eval(), rhs_.eval()); }
- const SourceExp& lhs_;
- const SourceExp& rhs_;
+ const ExpLhs& lhs_;
+ const ExpRhs& rhs_;
StlOp biop_;
};
-template <class StlOp>
-inline
+template <class StlOp> inline
BinaryExp<StlOp> makeBiExp(const Expression& lhs, const Expression& rhs, StlOp biop) //throw std::bad_cast
{
- return BinaryExp<StlOp>(dynamic_cast<const Expr<typename StlOp::first_argument_type >&>(lhs),
- dynamic_cast<const Expr<typename StlOp::second_argument_type>&>(rhs), biop);
+ return BinaryExp<StlOp>(dynamic_cast<const Expr<typename StlOp::first_argument_type >&>(lhs), //throw std::bad_cast
+ dynamic_cast<const Expr<typename StlOp::second_argument_type>&>(rhs), biop); //
}
-template <class Out>
-struct TernaryExp : public Out
+template <class T>
+struct TernaryExp : public Expr<T>
{
- TernaryExp(const Expr<bool>& ifExp, const Out& thenExp, const Out& elseExp) : ifExp_(ifExp), thenExp_(thenExp), elseExp_(elseExp) {}
- virtual typename Out::ValueType eval() const { return ifExp_.eval() ? thenExp_.eval() : elseExp_.eval(); }
+ TernaryExp(const Expr<bool>& ifExp, const Expr<T>& thenExp, const Expr<T>& elseExp) : ifExp_(ifExp), thenExp_(thenExp), elseExp_(elseExp) {}
+ virtual typename Expr<T>::ValueType eval() const { return ifExp_.eval() ? thenExp_.eval() : elseExp_.eval(); }
const Expr<bool>& ifExp_;
- const Out& thenExp_;
- const Out& elseExp_;
+ const Expr<T>& thenExp_;
+ const Expr<T>& elseExp_;
};
-struct LiteralNumberEx : public Expr<int>
+struct ConstNumberExp : public Expr<int>
{
- LiteralNumberEx(int n) : n_(n) {}
+ ConstNumberExp(int n) : n_(n) {}
virtual int eval() const { return n_; }
int n_;
};
-struct NumberN : public Expr<int>
+struct VariableNumberNExp : public Expr<int>
{
- NumberN(int& n) : n_(n) {}
+ VariableNumberNExp(int& n) : n_(n) {}
virtual int eval() const { return n_; }
int& n_;
};
-typedef zen::Zbase<char> Wstring;
-
-
class PluralForm
{
public:
struct ParsingError {};
//.po format,e.g.: (n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)
- PluralForm(const Wstring& phrase) : n_(0)
+ PluralForm(const std::string& phrase) : n_(0)
{
Parser(phrase, //in
expr, n_, dump); //out
@@ -148,8 +144,8 @@ private:
TK_GREATER,
TK_GREATER_EQUAL,
TK_MODULUS,
- TK_N,
- TK_NUMBER,
+ TK_VARIABLE_N,
+ TK_CONST_NUMBER,
TK_BRACKET_LEFT,
TK_BRACKET_RIGHT,
TK_END
@@ -158,13 +154,13 @@ private:
Token(Type t) : type(t), number(0) {}
Type type;
- int number; //if type == TK_NUMBER
+ int number; //if type == TK_CONST_NUMBER
};
class Scanner
{
public:
- Scanner(const Wstring& phrase) : stream(phrase), pos(stream.begin())
+ Scanner(const std::string& phrase) : stream(phrase), pos(stream.begin())
{
tokens.push_back(std::make_pair("?" , Token::TK_TERNARY_QUEST));
tokens.push_back(std::make_pair(":" , Token::TK_TERNARY_COLON));
@@ -177,8 +173,8 @@ private:
tokens.push_back(std::make_pair(">=", Token::TK_GREATER_EQUAL));
tokens.push_back(std::make_pair(">" , Token::TK_GREATER ));
tokens.push_back(std::make_pair("%" , Token::TK_MODULUS ));
- tokens.push_back(std::make_pair("n" , Token::TK_N ));
- tokens.push_back(std::make_pair("N" , Token::TK_N ));
+ tokens.push_back(std::make_pair("n" , Token::TK_VARIABLE_N ));
+ tokens.push_back(std::make_pair("N" , Token::TK_VARIABLE_N ));
tokens.push_back(std::make_pair("(" , Token::TK_BRACKET_LEFT ));
tokens.push_back(std::make_pair(")" , Token::TK_BRACKET_RIGHT));
}
@@ -188,21 +184,22 @@ private:
//skip whitespace
pos = std::find_if(pos, stream.end(), [](char c) { return !zen::isWhiteSpace(c); });
- if (pos == stream.end()) return Token(Token::TK_END);
+ if (pos == stream.end())
+ return Token::TK_END;
- for (TokenList::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
- if (startsWith(i->first))
+ for (auto iter = tokens.begin(); iter != tokens.end(); ++iter)
+ if (startsWith(iter->first))
{
- pos += i->first.size();
- return Token(i->second);
+ pos += iter->first.size();
+ return Token(iter->second);
}
- Wstring::const_iterator digitEnd = std::find_if(pos, stream.end(), [](char c) { return !zen::isDigit(c); });
- int digitCount = digitEnd - pos;
+ auto digitEnd = std::find_if(pos, stream.end(), [](char c) { return !zen::isDigit(c); });
+ ptrdiff_t digitCount = digitEnd - pos;
if (digitCount != 0)
{
- Token out(Token::TK_NUMBER);
- out.number = zen::stringTo<int>(Wstring(&*pos, digitCount));
+ Token out(Token::TK_CONST_NUMBER);
+ out.number = zen::stringTo<int>(std::string(&*pos, digitCount));
pos += digitCount;
return out;
}
@@ -211,25 +208,25 @@ private:
}
private:
- bool startsWith(const Wstring& prefix) const
+ bool startsWith(const std::string& prefix) const
{
if (stream.end() - pos < static_cast<ptrdiff_t>(prefix.size()))
return false;
return std::equal(prefix.begin(), prefix.end(), pos);
}
- typedef std::vector<std::pair<Wstring, Token::Type> > TokenList;
+ typedef std::vector<std::pair<std::string, Token::Type> > TokenList;
TokenList tokens;
- const Wstring stream;
- Wstring::const_iterator pos;
+ const std::string stream;
+ std::string::const_iterator pos;
};
class Parser
{
public:
- Parser(const Wstring& phrase, //in
+ Parser(const std::string& phrase, //in
const Expr<int>*& expr, int& n, PluralForm::DumpList& dump) : //out
scn(phrase),
tk(scn.nextToken()),
@@ -238,8 +235,8 @@ private:
{
try
{
- const Expression& e = parse();
- expr = &dynamic_cast<const Expr<int>&>(e);
+ const Expression& e = parse(); //throw std::bad_cast, ParsingError
+ expr = &dynamic_cast<const Expr<int>&>(e); //
}
catch (std::bad_cast&) { throw ParsingError(); }
@@ -250,14 +247,14 @@ private:
void nextToken() { tk = scn.nextToken(); }
const Token& token() const { return tk; }
- void consumeToken(Token::Type t)
+ void consumeToken(Token::Type t) //throw ParsingError
{
if (token().type != t)
throw ParsingError();
nextToken();
}
- const Expression& parse() { return parseConditional(); };
+ const Expression& parse() { return parseConditional(); }; //throw std::bad_cast, ParsingError
const Expression& parseConditional()
{
@@ -270,9 +267,9 @@ private:
consumeToken(Token::TK_TERNARY_COLON);
const Expression& elseEx = parse(); //
- return manageObj(TernaryExp<Expr<int> >(dynamic_cast<const Expr<bool>&>(e),
- dynamic_cast<const Expr<int>&>(thenEx),
- dynamic_cast<const Expr<int>&>(elseEx)));
+ return manageObj(TernaryExp<int>(dynamic_cast<const Expr<bool>&>(e), //
+ dynamic_cast<const Expr<int>&>(thenEx), //throw std::bad_cast
+ dynamic_cast<const Expr<int>&>(elseEx))); //
}
return e;
}
@@ -280,29 +277,25 @@ private:
const Expression& parseLogicalOr()
{
const Expression* e = &parseLogicalAnd();
- for (;;) //associativity: ->
- if (token().type == Token::TK_OR)
- {
- nextToken();
- const Expression& rhs = parseLogicalAnd();
- e = &manageObj(makeBiExp(*e, rhs, std::logical_or<bool>()));
- }
- else break;
+ while (token().type == Token::TK_OR) //associativity: ->
+ {
+ nextToken();
+ const Expression& rhs = parseLogicalAnd();
+ e = &manageObj(makeBiExp(*e, rhs, std::logical_or<bool>())); //throw std::bad_cast
+ }
return *e;
}
const Expression& parseLogicalAnd()
{
const Expression* e = &parseEquality();
- for (;;) //associativity: ->
- if (token().type == Token::TK_AND)
- {
- nextToken();
- const Expression& rhs = parseEquality();
+ while (token().type == Token::TK_AND) //associativity: ->
+ {
+ nextToken();
+ const Expression& rhs = parseEquality();
- e = &manageObj(makeBiExp(*e, rhs, std::logical_and<bool>()));
- }
- else break;
+ e = &manageObj(makeBiExp(*e, rhs, std::logical_and<bool>())); //throw std::bad_cast
+ }
return *e;
}
@@ -316,8 +309,8 @@ private:
nextToken();
const Expression& rhs = parseRelational();
- if (t == Token::TK_EQUAL) return manageObj(makeBiExp(e, rhs, std::equal_to <int>()));
- if (t == Token::TK_NOT_EQUAL) return manageObj(makeBiExp(e, rhs, std::not_equal_to<int>()));
+ if (t == Token::TK_EQUAL) return manageObj(makeBiExp(e, rhs, std::equal_to <int>())); //throw std::bad_cast
+ if (t == Token::TK_NOT_EQUAL) return manageObj(makeBiExp(e, rhs, std::not_equal_to<int>())); //
}
return e;
}
@@ -335,10 +328,10 @@ private:
nextToken();
const Expression& rhs = parseMultiplicative();
- if (t == Token::TK_LESS) return manageObj(makeBiExp(e, rhs, std::less <int>()));
- if (t == Token::TK_LESS_EQUAL) return manageObj(makeBiExp(e, rhs, std::less_equal <int>()));
- if (t == Token::TK_GREATER) return manageObj(makeBiExp(e, rhs, std::greater <int>()));
- if (t == Token::TK_GREATER_EQUAL) return manageObj(makeBiExp(e, rhs, std::greater_equal<int>()));
+ if (t == Token::TK_LESS) return manageObj(makeBiExp(e, rhs, std::less <int>())); //
+ if (t == Token::TK_LESS_EQUAL) return manageObj(makeBiExp(e, rhs, std::less_equal <int>())); //throw std::bad_cast
+ if (t == Token::TK_GREATER) return manageObj(makeBiExp(e, rhs, std::greater <int>())); //
+ if (t == Token::TK_GREATER_EQUAL) return manageObj(makeBiExp(e, rhs, std::greater_equal<int>())); //
}
return e;
}
@@ -347,35 +340,33 @@ private:
{
const Expression* e = &parsePrimary();
- for (;;) //associativity: ->
- if (token().type == Token::TK_MODULUS)
- {
- nextToken();
- const Expression& rhs = parsePrimary();
+ while (token().type == Token::TK_MODULUS) //associativity: ->
+ {
+ nextToken();
+ const Expression& rhs = parsePrimary();
- //"compile-time" check: n % 0
- const LiteralNumberEx* literal = dynamic_cast<const LiteralNumberEx*>(&rhs);
- if (literal && literal->eval() == 0)
+ //"compile-time" check: n % 0
+ if (auto literal = dynamic_cast<const ConstNumberExp*>(&rhs))
+ if (literal->eval() == 0)
throw ParsingError();
- e = &manageObj(makeBiExp(*e, rhs, std::modulus<int>()));
- }
- else break;
+ e = &manageObj(makeBiExp(*e, rhs, std::modulus<int>())); //throw std::bad_cast
+ }
return *e;
}
const Expression& parsePrimary()
{
- if (token().type == Token::TK_N)
+ if (token().type == Token::TK_VARIABLE_N)
{
nextToken();
- return manageObj(NumberN(n_));
+ return manageObj(VariableNumberNExp(n_));
}
- else if (token().type == Token::TK_NUMBER)
+ else if (token().type == Token::TK_CONST_NUMBER)
{
const int number = token().number;
nextToken();
- return manageObj(LiteralNumberEx(number));
+ return manageObj(ConstNumberExp(number));
}
else if (token().type == Token::TK_BRACKET_LEFT)
{
diff --git a/lib/perf_check.cpp b/lib/perf_check.cpp
index f8d80191..878b41a2 100644
--- a/lib/perf_check.cpp
+++ b/lib/perf_check.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "perf_check.h"
@@ -10,7 +10,7 @@
//#include <wx/ffile.h>
#include <zen/basic_math.h>
#include <zen/i18n.h>
-#include <wx+/format_unit.h>
+#include <zen/format_unit.h>
using namespace zen;
diff --git a/lib/perf_check.h b/lib/perf_check.h
index d16c35f9..b8014582 100644
--- a/lib/perf_check.h
+++ b/lib/perf_check.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef STATISTICS_H_INCLUDED
diff --git a/lib/process_xml.cpp b/lib/process_xml.cpp
index 0b53a0f5..57ba69e6 100644
--- a/lib/process_xml.cpp
+++ b/lib/process_xml.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "process_xml.h"
@@ -81,15 +81,15 @@ wxString xmlAccess::getGlobalConfigFile()
void xmlAccess::OptionalDialogs::resetDialogs()
{
- warningDependentFolders = true;
- warningMultiFolderWriteAccess = true;
- warningSignificantDifference = true;
- warningNotEnoughDiskSpace = true;
- warningUnresolvedConflicts = true;
- warningSyncDatabase = true;
- warningRecyclerMissing = true;
- popupOnConfigChange = true;
- showSummaryBeforeSync = true;
+ warningDependentFolders = true;
+ warningFolderPairRaceCondition = true;
+ warningSignificantDifference = true;
+ warningNotEnoughDiskSpace = true;
+ warningUnresolvedConflicts = true;
+ warningDatabaseError = true;
+ warningRecyclerMissing = true;
+ popupOnConfigChange = true;
+ confirmSyncStart = true;
}
@@ -132,7 +132,7 @@ xmlAccess::XmlBatchConfig xmlAccess::convertGuiToBatch(const xmlAccess::XmlGuiCo
{
std::vector<Zstring> filenames;
filenames.push_back(referenceFile);
- convertConfig(filenames, output); //throw xmlAccess::FfsXmlError
+ mergeConfigs(filenames, output); //throw xmlAccess::FfsXmlError
}
catch (xmlAccess::FfsXmlError&) {}
@@ -242,13 +242,13 @@ void mergeConfigFilesImpl(const std::vector<Zstring>& filenames, XmlCfg& config)
}
-void xmlAccess::convertConfig(const std::vector<Zstring>& filenames, XmlGuiConfig& config) //throw FfsXmlError
+void xmlAccess::mergeConfigs(const std::vector<Zstring>& filenames, XmlGuiConfig& config) //throw FfsXmlError
{
mergeConfigFilesImpl(filenames, config); //throw FfsXmlError
}
-void xmlAccess::convertConfig(const std::vector<Zstring>& filenames, XmlBatchConfig& config) //throw FfsXmlError
+void xmlAccess::mergeConfigs(const std::vector<Zstring>& filenames, XmlBatchConfig& config) //throw FfsXmlError
{
mergeConfigFilesImpl(filenames, config); //throw FfsXmlError
}
@@ -778,7 +778,7 @@ void readConfig(const XmlIn& in, SyncConfig& syncCfg)
if (in["CustomDeletionFolder"])
{
in["CustomDeletionFolder"](syncCfg.versioningDirectory);//obsolete name
- syncCfg.versionCountLimit = 0; //new parameter
+ syncCfg.versionCountLimit = -1; //new parameter
}
else
{
@@ -943,16 +943,31 @@ void readConfig(const XmlIn& in, XmlGlobalSettings& config)
//max. allowed file time deviation
inShared["FileTimeTolerance"](config.fileTimeTolerance);
- XmlIn inOpt = inShared["ShowOptionalDialogs"];
- inOpt["CheckForDependentFolders" ](config.optDialogs.warningDependentFolders);
- inOpt["CheckForMultipleWriteAccess" ](config.optDialogs.warningMultiFolderWriteAccess);
- inOpt["CheckForSignificantDifference"](config.optDialogs.warningSignificantDifference);
- inOpt["CheckForFreeDiskSpace"](config.optDialogs.warningNotEnoughDiskSpace);
- inOpt["CheckForUnresolvedConflicts"](config.optDialogs.warningUnresolvedConflicts);
- inOpt["NotifyDatabaseError"](config.optDialogs.warningSyncDatabase);
- inOpt["CheckMissingRecycleBin"](config.optDialogs.warningRecyclerMissing);
- inOpt["PopupOnConfigChange"](config.optDialogs.popupOnConfigChange);
- inOpt["SummaryBeforeSync" ](config.optDialogs.showSummaryBeforeSync);
+ XmlIn inOpt = inShared["OptionalDialogs"];
+ inOpt["WarnUnresolvedConflicts" ](config.optDialogs.warningUnresolvedConflicts);
+ inOpt["WarnNotEnoughDiskSpace" ](config.optDialogs.warningNotEnoughDiskSpace);
+ inOpt["WarnSignificantDifference" ](config.optDialogs.warningSignificantDifference);
+ inOpt["WarnRecycleBinNotAvailable" ](config.optDialogs.warningRecyclerMissing);
+ inOpt["WarnDatabaseError" ](config.optDialogs.warningDatabaseError);
+ inOpt["WarnDependentFolders" ](config.optDialogs.warningDependentFolders);
+ inOpt["WarnFolderPairRaceCondition"](config.optDialogs.warningFolderPairRaceCondition);
+ inOpt["PromptSaveConfig" ](config.optDialogs.popupOnConfigChange);
+ inOpt["ConfirmSyncStart" ](config.optDialogs.confirmSyncStart);
+
+ warn_static("remove after migration?")
+ if (!inOpt)
+ {
+ inOpt = inShared["ShowOptionalDialogs"];
+ inOpt["CheckForDependentFolders" ](config.optDialogs.warningDependentFolders);
+ inOpt["CheckForMultipleWriteAccess" ](config.optDialogs.warningFolderPairRaceCondition);
+ inOpt["CheckForSignificantDifference"](config.optDialogs.warningSignificantDifference);
+ inOpt["CheckForFreeDiskSpace"](config.optDialogs.warningNotEnoughDiskSpace);
+ inOpt["CheckForUnresolvedConflicts"](config.optDialogs.warningUnresolvedConflicts);
+ inOpt["NotifyDatabaseError" ](config.optDialogs.warningDatabaseError);
+ inOpt["CheckMissingRecycleBin"](config.optDialogs.warningRecyclerMissing);
+ inOpt["PopupOnConfigChange" ](config.optDialogs.popupOnConfigChange);
+ inOpt["SummaryBeforeSync" ](config.optDialogs.confirmSyncStart);
+ }
//gui specific global settings (optional)
XmlIn inGui = in["Gui"];
@@ -1233,16 +1248,16 @@ void writeConfig(const XmlGlobalSettings& config, XmlOut& out)
//max. allowed file time deviation
outShared["FileTimeTolerance"](config.fileTimeTolerance);
- XmlOut outOpt = outShared["ShowOptionalDialogs"];
- outOpt["CheckForDependentFolders" ](config.optDialogs.warningDependentFolders);
- outOpt["CheckForMultipleWriteAccess" ](config.optDialogs.warningMultiFolderWriteAccess);
- outOpt["CheckForSignificantDifference"](config.optDialogs.warningSignificantDifference);
- outOpt["CheckForFreeDiskSpace" ](config.optDialogs.warningNotEnoughDiskSpace);
- outOpt["CheckForUnresolvedConflicts" ](config.optDialogs.warningUnresolvedConflicts);
- outOpt["NotifyDatabaseError" ](config.optDialogs.warningSyncDatabase);
- outOpt["CheckMissingRecycleBin" ](config.optDialogs.warningRecyclerMissing);
- outOpt["PopupOnConfigChange" ](config.optDialogs.popupOnConfigChange);
- outOpt["SummaryBeforeSync" ](config.optDialogs.showSummaryBeforeSync);
+ XmlOut outOpt = outShared["OptionalDialogs"];
+ outOpt["WarnUnresolvedConflicts" ](config.optDialogs.warningUnresolvedConflicts);
+ outOpt["WarnNotEnoughDiskSpace" ](config.optDialogs.warningNotEnoughDiskSpace);
+ outOpt["WarnSignificantDifference" ](config.optDialogs.warningSignificantDifference);
+ outOpt["WarnRecycleBinNotAvailable" ](config.optDialogs.warningRecyclerMissing);
+ outOpt["WarnDatabaseError" ](config.optDialogs.warningDatabaseError);
+ outOpt["WarnDependentFolders" ](config.optDialogs.warningDependentFolders);
+ outOpt["WarnFolderPairRaceCondition"](config.optDialogs.warningFolderPairRaceCondition);
+ outOpt["PromptSaveConfig" ](config.optDialogs.popupOnConfigChange);
+ outOpt["ConfirmSyncStart" ](config.optDialogs.confirmSyncStart);
//gui specific global settings (optional)
XmlOut outGui = out["Gui"];
diff --git a/lib/process_xml.h b/lib/process_xml.h
index 7191e0c2..ec1a142f 100644
--- a/lib/process_xml.h
+++ b/lib/process_xml.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef PROCESSXML_H_INCLUDED
@@ -91,14 +91,14 @@ struct OptionalDialogs
void resetDialogs();
bool warningDependentFolders;
- bool warningMultiFolderWriteAccess;
+ bool warningFolderPairRaceCondition;
bool warningSignificantDifference;
bool warningNotEnoughDiskSpace;
bool warningUnresolvedConflicts;
- bool warningSyncDatabase;
+ bool warningDatabaseError;
bool warningRecyclerMissing;
bool popupOnConfigChange;
- bool showSummaryBeforeSync;
+ bool confirmSyncStart;
};
@@ -154,7 +154,7 @@ struct XmlGlobalSettings
naviLastSortColumn(zen::defaultValueLastSortColumn),
naviLastSortAscending(zen::defaultValueLastSortAscending),
showPercentBar(zen::defaultValueShowPercentage),
- cfgFileHistMax(20),
+ cfgFileHistMax(30),
folderHistMax(15),
onCompletionHistoryMax(8),
deleteOnBothSides(false),
@@ -228,13 +228,13 @@ struct XmlGlobalSettings
//struct Batch
};
-void readConfig(const Zstring& filename, XmlGuiConfig& config); //throw FfsXmlError
+void readConfig(const Zstring& filename, XmlGuiConfig& config); //
void readConfig(const Zstring& filename, XmlBatchConfig& config); //throw FfsXmlError
-void readConfig( XmlGlobalSettings& config); //throw FfsXmlError
+void readConfig( XmlGlobalSettings& config); //
-void writeConfig(const XmlGuiConfig& config, const Zstring& filename); //throw FfsXmlError
+void writeConfig(const XmlGuiConfig& config, const Zstring& filename); //
void writeConfig(const XmlBatchConfig& config, const Zstring& filename); //throw FfsXmlError
-void writeConfig(const XmlGlobalSettings& config); //throw FfsXmlError
+void writeConfig(const XmlGlobalSettings& config); //
//config conversion utilities
XmlGuiConfig convertBatchToGui(const XmlBatchConfig& batchCfg);
@@ -251,8 +251,8 @@ enum MergeType
};
MergeType getMergeType(const std::vector<Zstring>& filenames); //throw ()
-void convertConfig(const std::vector<Zstring>& filenames, XmlGuiConfig& config); //throw xmlAccess::FfsXmlError
-void convertConfig(const std::vector<Zstring>& filenames, XmlBatchConfig& config); //throw xmlAccess::FfsXmlError
+void mergeConfigs(const std::vector<Zstring>& filenames, XmlGuiConfig& config); //throw xmlAccess::FfsXmlError
+void mergeConfigs(const std::vector<Zstring>& filenames, XmlBatchConfig& config); //throw xmlAccess::FfsXmlError
std::wstring extractJobName(const Zstring& configFilename);
}
diff --git a/lib/resolve_path.cpp b/lib/resolve_path.cpp
index 425a640b..11733136 100644
--- a/lib/resolve_path.cpp
+++ b/lib/resolve_path.cpp
@@ -86,7 +86,7 @@ private:
{
auto addCsidl = [&](int csidl, const Zstring& paramName)
{
- wchar_t buffer[MAX_PATH];
+ wchar_t buffer[MAX_PATH] = {};
if (SUCCEEDED(::SHGetFolderPath(nullptr, //__in HWND hwndOwner,
csidl | CSIDL_FLAG_DONT_VERIFY, //__in int nFolder,
nullptr, //__in HANDLE hToken,
@@ -99,37 +99,55 @@ private:
}
};
- addCsidl(CSIDL_DESKTOPDIRECTORY, L"csidl_Desktop"); // C:\Users\username\Desktop
+ addCsidl(CSIDL_DESKTOPDIRECTORY, L"csidl_Desktop"); // C:\Users\<user>\Desktop
addCsidl(CSIDL_COMMON_DESKTOPDIRECTORY, L"csidl_PublicDesktop"); // C:\Users\All Users\Desktop
- addCsidl(CSIDL_MYMUSIC, L"csidl_MyMusic"); // C:\Users\username\My Documents\My Music
- addCsidl(CSIDL_COMMON_MUSIC, L"csidl_PublicMusic"); // C:\Users\All Users\Documents\My Music
+ addCsidl(CSIDL_FAVORITES, L"csidl_Favorites"); // C:\Users\<user>\Favorites
+ addCsidl(CSIDL_COMMON_FAVORITES, L"csidl_PublicFavorites"); // C:\Users\<user>\Favorites; unused? -> http://blogs.msdn.com/b/oldnewthing/archive/2012/09/04/10346022.aspx
- addCsidl(CSIDL_MYPICTURES, L"csidl_MyPictures"); // C:\Users\username\My Documents\My Pictures
- addCsidl(CSIDL_COMMON_PICTURES, L"csidl_PublicPictures"); // C:\Users\All Users\Documents\My Pictures
+ addCsidl(CSIDL_PERSONAL, L"csidl_MyDocuments"); // C:\Users\<user>\Documents
+ addCsidl(CSIDL_COMMON_DOCUMENTS, L"csidl_PublicDocuments"); // C:\Users\Public\Documents
- addCsidl(CSIDL_MYVIDEO, L"csidl_MyVideo"); // C:\Users\username\My Documents\My Videos
- addCsidl(CSIDL_COMMON_VIDEO, L"csidl_PublicVideo"); // C:\Users\All Users\Documents\My Videos
+ addCsidl(CSIDL_MYMUSIC, L"csidl_MyMusic"); // C:\Users\<user>\Music
+ addCsidl(CSIDL_COMMON_MUSIC, L"csidl_PublicMusic"); // C:\Users\Public\Music
- addCsidl(CSIDL_PERSONAL, L"csidl_MyDocuments"); // C:\Users\username\My Documents
- addCsidl(CSIDL_COMMON_DOCUMENTS, L"csidl_PublicDocuments"); // C:\Users\All Users\Documents
+ addCsidl(CSIDL_MYPICTURES, L"csidl_MyPictures"); // C:\Users\<user>\Pictures
+ addCsidl(CSIDL_COMMON_PICTURES, L"csidl_PublicPictures"); // C:\Users\Public\Pictures
- addCsidl(CSIDL_STARTMENU, L"csidl_StartMenu"); // C:\Users\username\Start Menu
- addCsidl(CSIDL_COMMON_STARTMENU, L"csidl_PublicStartMenu"); // C:\Users\All Users\Start Menu
+ addCsidl(CSIDL_MYVIDEO, L"csidl_MyVideos"); // C:\Users\<user>\Videos
+ addCsidl(CSIDL_COMMON_VIDEO, L"csidl_PublicVideos"); // C:\Users\Public\Videos
- addCsidl(CSIDL_FAVORITES, L"csidl_Favorites"); // C:\Users\username\Favorites
- addCsidl(CSIDL_COMMON_FAVORITES, L"csidl_PublicFavorites"); // C:\Users\All Users\Favoriten
+ addCsidl(CSIDL_NETHOOD, L"csidl_Nethood"); // C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Network Shortcuts
- addCsidl(CSIDL_TEMPLATES, L"csidl_Templates"); // C:\Users\username\Templates
- addCsidl(CSIDL_COMMON_TEMPLATES, L"csidl_PublicTemplates"); // C:\Users\All Users\Templates
+ addCsidl(CSIDL_PROGRAMS, L"csidl_Programs"); // C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
+ addCsidl(CSIDL_COMMON_PROGRAMS, L"csidl_PublicPrograms"); // C:\ProgramData\Microsoft\Windows\Start Menu\Programs
addCsidl(CSIDL_RESOURCES, L"csidl_Resources"); // C:\Windows\Resources
- //CSIDL_APPDATA covered by %AppData%
- //CSIDL_LOCAL_APPDATA covered by %LocalAppData%
- //CSIDL_COMMON_APPDATA covered by %ProgramData%
-
- //CSIDL_PROFILE covered by %UserProfile%
+ addCsidl(CSIDL_STARTMENU, L"csidl_StartMenu"); // C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu
+ addCsidl(CSIDL_COMMON_STARTMENU, L"csidl_PublicStartMenu"); // C:\ProgramData\Microsoft\Windows\Start Menu
+
+ addCsidl(CSIDL_STARTUP, L"csidl_Startup"); // C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp
+ addCsidl(CSIDL_COMMON_STARTUP, L"csidl_PublicStartup"); // C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
+
+ addCsidl(CSIDL_TEMPLATES, L"csidl_Templates"); // C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Templates
+ addCsidl(CSIDL_COMMON_TEMPLATES, L"csidl_PublicTemplates"); // C:\ProgramData\Microsoft\Windows\Templates
+
+ /*
+ CSIDL_APPDATA covered by %AppData%
+ CSIDL_LOCAL_APPDATA covered by %LocalAppData% -> not on XP!
+ CSIDL_COMMON_APPDATA covered by %ProgramData% -> not on XP!
+ CSIDL_PROFILE covered by %UserProfile%
+ CSIDL_WINDOWS covered by %WinDir%
+ CSIDL_SYSTEM covered by %WinDir%
+ CSIDL_SYSTEMX86 covered by %WinDir%
+ CSIDL_PROGRAM_FILES covered by %ProgramFiles%
+ CSIDL_PROGRAM_FILES_COMMON covered by %CommonProgramFiles%
+ CSIDL_PROGRAM_FILESX86 covered by %ProgramFiles(x86)% -> not on XP!
+ CSIDL_PROGRAM_FILES_COMMONX86 covered by %CommonProgramFiles(x86)% -> not on XP!
+ CSIDL_ADMINTOOLS not relevant?
+ CSIDL_COMMON_ADMINTOOLS not relevant?
+ */
}
CsidlConstants(const CsidlConstants&);
@@ -193,12 +211,12 @@ std::unique_ptr<Zstring> resolveMacro(const Zstring& macro, //macro without %-ch
if (processPhrase(Zstr("min" ), Zstr("%M"))) return cand;
if (processPhrase(Zstr("sec" ), Zstr("%S"))) return cand;
- //check domain-specific extensions
- {
- auto iter = std::find_if(ext.begin(), ext.end(), [&](const std::pair<Zstring, Zstring>& p){ return equalNoCase(macro, p.first); });
+ //check domain-specific extensions
+ {
+ auto iter = std::find_if(ext.begin(), ext.end(), [&](const std::pair<Zstring, Zstring>& p) { return equalNoCase(macro, p.first); });
if (iter != ext.end())
return make_unique<Zstring>(iter->second);
- }
+ }
//try to resolve as environment variable
if (std::unique_ptr<Zstring> value = getEnvironmentVar(macro))
@@ -446,6 +464,8 @@ void getDirectoryAliasesRecursive(const Zstring& dirname, std::set<Zstring, Less
addEnvVar(L"ProgramData"); // C:\ProgramData
addEnvVar(L"ProgramFiles"); // C:\Program Files
addEnvVar(L"ProgramFiles(x86)");// C:\Program Files (x86)
+ addEnvVar(L"CommonProgramFiles"); // C:\Program Files\Common Files
+ addEnvVar(L"CommonProgramFiles(x86)"); // C:\Program Files (x86)\Common Files
addEnvVar(L"Public"); // C:\Users\Public
addEnvVar(L"UserProfile"); // C:\Users\username
addEnvVar(L"WinDir"); // C:\Windows
diff --git a/lib/resolve_path.h b/lib/resolve_path.h
index ccc8f42e..0132b51f 100644
--- a/lib/resolve_path.h
+++ b/lib/resolve_path.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef RESOLVE_PATH_H_INCLUDED
diff --git a/lib/resources.cpp b/lib/resources.cpp
index ac20066a..6d586e54 100644
--- a/lib/resources.cpp
+++ b/lib/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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "resources.h"
@@ -65,10 +65,10 @@ GlobalResources::GlobalResources()
//generic image loading
if (name.EndsWith(L".png"))
bitmaps.insert(std::make_pair(name, wxImage(resourceFile, wxBITMAP_TYPE_PNG)));
- //else if (name == L"money.gif")
- // loadAnimFromZip(resourceFile, animationMoney);
+ else if (name == L"wink.gif")
+ loadAnimFromZip(resourceFile, aniWink);
else if (name == L"working.gif")
- loadAnimFromZip(resourceFile, animationSync);
+ loadAnimFromZip(resourceFile, aniSync);
}
}
diff --git a/lib/resources.h b/lib/resources.h
index df13340d..9081ff4e 100644
--- a/lib/resources.h
+++ b/lib/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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef RESOURCES_H_INCLUDED
@@ -21,8 +21,8 @@ public:
static const wxBitmap& getImage(const wxString& name) { return instance().getImageInt(name); }
//global image resource objects
- //wxAnimation animationMoney;
- wxAnimation animationSync;
+ wxAnimation aniWink;
+ wxAnimation aniSync;
wxIcon programIcon;
private:
diff --git a/lib/return_codes.h b/lib/return_codes.h
index 34ae0527..0bd98a41 100644
--- a/lib/return_codes.h
+++ b/lib/return_codes.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef RETURN_CODES_H_INCLUDED
@@ -16,6 +16,15 @@ enum FfsReturnCode
FFS_RC_ABORTED,
FFS_RC_EXCEPTION,
};
+
+
+inline
+void raiseReturnCode(FfsReturnCode& rc, FfsReturnCode rcProposed)
+{
+ if (rc < rcProposed)
+ rc = rcProposed;
+}
+
}
diff --git a/lib/shadow.cpp b/lib/shadow.cpp
index 5a5b9cef..5f2225e7 100644
--- a/lib/shadow.cpp
+++ b/lib/shadow.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "shadow.h"
diff --git a/lib/shadow.h b/lib/shadow.h
index bb834a41..cbe40dbb 100644
--- a/lib/shadow.h
+++ b/lib/shadow.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef SHADOW_H_INCLUDED
diff --git a/lib/soft_filter.h b/lib/soft_filter.h
index b9fb2fd4..32e7888d 100644
--- a/lib/soft_filter.h
+++ b/lib/soft_filter.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef SOFT_FILTER_H_INCLUDED
@@ -10,7 +10,7 @@
#include <algorithm>
#include <limits>
#include "../structures.h"
-#include <wx/stopwatch.h>
+//#include <wx/stopwatch.h>
namespace zen
{
@@ -30,9 +30,7 @@ public:
bool matchTime(Int64 writeTime) const { return timeFrom_ <= writeTime; }
bool matchSize(UInt64 fileSize) const { return sizeMin_ <= fileSize && fileSize <= sizeMax_; }
- bool matchFolder() const { return timeFrom_ == std::numeric_limits<Int64>::min(); }
- //if date filter is active we deactivate all folders: effectively gets rid of empty folders!
-
+ bool matchFolder() const { return matchesFolder_; }
bool isNull() const; //filter is equivalent to NullFilter, but may be technically slower
//small helper method: merge two soft filters
@@ -41,11 +39,13 @@ public:
private:
SoftFilter(const Int64& timeFrom,
const UInt64& sizeMin,
- const UInt64& sizeMax);
+ const UInt64& sizeMax,
+ bool matchesFolder);
Int64 timeFrom_; //unit: UTC, seconds
UInt64 sizeMin_; //unit: bytes
UInt64 sizeMax_; //unit: bytes
+ bool matchesFolder_;
};
}
@@ -75,7 +75,10 @@ namespace zen
inline
SoftFilter::SoftFilter(size_t timeSpan, UnitTime unitTimeSpan,
size_t sizeMin, UnitSize unitSizeMin,
- size_t sizeMax, UnitSize unitSizeMax)
+ size_t sizeMax, UnitSize unitSizeMax) :
+ matchesFolder_(unitTimeSpan == UTIME_NONE &&
+ unitSizeMin == USIZE_NONE &&
+ unitSizeMax == USIZE_NONE) //exclude folders if size or date filter is active: avoids creating empty folders if not needed!
{
resolveUnits(timeSpan, unitTimeSpan,
sizeMin, unitSizeMin,
@@ -88,17 +91,20 @@ SoftFilter::SoftFilter(size_t timeSpan, UnitTime unitTimeSpan,
inline
SoftFilter::SoftFilter(const Int64& timeFrom,
const UInt64& sizeMin,
- const UInt64& sizeMax) :
+ const UInt64& sizeMax,
+ bool matchesFolder) :
timeFrom_(timeFrom),
sizeMin_ (sizeMin),
- sizeMax_ (sizeMax) {}
+ sizeMax_ (sizeMax),
+ matchesFolder_(matchesFolder) {}
inline
-SoftFilter combineFilters(const SoftFilter& first, const SoftFilter& second)
+SoftFilter combineFilters(const SoftFilter& lhs, const SoftFilter& rhs)
{
- return SoftFilter(std::max(first.timeFrom_, second.timeFrom_),
- std::max(first.sizeMin_, second.sizeMin_),
- std::min(first.sizeMax_, second.sizeMax_));
+ return SoftFilter(std::max(lhs.timeFrom_, rhs.timeFrom_),
+ std::max(lhs.sizeMin_, rhs.sizeMin_),
+ std::min(lhs.sizeMax_, rhs.sizeMax_),
+ lhs.matchesFolder_ && rhs.matchesFolder_);
}
inline
@@ -106,7 +112,8 @@ bool SoftFilter::isNull() const //filter is equivalent to NullFilter, but may be
{
return timeFrom_ == std::numeric_limits<Int64>::min() &&
sizeMin_ == 0U &&
- sizeMax_ == std::numeric_limits<UInt64>::max();
+ sizeMax_ == std::numeric_limits<UInt64>::max() &&
+ matchesFolder_ == true;;
}
}
diff --git a/lib/status_handler.cpp b/lib/status_handler.cpp
index a7286c39..3188ba0d 100644
--- a/lib/status_handler.cpp
+++ b/lib/status_handler.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "status_handler.h"
diff --git a/lib/status_handler.h b/lib/status_handler.h
index 129d5ae9..789293e4 100644
--- a/lib/status_handler.h
+++ b/lib/status_handler.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef STATUSHANDLER_H_INCLUDED
diff --git a/lib/status_handler_impl.h b/lib/status_handler_impl.h
index 16466556..615288d2 100644
--- a/lib/status_handler_impl.h
+++ b/lib/status_handler_impl.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef STATUSHANDLER_IMPL_H_INCLUDED
diff --git a/lib/versioning.cpp b/lib/versioning.cpp
index a285bb70..b12d7307 100644
--- a/lib/versioning.cpp
+++ b/lib/versioning.cpp
@@ -230,7 +230,7 @@ void FileVersioner::revisionFile(const Zstring& sourceFile, const Zstring& relat
callback.objectProcessed();
});
- fileRelnames.push_back(relativeName);
+ fileRelNames.push_back(relativeName);
}
@@ -254,7 +254,7 @@ void FileVersioner::revisionDir(const Zstring& sourceDir, const Zstring& relativ
callback.objectProcessed();
});
- fileRelnames.push_back(relativeName);
+ fileRelNames.push_back(relativeName);
}
else
{
@@ -354,7 +354,7 @@ void FileVersioner::limitVersions(std::function<void()> updateUI) //throw FileEr
return newEntry;
};
- std::for_each(fileRelnames.begin(), fileRelnames.end(),
+ std::for_each(fileRelNames.begin(), fileRelNames.end(),
[&](const Zstring& relativeName) //e.g. "subdir\Sample.txt"
{
const Zstring fullname = appendSeparator(versioningDirectory_) + relativeName; //e.g. "D:\Revisions\subdir\Sample.txt"
diff --git a/lib/versioning.h b/lib/versioning.h
index 36721edb..b025511b 100644
--- a/lib/versioning.h
+++ b/lib/versioning.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef VERSIONING_HEADER_8760247652438056
@@ -53,7 +53,7 @@ private:
const Zstring timeStamp_;
const int versionCountLimit_;
- std::vector<Zstring> fileRelnames; //store list of revisioned files and symlinks (relativeName) for limitVersions()
+ std::vector<Zstring> fileRelNames; //store list of revisioned file and symlink relative names for limitVersions()
};
diff --git a/lib/xml_base.cpp b/lib/xml_base.cpp
index 9aa069c7..c7650bc0 100644
--- a/lib/xml_base.cpp
+++ b/lib/xml_base.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#include "xml_base.h"
diff --git a/lib/xml_base.h b/lib/xml_base.h
index 5c0ec3c3..338f91f7 100644
--- a/lib/xml_base.h
+++ b/lib/xml_base.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) ZenJu (zenju AT gmx DOT de) - All Rights Reserved *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
#ifndef XMLBASE_H_INCLUDED
bgstack15