2018-12-23 12:03:08 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
* gui/settings/RsharePeerSettings.h *
|
|
|
|
* *
|
|
|
|
* Copyright (c) 2010, Retroshare Team <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2010-09-10 14:38:46 -04:00
|
|
|
|
|
|
|
#ifndef _RSHAREPEERSETTINGS_H
|
|
|
|
#define _RSHAREPEERSETTINGS_H
|
|
|
|
|
|
|
|
#include <QSettings>
|
2014-12-29 16:41:05 -05:00
|
|
|
#include <retroshare/rstypes.h>
|
|
|
|
#include <retroshare/rsmsgs.h>
|
2010-09-10 14:38:46 -04:00
|
|
|
|
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 ();
|
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
QString getPrivateChatColor(const ChatId& chatId);
|
|
|
|
void setPrivateChatColor(const ChatId& chatId, const QString &value);
|
2010-09-10 14:38:46 -04:00
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
QString getPrivateChatFont(const ChatId& chatId);
|
|
|
|
void setPrivateChatFont(const ChatId& chatId, const QString &value);
|
2010-09-10 14:38:46 -04:00
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
bool getPrivateChatOnTop(const ChatId& chatId);
|
|
|
|
void setPrivateChatOnTop(const ChatId& chatId, bool value);
|
2011-07-08 18:33:26 -04:00
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
void saveWidgetInformation(const ChatId& chatId, QWidget *widget);
|
|
|
|
void loadWidgetInformation(const ChatId& chatId, QWidget *widget);
|
2010-11-15 15:49:24 -05:00
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
bool getShowAvatarFrame(const ChatId& chatId);
|
|
|
|
void setShowAvatarFrame(const ChatId& chatId, bool value);
|
2011-03-26 19:19:28 -04:00
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
void getStyle(const ChatId& chatId, const QString &name, RSStyle &style);
|
|
|
|
void setStyle(const ChatId& chatId, const QString &name, RSStyle &style);
|
2011-04-09 18:52:52 -04:00
|
|
|
|
2010-09-10 14:38:46 -04:00
|
|
|
protected:
|
|
|
|
/** Default constructor. */
|
|
|
|
RsharePeerSettings();
|
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
bool getSettingsIdOfPeerId(const ChatId& chatId, std::string &settingsId);
|
2012-01-17 15:36:36 -05:00
|
|
|
void cleanDeadIds();
|
2010-09-10 14:38:46 -04:00
|
|
|
|
|
|
|
/* get value of peer */
|
2014-12-29 16:41:05 -05:00
|
|
|
QVariant get(const ChatId& chatId, const QString &key, const QVariant &defaultValue = QVariant());
|
2010-09-10 14:38:46 -04:00
|
|
|
/* set value of peer */
|
2014-12-29 16:41:05 -05:00
|
|
|
void set(const ChatId& chatId, const QString &key, const QVariant &value);
|
2010-09-10 14:38:46 -04:00
|
|
|
|
|
|
|
/* map for fast access of the gpg id to the ssl id */
|
2014-03-17 16:56:06 -04:00
|
|
|
std::map<RsPeerId, std::string> m_SslToGpg;
|
2010-09-10 14:38:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// the one and only global settings object
|
|
|
|
extern RsharePeerSettings *PeerSettings;
|
|
|
|
|
|
|
|
#endif
|