Ejemplo n.º 1
0
void UploadOperation::start()
{
    //
    // Reset flags
    //

    m_gotoChild = false;
    m_gotoParent = false;

    // Notify listeners that operation have started
    notifyStart();

    // Get total size of files to upload and null bytes processed count
    m_totalBytesToCopy = getInputFilesSize();
    m_totalBytesCopied = 0;

    //
    // Send file list request to know filelist of remote destination directory.
    // Real file upload will start when reply for this request will be received
    //

    m_firstUpload = true;

    m_sender->sendFileListRequest(m_pathToTargetRoot.getString(),
                                  m_replyBuffer->isCompressionSupported());
}
Ejemplo n.º 2
0
void DownloadOperation::start()
{
  m_foldersToCalcSizeLeft = 0;

  m_totalBytesToCopy = 0;
  m_totalBytesCopied = 0;

  // Notify listeners that operation have started
  notifyStart();

  //
  // Try to calculate input files size.
  //
  // Then this state will be finished, we can
  // start files download.
  //
  // See decFoldersToCalcSizeCount, onDirSizeReply, onLastRequestFailed
  // methods.
  //

  tryCalcInputFilesSize();

  if (m_foldersToCalcSizeLeft == 0) {
    startDownload();
  }
}
void RemoteFilesDeleteOperation::start()
{
  // Notify listeners that operation have started
  notifyStart();

  // Remove first file in the list
  remove(false);
}
Ejemplo n.º 4
0
void Stopwatch::notifyStart(StopwatchItem& stopwatchItem, const std::string& option, const std::string& stopWatchName) {
	if (stopwatchItem.option != option || stopwatchItem.name != stopWatchName) {
		notifyStart(option, stopWatchName);
		return;
	}

	stopwatchItem.isValid = false;
	stopwatchItem.start   = getCurrentMicroTime();
	stopwatchItem.stop    = stopwatchItem.start;
}
Ejemplo n.º 5
0
bool Manager::start()
{
    if (mOpt.twoIsMaster){
        mLevel[0] = mLevel[1] = 3;
    } else {
        mLevel[0] = mLevel[1] = 2;
    }
    clearRound();
    notifyStart();
    notifyStartRound();
    mStatus = DealWait;
    return true;
}
Ejemplo n.º 6
0
void PUParticleSystem3D::startParticleSystem()
{
    stopParticleSystem();

    if (_state != State::RUNNING)
    {
        forceStopParticleSystem();
        if (_render)
            _render->notifyStart();

        for (auto &it : _observers){
            it->notifyStart();
        }

        for (auto& it : _emitters) {
            auto emitter = static_cast<PUEmitter*>(it);
            emitter->notifyStart();
        }

        for (auto& it : _affectors) {
            auto affector = static_cast<PUAffector*>(it);
            affector->notifyStart();
        }

        scheduleUpdate();
        _state = State::RUNNING;
        _latestPosition = getDerivedPosition(); // V1.3.1
    }

    for (auto iter : _children)
    {
        PUParticleSystem3D *system = dynamic_cast<PUParticleSystem3D *>(iter);
        if (system){
            system->_parentParticleSystem = this;
            system->startParticleSystem();
        }
    }
}
Ejemplo n.º 7
0
void DownloadOperation::start()
{
  m_foldersToCalcSizeLeft = 0;

  m_totalBytesToCopy = 0;
  m_totalBytesCopied = 0;

  notifyStart();

  tryCalcInputFilesSize();

  if (m_foldersToCalcSizeLeft == 0) {
    startDownload();
  }
}
Ejemplo n.º 8
0
void RemoteFileRenameOperation::start()
{
  StringStorage message;

  message.format(_T("Renaming remote file '%s' to '%s'"),
                 m_pathToSourceFile.getString(),
                 m_pathToTargetFile.getString());

  notifyInformation(message.getString());

  notifyStart();

  m_sender->sendMvFileRequest(m_pathToSourceFile.getString(),
                              m_pathToTargetFile.getString());
}
void RemoteFolderCreateOperation::start()
{
  // Logging
  StringStorage message;

  message.format(_T("Creating remote folder '%s'"),
                 m_pathToTargetFile.getString());

  notifyInformation(message.getString());

  // Nofity all that operation have started
  notifyStart();

  // Send mkdir request to server
  m_sender->sendMkDirRequest(m_pathToTargetFile.getString());
}
Ejemplo n.º 10
0
void FmBkupEnginePrivate::notifyStartInternal( int aTotalCount )
{
    iError = KErrNone;
    
    bool cancelable = false;
    switch( mProcess )
    {
        case FmBkupEngine::ProcessBackup:
            cancelable = true;
            break;
        case FmBkupEngine::ProcessRestore:
            cancelable = false;
            break;
        case FmBkupEngine::ProcessNone:
        default:
        Q_ASSERT( false );
    }
    emit notifyStart( cancelable, aTotalCount );
}
/*
 * Starts the operation.
 * \a isStopped flag the outside stop operation
 */
void FmOperationCopyOrMove::start( volatile bool *isStopped )
{
    mStop = isStopped; 
    mTotalSize   = 0;
    mCopiedOrMovedSize  = 0;
    mCurrentStep = 0;

    if ( mSourceList.empty() ) {
        emit notifyError( FmErrWrongParam, mErrString );    
        return ;
    }
	emit notifyPreparing( true );

    int numofFolders = 0;
    int numofFiles      = 0;

    int ret = FmFolderDetails::queryDetailOfContentList( mSourceList, numofFolders, 
        numofFiles, mTotalSize, mStop, true );
    if( ret != FmErrNone ) {
        emit notifyError( ret, mErrString );
        return;        
    }    
    if ( !targetHasEnoughSpace() ) {
        emit notifyError( FmErrDiskFull, mErrString );
        return;
        }    
    emit notifyStart( true, mTotalSteps );

    foreach( const QString& source, mSourceList ) {
        // formatPath, but do not append splash in the end
        // Otherwise could not get fileName in QFileInfo::fileName
        QString checkedSource( FmUtils::formatPath( source ) );
        QFileInfo fi( checkedSource );
        if( !fi.exists() ) {
            mErrString = checkedSource;   
            emit driveSpaceChanged();
            emit notifyError( FmErrSrcPathDoNotExist, mErrString );
            return;
        }
        QString newName;
        bool    isAcceptReplace = false;
        QFileInfo destFi( mTargetPath + fi.fileName() );

        // while for duplicated file/dir
        while( destFi.exists() ) {
            if( destFi.isFile() && destFi.absoluteFilePath().compare( fi.absoluteFilePath(), Qt::CaseInsensitive ) != 0 ) {
                emit askForReplace( destFi.absoluteFilePath(), fi.absoluteFilePath(), &isAcceptReplace );
                if( isAcceptReplace ) {
                    //delete src file
                    if( !QFile::remove( destFi.absoluteFilePath() ) ) {
                        mErrString = destFi.absoluteFilePath();
                        ret = FmErrCannotRemove;
                        break;
                    }
                    destFi.setFile( destFi.absoluteFilePath() );
                } else {
                    queryForRename( destFi.absoluteFilePath(), &newName );
                    if( newName.isEmpty() ) {
                        ret = FmErrCancel;
                        break;
                    }
                    QString targetName = mTargetPath + newName;
                    destFi.setFile( targetName );
                }
            } else{
                // destination is dir
                queryForRename( destFi.absoluteFilePath(), &newName );
                if( newName.isEmpty() ) {
                    ret = FmErrCancel;
                    break;
                }
                QString targetName = mTargetPath + newName;
                destFi.setFile( targetName );
            }
        }
        if( ret != FmErrNone ) {
            // refresh drive space no care if cancel, error or finished.
            // as filemanger cannot notify drive space changed
            // do not refresh path as QFileSystemModel will do auto-refresh
            emit driveSpaceChanged();
            emit notifyError( ret, mErrString );
            return;
        }
        ret = copyOrMove( checkedSource, mTargetPath, newName );
        if( ret != FmErrNone ) {
            emit driveSpaceChanged();
            emit notifyError( ret, mErrString );            
            return;
        }
    }    
Ejemplo n.º 12
0
void Stopwatch::notifyStart(const std::string& option, const std::string& stopWatchName) {
	notifyStart(getStopwatchReference(option, stopWatchName), option, stopWatchName);
}