2008-08-14 20:23:27 -04:00
|
|
|
/****************************************************************
|
2009-03-01 10:18:34 -05:00
|
|
|
* This file is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006-2007, crypton
|
2008-08-14 20:23:27 -04:00
|
|
|
* 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
|
|
|
|
|
2015-04-24 12:41:34 -04:00
|
|
|
#include <stdint.h>
|
2008-08-14 20:23:27 -04:00
|
|
|
#include <QHash>
|
2014-05-26 17:51:53 -04:00
|
|
|
#include <QRgb>
|
2008-08-14 20:23:27 -04:00
|
|
|
#include <QSettings>
|
|
|
|
|
2015-05-29 14:03:14 -04:00
|
|
|
#include <stdint.h>
|
2008-08-14 20:23:27 -04:00
|
|
|
#include <gui/linetypes.h>
|
|
|
|
#include "rsettings.h"
|
|
|
|
|
2012-10-27 11:59:12 -04:00
|
|
|
#define RS_CHATLOBBY_BLINK 0x00000001
|
|
|
|
|
2011-01-07 11:56:57 -05:00
|
|
|
#define STATUSBAR_DISC 0x00000001
|
|
|
|
|
2008-08-14 20:23:27 -04:00
|
|
|
//Forward declaration.
|
|
|
|
class QWidget;
|
|
|
|
class QToolBar;
|
|
|
|
class QMainWindow;
|
|
|
|
|
2014-07-24 10:54:23 -04:00
|
|
|
class GroupFrameSettings
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type { Nothing, Forum, Channel, Posted };
|
|
|
|
|
|
|
|
public:
|
|
|
|
GroupFrameSettings()
|
|
|
|
{
|
|
|
|
mOpenAllInNewTab = false;
|
|
|
|
mHideTabBarWithOneTab = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool mOpenAllInNewTab;
|
|
|
|
bool mHideTabBarWithOneTab;
|
|
|
|
};
|
|
|
|
|
2010-05-18 14:02:51 -04:00
|
|
|
/** Handles saving and restoring RShares's settings
|
2008-08-14 20:23:27 -04:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
{
|
2010-12-02 19:54:40 -05:00
|
|
|
public:
|
2014-07-24 12:52:11 -04:00
|
|
|
enum enumLastDir
|
|
|
|
{
|
|
|
|
LASTDIR_EXTRAFILE,
|
|
|
|
LASTDIR_CERT,
|
|
|
|
LASTDIR_HISTORY,
|
|
|
|
LASTDIR_IMAGES,
|
|
|
|
LASTDIR_MESSAGES,
|
|
|
|
LASTDIR_BLOGS,
|
2016-07-31 16:14:23 -04:00
|
|
|
LASTDIR_SOUNDS,
|
|
|
|
LASTDIR_PLUGIN
|
|
|
|
};
|
2014-07-24 12:52:11 -04:00
|
|
|
|
|
|
|
enum enumToasterPosition
|
|
|
|
{
|
|
|
|
TOASTERPOS_TOPLEFT,
|
|
|
|
TOASTERPOS_TOPRIGHT,
|
|
|
|
TOASTERPOS_BOTTOMLEFT,
|
|
|
|
TOASTERPOS_BOTTOMRIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum enumMsgOpen
|
|
|
|
{
|
|
|
|
MSG_OPEN_TAB,
|
|
|
|
MSG_OPEN_WINDOW
|
|
|
|
};
|
2011-06-03 20:46:02 -04:00
|
|
|
|
2008-08-14 20:23:27 -04:00
|
|
|
public:
|
2014-07-24 12:52:11 -04:00
|
|
|
/* create settings object */
|
|
|
|
static void Create(bool forceCreateNew = false);
|
|
|
|
|
|
|
|
/** 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();
|
|
|
|
|
|
|
|
/** Gets the page button Location.*/
|
|
|
|
bool getPageButtonLoc();
|
|
|
|
/** Sets the page button Location.*/
|
|
|
|
void setPageButtonLoc(bool onToolBar);
|
|
|
|
|
|
|
|
/** Gets the action button Location.*/
|
|
|
|
bool getActionButtonLoc();
|
|
|
|
/** Sets the action button Location.*/
|
|
|
|
void setActionButtonLoc(bool onToolBar);
|
|
|
|
|
|
|
|
/** Gets the tool button's style.*/
|
|
|
|
Qt::ToolButtonStyle getToolButtonStyle();
|
|
|
|
/** Sets the tool button's style.*/
|
|
|
|
void setToolButtonStyle(Qt::ToolButtonStyle style);
|
|
|
|
|
|
|
|
/** Gets the tool button's size.*/
|
|
|
|
int getToolButtonSize();
|
|
|
|
/** Sets the tool button's size.*/
|
|
|
|
void setToolButtonSize(int size);
|
|
|
|
|
|
|
|
/** Gets the list item icon's size.*/
|
|
|
|
int getListItemIconSize();
|
|
|
|
/** Sets the list item icon's size.*/
|
|
|
|
void setListItemIconSize(int size);
|
|
|
|
|
|
|
|
/** Returns true if RetroShare's main window should be visible when the
|
2008-08-14 20:23:27 -04:00
|
|
|
* application starts. */
|
2014-07-24 12:52:11 -04:00
|
|
|
bool getStartMinimized();
|
|
|
|
/** Sets whether to show main window when the application starts. */
|
|
|
|
void setStartMinimized(bool startMinimized);
|
|
|
|
|
|
|
|
bool getCloseToTray();
|
|
|
|
void setCloseToTray(bool closeToTray);
|
2010-12-13 15:34:07 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Returns true if RetroShare should start on system boot. */
|
|
|
|
bool runRetroshareOnBoot(bool &minimized);
|
2010-12-13 15:34:07 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Set whether to run RetroShare on system boot. */
|
|
|
|
void setRunRetroshareOnBoot(bool run, bool minimized);
|
2009-03-01 10:18:34 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Returns true if the user can set retroshare as protocol */
|
|
|
|
bool canSetRetroShareProtocol();
|
|
|
|
/** Returns true if retroshare:// is registered as protocol */
|
|
|
|
bool getRetroShareProtocol();
|
2016-03-01 07:08:33 -05:00
|
|
|
/** Register retroshare:// as protocol */
|
|
|
|
bool setRetroShareProtocol(bool value, QString &error);
|
|
|
|
|
|
|
|
/** Returns true if this instance have to run Local Server*/
|
|
|
|
bool getUseLocalServer();
|
|
|
|
/** Sets whether to run Local Server */
|
|
|
|
void setUseLocalServer(bool value);
|
2009-03-01 10:18:34 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* Get the destination log file. */
|
|
|
|
QString getLogFile();
|
|
|
|
/** Set the destination log file. */
|
|
|
|
void setLogFile(QString file);
|
2011-04-14 17:59:51 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
QString getLastDir(enumLastDir type);
|
|
|
|
void setLastDir(enumLastDir type, const QString &lastDir);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* Get the bandwidth graph line filter. */
|
|
|
|
uint getBWGraphFilter();
|
|
|
|
/** Set the bandwidth graph line filter. */
|
|
|
|
void setBWGraphFilter(uint line, bool status);
|
2010-12-02 19:54:40 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Set the bandwidth graph opacity setting. */
|
|
|
|
int getBWGraphOpacity();
|
|
|
|
/** Set the bandwidth graph opacity settings. */
|
|
|
|
void setBWGraphOpacity(int value);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Gets whether the bandwidth graph is always on top. */
|
|
|
|
bool getBWGraphAlwaysOnTop();
|
|
|
|
/** Sets whether the bandwidth graph is always on top. */
|
|
|
|
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2017-12-21 12:16:32 -05:00
|
|
|
void setHiddenServiceKey() ;
|
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
uint getNewsFeedFlags();
|
|
|
|
void setNewsFeedFlags(uint flags);
|
2008-12-07 09:19:13 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
uint getChatFlags();
|
|
|
|
void setChatFlags(uint flags);
|
2008-12-07 09:19:13 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
uint getChatLobbyFlags();
|
|
|
|
void setChatLobbyFlags(uint flags);
|
2012-10-27 11:59:12 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
uint getNotifyFlags();
|
|
|
|
void setNotifyFlags(uint flags);
|
2008-12-07 09:19:13 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
uint getMessageFlags();
|
|
|
|
void setMessageFlags(uint flags);
|
2012-04-26 19:41:14 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
bool getDisplayTrayChatLobby();
|
|
|
|
void setDisplayTrayChatLobby(bool bValue);
|
|
|
|
bool getDisplayTrayGroupChat();
|
|
|
|
void setDisplayTrayGroupChat(bool bValue);
|
2010-06-15 12:51:48 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
bool getChatSendMessageWithCtrlReturn();
|
|
|
|
void setChatSendMessageWithCtrlReturn(bool bValue);
|
2010-09-07 11:49:31 -04:00
|
|
|
|
2017-01-20 14:26:50 -05:00
|
|
|
bool getChatDoNotSendIsTyping();
|
|
|
|
void setChatDoNotSendIsTyping(bool bValue);
|
|
|
|
|
2016-01-27 14:27:44 -05:00
|
|
|
bool getChatSendAsPlainTextByDef();
|
|
|
|
void setChatSendAsPlainTextByDef(bool bValue);
|
|
|
|
|
|
|
|
bool getChatSearchShowBarByDefault();
|
|
|
|
void setChatSearchShowBarByDefault(bool bValue);
|
|
|
|
|
2014-05-26 17:51:53 -04:00
|
|
|
void setChatSearchCharToStartSearch(int iValue);
|
|
|
|
int getChatSearchCharToStartSearch();
|
|
|
|
|
|
|
|
void setChatSearchCaseSensitively(bool bValue);
|
|
|
|
bool getChatSearchCaseSensitively();
|
|
|
|
|
|
|
|
void setChatSearchWholeWords(bool bValue);
|
|
|
|
bool getChatSearchWholeWords();
|
|
|
|
|
|
|
|
void setChatSearchMoveToCursor(bool bValue);
|
|
|
|
bool getChatSearchMoveToCursor();
|
|
|
|
|
|
|
|
void setChatSearchSearchWithoutLimit(bool bValue);
|
|
|
|
bool getChatSearchSearchWithoutLimit();
|
|
|
|
|
|
|
|
void setChatSearchMaxSearchLimitColor(uint uiValue);
|
|
|
|
uint getChatSearchMaxSearchLimitColor();
|
|
|
|
|
|
|
|
void setChatSearchFoundColor(QRgb rgbValue);
|
|
|
|
QRgb getChatSearchFoundColor();
|
|
|
|
|
2016-08-09 17:32:25 -04:00
|
|
|
bool getChatLoadEmbeddedImages();
|
|
|
|
void setChatLoadEmbeddedImages(bool value);
|
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
enumToasterPosition getToasterPosition();
|
|
|
|
void setToasterPosition(enumToasterPosition position);
|
2010-12-10 16:49:38 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
QPoint getToasterMargin();
|
|
|
|
void setToasterMargin(QPoint margin);
|
2010-12-10 16:49:38 -05:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* chat font */
|
|
|
|
QString getChatScreenFont();
|
|
|
|
void setChatScreenFont(const QString &font);
|
2010-09-10 14:38:46 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* chat styles */
|
|
|
|
void getPublicChatStyle(QString &stylePath, QString &styleVariant);
|
|
|
|
void setPublicChatStyle(const QString &stylePath, const QString &styleVariant);
|
2010-09-07 11:49:31 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
void getPrivateChatStyle(QString &stylePath, QString &styleVariant);
|
|
|
|
void setPrivateChatStyle(const QString &stylePath, const QString &styleVariant);
|
2010-09-07 11:49:31 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
void getHistoryChatStyle(QString &stylePath, QString &styleVariant);
|
|
|
|
void setHistoryChatStyle(const QString &stylePath, const QString &styleVariant);
|
2010-09-07 11:49:31 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* Chat */
|
|
|
|
int getPublicChatHistoryCount();
|
|
|
|
void setPublicChatHistoryCount(int value);
|
2010-11-04 07:14:47 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
int getPrivateChatHistoryCount();
|
|
|
|
void setPrivateChatHistoryCount(int value);
|
2010-11-04 07:14:47 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
int getLobbyChatHistoryCount();
|
|
|
|
void setLobbyChatHistoryCount(int value);
|
2013-09-27 17:18:44 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
//! Save placement, state and size information of a window.
|
|
|
|
void saveWidgetInformation(QWidget *widget);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
//! Load placement, state and size information of a window.
|
|
|
|
void loadWidgetInformation(QWidget *widget);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
//! Method overload. Save window and toolbar information.
|
|
|
|
void saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
//! Method overload. Restore window and toolbar information.
|
|
|
|
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* MainWindow */
|
|
|
|
int getLastPageInMainWindow ();
|
|
|
|
void setLastPageInMainWindow (int value);
|
|
|
|
uint getStatusBarFlags();
|
|
|
|
void setStatusBarFlags(uint flags);
|
|
|
|
void setStatusBarFlag(uint flag, bool enable);
|
2010-11-04 07:14:47 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* Message */
|
|
|
|
bool getMsgSetToReadOnActivate();
|
|
|
|
void setMsgSetToReadOnActivate(bool value);
|
|
|
|
bool getMsgLoadEmbeddedImages();
|
|
|
|
void setMsgLoadEmbeddedImages(bool value);
|
2010-05-23 13:21:30 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
enumMsgOpen getMsgOpen();
|
|
|
|
void setMsgOpen(enumMsgOpen value);
|
2011-06-03 20:46:02 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* Forum */
|
|
|
|
bool getForumMsgSetToReadOnActivate();
|
|
|
|
void setForumMsgSetToReadOnActivate(bool value);
|
|
|
|
bool getForumExpandNewMessages();
|
|
|
|
void setForumExpandNewMessages(bool value);
|
|
|
|
bool getForumLoadEmbeddedImages();
|
|
|
|
void setForumLoadEmbeddedImages(bool value);
|
2017-01-18 15:22:38 -05:00
|
|
|
bool getForumLoadEmoticons();
|
|
|
|
void setForumLoadEmoticons(bool value);
|
2014-07-14 17:29:51 -04:00
|
|
|
|
2014-08-06 13:41:22 -04:00
|
|
|
/* Channel */
|
|
|
|
bool getChannelLoadThread();
|
|
|
|
void setChannelLoadThread(bool value);
|
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* GroupFrame settings */
|
|
|
|
bool getGroupFrameSettings(GroupFrameSettings::Type type, GroupFrameSettings &groupFrameSettings);
|
|
|
|
void setGroupFrameSettings(GroupFrameSettings::Type type, const GroupFrameSettings &groupFrameSettings);
|
2010-08-08 18:58:10 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* time before idle */
|
|
|
|
uint getMaxTimeBeforeIdle();
|
|
|
|
void setMaxTimeBeforeIdle(uint value);
|
2010-07-21 03:39:14 -04:00
|
|
|
|
2015-04-24 10:31:13 -04:00
|
|
|
// webinterface
|
|
|
|
bool getWebinterfaceEnabled();
|
|
|
|
void setWebinterfaceEnabled(bool enabled);
|
|
|
|
|
|
|
|
uint16_t getWebinterfacePort();
|
|
|
|
void setWebinterfacePort(uint16_t port);
|
|
|
|
|
|
|
|
bool getWebinterfaceAllowAllIps();
|
|
|
|
void setWebinterfaceAllowAllIps(bool allow_all);
|
2015-10-20 22:00:15 -04:00
|
|
|
|
|
|
|
// proxy function that computes the best icon size among sizes passed as array, to match the recommended size on screen.
|
|
|
|
int computeBestIconSize(int n_sizes, int *sizes, int recommended_size);
|
2015-04-24 10:31:13 -04:00
|
|
|
|
2017-02-25 18:16:36 -05:00
|
|
|
bool getPageAlreadyDisplayed(const QString& page_code) ;
|
|
|
|
void setPageAlreadyDisplayed(const QString& page_code,bool b) ;
|
2017-02-25 17:52:57 -05:00
|
|
|
|
2010-05-20 17:53:27 -04:00
|
|
|
protected:
|
2014-07-24 12:52:11 -04:00
|
|
|
/** Default constructor. */
|
|
|
|
RshareSettings();
|
2008-08-14 20:23:27 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
void initSettings();
|
2010-07-21 03:39:14 -04:00
|
|
|
|
2014-07-24 12:52:11 -04:00
|
|
|
/* member for fast access */
|
2015-10-20 22:00:15 -04:00
|
|
|
int m_maxTimeBeforeIdle;
|
2008-08-14 20:23:27 -04:00
|
|
|
};
|
|
|
|
|
2010-05-20 17:53:27 -04:00
|
|
|
// the one and only global settings object
|
|
|
|
extern RshareSettings *Settings;
|
|
|
|
|
2008-08-14 20:23:27 -04:00
|
|
|
#endif
|