예제 #1
0
/* write a file to utf-8 format */
bool fwriteUtf8(const QString file ,QString xml)
{
	if (file.contains("/", Qt::CaseInsensitive))
	{
		QString ultimacartellaaperta = file.left(file.lastIndexOf("/"))+"/";
		QDir dira(ultimacartellaaperta);
		if (dira.mkpath(ultimacartellaaperta)) { }
		else
		{
			return false;
		}
	}

	QTextCodec *codecx;
	codecx = QTextCodec::codecForMib(106);
	QFile f(file);
	if (f.open(QFile::WriteOnly | QFile::Text))
	{
		QTextStream sw(&f);
		sw.setCodec(codecx);
		sw << xml;
		f.close();
		return true;
	}
	return false;
}
예제 #2
0
파일: main.cpp 프로젝트: martamius/mushi
static inline bool Copy_To(QString inputfile, const QString outfile)
{
    bool succ;
    QString ultimacartellaaperta = outfile.left(outfile.lastIndexOf("/"))+"/";
    QDir dira(ultimacartellaaperta);
    dira.mkpath(ultimacartellaaperta);
    
    if (inputfile.startsWith(":/")) {
        QResource actual(inputfile);
        /////qDebug() << "rvalid->" << actual.isValid() << "|" << actual.absoluteFilePath();
        QFile fr(actual.absoluteFilePath());
        succ = fr.copy(outfile);
        if (!succ) {
        QMessageBox::warning(0,"Error \"XHTML Editor\" ",QString("Unable to copy \"%1\" ").arg(inputfile)); 
        }
        return succ;
    }
    
    QFile Imaged(inputfile); 
    succ =  Imaged.copy(outfile);
    if (!succ) {
    QMessageBox::warning(0,"Error \"XHTML Editor\" ",QString("Unable to copy \"%1\" ").arg(inputfile)); 
    }
    return succ;
    
}
예제 #3
0
/* simple mkdir */
bool Cache( const QString dirpath )
{
    QDir dira(dirpath);
    if ( dira.mkpath(dirpath) ) {
    return true;
    } else {
    return false;
    }
}
예제 #4
0
bool Prekazitor::prekazka() {
    TypPrekazky typ = (TypPrekazky)nahodne((int)TYPY_PREKAZEK);
    switch (typ) {
    case DIRA:
        return dira();
    case TRAMPOSKA:
        return tramposka();
    case PARKUR:
        return parkur();
    case PISKACOJUMP:
        return piskacojump();
    case PNEUMATIC:
        return pneumatic();
    case BODLAKY:
        return bodlaky();
    case TAJNA_CHODBA:
        return tajna_chodba();
    default:
        return false;
    }
}