mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 21:40:36 -04:00
-added new Preferences Dialog for Appearance
-moved some Settings from General to Appearance ( Language, Style, stylesheet -added checkbox for Start RetroShare with System start in GeneralDialog -moved Rsharesettings to Preferences folder to find bether -added new RSettings source -clean uped some old code stuff in MainWindow which is not more needed -replaced in MainWindow PreferencesWindows open function with new one. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@684 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4e43cb2f09
commit
c84f34e916
28 changed files with 1779 additions and 490 deletions
|
@ -58,6 +58,77 @@ win32_get_folder_location(int folder, QString defaultPath)
|
|||
return defaultPath;
|
||||
}
|
||||
|
||||
/** Returns the value in keyName at keyLocation.
|
||||
* Returns an empty QString if the keyName doesn't exist */
|
||||
QString
|
||||
win32_registry_get_key_value(QString keyLocation, QString keyName)
|
||||
{
|
||||
HKEY key;
|
||||
char data[255] = {0};
|
||||
DWORD size = sizeof(data);
|
||||
|
||||
/* Open the key for reading (opens new key if it doesn't exist) */
|
||||
if (RegOpenKeyExA(HKEY_CURRENT_USER,
|
||||
qPrintable(keyLocation),
|
||||
0L, KEY_READ, &key) == ERROR_SUCCESS) {
|
||||
|
||||
/* Key exists, so read the value into data */
|
||||
RegQueryValueExA(key, qPrintable(keyName),
|
||||
NULL, NULL, (LPBYTE)data, &size);
|
||||
}
|
||||
|
||||
/* Close anything that was opened */
|
||||
RegCloseKey(key);
|
||||
|
||||
return QString(data);
|
||||
}
|
||||
|
||||
/** Creates and/or sets the key to the specified value */
|
||||
void
|
||||
win32_registry_set_key_value(QString keyLocation, QString keyName, QString keyValue)
|
||||
{
|
||||
HKEY key;
|
||||
|
||||
/* Open the key for writing (opens new key if it doesn't exist */
|
||||
if (RegOpenKeyExA(HKEY_CURRENT_USER,
|
||||
qPrintable(keyLocation),
|
||||
0, KEY_WRITE, &key) != ERROR_SUCCESS) {
|
||||
|
||||
/* Key didn't exist, so write the newly opened key */
|
||||
RegCreateKeyExA(HKEY_CURRENT_USER,
|
||||
qPrintable(keyLocation),
|
||||
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
|
||||
&key, NULL);
|
||||
}
|
||||
|
||||
/* Save the value in the key */
|
||||
RegSetValueExA(key, qPrintable(keyName), 0, REG_SZ,
|
||||
(BYTE *)qPrintable(keyValue),
|
||||
(DWORD)keyValue.length() + 1); // include null terminator
|
||||
|
||||
/* Close the key */
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
/** Removes the key from the registry if it exists */
|
||||
void
|
||||
win32_registry_remove_key(QString keyLocation, QString keyName)
|
||||
{
|
||||
HKEY key;
|
||||
|
||||
/* Open the key for writing (opens new key if it doesn't exist */
|
||||
if (RegOpenKeyExA(HKEY_CURRENT_USER,
|
||||
qPrintable(keyLocation),
|
||||
0, KEY_SET_VALUE, &key) == ERROR_SUCCESS) {
|
||||
|
||||
/* Key exists so delete it */
|
||||
RegDeleteValueA(key, qPrintable(keyName));
|
||||
}
|
||||
|
||||
/* Close anything that was opened */
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
/** Gets the location of the user's %PROGRAMFILES% folder. */
|
||||
QString
|
||||
win32_program_files_folder()
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#ifndef _WIN32_H
|
||||
#define _WIN32_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
/** Retrieves the location of the user's %PROGRAMFILES% folder. */
|
||||
|
@ -32,5 +35,14 @@ QString win32_program_files_folder();
|
|||
/** Retrieves the location of the user's %APPDATA% folder. */
|
||||
QString win32_app_data_folder();
|
||||
|
||||
/** Returns value of keyName or empty QString if keyName doesn't exist */
|
||||
QString win32_registry_get_key_value(QString keyLocation, QString keyName);
|
||||
|
||||
/** Creates and/or sets the key to the specified value */
|
||||
void win32_registry_set_key_value(QString keyLocation, QString keyName, QString keyValue);
|
||||
|
||||
/** Removes the key from the registry if it exists */
|
||||
void win32_registry_remove_key(QString keyLocation, QString keyName);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue