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");
149 LOG(VB_GENERAL, LOG_ERR, QString(
"Cannot load screen '%1'")
180 LOG(VB_GENERAL, LOG_ERR,
"UpdateMenu() called before we have a button list to update!");
198 button->SetData(QVariant::fromValue(menuItem));
199 button->setDrawArrow((menuItem->
m_subMenu !=
nullptr));
218 if (menuItem ==
nullptr)
220 if (menuItem->m_subMenu)
228 if (menuItem->m_useSlot)
230 const char *slot = menuItem->m_data.value <
const char * >();
234 Qt::QueuedConnection);
241 Qt::QueuedConnection);
248 Qt::QueuedConnection);
255 Qt::QueuedConnection);
266 const char *slot = item->
GetData().value<
const char *>();
270 Qt::QueuedConnection);
277 Qt::QueuedConnection);
284 Qt::QueuedConnection);
291 Qt::QueuedConnection);
304 const QString &resultid)
332 button->SetData(std::move(data));
333 button->setDrawArrow(newMenu);
352 bool handled =
false;
356 for (
int i = 0; i < actions.size() && !handled; i++)
358 const QString&
action = actions[i];
367 else if ((
action ==
"LEFT" &&
382 else if (
action ==
"MENU")
387 else if ((
action ==
"RIGHT" &&
408 bool handled =
false;
413 case Qt::RightButton:
471 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythConfirmationDialog'");
477 else if (cancelButton)
500 bool handled =
false;
504 for (
int i = 0; i < actions.size() && !handled; i++)
506 const QString&
action = actions[i];
529 const QString &resultid)
568 QString
LOC =
"ShowOkPopup('" + message +
"') - ";
577 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no main window?");
583 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no popup stack? "
584 "Is there a MythThemeBase?");
597 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Couldn't Create() Dialog");
613 &block, [&block](
bool result)
614 { block.exit(result ? 1 : 0); });
617 return block.exec() != 0;
639 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTextInputDialog'");
661 const QString &resultid)
686 m_message(std::move(message)),
708 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSpinBoxDialog'");
759 const QString &resultid)
799 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchDialog'");
827 const QString &resultid)
855 for (
const QString& item : std::as_const(
m_list))
886 m_message(std::move(message)), m_startTime(std::move(startTime)),
887 m_resolution(resolutionFlags), m_rangeLimit(rangeLimit)
907 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTimeInputDialog'");
917 const QDate startdate(
m_startTime.toLocalTime().date());
918 QDate date(startdate);
932 bool selected =
false;
933 for (
int x = 0; x <= limit; x++)
938 date = date.addDays(1);
944 if (date == startdate)
949 date = date.addMonths(1);
950 text = date.toString(
"MMM yyyy");
952 if ((date.month() == startdate.month()) &&
953 (date.year() == startdate.year()))
958 date = date.addYears(1);
959 text = date.toString(
"yyyy");
960 if (date.year() == startdate.year())
965 item->SetData(QVariant(date));
980 bool selected =
false;
984 for (
int x = 0; x < limit; x++)
989 time = time.addSecs(60);
990 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
991 QDateTime dt = QDateTime(startdate, time, Qt::LocalTime);
993 QDateTime dt = QDateTime(startdate, time,
994 QTimeZone(QTimeZone::LocalTime));
998 if (time == starttime)
1003 time = time.addSecs(60*60);
1004 text = time.toString(
"hh:00");
1006 if (time.hour() == starttime.hour())
1011 item->SetData(QVariant(time));
1019 if (messageText && !
m_message.isEmpty())
1031 const QString& resultid)
1042 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
1043 QDateTime dateTime = QDateTime(date, time, Qt::LocalTime).toUTC();
1045 QDateTime dateTime = QDateTime(date, time,
1046 QTimeZone(QTimeZone::LocalTime)).toUTC();
1053 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