1#ifndef MYTHDIALOGBOX_H_
2#define MYTHDIALOGBOX_H_
46 m_id(
std::move(id)), m_result(result),
47 m_resultText(
std::move(text)),
48 m_resultData(
std::move(data)) { }
51 QString
GetId() {
return m_id; }
54 QVariant
GetData() {
return m_resultData; }
70 m_text(
std::move(text)), m_checked(checked), m_subMenu(subMenu) { Init(); }
73 bool checked =
false,
MythMenu *subMenu =
nullptr) :
74 m_text(
std::move(text)), m_data(QVariant::fromValue(slot)),
75 m_checked(checked), m_subMenu(subMenu) { Init(); }
78 bool checked =
false,
MythMenu *subMenu =
nullptr) :
79 m_text(
std::move(text)), m_data(QVariant::fromValue(slot)),
80 m_checked(checked), m_subMenu(subMenu) { Init(); }
83 bool checked =
false,
MythMenu *subMenu =
nullptr) :
84 m_text(
std::move(text)), m_data(QVariant::fromValue(slot)),
85 m_checked(checked), m_subMenu(subMenu) { Init(); }
86 void SetData(QVariant data) { m_data = std::move(data); }
90 bool m_checked {
false};
92 bool m_useSlot {
true};
103 MythMenu(QString text, QObject *retobject, QString resultid);
104 MythMenu(QString title, QString text, QObject *retobject, QString resultid);
107 void AddItemV(
const QString &title, QVariant data = 0,
MythMenu *subMenu =
nullptr,
108 bool selected =
false,
bool checked =
false);
109 void AddItem(
const QString &title) { AddItemV(title); };
112 MythMenu *subMenu =
nullptr,
bool selected =
false,
113 bool checked =
false);
115 template <
typename SLOT>
116 typename std::enable_if_t<FunctionPointerTest<SLOT>::MemberFunction>
117 AddItem(
const QString &title,
const SLOT &slot,
118 MythMenu *subMenu =
nullptr,
bool selected =
false,
119 bool checked =
false)
122 auto *item =
new MythMenuItem(title, slot2, checked, subMenu);
123 AddItem(item, selected, subMenu);
126 template <
typename SLOT>
127 typename std::enable_if_t<FunctionPointerTest<SLOT>::MemberConstFunction>
128 AddItem(
const QString &title,
const SLOT &slot,
129 MythMenu *subMenu =
nullptr,
bool selected =
false,
130 bool checked =
false)
133 auto *item =
new MythMenuItem(title, slot2, checked, subMenu);
134 AddItem(item, selected, subMenu);
137 void SetSelectedByTitle(
const QString &title);
138 void SetSelectedByData(
const QVariant& data);
142 bool IsEmpty() {
return m_menuItems.isEmpty(); }
154 int m_selectedItem {0};
171 bool fullscreen =
false,
bool osd =
false)
173 m_osdDialog(osd), m_text(
std::move(text)) {}
176 bool fullscreen =
false,
bool osd =
false)
178 m_osdDialog(osd), m_title(
std::move(title)),m_text(
std::move(text)) {}
180 bool fullscreen =
false,
bool osd =
false)
182 m_osdDialog(osd), m_menu(
menu), m_currentMenu(
menu) {}
185 bool Create(
void)
override;
189 void SetReturnEvent(QObject *retobject,
const QString &resultid);
190 void SetBackAction(
const QString &text, QVariant data);
191 void SetExitAction(
const QString &text, QVariant data);
192 void SetText(
const QString &text);
194 void AddButtonV(
const QString &title, QVariant data = 0,
195 bool newMenu =
false,
bool setCurrent =
false);
196 void AddButtonD(
const QString &title,
bool setCurrent) { AddButtonV(title, 0,
false, setCurrent); }
197 void AddButton(
const QString &title) { AddButtonV(title, 0,
false,
false); }
200 bool newMenu =
false,
bool setCurrent =
false)
202 AddButtonV(title, QVariant::fromValue(slot), newMenu, setCurrent);
206 template <
typename SLOT>
207 typename std::enable_if_t<FunctionPointerTest<SLOT>::MemberFunction>
209 bool newMenu =
false,
bool setCurrent =
false)
212 AddButtonV(title, QVariant::fromValue(slot2), newMenu, setCurrent);
216 template <
typename SLOT>
217 typename std::enable_if_t<FunctionPointerTest<SLOT>::MemberConstFunction>
219 bool newMenu =
false,
bool setCurrent =
false)
222 AddButtonV(title, QVariant::fromValue(slot2), newMenu, setCurrent);
226 bool keyPressEvent(QKeyEvent *event)
override;
227 bool inputMethodEvent(QInputMethodEvent *event)
override;
238 void SendEvent(
int res,
const QString& text =
"",
const QVariant& data = 0);
239 void updateMenu(
void);
244 QObject *m_retObject {
nullptr};
246 bool m_useSlots {
false};
248 bool m_fullscreen {
false};
249 bool m_osdDialog {
false};
254 QVariant m_backdata {0};
256 QVariant m_exitdata {0};
277 bool showCancel =
true)
279 m_message(
std::move(message)), m_showCancel(showCancel) {}
281 bool Create(
void)
override;
282 void SetReturnEvent(QObject *retobject,
const QString &resultid);
283 void SetData(QVariant data) { m_resultData = std::move(data); }
284 void SetMessage(
const QString &message);
286 bool keyPressEvent(QKeyEvent *event)
override;
292 void sendResult(
bool ok);
295 bool m_showCancel {
true};
296 QObject *m_retObject {
nullptr};
320 bool isPassword =
false,
321 QString defaultValue =
"")
323 m_message(
std::move(message)), m_defaultValue(
std::move(defaultValue)),
324 m_filter(filter), m_isPassword(isPassword) {}
326 bool Create(
void)
override;
327 void SetReturnEvent(QObject *retobject,
const QString &resultid);
337 bool m_isPassword {
false};
338 QObject *m_retObject {
nullptr};
361 bool Create(
void)
override;
362 void SetReturnEvent(QObject *retobject,
const QString &resultid);
364 void SetRange(
int low,
int high,
int step,
uint pageMultiple=5);
365 void AddSelection(
const QString& label,
int value);
366 void SetValue(
const QString & value);
367 void SetValue(
int value);
376 QObject *m_retObject {
nullptr };
415 bool matchAnywhere =
false,
416 QString defaultValue =
"")
418 m_title(
std::move(title)),
419 m_defaultValue(
std::move(defaultValue)),
420 m_list(
std::move(list)),
421 m_matchAnywhere(matchAnywhere),
424 bool Create(
void)
override;
425 void SetReturnEvent(QObject *retobject,
const QString &resultid);
439 bool m_matchAnywhere {
false };
441 QObject *m_retObject {
nullptr };
445 void slotSendResult(
void);
446 void slotUpdateList(
void);
476 kFutureDates = 0x100,
483 QDateTime startTime = QDateTime::currentDateTime(),
484 int rangeLimit = 14);
486 bool Create()
override;
487 void SetReturnEvent(QObject *retobject,
const QString &resultid);
493 void okClicked(
void);
506 QObject *m_retObject {
nullptr };
511template <
class OBJ,
typename FUNC>
513 FUNC slot,
bool showCancel =
false)
516 if (pop !=
nullptr && parent !=
nullptr)
519 Qt::QueuedConnection);
static int SendEvent(const MythUtilCommandLineParser &cmdline)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
DialogCompletionEvent(QString id, int result, QString text, QVariant data)
Dialog asking for user confirmation.
MythConfirmationDialog(MythScreenStack *parent, QString message, bool showCancel=true)
void SetData(QVariant data)
Basic menu dialog, message and a list of options.
MythDialogBox(QString title, QString text, MythScreenStack *parent, const char *name, bool fullscreen=false, bool osd=false)
std::enable_if_t< FunctionPointerTest< SLOT >::MemberConstFunction > AddButton(const QString &title, const SLOT &slot, bool newMenu=false, bool setCurrent=false)
void AddButton(const QString &title)
MythDialogBox(MythMenu *menu, MythScreenStack *parent, const char *name, bool fullscreen=false, bool osd=false)
std::enable_if_t< FunctionPointerTest< SLOT >::MemberFunction > AddButton(const QString &title, const SLOT &slot, bool newMenu=false, bool setCurrent=false)
void AddButton(const QString &title, const MythUICallbackNMF &slot, bool newMenu=false, bool setCurrent=false)
void AddButtonD(const QString &title, bool setCurrent)
void Closed(QString, int)
MythDialogBox(QString text, MythScreenStack *parent, const char *name, bool fullscreen=false, bool osd=false)
A custom event that represents a mouse gesture.
Screen in which all other widgets are contained and rendered.
Dialog prompting the user to enter a number using a spin box.
Dialog prompting the user to enter a text string.
MythTextInputDialog(MythScreenStack *parent, QString message, InputFilter filter=FilterNone, bool isPassword=false, QString defaultValue="")
Image widget, displays a single image or multiple images in sequence.
Provide a dialog to quickly find an entry in a list.
MythUISearchDialog(MythScreenStack *parent, QString title, QStringList list, bool matchAnywhere=false, QString defaultValue="")
the classes constructor
A widget for offering a range of numerical values where only the the bounding values and interval are...
This widget is used for grouping other widgets for display when a particular named state is called.
A text entry and edit widget.
All purpose text widget, displays a text string.
Q_DECLARE_METATYPE(std::chrono::seconds)
bool MUI_PUBLIC WaitFor(MythConfirmationDialog *dialog)
Blocks until confirmation dialog exits.
MUI_PUBLIC MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel=false)
Non-blocking version of MythPopupBox::showOkPopup()
static MythThemedMenu * menu
void(QObject::*)(void) const MythUICallbackMFc
void(QObject::*)(void) MythUICallbackMF
std::function< void(void)> MythUICallbackNMF