MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / initSignals

Method initSignals

UI/player.cpp:1690–2181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1688}
1689
1690void PlayerWindow::initSignals()
1691{
1692 QObject::connect(GlobalObjects::mpvplayer, &MPVPlayer::durationChanged, this, [this](int duration){
1693 // QCoreApplication::processEvents();
1694 int ts=duration/1000;
1695 int lmin=ts/60;
1696 int ls=ts-lmin*60;
1697 PlayContext::context()->duration = ts;
1698 progress->setRange(0,duration);
1699 progress->setSingleStep(1);
1700 miniProgress->setRange(0,duration);
1701 miniProgress->setSingleStep(1);
1702 totalTimeStr=QString("/%1:%2").arg(lmin,2,10,QChar('0')).arg(ls,2,10,QChar('0'));
1703 timeLabel->setText("00:00"+this->totalTimeStr);
1704 static_cast<DanmuStatisWidget *>(danmuStatisBar)->setDuration(ts);
1705 const PlayListItem *currentItem=GlobalObjects::playlist->getCurrentItem();
1706 if (currentItem)
1707 {
1708 if (currentItem->playTime > 15 && currentItem->playTime < ts - 15)
1709 {
1710 GlobalObjects::mpvplayer->seek(currentItem->playTime*1000);
1711 showMessage(tr("Jumped to the last play position"));
1712 }
1713 }
1714#ifdef QT_DEBUG
1715 qDebug()<<"Duration Changed";
1716#endif
1717 });
1718 QObject::connect(GlobalObjects::mpvplayer, &MPVPlayer::fileChanged, this, [](){
1719 if (!EventBus::getEventBus()->hasListener(EventBus::EVENT_PLAYER_FILE_CHANGED)) return;
1720 QVariantMap param = {
1721 { "file", GlobalObjects::mpvplayer->getCurrentFile() }
1722 };
1723 const PlayListItem *currentItem = GlobalObjects::playlist->getCurrentItem();
1724 if (currentItem)
1725 {
1726 Pool *pool = GlobalObjects::danmuManager->getPool(currentItem->poolID, false);
1727 if (pool)
1728 {
1729 param["anime_name"] = pool->animeTitle();
1730 param["epinfo"] = pool->toEp().toMap();
1731 }
1732 }
1733 EventBus::getEventBus()->pushEvent(EventParam{EventBus::EVENT_PLAYER_FILE_CHANGED, param});
1734 });
1735 QObject::connect(GlobalObjects::mpvplayer, &MPVPlayer::fileChanged, this, [this](){
1736 const PlayListItem *currentItem = GlobalObjects::playlist->getCurrentItem();
1737 showPlayerRegion(true);
1738 launchFocusTimeS = -1;
1739 progress->setEventMark(QVector<DanmuEvent>());
1740 progress->setChapterMark(QVector<MPVPlayer::ChapterInfo>());
1741 QString mediaTitle(GlobalObjects::mpvplayer->getMediaTitle());
1742 this->setFocus();
1743 if (!currentItem)
1744 {
1745 titleLabel->setText(mediaTitle);
1746 launchDanmuEdit->hide();
1747 GlobalObjects::danmuPool->setPoolID("");

Callers

nothing calls this directly

Calls 15

QStringClass · 0.85
formatSizeFunction · 0.85
setAwakeRequiredFunction · 0.85
unsetAwakeRequiredFunction · 0.85
setRangeMethod · 0.80
getCurrentItemMethod · 0.80
hasListenerMethod · 0.80
toEpMethod · 0.80
setEventMarkMethod · 0.80
setChapterMarkMethod · 0.80
getMediaTitleMethod · 0.80
setPoolIDMethod · 0.80

Tested by

no test coverage detected