Go to the documentation of this file.
4 #include <QCoreApplication>
28 (QEvent::Type) QEvent::registerEventType();
37 m_text(
std::move(text)), m_resultid(
std::move(resultid)), m_retObject(retobject)
43 m_title(
std::move(title)), m_text(
std::move(text)), m_resultid(
std::move(resultid)),
44 m_retObject(retobject)
63 item->SetData(std::move(data));
64 AddItem(item, selected, subMenu);
69 MythMenu *subMenu,
bool selected,
bool checked)
71 auto *item =
new MythMenuItem(title, slot, checked, subMenu);
72 AddItem(item, selected, subMenu);
93 if (item->m_text == title)
108 if (item->m_data == data)
129 QString windowName = (
m_fullscreen ?
"MythDialogBox" :
"MythPopupBox");
147 LOG(VB_GENERAL, LOG_ERR, QString(
"Cannot load screen '%1'")
178 LOG(VB_GENERAL, LOG_ERR,
"UpdateMenu() called before we have a button list to update!");
196 button->SetData(QVariant::fromValue(menuItem));
197 button->setDrawArrow((menuItem->
m_subMenu !=
nullptr));
216 if (menuItem ==
nullptr)
218 if (menuItem->m_subMenu)
226 if (menuItem->m_useSlot)
228 const char *slot = menuItem->m_data.value <
const char * >();
232 Qt::QueuedConnection);
239 Qt::QueuedConnection);
246 Qt::QueuedConnection);
253 Qt::QueuedConnection);
264 const char *slot = item->
GetData().value<
const char *>();
268 Qt::QueuedConnection);
275 Qt::QueuedConnection);
282 Qt::QueuedConnection);
289 Qt::QueuedConnection);
302 const QString &resultid)
330 button->SetData(std::move(data));
331 button->setDrawArrow(newMenu);
350 bool handled =
false;
354 for (
int i = 0; i < actions.size() && !handled; i++)
356 QString
action = actions[i];
365 else if ((
action ==
"LEFT" &&
380 else if (
action ==
"MENU")
385 else if ((
action ==
"RIGHT" &&
404 bool handled =
false;
409 case Qt::RightButton:
467 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythConfirmationDialog'");
473 else if (cancelButton)
496 bool handled =
false;
500 for (
int i = 0; i < actions.size() && !handled; i++)
502 QString
action = actions[i];
525 const QString &resultid)
564 QString
LOC =
"ShowOkPopup('" + message +
"') - ";
573 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no main window?");
579 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no popup stack? "
580 "Is there a MythThemeBase?");
593 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Couldn't Create() Dialog");
609 &block, [&block](
bool result)
610 { block.exit(result ? 1 : 0); });
613 return block.exec() != 0;
635 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTextInputDialog'");
657 const QString &resultid)
682 m_message(
std::move(message)),
704 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSpinBoxDialog'");
755 const QString &resultid)
795 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchDialog'");
823 const QString &resultid)
851 for (
const QString& item : qAsConst(
m_list))
882 m_message(
std::move(message)), m_startTime(
std::move(startTime)),
883 m_resolution(resolutionFlags), m_rangeLimit(rangeLimit)
903 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTimeInputDialog'");
913 const QDate startdate(
m_startTime.toLocalTime().date());
914 QDate date(startdate);
928 bool selected =
false;
929 for (
int x = 0; x <= limit; x++)
934 date = date.addDays(1);
940 if (date == startdate)
945 date = date.addMonths(1);
946 text = date.toString(
"MMM yyyy");
948 if ((date.month() == startdate.month()) &&
949 (date.year() == startdate.year()))
954 date = date.addYears(1);
955 text = date.toString(
"yyyy");
956 if (date.year() == startdate.year())
961 item->SetData(QVariant(date));
976 bool selected =
false;
980 for (
int x = 0; x < limit; x++)
985 time = time.addSecs(60);
986 QDateTime dt = QDateTime(startdate, time, Qt::LocalTime);
989 if (time == starttime)
994 time = time.addSecs(60*60);
995 text = time.toString(
"hh:00");
997 if (time.hour() == starttime.hour())
1002 item->SetData(QVariant(time));
1010 if (messageText && !
m_message.isEmpty())
1022 const QString& resultid)
1033 QDateTime dateTime = QDateTime(date, time, Qt::LocalTime).toUTC();
1039 QVariant data(dateTime);
bool WaitFor(MythConfirmationDialog *dialog)
Blocks until confirmation dialog exits.
MythScreenStack * GetMainStack()
void SetReturnEvent(QObject *retobject, const QString &resultid)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
virtual bool inputMethodEvent(QInputMethodEvent *event)
Input Method event handler.
QString GetValue(void) const override
bool Create(void) override
bool Create(void) override
Gesture GetGesture() const
Qt::MouseButton GetButton() const
MythUISpinBox * m_spinBox
void SendEvent(int res, const QString &text="", const QVariant &data=0)
void slotSendResult(void)
MythSpinBoxDialog(MythScreenStack *parent, QString message)
void SetReturnEvent(QObject *retobject, const QString &resultid)
void SetBackAction(const QString &text, QVariant data)
void SetReturnEvent(QObject *retobject, const QString &resultid)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void Closed(QString, int)
Screen in which all other widgets are contained and rendered.
QString GetText(void) const
void AddSelection(const QString &label, int value)
std::function< void(void)> MythUICallbackNMF
void Select(MythUIButtonListItem *item)
void SetRange(int low, int high, int step, uint pageMultiple=5)
Set the lower and upper bounds of the spinbox, the interval and page amount.
bool Create(void) override
MythUITextEdit * m_textEdit
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
MythUIType * GetFocusWidget(void) const
void SetValue(int val) override
void SetText(const QString &text, bool moveCursor=true)
void(QObject::*)(void) MythUICallbackMF
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void SetMenuItems(MythMenu *menu)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythUIButtonList * m_buttonList
bool SetFocusWidget(MythUIType *widget=nullptr)
void SetExitAction(const QString &text, QVariant data)
static MythThemedMenu * menu
bool Create(void) override
void SetText(const QString &text)
void BuildFocusList(void)
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
void SetPassword(bool isPassword)
void SetFilter(InputFilter filter)
void SetValue(const QString &value)
Can be called only after MythSpinBoxDialog::Create() return successfully The range need to be set bef...
A C++ ripoff of the stroke library for MythTV.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
MythUITextEdit * m_textEdit
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
bool inputMethodEvent(QInputMethodEvent *event) override
Input Method event handler.
void AddButtonV(const QString &title, QVariant data=0, bool newMenu=false, bool setCurrent=false)
void SetRange(int low, int high, int step, uint pageMultiple=5)
Set the lower and upper bounds of the spinbox, the interval and page amount.
All purpose text widget, displays a text string.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void slotUpdateList(void)
@ kAddYear
Add year to string if not included.
Dialog asking for user confirmation. Ok and optional Cancel button.
bool Create(void) override
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythUIText * m_messageText
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
MythUIButtonList * m_itemList
virtual void SetText(const QString &text)
virtual void SetVisible(bool visible)
void SetReturnEvent(QObject *retobject, const QString &resultid)
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
~DialogCompletionEvent() override
static const Type kEventType
MythMainWindow * GetMythMainWindow(void)
MythUIText * m_matchesText
void SetReturnEvent(QObject *retobject, const QString &resultid)
void SetMessage(const QString &message)
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
MythScreenStack * GetStack(const QString &Stackname)
@ kDateFull
Default local time.
MythScreenStack * m_screenStack
A custom event that represents a mouse gesture.
~MythDialogBox(void) override
void(QObject::*)(void) const MythUICallbackMFc
@ kTime
Default local time.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void AddSelection(int value, const QString &label="")
Add a special label for a value of the spinbox, it does not need to be in the range.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
virtual MythScreenType * GetTopScreen(void) const