2010-09-10 14:38:46 -04:00
|
|
|
/****************************************************************
|
|
|
|
* This file is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 - 2010, RetroShare Team
|
|
|
|
*
|
|
|
|
* 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 _RSHAREPEERSETTINGS_H
|
|
|
|
#define _RSHAREPEERSETTINGS_H
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
2011-04-09 18:52:52 -04:00
|
|
|
class RSStyle;
|
|
|
|
|
2010-09-10 14:38:46 -04:00
|
|
|
/** Handles saving and restoring RShares's settings for peers */
|
|
|
|
class RsharePeerSettings : public QSettings
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/* create settings object */
|
|
|
|
static void Create ();
|
|
|
|
|
|
|
|
QString getPrivateChatColor(const std::string &peerId);
|
|
|
|
void setPrivateChatColor(const std::string &peerId, const QString &value);
|
|
|
|
|
|
|
|
QString getPrivateChatFont(const std::string &peerId);
|
|
|
|
void setPrivateChatFont(const std::string &peerId, const QString &value);
|
|
|
|
|
2010-11-15 15:49:24 -05:00
|
|
|
void saveWidgetInformation(const std::string &peerId, QWidget *widget);
|
|
|
|
void loadWidgetInformation(const std::string &peerId, QWidget *widget);
|
|
|
|
|
2011-03-26 19:19:28 -04:00
|
|
|
bool getShowAvatarFrame(const std::string &peerId);
|
|
|
|
void setShowAvatarFrame(const std::string &peerId, bool value);
|
|
|
|
|
2011-04-09 18:52:52 -04:00
|
|
|
void getStyle(const std::string &peerId, const QString &name, RSStyle &style);
|
|
|
|
void setStyle(const std::string &peerId, const QString &name, RSStyle &style);
|
|
|
|
|
2010-09-10 14:38:46 -04:00
|
|
|
protected:
|
|
|
|
/** Default constructor. */
|
|
|
|
RsharePeerSettings();
|
|
|
|
|
|
|
|
bool getGpgIdOfSslId(const std::string &sslId, std::string &gpgId);
|
|
|
|
void cleanDeadGpgIds();
|
|
|
|
|
|
|
|
/* get value of peer */
|
|
|
|
QVariant get(const std::string &peerId, const QString &key, const QVariant &defaultValue = QVariant());
|
|
|
|
/* set value of peer */
|
|
|
|
void set(const std::string &peerId, const QString &key, const QVariant &value);
|
|
|
|
|
|
|
|
/* map for fast access of the gpg id to the ssl id */
|
|
|
|
std::map<std::string, std::string> m_SslToGpg;
|
|
|
|
};
|
|
|
|
|
|
|
|
// the one and only global settings object
|
|
|
|
extern RsharePeerSettings *PeerSettings;
|
|
|
|
|
|
|
|
#endif
|