예제 #1
0
void DownloadManager::downloadRequested(const QNetworkRequest& request) {
    std::cout << "DownloadManager::DownloadRequested()\n";
    QString src = request.url().toString();
    QString dest = request.attribute(QNetworkRequest::User, "~").toString();

    QFile* fileDestination = new QFile(dest);
    fileDestination->open(QIODevice::ReadWrite);
    QNetworkReply* reply = mNetworkAccess.get(request);
    reply->setReadBufferSize(0);
    mActiveDownloads.insert(reply, fileDestination);

    connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
    connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
    connect(reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));

    DownloadData* data = new DownloadData();
    data->mRemotePath = src;
    data->mLocalPath = dest;

    connect(reply, SIGNAL(finished()), data, SLOT(finished()));

    connect(reply, SIGNAL(downloadProgress(qint64, qint64)), data, SLOT(catchProgress(qint64, qint64)));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), data, SIGNAL(error(QNetworkReply::NetworkError)));
    connect(data, SIGNAL(stopMe()), this, SLOT(stopDownload()));
    connect(data, SIGNAL(removeMe()), this, SLOT(removeDownload()));
    //connect(data, SIGNAL(reloadMe()), this, SLOT(reloadDownload()));

    emit downloadStarted(data);
    emit controller_showSystemTrayMessage("", "Download Started: " + data->localName());
    mModel.addDownload(data);
    mDownloads.insert(data, reply);
}
예제 #2
0
FutureProgress *ProgressView::addTask(const QFuture<void> &future, const QString &title,
                                      const QString &type,
                                      ProgressManager::ProgressFlags flags)
{
    removeOldTasks(type);
    if (m_taskList.size() == 3)
        removeOneOldTask();
    FutureProgress *progress = new FutureProgress(this);
    progress->setTitle(title);
    progress->setFuture(future);

    m_layout->insertWidget(0, progress);
    m_taskList.append(progress);
    progress->setType(type);
    if (flags.testFlag(ProgressManager::KeepOnFinish))
    {
        progress->setKeepOnFinish(FutureProgress::KeepOnFinishTillUserInteraction);
    }
    else
    {
        progress->setKeepOnFinish(FutureProgress::HideOnFinish);
    }
    connect(progress, SIGNAL(removeMe()), this, SLOT(slotRemoveTask()));
    return progress;
}
bool QNetworkProtocol::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: processNextOperation((QNetworkOperation*)static_QUType_ptr.get(_o+1)); break;
    case 1: startOps(); break;
    case 2: emitNewChildren((const QUrlInfo&)*((const QUrlInfo*)static_QUType_ptr.get(_o+1)),(QNetworkOperation*)static_QUType_ptr.get(_o+2)); break;
    case 3: removeMe(); break;
    default:
	return QObject::qt_invoke( _id, _o );
    }
    return TRUE;
}
예제 #4
0
	void FileSharingWidget::stopUploading()
	{
		assert(isState(State::PlainFile_Uploading) ||
			   isState(State::ImageFile_Uploading));
		assert(!FsInfo_->GetUploadingProcessId().isEmpty());
		assert(FsInfo_->HasLocalPath());

		setState(State::Deleted);

		Ui::GetDispatcher()->abortSharedFileUploading(
			ContactUin_,
			FsInfo_->GetLocalPath(),
			FsInfo_->GetUploadingProcessId()
		);

		emit removeMe();

		BytesTransferred_ = 0;
        Ui::GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::filesharing_cancel);
	}
예제 #5
0
QNetworkProtocol::QNetworkProtocol()
    : QObject()
{
    d = new QNetworkProtocolPrivate( this );

    connect( d->opStartTimer, SIGNAL( timeout() ),
	     this, SLOT( startOps() ) );
    connect( d->removeTimer, SIGNAL( timeout() ),
	     this, SLOT( removeMe() ) );

    if ( url() ) {
	connect( this, SIGNAL( data( const QByteArray &, QNetworkOperation * ) ),
		 url(), SIGNAL( data( const QByteArray &, QNetworkOperation * ) ) );
	connect( this, SIGNAL( finished( QNetworkOperation * ) ),
		 url(), SIGNAL( finished( QNetworkOperation * ) ) );
	connect( this, SIGNAL( start( QNetworkOperation * ) ),
		 url(), SIGNAL( start( QNetworkOperation * ) ) );
	connect( this, SIGNAL( newChildren( const QValueList<QUrlInfo> &, QNetworkOperation * ) ),
		 url(), SIGNAL( newChildren( const QValueList<QUrlInfo> &, QNetworkOperation * ) ) );
	connect( this, SIGNAL( newChildren( const QValueList<QUrlInfo> &, QNetworkOperation * ) ),
		 url(), SLOT( addEntry( const QValueList<QUrlInfo> & ) ) );
	connect( this, SIGNAL( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ),
		 url(), SIGNAL( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ) );
	connect( this, SIGNAL( removed( QNetworkOperation * ) ),
		 url(), SIGNAL( removed( QNetworkOperation * ) ) );
	connect( this, SIGNAL( itemChanged( QNetworkOperation * ) ),
		 url(), SIGNAL( itemChanged( QNetworkOperation * ) ) );
	connect( this, SIGNAL( dataTransferProgress( int, int, QNetworkOperation * ) ),
		 url(), SIGNAL( dataTransferProgress( int, int, QNetworkOperation * ) ) );
	connect( this, SIGNAL( connectionStateChanged( int, const QString & ) ),
		 url(), SIGNAL( connectionStateChanged( int, const QString & ) ) );
    }

    connect( this, SIGNAL( finished( QNetworkOperation * ) ),
	     this, SLOT( processNextOperation( QNetworkOperation * ) ) );
    connect( this, SIGNAL( newChild( const QUrlInfo &, QNetworkOperation * ) ),
	     this, SLOT( emitNewChildren( const QUrlInfo &, QNetworkOperation * ) ) );

}
예제 #6
0
void FutureProgressPrivate::fadeAway()
{
    m_isFading = true;

    QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
    opacityEffect->setOpacity(1.);
    m_q->setGraphicsEffect(opacityEffect);

    QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
    QPropertyAnimation *animation = new QPropertyAnimation(opacityEffect, "opacity");
    animation->setDuration(Utils::StyleHelper::progressFadeAnimationDuration);
    animation->setEndValue(0.);
    group->addAnimation(animation);
    animation = new QPropertyAnimation(m_q, "maximumHeight");
    animation->setDuration(120);
    animation->setEasingCurve(QEasingCurve::InCurve);
    animation->setStartValue(m_q->sizeHint().height());
    animation->setEndValue(0.0);
    group->addAnimation(animation);

    connect(group, SIGNAL(finished()), m_q, SIGNAL(removeMe()));
    group->start(QAbstractAnimation::DeleteWhenStopped);
    emit m_q->fadeStarted();
}
예제 #7
0
파일: node.cpp 프로젝트: EmmaEdv/TND004
//Remove the key from the tree having as root this node
//Return true, if a node storing key was found and deleted
//Otherwise, return false -- there is no node storing key
//isRight==false: this node is left child of parent
//isRight==true: this node is right child of parent
bool Node::remove(string key, Node* parent, bool isRight)
{
    //if key is smaller than the value
    if(key < value.first){
        //check if the node storing key has a left child, if so continue
        if(!l_thread)
            return left->remove(key, this, false);
        else{
            return false;
        }
    }
    // if the key is larger than the value
    else if(key > value.first){
        //check if the node storing key has a right child, if so continue
        if(!r_thread)
            return right->remove(key, this, true);
        else{
            return false;
        }
    }
    //if the key is found
    else if(key == value.first){
        //check if the node storing key has any children,
        //if so replace root with the largest value of the left subtree and remove the leaf
        if(!r_thread && !l_thread){
            value = left->findMax()->value;
            return left->remove(value.first, this, false);
        }
        //else remove the node
        else{
            removeMe(parent,isRight);
            return true;
        }
    }
    return false;
}
예제 #8
0
파일: HsWidget.cpp 프로젝트: jamecc/Notee
void CHsWidget::emitRemoveMe()
{
    emit removeMe(this);
}
void DlgSetRDRPropertyByExpressionEditor::on_btnDelete_clicked()
{
    emit removeMe(this);
}
예제 #10
0
void Playlist::load()
{
    m_bLoadingState = true;
    int lastIndex = 0;

    setModelHeaders();

    QString fName = m_Settings->appPath();
    fName += QString::number(m_Hash);

    if(QFile::exists(fName)) {
        QSettings sfile(fName, QSettings::IniFormat);

        // Playlist data: library id/name, etc.
        sfile.beginGroup("Playlist");

        switch(m_listType) {
            case PlaylistWidget::Search:
                m_sSearch = sfile.value("strSearch").toString();

                m_Parser->setSearchStr(m_sSearch);
                m_Parser->setOffset(sfile.value("offset").toInt());
                m_Parser->setMore(sfile.value("more").toBool());
                m_Parser->setReqType(0);

                m_listWidget->setSearchStr(m_sSearch);
            break;
            case PlaylistWidget::AudioLib:
            setLibId(sfile.value("libraryId").toString(), "0");
                m_LibraryName = sfile.value("libraryName").toString();
                m_listWidget->setLibraryName(m_LibraryName);

                m_Parser->setReqType(1);
            break;
            case PlaylistWidget::Suggestions:
                m_Parser->setOffset(sfile.value("offset").toInt());
                m_Parser->setMore(sfile.value("more").toBool());
                m_Parser->setReqType(2);
            break;
            case PlaylistWidget::DbSearch:
                m_sSearch = sfile.value("strSearch").toString();

                m_listWidget->setSearchStr(m_sSearch);
            break;
        }
        lastIndex = sfile.value("last_track").toInt();

        sfile.endGroup();

        // Tracks data
        int size = sfile.beginReadArray("Tracks");
        for(int i = 0; i < size; i++) {
            sfile.setArrayIndex(i);

            Track *t = new Track(this);

            t->setArtist(sfile.value("artist").toString());
            t->setTitle(sfile.value("title").toString());
            t->setAlbum(sfile.value("album").toString());
            t->setUrl(sfile.value("url").toString());
            t->setDuration(sfile.value("duration").toString());
            t->setLenght(sfile.value("lenght").toInt());
            t->setAid(sfile.value("aid").toString());
            t->setOid(sfile.value("oid").toString());
            t->setHash(sfile.value("hash").toString());
            t->setDelHash(sfile.value("delHash").toString());
            t->setBitrate(sfile.value("bitrate").toInt());
            t->setMetaArtist(sfile.value("metaArtist").toString());
            t->setMetaTitle(sfile.value("metaTitle").toString());
            t->setMetaAlbum(sfile.value("metaAlbum").toString());
            t->setMetaLoaded(sfile.value("meta").toBool());

            addTrack(t);
            connect(t, SIGNAL(removeMe()), SLOT(onTrackSelfRemove()));

        }

        //fixme
        if(lastIndex < 0)
            lastIndex = 0;

        if(!m_tList.isEmpty()) {
            if(m_tList.size() > 0 && m_tList.size() >= lastIndex)
                m_LastTrack = m_tList.at(lastIndex);
            else
                m_LastTrack = m_tList.first();
        } else {
            m_LastTrack = 0;
        }

            sfile.endArray();
    }

    m_bLoadingState = false;

    m_listWidget->setActiveIndex(m_ProxyModel->index(lastIndex, 0));

}
// ParticleSystem2D
//---------------------------------------------------------------------------
ParticleSystem2D::~ParticleSystem2D()
{
	removeMe();

} // end ParticleSystem2D
// ------------------------------------------------------------------------------------------------
// CNSmlDataModBase::StripAllNotOnPartnerListL
// Strips all data from entity that is not supported by remote server.
// ------------------------------------------------------------------------------------------------
void CNSmlDataModBase::StripAllNotOnPartnerListL( CVersitParser* aEntity, TBool& aModified, TBool aParamLevelCheck ) const
	{
    _DBG_FILE("CNSmlDataModBase::StripAllNotOnPartnerListL(): begin");
    TInt remotepropertycount = iRemoteStoreFormat->MimeFormat( iUsedRemoteMimeType ).PropertyCount();
    if( iRemoteStoreFormat->MimeFormat( iUsedRemoteMimeType ).PropertyCount() )
        {
        
        // Check correct Data Sync protocol
        TInt value( EDataSyncNotRunning );
        TSmlProtocolVersion usedSyncProtocol( ESmlVersion1_2 );
        TInt error = RProperty::Get( KPSUidDataSynchronizationInternalKeys,
                                     KDataSyncStatus,
                                     value );
        if ( error == KErrNone &&
             value == EDataSyncRunning )
            {
            usedSyncProtocol = ESmlVersion1_1_2;
            }

        TBool wasModified( EFalse );

        CArrayPtr<CParserProperty>* allProps = aEntity->ArrayOfProperties( EFalse );
        for( TInt i = 0; i < allProps->Count(); ) // Variable i is not increased here because size of count might be changes during loop
            {
            const CParserProperty& ownProperty = *allProps->At( i );
             
            TBool removeMe( ETrue );
            
            for( TInt i2 = 0; i2 < iRemoteStoreFormat->MimeFormat( iUsedRemoteMimeType ).PropertyCount(); i2++ )
                {
                const CSmlDataProperty& remoteProperty = iRemoteStoreFormat->MimeFormat( iUsedRemoteMimeType ).Property( i2 );
                TPtrC8 remotename = remoteProperty.Field().Name().DesC();
                if( !ownProperty.Name().Compare( remoteProperty.Field().Name().DesC() ) )
                    {
                    TInt remoteparamcount = remoteProperty.ParamCount();
                    if( remoteProperty.ParamCount() > 0 && aParamLevelCheck )
                        {
                        if ( usedSyncProtocol == ESmlVersion1_1_2 )
                            {
                            const CParserProperty* p = allProps->At( i );
                            TInt entityParamCount = (( CNSmlProperty* )p)->ParamCount();
                            if( entityParamCount > 0)
                            {
                            for( TInt i3 = 0; i3 < remoteProperty.ParamCount(); i3++ )
                                {
                                TPtrC8 remoteparamname = remoteProperty.Param( i3 ).Field().Name().DesC();
                                if( ownProperty.Param( remoteProperty.Param( i3 ).Field().Name().DesC() ) )
                                    {
                                    removeMe = EFalse;
                                    }
                                }                           
                            }
                            else
                            {
                                removeMe = EFalse;
                            }
                            }
                        else // ESmlVersion1_2
                            {
                            CArrayPtr<CParserParam>* ownerparamarray = ownProperty.ParamArray();
                            if(ownerparamarray != NULL)
                                {
                                for(TInt ownerparam = 0; ownerparam < ownerparamarray->Count(); ownerparam++)
                                    {
									removeMe = ETrue;
                                    const CParserParam& ownParam = *ownerparamarray->At( ownerparam );
                                     TPtrC8 ownparamname = ownParam.Name();
                                     TPtrC8 ownparamvalue = ownParam.Value();
                                     if(ownparamvalue == _L8(""))
                                        {
                                         for(TInt remoteparam = 0; remoteparam < remoteProperty.ParamCount(); remoteparam++)
                                            {
                                            TDesC8 remoteparamname = remoteProperty.Param( remoteparam ).Field().Name().DesC();
                                            const CSmlDataField& field = remoteProperty.Param( remoteparam ).Field();
											if( field.EnumValueCount() > 0)
												{
												for( TInt rmtenumcount = 0; rmtenumcount < field.EnumValueCount(); rmtenumcount++ )
													{
													TPtrC8 rmtenumvalue = field.EnumValue( rmtenumcount ).DesC();
													if( rmtenumvalue.Compare(ownparamname)== 0 )
														{
														removeMe = EFalse;
														break;
														}
													} 
												}
											else
												{
												removeMe = EFalse;
												break;
												}											
                                            }
                                        }
                                     else
                                        {
										//Handling when the device supports VersitTokenType as "Encoding"    
										if(ownparamname == KVersitTokenENCODING)
											{
											removeMe = EFalse;
											}
										else
											{
	                                         for(TInt remoteparam = 0; remoteparam < remoteProperty.ParamCount(); remoteparam++)
	                                            {
	                                            TDesC8 remoteparamname = remoteProperty.Param( remoteparam ).Field().Name().DesC();
	                                            if(ownparamname.Compare(remoteProperty.Param( remoteparam ).Field().Name().DesC()) == 0)
	                                                {
	                                                const CSmlDataField& field = remoteProperty.Param( remoteparam ).Field();
													if( field.EnumValueCount() > 0)
														{
		                                                for( TInt rmtenumcount = 0; rmtenumcount < field.EnumValueCount(); rmtenumcount++ )
		                                                    {
		                                                     TPtrC8 rmtenumvalue = field.EnumValue( rmtenumcount ).DesC();
		                                                     if( rmtenumvalue.Compare(ownparamvalue)== 0 )
		                                                         {
		                                                         removeMe = EFalse;
																 break;
		                                                         }  
		                                                    }
														}
													else
														{
														removeMe = EFalse;
														break;
														}
	                                                }
												}
											}                                 
                                        }
                                        if( removeMe )
                                        {
                                        	break;
                                        }	
                                    } 
                                }
                            else
                                {
                                removeMe = EFalse;
                                }
                            }
                        }
                    else
                        {
                        removeMe = EFalse;
                        }

                    if( !removeMe )
                        {
                        break;
                        }
                    }
                }
            if( removeMe )
                {
                #ifdef __NSML_DEBUG__
                    TPtrC8 pn( ownProperty.Name() );
                    DBG_ARGS8(_S8("CNSmlDataModBase::StripAllNotOnPartnerListL(): Dropping %S"), &pn);
                #endif // __NSML_DEBUG__
                delete allProps->At( i );
                allProps->Delete( i );
                wasModified = ETrue;
                aModified = ETrue;
                }
            else
                {
                #ifdef __NSML_DEBUG__
                    TPtrC8 pn( ownProperty.Name() );
                    DBG_ARGS8(_S8("CNSmlDataModBase::StripAllNotOnPartnerListL(): NOT dropping %S"), &pn);
                #endif // __NSML_DEBUG__
                i++;
                }
            }
        // can't use aModified as that may have been set earlier!
        if( wasModified )
            {
            allProps->Compress();
            }
        }
    _DBG_FILE("CNSmlDataModBase::StripAllNotOnPartnerListL(): end");
    }
예제 #13
0
void ZoneClock::removeTimeout()
{
  emit removeMe(this);
}
예제 #14
0
void DataExplorer::on_pushButton_clicked()
{
	emit(removeMe(this));
}