/***************************************************************************
                          dcconfig.h  -  description
                             -------------------
    begin                : Fri Mar 1 2002
    copyright            : (C) 2002 by Mathias Küster
    email                : mathen@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DCCONFIG_H
#define DCCONFIG_H

/**
 *@author Mathias Küster
 */

#include <QImage>
#include <QObject>
#include <QByteArray>
#include <QMap>
#include <QList>
#include <QStringList>

// the typedef in dcfriendobject.h prevents the forward
// declaration of "class FriendMap;" from working
#include "dcfriendobject.h"
#include "dcdownloadalias.h"

#include <dclib/cconfig.h>

#define USERLIST_XPM_COLUMNS      9
#define USERLIST_XPM_ROWS        32
#define USERLIST_ICON_SIZE       16

/** */
enum eTransferViewType {
    etvtNONE = 0,
    etvtWINDOW,
    etvtDOCK
};

/** */
typedef unsigned int SoundDisableMode;
#define SET_SOUNDDISABLEWACTIVE(a) ((a) |= (1 << 0))
#define SET_SOUNDDISABLEWSHOW(a)   ((a) |= (1 << 1))
#define USET_SOUNDDISABLEWACTIVE(a) ((a) &= ~(1 << 0))
#define USET_SOUNDDISABLEWSHOW(a)   ((a) &= ~(1 << 1))
#define IS_SOUNDDISABLEWACTIVE(a) (((a) & (1 << 0)) == (1 << 0))
#define IS_SOUNDDISABLEWSHOW(a)   (((a) & (1 << 1)) == (1 << 1))

/** */
typedef unsigned int TrayMessageType;
#define SET_TRAY_MSG_DISC(a)        ((a) |= (1 << 0))
#define SET_TRAY_MSG_PRIV(a)        ((a) |= (1 << 1))
#define SET_TRAY_MSG_NICK(a)        ((a) |= (1 << 2))
#define SET_TRAY_MSG_NONE(a)        ((a) |= (1 << 3))
#define SET_TRAY_WND_ACTV(a)	    ((a) |= (1 << 4))
#define SET_TRAY_WND_VSBL(a)	    ((a) |= (1 << 5))
#define USET_TRAY_MSG_DISC(a)       ((a) &= ~(1 << 0))
#define USET_TRAY_MSG_PRIV(a)       ((a) &= ~(1 << 1))
#define USET_TRAY_MSG_NICK(a)       ((a) &= ~(1 << 2))
#define USET_TRAY_MSG_NONE(a)       ((a) &= ~(1 << 3))
#define USET_TRAY_WND_ACTV(a)	    ((a) &= ~(1 << 4))
#define USET_TRAY_WND_VSBL(a)	    ((a) &= ~(1 << 5))
#define IS_TRAY_MSG_DISC(a)         (((a) & (1 << 0)) == (1 << 0))
#define IS_TRAY_MSG_PRIV(a)         (((a) & (1 << 1)) == (1 << 1))
#define IS_TRAY_MSG_NICK(a)         (((a) & (1 << 2)) == (1 << 2))
#define IS_TRAY_MSG_NONE(a)         (((a) & (1 << 3)) == (1 << 3))
#define IS_TRAY_WND_ACTV(a)	    (((a) & (1 << 4)) == (1 << 4))
#define IS_TRAY_WND_VSBL(a)	    (((a) & (1 << 5)) == (1 << 5))

/** */
typedef unsigned int InotifyMessageType;

enum eInotifyAction {
    eInotifyAsk = 0,
    eInotifyNone,
    eInotifyRS //Recreate Share
};

#define SET_INOTIFY_DEL(a)          SET_TRAY_MSG_DISC(a)    // ((a) |= (1 << 0))
#define SET_INOTIFY_CRT(a)          SET_TRAY_MSG_PRIV(a)
#define SET_INOTIFY_CHG(a)          SET_TRAY_MSG_NICK(a)
#define SET_INOTIFY_LOG(a)          SET_TRAY_MSG_NONE(a)
#define USET_INOTIFY_DEL(a)         USET_TRAY_MSG_DISC(a)   // ((a) &= ~(1 << 0))
#define USET_INOTIFY_CRT(a)         USET_TRAY_MSG_PRIV(a)
#define USET_INOTIFY_CHG(a)         USET_TRAY_MSG_NICK(a)
#define USET_INOTIFY_LOG(a)         USET_TRAY_MSG_NONE(a)
#define IS_INOTIFY_DEL(a)           IS_TRAY_MSG_DISC(a)     // (((a) & (1 << 0)) == (1 << 0))
#define IS_INOTIFY_CRT(a)           IS_TRAY_MSG_PRIV(a)
#define IS_INOTIFY_CHG(a)           IS_TRAY_MSG_NICK(a)
#define IS_INOTIFY_LOG(a)           IS_TRAY_MSG_NONE(a)

/** */
enum eTrayMessageType {
    eTrayMessageTypeDISC = 0,
    eTrayMessageTypeNICK,
    eTrayMessageTypePRIV
};

/** */
enum eChatDoubleClickAction {
    ecdcaNONE = 0,
    ecdcaBROWSE,
    ecdcaCHAT,
    ecdcaASK,
    ecdcaPRIVATE
};

/** */
enum eUserSound {
    eusCONNECT,
    eusDISCONNECT,
    eusSEND,
    eusRECEIVE,
    eusFIRSTRECEIVE,
    eusNICKMENTIONED
};

/** */
enum eTimeStamp {
    etsPRIVATECHAT,
    etsHUBCHAT
};

/** */
enum eTransferViewOptions {
    etvoCHUNKPERCENT,
    etvoFILEPERCENT,
    etvoCHUNKSIZE,
    etvoFILESIZE,
    etvoDOWNLOADRATESINGLE,
    etvoELAPSEDTIMESINGLE,
    etvoDOWNLOADRATEMULTI,
    etvoELAPSEDTIMEMULTI
};

/** */
enum eLogChatOptions {
    elcoENABLELOGGING,
    elcoAPPENDDATE,
    elcoAPPENDHUBNAME,
    elcoAPPENDHUBHOST,
    elcoDISABLEPUBLICCHAT,
    elcoENABLENICKNAMEFILTER,
    elcoNICKNAMEFILTER_ENABLELOGGING
};

/** */
enum eChatColor {
    eccCHATTIMESTAMP = 0,
    eccCHATLOCALNICK,
    eccCHATLOCALTEXT,
    eccCHATREMOTENICK,
    eccCHATREMOTETEXT,
    eccCHATSTATUSNICK,
    eccCHATSTATUSTEXT,
    eccPUBLICCHATTIMESTAMP,
    eccPUBLICCHATLOCALNICK,
    eccPUBLICCHATLOCALTEXT,
    eccPUBLICCHATREMOTENICK,
    eccPUBLICCHATREMOTETEXT,
    eccPUBLICCHATSTATUSNICK,
    eccPUBLICCHATSTATUSTEXT,
    eccPUBLICPRIVATECHATNICK,
    eccPUBLICPRIVATECHATTEXT,
    eccCHATSAY,
    eccPUBLICCHATMENICK,
    eccOPNICK
};

/* Download not supported */
enum eMagnetAction {
    eMagnetPrompt = 0,
    eMagnetSearch,
    eMagnetDownload,
    eMagnetNothing
};

/* External magnet links not handled */
enum eMagnetSource {
    eChatMagnet = 0,
    eExternalMagnet
};

/** Key press to send chat message */
enum eSendChatKey {
    eControlEnter = 0,
    eEnter,
    eAltEnter,
    eAltS
};

/** "Quick options" aka download mode */
enum eDownloadMode {
    eDownloadAsk = 0,
    eDownloadSingle,
    eDownloadMulti
};

/** How to open new client (hub) windows */
enum eOpenClientWindow {
    eClientMinimized = 0,
    eClientNormal,
    eClientMaximized
};

/** Action on double clicking a user in a user list */
enum eDoubleClickUser {
    ePrivateChat = 0,
    eDownloadList
};

/** How tab nick completion should work */
enum eTabCompleteMode {
    eTabContains = 0,
    eTabStartsWith
};

/* Default application font. Needed from main.cpp too */
#define DEFAULT_APP_FONT	"Helvetica,12,-1,5,50,0,0,0,0,0"

class QPixmap;
class QProcess;
class QTextDocument;
class CXml;
class CMessageMyInfo;

/** */
typedef QMap<QString, QString> StringMap;
/** */
typedef QMap<QString, StringMap*> SettingMap;

/** */
class DC_EmoticonObject;

/** */
class DC_HubFilterObject {
public:

    /** construtor */
    DC_HubFilterObject() {
        m_nUser = 0;
        m_bName = false;
        m_bServer = false;
        m_bDescription = false;
    };

    /** destructor */
    ~DC_HubFilterObject() {
    };

    /** */
    QString m_sFilterName;
    /** */
    QString m_sContains;
    /** */
    unsigned int m_nUser;
    /** */
    bool m_bName;
    /** */
    bool m_bServer;
    /** */
    bool m_bDescription;
};

/** Stores a user command for custom menus */
class DC_UserMenuCommand {
public:

    /** */
    DC_UserMenuCommand() {
        m_nContext = 0;
        m_nType = -1;
    };

    /** */
    ~DC_UserMenuCommand() {
    };
    /**
     * Command type. Separator, Raw or RawOnce.
     */
    int m_nType;
    /** The name of the menu command */
    QString m_sName;
    /** The command to send to the hub */
    QString m_sCommand;
    /** Context is which menu(s) to put the command into */
    int m_nContext;
    /** Hub IP / DNS */
    QString m_sHubIP;
};

/** Stores a user custom chat command */
class DC_UserChatCommand {
public:

    /** */
    DC_UserChatCommand() {
    };

    /** */
    ~DC_UserChatCommand() {
    };

    /** Name of the command */
    QString m_sName;
    /** Command string to run */
    QString m_sCommand;
};

/** Stores an auto response trigger and response pair */
class DC_AutoResponseObject {
public:

    /** */
    DC_AutoResponseObject() {
        m_bCaseSensitive = false;
    };

    /** */
    ~DC_AutoResponseObject() {
    };

    /** Trigger QT regexp */
    QString m_sTrigger;
    /** Response */
    QString m_sResponse;
    /** Case sensitive or not */
    bool m_bCaseSensitive;
};

class DCConfig : public QObject, public CConfig {
    Q_OBJECT

public:
    /** construtor */
    DCConfig(CString configpath = CString());
    /** destructor */
    virtual ~DCConfig();

    /** */
    int Load();
    /** */
    int Save();

    /** */
    int LoadDCGui();
    /** */
    int SaveDCGui();
    /** */
    void ParseDCGuiConfig(CXml * xml);

    /** */
    int LoadDCHubFilter(QMap<QString, DC_HubFilterObject*> * map);
    /** */
    int SaveDCHubFilter(QMap<QString, DC_HubFilterObject*> * map);

    /** */
    int LoadDCFriendList(FriendMap * map);
    /** */
    int SaveDCFriendList(FriendMap * map);

    /** */
    int LoadQuickConnectHistory();
    /** */
    int SaveQuickConnectHistory();

    /** */
    bool GetOpenPrivateChatWindow() const;
    /** */
    void SetOpenPrivateChatWindow(bool b);
    /** */
    int GetChatMaxParagraph() const;
    /** */
    void SetChatMaxParagraph(int i);
    /** */
    bool GetChatShowJoinsAndParts() const;
    /** */
    void SetChatShowJoinsAndParts(bool b);
    /** */
    bool GetChatShowJoinsAndPartsOnlyFav() const;
    /** */
    void SetChatShowJoinsAndPartsOnlyFav(bool b);

    /** */
    eUnit GetUnit() const;
    /** */
    void SetUnit(eUnit unit);
    /** */
    bool GetTransferViewOptions(eTransferViewOptions e) const;
    /** */
    void SetTransferViewOptions(eTransferViewOptions e, bool b);
    /** */
    QString GetTheme() const;
    /** */
    void SetTheme(QString theme);
    /** */
    eSendChatKey GetSendChat() const;
    /** */
    void SetSendChat(eSendChatKey index);
    /** */
    QString GetLanguageFile() const;
    /** */
    void SetLanguageFile(QString languagefile);
    /** */
    bool GetTabBar() const;
    /** */
    void SetTabBar(bool b);
    /** */
    bool GetToolBar() const;
    /** */
    void SetToolBar(bool b);
    /** */
    bool GetStatusBar() const;
    /** */
    void SetStatusBar(bool b);
    /** */
    bool GetUserListRightAlignment() const;
    /** */
    void SetUserListRightAlignment(bool b);

    /** */
    QPixmap * GetUserIcon(CMessageMyInfo * myinfo);
    /** */
    void PlaySound(eUserSound usersound);
    /** */
    void PlaySound(QString file);

    /** */
    void SetAppFont(QString font);
    /** */
    QString GetAppFont() const;
    /** Set enable use of AppFont or use default font */
    void SetUseCustomFont(bool b);
    /** Get enable use of AppFont or use default font */
    bool GetUseCustomFont() const;

    /** */
    bool GetMap(QString name, StringMap *& map);

    /** */
    void SetAppGeometry(int width, int height);
    /** */
    void GetAppGeometry(int &width, int &height);

    /** */
    bool GetSoundDisabled() const;
    /** */
    void SetSoundDisabled(bool disabled);
    /** */
    bool GetSoundDisabledAway() const;
    /** */
    void SetSoundDisabledAway(bool disabled);
    /** */
    bool GetExternalSoundPlayer() const;
    /** */
    void SetExternalSoundPlayer(bool externalsoundplayer);
    /** */
    QString GetExternalPlayer() const;
    /** */
    void SetExternalPlayer(QString externalplayer);
    /** */
    QString GetSoundFile(eUserSound usersound);
    /** */
    void SetSoundFile(eUserSound usersound, QString soundfile);
    /** */
    bool GetSoundEnabled(eUserSound usersound);
    /** */
    void SetSoundEnabled(eUserSound usersound, bool enabled);

    /** */
    void SetTimeStamp(eTimeStamp timestamp, bool enabled);
    /** */
    bool GetTimeStamp(eTimeStamp timestamp);

    /** */
    void SetLogChatOption(eLogChatOptions elco, bool enabled);
    /** */
    bool GetLogChatOption(eLogChatOptions elco);
    /** */
    void SetLogChatNickNameFilter(QStringList list);
    /** */
    QStringList GetLogChatNickNameFilter();
    /** */
    bool CheckLogChatNickNameFilter(QString nick);

    /** */
    bool GetShowStatusMessage() const;
    /** */
    void SetShowStatusMessage(bool disabled);
    /** */
    bool GetShowTransferWin() const;
    /** */
    void SetShowTransferWin(bool disabled);

    /** */
    bool GetSendHidePrivateChatToPublicChat() const;
    /** */
    void SetSendHidePrivateChatToPublicChat(bool b);

    /** */
    bool GetEnableEmoticons() const;
    /** */
    void SetEnableEmoticons(bool b);

    /** */
    bool GetAutoAwayMode() const;
    /** */
    void SetAutoAwayMode(bool b);
    /** */
    unsigned int GetAutoAwayTime() const;
    /** */
    void SetAutoAwayTime(unsigned int n);
    /** */
    virtual void SetAwayMode(eUserAwayMode mode);

    /** */
    int GetChatMessageMaxLines() const;
    /** */
    void SetChatMessageMaxLines(int i);

    /** */
    int GetFloodCount() const;
    /** */
    void SetFloodCount(int i);
    /** */
    bool GetFloodOpKick() const;
    /** */
    void SetFloodOpKick(bool b);

    /** */
    bool GetThemeSupport() const;
    /** */
    void SetThemeSupport(bool b);
    /** */
    QString GetBackgroundPixmap() const;
    /** */
    void SetBackgroundPixmap(QString s);
    /** */
    QString GetBrowser() const;
    /** */
    void SetBrowser(QString s);
    /** Open the URL using the browser settings */
    void OpenURL(QString url);
    /** */
    bool GetCustomBrowser() const;
    /** */
    void SetCustomBrowser(bool b);

    /** */
    eDownloadMode GetDefaultDownloadMode() const;
    /** */
    void SetDefaultDownloadMode(eDownloadMode e, bool emitsig = false);

    /** */
    bool GetEnableTray() const;
    /** */
    void SetEnableTray(bool b);
    /** */
    bool GetQueryOnExit() const;
    /** */
    void SetQueryOnExit(bool b);
    /** */
    bool GetQueryOnFileDelete() const;
    /** */
    void SetQueryOnFileDelete(bool b);

    /** */
    bool GetShowChatSendButton() const;
    /** */
    void SetShowChatSendButton(bool b);
    /** */
    bool GetShowChatInTab() const;
    /** */
    void SetShowChatInTab(bool b);
    /** */
    QString GetChatColor(eChatColor type) const;
    /** */
    void SetChatColor(eChatColor type, QString s);
    /** */
    QString GetChatBackgroundColor() const;
    /** */
    bool GetChatBackgroundColorEnabled() const;
    /** */
    void SetChatBackgroundColor(bool enabled, QString color);
    /** */
    QString GetChatForegroundColor() const;
    /** */
    void SetChatForegroundColor(QString color);
    /** */
    eOpenClientWindow GetOpenClientWindows() const;
    /** */
    void SetOpenClientWindows(eOpenClientWindow w);

    /** */
    bool LoadEmoticons();
    /** */
    QImage & GetEmoticonImage();
    /** adds emoticon resources to the text document */
    bool AddEmoticons(QTextDocument * document);
    /**
     * Get the emoticon text at the coordinates in
     * the emoticon choosing dialog.
     */
    QString EmoticonTextForPos(int x, int y);
    /**
     * Get the emoticon text by internal id.
     * Needed for double clicking chat.
     */
    QString EmoticonTextForID(int id);

    /**
     * Replaces URLs and, if enabled, emoticons, with the
     * corresponding HTML.
     */
    QString ChatToHTML(QString chat);

    /** */
    QString GetUserPhotoFileName() const;
    /** */
    void SetUserPhotoFileName(QString s);

    /** */
    QString GetValknutDataPath() const;
    /** */
    void SetValknutDataPath(QString s);

    /** Get the list of user chat commands, caller must delete them */
    long GetUserChatCommands(QList<DC_UserChatCommand*> * list);
    /** Set the list of user chat commands, transfers ownership of the objects to g_pConfig */
    void SetUserChatCommands(QList<DC_UserChatCommand*> * list);
    /**
     * Instead of copying the list of commands to a DCChat and then deleting them all,
     * send the text to g_pConfig and get the text with the commands substituted.
     */
    QString ReplaceUserChatCommands(QString text);

    /** Get a copy of the list of user menu commands, caller must delete them */
    long GetUserMenuCommands(QMap<int, DC_UserMenuCommand*> * list);
    /** Get pointers to the actual user menu commands */
    long GetUserMenuCommandsDirect(QMap<int, DC_UserMenuCommand*> * list);
    /** Set the list of user menu commands, transfers ownership of the objects to g_pConfig */
    void SetUserMenuCommands(QMap<int, DC_UserMenuCommand*> * list);

    /** Gets the theme for application icons */
    QString GetApplicationIconTheme() const;
    /** Sets the theme for application icons */
    void SetApplicationIconTheme(QString s);

    /** Gets the theme for emoticons */
    QString GetEmoticonTheme() const;
    /** Sets the theme for emoticons */
    void SetEmoticonTheme(QString s);

    /** Gets the theme for userlist icons */
    QString GetUserListIconTheme() const;
    /**
     * Sets the theme for userlist icons.
     * Clears all cached pixmaps and loads the new image
     * if the theme has changed.
     */
    void SetUserListIconTheme(QString s);

    /** Gets the regexp of nicks to not open chat windows for */
    QString GetSuppressedNicks() const;
    /** Sets the regexp of nicks to not open chat windows for */
    void SetSuppressedNicks(QString s);

    /**
     * Gets the action for double clicking a user
     */
    eDoubleClickUser GetDoubleClickAction() const;
    /** Sets the action for double clicking a user */
    void SetDoubleClickAction(eDoubleClickUser action);

    /** Gets if auto responder is enabled for main chat */
    bool GetAutoResponderEnabled() const;
    /** Enables/Disables the auto responder for main chat */
    void SetAutoResponderEnabled(bool b);
    /** Gets the list of auto response triggers and responses, the caller must delete them */
    long GetAutoResponses(QList<DC_AutoResponseObject*> * list);
    /** Sets the list of auto response triggers and responses, transfers ownership of the objects to g_pConfig */
    void SetAutoResponses(QList<DC_AutoResponseObject*> * list);
    /** Gets the minimum time between auto-responses */
    long GetAutoResponseDelay() const;
    /** Sets the minimum time between auto-responses */
    void SetAutoResponseDelay(long n);
    /** Gets list of nicks to not auto respond to */
    QString GetAutoResponseIgnores() const;
    /** Sets list of nicks to not auto respond to */
    void SetAutoResponseIgnores(QString s);
    /** Gets if the auto responder is enabled for PMs */
    bool GetAutoResponderEnabledForPM() const;
    /** Enables/Disabled the auto responder for private messages */
    void SetAutoResponderEnabledForPM(bool b);

    /** Gets filelist naming scheme version
     * This is set internally so that the filelists are renamed
     * once only when upgrading to 0.3.10.
     * once only when upgrading to 0.3.17.
     *
     * 0 = 0.3.8 or earlier integers
     * 1 = 0.3.9 base64 encoded
     * 2 = 0.3.10 human readable nick-hubhost_port.filelist
     * 3 = setting was abused for searchindex changes
     * 4 = 0.3.17 human readable nick@hubhost_port.filelist
     */
    int GetFilelistNamingSchemeVersion() const;
    /** Sets filelist naming scheme version */
    void SetFilelistNamingSchemeVersion(int i);
    /** Renames the filelists */
    void RenameStoredFilelists();

    /** Gets QMainWindow saved state */
    QByteArray GetQMainWindowState() const;
    /** Sets QMainWindow state */
    void SetQMainWindowState(QByteArray b);

