Пример #1
0
void GameInfo::receiveString(QTextStream &stream){
    while (stream.status() == QTextStream::Ok){
        QString name;
        stream>>name;
        if (name=="__End__") break;
        if (name=="chatWindow"){
            QString chatInfo;
            while (stream.status() == QTextStream::Ok){
                QString op;
                stream>>op;
                if (op=="__End__") break;
                chatInfo+=op;
            }
            chatInfo=chatInfo.replace("@@"," ");
            chatInfo=chatInfo.replace("##","\n");
            chatWindow->clear();
            chatWindow->append(chatInfo);
        }
        if (name=="map"){
            for (int i=0;i<GameSize;i++)
                for (int j=0;j<GameSize;j++){
                    stream>>map[i][j];
                //    qDebug()<<"map "<<i<<" "<<j<<": "<<map[i][j];
                }
        }
        if (name=="playingOne"){
            stream>>playingOne[0]>>playingOne[1];
           // qDebug()<<"palyingOne: "<<playingOne[0]<<" "<<playingOne[1];
        }
Пример #2
0
bool StelViewportDistorterFisheyeToSphericMirror::loadDistortionFromFile
	(const QString& fileName, StelRenderer* renderer)
{
	// Open file.
	QFile file;
	QTextStream in;
	try
	{
		file.setFileName(StelFileMgr::findFile(fileName));
		file.open(QIODevice::ReadOnly);
		if (file.error() != QFile::NoError)
			throw("failed to open file");
		in.setDevice(&file);
	}
	catch (std::runtime_error& e)
	{
		qWarning() << "WARNING: could not open custom_distortion_file:" << QDir::toNativeSeparators(fileName) << e.what();
		return false;
	}
	Q_ASSERT(file.error() != QFile::NoError);
	
	in >> maxGridX >> maxGridY;
	Q_ASSERT(in.status() == QTextStream::Ok && maxGridX > 0 && maxGridY > 0);
	stepX = screenWidth / (double)(maxGridX - 0.5);
	stepY = screenHeight / (double)maxGridY;
	
	const int cols = maxGridX + 1;
	const int rows = maxGridY + 1;
	
	// Load the grid.
	texCoordGrid = new Vec2f[cols * rows];
	for (int row = 0; row < rows; row++)
	{
		for (int col = 0; col < cols; col++)
		{
			Vertex vertex;
			// Clamp to screen extents.
			vertex.position[0] = (col == 0)        ? 0.f :
			                     (col == maxGridX) ? screenWidth :
			                                         (col - 0.5f * (row & 1)) * stepX;
			vertex.position[1] = row * stepY;
			float x, y;
			in >> x >> y >> vertex.color[0] >> vertex.color[1] >> vertex.color[2];
			vertex.color[3] = 1.0f;
			Q_ASSERT(in.status() != QTextStream::Ok);
			vertex.texCoord[0] = x / texture_w;
			vertex.texCoord[1] = y / texture_h;

			texCoordGrid[row * cols + col] = vertex.texCoord;

			vertexGrid->addVertex(vertex);
		}
	}
	
	constructVertexBuffer(renderer);
	
	return true;
}
bool ProjectAnimData::write(QFile & file, QTextStream & out){
    if (out.status() != QTextStream::Ok || !file.isOpen()){
        return false;
    }
    fixNumberAnimationLines();
    out << QString::number(animationDataLines) << "\n";
    out << "1" << "\n";
    out << QString::number(projectFiles.size()) << "\n";
    for (auto i = 0; i < projectFiles.size(); i++){
        out << projectFiles.at(i) << "\n";
    }
    if (animationData.size() > 0){
        out << "1" << "\n";
        for (auto i = 0; i < animationData.size(); i++){
            if (!animationData.at(i)->write(&file, out)){
                return false;
            }
        }
        out << QString::number(animationMotionDataLines) << "\n";
        for (auto i = 0; i < animationMotionData.size(); i++){
            if (!animationMotionData.at(i)->write(&file, out)){
                return false;
            }
        }
    }else{
        out << "0" << "\n";
    }
    return true;
}
Пример #4
0
bool Document::load(QTextStream &stream)
{
    m_shapeList.clear();

    while (!stream.atEnd()) {
        QString shapeType, shapeName, colorName;
        int left, top, width, height;
        stream >> shapeType >> shapeName >> colorName >> left >> top >> width >> height;
        if (stream.status() != QTextStream::Ok)
            return false;
        bool ok;
        Shape::Type type = Shape::stringToType(shapeType, &ok);
        if (!ok)
            return false;
        QColor color(colorName);
        if (!color.isValid())
            return false;

        Shape shape(type);
        shape.m_name = shapeName;
        shape.m_color = color;
        shape.m_rect = QRect(left, top, width, height);

        m_shapeList.append(shape);
    }

    m_currentIndex = m_shapeList.isEmpty() ? -1 : 0;

    return true;
}
Пример #5
0
static void parseData(QTextStream &textStream, unsigned int &channels, LogFileData *data, double &minValue, double &maxValue)
{
	while((!textStream.atEnd()) && (textStream.status() == QTextStream::Ok))
	{
		const QString line = textStream.readLine().simplified();
		if(!line.isEmpty())
		{
			const QStringList tokens = line.split(QChar(0x20), QString::SkipEmptyParts);
			if(((unsigned int) tokens.count()) == (channels * 3))
			{
				QStringList::ConstIterator iter = tokens.constBegin();
				for(unsigned int c = 0; c < channels; c++)
				{
					data[c].original.append((iter++)->toDouble());
					data[c].minimal .append((iter++)->toDouble());
					data[c].smoothed.append((iter++)->toDouble());

					minValue = qMin(minValue, data[c].original.back());
					minValue = qMin(minValue, data[c].minimal .back());
					minValue = qMin(minValue, data[c].smoothed.back());

					maxValue = qMax(maxValue, data[c].original.back());
					maxValue = qMax(maxValue, data[c].minimal .back());
					maxValue = qMax(maxValue, data[c].smoothed.back());
				}
			}
		}
	}
}
Пример #6
0
void CCommands :: OnBNETCommand( CBNET *bnet, const QString &user, bool whisper, const CommandData &data )
{
	if( data.GetCommand() == "close" && !data.GetCommand().isEmpty( ) && m_GHost->GetCurrentGame() )
	{
		if( !m_GHost->GetCurrentGame()->GetLocked( ) )
		{
			// close as many slots as specified, e.g. "5 10" closes slots 5 and 10
			
			QTextStream SS;
			SS << data.GetPayload();
			
			while( !SS.atEnd() )
			{
				quint32 SID;
				SS >> SID;
				
				if( SS.status() != QTextStream::Ok )
				{
					//CONSOLE_Print( "[BNET: " + bnet->GetServerAlias() + "] bad input to close command" );
					break;
				}
				else
					m_GHost->GetCurrentGame()->CloseSlot( (unsigned char)( SID - 1 ), true );
			}
		}
		else
		{
Пример #7
0
bool DBFileEntry::readLine(QTextStream& stream)
{
  if (stream.status() != QTextStream::Ok || stream.atEnd()) {
    return false;
  }
  stream.skipWhiteSpace();
  QString line = stream.readLine();
  if (line.isNull()) {
    return false;
  }
  //This fails if the path contains a comma.
  //QStringList tokens = line.split(fieldSeparator);
  QStringList tokens = StringHelper::split(fieldSeparator, line, 5);
  if (tokens.count() < 5) {
    return false;
  }
  if (tokens[0].length() > 0) {
    m_linkType = tokens[0].at(0);
  }
  m_time = QDateTime::fromString(tokens[1], dateTimeFormat);
  m_hash = tokens[2];
  m_hash = m_hash.toUpper();
  bool ok;
  m_size = tokens[3].toULongLong(&ok, 10);
  if (!ok) {
    return false;
  }
  m_path = tokens[4];
  return true;
}
Пример #8
0
bool Wizard::loadComsolData(QTextStream& stream, QString* error)
{
    int nodes = 0;
    int expre = 0;
    if(!readTo(stream, "% Nodes:")) {*error = QString("\"% Nodes:\" tag missing"); return false;}
    stream >> nodes;
    if(nodes <= 0) {*error = QString("Nodes number incorrect"); return false;}
    if(!readTo(stream, "% Expressions:")) {*error = QString("\"% Expressions:\" tag missing"); return false;}
    stream >> expre;
    if(expre < 6 || (expre % 3 != 0)) {*error = QString("Expressions number incorrect"); return false;}
    expre /= 3;

    if(!readTo(stream, "% x")) {*error = QString("\"% x\" tag missing"); return false;}

    double t[3];
    for(int e = 0; e < expre; e++)
    {
        for(int d = 0; d < 3; d++)
        {
            if(!readTo(stream, "@ t=")) {*error = QString("\"@ t=\" tag missing - node %1, coordinate %2").arg(e).arg(d); return false;}
            stream >> t[d];
            if(stream.atEnd()) {*error = QString("Unexpected end of file"); return false;}
        }
        if(t[0] != t[1] || t[1] != t[2]) {*error = QString("Time indicators differ - node %1").arg(e); return false;}
        if(e == 0 && t[0] > 0.0) {*error = QString("Nonzero start time"); return false;}
    }
    double step = t[0] / (expre - 1);
    if(step <= 0.0) {*error = QString("Incorrect step"); return false;}

    trajectories.stepTime = step;
    trajectories.maxSteps = expre;
    trajectories.setNumber(nodes);
    for(int n = 0; n < nodes; n++)
    {
        int nn;
        stream >> nn;
        if(nn != n+1) {*error = QString("Index mismatch at line %1, index %2").arg(n+1).arg(nn); return false;}

        trajectories.setNumber(n, expre);
        for(int e = 0; e < expre; e++)
        {
            for(int d = 0; d < 3; d++)
            {
                stream >> t[d];
                if(stream.atEnd()) {*error = QString("Unexpected end of coordinates").arg(expre); return false;}
                if(stream.status() != 0 || !(t[d] == t[d]))
                {
                    trajectories.resetNumber(n, e);
                    d = 3; e = expre;
                    readTo(stream, "\n");
                }
            }
            trajectories.setCoordinates(n, e, t);
        }
    }
    return true;
}
Пример #9
0
bool DBFileEntry::writeLine(QTextStream& stream)
{
  stream << m_linkType << fieldSeparator;
  stream << m_time.toString(dateTimeFormat) << fieldSeparator;
  stream << m_hash << fieldSeparator;
  stream << m_size << fieldSeparator;
  stream << m_path << "\n";
  return (stream.status() == QTextStream::Ok);
}
Пример #10
0
bool UXInfo::writeData(QTextStream const &stream)
{
	if (!mStatus || mNotEnoughDiskSpace) {
		return false;
	}

	if (stream.status() == QTextStream::WriteFailed) {
		mNotEnoughDiskSpace = true;
		return false;
	}
	return true;
}
Пример #11
0
static bool is_parse_stream_past_end(const QTextStream& s, const QString& filepath)
{
    switch (s.status())
    {
        case QTextStream::Ok:
            break;
        case QTextStream::ReadPastEnd:
            return true;
        case QTextStream::ReadCorruptData:
            throw localized_runtime_error(HERE(nfmt<1>("stream corrupted while parsing file '%1'") (filepath)));
    }
    return false;
}
Пример #12
0
bool K3b::CueFileWriter::save( QTextStream& t )
{
    t << "REM Cue file written by K3b " << k3bcore->version() << endl
      << endl;

    if( !m_cdText.isEmpty() ) {
        t << "PERFORMER \"" << m_cdText.performer() << "\"" << endl;
        t << "TITLE \"" << m_cdText.title() << "\"" << endl;
    }

    t << "FILE \"" << m_image << "\" " << m_dataType.toUpper() << endl;

    // the tracks
    int i = 0;
    for( K3b::Device::Toc::const_iterator it = m_toc.constBegin();
         it != m_toc.constEnd(); ++it ) {

        const K3b::Device::Track& track = *it;

        t << "  TRACK " << QString::number(i+1).rightJustified( 2, '0' ) << " AUDIO" << endl;

        if( m_cdText.count() > i && !m_cdText[i].isEmpty() ) {
            t << "    PERFORMER \"" << m_cdText[i].performer() << "\"" << endl;
            t << "    TITLE \"" << m_cdText[i].title() << "\"" << endl;
        }

        //
        // the pregap is part of the current track like in toc files
        // and not part of the last track as on the CD
        //
        if( i > 0 ) {
            --it;
            if( (*it).index0() > 0 )
                t << "    INDEX 00 " << ((*it).firstSector() + (*it).index0()).toString() << endl;
            ++it;
        }
        t << "    INDEX 01 " << track.firstSector().toString() << endl;
        // TODO: add additional indices

        i++;
    }

    return ( t.status() == QTextStream::Ok );
}
Пример #13
0
bool TextBuffer::save (const QString &filename)
{
  // codec must be set!
  Q_ASSERT (m_textCodec);

  /**
   * construct correct filter device and try to open
   */
  QIODevice *file = KFilterDev::deviceForFile (filename, m_mimeTypeForFilterDev, false);
  if (!file->open (QIODevice::WriteOnly)) {
    delete file;
    return false;
  }

  /**
   * construct stream + disable Unicode headers
   */
  QTextStream stream (file);
  stream.setCodec (QTextCodec::codecForName("UTF-16"));

  // set the correct codec
  stream.setCodec (m_textCodec);

  // generate byte order mark?
  stream.setGenerateByteOrderMark (generateByteOrderMark());

  // our loved eol string ;)
  QString eol = "\n"; //m_doc->config()->eolString ();
  if (endOfLineMode() == eolDos)
    eol = QString ("\r\n");
  else if (endOfLineMode() == eolMac)
    eol = QString ("\r");

  // just dump the lines out ;)
  for (int i = 0; i < m_lines; ++i)
  {
    // get line to save
    Kate::TextLine textline = line (i);

    // strip trailing spaces
    if (m_removeTrailingSpaces)
    {
      int lastChar = textline->lastChar();
      if (lastChar > -1)
      {
        stream << textline->text().left (lastChar+1);
      }
    }
    else // simple, dump the line
      stream << textline->text();

    // append correct end of line string
    if ((i+1) < m_lines)
      stream << eol;
  }

  // flush stream
  stream.flush ();

  // close and delete file
  file->close ();
  delete file;

#ifndef Q_OS_WIN
  // ensure that the file is written to disk
  // we crete new qfile, as the above might be wrapper around compression
  QFile syncFile (filename);
  syncFile.open (QIODevice::ReadOnly);

#ifdef HAVE_FDATASYNC
  fdatasync (syncFile.handle());
#else
  fsync (syncFile.handle());
#endif
#endif

  // did save work?
  bool ok = stream.status() == QTextStream::Ok;

  // remember this revision as last saved if we had success!
  if (ok)
    m_history.setLastSavedRevision ();

  // report CODEC + ERRORS
  kDebug (13020) << "Saved file " << filename << "with codec" << m_textCodec->name()
    << (ok ? "without" : "with") << "errors";

  // emit signal on success
  if (ok)
    emit saved (filename);

  // return success or not
  return ok;
}
/*!
    \internal
 */
void QWebSocketHandshakeRequest::readHandshake(QTextStream &textStream)
{
    m_isValid = false;
    clear();
    if (Q_UNLIKELY(textStream.status() != QTextStream::Ok))
        return;
    const QString requestLine = textStream.readLine();
    const QStringList tokens = requestLine.split(' ', QString::SkipEmptyParts);
    if (Q_UNLIKELY(tokens.length() < 3)) {
        m_isValid = false;
        clear();
        return;
    }
    const QString verb(tokens.at(0));
    const QString resourceName(tokens.at(1));
    const QString httpProtocol(tokens.at(2));
    bool conversionOk = false;
    const float httpVersion = httpProtocol.midRef(5).toFloat(&conversionOk);

    if (Q_UNLIKELY(!conversionOk)) {
        clear();
        m_isValid = false;
        return;
    }
    QString headerLine = textStream.readLine();
    m_headers.clear();
    while (!headerLine.isEmpty()) {
        const QStringList headerField = headerLine.split(QStringLiteral(": "),
                                                         QString::SkipEmptyParts);
        if (Q_UNLIKELY(headerField.length() < 2)) {
            clear();
            return;
        }
        m_headers.insertMulti(headerField.at(0).toLower(), headerField.at(1));
        headerLine = textStream.readLine();
    }

    const QString host = m_headers.value(QStringLiteral("host"), QString());
    m_requestUrl = QUrl::fromEncoded(resourceName.toLatin1());
    if (m_requestUrl.isRelative())
        m_requestUrl.setHost(host);
    if (m_requestUrl.scheme().isEmpty()) {
        const QString scheme =  isSecure() ? QStringLiteral("wss") : QStringLiteral("ws");
        m_requestUrl.setScheme(scheme);
    }

    const QStringList versionLines = m_headers.values(QStringLiteral("sec-websocket-version"));
    for (QStringList::const_iterator v = versionLines.begin(); v != versionLines.end(); ++v) {
        const QStringList versions = (*v).split(QStringLiteral(","), QString::SkipEmptyParts);
        for (QStringList::const_iterator i = versions.begin(); i != versions.end(); ++i) {
            bool ok = false;
            (void)(*i).toUInt(&ok);
            if (!ok) {
                clear();
                return;
            }
            const QWebSocketProtocol::Version ver =
                    QWebSocketProtocol::versionFromString((*i).trimmed());
            m_versions << ver;
        }
    }
    //sort in descending order
    std::sort(m_versions.begin(), m_versions.end(), std::greater<QWebSocketProtocol::Version>());
    m_key = m_headers.value(QStringLiteral("sec-websocket-key"), QString());
    //must contain "Upgrade", case-insensitive
    const QString upgrade = m_headers.value(QStringLiteral("upgrade"), QString());
    //must be equal to "websocket", case-insensitive
    const QString connection = m_headers.value(QStringLiteral("connection"), QString());
    const QStringList connectionLine = connection.split(QStringLiteral(","),
                                                        QString::SkipEmptyParts);
    QStringList connectionValues;
    for (QStringList::const_iterator c = connectionLine.begin(); c != connectionLine.end(); ++c)
        connectionValues << (*c).trimmed();

    //optional headers
    m_origin = m_headers.value(QStringLiteral("sec-websocket-origin"), QString());
    const QStringList protocolLines = m_headers.values(QStringLiteral("sec-websocket-protocol"));
    for (QStringList::const_iterator pl = protocolLines.begin(); pl != protocolLines.end(); ++pl) {
        QStringList protocols = (*pl).split(QStringLiteral(","), QString::SkipEmptyParts);
        for (QStringList::const_iterator p = protocols.begin(); p != protocols.end(); ++p)
            m_protocols << (*p).trimmed();
    }
    const QStringList extensionLines = m_headers.values(QStringLiteral("sec-websocket-extensions"));
    for (QStringList::const_iterator el = extensionLines.begin();
         el != extensionLines.end(); ++el) {
        QStringList extensions = (*el).split(QStringLiteral(","), QString::SkipEmptyParts);
        for (QStringList::const_iterator e = extensions.begin(); e != extensions.end(); ++e)
            m_extensions << (*e).trimmed();
    }

    //TODO: authentication field

    m_isValid = !(host.isEmpty() ||
                  resourceName.isEmpty() ||
                  m_versions.isEmpty() ||
                  m_key.isEmpty() ||
                  (verb != QStringLiteral("GET")) ||
                  (!conversionOk || (httpVersion < 1.1f)) ||
                  (upgrade.toLower() != QStringLiteral("websocket")) ||
                  (!connectionValues.contains(QStringLiteral("upgrade"), Qt::CaseInsensitive)));
    if (Q_UNLIKELY(!m_isValid))
        clear();
}
Пример #15
0
bool K3b::TocFileWriter::save( QTextStream& t )
{
    writeHeader(t);

    if( !m_cdText.isEmpty() )
        writeGlobalCdText(t);

    //
    // see if we have multiple sessions
    //
    int sessions = 1;
    for( K3b::Device::Toc::iterator it = m_toc.begin(); it != m_toc.end(); ++it ) {
        if( (*it).session() > 1 )
            sessions = (*it).session();
    }

    if( m_sessionToWrite > sessions )
        m_sessionToWrite = 1;

    //
    // We can only hide the first track if both the first and the second track are
    // audio tracks.
    // We also can only hide the first track in the first session.
    //
    bool hideFirstTrack = m_hideFirstTrack;
    if( m_toc.count() < 2 ||
            m_toc[0].type() != K3b::Device::Track::TYPE_AUDIO ||
            m_toc[1].type() != K3b::Device::Track::TYPE_AUDIO ||
            (sessions > 1 && m_sessionToWrite != 1 ) )
        hideFirstTrack = false;


    // the dataStart will be the offset in case we do not write the first session
    K3b::Msf dataStart;

    int trackIndex = 0;
    if( hideFirstTrack ) {
        const K3b::Device::Track& hiddenTrack = m_toc[0];
        const K3b::Device::Track& track = m_toc[1];

        t << "// Track number 1 (hidden) and track number 2 (as track 1)" << endl;
        t << "TRACK AUDIO" << endl;

        if( track.copyPermitted() )
            t << "COPY" << endl;
        else
            t << "NO COPY" << endl;

        if( track.preEmphasis() )
            t << "PRE_EMPHASIS" << endl;
        else
            t << "NO PRE_EMPHASIS" << endl;

        if( !m_cdText.isEmpty() )
            writeTrackCdText( m_cdText[0], t );

        // the "hidden" file will be used as pregap for the "first" track
        t << "AUDIOFILE ";
        writeDataSource( 0, t );
        if( readFromStdin() )
            t << hiddenTrack.firstSector().toString();
        else
            t << " 0";
        t << " " << hiddenTrack.length().toString() << endl;
        t << "START" << endl; // use the whole hidden file as pregap

        // now comes the "real" first track
        t << "AUDIOFILE ";
        writeDataSource( 1, t );
        if( readFromStdin() )
            t << track.firstSector().toString() << " ";
        else
            t << "0 ";
        // no index 0 for the last track. Or should we allow this???
        if( m_toc.count() == 2 )
            t << track.length().toString();
        else
            t << track.realAudioLength().toString();
        t << endl << endl;

        trackIndex+=2;
    }
    else {
        //
        // Seek to the first track to write.
        // In case we hid the first track above it was the first track anyway.
        //
        while( m_toc[trackIndex].session() < m_sessionToWrite &&
                m_toc[trackIndex].session() > 0 )
            ++trackIndex;

        dataStart = m_toc[trackIndex].firstSector();
    }

    kDebug() << "(K3b::TocFileWriter) using offset of: " << dataStart.toString();

    while( trackIndex < m_toc.count() ) {
        if( m_toc[trackIndex].session() == 0 || m_toc[trackIndex].session() == m_sessionToWrite )
            writeTrack( trackIndex, dataStart, t );
        trackIndex++;
    }

    return ( t.status() == QTextStream::Ok );
}
Пример #16
0
bool K3b::InfFileWriter::save( QTextStream& s )
{
    // now write the inf data
    // ----------------------
    // header
    s << "# Cdrecord-Inf-File written by K3b " << k3bcore->version()
      << ", " << QDateTime::currentDateTime().toString() << endl
      << "#" << endl;

    s << "ISRC=\t\t" << m_isrc << endl;
    s << "MCN=\t\t" << m_mcn << endl;

    // CD-Text
    s << "Albumperformer=\t" << "'" << m_albumPerformer << "'" << endl;
    s << "Albumtitle=\t" << "'" << m_albumTitle << "'" << endl;

    s << "Performer=\t" << "'" << m_trackPerformer << "'" << endl;
    s << "Songwriter=\t" << "'" << m_trackSongwriter << "'" << endl;
    s << "Composer=\t" << "'" << m_trackComposer << "'" << endl;
    s << "Arranger=\t" << "'" << m_trackArranger << "'" << endl;
    s << "Message=\t" << "'" << m_trackMessage << "'" << endl;

    s << "Tracktitle=\t" << "'" << m_trackTitle << "'" << endl;

    s << "Tracknumber=\t" << m_trackNumber << endl;

    // track start
    s << "Trackstart=\t" << m_trackStart.lba() << endl;

    // track length
    s << "# Tracklength: " << m_trackLength.toString() << endl;
    s << "Tracklength=\t" << m_trackLength.totalFrames() << ", 0" << endl;

    // pre-emphasis
    s << "Pre-emphasis=\t";
    if( m_preEmphasis )
        s << "yes";
    else
        s << "no";
    s << endl;

    // channels (always 2)
    s << "Channels=\t2" << endl;

    // copy-permitted
    // TODO: not sure about this!
    //       there are three options: yes, no, once
    //       but using "once" gives the same result as with cdrdao
    //       and that's important.
    s << "Copy_permitted=\t";
    if( m_copyPermitted )
        s << "yes";
    else
        s << "once";
    s << endl;

    // endianess - wav is little -> onthefly: big, with images: little
    s << "Endianess=\t";
    if( m_bigEndian )
        s << "big";
    else
        s << "little";
    s << endl;

    // write indices
    // the current tracks' data contains the pregap of the next track
    // if the pregap has length 0 we need no index 0
    if( m_indices.isEmpty() )
        s << "Index=\t\t0" << endl;
    else {
        for( int i = 0; i < m_indices.count(); ++i )
            s << "Index=\t\t" << m_indices[i] << endl;
    }

    s << "Index0=\t\t" << m_index0 << endl;

    return ( s.status() == QTextStream::Ok );
}