Exemplo n.º 1
0
void AppUninstaller::_backupFolderClearFinished()
{
    DLog("--- do backup");

    // step 2: do backup
    if(!QDir(this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath()).exists()) {
        WLog("Application is not installed - it's installed root path does not exists here: ") << this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath();

        // will emit success to allow the GUI to refresh as not-installed
        this->_currentUninstallFinishedWithSuccess();
        return;
    }
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Performing app backup"));

#if 0
    QString appIntalledDirPath = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath();
    Runnable_CopyDirectory *backupWorker = new Runnable_CopyDirectory(appIntalledDirPath, AppSpecificPathHelper::getTmp_UninstallBackupDirectoryPath(), true, PathHelper::SHM_UseAsFile, true);
    connect(backupWorker, SIGNAL(failedWithError(QString)), this, SLOT(_backupFailedWithError(QString)));
    connect(backupWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_backupFinished()));
    QThreadPool::globalInstance()->start(backupWorker);
#endif

    if( !PathHelper::renameFileOrFolder(this->getCurrentAppInstalledRootDirFileInfo(),
                                        this->getCurrentAppTargetBackupDirName()) )
    {
        this->_backupFailedWithError(tr("Cannot backup the app"));
    }
    else {
        this->_backupFinished();
    }
}
void StreamToFileManager::_bufferTransmitterFlush(QByteArray bufferedData)
{
    DLog("Buffer flush");
    StreamToFile *worker = new StreamToFile(_targetFile, bufferedData);
    connect(worker, SIGNAL(finishedWithSuccess()), this, SLOT(_chunkWrittenToFile()));
    connect(worker, SIGNAL(failedWithError(QString)), this, SLOT(_chunkWriteToFileFailedWithError(QString)));
//    QThreadPool::globalInstance()->start(worker);
    _backgroundWorkerQueue->addItemToQueue(worker);
}
Exemplo n.º 3
0
void AppUninstaller::_currentUninstallFinishedWithSuccess()
{
    ApplicationDescriptionModel appDescr = this->_uninstallQueue.dequeue();
    DLog(" -- Uninstall finished for item: ") << appDescr.getDynamicDescription_ReadOnly()->getAppId() << appDescr.getDynamicDescription_ReadOnly()->getAppName();
    Q_EMIT finishedWithSuccess(appDescr);

    _isInUninstallProcess = false;
    this->_tryToStartNextUninstallInQueue();
}
Exemplo n.º 4
0
void AppUninstaller::_checkWhetherAppRunning()
{
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Checking for running app"));

    qRegisterMetaType< QList<PlatformspecificRunningExecutableDataInterface*> >("QList<PlatformspecificRunningExecutableDataInterface*>");
    Runnable_CheckForRunningExecutable *runningExeCheckWorker = new Runnable_CheckForRunningExecutable(this->getCurrentAppInstalledRootDirFileInfo().absoluteFilePath());
    connect(runningExeCheckWorker, SIGNAL(finishedWithSuccess(QList<PlatformspecificRunningExecutableDataInterface*>)), this, SLOT(_checkWhetherAppRunningCheckResult(QList<PlatformspecificRunningExecutableDataInterface*>)));
    QThreadPool::globalInstance()->start(runningExeCheckWorker);
}
Exemplo n.º 5
0
// ---------------
// --- cleanup ---
void AppUninstaller::_startCleanUp()
{
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Performing final cleanups"));

    Runnable_DeleteDirectoryRecursively *removeWorker = new Runnable_DeleteDirectoryRecursively(this->getCurrentAppTargetBackupDirFileInfo().absoluteFilePath());
    connect(removeWorker, SIGNAL(failedWithError(QString)), this, SLOT(_cleanUpFailedWithError(QString)));
    connect(removeWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_cleanUpFinished()));
    QThreadPool::globalInstance()->start(removeWorker);
}
void ClangStaticAnalyzerRunner::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    if (exitStatus == QProcess::NormalExit) {
        if (exitCode == 0)
            emit finishedWithSuccess(actualLogFile());
        else
            emit finishedWithFailure(finishedWithBadExitCode(exitCode), processCommandlineAndOutput());
    } else { // == QProcess::CrashExit
        emit finishedWithFailure(finishedDueToCrash(), processCommandlineAndOutput());
    }
}
Exemplo n.º 7
0
void ClangToolRunner::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    if (exitStatus == QProcess::NormalExit) {
        if (exitCode == 0) {
            qCDebug(LOG).noquote() << "Output:\n" << Utils::SynchronousProcess::normalizeNewlines(
                                                        QString::fromLocal8Bit(m_processOutput));
            emit finishedWithSuccess(m_filePath);
        } else {
            emit finishedWithFailure(finishedWithBadExitCode(m_name, exitCode),
                                     processCommandlineAndOutput());
        }
    } else { // == QProcess::CrashExit
        emit finishedWithFailure(finishedDueToCrash(m_name), processCommandlineAndOutput());
    }
}
Exemplo n.º 8
0
void AppUninstaller::_startRemoveApp()
{
    DLog("--- start remove");
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Removing the app"));
#if 0
    // step 3: remove the application
    Runnable_DeleteDirectoryRecursively *removeWorker = new Runnable_DeleteDirectoryRecursively(this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath());
    connect(removeWorker, SIGNAL(failedWithError(QString)), this, SLOT(_appRemoveFailedWithError(QString)));
    connect(removeWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_appRemoveFinished()));
    QThreadPool::globalInstance()->start(removeWorker);
