bool UpdaterComponent::fileComplete(Update* update)
{
  Q_UNUSED(update);
  if (m_file->isReady() && (m_manifest->isReady() || !m_hasManifest))
  {
    QLOG_DEBUG() << "Both files downloaded";
    // create a file that shows that we are ready
    // to apply this update
    //
    QFile readyFile(UpdateManager::GetPath("_readyToApply", m_version, false));
    if (readyFile.open(QFile::WriteOnly))
    {
      readyFile.write("FOO");
      readyFile.close();
    }

    emit downloadComplete(m_version);

    delete m_file;
    delete m_manifest;

    m_file = NULL;
    m_manifest = NULL;

    return true;
  }

  if (update)
  {
    QLOG_DEBUG() << "File " << update->m_localPath << " download completed";
  }

  return false;
}
Example #2
0
 virtual void write(const PointViewPtr view) final
 {
     if (m_hashPos != std::string::npos)
         readyFile(generateFilename());
     writeView(view);
     if (m_hashPos != std::string::npos)
         doneFile();
 }
Example #3
0
 virtual void ready(PointTableRef table) final
 {
     readyTable(table);
     if (m_hashPos == std::string::npos)
         readyFile(generateFilename());
 }
Example #4
0
void writeToFile()
{
    quint64 pid = QCoreApplication::applicationPid();
    QFile createdFile(QString(SHMCREATED));
    int count = 0;
    if( createdFile.open(QIODevice::WriteOnly | QIODevice::Text) )
    {
        //        if(!file.setPermissions( QFile::WriteUser | QFile::ReadUser | QFile::ExeUser | QFile::ReadGroup | QFile::ExeGroup  | QFile::ReadOther | QFile::ExeOther))
        //        {
        //            qDebug() << "Could not set permissions";
        //        }
        QTextStream out(&createdFile);
        out << pid;
        createdFile.close();
    }
    else
    {
        qDebug() << "Could not create file: " << QString( SHMCREATED);
        return;
    }

//    QFile file( DIRNAME "/WriteTest.txt");

//    if( !file.open(QIODevice::WriteOnly | QIODevice::Text) )
//    {
//        qDebug() << "Could open file: " << file.fileName();
//        return;
//    }

//    QTextStream out3( &file);

    while( count < 500)
    {
        count++;

//        if( ( count % 80) == 1)
//            out3 << "\n" << count;
//        else
//            out3 << ".";

//        out3.flush();
        int i= 100000;
        double d=0;
        double c = 0;
        while(i>0)
            {
                i--;
                c= pow(i,2.0);
                d= c+d;
            }

    }
 //   file.close();
    QFile readyFile(QString(FNAME));

    if( readyFile.open(QIODevice::WriteOnly | QIODevice::Text) )
    {
        //        if(!file.setPermissions( QFile::WriteUser | QFile::ReadUser | QFile::ExeUser | QFile::ReadGroup | QFile::ExeGroup  | QFile::ReadOther | QFile::ExeOther))
        //        {
        //            qDebug() << "Could not set permissions";
        //        }
        QTextStream out2(&readyFile);
        out2 << "ready";
        readyFile.close();
    }
    else
    {
        qDebug() << "Could not create file: " << QString( FNAME );
    }
}