本文整理汇总了C++中KVI_OPTION_STRING函数的典型用法代码示例。如果您正苦于以下问题:C++ KVI_OPTION_STRING函数的具体用法?C++ KVI_OPTION_STRING怎么用?C++ KVI_OPTION_STRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KVI_OPTION_STRING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KVI_OPTION_STRING
bool KviApplication::findImageThemeOnlyCompat(QString &szRetPath,const QString &filename)
{
// if we have a theme, look it up as first
if(!KVI_OPTION_STRING(KviOption_stringIconThemeSubdir).isEmpty())
{
QString szTmp = KVI_OPTION_STRING(KviOption_stringIconThemeSubdir);
szTmp.append(KVI_PATH_SEPARATOR_CHAR);
szTmp.append(filename);
getLocalKvircDirectory(szRetPath,KviApplication::Themes,szTmp);
if(KviFileUtils::fileExists(szRetPath))return true;
getGlobalKvircDirectory(szRetPath,KviApplication::Themes,szTmp);
if(KviFileUtils::fileExists(szRetPath))return true;
}
getLocalKvircDirectory(szRetPath,KviApplication::Pics,filename);
if(KviFileUtils::fileExists(szRetPath))return true;
if(findImageInImageSearchPath(szRetPath,filename))return true;
szRetPath = filename;
return false;
}
示例2: KVI_OPTION_STRING
bool KviApplication::findImage(QString & szRetPath, const QString & filename)
{
// Find a user file...
if(KviFileUtils::isAbsolutePath(filename))
{
szRetPath = filename;
return KviFileUtils::fileExists(filename);
}
// if we have a theme, look it up as first
if(!KVI_OPTION_STRING(KviOption_stringIconThemeSubdir).isEmpty())
{
QString szTmp = KVI_OPTION_STRING(KviOption_stringIconThemeSubdir);
szTmp.append(KVI_PATH_SEPARATOR_CHAR);
szTmp.append(filename);
getLocalKvircDirectory(szRetPath, KviApplication::Themes, szTmp);
if(KviFileUtils::fileExists(szRetPath))
return true;
getGlobalKvircDirectory(szRetPath, KviApplication::Themes, szTmp);
if(KviFileUtils::fileExists(szRetPath))
return true;
}
int i;
for(i = 0; i < 2; i++)
{
getLocalKvircDirectory(szRetPath, pics_localsubdirs[i], filename);
if(KviFileUtils::fileExists(szRetPath))
return true;
}
for(i = 0; i < 2; i++)
{
getGlobalKvircDirectory(szRetPath, pics_globalsubdirs[i], filename);
if(KviFileUtils::fileExists(szRetPath))
return true;
}
if(findImageInImageSearchPath(szRetPath, filename))
return true;
// Last resort
szRetPath = QDir::homePath();
KviQString::ensureLastCharIs(szRetPath, KVI_PATH_SEPARATOR_CHAR);
szRetPath.append(filename);
if(KviFileUtils::fileExists(szRetPath))
return true;
szRetPath = filename;
return false;
}
示例3: KVI_OPTION_STRING
void OptionsWidget_textEncoding::commit()
{
int idx = m_pTextEncodingCombo->currentIndex();
if(idx <= 0)
{
// guess from locale
KVI_OPTION_STRING(KviOption_stringDefaultTextEncoding) = "";
}
else
{
KVI_OPTION_STRING(KviOption_stringDefaultTextEncoding) = m_pTextEncodingCombo->itemText(idx);
}
idx = m_pSrvEncodingCombo->currentIndex();
if(idx <= 0)
{
// guess from locale
KVI_OPTION_STRING(KviOption_stringDefaultSrvEncoding) = "";
}
else
{
KVI_OPTION_STRING(KviOption_stringDefaultSrvEncoding) = m_pSrvEncodingCombo->itemText(idx);
}
idx = m_pForcedLocaleCombo->currentIndex();
QString szLangFile;
g_pApp->getLocalKvircDirectory(szLangFile, KviApplication::None, KVI_FORCE_LOCALE_FILE_NAME);
if(idx == 0)
{
if(KviFileUtils::fileExists(szLangFile))
KviFileUtils::removeFile(szLangFile);
}
else
{
g_szPrevSetLocale = m_pForcedLocaleCombo->itemText(idx);
if(!KviFileUtils::writeFile(szLangFile, m_pForcedLocaleCombo->itemText(idx)))
{
QMessageBox::critical(this, "Writing to File Failed - KVIrc", __tr2qs_ctx("Unable to write language information to", "options") + "\n" + szLangFile, __tr2qs_ctx("OK", "options"));
}
}
#ifdef COMPILE_ENCHANT_SUPPORT
QStringList wantedDictionaries;
for(int i = 0; i < m_pSpellCheckerDictionaries->rowCount(); ++i)
{
if(m_pSpellCheckerDictionaries->item(i, 0)->checkState() == Qt::Checked)
{
wantedDictionaries << m_pSpellCheckerDictionaries->item(i, 0)->text();
}
}
KVI_OPTION_STRINGLIST(KviOption_stringlistSpellCheckerDictionaries) = wantedDictionaries;
KviKvsScript::run("spellchecker.reloadDictionaries", nullptr);
#endif
}
示例4: setup_finish
// this is called just after the first startup
// all the subsystems are up and running (we even have a nice console
// to write on if needed).
// all the options are loaded.
KVIMODULEEXPORTFUNC void setup_finish()
{
if(bNeedToApplyDefaults)
{
KVI_OPTION_STRING(KviOption_stringIncomingPath) = g_szChoosenIncomingDirectory;
// Reset the quit message and the real name... if they contain the KVIrc version
// then probably the user hasn't even edited them.
if(KVI_OPTION_STRING(KviOption_stringQuitMessage).indexOf("KVIrc",0,Qt::CaseInsensitive) != -1)
KVI_OPTION_STRING(KviOption_stringQuitMessage) = KVI_DEFAULT_QUIT_MESSAGE;
// We deserve to change the user's part message in something nice :)
KVI_OPTION_STRING(KviOption_stringPartMessage) = KVI_DEFAULT_PART_MESSAGE;
// FIXME: Should we also change these ?
// #define KVI_DEFAULT_CTCP_USERINFO_REPLY "I'm too lazy to edit this field."
// #define KVI_DEFAULT_AWAY_MESSAGE "I'm off to see the wizard."
// Apply the chosen default theme
KviThemeInfo out;
switch(g_iThemeToApply)
{
case THEME_APPLY_HIRES:
KviTheme::load("Aria-1.0.0",out,BUILTIN);
break;
case THEME_APPLY_LORES:
KviTheme::load("MinimalDark-1.0.0",out,BUILTIN);
break;
// default: no theme
}
if(!szMircServers.isEmpty())
{
g_pServerDataBase->importFromMircIni(szMircServers,szMircIni,
KVI_OPTION_STRINGLIST(KviOption_stringlistRecentServers));
g_pApp->saveIrcServerDataBase();
}
g_pApp->loadDefaultScript();
if(!szUrl.isEmpty())
{
KviKvsVariantList * pParams = new KviKvsVariantList();
pParams->append(szUrl);
KviKvsScript::run("openurl $0",g_pActiveWindow,pParams);
delete pParams;
KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
} else if(!szHost.isEmpty()) {
KviKvsVariantList * pParams = new KviKvsVariantList();
pParams->append(szHost);
pParams->append((kvs_int_t)uPort);
KviKvsScript::run("server $0 $1",g_pActiveWindow,pParams);
delete pParams;
KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
}
}
}
示例5: mediaplayer_get_codec
static QTextCodec * mediaplayer_get_codec()
{
QTextCodec * pCodec = 0;
#if (QT_VERSION < 0x050000)
pCodec = QTextCodec::codecForName(KVI_OPTION_STRING(KviOption_stringWinampTextEncoding).toLatin1());
#else
pCodec = QTextCodec::codecForName(KVI_OPTION_STRING(KviOption_stringWinampTextEncoding).toUtf8());
#endif
if(!pCodec)
pCodec = QTextCodec::codecForLocale();
return pCodec;
}
示例6: KviOptionsWidget
OptionsWidget_identityAvatar::OptionsWidget_identityAvatar(QWidget * parent)
: KviOptionsWidget(parent)
{
createLayout();
layout()->setMargin(10);
m_pLocalAvatar = new KviPixmap(KVI_OPTION_PIXMAP(KviOption_pixmapMyAvatar));
bool bHaveAvatar = (!KVI_OPTION_STRING(KviOption_stringMyAvatar).isEmpty()) && m_pLocalAvatar->pixmap();
QString szTip = __tr2qs_ctx("Here you can choose your avatar image. It will be visible<br>" \
"by other people that request it. Choose a nice image of yourself,<br>" \
"possibly avoiding obscenity and offending images. It is a good idea<br>" \
"to choose a relatively small file (say 150 Kb max) because<br>" \
"most clients have a limit on the size of avatars being downloaded.<br>" \
"The image also should be smaller than 800x600 pixels since<br>" \
"it will have to be viewable in everyone's monitor.","options");
m_pUseAvatarCheck = new QCheckBox(__tr2qs_ctx("Use avatar","options"),this);
addWidgetToLayout(m_pUseAvatarCheck,0,0,0,0);
m_pUseAvatarCheck->setChecked(bHaveAvatar);
mergeTip(m_pUseAvatarCheck,szTip);
m_pAvatarPreview = new KviPixmapPreview(this);
addWidgetToLayout(m_pAvatarPreview,0,1,0,1);
m_pAvatarPreview->setPixmap(m_pLocalAvatar);
m_pAvatarPreview->setEnabled(bHaveAvatar);
connect(m_pUseAvatarCheck,SIGNAL(toggled(bool)),m_pAvatarPreview,SLOT(setEnabled(bool)));
mergeTip(m_pAvatarPreview,szTip);
KviTalHBox * hb = new KviTalHBox(this);
hb->setSpacing(4);
addWidgetToLayout(hb,0,2,0,2);
m_pAvatarNameEdit = new QLineEdit(hb);
m_pAvatarNameEdit->setReadOnly(true);
m_pAvatarNameEdit->setEnabled(bHaveAvatar);
m_pAvatarNameEdit->setText(KVI_OPTION_STRING(KviOption_stringMyAvatar));
connect(m_pUseAvatarCheck,SIGNAL(toggled(bool)),m_pAvatarNameEdit,SLOT(setEnabled(bool)));
m_pChooseAvatarButton = new QPushButton(__tr2qs_ctx("Choose...","options"),hb);
m_pChooseAvatarButton->setEnabled(bHaveAvatar);
connect(m_pUseAvatarCheck,SIGNAL(toggled(bool)),m_pChooseAvatarButton,SLOT(setEnabled(bool)));
connect(m_pChooseAvatarButton,SIGNAL(clicked()),this,SLOT(chooseAvatar()));
layout()->setRowStretch(1,2);
}
示例7: KVI_OPTION_STRING
void OptionsWidget_highlighting::commit()
{
KVI_OPTION_STRING(KviOption_stringWordSplitters) = m_pWordSplitterCharactersEdit->text().trimmed();
KVI_OPTION_BOOL(KviOption_boolUseFullWordHighlighting) = m_pHighlightAllOccurencesRadioButton->isChecked();
KviOptionsWidget::commit();
}
示例8: mediaFillBox
void OptionsWidget_soundGeneral::mediaFillBox()
{
QStringList l;
QStringList::Iterator it;
int cnt;
int i;
KviModule * m = g_pModuleManager->getModule("mediaplayer");
if(!m)goto disable;
if(!m->ctrl("getAvailableMediaPlayers",&l))goto disable;
m_pMediaPlayerBox->clear();
for ( it = l.begin(); it != l.end(); ++it )
{
m_pMediaPlayerBox->addItem(*it);
}
cnt = m_pMediaPlayerBox->count();
for(i=0;i<cnt;i++)
{
QString t = m_pMediaPlayerBox->itemText(i);
if(KviQString::equalCI(t,KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer)))
{
m_pMediaPlayerBox->setCurrentIndex(i);
break;
}
}
return;
disable:
m_pMediaPlayerBox->clear();
m_pMediaPlayerBox->setEnabled(false);
m_pMediaTestButton->setEnabled(false);
m_pMediaAutoDetectButton->setEnabled(false);
}
示例9: getMixerVolume
int DccVoiceWindow::getMixerVolume(void) const
{
#ifndef COMPILE_DISABLE_DCC_VOICE
int fd;
int ret;
int left; //, right;
int req;
if((fd = ::open(KVI_OPTION_STRING(KviOption_stringDccVoiceMixerDevice).toUtf8().data(), O_RDONLY)) == -1)
{
return 0;
}
req = KVI_OPTION_BOOL(KviOption_boolDccVoiceVolumeSliderControlsPCM) ? SOUND_MIXER_READ_PCM : SOUND_MIXER_READ_VOLUME;
if(::ioctl(fd,req,&ret))
{
::close(fd);
return 0;
}
left = (ret & 0x00ff);
// right = (ret & 0xff00) >> 8;
::close(fd);
return -left;
#else
return 0;
#endif
}
示例10: KVI_OPTION_STRING
void OptionsWidget_identityAvatar::commit(void)
{
KviOptionsWidget::commit();
QString szAvatarName = m_pAvatarNameEdit->text();
if(m_pUseAvatarCheck->isChecked() && m_pLocalAvatar->pixmap() && (!szAvatarName.isEmpty()))
{
KVI_OPTION_STRING(KviOption_stringMyAvatar) = szAvatarName;
KVI_OPTION_PIXMAP(KviOption_pixmapMyAvatar) = *m_pLocalAvatar;
} else {
KVI_OPTION_STRING(KviOption_stringMyAvatar) = "";
KVI_OPTION_PIXMAP(KviOption_pixmapMyAvatar) = KviPixmap();
}
g_pApp->setAvatarFromOptions();
}
示例11: mediaplayer_get_codec
static QTextCodec * mediaplayer_get_codec()
{
QTextCodec * c= QTextCodec::codecForName(KVI_OPTION_STRING(KviOption_stringWinampTextEncoding).toUtf8().data());
if(!c)c = QTextCodec::codecForLocale();
return c;
}
示例12: addStringSelector
KviStringSelector * KviOptionsWidget::addStringSelector(int x1,int y1,int x2,int y2,const QString & txt,int optId,bool bEnabled)
{
m_iResetFlags |= (g_stringOptionsTable[optId].flags & KviOption_resetMask);
KviStringSelector * d = addStringSelector(x1,y1,x2,y2,txt,&(KVI_OPTION_STRING(optId)),bEnabled);
QString tmp = m_szBasicTipStart;
tmp += g_stringOptionsTable[optId].name;
tmp += m_szBasicTipEnd;
KviTalToolTip::add(d,tmp);
return d;
}
示例13: addPasswordSelector
KviPasswordSelector * KviOptionsWidget::addPasswordSelector(QWidget * pParent,const QString & txt,int optId,bool bEnabled)
{
m_iResetFlags |= (g_stringOptionsTable[optId].flags & KviOption_resetMask);
KviPasswordSelector * d = addPasswordSelector(pParent,txt,&(KVI_OPTION_STRING(optId)),bEnabled);
QString tmp = m_szBasicTipStart;
tmp += g_stringOptionsTable[optId].name;
tmp += m_szBasicTipEnd;
KviTalToolTip::add(d,tmp);
return d;
}
示例14: KVI_OPTION_STRING
void KviWindow::getDefaultLogFileName(QString & szBuffer, QDate date, bool bGzip, unsigned int uDatetimeFormat)
{
QString szLog;
// dynamic log path
QString szDynamicPath = KVI_OPTION_STRING(KviOption_stringLogsDynamicPath).trimmed();
if(!szDynamicPath.isEmpty())
{
KviQString::escapeKvs(&szDynamicPath, KviQString::PermitVariables | KviQString::PermitFunctions);
KviKvsVariant vRet;
if(KviKvsScript::evaluate(szDynamicPath, this, nullptr, &vRet))
vRet.asString(szDynamicPath);
}
g_pApp->getLocalKvircDirectory(szLog, KviApplication::Log, szDynamicPath);
KviQString::ensureLastCharIs(szLog, KVI_PATH_SEPARATOR_CHAR);
//ensure the directory exists
KviFileUtils::makeDir(szLog);
QString szDate;
switch(uDatetimeFormat)
{
case 1:
szDate = date.toString(Qt::ISODate);
break;
case 2:
szDate = date.toString(Qt::SystemLocaleShortDate);
break;
case 0:
default:
szDate = date.toString("yyyy.MM.dd");
break;
}
szDate.replace('_', '-'); // this would confuse the log viewer
KviFileUtils::cleanFileName(szDate);
QString szBase;
getBaseLogFileName(szBase);
KviFileUtils::encodeFileName(szBase);
szBase = szBase.toLower();
szBase.replace("%%2e", "%2e");
QString szTmp;
if(bGzip)
szTmp = "%1_%2_%3.log.gz";
else
szTmp = "%1_%2_%3.log";
szLog.append(QString(szTmp).arg(typeString(), szBase, szDate));
szBuffer = szLog;
}
示例15: KviOptionsWidget
OptionsWidget_connectionSsl::OptionsWidget_connectionSsl(QWidget * parent)
: KviOptionsWidget(parent)
{
setObjectName("ssl_options_widget");
createLayout();
#ifdef COMPILE_SSL_SUPPORT
KviBoolSelector * b;
KviFileSelector * f;
KviPasswordSelector * p;
KviTalGroupBox * gbox = addGroupBox(0, 0, 0, 0, Qt::Horizontal, __tr2qs_ctx("Certificate", "options"));
b = addBoolSelector(gbox, __tr2qs_ctx("Use SSL certificate (PEM format only)", "options"),
&(KVI_OPTION_BOOL(KviOption_boolUseSSLCertificate)), true);
f = addFileSelector(gbox, __tr2qs_ctx("Certificate location:", "options"), &(KVI_OPTION_STRING(KviOption_stringSSLCertificatePath)),
KVI_OPTION_BOOL(KviOption_boolUseSSLCertificate));
connect(b, SIGNAL(toggled(bool)), f, SLOT(setEnabled(bool)));
p = new KviPasswordSelector(gbox, __tr2qs_ctx("Certificate password:", "options"), &(KVI_OPTION_STRING(KviOption_stringSSLCertificatePass)),
KVI_OPTION_BOOL(KviOption_boolUseSSLCertificate));
connect(b, SIGNAL(toggled(bool)), p, SLOT(setEnabled(bool)));
gbox = addGroupBox(0, 1, 0, 1, Qt::Horizontal, __tr2qs_ctx("Private Key", "options"));
b = addBoolSelector(gbox, __tr2qs_ctx("Use SSL private key", "options"), &(KVI_OPTION_BOOL(KviOption_boolUseSSLPrivateKey)), true);
f = addFileSelector(gbox, __tr2qs_ctx("Private key location:", "options"), &(KVI_OPTION_STRING(KviOption_stringSSLPrivateKeyPath)),
KVI_OPTION_BOOL(KviOption_boolUseSSLPrivateKey));
connect(b, SIGNAL(toggled(bool)), f, SLOT(setEnabled(bool)));
p = addPasswordSelector(gbox, __tr2qs_ctx("Private key password:", "options"), &(KVI_OPTION_STRING(KviOption_stringSSLPrivateKeyPass)),
KVI_OPTION_BOOL(KviOption_boolUseSSLPrivateKey));
connect(b, SIGNAL(toggled(bool)), p, SLOT(setEnabled(bool)));
addRowSpacer(0, 3, 0, 3);
#else
addLabel(0, 0, 0, 0, __tr2qs_ctx("This executable has no SSL support.", "options"));
#endif
}