void IpodCopyTracksJob::trackProcessed( CopiedStatus status, Meta::TrackPtr srcTrack, Meta::TrackPtr destTrack ) { m_sourceTrackStatus.insert( status, srcTrack ); emit incrementProgress(); emit signalTrackProcessed( srcTrack, destTrack, status ); }
void APG::ConstraintSolver::run() { if ( !m_readyToRun ) { error() << "DANGER WILL ROBINSON! A ConstraintSolver (serial no:" << m_serialNumber << ") tried to run before its QueryMaker finished!"; m_abortRequested = true; return; } if ( m_domain.empty() ) { debug() << "The QueryMaker returned no tracks"; return; } else { debug() << "Domain has" << m_domain.size() << "tracks"; } debug() << "Running ConstraintSolver" << m_serialNumber; emit totalSteps( m_maxGenerations ); // GENETIC ALGORITHM LOOP Population population; quint32 generation = 0; Meta::TrackList* best = NULL; while ( !m_abortRequested && ( generation < m_maxGenerations ) ) { quint32 s = m_constraintTreeRoot->suggestPlaylistSize(); m_suggestedPlaylistSize = (s > 0) ? s : m_suggestedPlaylistSize; fill_population( population ); best = find_best( population ); if ( population.value( best ) < m_satisfactionThreshold ) { select_population( population, best ); mutate_population( population ); generation++; emit incrementProgress(); } else { break; } } debug() << "solution at" << (void*)(best); m_solvedPlaylist = best->mid( 0 ); m_finalSatisfaction = m_constraintTreeRoot->satisfaction( m_solvedPlaylist ); /* clean up */ Population::iterator it = population.begin(); while ( it != population.end() ) { delete it.key(); it = population.erase( it ); } emit endProgressOperation( this ); }
void MainWindow::sortFiles() { // Get list of files QList<QFileInfo> files; QModelIndex parentIndex = dirModel->index(dirModel->rootPath()); int fileRows = dirModel->rowCount(parentIndex); for(int row = 0; row < fileRows; ++row) { QModelIndex childIndex = dirModel->index(row, 0, parentIndex); QFileInfo info = dirModel->fileInfo(childIndex); files.append(info); } if(files.size() == 0) { return; } emit setFileCount(files.size() - 1); // Sort Files foreach(QFileInfo info, files) { emit setCurrentFile(info); QString destination = queryRules(info); if(!(destination == NULL)) { QFile originalFile(info.absoluteFilePath()); qDebug() << rootDirPath + "/" + destination + "/" + info.fileName(); bool copied = originalFile.copy(rootDirPath + "/" + destination + "/" + info.fileName()); if(!copied) { qDebug() << "WARNING: COPIED FAILED - " << info.fileName() << " -> " << destination; continue; emit incrementProgress(); } qDebug() << "FILE COPIED: " << info.fileName() << " -> " << destination; originalFile.remove(); } emit incrementProgress(); }
/** Launches the AHRS sensors calibration */ void ConfigAHRSWidget::launchAHRSCalibration() { m_ahrs->calibInstructions->setText("Estimating sensor variance..."); m_ahrs->ahrsCalibStart->setEnabled(false); UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration"))); UAVObjectField *field = obj->getField(QString("measure_var")); field->setValue("MEASURE"); obj->updated(); QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2())); m_ahrs->calibProgress->setRange(0,calibrationDelay); phaseCounter = 0; progressBarIndex = 0; connect(&progressBarTimer, SIGNAL(timeout()), this, SLOT(incrementProgress())); progressBarTimer.start(1000); }
void BrowserMessageArea::newProgressOperation( QObject *sender, const QString &text, int maximum, QObject *obj, const char *slot, Qt::ConnectionType type ) { ProgressBar *newBar = new ProgressBar( 0 ); newBar->setDescription( text ); newBar->setMaximum( maximum ); connect( sender, SIGNAL(destroyed( QObject * )), m_progressBar, SLOT(endProgressOperation( QObject * )) ); connect( sender, SIGNAL(endProgressOperation( QObject * )), m_progressBar, SLOT(endProgressOperation( QObject * )) ); connect( sender, SIGNAL(incrementProgress()), m_progressBar, SLOT(slotIncrementProgress()) ); connect( sender, SIGNAL(totalSteps( int )), newBar, SLOT(slotTotalSteps( int )) ); newBar->setAbortSlot( obj, slot, type ); m_progressBar->addProgressBar( newBar, sender ); m_progressBar->show(); m_busy = true; }
KFFWin_Flightplan::KFFWin_Flightplan( QWidget *parent ) : QWidget( parent ) { KIconLoader loader; QPixmap pixmap; QIcon icon; QRect rect; rect = QApplication::desktop()->screenGeometry(); if ( rect.width() >= 1280 ) { setMinimumWidth( 1280 ); } ui_widget.setupUi( this ); qRegisterMetaType<NavDataList>(); m_editing = false; pixmap = loader.loadIcon( "arrow-left", KIconLoader::Toolbar ); icon.addPixmap( pixmap ); ui_widget.kpushbutton_next->setIcon( icon ); pixmap = loader.loadIcon( "arrow-right", KIconLoader::Toolbar ); icon.addPixmap( pixmap ); ui_widget.kpushbutton_previous->setIcon( icon ); m_progress = 0; m_thread = new NavThread(); ui_widget.kpushbutton_previous->setEnabled( false ); ui_widget.kpushbutton_next->setEnabled( false ); connect( m_thread, SIGNAL( finished( NavDataList ) ), SLOT( loadFinished( NavDataList ) ) ); connect( m_thread, SIGNAL( progress() ), SLOT( incrementProgress() ) ); connect( ui_widget.pushbutton_search, SIGNAL( clicked() ), SLOT( search() ) ); connect( ui_widget.lineEdit_search, SIGNAL( returnPressed() ), SLOT( search() ) ); connect( ui_widget.pushbutton_add, SIGNAL( clicked() ), SLOT( add() ) ); connect( ui_widget.kpushbutton_next, SIGNAL( clicked() ), SLOT( next() ) ); connect( ui_widget.kpushbutton_previous, SIGNAL( clicked() ), SLOT( previous() ) ); connect( ui_widget.pushbutton_open, SIGNAL( clicked() ), SLOT( open() ) ); connect( ui_widget.pushbutton_save, SIGNAL( clicked() ), SLOT( save() ) ); ui_widget.treewidget_navaids->setContextMenuPolicy( Qt::CustomContextMenu ); connect( ui_widget.treewidget_navaids, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showFavoriteContextMenu( const QPoint & ) ) ); connect( ui_widget.treewidget_navaids, SIGNAL( itemActivated( QTreeWidgetItem*, int ) ), this, SLOT( itemActivated( QTreeWidgetItem*, int ) ) ); connect( ui_widget.toolButton_up, SIGNAL( clicked() ), SLOT( moveItemUp() ) ); connect( ui_widget.toolButton_down, SIGNAL( clicked() ), SLOT( moveItemDown() ) ); connect( ui_widget.treewidget_navaids, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), this, SLOT( saveSettings() ) ); }
void StatusBar::incrementProgress() { incrementProgress(sender()); }