Beispiel #1
0
void GvCore::slotConfigChanged()
{
    if (!GwenviewConfig::historyEnabled()) {
        clearModel(recentFoldersModel());
        clearModel(recentUrlsModel());
    }
    d->setupPalettes();
}
Beispiel #2
0
/**
  * Forces an update of the attributes table.
  */
void AttributesModel::update(bool forceUpdate) {
    // get the selected node
    TreeNode *selNodeP = m_windowP->getSelectedNode();
    if (!selNodeP) {
        clearModel();
        reset();
        return;
    }

    // get the associated filter
    FilterTreeNode *filterP = NULL;
    if (selNodeP->isFilter())
        filterP = (FilterTreeNode *)selNodeP;
    else
        filterP = (FilterTreeNode *)selNodeP->parent();

    // we don't know the filter, can't display attributes
    if (!filterP) {
        clearModel();
        reset();
        return;
    }

    // we didn't move to a different filter and nothing changed, return the last values
    if (filterP == m_lastSelectedFilterP &&
        !forceUpdate) {
        reset();
        return;
    }

    // keep the ref of the last selected filter
    m_lastSelectedFilterP = filterP;

    // there's a row per attribute
    m_attributes.clear();
    m_attributePlugins.clear();
    m_plugins = filterP->getPlugins();
    for (int i = 0; i < m_plugins.count(); i++) {
        QString plugin = m_plugins[i];
        QStringList attributes = filterP->getPluginAttributes(plugin);
        for (int j = 0; j < attributes.count(); j++)
            m_attributePlugins.append(plugin);
        m_attributes += attributes;
    }

    m_rows = m_attributes.count();

    // force an update
    reset();
}
Beispiel #3
0
bool RawModel::loadFiffData(QFile& qFile)
{
    beginResetModel();
    clearModel();

    MatrixXd t_data,t_times; //type is later on (when append to m_data) casted into MatrixXdR (Row-Major)

    m_pfiffIO = QSharedPointer<FiffIO>(new FiffIO(qFile));
    if(!m_pfiffIO->m_qlistRaw.empty()) {
        m_iAbsFiffCursor = m_pfiffIO->m_qlistRaw[0]->first_samp; //Set cursor somewhere into fiff file [in samples]
        m_bStartReached = true;
        if(!m_pfiffIO->m_qlistRaw[0]->read_raw_segment(t_data, t_times, m_iAbsFiffCursor, m_iAbsFiffCursor+m_iWindowSize-1))
            return false;
        m_bFileloaded = true;
    }
    else {
        qDebug("RawModel: ERROR! Data set does not contain any fiff data!");
        endResetModel();
        m_bFileloaded = false;
        return false;
    }

    //set loaded fiff data
    m_data.append(t_data);
    m_procData.append(MatrixXdR::Zero(t_data.rows(),t_data.cols()));
    m_times.append(t_times);

    loadFiffInfos();
    genStdFilterOps();

    endResetModel();
    return true;
}
Beispiel #4
0
    void unrealise ()
    {
        if (++m_unrealised == 1) {
            m_observers.unrealise();

            clearModel();
        }
    }
Beispiel #5
0
	void MCBModule<Settings>::updateModel() const {
		clearModel();
		if (solverState() == SAT || (solverState() != UNSAT && appliedPreprocessing())) {
			getBackendsModel();
			mModel.update(mAssignments);
			mAssignments.clear();
		}
	}
Beispiel #6
0
void Screen::clearModels()
{
	ModelList::iterator it;

	for (it=_mdlList.begin();it!=_mdlList.end();it++)
	{
		clearModel((char*)(*it).first.c_str());
	}
}
Beispiel #7
0
  void unrealise()
  {
    if(++m_unrealised == 1)
    {
      m_observers.unrealise();

      //globalOutputStream() << "ModelResource::unrealise: " << m_path.c_str() << m_name.c_str() << "\n";
      clearModel();
    }
  }
Beispiel #8
0
 void CubeLIAModule<Settings>::updateModel() const
 {
     if( !mModelComputed && !mModelUpdated )
     {
         clearModel();
         if( solverState() != UNSAT )
         {
             getBackendsModel();
         }
         mModelUpdated = true;
     }
 }
