|
TTKMusicPlayer
4.3.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>
Inheritance diagram for MusicLrcAnalysis: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 | setMaximum (int max) noexcept |
| int | maximum () const noexcept |
| int | middle () const noexcept |
| State | loadFromFile (const QString &path) |
| State | loadFromBuffer (const TTKIntStringMap &data) |
| void | save () |
| void | setTimePosition (qint64 pos) |
| qint64 | findTimePosition (qint64 time) |
| void | setCurrentIndex (int index) noexcept |
| int | currentIndex () const noexcept |
| void | setFilePath (const QString &name) noexcept |
| QString | filePath () 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_maximum |
| int | m_currentIndex |
| QString | m_filePath |
| 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 39 of file musiclrcanalysis.h.
|
strong |
| Enumerator | |
|---|---|
| Success |
open file success |
| Failed |
open file failed |
Definition at line 33 of file musiclrcanalysis.h.
|
explicit |
Object constructor.
Definition at line 9 of file musiclrcanalysis.cpp.
|
noexcept |
Clear current lrc cache.
Definition at line 176 of file musiclrcanalysis.cpp.
References m_currentIndex, m_currentShowLrcContainer, and m_lrcContainer.
Referenced by loadFromBuffer(), and loadFromFile().
|
noexcept |
Check current container count.
Definition at line 193 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), and MusicLrcContainerForInterior::paintEvent().
|
inlinenoexcept |
Get current middle index.
Definition at line 104 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 298 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcTranslatedWidget::downloadDataFinished(), and MusicLrcContainerForInterior::showLrcPosterWidget().
| QString MusicLrcAnalysis::dataString | ( | ) | const |
Get all lrc from container.
Definition at line 288 of file musiclrcanalysis.cpp.
References m_lrcContainer, and TTK_LINEFEED.
Referenced by MusicLrcContainerForInterior::lrcCopyClipboard(), and MusicLrcTranslatedWidget::setCurrentSongName().
|
inlinenoexcept |
Get current file path.
Definition at line 112 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::contextMenuEvent(), MusicLrcContainerForInterior::lrcOpenFileDir(), MusicLrcTranslatedWidget::setCurrentSongName(), 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 213 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 251 of file musiclrcanalysis.cpp.
References m_currentShowLrcContainer, m_lrcContainer, and m_maximum.
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 271 of file musiclrcanalysis.cpp.
References findTime(), m_currentShowLrcContainer, and middle().
| qint64 MusicLrcAnalysis::findTimePosition | ( | qint64 | time | ) |
Find song time position by given time, return new time.
Definition at line 144 of file musiclrcanalysis.cpp.
References m_currentIndex, and m_lrcContainer.
Referenced by MusicLrcContainerForInterior::findTimePosition(), MusicLrcMakerWidget::lrcPositionFaster(), MusicLrcMakerWidget::lrcPositionSlower(), and MusicLrcMakerWidget::timeSliderValueChanged().
|
private |
Init parameters.
Definition at line 303 of file musiclrcanalysis.cpp.
References Failed, m_currentShowLrcContainer, m_lrcContainer, middle(), and Success.
Referenced by loadFromBuffer(), and loadFromFile().
|
noexcept |
Check current container is empty or not.
Definition at line 188 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 183 of file musiclrcanalysis.cpp.
References isEmpty(), m_currentIndex, m_currentShowLrcContainer, and m_maximum.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::mouseReleaseEvent(), MusicLrcContainerForInterior::updateCurrentLrc(), MusicLrcContainerForWallpaper::updateCurrentLrc(), and MusicLrcMakerWidget::updateCurrentLrc().
| MusicLrcAnalysis::State MusicLrcAnalysis::loadFromBuffer | ( | const TTKIntStringMap & | data | ) |
Set lrc container data from other raw data.
Definition at line 94 of file musiclrcanalysis.cpp.
References clear(), Failed, initialize(), and m_lrcContainer.
Referenced by MusicLrcMakerWidget::setCurrentThirdWidget().
| MusicLrcAnalysis::State MusicLrcAnalysis::loadFromFile | ( | const QString & | path | ) |
Set lrc container data from lyric file.
Definition at line 17 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_filePath, 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 |
Lrc analysis by match lrc line base.
Definition at line 333 of file musiclrcanalysis.cpp.
References TTKRegularExpression::captured(), TTKRegularExpression::capturedLength(), TTKRegularExpression::match(), Type01, Type02, Type03, Type04, Type05, Type06, Type07, Type08, Type09, Type10, Type11, Type12, Type13, and Type14.
Referenced by loadFromFile().
|
private |
Lrc analysis by match lrc line two[xx.(:)xx].
Definition at line 475 of file musiclrcanalysis.cpp.
References TTKRegularExpression::captured(), m_lrcContainer, TTKRegularExpression::match(), TTKRegularExpression::setPattern(), 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 490 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 455 of file musiclrcanalysis.cpp.
References TTKRegularExpression::captured(), m_lrcContainer, TTKRegularExpression::match(), TTKRegularExpression::setPattern(), TTK_DN_M2MS, and TTK_DN_S2MS.
|
inlinenoexcept |
Get current line maximum value.
Definition at line 69 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 73 of file musiclrcanalysis.h.
Referenced by findTime(), MusicLrcContainerForInterior::initCurrentLrc(), initialize(), MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::paintEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcMakerWidget::positionChanged(), MusicLrcContainerForInterior::showNoLrcCurrentInfo(), MusicLrcContainerForInterior::start(), MusicLrcContainerForInterior::stop(), MusicLrcContainerForInterior::text(), MusicLrcMakerWidget::thirdWidgetStateButtonClicked(), MusicLrcMakerWidget::updateAnimationLrc(), MusicLrcContainerForInterior::updateAnimationLrc(), and MusicLrcContainerForInterior::updateCurrentLrc().
| void MusicLrcAnalysis::save | ( | ) |
Save lrc data to current lrc file.
Definition at line 106 of file musiclrcanalysis.cpp.
References m_filePath, m_lrcContainer, QtNamespace, TTKTime::toString(), TTK_APP_NAME, and TTK_LINEFEED.
Referenced by MusicLrcMakerWidget::saveButtonClicked(), and MusicLrcContainerForInterior::saveLrcTimeChanged().
|
inlinenoexcept |
Set current middle index.
Definition at line 100 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
|
inlinenoexcept |
Set current file path.
Definition at line 108 of file musiclrcanalysis.h.
References name.
Referenced by MusicLrcMakerWidget::setCurrentSongName().
|
inlinenoexcept |
Set current line maximum value.
Definition at line 65 of file musiclrcanalysis.h.
References TTK::max().
Referenced by MusicIdentifySongWidget::createDetectedSuccessedWidget(), MusicLrcMakerWidget::createThirdWidget(), MusicRightAreaWidget::MusicRightAreaWidget(), MusicWebFMRadioPlayWidget::MusicWebFMRadioPlayWidget(), and MusicLrcContainerForInterior::setLrcSizeProperty().
| void MusicLrcAnalysis::setTimePosition | ( | qint64 | pos | ) |
Set lrc time by pos, both + or - the same pos.
Definition at line 134 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcMakerWidget::lrcPositionFaster(), MusicLrcMakerWidget::lrcPositionSlower(), and MusicLrcContainerForInterior::setTimePosition().
| QString MusicLrcAnalysis::text | ( | int | index | ) | const |
Get current lrc text by index.
Definition at line 198 of file musiclrcanalysis.cpp.
References m_currentIndex, and m_currentShowLrcContainer.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcContainerForWallpaper::updateAnimationLrc(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
|
private |
Definition at line 179 of file musiclrcanalysis.h.
Referenced by clear(), findTimePosition(), isValid(), and text().
|
private |
Definition at line 182 of file musiclrcanalysis.h.
Referenced by clear(), findTime(), initialize(), isValid(), and text().
|
private |
Definition at line 180 of file musiclrcanalysis.h.
Referenced by loadFromFile(), and save().
|
private |
Definition at line 181 of file musiclrcanalysis.h.
Referenced by clear(), count(), dataList(), dataString(), findText(), findTime(), findTimePosition(), initialize(), isEmpty(), loadFromBuffer(), matchLrcLine(), save(), and setTimePosition().
|
private |
Definition at line 179 of file musiclrcanalysis.h.
Referenced by findTime(), and isValid().
1.8.8