    /** Get show folders in right pane of filelist browser */
    bool GetFoldersInRightPane() const;
    /** Set show folders in right pane of filelist browser */
    void SetFoldersInRightPane(bool b);
    /** Get show subfolder sizes in left pane of filelist browser */
    bool GetFolderSizesInLeftPane() const;
    /** Set show subfolder sizes in left pane of filelist browser */
    void SetFolderSizesInLeftPane(bool b);
    /** Get sort folders in right pane on top */
    bool GetFoldersInRightPaneOnTop() const;
    /** Set sort folders in right pane on top */
    void SetFoldersInRightPaneOnTop(bool b);
    /** Get double click right pane folders opens them */
    bool GetOpenFoldersInRightPane() const;
    /** Set double click right pane folders opens them */
    void SetOpenFoldersInRightPane(bool b);
    /** Get send unknown /commands as chat */
    bool GetSendUnknownCommandsAsChat() const;
    /** Set send unknown /commands as chat */
    void SetSendUnknownCommandsAsChat(bool b);
    /** Get allowed unknown commands */
    QString GetAllowedUnknownCommands() const;
    /** Set allowed unknown commands */
    void SetAllowedUnknownCommands(QString s);
    /** Get fix hub details in search results */
    bool GetAdjustSearchResultHubNames() const;
    /** Set fix hub details in search results */
    void SetAdjustSearchResultHubNames(bool b);
    /** Get remove public hub menu item enabled */
    bool GetRemovePublicHubEnabled() const;
    /** Set remove public hub menu item enabled */
    void SetRemovePublicHubEnabled(bool b);

    /**
     * Get tab completion mode.
     */
    eTabCompleteMode GetTabCompleteMatchMode() const;
    /**
     * Set tab completion mode.
     */
    void SetTabCompleteMatchMode(eTabCompleteMode mode);
    /** Remove [] tags from nicks */
    bool GetTabCompleteStripTags() const;
    /** Set remove [] tags from nicks */
    void SetTabCompleteStripTags(bool b);

    /** Get use threads for running shell commands from chat */
    bool GetThreadsForShellCommands() const;
    /** Set use threads for running shell commands from chat */
    void SetThreadsForShellCommands(bool b);
    /** Get shell command timeout (seconds) */
    int GetShellCommandTimeout() const;
    /** Set shell command timeout (seconds) */
    void SetShellCommandTimeout(int s);

    /** Get use submenu for user commands */
    bool GetUserCommandSubmenu() const;
    /** Set use submenu for user commands */
    void SetUserCommandSubmenu(bool b);

    /** Get default magnet action */
    eMagnetAction GetMagnetAction(eMagnetSource = eChatMagnet) const;
    /** Set default magnet action */
    void SetMagnetAction(eMagnetAction act, eMagnetSource = eChatMagnet);

    /** Get alternating row colors */
    bool GetAlternatingRowColors() const;
    /** Set alternating row colors */
    void SetAlternatingRowColors(bool b);

    /** */
    eTransferViewType GetTransferViewType() const;
    /** */
    void SetTransferViewType(eTransferViewType e);
    /** */
    bool GetInTray() const;
    /** */
    void SetInTray(bool b);
    /** */
    eChatDoubleClickAction GetChatDoubleClickAction() const;
    /** */
    void SetChatDoubleClickAction(eChatDoubleClickAction action);
    /** */
    SoundDisableMode GetSoundDisableMode() const;
    /** */
    void SetSoundDisableMode(SoundDisableMode);
    /** */
    void SetTrayMessageType(TrayMessageType m);
    /** */
    TrayMessageType GetTrayMessageType() const;
    /** */
    void SetInotifyMessageType(InotifyMessageType m);
    /** */
    InotifyMessageType GetInotifyMessageType() const;
    /** */
    void SetInotifyAction(eInotifyAction m);
    /** */
    eInotifyAction GetInotifyAction() const;
    /** */
    void SetInotifyRecursive(bool m);
    /** */
    bool GetInotifyRecursive() const;
    /** */
    void SetInotifyInterval(int m);
    /** */
    int GetInotifyInterval() const;
    /** */
    void SetInotifyEnabled(bool m);
    /** */
    bool GetInotifyEnabled() const;
    /** */
    void SetAntiSpamEnabled(bool b);
    /** */
    bool GetAntiSpamEnabled() const;
    /** */
    void SetIPFilterEnabled(bool b);
    /** */
    bool GetIPFilterEnabled() const;
    /** */
    void SetAutoConnectToAllHubs(bool b);
    /** */
    bool GetAutoConnectToAllHubs() const;
    /** */
    void SetDownloadAliases(QList<DCDownloadAlias*>&);
    /** */
    const QList<DCDownloadAlias*> &GetDownloadAliases();
    /** */
    QStringList GetQuickConnectHistory();
    /** */
    void AppendQuickConnectHistory(const QString &entry);
    /** */
    void SetToolBarButtonStyle(Qt::ToolButtonStyle);
    /** */
    Qt::ToolButtonStyle GetToolBarButtonStyle() const;
    /** */
    void SetToolBarDisabledButtons(QStringList);
    /** */
    const QStringList &GetToolBarDisabledButtons();
    /** */
    void SetHideMenuBar(bool);
    /** */
    bool GetHideMenuBar() const;
    /** */
    void SetNotifyLength(eTrayMessageType e, int i);
    /** */
    int GetNotifyLength(eTrayMessageType e);
    /** */
    void SetIgnoreHandshake(bool);
    /** */
    bool GetIgnoreHandshake() const;


    /** */
    static void SetInstance(DCConfig *);
    /** */
    static DCConfig *Instance();

signals:
    /** emitted when the emoticon theme has changed */
    virtual void emoticonThemeChanged();
    /** emitted after chat background color settings have changed */
    virtual void chatBackgroundColorChanged();
    /** emitted after chat foreground color settings have changed */
    virtual void chatForegroundColorChanged();
    /** emitted after the default download mode has been changed not from the main menu */
    virtual void defaultDownloadModeChanged();
    /** emitted when the away mode is changed */
    virtual void awayModeChanged(eUserAwayMode newmode);
    /** emitted when the alternating rows colors setting changes, parameter is new setting */
    virtual void alternatingRowColorsChanged(bool enabled);
    /** emitted when auto away mode is enabled or disabled */
    virtual void autoAwayModeChanged(bool enabled);

private:
    /** */
    QString m_sValknutDataPath;

    /** */
    SettingMap m_guiSettingMap;

    /** */
    bool bOpenPrivateChatWindow;
    /** */
    int m_nChatMaxParagraph;
    /** */
    bool bShowTransferWin;
    /** */
    bool bTabBar;
    /** */
    bool bToolBar;
    /** */
    bool bStatusBar;
    /** */
    bool bUserListRightAlignment;
    /** */
    eUnit m_eUnit;
    /** */
    QString sTheme;
    /** Needed to avoid removing the QT3 version's theme setting */
    QString sThemeQT3;
    /** */
    eSendChatKey m_eSendChat;
    /** */
    bool bThemeSupport;
    /** */
    QString sLanguageFile;
    /** Application font */
    QString sAppFont;
    /** If true, use sAppFont, if false, use system default font */
    bool m_bUseCustomFont;
    /** Application height */
    int iAppHeight;
    /** Application Width */
    int iAppWidth;
    /** */
    bool bSoundDisabled;
    /** */
    bool bSoundDisabledAway;
    /** */
    bool bSoundEnabledConnect;
    /** */
    bool bSoundEnabledDisconnect;
    /** */
    bool bSoundEnabledSend;
    /** */
    bool bSoundEnabledReceive;
    /** */
    bool bSoundEnabledFirstReceive;
    /** */
    bool bSoundEnabledNickMentioned;
    /** */
    bool bExternalSoundPlayer;
    /** */
    QString sExternalPlayer;
    /** connect sound file */
    QString sSoundFileConnect;
    /** disconnect sound file */
    QString sSoundFileDisconnect;
    /** send sound file */
    QString sSoundFileSend;
    /** receive sound file */
    QString sSoundFileReceive;
    /** first receive sound file */
    QString sSoundFileFirstReceive;
    /** nick said in public chat */
    QString sSoundFileNickMentioned;

    /** */
    bool bEnableEmoticons;
    /** */
    bool bTimeStampPrivateChat;
    /** */
    bool bTimeStampHubChat;
    /** */
    bool bShowStatusMessage;
    /** */
    bool bSendHidePrivateChatToPublicChat;
    /** */
    bool bTVChunkPercent;
    /** */
    bool bTVFilePercent;
    /** */
    bool bTVChunkSize;
    /** */
    bool bTVFileSize;
    /** */
    bool bTVDownloadRateSingle;
    /** */
    bool bTVElapsedTimeSingle;
    /** */
    bool bTVDownloadRateMulti;
    /** */
    bool bTVElapsedTimeMulti;

    /** */
    bool m_bLogChatOption_1;
    /** */
    bool m_bLogChatOption_2;
    /** */
    bool m_bLogChatOption_3;
    /** */
    bool m_bLogChatOption_4;
    /** */
    bool m_bLogChatOption_5;
    /** */
    bool m_bLogChatOption_6;
    /** */
    bool m_bLogChatOption_7;
    /** */
    QStringList m_LogChatNickNameFilter;

    /** */
    int iChatMessageMaxLines;

    /** */
    int iFloodCount;
    /** */
    bool m_bFloodOpKick;

    /** */
    QList<DC_EmoticonObject*> * m_pEmoticons;
    /** */
    QImage m_EmoticonImage;

    /** */
    QProcess * pProcess;

    /** */
    QPixmap * m_UserIconCache[USERLIST_XPM_COLUMNS][USERLIST_XPM_ROWS];
    /** */
    QImage m_UserIcons;

    /** */
    eDownloadMode m_eDefaultDownloadMode;
    /** */
    bool m_bAutoAwayMode;
    /** */
    unsigned int m_nAutoAwayTime;

    /** */
    bool m_bEnableTray;
    /** */
    bool bQueryOnExit;
    /** */
    bool bQueryOnFileDelete;
    /** */
    bool bShowChatSendButton;
    /** */
    QString sBackgroundPixmap;
    /** */
    QString sBrowser;
    /** true to use sBrowser, false to use QDesktopServices */
    bool m_bCustomBrowser;
    /** */
    bool bShowChatInTab;
    /** */
    QString m_sChatColor_1;
    /** */
    QString m_sChatColor_2;
    /** */
    QString m_sChatColor_3;
    /** */
    QString m_sChatColor_4;
    /** */
    QString m_sChatColor_5;
    /** */
    QString m_sChatColor_6;
    /** */
    QString m_sChatColor_7;
    /** */
    QString m_sChatColor_8;
    /** */
    QString m_sChatColor_9;
    /** */
    QString m_sChatColor_10;
    /** */
    QString m_sChatColor_11;
    /** */
    QString m_sChatColor_12;
    /** */
    QString m_sChatColor_13;
    /** */
    QString m_sChatColor_14;
    /** */
    QString m_sChatColor_15;
    /** */
    QString m_sChatColor_16;
    /** */
    QString m_sChatColor_17;
    /** */
    QString m_sChatColor_18;
    /** Colour for operator nick */
    QString m_sChatColor_19;
    /** true to use custom chat background color */
    bool m_bChatBackgroundColorEnabled;
    /** */
    QString m_sChatBackgroundColor;
    /** */
    QString m_sChatForegroundColor;
    /** */
    eOpenClientWindow m_eOpenClientWindows;
    /** */
    bool m_bChatShowJoinsAndParts;
    /** */
    bool m_bChatShowJoinsAndPartsOnlyFav;

    /** */
    QString m_sUserPhotoFileName;

    /** The list of user customized chat commands */
    QList<DC_UserChatCommand*> m_lUserChatCommands;

    /** The list of user customized menu commands - now in order! */
    QMap<int, DC_UserMenuCommand*> m_UserMenuCommands;

    /** Theme for application icons */
    QString m_sApplicationIconTheme;

    /** Theme for emoticons */
    QString m_sEmoticonTheme;

    /** Theme for userlist icons */
    QString m_sUserListIconTheme;

    /** Regexp of nicks to not open chat windows for */
    QString m_sSuppressedNicks;

    /**
     * Action to do on double clicking a user
     */
    eDoubleClickUser m_eDoubleClickAction;

    /** True if auto responder is enabled for main chat */
    bool m_bAutoResponderEnabled;

    /** True if auto responder is enabled for private messages */
    bool m_bAutoResponderEnabledForPM;

    /** The list of auto response triggers and responses */
    QList<DC_AutoResponseObject*> m_lAutoResponses;

    /** The time between consequtive auto-responses for a user */
    long m_nAutoResponseDelay;

    /** A list of nicks to not auto respond to */
    QString m_sAutoResponseIgnores;

    /** The filelist naming scheme version.
     * This is set internally so that the filelists are renamed
     * once only when upgrading to 0.3.10.
     */
    int m_nFilelistNamingSchemeVersion;

    /** Saved QT4 QMainWindow state */
    QByteArray m_baQMainWindowState;

    /** Show folders in right pane of filelist browser? */
    bool m_bFoldersInRightPane;
    /** Show subfolder sizes in left pane of filelist browser? */
    bool m_bFolderSizesInLeftPane;
    /** Sort folders in right pane on top */
    bool m_bFoldersInRightPaneOnTop;
    /** Open folders in right pane by double clicking */
    bool m_bOpenFoldersInRightPane;
    /** Send unknown /commands as chat */
    bool m_bSendUnknownCommandsAsChat;
    /** List of allowed unknown commands */
    QString m_sAllowedUnknownCommands;
    /** Adjust hub details in search results */
    bool m_bAdjustSearchResultHubNames;
    /** True if the remove public hub item is enabled */
    bool m_bRemovePublicHubEnabled;

    /** */
    eTabCompleteMode m_eTabCompleteMatchMode;
    /** */
    bool m_bTabCompleteStripTags;

    /** use threads to start shell commands and wait for them to finish */
    bool m_bThreadsForShellCommands;
    /** how long to wait for shell commands to finish when not using threads */
    int m_nShellCommandTimeout;

    /** if true, user commands start in a submenu */
    bool m_bUserCommandSubmenu;

    /** Use alternating row colors */
    bool m_bAlternatingRowColors;

    /** default magnet action */
    eMagnetAction m_eMagnetActionChat;