void ExportDirectoryDialog::fillData()
{
    QString dirStr = ui->dirPathLineEdit->text();
    if(dirStr.isEmpty() || dirStr.trimmed().isEmpty())
        return;
    clearModel();
    QFileInfoList fileInfoList = Utils::listAllFileInDir(dirStr,
                                                         m_conf->getFileFilter(Configuration::MarkdownFile),
                                                         QDir::NoFilter,
                                                         ui->suddirCheckBox->isChecked()
                                                         );
    foreach (QFileInfo fi, fileInfoList) {
        addFile(fi.filePath());
    }
Beispiel #10
0
void PlaylistModel::receiveNewTrackList(QList<MpdTrack *>* tracks)
{
    QList<MpdTrack*> *tmpPointer = mEntries;
    emit clearModel();

    beginResetModel();
    mEntries = tracks;
    endResetModel();

    if ( mPlaybackState != MPD_STOP ) {
        setPlaying(mTrackNo,true);
    }
    if ( tmpPointer != 0 ) {
//       qDeleteAll(*tmpPointer);
        QList<MpdTrack*>::Iterator it;
        for ( it = tmpPointer->begin(); it != tmpPointer->end() ; ++it ) {
            (*it)->deleteLater();
        }
       delete(tmpPointer);
    }
}
void FavoriteApplicationsModel ::readSettings()
{
    if (!m_readSettings)
        return;

    clearModel();

    m_desktopFiles = m_readSettings->value("favorite-applications").toStringList();
    if ( m_desktopFiles.count()==0 )
    {
        oobeInit();
    }
    else
        m_popularityRating = m_readSettings->value("favorite-applications-ratings").toHash();

    for (QStringList::const_iterator i = m_desktopFiles.begin(); i != m_desktopFiles.end(); i++)
    {
        m_favorites << new Desktop(*i);
    }

    delayedReset();
}
ExportDirectoryDialog::ExportDirectoryDialog(QWidget *parent, const QString &dirPath) :
    QDialog(parent, Qt::WindowTitleHint|Qt::WindowSystemMenuHint),
    ui(new Ui::ExportDirectoryDialog)
{
    ui->setupUi(this);
    webView = new QWebView;
    timer = new QTimer(this);
    timer->setSingleShot(true);
    if(!dirPath.isEmpty()){
        ui->dirPathLineEdit->setText(dirPath);
        ui->browerPushButton->setEnabled(false);
    }
    ui->dirPathLineEdit->setReadOnly(true);
    ui->seperateHtmlRadioButton->setChecked(true);
    ui->seperateCssAndHtmlcheckBox->setEnabled(false);
    ui->keepDirCheckBox->setChecked(true);
    ui->exportPathWidget->setHidden(true);
    m_model = new QStandardItemModel(this);
    clearModel();
    ui->filesTreeView->setModel(m_model);
    ui->filesTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_conf = Configuration::getInstance();

    connect(ui->browerPushButton, SIGNAL(clicked()), this, SLOT(browerSourceDirSlot()));
    connect(ui->upPushButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(ui->downPushButton, SIGNAL(clicked()), this, SLOT(moveDown()));
    connect(ui->removePushButton, SIGNAL(clicked()), this, SLOT(removeOne()));
    connect(ui->suddirCheckBox, SIGNAL(clicked()), this, SLOT(fillData()));
    connect(ui->seperatePDFRadioButton, SIGNAL(toggled(bool)), ui->seperateCssAndHtmlcheckBox, SLOT(setDisabled(bool)));
    connect(ui->singlePDFRadioButton, SIGNAL(toggled(bool)), ui->seperateCssAndHtmlcheckBox, SLOT(setDisabled(bool)));
    connect(ui->keepDirCheckBox, SIGNAL(toggled(bool)), ui->exportPathWidget, SLOT(setHidden(bool)));
    connect(ui->exportPushButton, SIGNAL(clicked()), this, SLOT(exportBtnSlot()));
    connect(ui->exportPathBrowerPushButton, SIGNAL(clicked()), this, SLOT(exportPathBrowerSlot()));
    connect(this, SIGNAL(exportFinish()), this, SLOT(exportFinishSlot()));
    connect(this, SIGNAL(exportNext()), this, SLOT(exportOneByOne()));
}
void SatelliteModel::setRunning(bool isActive)
{
    if (!source && !demo)
        return;

    if (!m_componentCompleted) {
        m_runningRequested = isActive;
        return;
    }

    if (m_running == isActive)
        return;

    m_running = isActive;

    if (m_running) {
        clearModel();
        if (demo)
            timer->start(2000);
        else if (isSingleRequest())
            source->requestUpdate(10000);
        else
            source->startUpdates();

        if (demo)
            singleRequestServed = false;
    } else {
        if (demo)
            timer->stop();
        else if (!isSingleRequest())
            source->stopUpdates();
    }


    Q_EMIT runningChanged();
}
Beispiel #14
0
void BrowseThread::populateModel() {
    m_path_mutex.lock();
    MDir thisPath = m_path;
    BrowseTableModel* thisModelObserver = m_model_observer;
    m_path_mutex.unlock();

    // Refresh the name filters in case we loaded new SoundSource plugins.
    QStringList nameFilters(SoundSourceProxy::getSupportedFileNamePatterns());

    QDirIterator fileIt(thisPath.dir().absolutePath(), nameFilters,
                        QDir::Files | QDir::NoDotAndDotDot);

    // remove all rows
    // This is a blocking operation
    // see signal/slot connection in BrowseTableModel
    emit(clearModel(thisModelObserver));

    QList< QList<QStandardItem*> > rows;

    int row = 0;
    // Iterate over the files
    while (fileIt.hasNext()) {
        // If a user quickly jumps through the folders
        // the current task becomes "dirty"
        m_path_mutex.lock();
        MDir newPath = m_path;
        m_path_mutex.unlock();

        if (thisPath.dir() != newPath.dir()) {
            qDebug() << "Abort populateModel()";
            return populateModel();
        }

        QList<QStandardItem*> row_data;

        QStandardItem* item = new QStandardItem("0");
        item->setData("0", Qt::UserRole);
        row_data.insert(COLUMN_PREVIEW, item);

        const QString filepath = fileIt.next();
        {
            const TrackPointer pTrack =
                    SoundSourceProxy::importTemporaryTrack(
                            filepath,
                            thisPath.token());

            item = new QStandardItem(pTrack->getFileName());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_FILENAME, item);

            item = new QStandardItem(pTrack->getArtist());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_ARTIST, item);

            item = new QStandardItem(pTrack->getTitle());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_TITLE, item);

            item = new QStandardItem(pTrack->getAlbum());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_ALBUM, item);

            item = new QStandardItem(pTrack->getAlbumArtist());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_ALBUMARTIST, item);

            item = new QStandardItem(pTrack->getTrackNumber());
            item->setToolTip(item->text());
            item->setData(item->text().toInt(), Qt::UserRole);
            row_data.insert(COLUMN_TRACK_NUMBER, item);

            const QString year(pTrack->getYear());
            item = new YearItem(year);
            item->setToolTip(year);
            // The year column is sorted according to the numeric calendar year
            item->setData(mixxx::TrackMetadata::parseCalendarYear(year), Qt::UserRole);
            row_data.insert(COLUMN_YEAR, item);

            item = new QStandardItem(pTrack->getGenre());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_GENRE, item);

            item = new QStandardItem(pTrack->getComposer());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_COMPOSER, item);

            item = new QStandardItem(pTrack->getGrouping());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_GROUPING, item);

            item = new QStandardItem(pTrack->getComment());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_COMMENT, item);

            QString duration = pTrack->getDurationText(mixxx::Duration::Precision::SECONDS);
            item = new QStandardItem(duration);
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_DURATION, item);

            item = new QStandardItem(pTrack->getBpmText());
            item->setToolTip(item->text());
            item->setData(pTrack->getBpm(), Qt::UserRole);
            row_data.insert(COLUMN_BPM, item);

            item = new QStandardItem(pTrack->getKeyText());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_KEY, item);

            item = new QStandardItem(pTrack->getType());
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_TYPE, item);

            item = new QStandardItem(pTrack->getBitrateText());
            item->setToolTip(item->text());
            item->setData(pTrack->getBitrate(), Qt::UserRole);
            row_data.insert(COLUMN_BITRATE, item);

            QString location = pTrack->getLocation();
            QString nativeLocation = QDir::toNativeSeparators(location);
            item = new QStandardItem(nativeLocation);
            item->setToolTip(nativeLocation);
            item->setData(location, Qt::UserRole);
            row_data.insert(COLUMN_NATIVELOCATION, item);

            QDateTime modifiedTime = pTrack->getFileModifiedTime().toLocalTime();
            item = new QStandardItem(modifiedTime.toString(Qt::DefaultLocaleShortDate));
            item->setToolTip(item->text());
            item->setData(modifiedTime, Qt::UserRole);
            row_data.insert(COLUMN_FILE_MODIFIED_TIME, item);

            QDateTime creationTime = pTrack->getFileCreationTime().toLocalTime();
            item = new QStandardItem(creationTime.toString(Qt::DefaultLocaleShortDate));
            item->setToolTip(item->text());
            item->setData(creationTime, Qt::UserRole);
            row_data.insert(COLUMN_FILE_CREATION_TIME, item);

            const mixxx::ReplayGain replayGain(pTrack->getReplayGain());
            item = new QStandardItem(
                    mixxx::ReplayGain::ratioToString(replayGain.getRatio()));
            item->setToolTip(item->text());
            item->setData(item->text(), Qt::UserRole);
            row_data.insert(COLUMN_REPLAYGAIN, item);
        } // implicitly release track pointer and unlock cache

        rows.append(row_data);
        ++row;
        // If 10 tracks have been analyzed, send it to GUI
        // Will limit GUI freezing
        if (row % 10 == 0) {
            // this is a blocking operation
            emit(rowsAppended(rows, thisModelObserver));
            qDebug() << "Append " << rows.count() << " from " << filepath;
            rows.clear();
        }
        // Sleep additionally for 10ms which prevents us from GUI freezes
        msleep(20);
    }
    emit(rowsAppended(rows, thisModelObserver));
    qDebug() << "Append last " << rows.count();
}
Beispiel #15
0
DrawingManager::~DrawingManager(){
    
    clearModel();
    deleteShapes();
}
Beispiel #16
0
static int configure( Tcl_Interp *interp, ComboParams *para, 
      GnoclOption options[] )
{
   int          setToFirst = 0;
   GtkTreeModel *model = gtk_combo_box_get_model( para->comboBox );

   gnoclAttacheOptCmdAndVar( 
         &options[onChangedIdx], &para->onChanged, 
         &options[variableIdx], &para->variable, 
         "changed", getSigObj( para->comboBox ), 
         G_CALLBACK( changedFunc ), interp, traceFunc, para );

   if( options[itemsIdx].status == GNOCL_STATUS_CHANGED ) 
   {
      int     k, no;
      Tcl_Obj *items = options[itemsIdx].val.obj;

      if( options[itemValueIdx].status == GNOCL_STATUS_CHANGED ) 
      {
         Tcl_SetResult( interp, 
               "Either -items or -itemValueList may be given, but not both.", 
               TCL_STATIC );
         return TCL_ERROR;
      }
      
      if( Tcl_ListObjLength( interp, items, &no ) != TCL_OK )
      {
         Tcl_SetResult( interp, "items must be proper list", 
               TCL_STATIC );
         return TCL_ERROR;
      }

      clearModel( para->comboBox, model );
      for( k = 0; k < no; ++k )
      {
         Tcl_Obj *tp;
         if( Tcl_ListObjIndex( interp, items, k, &tp ) != TCL_OK )
            return TCL_ERROR;
         addItem( model, Tcl_GetString( tp ), Tcl_GetString( tp ) );
      }
      setToFirst = 1;
   }

   if( options[itemValueIdx].status == GNOCL_STATUS_CHANGED ) 
   {
      int     k, no;
      Tcl_Obj *items = options[itemValueIdx].val.obj;

      if( Tcl_ListObjLength( interp, items, &no ) != TCL_OK )
      {
         Tcl_SetResult( interp, "itemValueList must be proper list", 
               TCL_STATIC );
         return TCL_ERROR;
      }

      clearModel( para->comboBox, model );
      for( k = 0; k < no; ++k )
      {
         Tcl_Obj *tp, *txt, *val;
         if( Tcl_ListObjIndex( interp, items, k, &tp ) != TCL_OK )
            return TCL_ERROR;
         if( Tcl_ListObjIndex( interp, tp, 0, &txt ) != TCL_OK 
               || Tcl_ListObjIndex( interp, tp, 1, &val ) != TCL_OK )
         {
            return TCL_ERROR;
         }
         addItem( model, Tcl_GetString( val ) , Tcl_GetString( txt ) );
      }
      setToFirst = 1;
   }

   if( options[valueIdx].status == GNOCL_STATUS_CHANGED ) 
   {
      const char *val = Tcl_GetString( options[valueIdx].val.obj );
      int n = setState( para, val );
      if( n < 0 )
      {
         Tcl_AppendResult( interp, "Invalid value for option \"-value\" \"", 
               Tcl_GetString( options[valueIdx].val.obj ), "\"", NULL );
         return TCL_ERROR;
      }
      setVariable( para, val );
      setToFirst = 0;
   } 
   else if( options[variableIdx].status == GNOCL_STATUS_CHANGED 
         && para->variable != NULL ) 
   {
      const char *val = Tcl_GetVar2( para->interp, para->variable, 
            NULL, TCL_GLOBAL_ONLY );
      if( val != NULL )        
      {
         setState( para, val );
         setToFirst = 0;
      }
      else
         setToFirst = 1;
   }

   if( setToFirst )
   {
      GtkTreeIter iter;
      if( gtk_tree_model_get_iter_first( model, &iter ) )
      {
         const char *val;
         gtk_tree_model_get( model, &iter, VALUE_COLUMN, &val, -1 );
         setState( para, val );
         setVariable( para, val );
      }
   }

   return TCL_OK;
}
void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running)
{
    if (!d->m_componentCompleted) {
        d->m_runningRequested = running;
        return;
    }

    if (d->m_running == running)
        return;

    d->m_running = running;

    if (!running) {
        if (d->m_deviceAgent)
            d->m_deviceAgent->stop();
        if (d->m_serviceAgent)
            d->m_serviceAgent->stop();
    } else {
        clearModel();
        d->m_error = NoError;
        if (d->m_discoveryMode == DeviceDiscovery) {
            if (!d->m_deviceAgent) {
                d->m_deviceAgent = new QBluetoothDeviceDiscoveryAgent(this);
                connect(d->m_deviceAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
                connect(d->m_deviceAgent, SIGNAL(finished()), this, SLOT(finishedDiscovery()));
                connect(d->m_deviceAgent, SIGNAL(canceled()), this, SLOT(finishedDiscovery()));
                connect(d->m_deviceAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(errorDeviceDiscovery(QBluetoothDeviceDiscoveryAgent::Error)));
            }
            d->m_deviceAgent->start();
        } else {
            if (!d->m_serviceAgent) {
                d->m_serviceAgent = new QBluetoothServiceDiscoveryAgent(this);
                connect(d->m_serviceAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), this, SLOT(serviceDiscovered(QBluetoothServiceInfo)));
                connect(d->m_serviceAgent, SIGNAL(finished()), this, SLOT(finishedDiscovery()));
                connect(d->m_serviceAgent, SIGNAL(canceled()), this, SLOT(finishedDiscovery()));
                connect(d->m_serviceAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(errorDiscovery(QBluetoothServiceDiscoveryAgent::Error)));
            }

            d->m_serviceAgent->setRemoteAddress(QBluetoothAddress(d->m_remoteAddress));
            d->m_serviceAgent->clear();

            if (!d->m_uuid.isEmpty())
                d->m_serviceAgent->setUuidFilter(QBluetoothUuid(d->m_uuid));

            if (discoveryMode() == FullServiceDiscovery)  {
                //qDebug() << "Full Discovery";
                d->m_serviceAgent->start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
            } else {
                //qDebug() << "Minimal Discovery";
                d->m_serviceAgent->start(QBluetoothServiceDiscoveryAgent::MinimalDiscovery);
            }

            // we could not start service discovery
            if (!d->m_serviceAgent->isActive()) {
                d->m_running = false;
                errorDiscovery(d->m_serviceAgent->error());
                return;
            }
        }
    }

    emit runningChanged();
}
Beispiel #18
0
 Answer CubeLIAModule<Settings>::checkCore()
 {
     #ifdef DEBUG_CUBELIAMODULE
     print();
     #endif
     Answer ans;
     if( !rReceivedFormula().isRealConstraintConjunction() )
     {
         #ifdef DEBUG_CUBELIAMODULE
         std::cout << "Call internal LRAModule:" << std::endl;
         mLRA.print();
         #endif
         mLRA.clearLemmas();
         mLRAFormula->updateProperties();
         ans = mLRA.check( false, mFullCheck, mMinimizingCheck );
         switch( ans )
         {
             case SAT:
             {
                 clearModel();
                 // Get the model of mLRA
                 mLRA.updateModel();
                 const Model& relaxedModel = mLRA.model();
                 auto iter = mRealToIntVarMap.begin();
                 for( auto& ass : relaxedModel )
                 {
                     assert( iter != mRealToIntVarMap.end() );
                     // Round the result to the next integer
                     mModel.emplace_hint( mModel.end(), iter->second, carl::round( ass.second.asRational() ) );
                     ++iter;
                 }
                 // Check if the rounded model satisfies the received formula
                 bool receivedFormulaSatisfied = true;
                 for( const FormulaWithOrigins& fwo : rReceivedFormula() )
                 {
                     unsigned res = satisfies( mModel, fwo.formula() );
                     switch( res )
                     {
                         case 0:
                         case 2:
                             receivedFormulaSatisfied = false;
                         default:
                             break;
                     }
                     if( !receivedFormulaSatisfied )
                         break;
                 }
                 // If we found a model, we know that the formula is satisfiable, otherwise, we have to call the backends on the received formula
                 if( receivedFormulaSatisfied )
                 {
                     mModelUpdated = true;
                     return SAT;
                 }
                 clearModel();
                 break;
             }
             case UNSAT:
             {
                 if( Settings::exclude_unsatisfiable_cube_space )
                 {
                     // Exclude the space for which mLRA has detected unsatisfiability
                     for( auto& infsubset : mLRA.infeasibleSubsets() )
                     {
                         FormulasT formulas;
                         for( auto& formula : infsubset )
                             formulas.push_back( formula.negated() );
                         addLemma( FormulaT( carl::FormulaType::OR, formulas ) );
                     }
                 }
                 break;
             }
             default:
                 assert( false );
         }
     }
     #ifdef DEBUG_CUBELIAMODULE
     std::cout << "Call Backends:" << std::endl;
     #endif
     // Run backends on received formula
     ans = runBackends();
     if( ans == UNSAT )
         getInfeasibleSubsets();
     else if( ans == SAT )
         mModelUpdated = false;
     return ans;
 }
