Go to the documentation of this file.
7 #include <QDomDocument>
17 #include <libmythbase/mythversion.h>
81 LOG(VB_GENERAL, LOG_ERR, QString(
"Cannot load screen '%1'").arg(windowName));
113 std::chrono::milliseconds rs = 0ms;
120 rs = oe->elapsedSeconds();
129 if (lyric->m_time > 1s && rs >= lyric->m_time)
142 if ((dce ==
nullptr) || (dce->GetResult() < 0))
145 QString resultid = dce->
GetId();
146 QString resulttext = dce->GetResultText();
147 if (resultid ==
"actionmenu")
149 if (resulttext == tr(
"Save Lyrics"))
153 else if ((resulttext == tr(
"Edit Lyrics")) ||
154 (resulttext == tr(
"Add Lyrics")))
158 else if (resulttext == tr(
"Auto Scroll Lyrics"))
165 else if (resultid ==
"findlyricsmenu")
167 if (dce->GetResult() >= 0)
169 QString grabber = dce->GetData().toString();
199 QString status = QString(
"%1%").arg((
int)(100.0 / ((
double)maxSize / (
double)available)));
221 QString label = tr(
"Actions");
232 menu->AddItem(tr(
"Edit Lyrics"),
nullptr,
nullptr);
234 menu->AddItem(tr(
"Add Lyrics"),
nullptr,
nullptr);
237 menu->AddItem(tr(
"Save Lyrics"),
nullptr,
nullptr);
241 menu->AddItem(tr(
"Auto Scroll Lyrics"),
nullptr,
nullptr);
250 if (menuPopup->Create())
258 QString label = tr(
"Find Lyrics");
260 auto *
menu =
new MythMenu(label,
this,
"findlyricsmenu");
261 menu->AddItemV(tr(
"Search All Grabbers"), QVariant::fromValue(QString(
"ALL")));
263 QStringList strList(
"MUSIC_LYRICS_GETGRABBERS");
266 for (
int x = 1; x < strList.count(); x++)
267 menu->AddItemV(tr(
"Search %1").arg(strList.at(x)), QVariant::fromValue(strList.at(x)));
275 bool handled =
false;
285 if (actions.contains(
"UP") || actions.contains(
"DOWN") ||
286 actions.contains(
"PAGEUP") || actions.contains(
"PAGEDOWN"))
295 for (
int i = 0; i < actions.size() && !handled; i++)
297 QString
action = actions[i];
425 if (message.isEmpty())
472 if (!editDialog->Create())
493 m_sourceData(sourceData)
516 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'editlyrics'");
539 bool handled =
false;
547 for (
int i = 0; i < actions.size() && !handled; i++)
549 QString
action = actions[i];
586 bool changed =
false;
MythScreenStack * GetMainStack()
AudioOutput * getOutput(void)
LyricsData * m_sourceData
LyricsView(MythScreenStack *parent, MythScreenType *parentScreen)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
LyricsLineMap * lyrics(void)
MythUITextEdit * m_artistEdit
MythUIButton * m_okButton
void showMessage(const QString &message)
MythMenu * createFindLyricsMenu(void)
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
MythUITextEdit * m_titleEdit
std::chrono::milliseconds m_time
bool GetBooleanCheckState(void) const
void setArtist(const QString &artist)
void setAlbum(const QString &album)
void findLyrics(const QString &grabber="ALL")
bool isPlaying(void) const
void syncronizedChanged(bool syncronized)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
QString GetText(void) const
bool Create(void) override
PlayMode getPlayMode(void)
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
void setLyrics(const QStringList &lyrics)
MythUIButtonList * m_lyricsList
MythUIType * GetFocusWidget(void) const
MythUIText * m_bufferStatus
void addListener(QObject *listener)
Add a listener to the observable.
static const Type kPlayedTracksChangedEvent
MusicMetadata * getCurrentMetadata(void)
get the metadata for the current track in the playlist
void SetText(const QString &text, bool moveCursor=true)
Events sent by the DecoderHandler and it's helper classes.
void getBufferStatus(int *available, int *maxSize) const
void lyricStatusChanged(LyricsData::Status status, const QString &message)
void statusChanged(LyricsData::Status status, const QString &message)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
void customEvent(QEvent *event) override
static const Type kTrackChangeEvent
Basic menu dialog, message and a list of options.
static MythThemedMenu * menu
bool somethingChanged(void)
static const Type kOperationStart
void BuildFocusList(void)
void setGrabber(const QString &grabber)
void ShowMenu(void) override
void setSyncronized(bool syncronized)
EditLyricsDialog(MythScreenStack *parent, LyricsData *sourceData)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
bool syncronized(void) const
static const Type kOperationStop
MythUICheckBox * m_syncronizedCheck
virtual std::chrono::milliseconds GetAudiotime(void)=0
void setChanged(bool changed)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
QList< MusicMetadata * > & getPlayedTracksList(void)
void editFinished(bool result)
MythMenu * createMainMenu(void)
MythUITextEdit * m_grabberEdit
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void SetCheckState(MythUIStateType::StateType state)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythUIStateType * m_loadingState
MythUIText * m_statusText
void setTitle(const QString &title)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kBufferStatus
virtual void SetText(const QString &text)
static const Type kEventType
MythMainWindow * GetMythMainWindow(void)
MythScreenStack * GetStack(const QString &Stackname)
QString toString(bool syncronized)
void findLyrics(const QString &grabber)
MythUIButton * m_cancelButton
std::chrono::seconds getCurrentTrackTime(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
bool Create(void) override
~LyricsView(void) override
void customEvent(QEvent *event) override
void removeListener(QObject *listener)
Remove a listener to the observable.
MythUITextEdit * m_lyricsEdit
bool DisplayState(const QString &name)
MythUIProgressBar * m_bufferProgress
MythUITextEdit * m_albumEdit