    /** List of things URLs can start with (some DC related, some general) */
    QStringList m_lURLs;
    /** */
    bool m_bInTray;
    /** */
    eTransferViewType m_eTransferViewType;
    /** */
    eChatDoubleClickAction m_eChatDoubleClickAction;
    /** */
    SoundDisableMode m_SoundDisableMode;
    /** */
    TrayMessageType m_TrayMessageType;
    /** */
    InotifyMessageType m_InotifyMessageType;
    /** */
    eInotifyAction m_eInotifyAction;
    /** */
    bool m_bInotifyRecursive;
    /** */
    int m_iInotifyInterval;
    /** */
    bool m_bEnableInotify;
    /** */
    bool m_bAntiSpamEnabled;
    /** */
    bool m_bIPFilterEnabled;
    /** */
    bool m_bAutoConnectToAllHubs;
    /** */
    QList<DCDownloadAlias*> m_lDownloadAliases;
    /** */
    QStringList m_lQuickConnectHistory;
    /** */
    Qt::ToolButtonStyle m_ToolBtnStyle;
    /** */
    QStringList m_ToolBarDisabledButtons;
    /** */
    bool m_bHideMenuBar;
    /** */
    int notify_disc;
    /** */
    int notify_priv;
    /** */
    int notify_nick;
    /** */
    bool m_bIgnoreHandshake;

    /** */
    static DCConfig *g_pConfig;
};

namespace DC {
    class DCConfig;
}

/** inline functions */

/** */
inline void DCConfig::SetInstance(DCConfig *config) {
    g_pConfig = config;
}

/** */
inline DCConfig *DCConfig::Instance() {
    return g_pConfig;
}

/** */
inline bool DCConfig::GetOpenPrivateChatWindow() const {
    return bOpenPrivateChatWindow;
}

/** */
inline void DCConfig::SetOpenPrivateChatWindow(bool b) {
    bOpenPrivateChatWindow = b;
}

/** */
inline bool DCConfig::GetTabBar() const {
    return bTabBar;
}

/** */
inline void DCConfig::SetTabBar(bool b) {
    bTabBar = b;
}

/** */
inline bool DCConfig::GetToolBar() const {
    return bToolBar;
}

/** */
inline void DCConfig::SetToolBar(bool b) {
    bToolBar = b;
}

/** */
inline bool DCConfig::GetStatusBar() const {
    return bStatusBar;
}

/** */
inline void DCConfig::SetStatusBar(bool b) {
    bStatusBar = b;
}

/** */
inline bool DCConfig::GetUserListRightAlignment() const {
    return bUserListRightAlignment;
}

/** */
inline void DCConfig::SetUserListRightAlignment(bool b) {
    bUserListRightAlignment = b;
}

/** */
inline eUnit DCConfig::GetUnit() const {
    return m_eUnit;
}

/** */
inline void DCConfig::SetUnit(eUnit unit) {
    m_eUnit = unit;
}

/** */
inline QString DCConfig::GetTheme() const {
    return sTheme;
}

/** */
inline void DCConfig::SetTheme(QString theme) {
    sTheme = theme;
}

/** */
inline eSendChatKey DCConfig::GetSendChat() const {
    return m_eSendChat;
}

/** */
inline void DCConfig::SetSendChat(eSendChatKey index) {
    m_eSendChat = index;
}

/** */
inline QString DCConfig::GetLanguageFile() const {
    return sLanguageFile;
}

/** */
inline void DCConfig::SetLanguageFile(QString languagefile) {
    sLanguageFile = languagefile;
}

inline QString DCConfig::GetAppFont() const {
    return sAppFont;
}

inline void DCConfig::SetAppFont(QString font) {
    sAppFont = font;
}

/** */
inline bool DCConfig::GetUseCustomFont() const {
    return m_bUseCustomFont;
}

/** */
inline void DCConfig::SetUseCustomFont(bool b) {
    m_bUseCustomFont = b;
}

/** */
inline void DCConfig::SetAppGeometry(int width, int height) {
    iAppWidth = width;
    iAppHeight = height;
}

/** */
inline void DCConfig::GetAppGeometry(int &width, int &height) {
    width = iAppWidth;
    height = iAppHeight;
}

/** */
inline bool DCConfig::GetSoundDisabled() const {
    return bSoundDisabled;
}

/** */
inline void DCConfig::SetSoundDisabled(bool disabled) {
    bSoundDisabled = disabled;
}

/** */
inline bool DCConfig::GetSoundDisabledAway() const {
    return bSoundDisabledAway;
}

/** */
inline void DCConfig::SetSoundDisabledAway(bool disabled) {
    bSoundDisabledAway = disabled;
}

/** */
inline bool DCConfig::GetExternalSoundPlayer() const {
    return bExternalSoundPlayer;
}

/** */
inline void DCConfig::SetExternalSoundPlayer(bool externalsoundplayer) {
    bExternalSoundPlayer = externalsoundplayer;
}

/** */
inline QString DCConfig::GetExternalPlayer() const {
    return sExternalPlayer;
}

/** */
inline void DCConfig::SetExternalPlayer(QString externalplayer) {
    sExternalPlayer = externalplayer;
}

/** */
inline bool DCConfig::GetShowStatusMessage() const {
    return bShowStatusMessage;
}

/** */
inline void DCConfig::SetShowStatusMessage(bool b) {
    bShowStatusMessage = b;
}

/** */
inline bool DCConfig::GetShowTransferWin() const {
    return bShowTransferWin;
}

/** */
inline void DCConfig::SetShowTransferWin(bool b) {
    bShowTransferWin = b;
}

/** */
inline bool DCConfig::GetThemeSupport() const {
    return bThemeSupport;
}

/** */
inline void DCConfig::SetThemeSupport(bool b) {
    bThemeSupport = b;
}

/** */
inline bool DCConfig::GetSendHidePrivateChatToPublicChat() const {
    return bSendHidePrivateChatToPublicChat;
}

/** */
inline void DCConfig::SetSendHidePrivateChatToPublicChat(bool b) {
    bSendHidePrivateChatToPublicChat = b;
}

/** */
inline int DCConfig::GetChatMessageMaxLines() const {
    return iChatMessageMaxLines;
}

/** */
inline void DCConfig::SetChatMessageMaxLines(int i) {
    iChatMessageMaxLines = i;
}

/** */
inline void DCConfig::SetFloodCount(int i) {
    iFloodCount = i;
}

/** */
inline int DCConfig::GetFloodCount() const {
    return iFloodCount;
}

/** */
inline void DCConfig::SetFloodOpKick(bool b) {
    m_bFloodOpKick = b;
}

/** */
inline bool DCConfig::GetFloodOpKick() const {
    return m_bFloodOpKick;
}

/** */
inline eDownloadMode DCConfig::GetDefaultDownloadMode() const {
    return m_eDefaultDownloadMode;
}

/** */
inline bool DCConfig::GetEnableEmoticons() const {
    return bEnableEmoticons;
}

/** */
inline void DCConfig::SetEnableEmoticons(bool b) {
    bEnableEmoticons = b;
}

/** */
inline bool DCConfig::GetQueryOnExit() const {
    return bQueryOnExit;
}

/** */
inline void DCConfig::SetQueryOnExit(bool b) {
    bQueryOnExit = b;
}

/** */
inline bool DCConfig::GetEnableTray() const {
    return m_bEnableTray;
}

/** */
inline void DCConfig::SetEnableTray(bool b) {
    m_bEnableTray = b;
}

/** */
inline bool DCConfig::GetQueryOnFileDelete() const {
    return bQueryOnFileDelete;
}

/** */
inline void DCConfig::SetQueryOnFileDelete(bool b) {
    bQueryOnFileDelete = b;
}

/** */
inline bool DCConfig::GetShowChatSendButton() const {
    return bShowChatSendButton;
}

/** */
inline void DCConfig::SetShowChatSendButton(bool b) {
    bShowChatSendButton = b;
}

