Beispiel #1
0
void KNMusicPlaylistViewer::retranslate()
{
    //Update resource text.
    m_songCount[0]=tr("No song.");
    m_songCount[1]=tr("1 song, ");
    m_songCount[2]=tr("%1 songs, ");

    m_minuteCount[0]=tr("0 minute.");
    m_minuteCount[1]=tr("1 minute.");
    m_minuteCount[2]=tr("%1 minutes.");

    m_hourCount[0]=tr("1 hour and ");
    m_hourCount[1]=tr("%1 hours and ");

    m_hourCountWithoutMinuate[0]=tr("1 hour.");
    m_hourCountWithoutMinuate[1]=tr("%1 hours.");

    m_searchCount[0]=tr("No result.");
    m_searchCount[1]=tr("1 result.");
    m_searchCount[2]=tr("%1 results.");

    m_searchResultIn=tr("Search result in %1");
    //Update the tooltip data.
    m_playPlaylist->setToolTip(tr("Play the playlist"));
    m_shufflePlaylist->setToolTip(tr("Shuffle the playlist"));
    m_addToPlaylist->setToolTip(tr("Add songs to playlist"));
    //Update the detail info and title text.
    updateTitle();
    updateDetailInfo();
}
Beispiel #2
0
void KNMusicPlaylistDisplay::onActionRowChanged()
{
    //Update the detail info first.
    updateDetailInfo();
    //Set the changed flag to true.
    m_currentItem->setChanged(true);
}
Beispiel #3
0
void KNMusicPlaylistViewer::onActionSearch()
{
    //Check whether the proxy model is nullptr.
    if(m_treeView->proxyModel()==nullptr)
    {
        //Ignore the search request.
        return;
    }
    //Set the search rules to the proxy model.
    m_treeView->proxyModel()->setSearchBlocks(knMusicGlobal->search()->rules());
    //Update the title and detail info.
    updateTitle();
    updateDetailInfo();
}
Beispiel #4
0
void KNMusicPlaylistDisplay::updatePlaylistInfo()
{
    //Clear the original data first.
    m_playlistTitle->clear();
    m_playlistDetail->clear();
    //If the current item is null, then ignore it.
    if(m_currentItem==nullptr)
    {
        return;
    }
    //Set the title.
    updatePlaylistTitle();
    //Update the detail.
    updateDetailInfo();
}
Beispiel #5
0
void KNMusicPlaylistDisplay::retranslate()
{
    m_songCount[0]=tr("No song, ");
    m_songCount[1]=tr("1 song, ");
    m_songCount[2]=tr("%1 songs, ");

    m_minuateCount[0]=tr("0 minuate.");
    m_minuateCount[1]=tr("1 minuate.");
    m_minuateCount[2]=tr("%1 minuates.");

    m_searchCount[0]=tr("No result.");
    m_searchCount[1]=tr("1 result.");
    m_searchCount[2]=tr("%1 results.");

    m_searchResultIn=tr("Search '%1' in '%2'");

    updatePlaylistTitle();
    updateDetailInfo();

    m_playPlaylist->setToolTip(tr("Play the current playlist."));
    m_addToPlaylist->setToolTip(tr("Add music to playlist."));
}
Beispiel #6
0
void KNMusicPlaylistViewer::setPlaylist(KNMusicPlaylistModel *model)
{
    //Disconnect with the previous playlist.
    m_modelLinkHandler->disconnectAll();
    //Check whether the model is null.
    if(model)
    {
        //Check whether the model has been built from the stored data before.
        if(!model->isBuilt())
        {
            //Build the model.
            model->buildModel();
        }
        //Set the model to playlist tree view.
        m_treeView->setMusicModel(model);
        //Link the model with the details.
        m_modelLinkHandler->append(
                 connect(model, &KNMusicPlaylistModel::rowCountChanged,
                         this,
                         &KNMusicPlaylistViewer::onActionModelRowCountChanged));
        m_modelLinkHandler->append(
                    connect(model, &KNMusicPlaylistModel::titleChanged,
                            this, &KNMusicPlaylistViewer::updateTitle));
    }
    else
    {
        //For nullptr model, we have to clear all the information.
        m_treeView->setMusicModel(nullptr);
    }
    //Move the tree view to the top.
    m_treeView->scrollToTop();
    //Update the playlist information.
    updateTitle();
    //Update the detail information.
    updateDetailInfo();
}
Beispiel #7
0
void KNMusicPlaylistViewer::onActionModelRowCountChanged()
{
    //Update the detail information.
    updateDetailInfo();
}