Ejemplo n.º 1
0
TreeModel::TreeModel( QObject* parent )
    : QAbstractItemModel( parent )
    , m_rootItem( new TreeModelItem( downloadjob_ptr(), 0, this ) )
{
    addJobs( DownloadManager::instance()->jobs() );

    connect( DownloadManager::instance(), SIGNAL( jobAdded( downloadjob_ptr ) ), SLOT( onJobAdded( downloadjob_ptr ) ) );
}
Ejemplo n.º 2
0
void FractalGenerator::handleState()
{
    if ( m_activeJobs > 0 || !m_enabled || m_pendingResolution.isEmpty() )
        return;

    if ( !m_regions.isEmpty() && !m_pending ) {
        addJobs();
        return;
    }

    if ( m_preview && m_buffer && m_regions.isEmpty() && m_resolution == m_pendingResolution ) {
        delete[] m_previewBuffer;
        m_previewBuffer = m_buffer;
        m_buffer = NULL;

        postUpdate( FullUpdate );
    }

    if ( m_pending ) {
        if ( m_buffer && m_bufferSize != m_pendingBufferSize ) {
            delete[] m_buffer;
            m_buffer = NULL;
        }

        m_type = m_pendingType;
        m_position = m_pendingPosition;
        m_settings = m_pendingSettings;
        m_resolution = m_pendingResolution;
        m_bufferSize = m_pendingBufferSize;
        m_pending = false;

        if ( !m_buffer )
            m_buffer = new double[ m_bufferSize.width() * m_bufferSize.height() ];

        createFunctor();

        if ( !m_preview )
            postUpdate( InitialUpdate );

        m_validRegions.clear();

        splitRegions();
        addJobs();
    }
}
Ejemplo n.º 3
0
/************************************************
 *
 * ***********************************************/
void Project::addJob(Job job)
{
    addJobs(JobList() << job);
}