TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MusicLrcAnalysis Class Reference

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 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
 

Detailed Description

The class of the core lrc analysis.

Author
Greedysky greed.nosp@m.ysky.nosp@m.@163..nosp@m.com

Definition at line 29 of file musiclrcanalysis.h.

Member Enumeration Documentation

Enumerator
Type01 

[xx:xx.xxx]

Type02 

[xx:xx.xx]

Type03 

[xx:xx.x]

Type04 

[xx:xx:xxx]

Type05 

[xx:xx:xx]

Type06 

[xx:xx:x]

Type07 

[xx:xx]

Type08 

[xx.xx.xxx]

Type09 

[xx.xx.xx]

Type10 

[xx.xx.x]

Type11 

[xx.xx:xxx]

Type12 

[xx.xx:xx]

Type13 

[xx.xx:x]

Type14 

[xx.xx]

Definition at line 40 of file musiclrcanalysis.h.

Enumerator
Success 

open file success

Failed 

open file failed

Definition at line 34 of file musiclrcanalysis.h.

Constructor & Destructor Documentation

MusicLrcAnalysis::MusicLrcAnalysis ( QObject *  parent = nullptr)
explicit

Object constructor.

Definition at line 8 of file musiclrcanalysis.cpp.

Member Function Documentation

void MusicLrcAnalysis::clear ( )
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().

int MusicLrcAnalysis::count ( ) const
noexcept

Check current container count.

Definition at line 392 of file musiclrcanalysis.cpp.

References m_lrcContainer.

Referenced by MusicLrcContainerForInterior::mouseMoveEvent(), and MusicLrcContainerForInterior::paintEvent().

QString MusicLrcAnalysis::currentFilePath ( ) const
inlinenoexcept
int MusicLrcAnalysis::currentIndex ( ) const
inlinenoexcept
QStringList MusicLrcAnalysis::dataList ( ) const
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
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.

MusicLrcAnalysis::State MusicLrcAnalysis::initialize ( )
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().

bool MusicLrcAnalysis::isEmpty ( ) const
noexcept
bool MusicLrcAnalysis::isValid ( ) const
noexcept
int MusicLrcAnalysis::lineMax ( ) const
inlinenoexcept
int MusicLrcAnalysis::lineMiddle ( ) const
inlinenoexcept
MusicLrcAnalysis::State MusicLrcAnalysis::loadFromFile ( const QString &  path)
void MusicLrcAnalysis::matchLrcLine ( const QString &  oneLine)
private

Lrc analysis by match lrc line base.

Definition at line 159 of file musiclrcanalysis.cpp.

References Type01, Type02, Type03, Type04, Type05, Type06, Type07, Type08, Type09, Type10, Type11, Type12, Type13, and Type14.

Referenced by loadFromFile().

void MusicLrcAnalysis::matchLrcLine ( const QString &  oneLine,
const QString &  cap,
const QString &  first,
const QString &  second 
)
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.

void MusicLrcAnalysis::matchLrcLine ( const QString &  oneLine,
QString  cap,
const QString &  splite 
)
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.

void MusicLrcAnalysis::matchLrcLine ( const QString &  oneLine,
const QString &  cap,
const QString &  first,
const QString &  second,
const QString &  third 
)
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 ( )
void MusicLrcAnalysis::setCurrentFilePath ( const QString &  name)
inlinenoexcept

Set current file path.

Definition at line 110 of file musiclrcanalysis.h.

References name.

Referenced by MusicLrcMakerWidget::setCurrentSongName().

void MusicLrcAnalysis::setCurrentIndex ( int  index)
inlinenoexcept
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().

void MusicLrcAnalysis::setLineMax ( int  max)
inlinenoexcept
qint64 MusicLrcAnalysis::setSongTimeSpeed ( qint64  time)
QString MusicLrcAnalysis::text ( int  index) const

Member Data Documentation

QString MusicLrcAnalysis::m_currentFilePath
private

Definition at line 182 of file musiclrcanalysis.h.

Referenced by loadFromFile(), and saveData().

int MusicLrcAnalysis::m_currentLrcIndex
private

Definition at line 181 of file musiclrcanalysis.h.

Referenced by clear(), isValid(), setSongTimeSpeed(), and text().

QStringList MusicLrcAnalysis::m_currentShowLrcContainer
private

Definition at line 184 of file musiclrcanalysis.h.

Referenced by clear(), findTime(), initialize(), isValid(), and text().

int MusicLrcAnalysis::m_lineMax
private

Definition at line 181 of file musiclrcanalysis.h.

Referenced by findTime(), and isValid().

TTKIntStringMap MusicLrcAnalysis::m_lrcContainer
private

The documentation for this class was generated from the following files: