mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05: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
@ -44,7 +44,6 @@ HEADERS += rshare.h \
|
||||
rsiface/rstypes.h \
|
||||
rsiface/notifyqt.h \
|
||||
rsiface/RemoteDirModel.h \
|
||||
config/rshareSettings.h \
|
||||
control/bandwidthevent.h \
|
||||
control/eventtype.h \
|
||||
gui/DLListDelegate.h \
|
||||
@ -118,11 +117,13 @@ HEADERS += rshare.h \
|
||||
gui/Preferences/configpagestack.h \
|
||||
gui/Preferences/CryptographyDialog.h \
|
||||
gui/Preferences/DirectoriesDialog.h \
|
||||
gui/Preferences/LogDialog.h \
|
||||
gui/Preferences/AppearanceDialog.h \
|
||||
gui/Preferences/GeneralDialog.h \
|
||||
gui/Preferences/PreferencesWindow.h \
|
||||
gui/Preferences/ServerDialog.h \
|
||||
gui/Preferences/ConfirmQuitDialog.h \
|
||||
gui/Preferences/rsharesettings.h \
|
||||
gui/Preferences/rsettings.h \
|
||||
gui/toaster/MessageToaster.h \
|
||||
gui/toaster/OnlineToaster.h \
|
||||
gui/toaster/ChatToaster.h \
|
||||
@ -219,7 +220,7 @@ FORMS += gui/ChatDialog.ui \
|
||||
gui/moreinfo/moreinfo.ui \
|
||||
gui/Preferences/CryptographyDialog.ui \
|
||||
gui/Preferences/DirectoriesDialog.ui \
|
||||
gui/Preferences/LogDialog.ui \
|
||||
gui/Preferences/AppearanceDialog.ui \
|
||||
gui/Preferences/GeneralDialog.ui \
|
||||
gui/Preferences/PreferencesWindow.ui \
|
||||
gui/Preferences/ServerDialog.ui \
|
||||
@ -263,7 +264,6 @@ SOURCES += main.cpp \
|
||||
rshare.cpp \
|
||||
rsiface/notifyqt.cpp \
|
||||
rsiface/RemoteDirModel.cpp \
|
||||
config/rshareSettings.cpp \
|
||||
gui/DLListDelegate.cpp \
|
||||
gui/ULListDelegate.cpp \
|
||||
gui/StartDialog.cpp \
|
||||
@ -329,11 +329,13 @@ SOURCES += main.cpp \
|
||||
gui/Preferences/configpagestack.cpp \
|
||||
gui/Preferences/CryptographyDialog.cpp \
|
||||
gui/Preferences/DirectoriesDialog.cpp \
|
||||
gui/Preferences/LogDialog.cpp \
|
||||
gui/Preferences/AppearanceDialog.cpp \
|
||||
gui/Preferences/GeneralDialog.cpp \
|
||||
gui/Preferences/PreferencesWindow.cpp \
|
||||
gui/Preferences/ServerDialog.cpp \
|
||||
gui/Preferences/ConfirmQuitDialog.cpp \
|
||||
gui/Preferences/rsharesettings.cpp \
|
||||
gui/Preferences/rsettings.cpp \
|
||||
gui/common/vmessagebox.cpp \
|
||||
gui/common/rwindow.cpp \
|
||||
gui/common/html.cpp \
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QStyleFactory>
|
||||
#include <lang/languagesupport.h>
|
||||
#include <rshare.h>
|
||||
|
||||
@ -50,95 +51,51 @@
|
||||
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
|
||||
|
||||
/* Default Retroshare Settings */
|
||||
#if defined(Q_WS_MAC)
|
||||
#define DEFAULT_STYLE "macintosh (aqua)"
|
||||
#else
|
||||
#define DEFAULT_STYLE "plastique"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SHEETNAME "Default"
|
||||
|
||||
#define DEFAULT_LANGUAGE LanguageSupport::defaultLanguageCode()
|
||||
|
||||
#define DEFAULT_OPACITY 100
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
|
||||
#define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||
#define Rshare_REG_KEY "RetroShare"
|
||||
#else
|
||||
|
||||
#define Rshare_REG_KEY "RetroShare"
|
||||
#endif
|
||||
|
||||
/* Default bandwidth graph settings */
|
||||
#define DEFAULT_BWGRAPH_FILTER (BWGRAPH_SEND|BWGRAPH_REC)
|
||||
#define DEFAULT_BWGRAPH_ALWAYS_ON_TOP false
|
||||
|
||||
/** The location of RetroShare's settings and configuration file. */
|
||||
#define SETTINGS_FILE (Rshare::dataDirectory() + "/RetroShare.conf")
|
||||
|
||||
|
||||
/** Default Constructor */
|
||||
RshareSettings::RshareSettings()
|
||||
: QSettings(SETTINGS_FILE, QSettings::IniFormat)
|
||||
{
|
||||
setDefault(SETTING_STYLE, DEFAULT_STYLE);
|
||||
#if defined(Q_WS_MAC)
|
||||
setDefault(SETTING_STYLE, "macintosh (aqua)");
|
||||
#else
|
||||
static QStringList styles = QStyleFactory::keys();
|
||||
#if defined(Q_WS_WIN)
|
||||
if (styles.contains("windowsvista", Qt::CaseInsensitive))
|
||||
setDefault(SETTING_STYLE, "windowsvista");
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (styles.contains("cleanlooks", Qt::CaseInsensitive))
|
||||
setDefault(SETTING_STYLE, "cleanlooks");
|
||||
else
|
||||
setDefault(SETTING_STYLE, "plastique");
|
||||
}
|
||||
#endif
|
||||
|
||||
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
|
||||
setDefault(SETTING_SHEETNAME, true);
|
||||
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
|
||||
}
|
||||
|
||||
/** Sets the default value of <b>key</b> to be <b>val</b>. */
|
||||
void RshareSettings::setDefault(QString key, QVariant val)
|
||||
{
|
||||
_defaults.insert(key, val);
|
||||
}
|
||||
|
||||
/** Returns the default value for <b>key</b>. */
|
||||
QVariant RshareSettings::defaultValue(QString key)
|
||||
{
|
||||
if (_defaults.contains(key)) {
|
||||
return _defaults.value(key);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Save <b>val</b> to the configuration file for the setting <b>key</b>, if
|
||||
* <b>val</b> is different than <b>key</b>'s current value. */
|
||||
void RshareSettings::setValue(QString key, QVariant val)
|
||||
{
|
||||
if (value(key) != val) {
|
||||
QSettings::setValue(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value for <b>key</b>. If no value is currently saved, then the
|
||||
* default value for <b>key</b> will be returned. */
|
||||
QVariant RshareSettings::value(QString key)
|
||||
{
|
||||
return value(key, defaultValue(key));
|
||||
}
|
||||
|
||||
/** Returns the value for <b>key</b>. If no value is currently saved, then
|
||||
* <b>defaultValue</b> will be returned. */
|
||||
QVariant RshareSettings::value(QString key, QVariant defaultValue)
|
||||
{
|
||||
return QSettings::value(key, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/** Resets all of RetroShare's settings. */
|
||||
void RshareSettings::reset()
|
||||
{
|
||||
QSettings settings(SETTINGS_FILE, QSettings::IniFormat);
|
||||
settings.clear();
|
||||
}
|
||||
|
||||
/** Gets the currently preferred language code for Rshare. */
|
||||
QString RshareSettings::getLanguageCode()
|
||||
{
|
||||
return value(SETTING_LANGUAGE, DEFAULT_LANGUAGE).toString();
|
||||
return value(SETTING_LANGUAGE).toString();
|
||||
}
|
||||
|
||||
/** Sets the preferred language code. */
|
||||
@ -150,7 +107,7 @@ void RshareSettings::setLanguageCode(QString languageCode)
|
||||
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
||||
QString RshareSettings::getInterfaceStyle()
|
||||
{
|
||||
return value(SETTING_STYLE, DEFAULT_STYLE).toString();
|
||||
return value(SETTING_STYLE).toString();
|
||||
}
|
||||
|
||||
/** Sets the interface style key. */
|
||||
@ -162,7 +119,7 @@ void RshareSettings::setInterfaceStyle(QString styleKey)
|
||||
/** Gets the sheetname.*/
|
||||
QString RshareSettings::getSheetName()
|
||||
{
|
||||
return value(SETTING_SHEETNAME, DEFAULT_SHEETNAME).toString();
|
||||
return value(SETTING_SHEETNAME).toString();
|
||||
}
|
||||
/** Sets the sheetname.*/
|
||||
void RshareSettings::setSheetName(QString sheet)
|
||||
@ -224,6 +181,42 @@ RshareSettings::setShowMainWindowAtStart(bool show)
|
||||
setValue(SETTING_SHOW_MAINWINDOW_AT_START, show);
|
||||
}
|
||||
|
||||
/** Returns true if Vidalia is set to run on system boot. */
|
||||
bool
|
||||
RshareSettings::runRetroshareOnBoot()
|
||||
{
|
||||
#if defined(Q_WS_WIN)
|
||||
if (!win32_registry_get_key_value(STARTUP_REG_KEY, Rshare_REG_KEY).isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
/* Platforms other than windows aren't supported yet */
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** If <b>run</b> is set to true, then Vidalia will run on system boot. */
|
||||
void
|
||||
RshareSettings::setRunRetroshareOnBoot(bool run)
|
||||
{
|
||||
#if defined(Q_WS_WIN)
|
||||
if (run) {
|
||||
win32_registry_set_key_value(STARTUP_REG_KEY, Rshare_REG_KEY,
|
||||
QString("\"" +
|
||||
QDir::convertSeparators(QCoreApplication::applicationFilePath())) +
|
||||
"\"");
|
||||
} else {
|
||||
win32_registry_remove_key(STARTUP_REG_KEY, Rshare_REG_KEY);
|
||||
}
|
||||
#else
|
||||
/* Platforms othe rthan windows aren't supported yet */
|
||||
Q_UNUSED(run);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Saving Generic Widget Size / Location */
|
||||
|
||||
void RshareSettings::saveWidgetInformation(QWidget *widget)
|
||||
|
@ -87,7 +87,12 @@ public:
|
||||
* application starts. */
|
||||
bool showMainWindowAtStart();
|
||||
/** Sets whether to show Vidalia's main window when the application starts. */
|
||||
void setShowMainWindowAtStart(bool show);
|
||||
void setShowMainWindowAtStart(bool show);
|
||||
|
||||
/** Returns true if RetroShare should start on system boot. */
|
||||
bool runRetroshareOnBoot();
|
||||
/** Set whether to run RetroShare on system boot. */
|
||||
void setRunRetroshareOnBoot(bool run);
|
||||
|
||||
|
||||
/* Get the destination log file. */
|
||||
|
@ -65,7 +65,7 @@
|
||||
#define IMAGE_LINKS ":/images/knewsticker24.png"
|
||||
#define IMAGE_FILES ":/images/fileshare24.png"
|
||||
#define IMAGE_CHANNELS ":/images/channels.png"
|
||||
#define IMAGE_PREFERENCES ":/images/settings16.png"
|
||||
#define IMAGE_PREFERENCES ":/images/kcmsystem24.png"
|
||||
#define IMAGE_CHAT ":/images/groupchat.png"
|
||||
#define IMAGE_RETROSHARE ":/images/rstray3.png"
|
||||
#define IMAGE_ABOUT ":/images/informations_24x24.png"
|
||||
@ -111,10 +111,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
mSMPlayer = NULL;
|
||||
|
||||
/* Hide Console frame */
|
||||
//showConsoleFrame(false);
|
||||
//connect(ui.btnToggleConsole, SIGNAL(toggled(bool)), this, SLOT(showConsoleFrame(bool)));
|
||||
|
||||
ui.toolBarservice->hide();
|
||||
|
||||
// Setting icons
|
||||
@ -123,6 +119,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Create all the dialogs of which we only want one instance */
|
||||
_bandwidthGraph = new BandwidthGraph();
|
||||
messengerWindow = new MessengerWindow();
|
||||
_preferencesWindow = new PreferencesWindow();
|
||||
messengerWindow->hide();
|
||||
//messengerWindow->show();
|
||||
applicationWindow = new ApplicationWindow();
|
||||
@ -137,13 +134,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) );
|
||||
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
|
||||
connect(ui.actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) );
|
||||
|
||||
|
||||
/** Games ToolBox*/
|
||||
//connect(ui.qbackgammonButton, SIGNAL(clicked( bool )), this, SLOT( startgammon()) );
|
||||
//connect(ui.qcheckersButton, SIGNAL(clicked( bool )), this, SLOT( startqcheckers()) );
|
||||
|
||||
|
||||
|
||||
|
||||
/** adjusted quit behaviour: trigger a warning that can be switched off in the saved
|
||||
config file RetroShare.conf */
|
||||
connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(doQuit()));
|
||||
@ -465,11 +457,11 @@ void MainWindow::addSharedDirectory()
|
||||
}
|
||||
|
||||
/** Shows Preferences */
|
||||
void MainWindow::showPreferencesWindow()
|
||||
/*void MainWindow::showPreferencesWindow()
|
||||
{
|
||||
static PreferencesWindow* preferencesWindow = new PreferencesWindow(this);
|
||||
preferencesWindow->show();
|
||||
}
|
||||
}*/
|
||||
|
||||
/** Shows Options */
|
||||
void MainWindow::showSettings()
|
||||
@ -497,10 +489,10 @@ void MainWindow::showApplWindow()
|
||||
/** Destructor. */
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete _prefsAct;
|
||||
delete _bandwidthGraph;
|
||||
delete _messengerwindowAct;
|
||||
delete _smplayerAct;
|
||||
delete _preferencesWindow;
|
||||
}
|
||||
|
||||
/** Create and bind actions to events. Setup for initial
|
||||
@ -614,43 +606,6 @@ void MainWindow::toggleVisibilitycontextmenu()
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Toggles the Console pane on and off, changes toggle button text
|
||||
*/
|
||||
/*void MainWindow::showConsoleFrame(bool show)
|
||||
{
|
||||
if (show) {
|
||||
ui.frmConsole->setVisible(true);
|
||||
ui.btnToggleConsole->setChecked(true);
|
||||
ui.btnToggleConsole->setToolTip(tr("Hide Console"));
|
||||
} else {
|
||||
ui.frmConsole->setVisible(false);
|
||||
ui.btnToggleConsole->setChecked(false);
|
||||
ui.btnToggleConsole->setToolTip(tr("Show Console"));
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
Toggles the ToolBox on and off, changes toggle button text
|
||||
*/
|
||||
/*void MainWindow::showToolboxFrame(bool show)
|
||||
{
|
||||
if (show) {
|
||||
ui.toolboxframe->setVisible(true);
|
||||
ui.btntoggletoolbox->setChecked(true);
|
||||
ui.btntoggletoolbox->setToolTip(tr("Hide ToolBox"));
|
||||
ui.btntoggletoolbox->setIcon(QIcon(tr(":images/hide_toolbox_frame.png")));
|
||||
} else {
|
||||
ui.toolboxframe->setVisible(false);
|
||||
ui.btntoggletoolbox->setChecked(false);
|
||||
ui.btntoggletoolbox->setToolTip(tr("Show ToolBox"));
|
||||
ui.btntoggletoolbox->setIcon(QIcon(tr(":images/show_toolbox_frame.png")));
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
void MainWindow::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
/** internal Stylesheets **/
|
||||
@ -744,5 +699,12 @@ void MainWindow::setStyle()
|
||||
|
||||
}
|
||||
|
||||
/** Creates and displays the Configuration dialog with the current page set to
|
||||
* <b>page</b>. */
|
||||
void
|
||||
MainWindow::showPreferencesWindow(PreferencesWindow::Page page)
|
||||
{
|
||||
_preferencesWindow->showWindow(page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ private slots:
|
||||
void addFriend();
|
||||
void inviteFriend();
|
||||
void addSharedDirectory();
|
||||
void showPreferencesWindow();
|
||||
//void showPreferencesWindow();
|
||||
void showMessengerWindow();
|
||||
void showApplWindow();
|
||||
void showsmplayer();
|
||||
@ -140,6 +140,9 @@ private slots:
|
||||
/** Called when a child window requests the given help <b>topic</b>. */
|
||||
void showHelpDialog(const QString &topic);
|
||||
|
||||
/** Creates and displays the Configuration dialog with the current page set
|
||||
* to <b>page</b>. */
|
||||
void showPreferencesWindow(PreferencesWindow::Page page = PreferencesWindow::General);
|
||||
|
||||
void showSettings();
|
||||
void setStyle();
|
||||
|
@ -505,17 +505,16 @@
|
||||
<enum>Qt::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>35</x>
|
||||
<y>12</y>
|
||||
<width>753</width>
|
||||
<height>567</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
@ -1014,8 +1013,25 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" />
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>579</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
@ -1045,11 +1061,19 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBarservice" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>788</x>
|
||||
<y>12</y>
|
||||
<width>12</width>
|
||||
<height>567</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="allowedAreas" >
|
||||
<set>Qt::BottomToolBarArea|Qt::LeftToolBarArea|Qt::NoToolBarArea|Qt::RightToolBarArea</set>
|
||||
<set>Qt::BottomToolBarArea|Qt::LeftToolBarArea|Qt::RightToolBarArea</set>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
@ -1068,6 +1092,14 @@
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>12</y>
|
||||
<width>35</width>
|
||||
<height>567</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>toolBar_2</string>
|
||||
</property>
|
||||
@ -1098,7 +1130,8 @@
|
||||
</widget>
|
||||
<action name="actionAdd_Friend" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/add-friend24.png</normaloff>:/images/add-friend24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Friend</string>
|
||||
@ -1106,7 +1139,8 @@
|
||||
</action>
|
||||
<action name="actionInvite_Friend" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/invite-friend24.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/invite-friend24.png</normaloff>:/images/invite-friend24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Invite Friend</string>
|
||||
@ -1114,7 +1148,8 @@
|
||||
</action>
|
||||
<action name="actionAdd_Share" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/add-share24.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Share</string>
|
||||
@ -1122,7 +1157,8 @@
|
||||
</action>
|
||||
<action name="actionOptions" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/settings.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Options</string>
|
||||
@ -1130,7 +1166,8 @@
|
||||
</action>
|
||||
<action name="actionQuit" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/exit_24x24.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/exit_24x24.png</normaloff>:/images/exit_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Quit</string>
|
||||
@ -1141,7 +1178,8 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/highlight.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/highlight.png</normaloff>:/images/highlight.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Color</string>
|
||||
@ -1152,7 +1190,8 @@
|
||||
</action>
|
||||
<action name="actionSMPlayer" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/smplayer_icon32.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/smplayer_icon32.png</normaloff>:/images/smplayer_icon32.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>SMPlayer</string>
|
||||
@ -1160,7 +1199,8 @@
|
||||
</action>
|
||||
<action name="actionMessenger" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/kdmconfig.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/kdmconfig.png</normaloff>:/images/kdmconfig.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Messenger</string>
|
||||
@ -1168,7 +1208,8 @@
|
||||
</action>
|
||||
<action name="actionAbout" >
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >:/images/informations_24x24.png</iconset>
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/informations_24x24.png</normaloff>:/images/informations_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>About</string>
|
||||
|
135
retroshare-gui/src/gui/Preferences/AppearanceDialog.cpp
Normal file
135
retroshare-gui/src/gui/Preferences/AppearanceDialog.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#include <rshare.h>
|
||||
#include "AppearanceDialog.h"
|
||||
|
||||
|
||||
/** Constructor */
|
||||
AppearanceDialog::AppearanceDialog(QWidget *parent)
|
||||
: ConfigPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Create RshareSettings object */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
connect(ui.styleSheetCombo, SIGNAL(clicked()), this, SLOT(loadStyleSheet()));
|
||||
|
||||
/* Populate combo boxes */
|
||||
foreach (QString code, LanguageSupport::languageCodes()) {
|
||||
ui.cmboLanguage->addItem(QIcon(":/images/flags/" + code + ".png"),
|
||||
LanguageSupport::languageName(code),
|
||||
code);
|
||||
}
|
||||
foreach (QString style, QStyleFactory::keys()) {
|
||||
ui.cmboStyle->addItem(style, style.toLower());
|
||||
}
|
||||
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Default"));
|
||||
//loadStyleSheet("Default");
|
||||
loadqss();
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Saves the changes on this page */
|
||||
bool
|
||||
AppearanceDialog::save(QString &errmsg)
|
||||
{
|
||||
Q_UNUSED(errmsg);
|
||||
QString languageCode =
|
||||
LanguageSupport::languageCode(ui.cmboLanguage->currentText());
|
||||
|
||||
_settings->setLanguageCode(languageCode);
|
||||
_settings->setInterfaceStyle(ui.cmboStyle->currentText());
|
||||
_settings->setSheetName(ui.styleSheetCombo->currentText());
|
||||
|
||||
/* Set to new style */
|
||||
Rshare::setStyle(ui.cmboStyle->currentText());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void
|
||||
AppearanceDialog::load()
|
||||
{
|
||||
|
||||
int index = ui.cmboLanguage->findData(_settings->getLanguageCode());
|
||||
ui.cmboLanguage->setCurrentIndex(index);
|
||||
|
||||
index = ui.cmboStyle->findData(Rshare::style().toLower());
|
||||
ui.cmboStyle->setCurrentIndex(index);
|
||||
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName()));
|
||||
|
||||
/** load saved internal styleSheet **/
|
||||
//QFile file(":/qss/" + (_settings->getSheetName().toLower()) + ".qss");
|
||||
|
||||
/** load saved extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + (_settings->getSheetName().toLower()) + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
|
||||
}
|
||||
|
||||
void AppearanceDialog::on_styleSheetCombo_activated(const QString &sheetName)
|
||||
{
|
||||
loadStyleSheet(sheetName);
|
||||
}
|
||||
|
||||
void AppearanceDialog::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
/** internal Stylesheets **/
|
||||
//QFile file(":/qss/" + sheetName.toLower() + ".qss");
|
||||
|
||||
/** extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
|
||||
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
|
||||
}
|
||||
|
||||
void AppearanceDialog::loadqss()
|
||||
{
|
||||
|
||||
QFileInfoList slist = QDir(QApplication::applicationDirPath() + "/qss/").entryInfoList();
|
||||
foreach(QFileInfo st, slist)
|
||||
{
|
||||
if(st.fileName() != "." && st.fileName() != ".." && st.isFile())
|
||||
ui.styleSheetCombo->addItem(st.fileName().remove(".qss"));
|
||||
}
|
||||
|
||||
}
|
65
retroshare-gui/src/gui/Preferences/AppearanceDialog.h
Normal file
65
retroshare-gui/src/gui/Preferences/AppearanceDialog.h
Normal file
@ -0,0 +1,65 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _LOGDIALOG_H
|
||||
#define _LOGDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "rsharesettings.h"
|
||||
#include <lang/languagesupport.h>
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_AppearanceDialog.h"
|
||||
|
||||
class AppearanceDialog : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
AppearanceDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
/** Saves the changes on this page */
|
||||
bool save(QString &errmsg);
|
||||
/** Loads the settings for this page */
|
||||
void load();
|
||||
|
||||
private slots:
|
||||
|
||||
void on_styleSheetCombo_activated(const QString &styleSheetName);
|
||||
|
||||
|
||||
private:
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings* _settings;
|
||||
|
||||
void loadStyleSheet(const QString &sheetName);
|
||||
void loadqss();
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::AppearanceDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
717
retroshare-gui/src/gui/Preferences/AppearanceDialog.ui
Normal file
717
retroshare-gui/src/gui/Preferences/AppearanceDialog.ui
Normal file
@ -0,0 +1,717 @@
|
||||
<ui version="4.0" >
|
||||
<class>AppearanceDialog</class>
|
||||
<widget class="QWidget" name="AppearanceDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>440</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>192</red>
|
||||
<green>192</green>
|
||||
<blue>192</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="grpLanguage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>75</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Language</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>44</y>
|
||||
<width>341</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="cmboLanguage" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose the language used in RetroShare</p></body></html></string>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>27</y>
|
||||
<width>591</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes to language will only take effect after restarting RetroShare!</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="grpStyle" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>80</y>
|
||||
<width>441</width>
|
||||
<height>55</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Style</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>24</y>
|
||||
<width>341</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_2" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="cmboStyle" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose RetroShare's interface style</p></body></html></string>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>140</y>
|
||||
<width>441</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Style Sheet</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>20</y>
|
||||
<width>341</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_3" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="styleSheetCombo" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <config/rsharesettings.h>
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_DirectoriesDialog.h"
|
||||
|
@ -34,22 +34,6 @@ GeneralDialog::GeneralDialog(QWidget *parent)
|
||||
/* Create RshareSettings object */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
connect(ui.styleSheetCombo, SIGNAL(clicked()), this, SLOT(loadStyleSheet()));
|
||||
|
||||
/* Populate combo boxes */
|
||||
foreach (QString code, LanguageSupport::languageCodes()) {
|
||||
ui.cmboLanguage->addItem(QIcon(":/images/flags/" + code + ".png"),
|
||||
LanguageSupport::languageName(code),
|
||||
code);
|
||||
}
|
||||
foreach (QString style, QStyleFactory::keys()) {
|
||||
ui.cmboStyle->addItem(style, style.toLower());
|
||||
}
|
||||
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Default"));
|
||||
//loadStyleSheet("Default");
|
||||
loadqss();
|
||||
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable()){
|
||||
|
||||
/* Check if we are supposed to show our main window on startup */
|
||||
@ -61,7 +45,10 @@ GeneralDialog::GeneralDialog(QWidget *parent)
|
||||
ui.chkShowOnStartup->hide();
|
||||
//show();
|
||||
}
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifndef Q_WS_WIN
|
||||
ui.chkRunRetroshareAtSystemStartup->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Destructor */
|
||||
@ -75,18 +62,9 @@ bool
|
||||
GeneralDialog::save(QString &errmsg)
|
||||
{
|
||||
Q_UNUSED(errmsg);
|
||||
QString languageCode =
|
||||
LanguageSupport::languageCode(ui.cmboLanguage->currentText());
|
||||
|
||||
_settings->setLanguageCode(languageCode);
|
||||
_settings->setInterfaceStyle(ui.cmboStyle->currentText());
|
||||
_settings->setSheetName(ui.styleSheetCombo->currentText());
|
||||
|
||||
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
|
||||
|
||||
|
||||
/* Set to new style */
|
||||
Rshare::setStyle(ui.cmboStyle->currentText());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -94,61 +72,16 @@ GeneralDialog::save(QString &errmsg)
|
||||
void
|
||||
GeneralDialog::load()
|
||||
{
|
||||
int index = ui.cmboLanguage->findData(_settings->getLanguageCode());
|
||||
ui.cmboLanguage->setCurrentIndex(index);
|
||||
|
||||
index = ui.cmboStyle->findData(Rshare::style().toLower());
|
||||
ui.cmboStyle->setCurrentIndex(index);
|
||||
|
||||
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
ui.chkRunRetroshareAtSystemStartup->setChecked(
|
||||
_settings->runRetroshareOnBoot());
|
||||
|
||||
|
||||
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName()));
|
||||
|
||||
/** load saved internal styleSheet **/
|
||||
//QFile file(":/qss/" + (_settings->getSheetName().toLower()) + ".qss");
|
||||
|
||||
/** load saved extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + (_settings->getSheetName().toLower()) + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
|
||||
}
|
||||
|
||||
void GeneralDialog::on_styleSheetCombo_activated(const QString &sheetName)
|
||||
{
|
||||
loadStyleSheet(sheetName);
|
||||
}
|
||||
|
||||
void GeneralDialog::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
/** internal Stylesheets **/
|
||||
//QFile file(":/qss/" + sheetName.toLower() + ".qss");
|
||||
|
||||
/** extern Stylesheets **/
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
|
||||
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
|
||||
}
|
||||
|
||||
void GeneralDialog::loadqss()
|
||||
{
|
||||
|
||||
QFileInfoList slist = QDir(QApplication::applicationDirPath() + "/qss/").entryInfoList();
|
||||
foreach(QFileInfo st, slist)
|
||||
{
|
||||
if(st.fileName() != "." && st.fileName() != ".." && st.isFile())
|
||||
ui.styleSheetCombo->addItem(st.fileName().remove(".qss"));
|
||||
}
|
||||
|
||||
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GeneralDialog::startMinimized() const {
|
||||
if(ui.checkStartMinimized->isChecked()) return true;
|
||||
|
@ -24,11 +24,9 @@
|
||||
#define _GENERALDIALOG_H
|
||||
#include <QtGui>
|
||||
#include <QFileDialog>
|
||||
#include <QStyleFactory>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <config/rsharesettings.h>
|
||||
#include <lang/languagesupport.h>
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_GeneralDialog.h"
|
||||
@ -51,15 +49,13 @@ public:
|
||||
|
||||
private slots:
|
||||
|
||||
void on_styleSheetCombo_activated(const QString &styleSheetName);
|
||||
|
||||
|
||||
private:
|
||||
/** A VidaliaSettings object used for saving/loading settings */
|
||||
RshareSettings* _settings;
|
||||
|
||||
void loadStyleSheet(const QString &sheetName);
|
||||
void loadqss();
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GeneralDialog ui;
|
||||
|
@ -492,228 +492,11 @@
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="grpStyle" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>80</y>
|
||||
<width>441</width>
|
||||
<height>55</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Style</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>24</y>
|
||||
<width>341</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="cmboStyle" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose RetroShare's interface style</p></body></html></string>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="grpLanguage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>75</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Language</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>44</y>
|
||||
<width>341</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="cmboLanguage" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose the language used in RetroShare</p></body></html></string>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>27</y>
|
||||
<width>591</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Arial; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changes to language will only take effect after restarting RetroShare!</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>140</y>
|
||||
<width>441</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Style Sheet</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>20</y>
|
||||
<width>341</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QComboBox" name="styleSheetCombo" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="grpLogin" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>210</y>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
@ -739,19 +522,19 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>280</y>
|
||||
<y>60</y>
|
||||
<width>441</width>
|
||||
<height>80</height>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>System tray</string>
|
||||
<string>Misc</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="chkShowOnStartup" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<y>40</y>
|
||||
<width>401</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -767,7 +550,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<y>60</y>
|
||||
<width>401</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -779,13 +562,21 @@ p, li { white-space: pre-wrap; }
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chkRunRetroshareAtSystemStartup" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>411</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Start RetroShare when my system starts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cmboLanguage</tabstop>
|
||||
<tabstop>cmboStyle</tabstop>
|
||||
<tabstop>styleSheetCombo</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../images.qrc" />
|
||||
</resources>
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define FONT QFont(tr("Arial"), 8)
|
||||
|
||||
/* Images for toolbar icons */
|
||||
#define IMAGE_PREFERENCES ":/images/locale.png"
|
||||
#define IMAGE_PREFERENCES ":/images/kcmsystem24.png"
|
||||
#define IMAGE_SERVER ":/images/server_24x24.png"
|
||||
#define IMAGE_DIRECTORIES ":/images/folder_doments.png"
|
||||
#define IMAGE_CRYPTOGRAPHY ":/images/cryptography_24x24.png"
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
/** Constructor */
|
||||
PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
|
||||
: QMainWindow(parent, flags)
|
||||
: RWindow("PreferencesWindow", parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -56,7 +56,15 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
|
||||
createPageAction(QIcon(IMAGE_SERVER), tr("Server"), grp));
|
||||
|
||||
ui.stackPages->add(new DirectoriesDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_DIRECTORIES), tr("Directories"), grp));
|
||||
createPageAction(QIcon(IMAGE_DIRECTORIES), tr("Directories"), grp));
|
||||
|
||||
ui.stackPages->add(new AppearanceDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_DIRECTORIES), tr("AppearanceDialog"), grp));
|
||||
|
||||
/*foreach (ConfigPage *page, ui.stackPages->pages()) {
|
||||
connect(page, SIGNAL(helpRequested(QString)),
|
||||
this, SLOT(help(QString)));
|
||||
} */
|
||||
|
||||
/* Create the toolbar */
|
||||
ui.toolBar->addActions(grp->actions());
|
||||
@ -103,11 +111,11 @@ PreferencesWindow::addAction(QAction *action, const char *slot)
|
||||
}
|
||||
|
||||
/** Overloads the default show so we can load settings */
|
||||
void
|
||||
/*void
|
||||
PreferencesWindow::show()
|
||||
{
|
||||
{*/
|
||||
/* Load saved settings */
|
||||
loadSettings();
|
||||
/*loadSettings();
|
||||
|
||||
if (!this->isVisible()) {
|
||||
QMainWindow::show();
|
||||
@ -116,15 +124,16 @@ PreferencesWindow::show()
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QMainWindow::raise();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/** Shows the config dialog with focus set to the given page. */
|
||||
/** Shows the Preferences dialog with focus set to the given page. */
|
||||
void
|
||||
PreferencesWindow::show(Page page)
|
||||
PreferencesWindow::showWindow(Page page)
|
||||
{
|
||||
/* Show the dialog. */
|
||||
show();
|
||||
|
||||
/* Load saved settings */
|
||||
loadSettings();
|
||||
/* Show the dialog. */
|
||||
RWindow::showWindow();
|
||||
/* Set the focus to the specified page. */
|
||||
ui.stackPages->setCurrentIndex((int)page);
|
||||
}
|
||||
@ -215,9 +224,9 @@ PreferencesWindow::help()
|
||||
case General:
|
||||
help("config.general"); break;
|
||||
case Server:
|
||||
help("server"); break;
|
||||
case Directories:
|
||||
help("config.server"); break;
|
||||
case Directories:
|
||||
help("config.directories"); break;
|
||||
default:
|
||||
help("config.general"); break;
|
||||
}
|
||||
|
@ -29,14 +29,14 @@
|
||||
#include "DirectoriesDialog.h"
|
||||
#include "ServerDialog.h"
|
||||
#include "CryptographyDialog.h"
|
||||
#include "LogDialog.h"
|
||||
#include "AppearanceDialog.h"
|
||||
#include "gui/help/browser/helpbrowser.h"
|
||||
|
||||
#include <gui/common/rwindow.h>
|
||||
|
||||
|
||||
#include "ui_PreferencesWindow.h"
|
||||
|
||||
class PreferencesWindow : public QMainWindow
|
||||
class PreferencesWindow : public RWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -44,10 +44,9 @@ public:
|
||||
/** Preferences dialog pages. */
|
||||
enum Page {
|
||||
General = 0, /** Preferences page. */
|
||||
Directories = 1, /** Directories page. */
|
||||
Server = 2, /** Server page. */
|
||||
Cryptography = 3, /** Cryptography page. */
|
||||
About = 4 /** About page. */
|
||||
Server, /** Server page. */
|
||||
Directories, /** Directories page. */
|
||||
Appearance /** Appearance page. */
|
||||
|
||||
};
|
||||
|
||||
@ -61,9 +60,9 @@ protected:
|
||||
|
||||
public slots:
|
||||
/** Called when this dialog is to be displayed */
|
||||
void show();
|
||||
/** Shows the config dialog with focus set to the given page. */
|
||||
void show(Page page);
|
||||
//void show();
|
||||
/** Shows the Preferences dialog with focus set to the given page. */
|
||||
void showWindow(Page page);
|
||||
|
||||
private slots:
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <config/rsharesettings.h>
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_ServerDialog.h"
|
||||
|
95
retroshare-gui/src/gui/Preferences/rsettings.cpp
Normal file
95
retroshare-gui/src/gui/Preferences/rsettings.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, crypton
|
||||
* Copyright (c) 2008, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <rshare.h>
|
||||
|
||||
#include "rsettings.h"
|
||||
|
||||
/** The file in which all settings will read and written. */
|
||||
#define SETTINGS_FILE (Rshare::dataDirectory() + "/RetroShare.conf")
|
||||
|
||||
/** Constructor */
|
||||
RSettings::RSettings(const QString settingsGroup)
|
||||
: QSettings(SETTINGS_FILE, QSettings::IniFormat)
|
||||
{
|
||||
if (!settingsGroup.isEmpty())
|
||||
beginGroup(settingsGroup);
|
||||
}
|
||||
|
||||
/** Returns the saved value associated with <b>key</b>. If no value has been
|
||||
* set, the default value is returned.
|
||||
* \sa setDefault
|
||||
*/
|
||||
QVariant
|
||||
RSettings::value(const QString &key, const QVariant &defaultVal) const
|
||||
{
|
||||
return QSettings::value(key, defaultVal.isNull() ? defaultValue(key)
|
||||
: defaultVal);
|
||||
}
|
||||
|
||||
/** Sets the value associated with <b>key</b> to <b>val</b>. */
|
||||
void
|
||||
RSettings::setValue(const QString &key, const QVariant &val)
|
||||
{
|
||||
if (val == defaultValue(key))
|
||||
QSettings::remove(key);
|
||||
else if (val != value(key))
|
||||
QSettings::setValue(key, val);
|
||||
}
|
||||
|
||||
/** Sets the default setting for <b>key</b> to <b>val</b>. */
|
||||
void
|
||||
RSettings::setDefault(const QString &key, const QVariant &val)
|
||||
{
|
||||
_defaults.insert(key, val);
|
||||
}
|
||||
|
||||
/** Returns the default setting value associated with <b>key</b>. If
|
||||
* <b>key</b> has no default value, then an empty QVariant is returned. */
|
||||
QVariant
|
||||
RSettings::defaultValue(const QString &key) const
|
||||
{
|
||||
if (_defaults.contains(key))
|
||||
return _defaults.value(key);
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/** Resets all of Vidalia's settings. */
|
||||
void
|
||||
RSettings::reset()
|
||||
{
|
||||
/* Static method, so we have to create a QSettings object. */
|
||||
QSettings settings(SETTINGS_FILE, QSettings::IniFormat);
|
||||
settings.clear();
|
||||
}
|
||||
|
||||
/** Returns a map of all currently saved settings at the last appyl() point. */
|
||||
/*QMap<QString, QVariant>
|
||||
RSettings::allSettings() const
|
||||
{
|
||||
QMap<QString, QVariant> settings;
|
||||
foreach (QString key, allKeys()) {
|
||||
settings.insert(key, value(key));
|
||||
}
|
||||
return settings;
|
||||
}*/
|
||||
|
68
retroshare-gui/src/gui/Preferences/rsettings.h
Normal file
68
retroshare-gui/src/gui/Preferences/rsettings.h
Normal file
@ -0,0 +1,68 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, crypton
|
||||
* Copyright (c) 2008, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _RSETTINGS_H
|
||||
#define _RSETTINGS_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
class RSettings : public QSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default constructor. The optional parameter <b>group</b> can be used to
|
||||
* set a prefix that will be prepended to keys specified to VSettings in
|
||||
* value() and setValue(). */
|
||||
RSettings(const QString group = QString());
|
||||
|
||||
/** Resets all of Vidalia's settings. */
|
||||
static void reset();
|
||||
|
||||
/** Returns the saved value associated with <b>key</b>. If no value has been
|
||||
* set, the default value is returned.
|
||||
* \sa setDefault
|
||||
*/
|
||||
virtual QVariant value(const QString &key,
|
||||
const QVariant &defaultVal = QVariant()) const;
|
||||
/** Sets the value associated with <b>key</b> to <b>val</b>. */
|
||||
virtual void setValue(const QString &key, const QVariant &val);
|
||||
|
||||
protected:
|
||||
/** Sets the default setting for <b>key</b> to <b>val</b>. */
|
||||
void setDefault(const QString &key, const QVariant &val);
|
||||
/** Returns the default setting value associated with <b>key</b>. If
|
||||
* <b>key</b> has no default value, then an empty QVariant is returned. */
|
||||
QVariant defaultValue(const QString &key) const;
|
||||
/** Returns a map of all currently saved settings at the last apply()
|
||||
* point. */
|
||||
//QMap<QString, QVariant> allSettings() const;
|
||||
|
||||
private:
|
||||
/** Association of setting key names to default setting values. */
|
||||
QHash<QString, QVariant> _defaults;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
271
retroshare-gui/src/gui/Preferences/rsharesettings.cpp
Normal file
271
retroshare-gui/src/gui/Preferences/rsharesettings.cpp
Normal file
@ -0,0 +1,271 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QStyleFactory>
|
||||
#include <lang/languagesupport.h>
|
||||
#include <rshare.h>
|
||||
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#include <util/registry.h>
|
||||
#include <util/win32.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Retroshare's Settings */
|
||||
#define SETTING_LANGUAGE "LanguageCode"
|
||||
#define SETTING_STYLE "InterfaceStyle"
|
||||
#define SETTING_SHEETNAME "SheetName"
|
||||
|
||||
#define SETTING_DATA_DIRECTORY "DataDirectory"
|
||||
#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart"
|
||||
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
|
||||
#define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity"
|
||||
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
|
||||
|
||||
/* Default Retroshare Settings */
|
||||
#define DEFAULT_OPACITY 100
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||
#define RETROSHARE_REG_KEY "RetroShare"
|
||||
#endif
|
||||
|
||||
/* Default bandwidth graph settings */
|
||||
#define DEFAULT_BWGRAPH_FILTER (BWGRAPH_SEND|BWGRAPH_REC)
|
||||
#define DEFAULT_BWGRAPH_ALWAYS_ON_TOP false
|
||||
|
||||
|
||||
|
||||
/** Default Constructor */
|
||||
RshareSettings::RshareSettings()
|
||||
{
|
||||
#if defined(Q_WS_MAC)
|
||||
setDefault(SETTING_STYLE, "macintosh (aqua)");
|
||||
#else
|
||||
static QStringList styles = QStyleFactory::keys();
|
||||
#if defined(Q_WS_WIN)
|
||||
if (styles.contains("windowsvista", Qt::CaseInsensitive))
|
||||
setDefault(SETTING_STYLE, "windowsvista");
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (styles.contains("cleanlooks", Qt::CaseInsensitive))
|
||||
setDefault(SETTING_STYLE, "cleanlooks");
|
||||
else
|
||||
setDefault(SETTING_STYLE, "plastique");
|
||||
}
|
||||
#endif
|
||||
|
||||
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
|
||||
setDefault(SETTING_SHEETNAME, true);
|
||||
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
|
||||
}
|
||||
|
||||
|
||||
/** Gets the currently preferred language code for Rshare. */
|
||||
QString RshareSettings::getLanguageCode()
|
||||
{
|
||||
return value(SETTING_LANGUAGE).toString();
|
||||
}
|
||||
|
||||
/** Sets the preferred language code. */
|
||||
void RshareSettings::setLanguageCode(QString languageCode)
|
||||
{
|
||||
setValue(SETTING_LANGUAGE, languageCode);
|
||||
}
|
||||
|
||||
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
||||
QString RshareSettings::getInterfaceStyle()
|
||||
{
|
||||
return value(SETTING_STYLE).toString();
|
||||
}
|
||||
|
||||
/** Sets the interface style key. */
|
||||
void RshareSettings::setInterfaceStyle(QString styleKey)
|
||||
{
|
||||
setValue(SETTING_STYLE, styleKey);
|
||||
}
|
||||
|
||||
/** Gets the sheetname.*/
|
||||
QString RshareSettings::getSheetName()
|
||||
{
|
||||
return value(SETTING_SHEETNAME).toString();
|
||||
}
|
||||
/** Sets the sheetname.*/
|
||||
void RshareSettings::setSheetName(QString sheet)
|
||||
{
|
||||
setValue(SETTING_SHEETNAME, sheet);
|
||||
}
|
||||
|
||||
/** Returns the bandwidth line filter. */
|
||||
uint RshareSettings::getBWGraphFilter()
|
||||
{
|
||||
return value(SETTING_BWGRAPH_FILTER, DEFAULT_BWGRAPH_FILTER).toUInt();
|
||||
}
|
||||
|
||||
/** Saves the setting for whether or not the given line will be graphed */
|
||||
void RshareSettings::setBWGraphFilter(uint line, bool status)
|
||||
{
|
||||
uint filter = getBWGraphFilter();
|
||||
filter = (status ? (filter | line) : (filter & ~(line)));
|
||||
setValue(SETTING_BWGRAPH_FILTER, filter);
|
||||
}
|
||||
|
||||
/** Get the level of opacity for the BandwidthGraph window. */
|
||||
int RshareSettings::getBWGraphOpacity()
|
||||
{
|
||||
return value(SETTING_BWGRAPH_OPACITY, DEFAULT_OPACITY).toInt();
|
||||
}
|
||||
|
||||
/** Set the level of opacity for the BandwidthGraph window. */
|
||||
void RshareSettings::setBWGraphOpacity(int value)
|
||||
{
|
||||
setValue(SETTING_BWGRAPH_OPACITY, value);
|
||||
}
|
||||
|
||||
/** Gets whether the bandwidth graph is always on top when displayed. */
|
||||
bool RshareSettings::getBWGraphAlwaysOnTop()
|
||||
{
|
||||
return value(SETTING_BWGRAPH_ALWAYS_ON_TOP,
|
||||
DEFAULT_BWGRAPH_ALWAYS_ON_TOP).toBool();
|
||||
}
|
||||
|
||||
/** Sets whether the bandwidth graph is always on top when displayed. */
|
||||
void RshareSettings::setBWGraphAlwaysOnTop(bool alwaysOnTop)
|
||||
{
|
||||
setValue(SETTING_BWGRAPH_ALWAYS_ON_TOP, alwaysOnTop);
|
||||
}
|
||||
|
||||
/** Returns true if RetroShare's main window should be visible when the
|
||||
* application starts. */
|
||||
bool
|
||||
RshareSettings::showMainWindowAtStart()
|
||||
{
|
||||
return value(SETTING_SHOW_MAINWINDOW_AT_START).toBool();
|
||||
}
|
||||
|
||||
/** Sets whether to show RetroShare's main window when the application starts. */
|
||||
void
|
||||
RshareSettings::setShowMainWindowAtStart(bool show)
|
||||
{
|
||||
setValue(SETTING_SHOW_MAINWINDOW_AT_START, show);
|
||||
}
|
||||
|
||||
/** Returns true if Vidalia is set to run on system boot. */
|
||||
bool
|
||||
RshareSettings::runRetroshareOnBoot()
|
||||
{
|
||||
#if defined(Q_WS_WIN)
|
||||
if (!win32_registry_get_key_value(STARTUP_REG_KEY, RETROSHARE_REG_KEY).isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
/* Platforms other than windows aren't supported yet */
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** If <b>run</b> is set to true, then Vidalia will run on system boot. */
|
||||
void
|
||||
RshareSettings::setRunRetroshareOnBoot(bool run)
|
||||
{
|
||||
#if defined(Q_WS_WIN)
|
||||
if (run) {
|
||||
win32_registry_set_key_value(STARTUP_REG_KEY, RETROSHARE_REG_KEY,
|
||||
QString("\"" +
|
||||
QDir::convertSeparators(QCoreApplication::applicationFilePath())) +
|
||||
"\"");
|
||||
} else {
|
||||
win32_registry_remove_key(STARTUP_REG_KEY, RETROSHARE_REG_KEY);
|
||||
}
|
||||
#else
|
||||
/* Platforms othe rthan windows aren't supported yet */
|
||||
Q_UNUSED(run);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Saving Generic Widget Size / Location */
|
||||
|
||||
void RshareSettings::saveWidgetInformation(QWidget *widget)
|
||||
{
|
||||
beginGroup("widgetInformation");
|
||||
beginGroup(widget->objectName());
|
||||
|
||||
setValue("size", widget->size());
|
||||
setValue("pos", widget->pos());
|
||||
|
||||
endGroup();
|
||||
endGroup();
|
||||
}
|
||||
|
||||
void RshareSettings::saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar)
|
||||
{
|
||||
beginGroup("widgetInformation");
|
||||
beginGroup(widget->objectName());
|
||||
|
||||
setValue("toolBarArea", widget->toolBarArea(toolBar));
|
||||
|
||||
endGroup();
|
||||
endGroup();
|
||||
|
||||
saveWidgetInformation(widget);
|
||||
}
|
||||
|
||||
void RshareSettings::loadWidgetInformation(QWidget *widget)
|
||||
{
|
||||
beginGroup("widgetInformation");
|
||||
beginGroup(widget->objectName());
|
||||
|
||||
widget->resize(value("size", widget->size()).toSize());
|
||||
widget->move(value("pos", QPoint(200, 200)).toPoint());
|
||||
|
||||
endGroup();
|
||||
endGroup();
|
||||
}
|
||||
|
||||
void RshareSettings::loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar)
|
||||
{
|
||||
beginGroup("widgetInformation");
|
||||
beginGroup(widget->objectName());
|
||||
|
||||
widget->addToolBar((Qt::ToolBarArea) value("toolBarArea", Qt::TopToolBarArea).toInt(),
|
||||
toolBar);
|
||||
|
||||
endGroup();
|
||||
endGroup();
|
||||
|
||||
loadWidgetInformation(widget);
|
||||
}
|
||||
|
120
retroshare-gui/src/gui/Preferences/rsharesettings.h
Normal file
120
retroshare-gui/src/gui/Preferences/rsharesettings.h
Normal file
@ -0,0 +1,120 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _RSHARESETTINGS_H
|
||||
#define _RSHARESETTINGS_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QSettings>
|
||||
|
||||
#include <gui/linetypes.h>
|
||||
#include "rsettings.h"
|
||||
|
||||
|
||||
//Forward declaration.
|
||||
class QWidget;
|
||||
class QTableWidget;
|
||||
class QToolBar;
|
||||
class QMainWindow;
|
||||
|
||||
/** Handles saving and restoring RShares's settings, such as the
|
||||
* location of Tor, the control port, etc.
|
||||
*
|
||||
* NOTE: Qt 4.1 documentation states that constructing a QSettings object is
|
||||
* "very fast", so we shouldn't need to create a global instance of this
|
||||
* class.
|
||||
*/
|
||||
class RshareSettings : public RSettings
|
||||
{
|
||||
|
||||
public:
|
||||
/** Default constructor. */
|
||||
RshareSettings();
|
||||
|
||||
/** Gets the currently preferred language code for RShare. */
|
||||
QString getLanguageCode();
|
||||
/** Saves the preferred language code. */
|
||||
void setLanguageCode(QString languageCode);
|
||||
|
||||
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
|
||||
QString getInterfaceStyle();
|
||||
/** Sets the interface style key. */
|
||||
void setInterfaceStyle(QString styleKey);
|
||||
|
||||
/** Sets the stylesheet */
|
||||
void setSheetName(QString sheet);
|
||||
/** Gets the stylesheet */
|
||||
QString getSheetName();
|
||||
|
||||
/** Returns true if RetroShare's main window should be visible when the
|
||||
* application starts. */
|
||||
bool showMainWindowAtStart();
|
||||
/** Sets whether to show Vidalia's main window when the application starts. */
|
||||
void setShowMainWindowAtStart(bool show);
|
||||
|
||||
/** Returns true if RetroShare should start on system boot. */
|
||||
bool runRetroshareOnBoot();
|
||||
/** Set whether to run RetroShare on system boot. */
|
||||
void setRunRetroshareOnBoot(bool run);
|
||||
|
||||
|
||||
/* Get the destination log file. */
|
||||
QString getLogFile();
|
||||
/** Set the destination log file. */
|
||||
void setLogFile(QString file);
|
||||
|
||||
/* Get the bandwidth graph line filter. */
|
||||
uint getBWGraphFilter();
|
||||
/** Set the bandwidth graph line filter. */
|
||||
void setBWGraphFilter(uint line, bool status);
|
||||
|
||||
/** Set the bandwidth graph opacity setting. */
|
||||
int getBWGraphOpacity();
|
||||
/** Set the bandwidth graph opacity settings. */
|
||||
void setBWGraphOpacity(int value);
|
||||
|
||||
/** Gets whether the bandwidth graph is always on top. */
|
||||
bool getBWGraphAlwaysOnTop();
|
||||
/** Sets whether the bandwidth graph is always on top. */
|
||||
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
|
||||
|
||||
|
||||
//! Save placement, state and size information of a window.
|
||||
void saveWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Load placement, state and size information of a window.
|
||||
void loadWidgetInformation(QWidget *widget);
|
||||
|
||||
//! Method overload. Save window and toolbar information.
|
||||
void saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
|
||||
//! Method overload. Restore window and toolbar information.
|
||||
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -97,16 +97,14 @@ RWindow::restoreWindowState()
|
||||
QVariant
|
||||
RWindow::getSetting(QString setting, QVariant defaultValue)
|
||||
{
|
||||
QString key = _name + "/" + setting;
|
||||
return _settings->value(key, defaultValue);
|
||||
return _settings->value(setting, defaultValue);
|
||||
}
|
||||
|
||||
/** Saves a value associated with a property name for this window object. */
|
||||
void
|
||||
RWindow::saveSetting(QString prop, QVariant value)
|
||||
{
|
||||
QString key = _name + "/" + prop;
|
||||
_settings->setValue(key, value);
|
||||
_settings->setValue(prop, value);
|
||||
}
|
||||
|
||||
/** Overloaded QWidget::setVisible(). If this window is already visible and
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <QWidget>
|
||||
#include <QVariant>
|
||||
#include <QMainWindow>
|
||||
#include <config/rsharesettings.h>
|
||||
#include <gui/Preferences/rsharesettings.h>
|
||||
|
||||
|
||||
class RWindow : public QMainWindow
|
||||
|
@ -161,6 +161,7 @@
|
||||
<file>images/invitefriendlabel.png</file>
|
||||
<file>images/kbackgammon.png</file>
|
||||
<file>images/kblogger.png</file>
|
||||
<file>images/kcmsystem24.png</file>
|
||||
<file>images/kdmconfig.png</file>
|
||||
<file>images/konsole.png</file>
|
||||
<file>images/konqsidebar_news16.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/kcmsystem24.png
Normal file
BIN
retroshare-gui/src/gui/images/kcmsystem24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -27,7 +27,7 @@
|
||||
#include <QStyleFactory>
|
||||
#include <util/string.h>
|
||||
#include <lang/languagesupport.h>
|
||||
#include "config/rsharesettings.h"
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
|
||||
#include "rshare.h"
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
|
||||
|
||||
/** Rshare's version string */
|
||||
#define RSHARE_VERSION "0.7"
|
||||
|
@ -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…
Reference in New Issue
Block a user