KVIrc  4.9.2
DeveloperAPIs
Functions
KviTheme Namespace Reference

Functions

bool apply (const QString &szThemeDir, KviThemeInfo::Location eLocation, KviThemeInfo &buffer)
 
void installedThemeDirectories (QStringList &slThemes, KviThemeInfo::Location eLocation)
 
bool save (KviThemeInfo &options, bool bSaveIcons)
 
bool saveScreenshots (KviThemeInfo &options, const QString &szOriginalScreenshotPath)
 

Function Documentation

bool KVIRC_API KviTheme::apply ( const QString &  szThemeDirectory,
KviThemeInfo::Location  eLocation,
KviThemeInfo buffer 
)

Attempt to load and apply a theme. If eLocation is Builtin then szThemeDirectory is assumed to be a subdirectory of the kvirc global theme directory. If eLocation is User then szThemeDirectory is assumed to be a subdirectory of the kvirc local theme directory. If eLocation is External the szThemeDirectory is assumed to be a full path to a theme directory. Will return true on success and false on failure. On success this function will return the theme information in the buffer. On failure this function will also set buffer.lastError() to a meaningful value Note that for convenience this function is implemented in KviOptions.cpp

References KviThemeInfo::directory(), KviApplication::findImage(), KviStringConversion::fromString(), g_boolOptionsTable, g_colorOptionsTable, g_fontOptionsTable, g_iccolorOptionsTable, g_mirccolorOptionsTable, g_msgtypeOptionsTable, g_pApp, g_pixmapOptionsTable, g_rectOptionsTable, g_stringlistOptionsTable, g_stringOptionsTable, g_uintOptionsTable, KviConfigurationFile::hasKey(), i, KVI_NUM_BOOL_OPTIONS, KVI_NUM_COLOR_OPTIONS, KVI_NUM_FONT_OPTIONS, KVI_NUM_ICCOLOR_OPTIONS, KVI_NUM_MIRCCOLOR_OPTIONS, KVI_NUM_MSGTYPE_OPTIONS, KVI_NUM_PIXMAP_OPTIONS, KVI_NUM_RECT_OPTIONS, KVI_NUM_STRING_OPTIONS, KVI_NUM_STRINGLIST_OPTIONS, KVI_NUM_UINT_OPTIONS, KVI_OPTION_BOOL, KVI_OPTION_STRING, KVI_THEMEDATA_CONFIG_GROUP, KVI_THEMEDATA_FILE_NAME, KviOption_boolShowIconsInPopupMenus, KviOption_stringIconThemeSubdir, KviThemeInfo::load(), KviRuntimeInfo::name(), KviApplication::optionResetUpdate(), KviConfigurationFile::Read, READ_ALL_OPTIONS, READ_OPTIONS, KviConfigurationFile::readEntry(), KviConfigurationFile::setGroup(), szBuffer, and t().

Referenced by ThemeManagementDialog::applyCurrentTheme(), setup_finish(), and theme_kvs_cmd_apply().

void KVIRC_API KviTheme::installedThemeDirectories ( QStringList &  slThemes,
KviThemeInfo::Location  eLocation 
)
bool KVIRC_API KviTheme::save ( KviThemeInfo options,
bool  bSaveIcons 
)

Save a theme given the specified options. Will return true on success and false on failure. On failure this function will also set options.lastError() to a meaningful value This function requires both absoluteDirectory() and subdirectory() to be set to the right values. In theory this function could save a theme in a directory different than $KVIRC_LOCAL_DIR/themes/subdirectory but this feature is actually unused. Note that for convenience this function is implemented in KviOptions.cpp

References __tr2qs, KviFileUtils::copyFile(), d, KviThemeInfo::directory(), KviFileUtils::directoryExists(), g_boolOptionsTable, g_colorOptionsTable, g_fontOptionsTable, g_iccolorOptionsTable, g_mirccolorOptionsTable, g_msgtypeOptionsTable, g_pApp, g_pIconManager, g_pixmapOptionsTable, g_rectOptionsTable, g_stringlistOptionsTable, g_stringOptionsTable, g_uintOptionsTable, KviApplication::getGlobalKvircDirectory(), KviIconManager::getPixmapWithCache(), KviIconManager::getSmallIcon(), KviIconManager::getSmallIconName(), i, KviIconManager::IconCount, j, KVI_NUM_BOOL_OPTIONS, KVI_NUM_COLOR_OPTIONS, KVI_NUM_FONT_OPTIONS, KVI_NUM_ICCOLOR_OPTIONS, KVI_NUM_MIRCCOLOR_OPTIONS, KVI_NUM_MSGTYPE_OPTIONS, KVI_NUM_PIXMAP_OPTIONS, KVI_NUM_RECT_OPTIONS, KVI_NUM_STRING_OPTIONS, KVI_NUM_STRINGLIST_OPTIONS, KVI_NUM_UINT_OPTIONS, KVI_PATH_SEPARATOR_CHAR, KVI_SMALLICONS_SUBDIRECTORY, KVI_THEMEDATA_CONFIG_GROUP, KVI_THEMEDATA_FILE_NAME, KVI_THEMEINFO_FILE_NAME, KviFileUtils::makeDir(), KviRuntimeInfo::name(), p, KviCachedPixmap::path(), KviApplication::Pics, KviThemeInfo::save(), KviConfigurationFile::setGroup(), KviThemeInfo::setLastError(), KviThemeInfo::subdirectory(), KviConfigurationFile::Write, WRITE_OPTIONS, and KviConfigurationFile::writeEntry().

Referenced by compute_descriptor_score(), KviIrcView::getTextLine(), KviIrcServerParser::parseNumericNames(), SaveThemeDialog::saveTheme(), str_kvs_fnc_printf(), KviConfigurationFile::sync(), and KviCString::vsprintf().

bool KVIRC_API KviTheme::saveScreenshots ( KviThemeInfo options,
const QString &  szOriginalScreenshotPath 
)

Save the theme screenshots in the given EXISTING directory and given an existing screenshot on disk (usually in the tmp directory).

References __tr2qs, KviThemeInfo::directory(), KVI_THEME_LARGE_SCREENSHOT_NAME, KVI_THEME_MEDIUM_SCREENSHOT_NAME, KVI_THEME_SMALL_SCREENSHOT_NAME, QIMAGE_SCALE_MIN, and KviThemeInfo::setLastError().

Referenced by SaveThemeDialog::saveTheme().