#endif
    // the app is already 'removed' -> it's folder is renamed as backup, so all we need to do is remove the renamed backup
    this->_appRemoveFinished();
}
Exemplo n.º 9
0
void AppUninstaller::_startBackup()
{
    DLog("--- clear backup");
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Preparing app backup"));

#if 0
    // step 1: clear the backup folder
    Runnable_DeleteDirectoryRecursively *backupCleanerWorker = new Runnable_DeleteDirectoryRecursively(AppSpecificPathHelper::getTmp_UninstallBackupDirectoryPath());
    connect(backupCleanerWorker, SIGNAL(failedWithError(QString)), this, SLOT(_backupFolderClearFailedWithError(QString)));
    connect(backupCleanerWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_backupFolderCleareFinished()));
    QThreadPool::globalInstance()->start(backupCleanerWorker);
#endif
    // step 1: clear the backup folder
    QString backupTargetFolderPath = PathHelper::combineAndCleanPathes(
                AppSpecificPathHelper::getCurrentUserLocalAppFolderPath(),
                this->getCurrentAppTargetBackupDirName());
    DLog("Backup target folder path: ") << backupTargetFolderPath;

    Runnable_DeleteDirectoryRecursively *backupCleanerWorker = new Runnable_DeleteDirectoryRecursively(backupTargetFolderPath);
    connect(backupCleanerWorker, SIGNAL(failedWithError(QString)), this, SLOT(_backupFolderClearFailedWithError(QString)));
    connect(backupCleanerWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_backupFolderClearFinished()));
    QThreadPool::globalInstance()->start(backupCleanerWorker);
}
Exemplo n.º 10
0
// ---------------------
// --- revert backup ---
void AppUninstaller::_startRevertBackup()
{
#if 0
    QString appIntalledDirPath = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath();
    Runnable_CopyDirectory *backupWorker = new Runnable_CopyDirectory(AppSpecificPathHelper::getTmp_UninstallBackupDirectoryPath(), appIntalledDirPath, true, PathHelper::SHM_UseAsFile, false);
    connect(backupWorker, SIGNAL(failedWithError(QString)), this, SLOT(_revertBackupFailedWithError(QString)));
    connect(backupWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_revertBackupFinished()));
    QThreadPool::globalInstance()->start(backupWorker);
#endif

    if( !PathHelper::renameFileOrFolder(this->getCurrentAppTargetBackupDirFileInfo(),
                                        this->getCurrentAppInstalledRootDirName()) )
    {
        this->_revertBackupFailedWithError(tr("Cannot revert the backup"));
    }
    else {
        this->_revertBackupFinished();
    }
}