void KNMusicCategoryModel::onCoverImageUpdate(const QString &categoryText, const QString &imageKey, const QPixmap &image) { //Check if it need to be add to blank item. if(categoryText.isEmpty()) { return; } //Search the category text. QModelIndexList results= match(index(1,0), Qt::DisplayRole, categoryText, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive); //This result should never be empty. if(results.isEmpty()) { //Are you kidding me? return; } //Check is the result index cover image has a key. //If it contains a key, then do nothing. QModelIndex resultIndex=results.first(); if(data(resultIndex, CategoryArtworkKeyRole).isNull()) { setAlbumArt(resultIndex, imageKey, QIcon(image)); } }
void KNMusicCategoryModel::changeAlbumArt(const QModelIndex &target, const QString &artworkKey, const QIcon &artwork) { //Set the album art first. setAlbumArt(target, artworkKey, artwork); //Emit updated signal. emit categoryAlbumArtUpdate(target); }
int AlbumArtProvider::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: AlbumArtSaved((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break; case 1: setAlbumArt((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break; default: ; } _id -= 2; } return _id; }
QmlView::QmlView(QUrl source, QWidget *parent, MafwRegistryAdapter *mafwRegistry ) : QMainWindow(parent), ui(new Ui::QmlView), mafwRegistry(mafwRegistry), mafwRenderer(mafwRegistry->renderer()) { ui->setupUi(this); ui->declarativeView->setSource(source); ui->declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_Maemo5StackedWindow); setAttribute(Qt::WA_Maemo5NonComposited); QGLWidget *glWidget = new QGLWidget(this); ui->declarativeView->setViewport(glWidget); positionTimer = new QTimer(this); positionTimer->setInterval(1000); fmtx = new FMTXInterface(this); Rotator *rotator = Rotator::acquire(); savedPolicy = rotator->policy(); rotator->setPolicy(Rotator::Landscape); rootObject = dynamic_cast<QObject*>(ui->declarativeView->rootObject()); rootObject->setParent(this); connect(rootObject, SIGNAL(quitButtonClicked()), this, SLOT(close())); connect(rootObject, SIGNAL(prevButtonClicked()), mafwRenderer, SLOT(previous())); connect(rootObject, SIGNAL(playButtonClicked()), this, SLOT(onPlayClicked())); connect(rootObject, SIGNAL(nextButtonClicked()), mafwRenderer, SLOT(next())); connect(rootObject, SIGNAL(fmtxButtonClicked()), this, SLOT(onFmtxClicked())); connect(rootObject, SIGNAL(sliderValueChanged(int)), this, SLOT(onSliderValueChanged(int))); connect(rootObject, SIGNAL(playlistItemSelected(int)), this, SLOT(onPlaylistItemChanged(int))); connect(this, SIGNAL(titleChanged(QVariant)), rootObject, SLOT(setSongTitle(QVariant))); connect(this, SIGNAL(albumChanged(QVariant)), rootObject, SLOT(setSongAlbum(QVariant))); connect(this, SIGNAL(artistChanged(QVariant)), rootObject, SLOT(setSongArtist(QVariant))); connect(this, SIGNAL(albumArtChanged(QVariant)), rootObject, SLOT(setAlbumArt(QVariant))); connect(this, SIGNAL(durationTextChanged(QVariant)), rootObject, SLOT(setPosition(QVariant))); connect(this, SIGNAL(positionChanged(QVariant)), rootObject, SLOT(setSliderValue(QVariant))); connect(this, SIGNAL(durationChanged(QVariant)), rootObject, SLOT(setSliderMaximum(QVariant))); connect(this, SIGNAL(stateIconChanged(QVariant)), rootObject, SLOT(setPlayButtonIcon(QVariant))); connect(this, SIGNAL(rowChanged(QVariant)), rootObject, SLOT(onRowChanged(QVariant))); connect(this, SIGNAL(fmtxStateChanged(QVariant)), rootObject, SLOT(onFmtxStateChanged(QVariant))); connect(this, SIGNAL(playlistItemAppended(QVariant,QVariant,QVariant)), rootObject, SLOT(appendPlaylistItem(QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemInserted(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(insertPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemSet(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(setPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemRemoved(QVariant)), rootObject, SLOT(removePlaylistItem(QVariant))); connect(this, SIGNAL(playlistCleared()), rootObject, SLOT(clearPlaylist())); connect(mafwRenderer, SIGNAL(stateChanged(MafwPlayState)), this, SLOT(onStateChanged(MafwPlayState))); connect(mafwRenderer, SIGNAL(positionReceived(int,QString)), this, SLOT(onPositionChanged(int))); connect(mafwRenderer, SIGNAL(statusReceived(MafwPlaylist*,uint,MafwPlayState,QString,QString)), this, SLOT(onStatusReceived(MafwPlaylist*,uint,MafwPlayState))); connect(positionTimer, SIGNAL(timeout()), mafwRenderer, SLOT(getPosition())); connect(fmtx, SIGNAL(propertyChanged()), this, SLOT(onFmtxChanged())); onFmtxChanged(); positionTimer->start(); quint32 disable = {0}; Atom winPortraitModeSupportAtom = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_SUPPORT", false); XChangeProperty(QX11Info::display(), winId(), winPortraitModeSupportAtom, XA_CARDINAL, 32, PropModeReplace, (uchar*) &disable, 1); this->setDNDAtom(true); mafwRenderer->getStatus(); mafwRenderer->getPosition(); }