mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 00:31:32 -04:00
removed not needed old Preferences
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1876 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
34c4e500e4
commit
bbe773b91c
73 changed files with 257 additions and 10573 deletions
|
@ -26,7 +26,7 @@
|
|||
#include <QStyleFactory>
|
||||
#include <QtGui>
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
#include "rsharesettings.h"
|
||||
#include <lang/languagesupport.h>
|
||||
|
||||
#include "configpage.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include <gui/Preferences/rsharesettings.h>
|
||||
#include "rsharesettings.h"
|
||||
#include "gui/connect/ConnectFriendWizard.h"
|
||||
|
||||
#include "configpage.h"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "FileAssociationsPage.h"
|
||||
#include "AddFileAssociationDialog.h"
|
||||
//#include "rshare.h" // for Rshare::dataDirectory() method
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_GeneralPage.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_NotifyPage.h"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <gui/Preferences/rsharesettings.h>
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "configpage.h"
|
||||
#include "ui_SoundPage.h"
|
||||
|
|
95
retroshare-gui/src/gui/settings/rsettings.cpp
Normal file
95
retroshare-gui/src/gui/settings/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/settings/rsettings.h
Normal file
68
retroshare-gui/src/gui/settings/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
|
||||
|
336
retroshare-gui/src/gui/settings/rsharesettings.cpp
Normal file
336
retroshare-gui/src/gui/settings/rsharesettings.cpp
Normal file
|
@ -0,0 +1,336 @@
|
|||
/****************************************************************
|
||||
* 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 "rsiface/rsnotify.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#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"
|
||||
|
||||
#define SETTING_NEWSFEED_FLAGS "NewsFeedFlags"
|
||||
#define SETTING_CHAT_FLAGS "ChatFlags"
|
||||
#define SETTING_NOTIFY_FLAGS "NotifyFlags"
|
||||
#define SETTING_CHAT_AVATAR "ChatAvatar"
|
||||
|
||||
/* 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);
|
||||
|
||||
/* defaults here are not ideal.... but dusent matter */
|
||||
|
||||
uint defChat = (RS_CHAT_OPEN_NEW |
|
||||
RS_CHAT_REOPEN );
|
||||
// This is not default... RS_CHAT_FOCUS.
|
||||
|
||||
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG |
|
||||
RS_POPUP_CHAT | RS_POPUP_CALL);
|
||||
|
||||
uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN |
|
||||
RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
|
||||
RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG |
|
||||
RS_FEED_TYPE_FILES);
|
||||
|
||||
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed);
|
||||
setDefault(SETTING_CHAT_FLAGS, defChat);
|
||||
setDefault(SETTING_NOTIFY_FLAGS, defNotify);
|
||||
|
||||
}
|
||||
|
||||
/** Gets/sets the currently saved chat avatar. */
|
||||
QImage RshareSettings::getChatAvatar() const
|
||||
{
|
||||
return value(SETTING_CHAT_AVATAR).value<QImage>();
|
||||
}
|
||||
void RshareSettings::setChatAvatar(const QImage& I)
|
||||
{
|
||||
setValue(SETTING_CHAT_AVATAR,I) ;
|
||||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
||||
/** Setting for Notify / Chat and NewsFeeds **/
|
||||
uint RshareSettings::getNewsFeedFlags()
|
||||
{
|
||||
return value(SETTING_NEWSFEED_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setNewsFeedFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_NEWSFEED_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getChatFlags()
|
||||
{
|
||||
return value(SETTING_CHAT_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setChatFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_CHAT_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getNotifyFlags()
|
||||
{
|
||||
return value(SETTING_NOTIFY_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setNotifyFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_NOTIFY_FLAGS, flags);
|
||||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
136
retroshare-gui/src/gui/settings/rsharesettings.h
Normal file
136
retroshare-gui/src/gui/settings/rsharesettings.h
Normal file
|
@ -0,0 +1,136 @@
|
|||
/****************************************************************
|
||||
* 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);
|
||||
|
||||
/** Returns the chat avatar. Returns a null image if no avatar is saved. */
|
||||
QImage getChatAvatar() const ;
|
||||
|
||||
/** set the chat avatar. Returns a null image if no avatar is saved. */
|
||||
void setChatAvatar(const QImage&) ;
|
||||
|
||||
|
||||
/* 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);
|
||||
|
||||
uint getNewsFeedFlags();
|
||||
void setNewsFeedFlags(uint flags);
|
||||
|
||||
uint getChatFlags();
|
||||
void setChatFlags(uint flags);
|
||||
|
||||
uint getNotifyFlags();
|
||||
void setNotifyFlags(uint flags);
|
||||
|
||||
|
||||
//! 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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue