KVIrc  4.9.2
DeveloperAPIs
Namespaces | Macros | Functions | Variables
KviOptions.cpp File Reference
#include "KviOptions.h"
#include "kvi_defaults.h"
#include "KviConfigurationFile.h"
#include "KviApplication.h"
#include "KviIconManager.h"
#include "KviControlCodes.h"
#include "KviLocale.h"
#include "kvi_confignames.h"
#include "KviWindow.h"
#include "kvi_out.h"
#include "KviStringConversion.h"
#include "kvi_settings.h"
#include "KviMainWindow.h"
#include "KviInternalCommand.h"
#include "KviTheme.h"
#include "KviFileUtils.h"
#include <QMessageBox>
#include <QDir>
#include <QStringList>

Namespaces

 KviTheme
 

Macros

#define _KVI_OPTIONS_CPP_
 
#define BOOL_OPTION(_txt, _val, _flags)   KviBoolOption(KVI_BOOL_OPTIONS_PREFIX _txt, _val, _flags)
 
#define COLOR_OPTION(_name, _red, _green, _blue, _alpha, _flags)
 
#define FONT_OPTION(_name, _face, _size, _flags)
 
#define GET_OPTION_STRING(__numOpt, __table, __prefix, __prefixLen)
 
#define IC_COLOR_OPTION(_num, _red, _green, _blue)
 
#define LIST_OPTIONS(__txt, __num, __table)
 
#define MIRC_COLOR_OPTION(_num, _red, _green, _blue)
 
#define MSGTYPE_OPTION(_name, _text, _icon, _levl)
 
#define MSGTYPE_OPTION_SPEC(_name, _text, _icon, _fore, _back, _levl)
 
#define PIXMAP_OPTION(_name, _flags)
 
#define READ_ALL_OPTIONS(_num, _table, _readFnc)
 
#define READ_OPTIONS(_num, _table, _readFnc)
 
#define READ_OPTIONS(_num, _table, _readFnc)
 
#define RECT_OPTION(_txt, _val, _flags)   KviRectOption(KVI_RECT_OPTIONS_PREFIX _txt, _val, _flags)
 
#define RUN_THE_BROWSER   "run xdg-open $0"
 
#define SET_OPTION_VALUE(__numOpt, __table, __prefix, __prefixLen)
 
#define STRING_OPTION(_txt, _val, _flags)   KviStringOption(KVI_STRING_OPTIONS_PREFIX _txt, _val, _flags)
 
#define STRINGLIST_OPTION(_txt, _flags)   KviStringListOption(KVI_STRINGLIST_OPTIONS_PREFIX _txt, QStringList(), _flags)
 
#define STRINGLIST_OPTION_WITHDEFAULT(_txt, _flags, _def)   KviStringListOption(KVI_STRINGLIST_OPTIONS_PREFIX _txt, QStringList(_def), _flags)
 
#define UINT_OPTION(_name, _value, _flags)
 
#define WRITE_OPTIONS(_num, _table)
 
#define WRITE_OPTIONS(_num, _table)
 

Functions

bool KviTheme::apply (const QString &szThemeDir, KviThemeInfo::Location eLocation, KviThemeInfo &buffer)
 
static void config_set_section (int flag, KviConfigurationFile *cfg)
 
bool KviTheme::save (KviThemeInfo &options, bool bSaveIcons)
 

Variables

KviBoolOption g_boolOptionsTable [KVI_NUM_BOOL_OPTIONS]
 
KviColorOption g_colorOptionsTable [KVI_NUM_COLOR_OPTIONS]
 
KviFontOption g_fontOptionsTable [KVI_NUM_FONT_OPTIONS]
 
KviColorOption g_iccolorOptionsTable [KVI_NUM_ICCOLOR_OPTIONS]
 
KVIRC_API int g_iIdentDaemonRunningUsers
 
KviColorOption g_mirccolorOptionsTable [KVI_NUM_MIRCCOLOR_OPTIONS]
 
KviMessageTypeSettingsOption g_msgtypeOptionsTable [KVI_NUM_MSGTYPE_OPTIONS]
 
KviPixmapOption g_pixmapOptionsTable [KVI_NUM_PIXMAP_OPTIONS]
 
KviRectOption g_rectOptionsTable [KVI_NUM_RECT_OPTIONS]
 
KviStringListOption g_stringlistOptionsTable [KVI_NUM_STRINGLIST_OPTIONS]
 
KviStringOption g_stringOptionsTable [KVI_NUM_STRING_OPTIONS]
 
KviUIntOption g_uintOptionsTable [KVI_NUM_UINT_OPTIONS]
 
static const char * options_section_table [KVI_NUM_OPTION_SECT_FLAGS]
 

Macro Definition Documentation

#define _KVI_OPTIONS_CPP_
#define BOOL_OPTION (   _txt,
  _val,
  _flags 
)    KviBoolOption(KVI_BOOL_OPTIONS_PREFIX _txt, _val, _flags)
#define COLOR_OPTION (   _name,
  _red,
  _green,
  _blue,
  _alpha,
  _flags 
)
Value:
KviColorOption(KVI_COLOR_OPTIONS_PREFIX _name, \
QColor(_red, _green, _blue, _alpha), \
_flags | KviOption_resetUpdateGui | KviOption_groupTheme | KviOption_resetUpdatePseudoTransparency)
#define KVI_COLOR_OPTIONS_PREFIX
Definition: KviOptions.h:439
#define FONT_OPTION (   _name,
  _face,
  _size,
  _flags 
)
Value:
KviFontOption( \
QFont(_face, _size), \
_flags | KviOption_groupTheme)
#define KVI_FONT_OPTIONS_PREFIX
Definition: KviOptions.h:607
#define GET_OPTION_STRING (   __numOpt,
  __table,
  __prefix,
  __prefixLen 
)
Value:
if(KviQString::equalCIN(optName, __prefix, __prefixLen)) \
{ \
for(int i = 0; i < __numOpt; i++) \
{ \
if(KviQString::equalCI(optName, __table[i].name)) \
{ \
KviStringConversion::toString(__table[i].option, buffer); \
return true; \
} \
} \
return false; \
}
if(m_pFile) delete m_pFile
bool equalCIN(const QString &sz1, const QString &sz2, unsigned int uLen)
Compares two strings with case insensitive up to N chars.
Definition: KviQString.cpp:86
#define i
Definition: detector.cpp:73
QString name()
Definition: KviRuntimeInfo.cpp:655
bool equalCI(const QString &sz1, const QString &sz2)
Compares two strings with case insensitive.
Definition: KviQString.cpp:285
void toString(const bool bValue, QString &szBuffer)
Definition: KviStringConversion.cpp:100

Referenced by KviApplication::getOptionString().

#define IC_COLOR_OPTION (   _num,
  _red,
  _green,
  _blue 
)
Value:
KviColorOption( \
QColor(_red, _green, _blue), \
KviOption_sectFlagWindowList | KviOption_resetUpdateGui | KviOption_groupTheme)
#define KVI_ICCOLOR_OPTIONS_PREFIX
Definition: KviOptions.h:622
#define LIST_OPTIONS (   __txt,
  __num,
  __table 
)
Value:
for(i = 0; i < __num; i++) \
wnd->outputNoFmt(KVI_OUT_SYSTEMMESSAGE, __table[i].name);
#define KVI_OUT_SYSTEMMESSAGE
Definition: kvi_out.h:42
#define i
Definition: detector.cpp:73
Definition: KviControlCodes.h:154

Referenced by KviApplication::listAvailableOptions().

#define MIRC_COLOR_OPTION (   _num,
  _red,
  _green,
  _blue 
)
Value:
KviColorOption(KVI_MIRCCOLOR_OPTIONS_PREFIX _num, QColor(_red, _green, _blue), \
KviOption_sectFlagMircColor | KviOption_resetUpdateGui | KviOption_groupTheme)
#define KVI_MIRCCOLOR_OPTIONS_PREFIX
Definition: KviOptions.h:633
#define MSGTYPE_OPTION (   _name,
  _text,
  _icon,
  _levl 
)
Value:
KviMessageTypeSettingsOption( \
KviOption_sectFlagMsgType | KviOption_groupTheme)
Definition: KviMessageTypeSettings.h:47
Definition: KviControlCodes.h:128
#define KVI_MSGTYPE_OPTIONS_PREFIX
Definition: KviOptions.h:628
Definition: KviControlCodes.h:143
#define MSGTYPE_OPTION_SPEC (   _name,
  _text,
  _icon,
  _fore,
  _back,
  _levl 
)
Value:
KviMessageTypeSettingsOption( \
KviMessageTypeSettings(_text, _icon, _fore, _back, true, _levl), \
KviOption_sectFlagMsgType | KviOption_groupTheme)
Definition: KviMessageTypeSettings.h:47
#define KVI_MSGTYPE_OPTIONS_PREFIX
Definition: KviOptions.h:628
#define PIXMAP_OPTION (   _name,
  _flags 
)
Value:
KviPixmapOption( \
KviPixmap(), \
_flags | KviOption_resetUpdateGui)
Definition: KviPixmap.h:33
#define KVI_PIXMAP_OPTIONS_PREFIX
Definition: KviOptions.h:494
#define READ_ALL_OPTIONS (   _num,
  _table,
  _readFnc 
)
Value:
for(i = 0; i < _num; i++) \
{ \
if(cfg.hasKey(_table[i].name)) \
{ \
iResetFlags |= (_table[i].flags & KviOption_resetMask); \
_table[i].option = cfg._readFnc(_table[i].name, _table[i].option); \
} \
}
if(m_pFile) delete m_pFile
#define i
Definition: detector.cpp:73
QString name()
Definition: KviRuntimeInfo.cpp:655

Referenced by KviTheme::apply().

#define READ_OPTIONS (   _num,
  _table,
  _readFnc 
)
Value:
for(i = 0; i < _num; i++) \
{ \
config_set_section(_table[i].flags, &cfg); \
_table[i].option = cfg._readFnc(_table[i].name, _table[i].option); \
}
#define i
Definition: detector.cpp:73
static void config_set_section(int flag, KviConfigurationFile *cfg)
Definition: KviOptions.cpp:852
QString name()
Definition: KviRuntimeInfo.cpp:655

Referenced by KviTheme::apply(), and KviApplication::loadOptions().

#define READ_OPTIONS (   _num,
  _table,
  _readFnc 
)
Value:
for(i = 0; i < _num; i++) \
{ \
if(_table[i].flags & KviOption_groupTheme) \
{ \
if(cfg.hasKey(_table[i].name)) \
{ \
iResetFlags |= (_table[i].flags & KviOption_resetMask); \
_table[i].option = cfg._readFnc(_table[i].name, _table[i].option); \
} \
} \
}
if(m_pFile) delete m_pFile
#define i
Definition: detector.cpp:73
QString name()
Definition: KviRuntimeInfo.cpp:655
#define RECT_OPTION (   _txt,
  _val,
  _flags 
)    KviRectOption(KVI_RECT_OPTIONS_PREFIX _txt, _val, _flags)
#define RUN_THE_BROWSER   "run xdg-open $0"
#define SET_OPTION_VALUE (   __numOpt,
  __table,
  __prefix,
  __prefixLen 
)
Value:
if(KviQString::equalCIN(optName, __prefix, __prefixLen)) \
{ \
for(int i = 0; i < __numOpt; i++) \
{ \
if(KviQString::equalCI(optName, __table[i].name)) \
{ \
if(!KviStringConversion::fromString(value, __table[i].option)) \
return false; \
optionResetUpdate(__table[i].flags); \
return true; \
} \
} \
return false; \
}
bool fromString(const QString &szValue, bool &bBuffer)
Definition: KviStringConversion.cpp:105
if(m_pFile) delete m_pFile
bool equalCIN(const QString &sz1, const QString &sz2, unsigned int uLen)
Compares two strings with case insensitive up to N chars.
Definition: KviQString.cpp:86
#define i
Definition: detector.cpp:73
QString name()
Definition: KviRuntimeInfo.cpp:655
bool equalCI(const QString &sz1, const QString &sz2)
Compares two strings with case insensitive.
Definition: KviQString.cpp:285

Referenced by KviApplication::setCommonOptionValue().

#define STRING_OPTION (   _txt,
  _val,
  _flags 
)    KviStringOption(KVI_STRING_OPTIONS_PREFIX _txt, _val, _flags)
#define STRINGLIST_OPTION (   _txt,
  _flags 
)    KviStringListOption(KVI_STRINGLIST_OPTIONS_PREFIX _txt, QStringList(), _flags)
#define STRINGLIST_OPTION_WITHDEFAULT (   _txt,
  _flags,
  _def 
)    KviStringListOption(KVI_STRINGLIST_OPTIONS_PREFIX _txt, QStringList(_def), _flags)
#define UINT_OPTION (   _name,
  _value,
  _flags 
)
Value:
KviUIntOption( \
_value, \
_flags)
#define KVI_UINT_OPTIONS_PREFIX
Definition: KviOptions.h:509
#define WRITE_OPTIONS (   _num,
  _table 
)
Value:
for(i = 0; i < _num; i++) \
{ \
config_set_section(_table[i].flags, &cfg); \
cfg.writeEntry(_table[i].name, _table[i].option); \
}
#define i
Definition: detector.cpp:73
static void config_set_section(int flag, KviConfigurationFile *cfg)
Definition: KviOptions.cpp:852
QString name()
Definition: KviRuntimeInfo.cpp:655