Beispiel #19
0
void BrowseThread::populateModel() {
    m_path_mutex.lock();
    QString thisPath = m_path;
    BrowseTableModel* thisModelObserver = m_model_observer;
    m_path_mutex.unlock();

    // Refresh the name filters in case we loaded new SoundSource plugins.
    QStringList nameFilters(SoundSourceProxy::supportedFileExtensionsString().split(" "));

    QDirIterator fileIt(thisPath, nameFilters, QDir::Files | QDir::NoDotAndDotDot);

    // remove all rows
    // This is a blocking operation
    // see signal/slot connection in BrowseTableModel
    emit(clearModel(thisModelObserver));

    QList< QList<QStandardItem*> > rows;

    int row = 0;
    // Iterate over the files
    while (fileIt.hasNext()) {
        // If a user quickly jumps through the folders
        // the current task becomes "dirty"
        m_path_mutex.lock();
        QString newPath = m_path;
        m_path_mutex.unlock();

        if(thisPath != newPath) {
            qDebug() << "Abort populateModel()";
            return populateModel();
        }

        QString filepath = fileIt.next();
        TrackInfoObject tio(filepath);
        QList<QStandardItem*> row_data;

        QStandardItem* item = new QStandardItem(tio.getFilename());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_FILENAME, item);

        item = new QStandardItem(tio.getArtist());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_ARTIST, item);

        item = new QStandardItem(tio.getTitle());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_TITLE, item);

        item = new QStandardItem(tio.getAlbum());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_ALBUM, item);

        item = new QStandardItem(tio.getAlbumArtist());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_ALBUMARTIST, item);

        item = new QStandardItem(tio.getTrackNumber());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_TRACK_NUMBER, item);

        item = new QStandardItem(tio.getYear());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_YEAR, item);

        item = new QStandardItem(tio.getGenre());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_GENRE, item);

        item = new QStandardItem(tio.getComposer());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_COMPOSER, item);

        item = new QStandardItem(tio.getGrouping());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_GROUPING, item);

        item = new QStandardItem(tio.getComment());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_COMMENT, item);

        QString duration = Time::formatSeconds(qVariantValue<int>(
                tio.getDuration()), false);
        item = new QStandardItem(duration);
        item->setToolTip(item->text());
        row_data.insert(COLUMN_DURATION, item);

        item = new QStandardItem(tio.getBpmStr());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_BPM, item);

        item = new QStandardItem(tio.getKeyText());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_KEY, item);

        item = new QStandardItem(tio.getType());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_TYPE, item);

        item = new QStandardItem(tio.getBitrateStr());
        item->setToolTip(item->text());
        row_data.insert(COLUMN_BITRATE, item);

        item = new QStandardItem(filepath);
        item->setToolTip(item->text());
        row_data.insert(COLUMN_LOCATION, item);

        rows.append(row_data);
        ++row;
        // If 10 tracks have been analyzed, send it to GUI
        // Will limit GUI freezing
        if(row % 10 == 0){
            // this is a blocking operation
            emit(rowsAppended(rows, thisModelObserver));
            //qDebug() << "Append " << rows.count() << " from " << filepath;
            rows.clear();
        }
        // Sleep additionally for 10ms which prevents us from GUI freezes
        msleep(20);
    }
    emit(rowsAppended(rows, thisModelObserver));
    //qDebug() << "Append last " << rows.count() << " from " << thisPath;
}
// Set the model, this also resets the camera
void AnimationPreview::setModelNode(const scene::INodePtr& node)
{
	// Remove the old model from the scene, if any
	clearModel();

	// Ensure that this is an MD5 model node
	model::ModelNodePtr model = Node_getModel(node);
	
	if (!model)
	{
		rError() << "AnimationPreview::setModelNode: node is not a model." << std::endl;
		stopPlayback();
		return;
	}

	// greebo: Call getScene() to trigger a scene setup if necessary
	getScene();

	try
	{
		dynamic_cast<const md5::IMD5Model&>(model->getIModel());
	}
	catch (std::bad_cast&)
	{
		rError() << "AnimationPreview::setModelNode: modelnode doesn't contain an MD5 model." << std::endl;
		stopPlayback();
		return;
	}

	_model = node;

	// Set the animation to play
	dynamic_cast<md5::IMD5Model&>(model->getIModel()).setAnim(_anim);

	// AddChildNode also tells the model which renderentity it is attached to
	_entity->addChildNode(_model);

	// Reset preview time
	stopPlayback();

	if (_model != NULL)
	{
		// Reset the rotation to the default one
		_rotation = Matrix4::getRotation(Vector3(0,-1,0), Vector3(0,-0.3f,1));
		_rotation.multiplyBy(Matrix4::getRotation(Vector3(0,1,0), Vector3(1,-1,0)));
		
		// Use AABB to adjust camera distance
		const AABB& bounds = _model->localAABB();

		if (bounds.isValid())
		{
			_camDist = -5.0f * static_cast<float>(bounds.getRadius());
		}
		else
		{
			// Bounds not valid, fall back to default
			_camDist = -40.0f;
		}

		// Start playback when switching particles
		startPlayback();
	}

	// Redraw
	queueDraw();
}