void AvarListModel::endFrameChanged(int end) { _endFrame = end; _maxColumns = (_endFrame-_startFrame)+1; //reset(); populateModel(); }
void AvarListModel::startFrameChanged(int start) { _startFrame = start; _maxColumns = (_endFrame-_startFrame)+1; //reset(); populateModel(); }
void WeekModel::timerEvent(QTimerEvent *event) { Q_UNUSED(event); if (QDateTime::currentDateTime().date().day() != m_today.date().day()) { populateModel(); } }
void QRelation::populateDictionary() { if (!isValid()) return; if (model == NULL) populateModel(); QSqlRecord record; QString indexColumn; QString displayColumn; for (int i=0; i < model->rowCount(); ++i) { record = model->record(i); indexColumn = rel.indexColumn(); if (m_parent->database().driver()->isIdentifierEscaped(indexColumn, QSqlDriver::FieldName)) indexColumn = m_parent->database().driver()->stripDelimiters(indexColumn, QSqlDriver::FieldName); displayColumn = rel.displayColumn(); if (m_parent->database().driver()->isIdentifierEscaped(displayColumn, QSqlDriver::FieldName)) displayColumn = m_parent->database().driver()->stripDelimiters(displayColumn, QSqlDriver::FieldName); dictionary[record.field(indexColumn).value().toString()] = record.field(displayColumn).value(); } m_dictInitialized = true; }
NoteModel *SqlNoteInterface::notesFor(const QString &text, int category) const { QSqlQuery query; if (text.isEmpty()) { if (category == NoteValues::NONE) { return populateModel(); } else { query.prepare("SELECT * FROM note WHERE category = :category"); query.bindValue(":category", category); return modelForQuery(query); } } else { if (category == NoteValues::NONE) { query.prepare("SELECT * FROM Note WHERE (name LIKE '%"+text+"%' or content LIKE '%"+text+"%')"); return modelForQuery(query); } else { query.prepare("SELECT * FROM Note WHERE (name LIKE '%"+text+"%' OR content LIKE '%"+text+"%') "+"AND category = :category"); query.bindValue(":category", category); return modelForQuery(query); } } }
AvarListModel::AvarListModel(const QList<int>& avars, int startFrame, int endFrame, QObject* parent) : QAbstractTableModel(parent), m_currentTime(0) { _startFrame = startFrame; _endFrame = endFrame; int i; foreach(i, m_avarRefs) DataManager::instance().releaseRef(i); m_avarRefs = avars; populateModel(); }
void QFacebookGraphConnectionMediaBase::requestDone(bool ok) { m_model.clear(); if (ok) { if(result().contains("data")) populateModel(); emit modelPopulated(); } else qDebug() << "Request failed"; }
void ArchiveItemModel::openArchive(QString filePath) { //TODO: make async; output status closeArchive(); if (_archive.openArchive(filePath)) { std::vector<ArchiveEntry> entries; bool success; _archive.readAllEntries(entries, success); _archive.syncArchive(); if (success) populateModel(entries); } }
SqlNoteInterface::SqlNoteInterface(QObject *parent): QObject(parent) { QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); QString dbPath = PathResolver::appLocalDataLocation() + "notes"; db.setDatabaseName(dbPath); if (!db.open()) { qFatal("Cannot open db"); return; } QSqlQuery query; query.exec("create table if not exists Note(id INTEGER PRIMARY KEY AUTOINCREMENT, name Text, content Text, category TINYINT, lastModificationDateTime DATETIME )"); populateModel(); }
void SimulationExperimentViewInformationParametersWidget::initialize(SimulationSupport::Simulation *pSimulation, bool pReloadingView) { // Keep track of the simulation mSimulation = pSimulation; // First clear ourselves, if needed if (mNeedClearing) { clear(); mNeedClearing = false; } // Check whether our model's VOI is among our model's parameters (i.e. it is // defined in the main CellML file) CellMLSupport::CellmlFileRuntime *runtime = pSimulation->runtime(); mVoiAccessible = runtime->parameters().contains(runtime->voi()); // Retranslate our core self, if needed // Note: part of reloading ourselves consists of finalising ourselves, which // means clearing all of our contents including our header labels. So, // we need to 'retranslate' them otherwise they will read "1", "2", // "3", etc. if (pReloadingView) { PropertyEditorWidget::retranslateUi(); } // Populate our property editor and context menu populateModel(runtime); populateContextMenu(runtime); // Reset our import information, if we are reloading ourselves if (pReloadingView) { mImportComponent = nullptr; } // Keep track of when some of the model's data has changed connect(pSimulation->data(), &SimulationSupport::SimulationData::updated, this, &SimulationExperimentViewInformationParametersWidget::updateParameters); }
void QRelation::populateDictionary() { if (!isValid()) return; if (model == NULL) populateModel(); QSqlRecord record; for (int i=0; i < model->rowCount(); ++i) { record = model->record(i); dictionary[record.field(rel.indexColumn()).value().toString()] = record.field(rel.displayColumn()).value(); } m_dictInitialized = true; }
void BrowseThread::run() { m_mutex.lock(); while (!m_bStopThread) { //Wait until the user has selected a folder m_locationUpdated.wait(&m_mutex); Trace trace("BrowseThread"); //Terminate thread if Mixxx closes if(m_bStopThread) { break; } // Populate the model populateModel(); } m_mutex.unlock(); }
Model::Model(QObject *parent) { armyMap[1] = tr("陈记臣"); armyMap[2] = tr("黄庆忠"); armyMap[3] = tr("张泽鹏"); armyMap[4] = tr("张惠康"); weaponTypeMap[1] = tr("男"); weaponTypeMap[2] = tr("女"); weaponTypeMap[3] = tr("充"); weaponTypeMap[4] = tr("基"); weaponTypeMap[5] = tr("伪"); weaponTypeMap[6] = tr("腐"); weaponTypeMap[7] = tr("宅"); weaponTypeMap[8] = tr("现"); populateModel(); }
void XmlEdit::performCompletion(const QString &completionPrefix) { populateModel(completionPrefix); if (completionPrefix != completer->completionPrefix()) { completer->setCompletionPrefix(completionPrefix); completer->popup()->setCurrentIndex( completer->completionModel()->index(0, 0)); } if (completer->completionCount() == 1) insertCompletion(completer->currentCompletion(), true); else { QRect rect = cursorRect(); rect.setWidth(completer->popup()->sizeHintForColumn(0) + completer->popup()->verticalScrollBar()-> sizeHint().width()); completer->complete(rect); } }
TimeZoneModel::TimeZoneModel(QObject *parent) : MAbstractItemModel(parent) { populateModel(); }
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(); }
LanguageModel::LanguageModel(QObject *parent) : MAbstractItemModel(parent) { populateModel(); }
void qjackctlInterfaceComboBox::showPopup (void) { populateModel(); QComboBox::showPopup(); }
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; }
/*! Called when activating the view */ void CntImageEditorView::activate( const CntViewParameters aArgs ) { mArgs = aArgs; mViewManager = &mEngine->viewManager(); mThumbnailManager = &mEngine->thumbnailManager(); connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this, SLOT(thumbnailReady(QPixmap, void*, int, int)) ); if (mView->navigationAction() != mSoftkey) mView->setNavigationAction(mSoftkey); HbMainWindow* window = mView->mainWindow(); if ( window ) { connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation))); setOrientation(window->orientation()); } if ( mArgs.contains(ESelectedContact)) { mContact = new QContact(mArgs.value(ESelectedContact).value<QContact>()); } if ( mArgs.contains(ESelectedGroupContact) && !mContact ) { mContact = new QContact(mArgs.value(ESelectedGroupContact).value<QContact>()); } QString myCard = mArgs.value( EMyCard ).toString(); QContactLocalId localId = mContact->localId(); QContactLocalId selfContactId = mEngine->contactManager(SYMBIAN_BACKEND).selfContactId(); bool isMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); if (isMyCard) { mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); } else if (mContact->type() == QContactType::TypeGroup) { mSaveManager = new CntSaveManager(CntSaveManager::EGroup); } else { mSaveManager = new CntSaveManager(); } // set the correct image if the contact already has an image set mImageLabel = static_cast<CntImageLabel*>(mDocumentLoader.findWidget(QString("cnt_image_label"))); mImageLabel->ungrabGesture(Qt::TapGesture); QList<QContactAvatar> details = mContact->details<QContactAvatar>(); if (details.count() > 0) { for (int i = 0;i < details.count();i++) { if (details.at(i).imageUrl().isValid()) { mAvatar = new QContactAvatar(details.at(i)); mThumbnailManager->getThumbnail(ThumbnailManager::ThumbnailLarge, mAvatar->imageUrl().toString()); break; } } } else { mAvatar = new QContactAvatar(); mRemoveImage->setEnabled(false); if (mContact->type() == QContactType::TypeGroup) { mImageLabel->setAvatarIcon(HbIcon("qtg_large_add_group_picture")); } } // set up the list mListView = static_cast<HbListView*>(mDocumentLoader.findWidget(QString("cnt_listview"))); connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(listViewActivated(const QModelIndex&))); HbFrameBackground frame; frame.setFrameGraphicsName("qtg_fr_list_normal"); frame.setFrameType(HbFrameDrawer::NinePieces); mListView->itemPrototypes().first()->setDefaultFrame(frame); mListView->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon); mListView->setUniformItemSizes(true); mModel = new QStandardItemModel(); populateModel(mModel); mListView->setModel(mModel); }