/** */
inline QString DCConfig::GetBackgroundPixmap() const {
    return sBackgroundPixmap;
}

/** */
inline void DCConfig::SetBackgroundPixmap(QString s) {
    sBackgroundPixmap = s;
}

/** */
inline QString DCConfig::GetBrowser() const {
    return sBrowser;
}

/** */
inline void DCConfig::SetBrowser(QString s) {
    sBrowser = s;
}

/** */
inline bool DCConfig::GetCustomBrowser() const {
    return m_bCustomBrowser;
}

/** */
inline void DCConfig::SetCustomBrowser(bool b) {
    m_bCustomBrowser = b;
}

/** */
inline bool DCConfig::GetShowChatInTab() const {
    return bShowChatInTab;
}

/** */
inline void DCConfig::SetShowChatInTab(bool b) {
    bShowChatInTab = b;
}

/** */
inline int DCConfig::GetChatMaxParagraph() const {
    return m_nChatMaxParagraph;
}

/** */
inline void DCConfig::SetChatMaxParagraph(int i) {
    m_nChatMaxParagraph = i;
}

/** */
inline eOpenClientWindow DCConfig::GetOpenClientWindows() const {
    return m_eOpenClientWindows;
}

/** */
inline void DCConfig::SetOpenClientWindows(eOpenClientWindow w) {
    m_eOpenClientWindows = w;
}

/** */
inline bool DCConfig::GetAutoAwayMode() const {
    return m_bAutoAwayMode;
}

/** */
inline unsigned int DCConfig::GetAutoAwayTime() const {
    return m_nAutoAwayTime;
}

/** */
inline void DCConfig::SetAutoAwayTime(unsigned int n) {
    m_nAutoAwayTime = n;
}

/** */
inline bool DCConfig::GetChatShowJoinsAndParts() const {
    return m_bChatShowJoinsAndParts;
}

/** */
inline void DCConfig::SetChatShowJoinsAndParts(bool b) {
    m_bChatShowJoinsAndParts = b;
}

/** */
inline bool DCConfig::GetChatShowJoinsAndPartsOnlyFav() const {
    return m_bChatShowJoinsAndPartsOnlyFav;
}

/** */
inline void DCConfig::SetChatShowJoinsAndPartsOnlyFav(bool b) {
    m_bChatShowJoinsAndPartsOnlyFav = b;
}

/** */
inline QString DCConfig::GetUserPhotoFileName() const {
    return m_sUserPhotoFileName;
}

/** */
inline void DCConfig::SetUserPhotoFileName(QString s) {
    m_sUserPhotoFileName = s;
}

/** */
inline QString DCConfig::GetValknutDataPath() const {
    return m_sValknutDataPath;
}

/** */
inline void DCConfig::SetValknutDataPath(QString s) {
    m_sValknutDataPath = s;
}

/** */
inline QString DCConfig::GetApplicationIconTheme() const {
    return m_sApplicationIconTheme;
}

/** */
inline void DCConfig::SetApplicationIconTheme(QString s) {
    m_sApplicationIconTheme = s;
}

/** */
inline QString DCConfig::GetEmoticonTheme() const {
    return m_sEmoticonTheme;
}

/** */
inline void DCConfig::SetEmoticonTheme(QString s) {
    m_sEmoticonTheme = s;
}

/** */
inline QString DCConfig::GetUserListIconTheme() const {
    return m_sUserListIconTheme;
}

/** */
inline QString DCConfig::GetSuppressedNicks() const {
    return m_sSuppressedNicks;
}

/** */
inline void DCConfig::SetSuppressedNicks(QString s) {
    m_sSuppressedNicks = s;
}

/** */
inline eDoubleClickUser DCConfig::GetDoubleClickAction() const {
    return m_eDoubleClickAction;
}

/** */
inline void DCConfig::SetDoubleClickAction(eDoubleClickUser action) {
    m_eDoubleClickAction = action;
}

/** */
inline bool DCConfig::GetAutoResponderEnabled() const {
    return m_bAutoResponderEnabled;
}

/** */
inline void DCConfig::SetAutoResponderEnabled(bool b) {
    m_bAutoResponderEnabled = b;
}

/** */
inline long DCConfig::GetAutoResponseDelay() const {
    return m_nAutoResponseDelay;
}

/** */
inline void DCConfig::SetAutoResponseDelay(long n) {
    m_nAutoResponseDelay = n;
}

/** */
inline QString DCConfig::GetAutoResponseIgnores() const {
    return m_sAutoResponseIgnores;
}

/** */
inline void DCConfig::SetAutoResponseIgnores(QString s) {
    m_sAutoResponseIgnores = s;
}

/** */
inline bool DCConfig::GetAutoResponderEnabledForPM() const {
    return m_bAutoResponderEnabledForPM;
}

/** */
inline void DCConfig::SetAutoResponderEnabledForPM(bool b) {
    m_bAutoResponderEnabledForPM = b;
}

/** */
inline int DCConfig::GetFilelistNamingSchemeVersion() const {
    return m_nFilelistNamingSchemeVersion;
}

/** */
inline void DCConfig::SetFilelistNamingSchemeVersion(int i) {
    m_nFilelistNamingSchemeVersion = i;
}

/** */
inline QByteArray DCConfig::GetQMainWindowState() const {
    return m_baQMainWindowState;
}

/** */
inline void DCConfig::SetQMainWindowState(QByteArray ba) {
    m_baQMainWindowState = ba;
}

/** */
inline bool DCConfig::GetFoldersInRightPane() const {
    return m_bFoldersInRightPane;
}

/** */
inline void DCConfig::SetFoldersInRightPane(bool b) {
    m_bFoldersInRightPane = b;
}

/** */
inline bool DCConfig::GetFolderSizesInLeftPane() const {
    return m_bFolderSizesInLeftPane;
}

/** */
inline void DCConfig::SetFolderSizesInLeftPane(bool b) {
    m_bFolderSizesInLeftPane = b;
}

/** */
inline bool DCConfig::GetFoldersInRightPaneOnTop() const {
    return m_bFoldersInRightPaneOnTop;
}

/** */
inline void DCConfig::SetFoldersInRightPaneOnTop(bool b) {
    m_bFoldersInRightPaneOnTop = b;
}

/** */
inline bool DCConfig::GetOpenFoldersInRightPane() const {
    return m_bOpenFoldersInRightPane;
}

/** */
inline void DCConfig::SetOpenFoldersInRightPane(bool b) {
    m_bOpenFoldersInRightPane = b;
}

/** */
inline bool DCConfig::GetSendUnknownCommandsAsChat() const {
    return m_bSendUnknownCommandsAsChat;
}

/** */
inline void DCConfig::SetSendUnknownCommandsAsChat(bool b) {
    m_bSendUnknownCommandsAsChat = b;
}

/** */
inline QString DCConfig::GetAllowedUnknownCommands() const {
    return m_sAllowedUnknownCommands;
}

/** */
inline void DCConfig::SetAllowedUnknownCommands(QString s) {
    m_sAllowedUnknownCommands = s;
}

/** */
inline bool DCConfig::GetAdjustSearchResultHubNames() const {
    return m_bAdjustSearchResultHubNames;
}

/** */
inline void DCConfig::SetAdjustSearchResultHubNames(bool b) {
    m_bAdjustSearchResultHubNames = b;
}

/** */
inline bool DCConfig::GetRemovePublicHubEnabled() const {
    return m_bRemovePublicHubEnabled;
}

