Clone
ixen <ixen@copyhandler.com>
committed
on 24 Oct 10
Moved TConfig class to libchcore library.
LoggerImprovements + 5 more
src/ch/CfgProperties.h (+7 -7)
6 6 *   it under the terms of the GNU Library General Public License          *
7 7 *   (version 2) as published by the Free Software Foundation;             *
8 8 *                                                                         *
9 9 *   This program is distributed in the hope that it will be useful,       *
10 10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 12 *   GNU General Public License for more details.                          *
13 13 *                                                                         *
14 14 *   You should have received a copy of the GNU Library General Public     *
15 15 *   License along with this program; if not, write to the                 *
16 16 *   Free Software Foundation, Inc.,                                       *
17 17 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18 18 ***************************************************************************/
19 19 #ifndef __PROPERTYTYPES_H__
20 20 #define __PROPERTYTYPES_H__
21 21
22 22 #pragma once
23 23
24 24 #include "TTaskConfiguration.h"
25 25
26   class TConfig;
  26 namespace chcore { class TConfig; }
27 27
28 28 // properties definitions
29 29 enum ECHProperties
30 30 {
31 31         PP_PCLIPBOARDMONITORING = 0,
32 32         PP_PMONITORSCANINTERVAL,
33 33         PP_PRELOADAFTERRESTART,
34 34         PP_PCHECK_FOR_UPDATES_FREQUENCY,
35 35         PP_PUPDATE_CHECK_FOR_BETA,
36 36         PP_PSHUTDOWNAFTREFINISHED,
37 37         PP_PTIMEBEFORESHUTDOWN,
38 38         PP_PFORCESHUTDOWN,
39 39         PP_PAUTOSAVEINTERVAL,
40 40         PP_PPROCESSPRIORITYCLASS,
41 41         PP_PLANGUAGE,
42 42
43 43         PP_STATUSREFRESHINTERVAL,
44 44         PP_STATUSSHOWDETAILS,
45 45         PP_STATUSAUTOREMOVEFINISHED,
46 46
 
233 233 PROPERTY(PP_SHSHOWMOVE, bool, _T("CHConfig.ShellExtension.ShowCommands.Move"), true);
234 234 PROPERTY(PP_SHSHOWCOPYMOVE, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyMoveSpecial"), true);
235 235 PROPERTY(PP_SHSHOWPASTE, bool, _T("CHConfig.ShellExtension.ShowCommands.Paste"), true);
236 236 PROPERTY(PP_SHSHOWPASTESPECIAL, bool, _T("CHConfig.ShellExtension.ShowCommands.PasteSpecial"), true);
237 237 PROPERTY(PP_SHSHOWCOPYTO, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyTo"), true);
238 238 PROPERTY(PP_SHSHOWMOVETO, bool, _T("CHConfig.ShellExtension.ShowCommands.MoveTo"), true);
239 239 PROPERTY(PP_SHSHOWCOPYMOVETO, bool, _T("CHConfig.ShellExtension.ShowCommands.CopyToMoveToSpecial"), true);
240 240 PROPERTY(PP_SHSHOWFREESPACE, bool, _T("CHConfig.ShellExtension.ShowFreeSpaceAlongShortcuts"), true);
241 241 PROPERTY(PP_SHSHOWSHELLICONS, bool, _T("CHConfig.ShellExtension.ShowShortcutsShellIcons"), false);
242 242 PROPERTY(PP_SHINTERCEPTDRAGDROP, bool, _T("CHConfig.ShellExtension.InterceptDragDrop"), true);
243 243 PROPERTY(PP_SHINTERCEPTKEYACTIONS, bool, _T("CHConfig.ShellExtension.InterceptKeyboardActions"), true);
244 244 PROPERTY(PP_SHINTERCEPTCTXMENUACTIONS, bool, _T("CHConfig.ShellExtension.InterceptDefaultContextMenuActions"), false);
245 245
246 246 // Invisible options
247 247 PROPERTY_MINMAX(PP_LAST_UPDATE_TIMESTAMP, long long, _T("CHConfig.RuntimeState.LastCheckedForUpdates"), 0, 0, LLONG_MAX);
248 248
249 249 /////////////////////////////////////////////////////////////////////////////////////////////
250 250 // Properties retrieval
251 251
252 252 template<ECHProperties PropID>
253   typename PropData<PropID>::value_type GetPropValue(const TConfig& rConfig)
  253 typename PropData<PropID>::value_type GetPropValue(const chcore::TConfig& rConfig)
254 254 {
255 255         typename PropData<PropID>::value_type tValue;
256           if(!rConfig.GetValue(CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), tValue))
  256         if(!GetConfigValue(rConfig, CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), tValue))
257 257                 tValue = PropData<PropID>::GetDefaultValue();
258 258         return tValue;
259 259 }
260 260
261 261 template<ECHProperties PropID>
262   bool GetPropValue(const TConfig& rConfig, typename PropData<PropID>::value_type& rValue)
  262 bool GetPropValue(const chcore::TConfig& rConfig, typename PropData<PropID>::value_type& rValue)
263 263 {
264           return rConfig.GetValue(CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), rValue);
  264         return GetConfigValue(rConfig, CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), rValue);
265 265 }
266 266
267 267 template<ECHProperties PropID>
268   void SetPropValue(TConfig& rConfig, const typename PropData<PropID>::value_type& rValue)
  268 void SetPropValue(chcore::TConfig& rConfig, const typename PropData<PropID>::value_type& rValue)
269 269 {
270           rConfig.SetValue(CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), rValue);
  270         SetConfigValue(rConfig, CString(PropData<PropID>::GetPropertyNamePrefix()) + PropData<PropID>::GetPropertyName(), rValue);
271 271 }
272 272
273 273 #endif