Fisheye: Tag 9ea1e103b5fa4ddfebf8028f121ce16e917eec04 refers to a dead (removed) revision in file `src/ch/CfgProperties.cpp'. Fisheye: No comparison available. Pass `N' to diff? Index: src/ch/CfgProperties.h =================================================================== diff -u -r7d6b4eae7b58d17c4b554c25cc4cff875bd53161 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/CfgProperties.h (.../CfgProperties.h) (revision 7d6b4eae7b58d17c4b554c25cc4cff875bd53161) +++ src/ch/CfgProperties.h (.../CfgProperties.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -21,10 +21,10 @@ #pragma once -#include "../libicpf/cfg.h" +class TConfig; // properties definitions -enum CHProperties +enum ECHProperties { PP_PCLIPBOARDMONITORING = 0, PP_PMONITORSCANINTERVAL, @@ -115,7 +115,138 @@ eFreq_Max }; -// register function -bool RegisterProperties(icpf::config* pManager); +///////////////////////////////////////////////////////////////////////////////////////////// +// Properties definitions -#endif \ No newline at end of file +template struct PropData; + +#define PROPERTY(enum_id, val_type, val_name, def_value)\ + template<> struct PropData\ + {\ + typedef val_type value_type;\ + static value_type GetDefaultValue() { return def_value; }\ + static const wchar_t* GetPropertyName() { return val_name; }\ + } + +#define PROPERTY_MINMAX(enum_id, val_type, val_name, def_value, min_val, max_val)\ + template<> struct PropData\ + {\ + typedef val_type value_type;\ + static value_type GetDefaultValue() { return def_value; }\ + static const wchar_t* GetPropertyName() { return val_name; }\ + } + +const long long Hour = 3600UL*1000UL; +const long long Minute = 60UL*1000UL; +const long long Second = 1000UL; + +typedef std::vector CStringVector; + +// General settings +PROPERTY(PP_PCLIPBOARDMONITORING, bool, _T("CHConfig.General.Program.EnableClipboardMonitoring"), false); +PROPERTY_MINMAX(PP_PMONITORSCANINTERVAL, unsigned int, _T("CHConfig.General.Program.ClipboardMonitorScanInterval"), 1000, 0, 3600UL*1000UL); +PROPERTY(PP_PRELOADAFTERRESTART, bool, _T("CHConfig.General.Program.RunWithSystem"), false); + +PROPERTY_MINMAX(PP_PCHECK_FOR_UPDATES_FREQUENCY, unsigned int, _T("CHConfig.General.Program.Updates.Frequency"), eFreq_Weekly, eFreq_Never, eFreq_Max - 1); +PROPERTY(PP_PUPDATE_CHECK_FOR_BETA, bool, _T("CHConfig.General.Program.Updates.CheckForBetaVersions"), true); + +PROPERTY(PP_PPROCESSPRIORITYCLASS, int, _T("CHConfig.General.Program.ProcessPriority"), NORMAL_PRIORITY_CLASS); +PROPERTY(PP_PLANGUAGE, CString, _T("CHConfig.General.Program.Language"), _T("\\Langs\\English.lng")); + +PROPERTY(PP_SHORTCUTS, CStringVector, _T("CHConfig.General.Program.Shortcuts.Shortcut"), (CStringVector())); +PROPERTY(PP_RECENTPATHS, CStringVector, _T("CHConfig.General.Program.RecentPaths.Path"), (CStringVector())); + +PROPERTY(PP_LOGENABLELOGGING, bool, _T("CHConfig.General.Logging.Enable"), true); +PROPERTY_MINMAX(PP_LOGMAXSIZE, int, _T("CHConfig.General.Logging.SizeLimit"), 512384, 1024, 0xffffffff); +PROPERTY_MINMAX(PP_LOGLEVEL, unsigned int, _T("CHConfig.General.Logging.LoggingLevel"), 1, 0, 3); + +// GUI +PROPERTY_MINMAX(PP_STATUSREFRESHINTERVAL, unsigned int, _T("CHConfig.GUI.StatusDialog.RefreshInterval"), 1000, 0, 24*Hour); +PROPERTY(PP_STATUSSHOWDETAILS, bool, _T("CHConfig.GUI.StatusDialog.ShowDetails"), true); +PROPERTY(PP_STATUSAUTOREMOVEFINISHED, bool, _T("CHConfig.GUI.StatusDialog.AutoRemoveFinishedTasks"), false); + +PROPERTY_MINMAX(PP_FDWIDTH, int, _T("CHConfig.GUI.FolderDialog.Width"), -1, -1, 32767); +PROPERTY_MINMAX(PP_FDHEIGHT, int, _T("CHConfig.GUI.FolderDialog.Height"), -1, -1, 32767); +PROPERTY_MINMAX(PP_FDSHORTCUTLISTSTYLE, int, _T("CHConfig.GUI.FolderDialog.ShortcutListStyle"), 1, 0, 3); +PROPERTY(PP_FDEXTENDEDVIEW, bool, _T("CHConfig.GUI.FolderDialog.ExtendedView"), true); +PROPERTY(PP_FDIGNORESHELLDIALOGS, bool, _T("CHConfig.GUI.FolderDialog.IgnoreShellDialogs"), false); + +PROPERTY(PP_MVSHOWFILENAMES, bool, _T("CHConfig.GUI.MiniView.ShowFilenames"), true); +PROPERTY(PP_MVSHOWSINGLETASKS, bool, _T("CHConfig.GUI.MiniView.ShowSingleTasks"), true); +PROPERTY_MINMAX(PP_MVREFRESHINTERVAL, unsigned int, _T("CHConfig.GUI.MiniView.RefreshInterval"), 200, 0, 24*Hour); +PROPERTY(PP_MVAUTOSHOWWHENRUN, bool, _T("CHConfig.GUI.MiniView.AutoShowOnStartup"), true); +PROPERTY(PP_MVAUTOHIDEWHENEMPTY, bool, _T("CHConfig.GUI.MiniView.AutohideWhenEmpty"), true); +PROPERTY(PP_MVUSESMOOTHPROGRESS, bool, _T("CHConfig.GUI.MiniView.UseSmoothProgress"), true); + +// Core engine +PROPERTY_MINMAX(PP_PAUTOSAVEINTERVAL, unsigned int, _T("CHConfig.Core.AutosaveInterval"), 30*Second, 0, 24*Hour); + +PROPERTY(PP_PSHUTDOWNAFTREFINISHED, bool, _T("CHConfig.Core.Shutdown.ShutdownSystemAfterFinished"), false); +PROPERTY_MINMAX(PP_PTIMEBEFORESHUTDOWN, int, _T("CHConfig.Core.Shutdown.TimeBeforeShutdown"), 10000, 0, 24*Hour); +PROPERTY(PP_PFORCESHUTDOWN, bool, _T("CHConfig.Core.Shutdown.ForceShutdown"), false); + +PROPERTY(PP_SNDPLAYSOUNDS, bool, _T("CHConfig.Core.Notifications.Sounds.Enable"), true); +PROPERTY(PP_SNDERRORSOUNDPATH, CString, _T("CHConfig.Core.Notifications.Sounds.ErrorSoundPath"), _T("\\media\\chord.wav")); +PROPERTY(PP_SNDFINISHEDSOUNDPATH, CString, _T("CHConfig.Core.Notifications.Sounds.FinishedSoundPath"), _T("\\media\\ding.wav")); + +PROPERTY(PP_CMLIMITMAXOPERATIONS, unsigned int, _T("CHConfig.Core.Operation.LimitMaxOperations"), 1); + +PROPERTY(PP_CMSETDESTATTRIBUTES, bool, _T("CHConfig.Core.Operation.SetDestinationAttributes"), true); +PROPERTY(PP_CMSETDESTDATE, bool, _T("CHConfig.Core.Operation.SetDestinationTime"), true); +PROPERTY(PP_CMPROTECTROFILES, bool, _T("CHConfig.Core.Operation.ProtectReadOnlyFiles"), true); +PROPERTY(PP_CMREADSIZEBEFOREBLOCKING, bool, _T("CHConfig.Core.Operation.ScanForFilesBeforeBlocking"), true); +PROPERTY(PP_CMDEFAULTPRIORITY, int, _T("CHConfig.Core.Operation.Thread.Priority"), THREAD_PRIORITY_NORMAL); +PROPERTY(PP_CMDISABLEPRIORITYBOOST, bool, _T("CHConfig.Core.Operation.Thread.DisablePriorityBoost"), false); +PROPERTY(PP_CMDELETEAFTERFINISHED, bool, _T("CHConfig.Core.Operation.DeleteDilesInSeparateOperation"), true); + +PROPERTY(PP_BFUSEONLYDEFAULT, bool, _T("CHConfig.Core.Operation.Buffer.UseOnlyDefaultBuffer"), false); +PROPERTY_MINMAX(PP_BFDEFAULT, unsigned int, _T("CHConfig.Core.Operation.Buffer.DefaultBufferSize"), 2097152, 1, 0xffffffff); +PROPERTY_MINMAX(PP_BFONEDISK, unsigned int, _T("CHConfig.Core.Operation.Buffer.OnePhysicalDiskSize"), 4194304, 1, 0xffffffff); +PROPERTY_MINMAX(PP_BFTWODISKS, unsigned int, _T("CHConfig.Core.Operation.Buffer.TwoPhysicalDisksSize"), 524288, 1, 0xffffffff); +PROPERTY_MINMAX(PP_BFCD, unsigned int, _T("CHConfig.Core.Operation.Buffer.CDSize"), 262144, 1, 0xffffffff); +PROPERTY_MINMAX(PP_BFLAN, unsigned int, _T("CHConfig.Core.Operation.Buffer.LANSize"), 131072, 1, 0xffffffff); +PROPERTY(PP_BFUSENOBUFFERING, bool, _T("CHConfig.Core.Operation.Buffering.DisableBufferingForLargeFiles"), true); +PROPERTY_MINMAX(PP_BFBOUNDARYLIMIT, int, _T("CHConfig.Core.Operation.Buffering.MinSizeOfFileToDisableBuffering"), 2097152, 1, 0xffffffff); + +// Shell extension +PROPERTY(PP_SHSHOWCOPY, bool, _T("CHConfig.ShellExtension.ShowCommands.Copy"), true); +PROPERTY(PP_SHSHOWMOVE, bool, _T("CHConfig.ShellExtension.ShowCommands.Move"), true); +PROPERTY(PP_SHSHOWCOPYMOVE, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyMoveSpecial"), true); +PROPERTY(PP_SHSHOWPASTE, bool, _T("CHConfig.ShellExtension.ShowCommands.Paste"), true); +PROPERTY(PP_SHSHOWPASTESPECIAL, bool, _T("CHConfig.ShellExtension.ShowCommands.PasteSpecial"), true); +PROPERTY(PP_SHSHOWCOPYTO, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyTo"), true); +PROPERTY(PP_SHSHOWMOVETO, bool, _T("CHConfig.ShellExtension.ShowCommands.MoveTo"), true); +PROPERTY(PP_SHSHOWCOPYMOVETO, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyToMoveToSpecial"), true); +PROPERTY(PP_SHSHOWFREESPACE, bool, _T("CHConfig.ShellExtension.ShowFreeSpaceAlongShortcuts"), true); +PROPERTY(PP_SHSHOWSHELLICONS, bool, _T("CHConfig.ShellExtension.ShowShortcutsShellIcons"), false); +PROPERTY(PP_SHINTERCEPTDRAGDROP, bool, _T("CHConfig.ShellExtension.InterceptDragDrop"), true); +PROPERTY(PP_SHINTERCEPTKEYACTIONS, bool, _T("CHConfig.ShellExtension.ShowCommands.InterceptKeyboardActions"), true); +PROPERTY(PP_SHINTERCEPTCTXMENUACTIONS, bool, _T("CHConfig.ShellExtension.ShowCommands.InterceptDefaultContextMenuActions"), false); + +// Invisible options +PROPERTY_MINMAX(PP_LAST_UPDATE_TIMESTAMP, long long, _T("CHConfig.RuntimeState.LastCheckedForUpdates"), 0, 0, LLONG_MAX); + +///////////////////////////////////////////////////////////////////////////////////////////// +// Properties retrieval + +template +typename PropData::value_type GetPropValue(const TConfig& rConfig) +{ + typename PropData::value_type tValue; + rConfig.GetValue(PropData::GetPropertyName(), tValue, PropData::GetDefaultValue()); + return tValue; +} + +template +bool GetPropValue(const TConfig& rConfig, typename PropData::value_type& rValue) +{ + return rConfig.GetValue(PropData::GetPropertyName(), rValue, PropData::GetDefaultValue()); +} + +template +void SetPropValue(TConfig& rConfig, const typename PropData::value_type& rValue) +{ + rConfig.SetValue(PropData::GetPropertyName(), rValue); +} + +#endif Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -25,7 +25,6 @@ #include "ch.h" #include "task.h" #include "CfgProperties.h" -#include "charvect.h" #include "FolderDialog.h" #include "task.h" #include "ShutdownDlg.h" @@ -74,10 +73,10 @@ UINT nFormat=RegisterClipboardFormat(_T("Preferred DropEffect")); UINT uiCounter=0, uiShutCounter=0; - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); for(;;) { - if (uiCounter == 0 && rConfig.get_bool(PP_PCLIPBOARDMONITORING) && IsClipboardFormatAvailable(CF_HDROP)) + if (uiCounter == 0 && GetPropValue(rConfig) && IsClipboardFormatAvailable(CF_HDROP)) { // get data from clipboard OpenClipboard(NULL); @@ -122,29 +121,15 @@ // get dest folder CFolderDialog dlg; - const tchar_t* pszPath = NULL; - dlg.m_bdData.cvShortcuts.clear(true); - size_t stCount = rConfig.get_value_count(PP_SHORTCUTS); - for(size_t stIndex = 0; stIndex < stCount; stIndex++) - { - pszPath = rConfig.get_string(PP_SHORTCUTS, stIndex); - dlg.m_bdData.cvShortcuts.push_back(pszPath); - } + GetPropValue(rConfig, dlg.m_bdData.cvShortcuts); + GetPropValue(rConfig, dlg.m_bdData.cvRecent); - dlg.m_bdData.cvRecent.clear(true); - stCount = rConfig.get_value_count(PP_RECENTPATHS); - for(size_t stIndex = 0; stIndex < stCount; stIndex++) - { - pszPath = rConfig.get_string(PP_RECENTPATHS, stIndex); - dlg.m_bdData.cvRecent.push_back(pszPath); - } + dlg.m_bdData.bExtended=GetPropValue(rConfig); + dlg.m_bdData.cx=GetPropValue(rConfig); + dlg.m_bdData.cy=GetPropValue(rConfig); + dlg.m_bdData.iView=GetPropValue(rConfig); + dlg.m_bdData.bIgnoreDialogs=GetPropValue(rConfig); - dlg.m_bdData.bExtended=rConfig.get_bool(PP_FDEXTENDEDVIEW); - dlg.m_bdData.cx=boost::numeric_cast(rConfig.get_signed_num(PP_FDWIDTH)); - dlg.m_bdData.cy=boost::numeric_cast(rConfig.get_signed_num(PP_FDHEIGHT)); - dlg.m_bdData.iView=boost::numeric_cast(rConfig.get_signed_num(PP_FDSHORTCUTLISTSTYLE)); - dlg.m_bdData.bIgnoreDialogs=rConfig.get_bool(PP_FDIGNORESHELLDIALOGS); - dlg.m_bdData.strInitialDir=(dlg.m_bdData.cvRecent.size() > 0) ? dlg.m_bdData.cvRecent.at(0) : _T(""); if(eOperation == eOperation_Copy) @@ -171,25 +156,16 @@ INT_PTR iResult=dlg.DoModal(); // set data to config - rConfig.clear_array_values(PP_SHORTCUTS); - for(char_vector::iterator it = dlg.m_bdData.cvShortcuts.begin(); it != dlg.m_bdData.cvShortcuts.end(); it++) - { - rConfig.set_string(PP_SHORTCUTS, (*it), icpf::property::action_add); - } + SetPropValue(rConfig, dlg.m_bdData.cvShortcuts); + SetPropValue(rConfig, dlg.m_bdData.cvRecent); - rConfig.clear_array_values(PP_RECENTPATHS); - for(char_vector::iterator it = dlg.m_bdData.cvRecent.begin(); it != dlg.m_bdData.cvRecent.end(); it++) - { - rConfig.set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); - } + SetPropValue(rConfig, dlg.m_bdData.bExtended); + SetPropValue(rConfig, dlg.m_bdData.cx); + SetPropValue(rConfig, dlg.m_bdData.cy); + SetPropValue(rConfig, dlg.m_bdData.iView); + SetPropValue(rConfig, dlg.m_bdData.bIgnoreDialogs); + rConfig.Write(); - rConfig.set_bool(PP_FDEXTENDEDVIEW, dlg.m_bdData.bExtended); - rConfig.set_signed_num(PP_FDWIDTH, dlg.m_bdData.cx); - rConfig.set_signed_num(PP_FDHEIGHT, dlg.m_bdData.cy); - rConfig.set_signed_num(PP_FDSHORTCUTLISTSTYLE, dlg.m_bdData.iView); - rConfig.set_bool(PP_FDIGNORESHELLDIALOGS, dlg.m_bdData.bIgnoreDialogs); - rConfig.write(NULL); - if(iResult == IDOK) { // get dest path @@ -201,15 +177,15 @@ spTask->SetTaskDefinition(tTaskDefinition); BUFFERSIZES bs; - bs.m_bOnlyDefault=rConfig.get_bool(PP_BFUSEONLYDEFAULT); - bs.m_uiDefaultSize=(UINT)rConfig.get_signed_num(PP_BFDEFAULT); - bs.m_uiOneDiskSize=(UINT)rConfig.get_signed_num(PP_BFONEDISK); - bs.m_uiTwoDisksSize=(UINT)rConfig.get_signed_num(PP_BFTWODISKS); - bs.m_uiCDSize=(UINT)rConfig.get_signed_num(PP_BFCD); - bs.m_uiLANSize=(UINT)rConfig.get_signed_num(PP_BFLAN); + bs.m_bOnlyDefault=GetPropValue(rConfig); + bs.m_uiDefaultSize=GetPropValue(rConfig); + bs.m_uiOneDiskSize=GetPropValue(rConfig); + bs.m_uiTwoDisksSize=GetPropValue(rConfig); + bs.m_uiCDSize=GetPropValue(rConfig); + bs.m_uiLANSize=GetPropValue(rConfig); spTask->SetBufferSizes(&bs); - spTask->SetPriority(boost::numeric_cast(rConfig.get_signed_num(PP_CMDEFAULTPRIORITY))); + spTask->SetPriority(GetPropValue(rConfig)); // add task to a list of tasks and start pData->m_pTasks->Add(spTask); @@ -224,24 +200,24 @@ } // do we need to check for turning computer off - if(uiShutCounter == 0 && GetConfig().get_bool(PP_PSHUTDOWNAFTREFINISHED)) + if(uiShutCounter == 0 && GetPropValue(GetConfig())) { if(pData->m_pTasks->AreAllFinished()) { TRACE("Shut down windows\n"); bool bShutdown=true; - if (GetConfig().get_signed_num(PP_PTIMEBEFORESHUTDOWN) != 0) + if (GetPropValue(GetConfig()) != 0) { CShutdownDlg dlg; - dlg.m_iOverallTime = boost::numeric_cast(GetConfig().get_signed_num(PP_PTIMEBEFORESHUTDOWN)); + dlg.m_iOverallTime = GetPropValue(GetConfig()); if (dlg.m_iOverallTime < 0) dlg.m_iOverallTime=-dlg.m_iOverallTime; bShutdown=(dlg.DoModal() != IDCANCEL); } - GetConfig().set_bool(PP_PSHUTDOWNAFTREFINISHED, false); - GetConfig().write(NULL); - if (bShutdown) + SetPropValue(GetConfig(), false); + GetConfig().Write(); + if(bShutdown) { // adjust token privileges for NT HANDLE hToken=NULL; @@ -255,7 +231,7 @@ AdjustTokenPrivileges(hToken, FALSE, &tp, NULL, NULL, NULL); } - BOOL bExit=ExitWindowsEx(EWX_POWEROFF | EWX_SHUTDOWN | (GetConfig().get_bool(PP_PFORCESHUTDOWN) ? EWX_FORCE : 0), 0); + BOOL bExit=ExitWindowsEx(EWX_POWEROFF | EWX_SHUTDOWN | (GetPropValue(GetConfig()) ? EWX_FORCE : 0), 0); if (bExit) return 1; else @@ -277,9 +253,9 @@ uiCounter+=iSleepCount; uiShutCounter+=iSleepCount; - if (uiCounter >= (UINT)GetConfig().get_signed_num(PP_PMONITORSCANINTERVAL)) + if(uiCounter >= GetPropValue(GetConfig())) uiCounter=0; - if (uiShutCounter >= 800) + if(uiShutCounter >= 800) uiShutCounter=0; } Index: src/ch/CustomCopyDlg.h =================================================================== diff -u -rbd08c279240bac9e7902f8da6a9251e0252ec324 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision bd08c279240bac9e7902f8da6a9251e0252ec324) +++ src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -21,7 +21,6 @@ #include "DataBuffer.h" #include "FileFilter.h" -#include "charvect.h" ///////////////////////////////////////////////////////////////////////////// // CCustomCopyDlg dialog @@ -38,7 +37,7 @@ { CStringArray m_astrPaths; // source paths to copy/move CString m_strDestPath; // currently selected destination path - char_vector m_vRecent; // recently selected paths + std::vector m_vRecent; // recently selected paths int m_iOperation; // copy || move int m_iPriority; // operation priority BUFFERSIZES m_bsSizes; // buffer sizes selected for this task Index: src/ch/FeedbackHandler.cpp =================================================================== diff -u -r22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1) +++ src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -92,26 +92,26 @@ } case eFT_OperationFinished: { - if(GetConfig().get_bool(PP_SNDPLAYSOUNDS)) + if(GetPropValue(GetConfig())) { - TCHAR* pszPath = new TCHAR[_MAX_PATH]; - GetConfig().get_string(PP_SNDFINISHEDSOUNDPATH, pszPath, _MAX_PATH); - GetApp().ExpandPath(pszPath); - PlaySound(pszPath, NULL, SND_FILENAME | SND_ASYNC); - delete [] pszPath; + CString strPath = GetPropValue(GetConfig()); + GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); + strPath.ReleaseBuffer(); + + PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } break; } case eFT_OperationError: { - if(GetConfig().get_bool(PP_SNDPLAYSOUNDS)) + if(GetPropValue(GetConfig())) { - TCHAR* pszPath = new TCHAR[_MAX_PATH]; - GetConfig().get_string(PP_SNDERRORSOUNDPATH, pszPath, _MAX_PATH); - GetApp().ExpandPath(pszPath); - PlaySound(pszPath, NULL, SND_FILENAME | SND_ASYNC); - delete [] pszPath; + CString strPath = GetPropValue(GetConfig()); + GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); + strPath.ReleaseBuffer(); + + PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } break; Index: src/ch/FolderDialog.cpp =================================================================== diff -u -rc435ab507c8b8280264188b49e9ada56d46c0261 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision c435ab507c8b8280264188b49e9ada56d46c0261) +++ src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -427,7 +427,7 @@ for(size_t stIndex = 0; stIndex < m_bdData.cvRecent.size(); ++stIndex) { cbi.iItem = stIndex; - cbi.pszText = m_bdData.cvRecent.at(stIndex); + cbi.pszText = const_cast((PCTSTR)m_bdData.cvRecent.at(stIndex)); sfi.iIcon = -1; SHGetFileInfo(m_bdData.cvRecent.at(stIndex), FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); @@ -559,7 +559,7 @@ return; } - m_bdData.cvRecent.insert(m_bdData.cvRecent.begin(), (const PTSTR)(LPCTSTR)(m_strPath+_T('\\')), true); + m_bdData.cvRecent.insert(m_bdData.cvRecent.begin(), (m_strPath + _T('\\'))); CRect rcDlg; GetWindowRect(&rcDlg); @@ -865,7 +865,7 @@ SHGetFileInfo(sc.m_strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); // add to an array and to shortcuts list - m_bdData.cvShortcuts.push_back((const PTSTR)(LPCTSTR)(CString)(sc), true); + m_bdData.cvShortcuts.push_back(sc); int iIndex = boost::numeric_cast(m_bdData.cvShortcuts.size() - 1); m_ctlShortcuts.InsertItem(iIndex, sc.m_strName, sfi.iIcon); m_ctlShortcuts.SetItem(iIndex, 1, LVIF_TEXT, sc.m_strPath, 0, 0, 0, 0); @@ -897,7 +897,7 @@ { int iSel=m_ctlShortcuts.GetNextSelectedItem(pos); m_ctlShortcuts.DeleteItem(iSel); - m_bdData.cvShortcuts.erase(m_bdData.cvShortcuts.begin()+iSel, true); + m_bdData.cvShortcuts.erase(m_bdData.cvShortcuts.begin() + iSel); m_ctlShortcuts.Arrange(LVA_DEFAULT); } @@ -913,7 +913,7 @@ if (pdi->item.pszText == NULL) { m_ctlShortcuts.DeleteItem(pdi->item.iItem); - m_bdData.cvShortcuts.erase(m_bdData.cvShortcuts.begin()+pdi->item.iItem, true); + m_bdData.cvShortcuts.erase(m_bdData.cvShortcuts.begin() + pdi->item.iItem); *pResult=0; return; @@ -923,7 +923,7 @@ CShortcut sc=CString(m_bdData.cvShortcuts.at(pdi->item.iItem)); sc.m_strName=pdi->item.pszText; - m_bdData.cvShortcuts.replace(m_bdData.cvShortcuts.begin()+pdi->item.iItem, (const PTSTR)(LPCTSTR)(CString)sc, true, true); + m_bdData.cvShortcuts[pdi->item.iItem] = (CString)sc; *pResult=1; } @@ -950,7 +950,7 @@ } DWORD dwStyle = GetWindowLong(m_ctlShortcuts.GetSafeHwnd(), GWL_STYLE); - + // Only set the window style if the view bits have changed. if ((dwStyle & LVS_TYPEMASK) != dwView) SetWindowLongPtr(m_ctlShortcuts.GetSafeHwnd(), GWL_STYLE, (dwStyle & ~LVS_TYPEMASK) | dwView); Index: src/ch/FolderDialog.h =================================================================== diff -u -r68739164e349c34dcd0bcb36c6eb381f23cb8b77 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/FolderDialog.h (.../FolderDialog.h) (revision 68739164e349c34dcd0bcb36c6eb381f23cb8b77) +++ src/ch/FolderDialog.h (.../FolderDialog.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -35,7 +35,6 @@ #include "DirTreeCtrl.h" #include "ThemedButton.h" #include "shortcuts.h" -#include "charvect.h" #include "../libictranslate/LanguageDialog.h" ///////////////////////////////////////////////////////////////////////////// @@ -74,8 +73,8 @@ CString strCaption; CString strText; CString strInitialDir; - char_vector cvRecent; - char_vector cvShortcuts; + std::vector cvRecent; + std::vector cvShortcuts; int cx, cy; // pixels int iView; // type of view (large icons, small icons, ...) Index: src/ch/MainWnd.cpp =================================================================== diff -u -r98791237b8511ff19aa54dc3c6901222287d9914 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 98791237b8511ff19aa54dc3c6901222287d9914) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -184,7 +184,7 @@ LOG_INFO(_T("Starting clipboard monitor...")); CClipboardMonitor::StartMonitor(&m_tasks); - EUpdatesFrequency eFrequency = (EUpdatesFrequency)GetConfig().get_unsigned_num(PP_PCHECK_FOR_UPDATES_FREQUENCY); + EUpdatesFrequency eFrequency = (EUpdatesFrequency)GetPropValue(GetConfig()); if(eFrequency != eFreq_Never) { unsigned long long ullMinInterval = 0; @@ -212,7 +212,7 @@ // get last check time stored in configuration unsigned long long ullCurrentStamp = _time64(NULL); - unsigned long long ullTimestamp = GetConfig().get_unsigned_num(PP_LAST_UPDATE_TIMESTAMP); + unsigned long long ullTimestamp = GetPropValue(GetConfig()); // perform checking for updates only when the minimal interval has passed if(ullCurrentStamp - ullTimestamp >= ullMinInterval) @@ -223,11 +223,11 @@ pDlg->m_bAutoDelete = true; pDlg->Create(); - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); try { - rConfig.set_unsigned_num(PP_LAST_UPDATE_TIMESTAMP, _time64(NULL)); - rConfig.write(NULL); + SetPropValue(rConfig, _time64(NULL)); + rConfig.Write(); } catch(icpf::exception& /*e*/) { @@ -237,12 +237,12 @@ } // start saving timer - SetTimer(1023, (UINT)GetConfig().get_signed_num(PP_PAUTOSAVEINTERVAL), NULL); + SetTimer(1023, GetPropValue(GetConfig()), NULL); SetTimer(3245, TM_AUTOREMOVE, NULL); SetTimer(8743, TM_ACCEPTING, NULL); // ends wait state in tasks - if (GetConfig().get_bool(PP_MVAUTOSHOWWHENRUN)) + if (GetPropValue(GetConfig())) PostMessage(WM_SHOWMINIVIEW); return 0; @@ -300,8 +300,8 @@ POINT pt; GetCursorPos(&pt); - pSubMenu->CheckMenuItem(ID_POPUP_MONITORING, MF_BYCOMMAND | (GetConfig().get_bool(PP_PCLIPBOARDMONITORING) ? MF_CHECKED : MF_UNCHECKED)); - pSubMenu->CheckMenuItem(ID_POPUP_SHUTAFTERFINISHED, MF_BYCOMMAND | (GetConfig().get_bool(PP_PSHUTDOWNAFTREFINISHED) ? MF_CHECKED : MF_UNCHECKED)); + pSubMenu->CheckMenuItem(ID_POPUP_MONITORING, MF_BYCOMMAND | (GetPropValue(GetConfig()) ? MF_CHECKED : MF_UNCHECKED)); + pSubMenu->CheckMenuItem(ID_POPUP_SHUTAFTERFINISHED, MF_BYCOMMAND | (GetPropValue(GetConfig()) ? MF_CHECKED : MF_UNCHECKED)); // track the menu pSubMenu->TrackPopupMenu(TPM_LEFTBUTTON, pt.x, pt.y, this); @@ -366,12 +366,12 @@ // autosave timer KillTimer(1023); m_tasks.SaveProgress(); - SetTimer(1023, (UINT)GetConfig().get_signed_num(PP_PAUTOSAVEINTERVAL), NULL); + SetTimer(1023, GetPropValue(GetConfig()), NULL); break; case 3245: // auto-delete finished tasks timer KillTimer(3245); - if (GetConfig().get_bool(PP_STATUSAUTOREMOVEFINISHED)) + if (GetPropValue(GetConfig())) { size_t stSize = m_tasks.GetSize(); m_tasks.RemoveAllFinished(); @@ -384,7 +384,7 @@ case 8743: { // wait state handling section - m_tasks.ResumeWaitingTasks((size_t)GetConfig().get_signed_num(PP_CMLIMITMAXOPERATIONS)); + m_tasks.ResumeWaitingTasks((size_t)GetPropValue(GetConfig())); break; } } @@ -439,18 +439,18 @@ } while (iOffset < ulLen); - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); // special operation - modify stuff CFiltersArray ffFilters; - int iPriority = boost::numeric_cast(GetConfig().get_signed_num(PP_CMDEFAULTPRIORITY)); + int iPriority = boost::numeric_cast(GetPropValue(GetConfig())); BUFFERSIZES bsSizes; - bsSizes.m_bOnlyDefault=GetConfig().get_bool(PP_BFUSEONLYDEFAULT); - bsSizes.m_uiDefaultSize=(UINT)GetConfig().get_signed_num(PP_BFDEFAULT); - bsSizes.m_uiOneDiskSize=(UINT)GetConfig().get_signed_num(PP_BFONEDISK); - bsSizes.m_uiTwoDisksSize=(UINT)GetConfig().get_signed_num(PP_BFTWODISKS); - bsSizes.m_uiCDSize=(UINT)GetConfig().get_signed_num(PP_BFCD); - bsSizes.m_uiLANSize=(UINT)GetConfig().get_signed_num(PP_BFLAN); + bsSizes.m_bOnlyDefault=GetPropValue(GetConfig()); + bsSizes.m_uiDefaultSize=GetPropValue(GetConfig()); + bsSizes.m_uiOneDiskSize=GetPropValue(GetConfig()); + bsSizes.m_uiTwoDisksSize=GetPropValue(GetConfig()); + bsSizes.m_uiCDSize=GetPropValue(GetConfig()); + bsSizes.m_uiLANSize=GetPropValue(GetConfig()); BOOL bOnlyCreate=FALSE; BOOL bIgnoreDirs=FALSE; @@ -470,16 +470,10 @@ dlg.m_ccData.m_bForceDirectories=(bForceDirectories != 0); dlg.m_ccData.m_bCreateStructure=(bOnlyCreate != 0); - dlg.m_ccData.m_vRecent.clear(true); - const tchar_t* pszPath = NULL; - size_t stCount = rConfig.get_value_count(PP_RECENTPATHS); - for(size_t stIndex = 0; stIndex < stCount; stIndex++) - { - pszPath = rConfig.get_string(PP_RECENTPATHS, stIndex); - if(pszPath) - dlg.m_ccData.m_vRecent.push_back(pszPath); - } + dlg.m_ccData.m_vRecent.clear(); + GetPropValue(rConfig, dlg.m_ccData.m_vRecent); + INT_PTR iModalResult; if ( (iModalResult=dlg.DoModal()) == IDCANCEL) return CWnd::OnCopyData(pWnd, pCopyDataStruct); @@ -495,13 +489,9 @@ bIgnoreDirs=dlg.m_ccData.m_bIgnoreFolders; bForceDirectories=dlg.m_ccData.m_bForceDirectories; bOnlyCreate=dlg.m_ccData.m_bCreateStructure; - dlg.m_ccData.m_vRecent.insert(dlg.m_ccData.m_vRecent.begin(), (const PTSTR)(LPCTSTR)strDstPath, true); + dlg.m_ccData.m_vRecent.insert(dlg.m_ccData.m_vRecent.begin(), strDstPath); - rConfig.clear_array_values(PP_RECENTPATHS); - for(char_vector::iterator it = dlg.m_ccData.m_vRecent.begin(); it != dlg.m_ccData.m_vRecent.end(); it++) - { - rConfig.set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); - } + SetPropValue(rConfig, dlg.m_ccData.m_vRecent); } // create new task @@ -551,44 +541,33 @@ void CMainWnd::OnPopupCustomCopy() { - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); CCustomCopyDlg dlg; dlg.m_ccData.m_iOperation=0; - dlg.m_ccData.m_iPriority = boost::numeric_cast(rConfig.get_signed_num(PP_CMDEFAULTPRIORITY)); - dlg.m_ccData.m_bsSizes.m_bOnlyDefault=rConfig.get_bool(PP_BFUSEONLYDEFAULT); - dlg.m_ccData.m_bsSizes.m_uiDefaultSize=(UINT)rConfig.get_signed_num(PP_BFDEFAULT); - dlg.m_ccData.m_bsSizes.m_uiOneDiskSize=(UINT)rConfig.get_signed_num(PP_BFONEDISK); - dlg.m_ccData.m_bsSizes.m_uiTwoDisksSize=(UINT)rConfig.get_signed_num(PP_BFTWODISKS); - dlg.m_ccData.m_bsSizes.m_uiCDSize=(UINT)rConfig.get_signed_num(PP_BFCD); - dlg.m_ccData.m_bsSizes.m_uiLANSize=(UINT)rConfig.get_signed_num(PP_BFLAN); + dlg.m_ccData.m_iPriority = boost::numeric_cast(GetPropValue(rConfig)); + dlg.m_ccData.m_bsSizes.m_bOnlyDefault=GetPropValue(rConfig); + dlg.m_ccData.m_bsSizes.m_uiDefaultSize=GetPropValue(rConfig); + dlg.m_ccData.m_bsSizes.m_uiOneDiskSize=GetPropValue(rConfig); + dlg.m_ccData.m_bsSizes.m_uiTwoDisksSize=GetPropValue(rConfig); + dlg.m_ccData.m_bsSizes.m_uiCDSize=GetPropValue(rConfig); + dlg.m_ccData.m_bsSizes.m_uiLANSize=GetPropValue(rConfig); dlg.m_ccData.m_bCreateStructure=false; dlg.m_ccData.m_bForceDirectories=false; dlg.m_ccData.m_bIgnoreFolders=false; - dlg.m_ccData.m_vRecent.clear(true); - const tchar_t* pszPath = NULL; - size_t stCount = rConfig.get_value_count(PP_RECENTPATHS); - for(size_t stIndex = 0; stIndex < stCount; stIndex++) - { - pszPath = rConfig.get_string(PP_RECENTPATHS, stIndex); - if(pszPath) - dlg.m_ccData.m_vRecent.push_back(pszPath); - } + dlg.m_ccData.m_vRecent.clear(); + GetPropValue(rConfig, dlg.m_ccData.m_vRecent); + if (dlg.DoModal() == IDOK) { + SetPropValue(rConfig, dlg.m_ccData.m_vRecent); + // save recent paths dlg.m_ccData.m_vRecent.push_back((PCTSTR)dlg.m_ccData.m_strDestPath); - rConfig.clear_array_values(PP_RECENTPATHS); - for(char_vector::iterator it = dlg.m_ccData.m_vRecent.begin(); it != dlg.m_ccData.m_vRecent.end(); it++) - { - rConfig.set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); - } - - TTaskDefinition tTaskDefinition; tTaskDefinition.SetOperationType((dlg.m_ccData.m_iOperation == 1) ? eOperation_Move : eOperation_Copy); @@ -643,27 +622,27 @@ case WM_CONFIGNOTIFY: { - GetApp().SetAutorun(GetConfig().get_bool(PP_PRELOADAFTERRESTART)); + GetApp().SetAutorun(GetPropValue(GetConfig())); // set this process class HANDLE hProcess=GetCurrentProcess(); - ::SetPriorityClass(hProcess, (DWORD)GetConfig().get_signed_num(PP_PPROCESSPRIORITYCLASS)); + ::SetPriorityClass(hProcess, (DWORD)GetPropValue(GetConfig())); break; } case WM_GETCONFIG: { - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); // std config values - g_pscsShared->bShowFreeSpace=rConfig.get_bool(PP_SHSHOWFREESPACE); + g_pscsShared->bShowFreeSpace=GetPropValue(rConfig); // experimental - doesn't work on all systems - g_pscsShared->bShowShortcutIcons=rConfig.get_bool(PP_SHSHOWSHELLICONS); - g_pscsShared->uiFlags = (rConfig.get_bool(PP_SHINTERCEPTDRAGDROP) ? CSharedConfigStruct::eFlag_InterceptDragAndDrop : 0) | - (rConfig.get_bool(PP_SHINTERCEPTKEYACTIONS) ? CSharedConfigStruct::eFlag_InterceptKeyboardActions : 0) | - (rConfig.get_bool(PP_SHINTERCEPTCTXMENUACTIONS) ? CSharedConfigStruct::eFlag_InterceptCtxMenuActions : 0); + g_pscsShared->bShowShortcutIcons=GetPropValue(rConfig); + g_pscsShared->uiFlags = (GetPropValue(rConfig) ? CSharedConfigStruct::eFlag_InterceptDragAndDrop : 0) | + (GetPropValue(rConfig) ? CSharedConfigStruct::eFlag_InterceptKeyboardActions : 0) | + (GetPropValue(rConfig) ? CSharedConfigStruct::eFlag_InterceptCtxMenuActions : 0); // sizes for (int i=0;i<6;i++) @@ -679,9 +658,9 @@ { g_pscsShared->iCommandCount=3; g_pscsShared->iShortcutsCount=0; - g_pscsShared->uiFlags |= (rConfig.get_bool(PP_SHSHOWCOPY) ? CSharedConfigStruct::DD_COPY_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWMOVE) ? CSharedConfigStruct::DD_MOVE_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWCOPYMOVE) ? CSharedConfigStruct::DD_COPYMOVESPECIAL_FLAG : 0); + g_pscsShared->uiFlags |= (GetPropValue(rConfig) ? CSharedConfigStruct::DD_COPY_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::DD_MOVE_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::DD_COPYMOVESPECIAL_FLAG : 0); pCommand[0].uiCommandID=CSharedConfigStruct::DD_COPY_FLAG; GetResManager().LoadStringCopy(IDS_MENUCOPY_STRING, pCommand[0].szCommand, 128); @@ -699,11 +678,11 @@ case GC_EXPLORER: { g_pscsShared->iCommandCount=5; - g_pscsShared->uiFlags |= (rConfig.get_bool(PP_SHSHOWPASTE) ? CSharedConfigStruct::EC_PASTE_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWPASTESPECIAL) ? CSharedConfigStruct::EC_PASTESPECIAL_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWCOPYTO) ? CSharedConfigStruct::EC_COPYTO_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWMOVETO) ? CSharedConfigStruct::EC_MOVETO_FLAG : 0) - | (rConfig.get_bool(PP_SHSHOWCOPYMOVETO) ? CSharedConfigStruct::EC_COPYMOVETOSPECIAL_FLAG : 0); + g_pscsShared->uiFlags |= (GetPropValue(rConfig) ? CSharedConfigStruct::EC_PASTE_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::EC_PASTESPECIAL_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::EC_COPYTO_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::EC_MOVETO_FLAG : 0) + | (GetPropValue(rConfig) ? CSharedConfigStruct::EC_COPYMOVETOSPECIAL_FLAG : 0); pCommand[0].uiCommandID=CSharedConfigStruct::EC_PASTE_FLAG; GetResManager().LoadStringCopy(IDS_MENUPASTE_STRING, pCommand[0].szCommand, 128); @@ -722,15 +701,8 @@ GetResManager().LoadStringCopy(IDS_MENUTIPCOPYMOVETOSPECIAL_STRING, pCommand[4].szDesc, 128); // prepare shortcuts - char_vector cvShortcuts; - const tchar_t* pszPath = NULL; - size_t stCount = rConfig.get_value_count(PP_SHORTCUTS); - for(size_t stIndex = 0; stIndex < stCount; stIndex++) - { - pszPath = rConfig.get_string(PP_SHORTCUTS, stIndex); - if(pszPath) - cvShortcuts.push_back(pszPath); - } + std::vector cvShortcuts; + GetPropValue(rConfig, cvShortcuts); // count of shortcuts to store g_pscsShared->iShortcutsCount = boost::numeric_cast(std::min(cvShortcuts.size(), (SHARED_BUFFERSIZE - 5 * sizeof(_COMMAND)) / sizeof(_SHORTCUT))); @@ -814,14 +786,14 @@ void CMainWnd::OnPopupMonitoring() { // change flag in config - GetConfig().set_bool(PP_PCLIPBOARDMONITORING, !GetConfig().get_bool(PP_PCLIPBOARDMONITORING)); - GetConfig().write(NULL); + SetPropValue(GetConfig(), !GetPropValue(GetConfig())); + GetConfig().Write(); } void CMainWnd::OnPopupShutafterfinished() { - GetConfig().set_bool(PP_PSHUTDOWNAFTREFINISHED, !GetConfig().get_bool(PP_PSHUTDOWNAFTREFINISHED)); - GetConfig().write(NULL); + SetPropValue(GetConfig(), !GetPropValue(GetConfig())); + GetConfig().Write(); } void CMainWnd::OnPopupRegisterdll() Index: src/ch/MiniViewDlg.cpp =================================================================== diff -u -r61ed5f2f3084ba759ec27f61b4f909ed8ce305e9 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision 61ed5f2f3084ba759ec27f61b4f909ed8ce305e9) +++ src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -131,7 +131,7 @@ RefreshStatus(); - SetTimer(9843, (UINT)GetConfig().get_signed_num(PP_MVREFRESHINTERVAL), NULL); + SetTimer(9843, GetPropValue(GetConfig()), NULL); } CLanguageDialog::OnTimer(nIDEvent); @@ -179,7 +179,7 @@ int index=0; _PROGRESSITEM_* pItem=NULL; - if(GetConfig().get_bool(PP_MVSHOWSINGLETASKS)) + if(GetPropValue(GetConfig())) { for(size_t stIndex = 0; stIndex < m_pTasks->GetSize(); ++stIndex) { @@ -213,10 +213,10 @@ { if (m_bShown) { - if (GetConfig().get_bool(PP_MVAUTOHIDEWHENEMPTY) || *m_pbHide) + if (GetPropValue(GetConfig()) || *m_pbHide) HideWindow(); } - else if (!GetConfig().get_bool(PP_MVAUTOHIDEWHENEMPTY) && !(*m_pbHide)) + else if (!GetPropValue(GetConfig()) && !(*m_pbHide)) { // need to be visible ShowWindow(); @@ -248,10 +248,10 @@ pItem->m_spTask.reset(); // get rid of the rest - m_ctlStatus.SetSmoothProgress(GetConfig().get_bool(PP_MVUSESMOOTHPROGRESS)); + m_ctlStatus.SetSmoothProgress(GetPropValue(GetConfig())); m_ctlStatus.UpdateItems(index, true); - m_ctlStatus.SetShowCaptions(GetConfig().get_bool(PP_MVSHOWFILENAMES)); + m_ctlStatus.SetShowCaptions(GetPropValue(GetConfig())); // calc size RecalcSize(0, bInitial); @@ -268,7 +268,7 @@ RefreshStatus(); // set refresh timer - SetTimer(9843, (UINT)GetConfig().get_signed_num(PP_MVREFRESHINTERVAL), NULL); + SetTimer(9843, GetPropValue(GetConfig()), NULL); return static_cast(0); } @@ -611,7 +611,7 @@ int iSel=pDlg->m_ctlStatus.GetCurSel(); if (iSel == LB_ERR || (size_t)iSel >= pDlg->m_ctlStatus.m_vItems.size()) return; - CTaskPtr spTask = pDlg->m_ctlStatus.m_vItems.at(iSel)->m_spTask; + CTaskPtr spTask = pDlg->m_ctlStatus.m_vItems.at(iSel)->m_spTask; if(spTask) spTask->RestartProcessing(); else Index: src/ch/OptionsDlg.cpp =================================================================== diff -u -r7d6b4eae7b58d17c4b554c25cc4cff875bd53161 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 7d6b4eae7b58d17c4b554c25cc4cff875bd53161) +++ src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -102,26 +102,13 @@ m_ctlProperties.Init(); // copy shortcut and recent paths - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); - m_cvRecent.clear(true); - size_t stSize = rConfig.get_value_count(PP_RECENTPATHS); - const tchar_t* pszPath = NULL; - for(size_t stIndex = 0; stIndex < stSize; stIndex++) - { - pszPath = rConfig.get_string(PP_RECENTPATHS, stIndex); - if(pszPath) - m_cvRecent.push_back(pszPath); - } + m_cvRecent.clear(); + GetPropValue(rConfig, m_cvRecent); - m_cvShortcuts.clear(true); - stSize = rConfig.get_value_count(PP_SHORTCUTS); - for(size_t stIndex = 0; stIndex < stSize; stIndex++) - { - pszPath = rConfig.get_string(PP_SHORTCUTS, stIndex); - if(pszPath) - m_cvShortcuts.push_back(pszPath); - } + m_cvShortcuts.clear(); + GetPropValue(rConfig, m_cvShortcuts); _tcscpy(m_szLangPath, _T("\\Langs\\")); GetApp().ExpandPath(m_szLangPath); @@ -180,13 +167,12 @@ COptionsDlg* pDlg=static_cast(lpParam); CShortcutsDlg dlg; - dlg.m_cvShortcuts.assign(pDlg->m_cvShortcuts.begin(), pDlg->m_cvShortcuts.end(), true, true); + dlg.m_cvShortcuts = pDlg->m_cvShortcuts; dlg.m_pcvRecent=&pDlg->m_cvRecent; if (dlg.DoModal() == IDOK) { // restore shortcuts to pDlg->cvShortcuts - pDlg->m_cvShortcuts.assign(dlg.m_cvShortcuts.begin(), dlg.m_cvShortcuts.end(), true, false); - dlg.m_cvShortcuts.erase(dlg.m_cvShortcuts.begin(), dlg.m_cvShortcuts.end(), false); + pDlg->m_cvShortcuts = dlg.m_cvShortcuts; // property list TCHAR szBuf[32]; @@ -201,12 +187,11 @@ COptionsDlg* pDlg=static_cast(lpParam); CRecentDlg dlg; - dlg.m_cvRecent.assign(pDlg->m_cvRecent.begin(), pDlg->m_cvRecent.end(), true, true); + dlg.m_cvRecent = pDlg->m_cvRecent; if (dlg.DoModal() == IDOK) { // restore - pDlg->m_cvRecent.assign(dlg.m_cvRecent.begin(), dlg.m_cvRecent.end(), true, false); - dlg.m_cvRecent.erase(dlg.m_cvRecent.begin(), dlg.m_cvRecent.end(), false); + pDlg->m_cvRecent = dlg.m_cvRecent; // property list TCHAR szBuf[32]; @@ -233,16 +218,16 @@ // load settings PROP_SEPARATOR(IDS_PROGRAM_STRING); - PROP_BOOL(IDS_CLIPBOARDMONITORING_STRING, GetConfig().get_bool(PP_PCLIPBOARDMONITORING)); - PROP_UINT(IDS_CLIPBOARDINTERVAL_STRING, GetConfig().get_signed_num(PP_PMONITORSCANINTERVAL)); - PROP_BOOL(IDS_AUTORUNPROGRAM_STRING, GetConfig().get_bool(PP_PRELOADAFTERRESTART)); - PROP_COMBO(IDS_CFG_CHECK_FOR_UPDATES_FREQUENCY, IDS_UPDATE_FREQUENCIES, GetConfig().get_unsigned_num(PP_PCHECK_FOR_UPDATES_FREQUENCY)); - PROP_BOOL(IDS_CFG_UPDATE_CHECK_FOR_BETA, GetConfig().get_bool(PP_PUPDATE_CHECK_FOR_BETA)); - PROP_BOOL(IDS_AUTOSHUTDOWN_STRING, GetConfig().get_bool(PP_PSHUTDOWNAFTREFINISHED)); - PROP_UINT(IDS_SHUTDOWNTIME_STRING, GetConfig().get_signed_num(PP_PTIMEBEFORESHUTDOWN)); - PROP_COMBO(IDS_FORCESHUTDOWN_STRING, IDS_FORCESHUTDOWNVALUES_STRING, GetConfig().get_bool(PP_PFORCESHUTDOWN) ? 1 : 0); - PROP_UINT(IDS_AUTOSAVEINTERVAL_STRING, GetConfig().get_signed_num(PP_PAUTOSAVEINTERVAL)); - PROP_COMBO(IDS_CFGPRIORITYCLASS_STRING, IDS_CFGPRIORITYCLASSITEMS_STRING, PriorityClassToIndex(boost::numeric_cast(GetConfig().get_signed_num(PP_PPROCESSPRIORITYCLASS)))); + PROP_BOOL(IDS_CLIPBOARDMONITORING_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_CLIPBOARDINTERVAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_AUTORUNPROGRAM_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_CFG_CHECK_FOR_UPDATES_FREQUENCY, IDS_UPDATE_FREQUENCIES, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFG_UPDATE_CHECK_FOR_BETA, GetPropValue(GetConfig())); + PROP_BOOL(IDS_AUTOSHUTDOWN_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_SHUTDOWNTIME_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_FORCESHUTDOWN_STRING, IDS_FORCESHUTDOWNVALUES_STRING, GetPropValue(GetConfig()) ? 1 : 0); + PROP_UINT(IDS_AUTOSAVEINTERVAL_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_CFGPRIORITYCLASS_STRING, IDS_CFGPRIORITYCLASSITEMS_STRING, PriorityClassToIndex(boost::numeric_cast(GetPropValue(GetConfig())))); PROP_DIR(IDS_TEMPFOLDER_STRING, IDS_TEMPFOLDERCHOOSE_STRING, strPath); // lang @@ -261,75 +246,71 @@ ///////////////// PROP_SEPARATOR(IDS_STATUSWINDOW_STRING); - PROP_UINT(IDS_REFRESHSTATUSINTERVAL_STRING, GetConfig().get_signed_num(PP_STATUSREFRESHINTERVAL)); - PROP_BOOL(IDS_STATUSSHOWDETAILS_STRING, GetConfig().get_bool(PP_STATUSSHOWDETAILS)); - PROP_BOOL(IDS_STATUSAUTOREMOVE_STRING, GetConfig().get_bool(PP_STATUSAUTOREMOVEFINISHED)); + PROP_UINT(IDS_REFRESHSTATUSINTERVAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_STATUSSHOWDETAILS_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_STATUSAUTOREMOVE_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_MINIVIEW_STRING); - PROP_BOOL(IDS_SHOWFILENAMES_STRING, GetConfig().get_bool(PP_MVSHOWFILENAMES)); - PROP_BOOL(IDS_SHOWSINGLETASKS_STRING, GetConfig().get_bool(PP_MVSHOWSINGLETASKS)); - PROP_UINT(IDS_MINIVIEWREFRESHINTERVAL_STRING, GetConfig().get_signed_num(PP_MVREFRESHINTERVAL)); - PROP_BOOL(IDS_MINIVIEWSHOWAFTERSTART_STRING, GetConfig().get_bool(PP_MVAUTOSHOWWHENRUN)); - PROP_BOOL(IDS_MINIVIEWAUTOHIDE_STRING, GetConfig().get_bool(PP_MVAUTOHIDEWHENEMPTY)); - PROP_BOOL(IDS_MINIVIEWSMOOTHPROGRESS_STRING, GetConfig().get_bool(PP_MVUSESMOOTHPROGRESS)); + PROP_BOOL(IDS_SHOWFILENAMES_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_SHOWSINGLETASKS_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_MINIVIEWREFRESHINTERVAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_MINIVIEWSHOWAFTERSTART_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_MINIVIEWAUTOHIDE_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_MINIVIEWSMOOTHPROGRESS_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_CFGFOLDERDIALOG_STRING); - PROP_BOOL(IDS_CFGFDEXTVIEW_STRING, GetConfig().get_bool(PP_FDEXTENDEDVIEW)); - PROP_UINT(IDS_CFGFDWIDTH_STRING, GetConfig().get_signed_num(PP_FDWIDTH)); - PROP_UINT(IDS_CFGFDHEIGHT_STRING, GetConfig().get_signed_num(PP_FDHEIGHT)); - PROP_COMBO(IDS_CFGFDSHORTCUTS_STRING, IDS_CFGFDSHORTCUTSSTYLES_STRING, GetConfig().get_signed_num(PP_FDSHORTCUTLISTSTYLE)); - PROP_BOOL(IDS_CFGFDIGNOREDIALOGS_STRING, GetConfig().get_bool(PP_FDIGNORESHELLDIALOGS)); + PROP_BOOL(IDS_CFGFDEXTVIEW_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_CFGFDWIDTH_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_CFGFDHEIGHT_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_CFGFDSHORTCUTS_STRING, IDS_CFGFDSHORTCUTSSTYLES_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGFDIGNOREDIALOGS_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_CFGSHELL_STRING); - PROP_BOOL(IDS_CFGSHCOPY_STRING, GetConfig().get_bool(PP_SHSHOWCOPY)); - PROP_BOOL(IDS_CFGSHMOVE_STRING, GetConfig().get_bool(PP_SHSHOWMOVE)); - PROP_BOOL(IDS_CFGSHCMSPECIAL_STRING, GetConfig().get_bool(PP_SHSHOWCOPYMOVE)); - PROP_BOOL(IDS_CFGSHPASTE_STRING, GetConfig().get_bool(PP_SHSHOWPASTE)); - PROP_BOOL(IDS_CFGSHPASTESPECIAL_STRING, GetConfig().get_bool(PP_SHSHOWPASTESPECIAL)); - PROP_BOOL(IDS_CFGSHCOPYTO_STRING, GetConfig().get_bool(PP_SHSHOWCOPYTO)); - PROP_BOOL(IDS_CFGSHMOVETO_STRING, GetConfig().get_bool(PP_SHSHOWMOVETO)); - PROP_BOOL(IDS_CFGSHCMTOSPECIAL_STRING, GetConfig().get_bool(PP_SHSHOWCOPYMOVETO)); - PROP_BOOL(IDS_CFGSHSHOWFREESPACE_STRING, GetConfig().get_bool(PP_SHSHOWFREESPACE)); - PROP_BOOL(IDS_CFGSHSHOWICONS_STRING, GetConfig().get_bool(PP_SHSHOWSHELLICONS)); - PROP_BOOL(IDS_CFGSHINTERCEPTDRAG_STRING, GetConfig().get_bool(PP_SHINTERCEPTDRAGDROP)); - PROP_BOOL(IDS_CFGINTERCEPTKEYACTION_STRING, GetConfig().get_bool(PP_SHINTERCEPTKEYACTIONS)); - PROP_BOOL(IDS_CFGINTERCEPTCONTEXTMENU_STRING, GetConfig().get_bool(PP_SHINTERCEPTCTXMENUACTIONS)); + PROP_BOOL(IDS_CFGSHCOPY_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHMOVE_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHCMSPECIAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHPASTE_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHPASTESPECIAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHCOPYTO_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHMOVETO_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHCMTOSPECIAL_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHSHOWFREESPACE_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHSHOWICONS_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGSHINTERCEPTDRAG_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGINTERCEPTKEYACTION_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_CFGINTERCEPTCONTEXTMENU_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_PROCESSINGTHREAD_STRING); - PROP_BOOL(IDS_SETDESTATTRIB_STRING, GetConfig().get_bool(PP_CMSETDESTATTRIBUTES)); - PROP_BOOL(IDS_SETDESTTIME_STRING, GetConfig().get_bool(PP_CMSETDESTDATE)); - PROP_BOOL(IDS_PROTECTROFILES_STRING, GetConfig().get_bool(PP_CMPROTECTROFILES)); - PROP_UINT(IDS_LIMITOPERATIONS_STRING, GetConfig().get_signed_num(PP_CMLIMITMAXOPERATIONS)); - PROP_BOOL(IDS_READSIZEBEFOREBLOCK_STRING, GetConfig().get_bool(PP_CMREADSIZEBEFOREBLOCKING)); - PROP_COMBO(IDS_DEFAULTPRIORITY_STRING, MakeCompoundString(IDS_PRIORITY0_STRING, 7, _T("!")), PriorityToIndex(boost::numeric_cast(GetConfig().get_signed_num(PP_CMDEFAULTPRIORITY)))); - PROP_BOOL(IDS_CFGDISABLEPRIORITYBOOST_STRING, GetConfig().get_bool(PP_CMDISABLEPRIORITYBOOST)); - PROP_BOOL(IDS_DELETEAFTERFINISHED_STRING, GetConfig().get_bool(PP_CMDELETEAFTERFINISHED)); + PROP_BOOL(IDS_SETDESTATTRIB_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_SETDESTTIME_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_PROTECTROFILES_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_LIMITOPERATIONS_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_READSIZEBEFOREBLOCK_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_DEFAULTPRIORITY_STRING, MakeCompoundString(IDS_PRIORITY0_STRING, 7, _T("!")), PriorityToIndex(boost::numeric_cast(GetPropValue(GetConfig())))); + PROP_BOOL(IDS_CFGDISABLEPRIORITYBOOST_STRING, GetPropValue(GetConfig())); + PROP_BOOL(IDS_DELETEAFTERFINISHED_STRING, GetPropValue(GetConfig())); // Buffer PROP_SEPARATOR(IDS_OPTIONSBUFFER_STRING); - PROP_BOOL(IDS_AUTODETECTBUFFERSIZE_STRING, GetConfig().get_bool(PP_BFUSEONLYDEFAULT)); - PROP_CUSTOM_UINT(IDS_DEFAULTBUFFERSIZE_STRING, GetConfig().get_signed_num(PP_BFDEFAULT), &CustomPropertyCallbackProc, 0); - PROP_CUSTOM_UINT(IDS_ONEDISKBUFFERSIZE_STRING, GetConfig().get_signed_num(PP_BFONEDISK), &CustomPropertyCallbackProc, 1); - PROP_CUSTOM_UINT(IDS_TWODISKSBUFFERSIZE_STRING, GetConfig().get_signed_num(PP_BFTWODISKS), &CustomPropertyCallbackProc, 2); - PROP_CUSTOM_UINT(IDS_CDBUFFERSIZE_STRING, GetConfig().get_signed_num(PP_BFCD), &CustomPropertyCallbackProc, 3); - PROP_CUSTOM_UINT(IDS_LANBUFFERSIZE_STRING, GetConfig().get_signed_num(PP_BFLAN), &CustomPropertyCallbackProc, 4); - PROP_BOOL(IDS_USENOBUFFERING_STRING, GetConfig().get_bool(PP_BFUSENOBUFFERING)); - PROP_UINT(IDS_LARGEFILESMINSIZE_STRING, GetConfig().get_signed_num(PP_BFBOUNDARYLIMIT)); + PROP_BOOL(IDS_AUTODETECTBUFFERSIZE_STRING, GetPropValue(GetConfig())); + PROP_CUSTOM_UINT(IDS_DEFAULTBUFFERSIZE_STRING, GetPropValue(GetConfig()), &CustomPropertyCallbackProc, 0); + PROP_CUSTOM_UINT(IDS_ONEDISKBUFFERSIZE_STRING, GetPropValue(GetConfig()), &CustomPropertyCallbackProc, 1); + PROP_CUSTOM_UINT(IDS_TWODISKSBUFFERSIZE_STRING, GetPropValue(GetConfig()), &CustomPropertyCallbackProc, 2); + PROP_CUSTOM_UINT(IDS_CDBUFFERSIZE_STRING, GetPropValue(GetConfig()), &CustomPropertyCallbackProc, 3); + PROP_CUSTOM_UINT(IDS_LANBUFFERSIZE_STRING, GetPropValue(GetConfig()), &CustomPropertyCallbackProc, 4); + PROP_BOOL(IDS_USENOBUFFERING_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_LARGEFILESMINSIZE_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_CFGLOGFILE_STRING); - PROP_BOOL(IDS_CFGENABLELOGGING_STRING, GetConfig().get_bool(PP_LOGENABLELOGGING)); - PROP_UINT(IDS_CFGMAXLIMIT_STRING, GetConfig().get_signed_num(PP_LOGMAXSIZE)); - PROP_COMBO(IDS_CFGLOGLEVEL, IDS_CFGLOGLEVEL_VALUES, GetConfig().get_unsigned_num(PP_LOGLEVEL)); + PROP_BOOL(IDS_CFGENABLELOGGING_STRING, GetPropValue(GetConfig())); + PROP_UINT(IDS_CFGMAXLIMIT_STRING, GetPropValue(GetConfig())); + PROP_COMBO(IDS_CFGLOGLEVEL, IDS_CFGLOGLEVEL_VALUES, GetPropValue(GetConfig())); // Sounds PROP_SEPARATOR(IDS_SOUNDS_STRING); - PROP_BOOL(IDS_PLAYSOUNDS_STRING, GetConfig().get_bool(PP_SNDPLAYSOUNDS)); - GetConfig().get_string(PP_SNDERRORSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); - strPath.ReleaseBuffer(); - PROP_PATH(IDS_SOUNDONERROR_STRING, IDS_SOUNDSWAVFILTER_STRING, strPath); - GetConfig().get_string(PP_SNDFINISHEDSOUNDPATH, strPath.GetBuffer(_MAX_PATH), _MAX_PATH); - strPath.ReleaseBuffer(); - PROP_PATH(IDS_SOUNDONFINISH_STRING, IDS_SOUNDSWAVFILTER_STRING, strPath); + PROP_BOOL(IDS_PLAYSOUNDS_STRING, GetPropValue(GetConfig())); + PROP_PATH(IDS_SOUNDONERROR_STRING, IDS_SOUNDSWAVFILTER_STRING, GetPropValue(GetConfig())); + PROP_PATH(IDS_SOUNDONFINISH_STRING, IDS_SOUNDSWAVFILTER_STRING, GetPropValue(GetConfig())); PROP_SEPARATOR(IDS_CFGSHORTCUTS_STRING); PROP_CUSTOM_UINT(IDS_CFGSCCOUNT_STRING, m_cvShortcuts.size(), &ShortcutsPropertyCallbackProc, 0); @@ -343,115 +324,110 @@ // counter int iPosition=0; - icpf::config& rConfig = GetConfig(); + TConfig& rConfig = GetConfig(); + rConfig.DelayNotifications(); SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_PCLIPBOARDMONITORING, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_PMONITORSCANINTERVAL, GetUintProp(iPosition++)); - rConfig.set_bool(PP_PRELOADAFTERRESTART, GetBoolProp(iPosition++)); - rConfig.set_unsigned_num(PP_PCHECK_FOR_UPDATES_FREQUENCY, GetIndexProp(iPosition++)); - rConfig.set_bool(PP_PUPDATE_CHECK_FOR_BETA, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_PSHUTDOWNAFTREFINISHED, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_PTIMEBEFORESHUTDOWN, GetUintProp(iPosition++)); - rConfig.set_bool(PP_PFORCESHUTDOWN, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_PAUTOSAVEINTERVAL, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_PPROCESSPRIORITYCLASS, IndexToPriorityClass(GetIndexProp(iPosition++))); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetIndexProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, IndexToPriorityClass(GetIndexProp(iPosition++))); // language PCTSTR pszSrc=m_vld.at(GetIndexProp(iPosition++)).GetFilename(true); if (_tcsnicmp(pszSrc, GetApp().GetProgramPath(), _tcslen(GetApp().GetProgramPath())) == 0) { // replace the first part of path with TCHAR szData[_MAX_PATH]; _sntprintf(szData, _MAX_PATH, _T("%s"), pszSrc+_tcslen(GetApp().GetProgramPath())); - rConfig.set_string(PP_PLANGUAGE, szData); + SetPropValue(rConfig, szData); } else - rConfig.set_string(PP_PLANGUAGE, pszSrc); + SetPropValue(rConfig, pszSrc); SKIP_SEPARATOR(iPosition); - rConfig.set_signed_num(PP_STATUSREFRESHINTERVAL, GetUintProp(iPosition++)); - rConfig.set_bool(PP_STATUSSHOWDETAILS, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_STATUSAUTOREMOVEFINISHED, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_MVSHOWFILENAMES, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_MVSHOWSINGLETASKS, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_MVREFRESHINTERVAL, GetUintProp(iPosition++)); - rConfig.set_bool(PP_MVAUTOSHOWWHENRUN, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_MVAUTOHIDEWHENEMPTY, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_MVUSESMOOTHPROGRESS, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_FDEXTENDEDVIEW, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_FDWIDTH, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_FDHEIGHT, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_FDSHORTCUTLISTSTYLE, GetIndexProp(iPosition++)); - rConfig.set_bool(PP_FDIGNORESHELLDIALOGS, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetIndexProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_SHSHOWCOPY, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWMOVE, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWCOPYMOVE, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWPASTE, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWPASTESPECIAL, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWCOPYTO, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWMOVETO, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWCOPYMOVETO, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWFREESPACE, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHSHOWSHELLICONS, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHINTERCEPTDRAGDROP, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHINTERCEPTKEYACTIONS, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_SHINTERCEPTCTXMENUACTIONS, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_CMSETDESTATTRIBUTES, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_CMSETDESTDATE, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_CMPROTECTROFILES, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_CMLIMITMAXOPERATIONS, GetUintProp(iPosition++)); - rConfig.set_bool(PP_CMREADSIZEBEFOREBLOCKING, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_CMDEFAULTPRIORITY, IndexToPriority(GetIndexProp(iPosition++))); - rConfig.set_bool(PP_CMDISABLEPRIORITYBOOST, GetBoolProp(iPosition++)); - rConfig.set_bool(PP_CMDELETEAFTERFINISHED, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, IndexToPriority(GetIndexProp(iPosition++))); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); // Buffer SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_BFUSEONLYDEFAULT, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_BFDEFAULT, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_BFONEDISK, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_BFTWODISKS, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_BFCD, GetUintProp(iPosition++)); - rConfig.set_signed_num(PP_BFLAN, GetUintProp(iPosition++)); - rConfig.set_bool(PP_BFUSENOBUFFERING, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_BFBOUNDARYLIMIT, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); // log file SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_LOGENABLELOGGING, GetBoolProp(iPosition++)); - rConfig.set_signed_num(PP_LOGMAXSIZE, GetUintProp(iPosition++)); - rConfig.set_unsigned_num(PP_LOGLEVEL, GetIndexProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetUintProp(iPosition++)); + SetPropValue(rConfig, GetIndexProp(iPosition++)); // Sounds SKIP_SEPARATOR(iPosition); - rConfig.set_bool(PP_SNDPLAYSOUNDS, GetBoolProp(iPosition++)); - rConfig.set_string(PP_SNDERRORSOUNDPATH, GetStringProp(iPosition++)); - rConfig.set_string(PP_SNDFINISHEDSOUNDPATH, GetStringProp(iPosition++)); + SetPropValue(rConfig, GetBoolProp(iPosition++)); + SetPropValue(rConfig, GetStringProp(iPosition++)); + SetPropValue(rConfig, GetStringProp(iPosition++)); // shortcuts & recent paths SKIP_SEPARATOR(iPosition); - rConfig.clear_array_values(PP_SHORTCUTS); - for(char_vector::iterator it = m_cvShortcuts.begin(); it != m_cvShortcuts.end(); it++) - { - rConfig.set_string(PP_SHORTCUTS, (*it), icpf::property::action_add); - } - + SetPropValue(rConfig, m_cvShortcuts); + SKIP_SEPARATOR(iPosition); - rConfig.clear_array_values(PP_RECENTPATHS); - for(char_vector::iterator it = m_cvRecent.begin(); it != m_cvRecent.end(); it++) - { - rConfig.set_string(PP_RECENTPATHS, (*it), icpf::property::action_add); - } + SetPropValue(rConfig, m_cvRecent); - rConfig.write(NULL); + rConfig.ResumeNotifications(); + + rConfig.Write(); } void COptionsDlg::OnCancel() Index: src/ch/OptionsDlg.h =================================================================== diff -u -r449a5b399ab21ca0d06050b47b264f2f704af966 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/OptionsDlg.h (.../OptionsDlg.h) (revision 449a5b399ab21ca0d06050b47b264f2f704af966) +++ src/ch/OptionsDlg.h (.../OptionsDlg.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -20,7 +20,6 @@ #define __OPTIONSDLG_H__ #include "PropertyListCtrl.h" -#include "charvect.h" #define WM_CONFIGNOTIFY WM_USER+13 @@ -38,8 +37,8 @@ static bool m_bLock; // locker - char_vector m_cvRecent; - char_vector m_cvShortcuts; + std::vector m_cvRecent; + std::vector m_cvShortcuts; // for languages vector m_vld; Index: src/ch/RecentDlg.cpp =================================================================== diff -u -r9352ed0c4fe447a36bc728640c307be6d41455fd -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/RecentDlg.cpp (.../RecentDlg.cpp) (revision 9352ed0c4fe447a36bc728640c307be6d41455fd) +++ src/ch/RecentDlg.cpp (.../RecentDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -138,7 +138,7 @@ return; // add to a table - m_cvRecent.push_back((const PTSTR)(LPCTSTR)m_strPath, true); + m_cvRecent.push_back(m_strPath); // add to list with an icon SHFILEINFO sfi; @@ -162,7 +162,7 @@ return; // array update - m_cvRecent.replace(m_cvRecent.begin()+iPos, (const PTSTR)(LPCTSTR)m_strPath, true, true); + m_cvRecent[iPos] = m_strPath; // list SHFILEINFO sfi; @@ -180,8 +180,8 @@ int iPos=-1; while (pos) { - iPos=m_ctlRecent.GetNextSelectedItem(pos); - m_cvRecent.erase(m_cvRecent.begin()+iPos, true); + iPos = m_ctlRecent.GetNextSelectedItem(pos); + m_cvRecent.erase(m_cvRecent.begin() + iPos); m_ctlRecent.DeleteItem(iPos); } Index: src/ch/RecentDlg.h =================================================================== diff -u -r449a5b399ab21ca0d06050b47b264f2f704af966 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/RecentDlg.h (.../RecentDlg.h) (revision 449a5b399ab21ca0d06050b47b264f2f704af966) +++ src/ch/RecentDlg.h (.../RecentDlg.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -19,8 +19,6 @@ #ifndef __RECENTDLG_H__ #define __RECENTDLG_H__ -#include "charvect.h" - ///////////////////////////////////////////////////////////////////////////// // CRecentDlg dialog @@ -47,7 +45,7 @@ // Implementation public: - char_vector m_cvRecent; + std::vector m_cvRecent; HIMAGELIST m_himl, m_hliml; protected: Index: src/ch/ShortcutsDlg.cpp =================================================================== diff -u -r9352ed0c4fe447a36bc728640c307be6d41455fd -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/ShortcutsDlg.cpp (.../ShortcutsDlg.cpp) (revision 9352ed0c4fe447a36bc728640c307be6d41455fd) +++ src/ch/ShortcutsDlg.cpp (.../ShortcutsDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -112,7 +112,7 @@ for(size_t stIndex = 0; stIndex < m_pcvRecent->size(); ++stIndex) { cbi.iItem = stIndex; - cbi.pszText = m_pcvRecent->at(stIndex); + cbi.pszText = const_cast((PCTSTR)m_pcvRecent->at(stIndex)); sfi.iIcon = -1; SHGetFileInfo(cbi.pszText, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); cbi.iImage = sfi.iIcon; @@ -242,7 +242,7 @@ m_ctlPath.GetWindowText(sc.m_strPath); // add to an array - m_cvShortcuts.push_back((const PTSTR)(LPCTSTR)(CString)sc, true); + m_cvShortcuts.push_back((CString)sc); // add with an icon SHFILEINFO sfi; @@ -268,7 +268,7 @@ m_ctlPath.GetWindowText(sc.m_strPath); // array update - m_cvShortcuts.replace(m_cvShortcuts.begin()+iPos, (const PTSTR)(LPCTSTR)(CString)sc, true, true); + m_cvShortcuts[iPos] = (CString)sc; // list SHFILEINFO sfi; @@ -289,7 +289,7 @@ while (pos) { iPos=m_ctlShortcuts.GetNextSelectedItem(pos); - m_cvShortcuts.erase(m_cvShortcuts.begin()+iPos, true); + m_cvShortcuts.erase(m_cvShortcuts.begin() + iPos); m_ctlShortcuts.DeleteItem(iPos); } @@ -319,7 +319,10 @@ break; // swap data in m_ascShortcuts - m_cvShortcuts.swap_items(m_cvShortcuts.begin()+iPos-1, m_cvShortcuts.begin()+iPos); + std::vector::iterator iterOne = m_cvShortcuts.begin() + iPos - 1; + std::vector::iterator iterTwo = m_cvShortcuts.begin()+iPos; + std::swap(iterOne, iterTwo); + //m_cvShortcuts.swap(); // do the same with list SHFILEINFO sfi; @@ -356,8 +359,11 @@ break; // swap data in m_ascShortcuts - m_cvShortcuts.swap_items(m_cvShortcuts.begin()+iPos, m_cvShortcuts.begin()+iPos+1); + std::vector::iterator iterOne = m_cvShortcuts.begin() + iPos; + std::vector::iterator iterTwo = m_cvShortcuts.begin() + iPos + 1; + std::swap(iterOne, iterTwo); + // do the same with list SHFILEINFO sfi; sfi.iIcon=-1; Index: src/ch/StatusDlg.cpp =================================================================== diff -u -r044d0e17cdedf3055202486a2235e1a3c8dd6e56 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 044d0e17cdedf3055202486a2235e1a3c8dd6e56) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -170,7 +170,7 @@ }; // refresh data timer - SetTimer(777, (UINT)GetConfig().get_signed_num(PP_STATUSREFRESHINTERVAL), NULL); + SetTimer(777, GetPropValue(GetConfig()), NULL); return TRUE; } @@ -209,7 +209,7 @@ RefreshStatus(); // reenable - SetTimer(777, (UINT)GetConfig().get_signed_num(PP_STATUSREFRESHINTERVAL), NULL); + SetTimer(777, GetPropValue(GetConfig()), NULL); } CLanguageDialog::OnTimer(nIDEvent); @@ -266,7 +266,7 @@ m_ctlStatusList.SetItem(&lvi); // right side update - if(spTask == m_spSelectedItem && GetConfig().get_bool(PP_STATUSSHOWDETAILS)) + if(spTask == m_spSelectedItem && GetPropValue(GetConfig())) { // data that can be changed by a thread GetDlgItem(IDC_OPERATION_STATIC)->SetWindowText(td.m_szStatusText); // operation @@ -353,7 +353,7 @@ void CStatusDlg::OnRollUnrollButton() { // change settings in config dialog - GetConfig().set_bool(PP_STATUSSHOWDETAILS, !GetConfig().get_bool(PP_STATUSSHOWDETAILS)); + SetPropValue(GetConfig(), !GetPropValue(GetConfig())); ApplyDisplayDetails(); } @@ -365,7 +365,7 @@ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0); GetWindowRect(&rect); - bool bDetails=GetConfig().get_bool(PP_STATUSSHOWDETAILS); + bool bDetails=GetPropValue(GetConfig()); // stick cause if (rect.right == rcScreen.right && rect.bottom == rcScreen.bottom) @@ -644,21 +644,21 @@ int CStatusDlg::GetImageFromStatus(ETaskCurrentState eState) { - switch(eState) - { - case eTaskState_Cancelled: - return 4; - case eTaskState_Finished: - return 3; - case eTaskState_Waiting: - return 5; - case eTaskState_Paused: - return 2; - case eTaskState_Error: - return 1; - default: - return 0; - } + switch(eState) + { + case eTaskState_Cancelled: + return 4; + case eTaskState_Finished: + return 3; + case eTaskState_Waiting: + return 5; + case eTaskState_Paused: + return 2; + case eTaskState_Error: + return 1; + default: + return 0; + } } LPTSTR CStatusDlg::FormatTime(time_t timeSeconds, LPTSTR lpszBuffer, size_t stMaxBufferSize) @@ -715,7 +715,7 @@ SetWindowText(m_szData); // refresh overall progress - if (GetConfig().get_bool(PP_STATUSSHOWDETAILS)) + if (GetPropValue(GetConfig())) { m_ctlProgressAll.SetPos(nPercent); Index: src/ch/TConfig.cpp =================================================================== diff -u --- src/ch/TConfig.cpp (revision 0) +++ src/ch/TConfig.cpp (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -0,0 +1,428 @@ +// ============================================================================ +// Copyright (C) 2001-2010 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +/// @file TConfig.cpp +/// @date 2010/09/27 +/// @brief Contains implementations of classes related to configuration handling. +// ============================================================================ +#include "stdafx.h" +#include "TConfig.h" +#pragma warning(push) +#pragma warning(disable: 4702) +#include +#pragma warning(pop) + +/////////////////////////////////////////////////////////////////////////////////////////////// +// class TConfigNotifier + +TConfigNotifier::TConfigNotifier(void (*pfnCallback)(const std::set&, void*), void* pParam) : + m_pfnCallback(pfnCallback), + m_pParam(pParam) +{ +} + +TConfigNotifier::~TConfigNotifier() +{ +} + +void TConfigNotifier::operator()(const std::set& rsetPropNames) +{ + if(!m_pfnCallback) + THROW(_T("Invalid pointer"), 0, 0, 0); + + (*m_pfnCallback)(rsetPropNames, m_pParam); +} + +TConfigNotifier& TConfigNotifier::operator=(const TConfigNotifier& rNotifier) +{ + if(this != &rNotifier) + { + m_pfnCallback = rNotifier.m_pfnCallback; + m_pParam = rNotifier.m_pParam; + } + return *this; +} + +bool TConfigNotifier::operator==(const TConfigNotifier& rNotifier) const +{ + return m_pfnCallback == rNotifier.m_pfnCallback/* && m_pParam == rNotifier.m_pParam*/; +} + +///////////////////////////////////////////////////////////////////////////////////////////// +// class TConfig + +TConfig::TConfig() : + m_bDelayedEnabled(false) +{ +} + +TConfig::~TConfig() +{ +} + +// read/write +void TConfig::Read(const CString& strFile) +{ + m_strFilePath = strFile; + std::wifstream ifs(m_strFilePath, ios_base::in); + + boost::unique_lock lock(m_lock); + + try + { + boost::property_tree::xml_parser::read_xml(ifs, m_propTree); + } + catch(...) + { + m_propTree.clear(); + throw; + } +} + +void TConfig::Write() +{ + std::wofstream ofs(m_strFilePath, ios_base::out); + + boost::shared_lock lock(m_lock); + boost::property_tree::xml_parser::write_xml(ofs, m_propTree); +} + +void TConfig::Clear() +{ + boost::unique_lock lock(m_lock); + m_propTree.clear(); +} + +// value setting/retrieval +bool TConfig::GetBool(PCTSTR pszPropName, bool bDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, bDefault); +} + +bool TConfig::GetValue(PCTSTR pszPropName, bool& bValue, bool bDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + bValue = tValue.get(); + return true; + } + else + { + bValue = bDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, bool bValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, bValue); + + SendNotification(pszPropName); + return *this; +} + +int TConfig::GetInt(PCTSTR pszPropName, int iDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, iDefault); +} + + +bool TConfig::GetValue(PCTSTR pszPropName, int& iValue, int iDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + iValue = tValue.get(); + return true; + } + else + { + iValue = iDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, int iValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, iValue); + + SendNotification(pszPropName); + return *this; +} + +unsigned int TConfig::GetUInt(PCTSTR pszPropName, unsigned int uiDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, uiDefault); +} + +bool TConfig::GetValue(PCTSTR pszPropName, unsigned int& uiValue, unsigned int uiDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + uiValue = tValue.get(); + return true; + } + else + { + uiValue = uiDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, unsigned int uiValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, uiValue); + + SendNotification(pszPropName); + return *this; +} + +long long TConfig::GetLongLong(PCTSTR pszPropName, long long llDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, llDefault); +} + +bool TConfig::GetValue(PCTSTR pszPropName, long long& llValue, long long llDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + llValue = tValue.get(); + return true; + } + else + { + llValue = llDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, long long llValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, llValue); + + SendNotification(pszPropName); + return *this; +} + +unsigned long long TConfig::GetULongLong(PCTSTR pszPropName, unsigned long long ullDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, ullDefault); +} + +bool TConfig::GetValue(PCTSTR pszPropName, unsigned long long& ullValue, unsigned long long ullDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + ullValue = tValue.get(); + return true; + } + else + { + ullValue = ullDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, unsigned long long ullValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, ullValue); + + SendNotification(pszPropName); + return *this; +} + +double TConfig::GetDouble(PCTSTR pszPropName, double dDefault) const +{ + boost::shared_lock lock(m_lock); + return m_propTree.get(pszPropName, dDefault); +} + +bool TConfig::GetValue(PCTSTR pszPropName, double& dValue, double dDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + dValue = tValue.get(); + return true; + } + else + { + dValue = dDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, double dValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, dValue); + + SendNotification(pszPropName); + return *this; +} + +CString TConfig::GetString(PCTSTR pszPropName, const CString& strDefault) const +{ + boost::shared_lock lock(m_lock); + std::wstring wstrData = m_propTree.get(pszPropName, std::wstring(strDefault)); + return wstrData.c_str(); +} + +bool TConfig::GetValue(PCTSTR pszPropName, CString& rstrValue, const CString& strDefault) const +{ + boost::optional tValue = m_propTree.get_optional(pszPropName); + if(tValue.is_initialized()) + { + rstrValue = tValue.get().c_str(); + return true; + } + else + { + rstrValue = strDefault; + return false; + } +} + +TConfig& TConfig::SetValue(PCTSTR pszPropName, const CString& strValue) +{ + boost::unique_lock lock(m_lock); + m_propTree.put(pszPropName, std::wstring(strValue)); + + SendNotification(pszPropName); + return *this; +} + +bool TConfig::GetValue(PCTSTR pszPropName, std::vector& rvValues) const +{ + boost::shared_lock lock(m_lock); + bool bResult = false; + rvValues.clear(); + BOOST_FOREACH(const boost::property_tree::wiptree::value_type& rEntry, m_propTree.get_child(pszPropName)) + { + rvValues.push_back(rEntry.second.data().c_str()); + bResult = true; + } + + return bResult; +} + +bool TConfig::GetValue(PCTSTR pszPropName, std::vector& rvValues, const std::vector& rvDefault) const +{ + boost::shared_lock lock(m_lock); + rvValues.clear(); + + boost::optional children = m_propTree.get_child_optional(pszPropName); + if(children.is_initialized()) + { + BOOST_FOREACH(const boost::property_tree::wiptree::value_type& rEntry, children.get()) + { + rvValues.push_back(rEntry.second.data().c_str()); + } + + return true; + } + else + { + rvValues = rvDefault; + return false; + } +} + +void TConfig::SetValue(PCTSTR pszPropName, const std::vector& rvValues) +{ + boost::unique_lock lock(m_lock); + m_propTree.erase(pszPropName); + BOOST_FOREACH(const CString& strValue, rvValues) + { + m_propTree.add(pszPropName, (PCTSTR)strValue); + } + SendNotification(pszPropName); +} + +// extraction of subtrees +void TConfig::ExtractSubConfig(PCTSTR pszSubTreeName, TConfig& rSubConfig) const +{ + boost::unique_lock dst_lock(m_lock); + rSubConfig.Clear(); + + boost::shared_lock lock(m_lock); + + rSubConfig.m_propTree = m_propTree.get_child(pszSubTreeName); +} + +void TConfig::ConnectToNotifier(void (*pfnCallback)(const std::set&, void*), void* pParam) +{ + m_notifier.connect(TConfigNotifier(pfnCallback, pParam)); +} + +void TConfig::DisconnectFromNotifier(void (*pfnCallback)(const std::set&, void*)) +{ + m_notifier.disconnect(TConfigNotifier(pfnCallback, NULL)); +} + +void TConfig::DelayNotifications() +{ + m_bDelayedEnabled = true; +} + +void TConfig::ResumeNotifications() +{ + if(m_bDelayedEnabled) + { + m_bDelayedEnabled = false; + if(!m_setDelayedNotifications.empty()) + { + SendNotification(m_setDelayedNotifications); + m_setDelayedNotifications.clear(); + } + } +} + +void TConfig::SendNotification(const std::set& rsetInfo) +{ + if(m_bDelayedEnabled) + m_setDelayedNotifications.insert(rsetInfo.begin(), rsetInfo.end()); + else + m_notifier(rsetInfo); +} + +void TConfig::SendNotification(PCTSTR pszInfo) +{ + if(m_bDelayedEnabled) + m_setDelayedNotifications.insert(pszInfo); + else + { + std::set setData; + setData.insert(pszInfo); + m_notifier(setData); + } +} Index: src/ch/TConfig.h =================================================================== diff -u --- src/ch/TConfig.h (revision 0) +++ src/ch/TConfig.h (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -0,0 +1,119 @@ +// ============================================================================ +// Copyright (C) 2001-2010 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +/// @file TConfig.h +/// @date 2010/09/27 +/// @brief Contains declaration of classes related to configuration handling. +// ============================================================================ +#ifndef __TCONFIG_H__ +#define __TCONFIG_H__ + +#pragma warning(push) +#pragma warning(disable: 4100 4702) +#include +#include +#pragma warning(pop) + +class TConfigNotifier +{ +public: + TConfigNotifier(void (*pfnCallback)(const std::set&, void*), void* pParam); + ~TConfigNotifier(); + + void operator()(const std::set& rsetPropNames); + + TConfigNotifier& operator=(const TConfigNotifier& rNotifier); + + bool operator==(const TConfigNotifier& rNotifier) const; + +private: + void (*m_pfnCallback)(const std::set&, void*); + void* m_pParam; +}; + +class TConfig +{ +public: + TConfig(); + ~TConfig(); + + // read/write + void Read(const CString& strFile); + void Write(); + + void Clear(); + + // value setting/retrieval + bool GetBool(PCTSTR pszPropName, bool bDefault) const; + bool GetValue(PCTSTR pszPropName, bool& bValue, bool bDefault) const; + TConfig& SetValue(PCTSTR pszPropName, bool bValue); + + int GetInt(PCTSTR pszPropName, int iDefault) const; + bool GetValue(PCTSTR pszPropName, int& iValue, int iDefault) const; + TConfig& SetValue(PCTSTR pszPropName, int iValue); + + unsigned int GetUInt(PCTSTR pszPropName, unsigned int uiDefault) const; + bool GetValue(PCTSTR pszPropName, unsigned int& uiValue, unsigned int uiDefault) const; + TConfig& SetValue(PCTSTR pszPropName, unsigned int uiValue); + + long long GetLongLong(PCTSTR pszPropName, long long llDefault) const; + bool GetValue(PCTSTR pszPropName, long long& llValue, long long llDefault) const; + TConfig& SetValue(PCTSTR pszPropName, long long llValue); + + unsigned long long GetULongLong(PCTSTR pszPropName, unsigned long long ullDefault) const; + bool GetValue(PCTSTR pszPropName, unsigned long long& ullValue, unsigned long long ullDefault) const; + TConfig& SetValue(PCTSTR pszPropName, unsigned long long ullValue); + + double GetDouble(PCTSTR pszPropName, double dDefault) const; + bool GetValue(PCTSTR pszPropName, double& dValue, double dDefault) const; + TConfig& SetValue(PCTSTR pszPropName, double dValue); + + CString GetString(PCTSTR pszPropName, const CString& strDefault) const; + bool GetValue(PCTSTR pszPropName, CString& rstrValue, const CString& strDefault) const; + TConfig& SetValue(PCTSTR pszPropName, const CString& strValue); + + bool GetValue(PCTSTR pszPropName, std::vector& rvValues) const; + bool GetValue(PCTSTR pszPropName, std::vector& rvValues, const std::vector& rvDefault) const; + void SetValue(PCTSTR pszPropName, const std::vector& rvValues); + + // extraction of subtrees + void ExtractSubConfig(PCTSTR pszSubTreeName, TConfig& rSubConfig) const; + + // property change notification + void ConnectToNotifier(void (*pfnCallback)(const std::set&, void*), void* pParam); + void DisconnectFromNotifier(void (*pfnCallback)(const std::set&, void*)); + + void DelayNotifications(); + void ResumeNotifications(); + +protected: + void SendNotification(const std::set& rsetInfo); + void SendNotification(PCTSTR pszInfo); + +private: + boost::property_tree::wiptree m_propTree; + CString m_strFilePath; + + boost::signals2::signal&)> m_notifier; + std::set m_setDelayedNotifications; + bool m_bDelayedEnabled; + + mutable boost::shared_mutex m_lock; +}; + +#endif Index: src/ch/UpdaterDlg.cpp =================================================================== diff -u -r07a3be49b0c7e5599eb89c2f9da9a9272cc1558a -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision 07a3be49b0c7e5599eb89c2f9da9a9272cc1558a) +++ src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -54,7 +54,7 @@ ShowWindow(SW_SHOW); // start the updater - m_ucChecker.AsyncCheckForUpdates(_T(PRODUCT_SITE), GetConfig().get_bool(PP_PUPDATE_CHECK_FOR_BETA), m_bBackgroundMode); + m_ucChecker.AsyncCheckForUpdates(_T(PRODUCT_SITE), GetPropValue(GetConfig()), m_bBackgroundMode); // start a timer to display progress SetTimer(UPDATER_TIMER, 10, NULL); Index: src/ch/ch.cpp =================================================================== diff -u -rbeeac49d2e0888993bd231a4e5863c7f0741e154 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/ch.cpp (.../ch.cpp) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) +++ src/ch/ch.cpp (.../ch.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -36,8 +36,6 @@ static char THIS_FILE[] = __FILE__; #endif -icpf::config CCopyHandlerApp::m_config = icpf::config::eIni; - ///////////////////////////////////////////////////////////////////////////// // CCopyHandlerApp @@ -79,9 +77,9 @@ theApp.OnResManNotify(uiMsg); } -void ConfigPropertyChangedCallback(uint_t uiPropID, ptr_t /*pParam*/) +void ConfigPropertyChangedCallback(const std::set& setPropNames, void* /*pParam*/) { - theApp.OnConfigNotify(uiPropID); + theApp.OnConfigNotify(setPropNames); } CCopyHandlerApp::CCopyHandlerApp() : @@ -125,9 +123,10 @@ return ictranslate::CResourceManager::Acquire(); } -icpf::config& GetConfig() +TConfig& GetConfig() { - return CCopyHandlerApp::m_config; + static TConfig tCfg; + return tCfg; } int MsgBox(UINT uiID, UINT nType, UINT nIDHelp) @@ -156,7 +155,6 @@ ///////////////////////////////////////////////////////////////////////////// // CCopyHandlerApp initialization -#include "charvect.h" LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) { @@ -227,36 +225,30 @@ return FALSE; } - strCfgPath = strPath + _T("\\ch.ini"); + strCfgPath = strPath + _T("\\ch.xml"); // initialize configuration file - m_config.set_callback(ConfigPropertyChangedCallback, NULL); + TConfig& rCfg = GetConfig(); + rCfg.ConnectToNotifier(ConfigPropertyChangedCallback, NULL); // read the configuration try { - m_config.read(strCfgPath); + GetConfig().Read(strCfgPath); } catch(...) { } - // set working dir for the engine - icpf::config& rConfig = GetConfig(); - -// rConfig.SetBasePath(strPath); - // register all properties - RegisterProperties(&rConfig); - // ================================= Logging ======================================== // initialize the global log file if it is requested by configuration file strLogPath = strPath + + _T("\\ch.log"); chcore::TLogger& rLogger = chcore::TLogger::Acquire(); try { - rLogger.init(strLogPath, (int_t)m_config.get_signed_num(PP_LOGMAXSIZE), (int_t)rConfig.get_unsigned_num(PP_LOGLEVEL), false, false); - rLogger.Enable(m_config.get_bool(PP_LOGENABLELOGGING)); + rLogger.init(strLogPath, GetPropValue(rCfg), GetPropValue(rCfg), false, false); + rLogger.Enable(GetPropValue(rCfg)); } catch(...) { @@ -286,16 +278,14 @@ ictranslate::CResourceManager& rResManager = ictranslate::CResourceManager::Acquire(); // set current language - TCHAR szPath[_MAX_PATH]; - rResManager.Init(AfxGetInstanceHandle()); rResManager.SetCallback(ResManCallback); - rConfig.get_string(PP_PLANGUAGE, szPath, _MAX_PATH); - TRACE(_T("Help path=%s\n"), szPath); - if(!rResManager.SetLanguage(ExpandPath(szPath))) + GetPropValue(rCfg, strPath); + TRACE(_T("Help path=%s\n"), strPath); + if(!rResManager.SetLanguage(ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)))) { TCHAR szData[2048]; - _sntprintf(szData, 2048, _T("Couldn't find the language file specified in configuration file:\n%s\nPlease correct this path to point the language file to use.\nProgram will now exit."), szPath); + _sntprintf(szData, 2048, _T("Couldn't find the language file specified in configuration file:\n%s\nPlease correct this path to point the language file to use.\nProgram will now exit."), strPath); LOG_ERROR(szData); AfxMessageBox(szData, MB_ICONSTOP | MB_OK); return FALSE; @@ -379,11 +369,11 @@ // set this process priority class HANDLE hProcess=GetCurrentProcess(); - ::SetPriorityClass(hProcess, (DWORD)rConfig.get_signed_num(PP_PPROCESSPRIORITYCLASS)); + ::SetPriorityClass(hProcess, GetPropValue(rCfg)); #ifndef _DEBUG // for easier writing the program - doesn't collide with std CH // set "run with system" registry settings - SetAutorun(rConfig.get_bool(PP_PRELOADAFTERRESTART)); + SetAutorun(rCfg.GetBool(PP_PRELOADAFTERRESTART)); #endif // ================================= Main window ======================================== @@ -413,41 +403,38 @@ return false; } -void CCopyHandlerApp::OnConfigNotify(uint_t uiPropID) +void CCopyHandlerApp::OnConfigNotify(const std::set& setPropNames) { // is this language - switch(uiPropID) + if(setPropNames.find(PropData::GetPropertyName()) != setPropNames.end()) { - case PP_PLANGUAGE: - { - // update language in resource manager - TCHAR szPath[_MAX_PATH]; - GetConfig().get_string(PP_PLANGUAGE, szPath, _MAX_PATH); - GetResManager().SetLanguage(ExpandPath(szPath)); - break; - } - case PP_LOGENABLELOGGING: - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + // update language in resource manager + CString strPath; + GetPropValue(GetConfig(), strPath); + GetResManager().SetLanguage(ExpandPath(strPath.GetBufferSetLength(_MAX_PATH))); + strPath.ReleaseBuffer(); + } - rLogger.Enable(GetConfig().get_bool(PP_LOGENABLELOGGING)); - break; - } - case PP_LOGLEVEL: - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + if(setPropNames.find(PropData::GetPropertyName()) != setPropNames.end()) + { + chcore::TLogger& rLogger = chcore::TLogger::Acquire(); - rLogger.set_log_level((int_t)GetConfig().get_unsigned_num(PP_LOGLEVEL)); - break; - } - case PP_LOGMAXSIZE: - { - chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + rLogger.Enable(GetPropValue(GetConfig())); + } - rLogger.set_max_size((int_t)GetConfig().get_signed_num(PP_LOGMAXSIZE)); - break; - } + if(setPropNames.find(PropData::GetPropertyName()) != setPropNames.end()) + { + chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + + rLogger.set_log_level(GetPropValue(GetConfig())); } + + if(setPropNames.find(PropData::GetPropertyName()) != setPropNames.end()) + { + chcore::TLogger& rLogger = chcore::TLogger::Acquire(); + + rLogger.set_max_size(GetPropValue(GetConfig())); + } } void CCopyHandlerApp::OnResManNotify(UINT uiType) Index: src/ch/ch.h =================================================================== diff -u -rbeeac49d2e0888993bd231a4e5863c7f0741e154 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/ch.h (.../ch.h) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) +++ src/ch/ch.h (.../ch.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -29,7 +29,7 @@ #include "../chext/chext.h" #include "../libicpf/log.h" #include "../libictranslate/ResourceManager.h" -#include "../libchcore/TCoreConfig.h" +#include "TConfig.h" using namespace std; @@ -56,11 +56,11 @@ friend LRESULT MainRouter(ULONGLONG ullDst, UINT uiMsg, WPARAM wParam, LPARAM lParam); friend CCopyHandlerApp& GetApp(); friend ictranslate::CResourceManager& GetResManager(); - friend icpf::config& GetConfig(); + friend TConfig& GetConfig(); bool IsShellExtEnabled() const; - void OnConfigNotify(uint_t uiPropID); + void OnConfigNotify(const std::set& setPropNames); void OnResManNotify(UINT uiType); protected: @@ -70,7 +70,6 @@ protected: HANDLE m_hMapObject; IShellExtControl* m_piShellExtControl; - static icpf::config m_config; CWnd *m_pMainWindow; Index: src/ch/ch.vc90.vcproj =================================================================== diff -u -rb8222db9e695712dc5e3ac9cb28983bfb8793ac4 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision b8222db9e695712dc5e3ac9cb28983bfb8793ac4) +++ src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -575,18 +575,10 @@ > - - - - @@ -619,6 +611,14 @@ > + + + + Fisheye: Tag 9ea1e103b5fa4ddfebf8028f121ce16e917eec04 refers to a dead (removed) revision in file `src/ch/charvect.h'. Fisheye: No comparison available. Pass `N' to diff? Index: src/ch/shortcutsdlg.h =================================================================== diff -u -r449a5b399ab21ca0d06050b47b264f2f704af966 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/shortcutsdlg.h (.../shortcutsdlg.h) (revision 449a5b399ab21ca0d06050b47b264f2f704af966) +++ src/ch/shortcutsdlg.h (.../shortcutsdlg.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -19,8 +19,6 @@ #ifndef __SHORTCUTSDLG_H__ #define __SHORTCUTSDLG_H__ -#include "charvect.h" - ///////////////////////////////////////////////////////////////////////////// // CShortcutsDlg dialog @@ -48,8 +46,8 @@ // Implementation public: - const char_vector *m_pcvRecent; // one way only - char_vector m_cvShortcuts; // two-way - shortcuts are being returned through this member + const std::vector *m_pcvRecent; // one way only + std::vector m_cvShortcuts; // two-way - shortcuts are being returned through this member protected: void UpdateComboIcon(); void SetComboPath(LPCTSTR lpszPath); Index: src/ch/task.cpp =================================================================== diff -u -r0660fea6e85becc94c8ac5c9ce41ba270726efd2 -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 --- src/ch/task.cpp (.../task.cpp) (revision 0660fea6e85becc94c8ac5c9ce41ba270726efd2) +++ src/ch/task.cpp (.../task.cpp) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) @@ -1288,14 +1288,14 @@ // delete data if(spFileInfo->IsDirectory()) { - if(!GetConfig().get_bool(PP_CMPROTECTROFILES)) + if(!GetPropValue(GetConfig())) SetFileAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); bSuccess=RemoveDirectory(spFileInfo->GetFullFilePath()); } else { // set files attributes to normal - it'd slow processing a bit, but it's better. - if(!GetConfig().get_bool(PP_CMPROTECTROFILES)) + if(!GetPropValue(GetConfig())) SetFileAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); bSuccess=DeleteFile(spFileInfo->GetFullFilePath()); } @@ -1813,7 +1813,7 @@ // NOTE: we are using here the file size read when scanning directories for files; it might be // outdated at this point, but at present we don't want to re-read file size since it // will cost additional disk access - bool bNoBuffer = (GetConfig().get_bool(PP_BFUSENOBUFFERING) && pData->spSrcFile->GetLength64() >= (unsigned long long)GetConfig().get_signed_num(PP_BFBOUNDARYLIMIT)); + bool bNoBuffer = (GetPropValue(GetConfig()) && pData->spSrcFile->GetLength64() >= (unsigned long long)GetPropValue(GetConfig())); // first open the source file and handle any failures eResult = OpenSourceFileFB(hSrc, pData->spSrcFile, bNoBuffer); @@ -1830,7 +1830,7 @@ // change attributes of a dest file // NOTE: probably should be removed from here and report problems with read-only files // directly to the user (as feedback request) - if(!GetConfig().get_bool(PP_CMPROTECTROFILES)) + if(!GetPropValue(GetConfig())) SetFileAttributes(pData->strDstFile, FILE_ATTRIBUTE_NORMAL); // open destination file, handle the failures and possibly existence of the destination file @@ -2234,21 +2234,21 @@ spFileInfo->SetFlags(ccp.bProcessed ? FIF_PROCESSED : 0, FIF_PROCESSED); // if moving - delete file (only if config flag is set) - if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !GetConfig().get_bool(PP_CMDELETEAFTERFINISHED)) + if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !GetPropValue(GetConfig())) { - if(!GetConfig().get_bool(PP_CMPROTECTROFILES)) + if(!GetPropValue(GetConfig())) SetFileAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); DeleteFile(spFileInfo->GetFullFilePath()); // there will be another try later, so I don't check // if succeeded } } // set a time - if(GetConfig().get_bool(PP_CMSETDESTDATE)) + if(GetPropValue(GetConfig())) SetFileDirectoryTime(ccp.strDstFile, spFileInfo); // no error checking (but most probably it should be checked) // attributes - if(GetConfig().get_bool(PP_CMSETDESTATTRIBUTES)) + if(GetPropValue(GetConfig())) SetFileAttributes(ccp.strDstFile, spFileInfo->GetAttributes()); // as above } @@ -2319,7 +2319,7 @@ if(m_tTaskDefinition.GetSourcePathCount() > 0) { CString strSrcPath = m_tTaskDefinition.GetSourcePathAt(0)->GetPath(); - CString strDstPath = m_tTaskDefinition.GetDestinationPath(); + CString strDstPath = m_tTaskDefinition.GetDestinationPath(); FEEDBACK_NOTENOUGHSPACE feedStruct = { ullNeededSize, (PCTSTR)strSrcPath, (PCTSTR)strDstPath }; CFeedbackHandler::EFeedbackResult frResult = (CFeedbackHandler::EFeedbackResult)m_piFeedbackHandler->RequestFeedback(CFeedbackHandler::eFT_NotEnoughSpace, &feedStruct); @@ -2378,10 +2378,10 @@ // set thread options HANDLE hThread = GetCurrentThread(); - ::SetThreadPriorityBoost(hThread, GetConfig().get_bool(PP_CMDISABLEPRIORITYBOOST)); + ::SetThreadPriorityBoost(hThread, GetPropValue(GetConfig())); // determine when to scan directories - bool bReadTasksSize = GetConfig().get_bool(PP_CMREADSIZEBEFOREBLOCKING); + bool bReadTasksSize = GetPropValue(GetConfig()); // wait for permission to really start (but only if search for files is not allowed to start regardless of the lock) size_t stSubOperationIndex = m_TTaskBasicProgressInfo.GetSubOperationIndex(); @@ -2474,7 +2474,7 @@ } // perform cleanup dependent on currently executing subtask - switch(m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex())) + switch(m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_TTaskBasicProgressInfo.GetSubOperationIndex())) { case eSubOperation_Scanning: m_files.Clear(); // get rid of m_files contents