Changeset 25 for trunk/src/corelib/io/qsettings.cpp
- Timestamp:
- Jun 11, 2009, 2:40:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qsettings.cpp
r2 r25 350 350 // see also qsettings_win.cpp and qsettings_mac.cpp 351 351 352 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 352 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 353 353 QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format, QSettings::Scope scope, 354 354 const QString &organization, const QString &application) … … 358 358 #endif 359 359 360 #if !defined(Q_OS_WIN) 360 #if !defined(Q_OS_WIN) 361 361 QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::Format format) 362 362 { … … 1130 1130 Windows registry and the Mac CFPreferences.) 1131 1131 */ 1132 #if def Q_OS_WIN1132 #if 1133 1133 pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), 1134 1134 windowsConfigPath(CSIDL_APPDATA) + QDir::separator()); 1135 1135 pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), 1136 1136 windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator()); 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1137 1159 #else 1138 1160 QString userPath; … … 1898 1920 IniMap::const_iterator i; 1899 1921 1900 #if def Q_OS_WIN1922 #if 1901 1923 const char * const eol = "\r\n"; 1902 1924 #else … … 2032 2054 Users normally expect an application to remember its settings 2033 2055 (window sizes and positions, options, etc.) across sessions. This 2034 information is often stored in the system registry on Windows ,2056 information is often stored in the system registry on Windows, 2035 2057 and in XML preferences files on Mac OS X. On Unix systems, in the 2036 2058 absence of a standard, many applications (including the KDE … … 2135 2157 \section1 Key Syntax 2136 2158 2137 Setting keys can contain any Unicode characters. The Windows 2159 Setting keys can contain any Unicode characters. The Windows 2138 2160 registry and INI files use case-insensitive keys, whereas the 2139 2161 Carbon Preferences API on Mac OS X uses case-sensitive keys. To … … 2321 2343 \endlist 2322 2344 2323 On Windows , NativeFormat settings are stored in the following2345 On Windows, NativeFormat settings are stored in the following 2324 2346 registry paths: 2325 2347 … … 2359 2381 Settings\\All Users\\Application Data}. 2360 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2361 2392 The paths for the \c .ini and \c .conf files can be changed using 2362 setPath(). On Unix and Mac OS X, the user can override them by by 2363 setting the \c XDG_CONFIG_HOME environment variable; see 2364 setPath() for details. 2393 setPath(). On Unix, Mac OS X and OS/2, the user can override them by setting 2394 the \c XDG_CONFIG_HOME environment variable; see setPath() for details. 2365 2395 2366 2396 \section2 Accessing INI and .plist Files Directly … … 2382 2412 \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 3 2383 2413 2384 \section2 Accessing the Windows Registry Directly2385 2386 On Windows , QSettings lets you access settings that have been2414 \section2 Accessing the Windows Registry Directly 2415 2416 On Windows, QSettings lets you access settings that have been 2387 2417 written with QSettings (or settings in a supported format, e.g., string 2388 2418 data) in the system registry. This is done by constructing a QSettings … … 2405 2435 so. 2406 2436 2407 \section2 Accessing Common Registry Settings on Windows 2408 2409 On Windows , it is possible for a key to have both a value and subkeys.2410 Its default value is accessed by using "Default" or "." in2437 \section2 Accessing Common Registry Settings on Windows 2438 2439 On Windows 2440 Its default value is accessed by using "Default" or "." in 2411 2441 place of a subkey: 2412 2442 2413 2443 \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 6 2414 2444 2415 On other platforms than Windows , "Default" and "." would be2445 On other platforms than Windows, "Default" and "." would be 2416 2446 treated as regular subkeys. 2417 2447 … … 2424 2454 2425 2455 \list 2426 \o The Windows system registry has the following limitations: A2456 \o The Windows system registry has the following limitations: A 2427 2457 subkey may not exceed 255 characters, an entry's value may 2428 2458 not exceed 16,383 characters, and all the values of a key may … … 2482 2512 \value NativeFormat Store the settings using the most 2483 2513 appropriate storage format for the platform. 2484 On Windows , this means the system registry;2514 On Windows, this means the system registry; 2485 2515 on Mac OS X, this means the CFPreferences 2486 2516 API; on Unix, this means textual … … 2647 2677 fileName depends on the platform. On Unix, \a fileName is the 2648 2678 name of an INI file. On Mac OS X, \a fileName is the name of a 2649 \c .plist file. On Windows , \a fileName is a path in the system2679 \c .plist file. On Windows, \a fileName is a path in the system 2650 2680 registry. 2651 2681 … … 2806 2836 object are stored. 2807 2837 2808 On Windows , if the format is QSettings::NativeFormat, the return value2809 is a system registry path, not a file path.2838 On Windows 2839 is a system registry path, not a file path. 2810 2840 2811 2841 \sa isWritable(), format() … … 3206 3236 3207 3237 /*! 3208 3238 3209 3239 Sets the value of setting \a key to \a value. If the \a key already 3210 3240 exists, the previous value is overwritten. 3211 3241 3212 Note that the Windows registry and INI files use case-insensitive3242 Note that the Windows registry and INI files use case-insensitive 3213 3243 keys, whereas the Carbon Preferences API on Mac OS X uses 3214 3244 case-sensitive keys. To avoid portability problems, see the \l{Key … … 3245 3275 \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 25 3246 3276 3247 Note that the Windows registry and INI files use case-insensitive 3248 keys, whereas the Carbon Preferences API on Mac OS X uses 3249 case-sensitive keys. To avoid portability problems, see the \l{Key 3250 Syntax} rules. 3277 Note that the Windows and OS/2 registry and INI files use case-insensitive 3278 keys, whereas the Carbon Preferences API on Mac OS X uses case-sensitive 3279 keys. To avoid portability problems, see the \l{Key Syntax} rules. 3251 3280 3252 3281 \sa setValue(), value(), contains() … … 3280 3309 relative to that group. 3281 3310 3282 Note that the Windows registry and INI files use case-insensitive 3283 keys, whereas the Carbon Preferences API on Mac OS X uses 3284 case-sensitive keys. To avoid portability problems, see the \l{Key 3285 Syntax} rules. 3311 Note that the Windows and OS/2 registry and INI files use case-insensitive 3312 keys, whereas the Carbon Preferences API on Mac OS X uses case-sensitive 3313 keys. To avoid portability problems, see the \l{Key Syntax} rules. 3286 3314 3287 3315 \sa value(), setValue() … … 3342 3370 returned. 3343 3371 3344 Note that the Windows registry and INI files use case-insensitive3372 Note that the Windows registry and INI files use case-insensitive 3345 3373 keys, whereas the Carbon Preferences API on Mac OS X uses 3346 3374 case-sensitive keys. To avoid portability problems, see the \l{Key … … 3405 3433 { 3406 3434 setPath(IniFormat, SystemScope, dir); 3407 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 3435 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 3408 3436 setPath(NativeFormat, SystemScope, dir); 3409 3437 #endif … … 3419 3447 { 3420 3448 setPath(IniFormat, UserScope, dir); 3421 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 3449 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) 3422 3450 setPath(NativeFormat, UserScope, dir); 3423 3451 #endif … … 3442 3470 \row \o{1,2} Mac OS X \o{1,2} IniFormat \o UserScope \o \c $HOME/.config 3443 3471 \row \o SystemScope \o \c /etc/xdg 3472 3473 3444 3474 \endtable 3445 3475 3446 The default UserScope paths on Unix and Mac OS X (\c3447 $HOME/ .config or $HOME/Settings) can be overridden by the user by setting the3476 The default UserScope paths on Unix 3477 $HOME/Settings) can be overridden by the user by setting the 3448 3478 \c XDG_CONFIG_HOME environment variable. The default SystemScope 3449 paths on Unix and Mac OS X (\c /etc/xdg) can be overridden when 3450 building the Qt library using the \c configure script's \c 3479 paths on Unix, Mac OS X (\c /etc/xdg) and OS/2 (\c <boot_drv>:\OS2\xdg) can 3480 be overridden when building the Qt library using the \c configure script's 3481 \c 3451 3482 --sysconfdir flag (see QLibraryInfo for details). 3452 3483 3453 Setting the NativeFormat paths on Windows and Mac OS X has no 3454 effect. 3484 Setting the NativeFormat paths on Windows, Mac OS X and OS/2 has no effect. 3455 3485 3456 3486 \warning This function doesn't affect existing QSettings objects. … … 3723 3753 3724 3754 \value Unix Unix systems (X11 and Embedded Linux) 3725 \value Windows Microsoft Windows systems3755 \value Windows Microsoft Windows systems 3726 3756 \value Mac Mac OS X systems 3727 3757
Note:
See TracChangeset
for help on using the changeset viewer.