TTKMusicPlayer
4.1.3.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) | |
~MusicLrcAnalysis () | |
void | setLineMax (int max) |
int | lineMax () const |
int | lineMiddle () const |
State | setData (const QByteArray &data) |
State | setData (const TTKIntStringMap &data) |
void | saveData () |
State | loadFromLrcFile (const QString &path) |
State | loadFromKrcFile (const QString &path) |
qint64 | setSongTimeSpeed (qint64 time) |
void | revertTime (qint64 pos) |
void | setCurrentIndex (int index) |
int | currentIndex () const |
void | setCurrentFilePath (const QString &name) |
QString | currentFilePath () const |
void | clear () |
bool | isValid () const |
bool | isEmpty () const |
int | count () const |
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 | |
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 30 of file musiclrcanalysis.h.
|
strong |
Definition at line 41 of file musiclrcanalysis.h.
|
strong |
Enumerator | |
---|---|
Success |
open file success |
Failed |
open file failed |
Definition at line 35 of file musiclrcanalysis.h.
|
explicit |
Object constructor.
Definition at line 8 of file musiclrcanalysis.cpp.
MusicLrcAnalysis::~MusicLrcAnalysis | ( | ) |
Object destructor.
Definition at line 16 of file musiclrcanalysis.cpp.
void MusicLrcAnalysis::clear | ( | ) |
Clear current lrc cache.
Definition at line 407 of file musiclrcanalysis.cpp.
References m_currentLrcIndex, m_currentShowLrcContainer, and m_lrcContainer.
Referenced by loadFromKrcFile(), loadFromLrcFile(), and setData().
int MusicLrcAnalysis::count | ( | ) | const |
Check current container count.
Definition at line 424 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), and MusicLrcContainerForInterior::paintEvent().
|
inline |
Get current file path.
Definition at line 127 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::contextMenuEvent(), MusicLrcContainerForInterior::lrcOpenFileDir(), and MusicLrcContainerForInterior::translatedLrcData().
|
inline |
Get current middle index.
Definition at line 119 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 530 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 520 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 444 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 483 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 503 of file musiclrcanalysis.cpp.
References findTime(), lineMiddle(), and m_currentShowLrcContainer.
bool MusicLrcAnalysis::isEmpty | ( | ) | const |
Check current container is empty or not.
Definition at line 419 of file musiclrcanalysis.cpp.
References m_lrcContainer.
Referenced by MusicLrcContainerForInterior::contextMenuEvent(), findText(), isValid(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcMakerWidget::positionChanged(), and MusicLrcContainerForInterior::resizeWidth().
bool MusicLrcAnalysis::isValid | ( | ) | const |
Check current index is valid or not.
Definition at line 414 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().
|
inline |
Get current line maximum value.
Definition at line 75 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().
|
inline |
Get current line middle number.
Definition at line 79 of file musiclrcanalysis.h.
Referenced by findTime(), MusicLrcContainerForInterior::initCurrentLrc(), loadFromKrcFile(), MusicLrcContainerForInterior::mouseMoveEvent(), MusicLrcContainerForInterior::paintEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcMakerWidget::positionChanged(), setData(), MusicLrcContainerForInterior::showNoLrcCurrentInfo(), MusicLrcContainerForInterior::startDrawLrc(), MusicLrcContainerForInterior::stopDrawLrc(), MusicLrcContainerForInterior::text(), MusicLrcMakerWidget::thirdWidgetStateButtonClicked(), MusicLrcMakerWidget::updateAnimationLrc(), MusicLrcContainerForInterior::updateAnimationLrc(), and MusicLrcContainerForInterior::updateCurrentLrc().
MusicLrcAnalysis::State MusicLrcAnalysis::loadFromKrcFile | ( | const QString & | path | ) |
Analysis krc file to map return the state.
Definition at line 120 of file musiclrcanalysis.cpp.
References clear(), MusicLrcFromKrc::decode(), MusicLrcFromKrc::decodeString(), Failed, lineMiddle(), m_currentFilePath, m_currentShowLrcContainer, m_lrcContainer, matchLrcLine(), Success, text(), and TTK_WLINEFEED.
Referenced by MusicRightAreaWidget::loadCurrentSongLrc().
MusicLrcAnalysis::State MusicLrcAnalysis::loadFromLrcFile | ( | const QString & | path | ) |
Analysis lrc file to map return the state.
Definition at line 104 of file musiclrcanalysis.cpp.
References clear(), Failed, m_currentFilePath, and setData().
Referenced by MusicIdentifySongWidget::createDetectedSuccessedWidget(), MusicRightAreaWidget::loadCurrentSongLrc(), and MusicWebFMRadioPlayWidget::lrcDownloadStateChanged().
|
private |
|
private |
Lrc analysis by match lrc line two[xx.(:)xx].
Definition at line 309 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 324 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 289 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 373 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 383 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().
|
inline |
Set current file path.
Definition at line 123 of file musiclrcanalysis.h.
References name.
Referenced by MusicLrcMakerWidget::setCurrentSongName().
|
inline |
Set current middle index.
Definition at line 115 of file musiclrcanalysis.h.
Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
MusicLrcAnalysis::State MusicLrcAnalysis::setData | ( | const QByteArray & | data | ) |
Set lrc container data from other raw data.
Definition at line 21 of file musiclrcanalysis.cpp.
References clear(), MusicApplication::duration(), Failed, MusicApplication::instance(), lineMiddle(), m_currentShowLrcContainer, m_lrcContainer, matchLrcLine(), MUSIC_TTKLRCF, qAsConst, Success, text(), and TTK_LINEFEED.
Referenced by loadFromLrcFile(), and MusicLrcMakerWidget::setCurrentThirdWidget().
MusicLrcAnalysis::State MusicLrcAnalysis::setData | ( | const TTKIntStringMap & | data | ) |
Set lrc container data from other raw data.
Definition at line 71 of file musiclrcanalysis.cpp.
References clear(), Failed, lineMiddle(), m_currentShowLrcContainer, m_lrcContainer, and Success.
|
inline |
Set current line maximum value.
Definition at line 71 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 342 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 429 of file musiclrcanalysis.cpp.
References m_currentLrcIndex, and m_currentShowLrcContainer.
Referenced by loadFromKrcFile(), MusicLrcContainerForInterior::mouseMoveEvent(), MusicIdentifySongWidget::positionChanged(), MusicWebFMRadioPlayWidget::positionChanged(), setData(), MusicLrcContainerForInterior::setLrcSize(), MusicLrcContainerForWallpaper::updateAnimationLrc(), MusicLrcMakerWidget::updateAnimationLrc(), and MusicLrcContainerForInterior::updateAnimationLrc().
|
private |
Definition at line 191 of file musiclrcanalysis.h.
Referenced by loadFromKrcFile(), loadFromLrcFile(), and saveData().
|
private |
Definition at line 190 of file musiclrcanalysis.h.
Referenced by clear(), isValid(), setSongTimeSpeed(), and text().
|
private |
Definition at line 193 of file musiclrcanalysis.h.
Referenced by clear(), findTime(), isValid(), loadFromKrcFile(), setData(), and text().
|
private |
Definition at line 190 of file musiclrcanalysis.h.
Referenced by findTime(), and isValid().
|
private |
Definition at line 192 of file musiclrcanalysis.h.
Referenced by clear(), count(), dataList(), dataString(), findText(), findTime(), isEmpty(), loadFromKrcFile(), matchLrcLine(), revertTime(), saveData(), setData(), and setSongTimeSpeed().