TTKMusicPlayer
4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
|
The class of the core lrc analysis. More...
#include <musiclrcanalysis.h>
Public Types | |
enum | State { State::Success, State::Failed } |
enum | Format { Format::Type01, Format::Type02, Format::Type03, Format::Type04, Format::Type05, Format::Type06, Format::Type07, Format::Type08, Format::Type09, Format::Type10, Format::Type11, Format::Type12, Format::Type13, Format::Type14 } |
Public Member Functions | |
MusicLrcAnalysis (QObject *parent=nullptr) | |
void | setLineMax (int max) noexcept |
int | lineMax () const noexcept |
int | lineMiddle () const noexcept |
void | saveData () |
State | setData (const TTKIntStringMap &data) |
State | loadFromFile (const QString &path) |
qint64 | setSongTimeSpeed (qint64 time) |
void | revertTime (qint64 pos) |
void | setCurrentIndex (int index) noexcept |
int | currentIndex () const noexcept |
void | setCurrentFilePath (const QString &name) noexcept |
QString | currentFilePath () const noexcept |
void | clear () noexcept |
bool | isValid () const noexcept |
bool | isEmpty () const noexcept |
int | count () const noexcept |
QString | text (int index) const |
bool | findText (qint64 current, qint64 total, QString &pre, QString &last, qint64 &interval) const |
qint64 | findTime (int index) const |
qint64 | findTime (const QStringList &ts) const |
QString | dataString () const |
QStringList | dataList () const |
Private Member Functions | |
State | initialize () |
void | matchLrcLine (const QString &oneLine) |
void | matchLrcLine (const QString &oneLine, const QString &cap, const QString &first, const QString &second) |
void | matchLrcLine (const QString &oneLine, QString cap, const QString &splite) |
void | matchLrcLine (const QString &oneLine, const QString &cap, const QString &first, const QString &second, const QString &third) |
Private Attributes | |
int | m_lineMax |
int | m_currentLrcIndex |
QString | m_currentFilePath |
TTKIntStringMap | m_lrcContainer |
QStringList | m_currentShowLrcContainer |
The class of the core lrc analysis.
Definition at line 29 of file musiclrcanalysis.h.
|
strong |
Definition at line 40 of file musiclrcanalysis.h.
|
strong |
Enumerator | |
---|---|
Success |
open file success |
Failed |
open file failed |
Definition at line 34 of file musiclrcanalysis.h.
|
explicit |
Object constructor.
Definition at line 8 of file musiclrcanalysis.cpp.
|
noexcept |
Clear current lrc cache.
Definition at line 375 of file musiclrcanalysis.cpp.
References m_currentLrcIndex, m_currentShowLrcContainer, and m_lrcContainer.
Referenced by loadFromFile(), and setData().
|
noexcept |
Check current container count.
Definition at line 392 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), and MusicLrcContainerForInterior::paintEvent().
|
inlinenoexcept |
Get current file path.
Definition at line 114 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::contextMenuEvent(), MusicLrcContainerForInterior::lrcOpenFileDir(), and MusicLrcContainerForInterior::translatedLrcData().
|
inlinenoexcept |
Get current middle index.
Definition at line 106 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::mouseReleaseEvent(), MusicLrcContainerForInterior::paintEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::resizeWidth(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
QStringList MusicLrcAnalysis::dataList | ( | ) | const |
Get all lrc from container.
Definition at line 497 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::queryTranslatedLrcFinished(), and MusicLrcContainerForInterior::showLrcPosterWidget().
QString MusicLrcAnalysis::dataString | ( | ) | const |
Get all lrc from container.
Definition at line 487 of file musiclrcanalysis.cpp.
References m_lrcContainer, and TTK_LINEFEED.
Referenced by MusicLrcContainerForInterior::lrcCopyClipboard(), and MusicLrcContainerForInterior::translatedLrcData().
bool MusicLrcAnalysis::findText | ( | qint64 | current, |
qint64 | total, | ||
QString & | pre, | ||
QString & | last, | ||
qint64 & | interval | ||
) | const |
Get current lrc and next lrc in container by current time.
Definition at line 412 of file musiclrcanalysis.cpp.
References isEmpty(), and m_lrcContainer.
Referenced by MusicLrcMakerWidget::positionChanged(), and MusicRightAreaWidget::updateCurrentLrc().
qint64 MusicLrcAnalysis::findTime | ( | int | index | ) | const |
Get current time by index.
Definition at line 450 of file musiclrcanalysis.cpp.
References m_currentShowLrcContainer, m_lineMax, and m_lrcContainer.
Referenced by findTime(), MusicLrcContainerForInterior::mouseReleaseEvent(), MusicLrcContainerForInterior::paintEvent(), MusicIdentifySongWidget::positionChanged(), and MusicWebFMRadioPlayWidget::positionChanged().
qint64 MusicLrcAnalysis::findTime | ( | const QStringList & | ts | ) | const |
Get current time by texts.
Definition at line 470 of file musiclrcanalysis.cpp.
References findTime(), lineMiddle(), and m_currentShowLrcContainer.
|
private |
Init parameters.
Definition at line 129 of file musiclrcanalysis.cpp.
References Failed, lineMiddle(), m_currentShowLrcContainer, m_lrcContainer, and Success.
Referenced by loadFromFile(), and setData().
|
noexcept |
Check current container is empty or not.
Definition at line 387 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::contextMenuEvent(), findText(), isValid(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcMakerWidget::positionChanged(), and MusicLrcContainerForInterior::resizeWidth().
|
noexcept |
Check current index is valid or not.
Definition at line 382 of file musiclrcanalysis.cpp.
References isEmpty(), m_currentLrcIndex, m_currentShowLrcContainer, and m_lineMax.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::mouseReleaseEvent(), MusicLrcContainerForInterior::updateCurrentLrc(), MusicLrcContainerForWallpaper::updateCurrentLrc(), and MusicLrcMakerWidget::updateCurrentLrc().
|
inlinenoexcept |
Get current line maximum value.
Definition at line 70 of file musiclrcanalysis.h.
Referenced by MusicLrcMakerWidget::createThirdWidget(), MusicLrcContainerForWallpaper::initCurrentLrc(), MusicLrcContainerForInterior::initCurrentLrc(), MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::resizeWidth(), MusicLrcMakerWidget::setCurrentThirdWidget(), MusicLrcContainerForInterior::setItemStyleSheet(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcContainerForInterior::showNoLrcCurrentInfo(), MusicLrcContainerForWallpaper::updateAnimationLrc(), MusicLrcMakerWidget::updateAnimationLrc(), MusicLrcContainerForInterior::updateAnimationLrc(), and MusicLrcContainerForInterior::updateCurrentLrc().
|
inlinenoexcept |
Get current line middle number.
Definition at line 74 of file musiclrcanalysis.h.
Referenced by findTime(), MusicLrcContainerForInterior::initCurrentLrc(), initialize(), MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::paintEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcMakerWidget::positionChanged(), MusicLrcContainerForInterior::showNoLrcCurrentInfo(), MusicLrcContainerForInterior::startDrawLrc(), MusicLrcContainerForInterior::stopDrawLrc(), MusicLrcContainerForInterior::text(), MusicLrcMakerWidget::thirdWidgetStateButtonClicked(), MusicLrcMakerWidget::updateAnimationLrc(), MusicLrcContainerForInterior::updateAnimationLrc(), and MusicLrcContainerForInterior::updateCurrentLrc().
MusicLrcAnalysis::State MusicLrcAnalysis::loadFromFile | ( | const QString & | path | ) |
Analysis lyric file to map return the state.
Definition at line 52 of file musiclrcanalysis.cpp.
References clear(), MusicLrcFromInterface::data(), MusicLrcFromPlain::decode(), MusicLrcFromKrc::decode(), MusicLrcFromQrc::decode(), MusicLrcFromTrc::decode(), MusicLrcFromYrc::decode(), Failed, initialize(), KRC_FILE_SUFFIX, LRC_FILE_SUFFIX, m_currentFilePath, matchLrcLine(), qAsConst, QRC_FILE_SUFFIX, TTK::String::split(), TRC_FILE_SUFFIX, TTK_FILE_SUFFIX, TTK_INFO_STREAM, TTK_LINEFEED, TTK_WLINEFEED, and YRC_FILE_SUFFIX.
Referenced by MusicIdentifySongWidget::createDetectedSuccessedWidget(), MusicRightAreaWidget::loadCurrentSongLrc(), and MusicWebFMRadioPlayWidget::lrcDownloadStateChanged().
|
private |
|
private |
Lrc analysis by match lrc line two[xx.(:)xx].
Definition at line 301 of file musiclrcanalysis.cpp.
References m_lrcContainer, TTK_DN_M2MS, and TTK_DN_S2MS.
|
private |
Lrc analysis by match lrc line three[xx.xx.x(xx)][xx:xx:x(xx)].
Definition at line 316 of file musiclrcanalysis.cpp.
References m_lrcContainer, TTK_DN_M2MS, and TTK_DN_S2MS.
|
private |
Lrc analysis by match lrc line three[xx.(:)xx.(:)x(xx)].
Definition at line 281 of file musiclrcanalysis.cpp.
References m_lrcContainer, TTK_DN_M2MS, and TTK_DN_S2MS.
void MusicLrcAnalysis::revertTime | ( | qint64 | pos | ) |
Revert lrc time by pos, both + or - the same pos.
Definition at line 365 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcMakerWidget::lrcSpeedFaster(), MusicLrcMakerWidget::lrcSpeedSlower(), and MusicLrcContainerForInterior::revertTimeSpeed().
void MusicLrcAnalysis::saveData | ( | ) |
Save lrc data to current lrc file.
Definition at line 16 of file musiclrcanalysis.cpp.
References m_currentFilePath, m_lrcContainer, QtNamespace, TTKTime::toString(), TTK_APP_NAME, and TTK_LINEFEED.
Referenced by MusicLrcMakerWidget::saveButtonClicked(), and MusicLrcContainerForInterior::saveLrcTimeChanged().
|
inlinenoexcept |
Set current file path.
Definition at line 110 of file musiclrcanalysis.h.
References name.
Referenced by MusicLrcMakerWidget::setCurrentSongName().
|
inlinenoexcept |
Set current middle index.
Definition at line 102 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
MusicLrcAnalysis::State MusicLrcAnalysis::setData | ( | const TTKIntStringMap & | data | ) |
Set lrc container data from other raw data.
Definition at line 40 of file musiclrcanalysis.cpp.
References clear(), Failed, initialize(), and m_lrcContainer.
Referenced by MusicLrcMakerWidget::setCurrentThirdWidget().
|
inlinenoexcept |
Set current line maximum value.
Definition at line 66 of file musiclrcanalysis.h.
References TTK::max().
Referenced by MusicIdentifySongWidget::createDetectedSuccessedWidget(), MusicLrcMakerWidget::createThirdWidget(), MusicRightAreaWidget::MusicRightAreaWidget(), MusicWebFMRadioPlayWidget::MusicWebFMRadioPlayWidget(), and MusicLrcContainerForInterior::setLrcSizeProperty().
qint64 MusicLrcAnalysis::setSongTimeSpeed | ( | qint64 | time | ) |
Set song speed by given time, return new time.
Definition at line 334 of file musiclrcanalysis.cpp.
References m_currentLrcIndex, and m_lrcContainer.
Referenced by MusicLrcMakerWidget::lrcSpeedFaster(), MusicLrcMakerWidget::lrcSpeedSlower(), MusicLrcContainerForInterior::setSongTimeSpeed(), and MusicLrcMakerWidget::timeSliderValueChanged().
QString MusicLrcAnalysis::text | ( | int | index | ) | const |
Get current lrc text by index.
Definition at line 397 of file musiclrcanalysis.cpp.
References m_currentLrcIndex, and m_currentShowLrcContainer.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcContainerForWallpaper::updateAnimationLrc(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
|
private |
Definition at line 182 of file musiclrcanalysis.h.
Referenced by loadFromFile(), and saveData().
|
private |
Definition at line 181 of file musiclrcanalysis.h.
Referenced by clear(), isValid(), setSongTimeSpeed(), and text().
|
private |
Definition at line 184 of file musiclrcanalysis.h.
Referenced by clear(), findTime(), initialize(), isValid(), and text().
|
private |
Definition at line 181 of file musiclrcanalysis.h.
Referenced by findTime(), and isValid().
|
private |
Definition at line 183 of file musiclrcanalysis.h.
Referenced by clear(), count(), dataList(), dataString(), findText(), findTime(), initialize(), isEmpty(), matchLrcLine(), revertTime(), saveData(), setData(), and setSongTimeSpeed().