/** */
inline void DCConfig::SetRemovePublicHubEnabled(bool b) {
    m_bRemovePublicHubEnabled = b;
}

/** */
inline eTabCompleteMode DCConfig::GetTabCompleteMatchMode() const {
    return m_eTabCompleteMatchMode;
}

/** */
inline void DCConfig::SetTabCompleteMatchMode(eTabCompleteMode mode) {
    m_eTabCompleteMatchMode = mode;
}

/** */
inline bool DCConfig::GetTabCompleteStripTags() const {
    return m_bTabCompleteStripTags;
}

/** */
inline void DCConfig::SetTabCompleteStripTags(bool b) {
    m_bTabCompleteStripTags = b;
}

/** */
inline bool DCConfig::GetThreadsForShellCommands() const {
    return m_bThreadsForShellCommands;
}

/** */
inline void DCConfig::SetThreadsForShellCommands(bool b) {
    m_bThreadsForShellCommands = b;
}

/** */
inline int DCConfig::GetShellCommandTimeout() const {
    return m_nShellCommandTimeout;
}

/** */
inline void DCConfig::SetShellCommandTimeout(int s) {
    m_nShellCommandTimeout = s;
}

/** */
inline bool DCConfig::GetUserCommandSubmenu() const {
    return m_bUserCommandSubmenu;
}

/** */
inline void DCConfig::SetUserCommandSubmenu(bool b) {
    m_bUserCommandSubmenu = b;
}

/** */
inline bool DCConfig::GetChatBackgroundColorEnabled() const {
    return m_bChatBackgroundColorEnabled;
}

/** */
inline QString DCConfig::GetChatBackgroundColor() const {
    return m_sChatBackgroundColor;
}

/** */
inline QString DCConfig::GetChatForegroundColor() const {
    return m_sChatForegroundColor;
}

/** */
inline bool DCConfig::GetAlternatingRowColors() const {
    return m_bAlternatingRowColors;
}

/** */
inline void DCConfig::SetInTray(bool b) {
    m_bInTray = b;
}

/** */
inline bool DCConfig::GetInTray() const {
    return m_bInTray;
}

/** */
inline eTransferViewType DCConfig::GetTransferViewType() const {
    return m_eTransferViewType;
}

/** */
inline void DCConfig::SetTransferViewType(eTransferViewType e) {
    m_eTransferViewType = e;
}

/** */
inline eChatDoubleClickAction DCConfig::GetChatDoubleClickAction() const {
    return m_eChatDoubleClickAction;
}

/** */
inline void DCConfig::SetChatDoubleClickAction(eChatDoubleClickAction action) {
    m_eChatDoubleClickAction = action;
}

/** */
inline void DCConfig::SetSoundDisableMode(SoundDisableMode mode) {
    m_SoundDisableMode = mode;
}

/** */
inline SoundDisableMode DCConfig::GetSoundDisableMode() const {
    return m_SoundDisableMode;
}

/** */
inline void DCConfig::SetTrayMessageType(TrayMessageType t) {
    m_TrayMessageType = t;
}

/** */
inline TrayMessageType DCConfig::GetTrayMessageType() const {
    return m_TrayMessageType;
}

/** */
inline void DCConfig::SetInotifyMessageType(InotifyMessageType m) {
    m_InotifyMessageType = m;
}

/** */
inline InotifyMessageType DCConfig::GetInotifyMessageType() const {
    return m_InotifyMessageType;
}

/** */
inline void DCConfig::SetInotifyAction(eInotifyAction m) {
    m_eInotifyAction = m;
}

/** */
inline eInotifyAction DCConfig::GetInotifyAction() const {
    return m_eInotifyAction;
}

/** */
inline void DCConfig::SetInotifyRecursive(bool m) {
    m_bInotifyRecursive = m;
}

/** */
inline bool DCConfig::GetInotifyRecursive() const {
    return m_bInotifyRecursive;
}

/** */
inline void DCConfig::SetInotifyInterval(int secs) {
    m_iInotifyInterval = secs > 20 ? secs : 20;
}

/** */
inline int DCConfig::GetInotifyInterval() const {
    return m_iInotifyInterval;
}

/** */
inline void DCConfig::SetInotifyEnabled(bool m) {
    m_bEnableInotify = m;
}

/** */
inline bool DCConfig::GetInotifyEnabled() const {
    return m_bEnableInotify;
}

/** */
inline void DCConfig::SetAntiSpamEnabled(bool b) {
    m_bAntiSpamEnabled = b;
}

/** */
inline bool DCConfig::GetAntiSpamEnabled() const {
    return m_bAntiSpamEnabled;
}

/** */
inline void DCConfig::SetIPFilterEnabled(bool b) {
    m_bIPFilterEnabled = b;
}

/** */
inline bool DCConfig::GetIPFilterEnabled() const {
    return m_bIPFilterEnabled;
}

/** */
inline void DCConfig::SetAutoConnectToAllHubs(bool b) {
    m_bAutoConnectToAllHubs = b;
}

/** */
inline bool DCConfig::GetAutoConnectToAllHubs() const {
    return m_bAutoConnectToAllHubs;
}

/** */
inline void DCConfig::SetDownloadAliases(QList<DCDownloadAlias*> &list){
    m_lDownloadAliases.clear();
    m_lDownloadAliases.append(list);
}

/** */
inline const QList<DCDownloadAlias*> &DCConfig::GetDownloadAliases(){
    return m_lDownloadAliases;
}

/** */
inline QStringList DCConfig::GetQuickConnectHistory(){
    return m_lQuickConnectHistory;
}

/** */
inline void DCConfig::AppendQuickConnectHistory(const QString &entry){
    if (!m_lQuickConnectHistory.contains(entry)) {
        m_lQuickConnectHistory.push_front(entry);
    }
}

/** */
inline void DCConfig::SetToolBarButtonStyle(Qt::ToolButtonStyle style){
    m_ToolBtnStyle = style;
}

/** */
inline Qt::ToolButtonStyle DCConfig::GetToolBarButtonStyle() const{
    return m_ToolBtnStyle;
}

/** */
inline void DCConfig::SetToolBarDisabledButtons(QStringList l){
    m_ToolBarDisabledButtons = l;
}

/** */
inline const QStringList &DCConfig::GetToolBarDisabledButtons(){
    return m_ToolBarDisabledButtons;
}

/** */
inline void DCConfig::SetHideMenuBar(bool b){
    m_bHideMenuBar = b;
}

/** */
inline bool DCConfig::GetHideMenuBar() const{
    return m_bHideMenuBar;
}

/** */
inline void DCConfig::SetNotifyLength(eTrayMessageType e, int i){
    if (e == eTrayMessageTypePRIV)
           notify_priv = i;
    else if (e == eTrayMessageTypeDISC)
           notify_disc = i;
    else if (e == eTrayMessageTypeNICK)
           notify_nick = i;
}

/** */
inline int DCConfig::GetNotifyLength(eTrayMessageType e){
    int k;
    switch (e){
		case eTrayMessageTypeDISC:
			k = notify_disc;
			break;
		case eTrayMessageTypePRIV:
			k = notify_priv;
			break;
		case eTrayMessageTypeNICK:
			k = notify_nick;
			break;
    }
    return k;
}

/** */
inline void DCConfig::SetIgnoreHandshake(bool b){
    m_bIgnoreHandshake = b;
}

/** */
inline bool DCConfig::GetIgnoreHandshake() const{
    return m_bIgnoreHandshake;
}

#endif
