Example #1
0
void KNMusicNowPlaying::onActionLoadSuccess()
{
    //Clear out the cannot playing flag.
    playingMusicModel()->setData(m_playingIndex,
                                 false,
                                 CannotPlayFlagRole);
    //Give out the current.
    emit nowPlayingChanged(m_playingAnalysisItem);
}
Example #2
0
void KNMusicNowPlaying::onActionModelDataChanged(const QModelIndex &topLeft,
                                                 const QModelIndex &bottomRight)
{
    //Get the current row.
    int currentRow=m_playingIndex.row();
    //Check whether the current index is in the range.
    if(currentRow >= topLeft.row() && currentRow <= bottomRight.row())
    {
        //Get the new detail info.
        m_playingAnalysisItem.detailInfo=
                playingMusicModel()->rowDetailInfo(currentRow);
        //Give out the current.
        emit nowPlayingChanged(m_playingAnalysisItem);
    }
}
Example #3
0
void KNMusicNowPlaying::onActionLoadSuccess()
{
    //Check the model first.
    if(playingMusicModel())
    {
        //Block model signal first.
        playingMusicModel()->blockSignals(true);
        //Clear out the cannot playing flag.
        playingMusicModel()->setData(m_playingIndex,
                                     false,
                                     CannotPlayFlagRole);
        //Block model signal first.
        playingMusicModel()->blockSignals(false);
        //Give out the current.
        emit nowPlayingChanged(m_playingAnalysisItem);
    }
    //Play the backend.
    m_backend->play();
}
MediaListsManager::MediaListsManager(MainWindow* parent) : QObject(parent)
{
    m_application = (BangarangApplication*)KApplication::kApplication();
    Ui::MainWindowClass* ui = m_application->mainWindow()->ui;

    //Set up Audio lists view
    MediaListProperties audioListsProperties;
    audioListsProperties.lri = "medialists://audio";
    m_audioListsModel = new MediaItemModel(this);
    m_audioListsModel->setMediaListProperties(audioListsProperties);
    QListView* audioLists = m_application->mainWindow()->audioListsStack()->ui->audioLists;
    audioLists->setModel(m_audioListsModel);
    connect(audioLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(audioListsSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(m_audioListsModel, SIGNAL(mediaListChanged()), this, SLOT(audioListsChanged()));
    m_audioListsModel->load();
    QToolButton* audioListSelect = m_application->mainWindow()->ui->audioListSelect;
    connect(audioListSelect, SIGNAL(clicked()), this, SLOT(selectAudioList()));

    //Set up Video lists view
    MediaListProperties videoListsProperties;
    videoListsProperties.lri = "medialists://video";
    m_videoListsModel = new MediaItemModel(this);
    m_videoListsModel->setMediaListProperties(videoListsProperties);
    QListView* videoLists = m_application->mainWindow()->videoListsStack()->ui->videoLists;
    videoLists->setModel(m_videoListsModel);
    connect(videoLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(videoListsSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(m_videoListsModel, SIGNAL(mediaListChanged()), this, SLOT(videoListsChanged()));
    m_videoListsModel->load();
    QToolButton* videoListSelect = m_application->mainWindow()->ui->videoListSelect;
    connect(videoListSelect, SIGNAL(clicked()), this, SLOT(selectVideoList()));

    //Set up media list view
    m_loadingProgress = 0;
    MediaView* mediaView = ui->mediaView;
    mediaView->setMainWindow(m_application->mainWindow());
    mediaView->setSourceModel(m_application->browsingModel());
    connect(m_application->browsingModel(), SIGNAL(mediaListChanged()), this, SLOT(mediaListChanged()));
    connect(m_application->browsingModel(), SIGNAL(mediaListPropertiesChanged()), this, SLOT(mediaListPropertiesChanged()));
    connect(m_application->browsingModel(), SIGNAL(loading()), this, SLOT(mediaListLoading()));
    connect(m_application->browsingModel(), SIGNAL(loadingStateChanged(bool)), this, SLOT(mediaListLoadingStateChanged(bool)));
    connect(m_application->browsingModel(), SIGNAL(propertiesChanged()), this, SLOT(updateListHeader()));
    connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(categoryActivated(QModelIndex)), this, SLOT(mediaListCategoryActivated(QModelIndex)));
    connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(actionActivated(QModelIndex)), this, SLOT(mediaListActionActivated(QModelIndex)));
    connect(mediaView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(mediaSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(ui->previous, SIGNAL(clicked()), this, SLOT(loadPreviousList()));
    connect(m_application->playlist()->nowPlayingModel(), SIGNAL(mediaListChanged()), this, SLOT(nowPlayingChanged()));
    connect(m_application->mainWindow(), SIGNAL(switchedMainWidget(MainWindow::MainWidget)), this, SLOT(defaultListLoad(MainWindow::MainWidget)));

    //Setup media list filter
    ui->mediaListFilterProxyLine->lineEdit()->setClickMessage(QString());
    ui->mediaListFilterProxyLine->setProxy(ui->mediaView->filterProxyModel());
    ui->mediaListFilter->setVisible(false);
    connect(ui->closeMediaListFilter, SIGNAL(clicked()), this, SLOT(closeMediaListFilter()));

    //Set up play select/all buttons
    connect(ui->playAll, SIGNAL(clicked()), this, SLOT(playAll()));
    connect(ui->playSelected, SIGNAL(clicked()), this, SLOT(playSelected()));

    //Setup browsing model status notifications
    connect(m_application->browsingModel(), SIGNAL(statusUpdated()), this, SLOT(browsingModelStatusUpdated()));

    //Set up search
    KLineEdit* searchField = m_application->mainWindow()->ui->Filter;
    connect(searchField, SIGNAL(returnPressed()), this, SLOT(loadSearch()));

    //Set up device notifier
    connect(DeviceManager::instance(), SIGNAL(deviceListChanged(DeviceManager::RelatedType)),
            this, SLOT(updateDeviceList(DeviceManager::RelatedType)));

    //Set default media list selection
    showMediaList(AudioList);

}