Referenced by KviTheme::save(), and KviApplication::saveOptions().

#define WRITE_OPTIONS (   _num,
  _table 
)
Value:
for(i = 0; i < _num; i++) \
{ \
if(_table[i].flags & KviOption_groupTheme) \
cfg.writeEntry(_table[i].name, _table[i].option); \
}
if(m_pFile) delete m_pFile
#define i
Definition: detector.cpp:73
QString name()
Definition: KviRuntimeInfo.cpp:655

Function Documentation

static void config_set_section ( int  flag,
KviConfigurationFile cfg 
)
static

Variable Documentation

KviBoolOption g_boolOptionsTable[KVI_NUM_BOOL_OPTIONS]
KviColorOption g_colorOptionsTable[KVI_NUM_COLOR_OPTIONS]
KviFontOption g_fontOptionsTable[KVI_NUM_FONT_OPTIONS]
KviColorOption g_iccolorOptionsTable[KVI_NUM_ICCOLOR_OPTIONS]
Initial value:
= {
IC_COLOR_OPTION("0", 250, 250, 0),
IC_COLOR_OPTION("1", 0, 0, 0),
IC_COLOR_OPTION("2", 0, 0, 200),
IC_COLOR_OPTION("3", 200, 0, 0),
IC_COLOR_OPTION("4", 255, 255, 255),
IC_COLOR_OPTION("5", 0, 150, 190),
IC_COLOR_OPTION("6", 0, 130, 0),
}
#define IC_COLOR_OPTION(_num, _red, _green, _blue)
Definition: KviOptions.cpp:516

Referenced by KviTheme::apply(), KviApplication::getOptionString(), KviApplication::listAvailableOptions(), KviApplication::loadOptions(), KviTheme::save(), KviApplication::saveOptions(), and KviApplication::setCommonOptionValue().

KVIRC_API int g_iIdentDaemonRunningUsers
KviColorOption g_mirccolorOptionsTable[KVI_NUM_MIRCCOLOR_OPTIONS]
Initial value:
= {
MIRC_COLOR_OPTION("0", 255, 255, 255),
MIRC_COLOR_OPTION("1", 0, 0, 0),
MIRC_COLOR_OPTION("2", 0, 0, 140),
MIRC_COLOR_OPTION("3", 0, 100, 0),
MIRC_COLOR_OPTION("4", 230, 0, 0),
MIRC_COLOR_OPTION("5", 150, 0, 0),
MIRC_COLOR_OPTION("6", 80, 0, 80),
MIRC_COLOR_OPTION("7", 255, 90, 0),
MIRC_COLOR_OPTION("8", 255, 255, 0),
MIRC_COLOR_OPTION("9", 0, 255, 0),
MIRC_COLOR_OPTION("10", 0, 150, 180),
MIRC_COLOR_OPTION("11", 170, 170, 255),
MIRC_COLOR_OPTION("12", 15, 15, 255),
MIRC_COLOR_OPTION("13", 200, 0, 200),
MIRC_COLOR_OPTION("14", 80, 80, 80),
}
#define MIRC_COLOR_OPTION(_num, _red, _green, _blue)
Definition: KviOptions.cpp:436

Referenced by KviTheme::apply(), KviApplication::getOptionString(), KviApplication::listAvailableOptions(), KviApplication::loadOptions(), KviTheme::save(), KviApplication::saveOptions(), and KviApplication::setCommonOptionValue().

