diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:56:14 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:56:14 +0200 |
commit | 1046c195a9bbac24678c06310a4dd56b10347244 (patch) | |
tree | 89ad9f6fe3e538d65ef973b628ed9284b6c99e9f /library/processXml.h | |
parent | 1.14 (diff) | |
download | FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.tar.gz FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.tar.bz2 FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.zip |
1.15
Diffstat (limited to 'library/processXml.h')
-rw-r--r-- | library/processXml.h | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/library/processXml.h b/library/processXml.h index bc81556e..5f3f8ef9 100644 --- a/library/processXml.h +++ b/library/processXml.h @@ -25,7 +25,7 @@ namespace xmlAccess XmlGuiConfig() : hideFilteredElements(false) {} //initialize values MainConfiguration mainCfg; - vector<FolderPair> directoryPairs; + std::vector<FolderPair> directoryPairs; bool hideFilteredElements; }; @@ -36,31 +36,53 @@ namespace xmlAccess XmlBatchConfig() : silent(false) {} MainConfiguration mainCfg; - vector<FolderPair> directoryPairs; + std::vector<FolderPair> directoryPairs; bool silent; }; int retrieveSystemLanguage(); + struct XmlGlobalSettings { +//--------------------------------------------------------------------- +//internal structures: + enum ColumnTypes + { + FILENAME = 0, + REL_PATH, + SIZE, + DATE + }; + + struct ColumnAttrib + { + ColumnTypes type; + bool visible; + unsigned position; + int width; + }; + typedef std::vector<ColumnAttrib> ColumnAttributes; + +//--------------------------------------------------------------------- struct _Global { _Global() : programLanguage(retrieveSystemLanguage()), #ifdef FFS_WIN - dstCheckActive(true), + handleDstOnFat32(true), #endif folderDependCheckActive(true) {} int programLanguage; #ifdef FFS_WIN - bool dstCheckActive; + bool handleDstOnFat32; #endif bool folderDependCheckActive; } global; +//--------------------------------------------------------------------- struct _Gui { _Gui() : @@ -68,30 +90,63 @@ namespace xmlAccess heightNotMaximized(wxDefaultCoord), posXNotMaximized(wxDefaultCoord), posYNotMaximized(wxDefaultCoord), - isMaximized(false) {} + isMaximized(false), +#ifdef FFS_WIN + commandLineFileManager(wxT("explorer /select, %x")) +#elif defined FFS_LINUX + commandLineFileManager(wxT("konqueror \"%path\"")) +#endif + {} int widthNotMaximized; int heightNotMaximized; int posXNotMaximized; int posYNotMaximized; bool isMaximized; - vector<int> columnWidthLeft; - vector<int> columnWidthRight; - vector<int> columnPositionsLeft; - vector<int> columnPositionsRight; + + ColumnAttributes columnAttribLeft; + ColumnAttributes columnAttribRight; + std::vector<wxString> cfgFileHistory; + wxString commandLineFileManager; } gui; +//--------------------------------------------------------------------- //struct _Batch }; + inline + bool sortByType(const XmlGlobalSettings::ColumnAttrib& a, const XmlGlobalSettings::ColumnAttrib& b) + { + return a.type < b.type; + } + + + inline + bool sortByPositionOnly(const XmlGlobalSettings::ColumnAttrib& a, const XmlGlobalSettings::ColumnAttrib& b) + { + return a.position < b.position; + } + + + inline + bool sortByPositionAndVisibility(const XmlGlobalSettings::ColumnAttrib& a, const XmlGlobalSettings::ColumnAttrib& b) + { + if (a.visible == false) //hidden elements shall appear at end of vector + return false; + if (b.visible == false) + return true; + return a.position < b.position; + } + + XmlGuiConfig readGuiConfig(const wxString& filename); XmlBatchConfig readBatchConfig(const wxString& filename); XmlGlobalSettings readGlobalSettings(); //used for both GUI and batch mode, independent from configuration instance - void writeGuiConfig(const wxString& filename, const XmlGuiConfig& inputCfg); - void writeBatchConfig(const wxString& filename, const XmlBatchConfig& inputCfg); - void writeGlobalSettings(const XmlGlobalSettings& inputCfg); + void writeGuiConfig(const wxString& filename, const XmlGuiConfig& outputCfg); + void writeBatchConfig(const wxString& filename, const XmlBatchConfig& outputCfg); + void writeGlobalSettings(const XmlGlobalSettings& outputCfg); } |