本文整理汇总了C++中QString::ascii方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::ascii方法的具体用法?C++ QString::ascii怎么用?C++ QString::ascii使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::ascii方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findNext
void SearchLocationID::findNext( const QString& serverConfigFile )
{
kdebugf();
connect(&httpClient_, SIGNAL(finished()), this, SLOT(downloadingFinished()));
connect(&httpClient_, SIGNAL(error()), this, SLOT(downloadingError()));
connect(&httpClient_, SIGNAL(redirected(QString)), this, SLOT(downloadingRedirected(QString)));
serverConfigFile_ = serverConfigFile;
if (weatherConfig_ != 0)
delete weatherConfig_;
weatherConfig_ = new PlainConfigFile(WeatherGlobal::getConfigPath(serverConfigFile_));
QString encoding = weatherConfig_->readEntry("Default","Encoding");
decoder_ = QTextCodec::codecForName(encoding.ascii());
host_ = weatherConfig_->readEntry("Name Search","Search host");
httpClient_.setHost(host_);
QString encodedCity = city_;
encodeUrl(&encodedCity, encoding);
url_.sprintf(weatherConfig_->readEntry("Name Search","Search path").ascii() , encodedCity.ascii());
timerTimeout_->start(weather_global->CONNECTION_TIMEOUT, false);
timeoutCount_ = weather_global->CONNECTION_COUNT;
httpClient_.get(url_);
kdebugf2();
}
示例2: defined
void Q3GCache::statistics() const
{
#if defined(QT_DEBUG)
QString line;
line.fill(QLatin1Char('*'), 80);
qDebug("%s", line.ascii());
qDebug("CACHE STATISTICS:");
qDebug("cache contains %d item%s, with a total cost of %d",
count(), count() != 1 ? "s" : "", tCost);
qDebug("maximum cost is %d, cache is %d%% full.",
mCost, (200*tCost + mCost) / (mCost*2));
qDebug("find() has been called %d time%s",
lruList->finds, lruList->finds != 1 ? "s" : "");
qDebug("%d of these were hits, items found had a total cost of %d.",
lruList->hits,lruList->hitCosts);
qDebug("%d item%s %s been inserted with a total cost of %d.",
lruList->inserts,lruList->inserts != 1 ? "s" : "",
lruList->inserts != 1 ? "have" : "has", lruList->insertCosts);
qDebug("%d item%s %s too large or had too low priority to be inserted.",
lruList->insertMisses, lruList->insertMisses != 1 ? "s" : "",
lruList->insertMisses != 1 ? "were" : "was");
qDebug("%d item%s %s been thrown away with a total cost of %d.",
lruList->dumps, lruList->dumps != 1 ? "s" : "",
lruList->dumps != 1 ? "have" : "has", lruList->dumpCosts);
qDebug("Statistics from internal dictionary class:");
dict->statistics();
qDebug("%s", line.ascii());
#endif
}
示例3: fillConfigurations
void ElogConfigurationI::fillConfigurations() {
QString strIPAddress;
QString strName;
QString strGroup;
QString strEntry;
KConfig cfg("kstrc", false, false);
int iPortNumber;
int i;
for( i=0; i<10; i++ ) {
strGroup.sprintf("ELOG%d", i );
cfg.setGroup(strGroup);
strIPAddress = cfg.readEntry("IPAddress", "");
iPortNumber = cfg.readNumEntry("Port", 8080);
strName = cfg.readEntry("Name", "");
strIPAddress.stripWhiteSpace();
strName.stripWhiteSpace();
if( !strIPAddress.isEmpty() ) {
strEntry.sprintf( "%d [%s:%d:%s]", i, strIPAddress.ascii(), iPortNumber, strName.ascii() );
} else {
strEntry.sprintf( "%d", i );
}
comboBoxConfiguration->insertItem( strEntry );
}
}
示例4: TalkGui
Talk::Talk(const QString &playername, QWidget * /* parent */, bool isplayer)
: TalkGui()
{
name = playername;
// create a new tab
QString s = "MultiLineEdit1_" + QString::number(++counter);
MultiLineEdit1->setName(s.ascii()) ;
MultiLineEdit1->setCurrentFont(setting->fontComments);
s = "LineEdit1_" + QString::number(++counter);
LineEdit1->setName(s.ascii());
LineEdit1->setFont(setting->fontComments);
// do not add a button for shouts* or channels tab
if ( (name.find('*') != -1) || (!isplayer))
{
delete pb_releaseTalkTab;
delete pb_match;
delete stats_layout;
}
}
示例5: validateLayout
//=====================================
// XKeyboard::Layout/Model check
//-------------------------------------
void XKeyboard::validateLayout ( void ) {
// log(L_INFO,"XKeyboard::validateLayout() called\n");
// ...
// this function check if the currently used combination
// of layout and model is valid according to the Keyboard.map
// if not we will provide a warning
// ---
QString XkbModel;
QString XkbLayout;
QDictIterator<char> itModel (mModelHash);
for (; itModel.current(); ++itModel) {
if (QString::fromLocal8Bit(itModel.current()) == mType->currentText()) {
XkbModel = itModel.currentKey();
}
}
// 2) primary XKB layout
QDictIterator<char> itLayout (mLayoutHash);
for (; itLayout.current(); ++itLayout) {
if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) {
XkbLayout = itLayout.currentKey();
}
}
QString isValid = qx ( VALIDATELAYOUT,STDOUT,2,"%s %s",
XkbModel.ascii(),XkbLayout.ascii()
);
if (! isValid.toInt()) {
setMessage ("noValidLayout");
}
}
示例6:
bool First_scr::
extract_values( std::vector<double>& values, const QString& tagname,
QDomElement& elem, int id ) {
QDomNodeList node = elem.elementsByTagName( tagname );
if( node.count() == 0 ) {
GsTLcerr << "missing tag \"" << tagname.ascii() << "\" for variogram "
<< id << gstlIO::end;
return false;
}
QDomElement dir_elem = node.item(0).toElement();
if( dir_elem.isNull() ) {
GsTLcerr << "missing tag \"" << tagname.ascii() << "\" for variogram "
<< id << gstlIO::end;
return false;
}
QString dir_str = dir_elem.text();
QStringList coords = QStringList::split( " ", dir_str, false );
values.clear();
for( int i=0 ; i < coords.size() ; i++ ) {
values.push_back( coords[i].toDouble() );
}
return true;
}
示例7: it
//====================================
// getArrangement
//------------------------------------
QDict<QString> SCCMonitorArrange::getArrangement ( void ) {
QDict<QString> result;
QList<SCCLayoutLine> layout = mMatrix->getLayout();
QListIterator<SCCLayoutLine> it (layout);
for (; it.current(); ++it) {
QString* key = new QString();
QString* value = new QString();
SCCLayoutLine* l = it.current();
int neighbour[4] = {l->mLeft,l->mRight,l->mTop,l->mBottom};
key->sprintf("Screen:Screen[%d]",mCardID[l->ID]);
for (int n=0;n<4;n++) {
if (neighbour[n] == -1) {
value->sprintf (
"%s <none>",value->ascii()
);
} else {
value->sprintf (
"%s Screen[%d]",value->ascii(),neighbour[n]
);
}
}
*value = value->stripWhiteSpace();
result.insert (
*key,value
);
}
return result;
}
示例8: make_response
QString Unsettled::make_response ( const QString& chex, const QString& password ) const
{
int size = chex.length ();
if ( size & 1 )
return "error";
size >>= 1;
// convert challenge from hex to bin
QString cbin;
for ( int i = 0; i < size; i++ )
{
QString tmp = chex.mid ( 2 * i, 2 );
cbin.append ( ( char ) strtol ( tmp.ascii (), 0, 16 ) );
}
// calculate response
unsigned char rbin[MD5_DIGEST_LENGTH];
MD5state_st md5;
MD5_Init ( &md5 );
MD5_Update ( &md5, cbin.ascii (), size );
MD5_Update ( &md5, password.toAscii(), password.length () );
MD5_Final ( rbin, &md5 );
// convert response from bin to hex
QString rhex;
for ( int i = 0; i < MD5_DIGEST_LENGTH; i++ )
{
char buffer[3];
snprintf ( buffer, 3, "%02x", rbin[i] );
rhex.append ( buffer );
}
return rhex;
}
示例9: fieldValue
QString SysIBM::fieldValue(const QString &fieldName, const QString &path)
{
int len = fieldName.length();
QString val;
if (len < 1) return val;
val = dbgReadPathString(path);
if (val.length() < 1) return val;
QStringList lines = QStringList::split("\n", val);
for ( QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it )
{
QString line = (*it);
if ((int) line.length() > len + 1
&& line[len] == ':'
&& line.startsWith(fieldName))
{
printf("%s: Value for field '%s': '%s'\n",
path.ascii(), fieldName.ascii(),
line.mid(len+2).stripWhiteSpace().ascii());
return line.mid(len+2).stripWhiteSpace();
}
}
return QString();
}
示例10: LoadCustomizationFile
bool LoadCustomizationFile(QString srcPath)
{
QString fn_Custom = QString("%1/%2.custom").arg(srcPath).arg(appName);
DBG_OUT("Checking for Customization file: %s", fn_Custom.ascii() );
if (QFile::exists(fn_Custom))
{
DBG_OUT("Customization file found. Loading custom parameters");
ZConfig* cstm_File = new ZConfig(fn_Custom);
if (cstm_File->groupExists("UNPACK_TOOLS"))
{
FullPath_7z = cstm_File->readEntry("UNPACK_TOOLS","BIN_FULLPATH",APP_FULLPATH_7Z);
DBG_OUT("UNPACK_TOOLS::BIN_FULLPATH : '%s'", FullPath_7z.ascii() );
}
if (cstm_File->groupExists("MENU_CFGS"))
{
appMenuUUID = cstm_File->readEntry("MENU_CFGS","APP_MENU_UUID",APP_FULLPATH_7Z);
DBG_OUT("MENU_CFGS::APP_MENU_UUID : '%s'", appMenuUUID.ascii() );
}
delete cstm_File;
return true;
}
return false;
}
示例11: resetPage
//=====================================
// XAccessX reset and switch to Intro
//-------------------------------------
void XAccessX::resetPage (int reload) {
// ...
// this function is called if the xaccess dialog is finished or canceled
// AccessX is an X11 extension which need a seperate configuration file
// which is outside of the normal configuration create via ISaX. Therefore
// we don`t need to serialize any data here
// ---
if (reload == PAGE_RELOAD) {
if (mEnable -> isChecked()) {
QFile* mHandle = new QFile (
"/usr/X11R6/lib/X11/xkb/X0-config.keyboard"
);
if (! mHandle -> open(IO_WriteOnly)) {
log (L_ERROR,
"XAccessX::open failed on: %s -> %s\n",
mHandle->name().ascii(),strerror(errno)
);
}
QString* speed = new QString();
speed -> sprintf (
"%d",mLCD -> intValue()
);
QDict<char> data;
data.insert ("MouseKeysMaxSpeed=" ,
speed->ascii()
);
data.insert ("MouseKeysDelay=" , "40");
data.insert ("MouseKeysInterval=" , "10" );
data.insert ("MouseKeysTimeToMax=", "1000" );
data.insert ("MouseKeysCurve=" , "0" );
data.insert ("Controls+=","MouseKeysAccel");
#if 0
data.insert ("Controls+=",
"MouseKeysAccel + AccessxKeys"
);
data.insert ("Feedback+=",
"SlowKeysPress + SlowKeysAccept + StickyKeys + LatchToLock"
);
#endif
QDictIterator<char> it (data);
for (; it.current(); ++it) {
QString line;
line.sprintf ("%s %s\n",
it.currentKey().ascii(),it.current()
);
mHandle -> writeBlock (
line.ascii(),line.length()
);
}
mHandle -> close();
}
}
if (reload == PAGE_RELOAD) {
slotApply();
}
mStatus -> clear();
slotIntro (mIndex);
XTemplate::resetPage ();
mStack -> raiseWidget (Intro);
}
示例12: fileList
QStringList CEmoticons::fileList(const char *theme)
{
QString szdir = data->basedir + "/" + theme + "/";
QString szaltdir = data->altbasedir + "/" + theme + "/";
QStringList ret;
QDir d(szdir);
QDir altd(szaltdir);
node_list_t list;
node_list_t::iterator iter;
struct node n;
if (d.exists())
loadTheme(data, szdir.ascii(), list);
else if (altd.exists())
loadTheme(data, szaltdir.ascii(), list);
if (d.exists() || altd.exists())
{
for (iter = list.begin();
iter != list.end(); iter++)
{
n = *iter;
ret << n.file;
}
}
return ret;
}
示例13: createSymlinks
static void createSymlinks( const QString &location, const QString &package )
{
QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" );
mkdir( "/usr/lib/ipkg", 0777 );
mkdir( listDir, 0777 );
QFile outFile( listDir + package + ".list");
// odebug << "createSymlinks " << inFile.name().ascii() << " -> " << outFile.name().ascii() << "" << oendl;
if ( inFile.open(IO_ReadOnly) && outFile.open(IO_WriteOnly)) {
QTextStream in(&inFile);
QTextStream out(&outFile);
QString s;
while ( !in.eof() ) { // until end of file...
s = in.readLine(); // line of text excluding '\n'
// odebug << "Read: " << s.ascii() << "" << oendl;
if (s.find(location,0,true) >= 0) {
// odebug << "Found!" << oendl;
s = s.replace(location,"");
}
// odebug << "Read after: " << s.ascii() << "" << oendl;
// for s, do link/mkdir.
if ( s.right(1) == "/" ) {
// odebug << "do mkdir for " << s.ascii() << "" << oendl;
mkdir( s.ascii(), 0777 );
//possible optimization: symlink directories
//that don't exist already. -- Risky.
} else {
// odebug << "do symlink for " << s.ascii() << "" << oendl;
QFileInfo ffi( s );
//Don't try to symlink if a regular file exists already
if ( !ffi.exists() || ffi.isSymLink() ) {
if (symlink( (location+s).ascii(), s.ascii() ) != 0) {
if (errno == ENOENT) {
// perror("Symlink Failed! ");
QString e=s.ascii();
e = e.replace(ffi.fileName(),"");
// odebug << "DirName : " << e.ascii() << "" << oendl;
system ( QString("mkdir -p ")+e.ascii() );
if (symlink( (location+s).ascii(), s.ascii() ) != 0)
odebug << "Big problem creating symlink and directory" << oendl;
}
}
// odebug << "Created << s.ascii() << oendl;
out << s << "\n";
} else {
odebug << "" << s.ascii() << " exists already, not symlinked" << oendl;
}
}
}
inFile.close();
outFile.close();
}
}
示例14: setMouseCursor
//=====================================
// set cursor for root window...
//-------------------------------------
void setMouseCursor (const QString& cursorName) {
QString optc ("-cursor_name");
QString optd ("-display");
QString display ( DisplayString ( QApplication::desktop()->x11Display() ));
qx (XSETROOT,STDNONE,4,"%s %s %s %s",
optc.ascii(),cursorName.ascii(),optd.ascii(),display.ascii()
);
}
示例15: dbgReadPathString
QString SysIBM::dbgReadPathString(const QString &path)
{
QString ret = readPathString(path);
printf("READ '%s':\n%s(END)\n\n", path.ascii(), ret.ascii());
return ret;
}