KviMessageTypeSettingsOption g_msgtypeOptionsTable[KVI_NUM_MSGTYPE_OPTIONS]
KviPixmapOption g_pixmapOptionsTable[KVI_NUM_PIXMAP_OPTIONS]
Initial value:
= {
PIXMAP_OPTION("IrcViewBackground", KviOption_sectFlagIrcView | KviOption_groupTheme),
PIXMAP_OPTION("InputBackground", KviOption_sectFlagInput | KviOption_groupTheme),
PIXMAP_OPTION("UserListViewBackground", KviOption_sectFlagUserListView | KviOption_groupTheme),
PIXMAP_OPTION("LabelBackground", KviOption_sectFlagLabel | KviOption_groupTheme),
PIXMAP_OPTION("MyAvatar", KviOption_sectFlagUser),
PIXMAP_OPTION("IrcToolBarAppletBackground", KviOption_sectFlagIrcToolBar | KviOption_groupTheme),
PIXMAP_OPTION("TreeWindowListBackground", KviOption_sectFlagWindowList | KviOption_groupTheme),
PIXMAP_OPTION("GlobalTransparencyBackground", KviOption_sectFlagGui | KviOption_resetUpdatePseudoTransparency | KviOption_groupTheme),
}
#define PIXMAP_OPTION(_name, _flags)
Definition: KviOptions.cpp:533

Referenced by KviOptionsWidget::addPixmapSelector(), KviTheme::apply(), KviApplication::getOptionString(), KviApplication::listAvailableOptions(), KviApplication::loadOptions(), KviTheme::save(), KviApplication::saveOptions(), and KviApplication::setOptionValue().

KviRectOption g_rectOptionsTable[KVI_NUM_RECT_OPTIONS]
Initial value:
= {
RECT_OPTION("FrameGeometry", QRect(0, 0, 10, 10), KviOption_sectFlagGeometry),
RECT_OPTION("GeneralOptionsDialogGeometry", QRect(50, 50, 600, 450), KviOption_sectFlagGeometry),
}
#define RECT_OPTION(_txt, _val, _flags)
Definition: KviOptions.cpp:52

Referenced by KviTheme::apply(), KviApplication::getOptionString(), KviApplication::listAvailableOptions(), KviApplication::loadOptions(), KviTheme::save(), KviApplication::saveOptions(), and KviApplication::setCommonOptionValue().

KviStringListOption g_stringlistOptionsTable[KVI_NUM_STRINGLIST_OPTIONS]
Initial value:
= {
STRINGLIST_OPTION("HighlightWords", KviOption_sectFlagIrcView),
STRINGLIST_OPTION("SpamWords", KviOption_sectFlagAntiSpam),
STRINGLIST_OPTION_WITHDEFAULT("RecentChannels", KviOption_sectFlagRecent, "#kvirc" KVI_RECENT_CHANNELS_SEPARATOR "freenode"),
STRINGLIST_OPTION("RecentServers", KviOption_sectFlagRecent),
STRINGLIST_OPTION("RecentNicknames", KviOption_sectFlagRecent),
STRINGLIST_OPTION("ModuleExtensionToolbars", KviOption_sectFlagFrame),
STRINGLIST_OPTION("ImageSearchPaths", KviOption_sectFlagFrame | KviOption_encodePath),
STRINGLIST_OPTION("RecentIrcUrls", KviOption_sectFlagRecent),
}
#define STRINGLIST_OPTION_WITHDEFAULT(_txt, _flags, _def)
Definition: KviOptions.cpp:421
#define STRINGLIST_OPTION(_txt, _flags)
Definition: KviOptions.cpp:418
#define KVI_RECENT_CHANNELS_SEPARATOR
Definition: KviOptions.h:683

Referenced by KviOptionsWidget::addStringListSelector(), KviTheme::apply(), KviApplication::getOptionString(), KviApplication::listAvailableOptions(), KviApplication::loadOptions(), KviTheme::save(), KviApplication::saveOptions(), and KviApplication::setCommonOptionValue().

KviStringOption g_stringOptionsTable[KVI_NUM_STRING_OPTIONS]
KviUIntOption g_uintOptionsTable[KVI_NUM_UINT_OPTIONS]
const char* options_section_table[KVI_NUM_OPTION_SECT_FLAGS]
static
Initial value:
= {
"None", "Frame", "Mdi", "Windows",
"WindowList", "IrcView", "MsgType", "MircColor",
"Input", "UserParser", "Connection", "IrcSocket",
"User", "UserListView", "Label", "Modules",
"Ctcp", "Dcc", "Gui", "IrcToolBar",
"Logging", "AntiSpam", "Avatar", "Url",
"Recent", "Geometry", "Notifier"
}

Referenced by config_set_section().