1#ifndef MYTHDIALOGBOX_H_
2#define MYTHDIALOGBOX_H_
45 m_id(std::move(id)), m_result(result),
46 m_resultText(std::move(text)),
47 m_resultData(std::move(data)) { }
50 QString
GetId() {
return m_id; }
53 QVariant
GetData() {
return m_resultData; }
69 m_text(std::move(text)), m_checked(checked), m_subMenu(subMenu) { Init(); }
72 bool checked =
false,
MythMenu *subMenu =
nullptr) :
73 m_text(std::move(text)), m_data(QVariant::fromValue(slot)),
74 m_checked(checked), m_subMenu(subMenu) { Init(); }
77 bool checked =
false,
MythMenu *subMenu =
nullptr) :
78 m_text(std::move(text)), m_data(QVariant::fromValue(slot)),
79 m_checked(checked), m_subMenu(subMenu) { Init(); }
82 bool checked =
false,
MythMenu *subMenu =
nullptr) :
83 m_text(std::move(text)), m_data(QVariant::fromValue(slot)),
84 m_checked(checked), m_subMenu(subMenu) { Init(); }
85 void SetData(QVariant data) { m_data = std::move(data); }
89 bool m_checked {
false};
91 bool m_useSlot {
true};
102 MythMenu(QString text, QObject *retobject, QString resultid);
103 MythMenu(QString title, QString text, QObject *retobject, QString resultid);
106 void AddItemV(
const QString &title, QVariant data = 0,
MythMenu *subMenu =
nullptr,
107 bool selected =
false,
bool checked =
false);
108 void AddItem(
const QString &title) { AddItemV(title); };
111 MythMenu *subMenu =
nullptr,
bool selected =
false,
112 bool checked =
false);
114 template <
typename SLOT>
115 void AddItem(
const QString &title,
const SLOT &slot,
116 MythMenu *subMenu =
nullptr,
bool selected =
false,
117 bool checked =
false)
121 auto *item =
new MythMenuItem(title, slot2, checked, subMenu);
122 AddItem(item, selected, subMenu);
125 template <
typename SLOT>
126 void AddItem(
const QString &title,
const SLOT &slot,
127 MythMenu *subMenu =
nullptr,
bool selected =
false,
128 bool checked =
false)
132 auto *item =
new MythMenuItem(title, slot2, checked, subMenu);
133 AddItem(item, selected, subMenu);
136 void SetSelectedByTitle(
const QString &title);
137 void SetSelectedByData(
const QVariant& data);
141 bool IsEmpty() {
return m_menuItems.isEmpty(); }
153 int m_selectedItem {0};
170 bool fullscreen =
false,
bool osd =
false)
172 m_osdDialog(osd), m_text(std::move(text)) {}
175 bool fullscreen =
false,
bool osd =
false)
177 m_osdDialog(osd), m_title(std::move(title)),m_text(std::move(text)) {}
179 bool fullscreen =
false,
bool osd =
false)
181 m_osdDialog(osd), m_menu(
menu), m_currentMenu(
menu) {}
184 bool Create(
void)
override;
188 void SetReturnEvent(QObject *retobject,
const QString &resultid);
189 void SetBackAction(
const QString &text, QVariant data);
190 void SetExitAction(
const QString &text, QVariant data);
191 void SetText(
const QString &text);
193 void AddButtonV(
const QString &title, QVariant data = 0,
194 bool newMenu =
false,
bool setCurrent =
false);
195 void AddButtonD(
const QString &title,
bool setCurrent) { AddButtonV(title, 0,
false, setCurrent); }
196 void AddButton(
const QString &title) { AddButtonV(title, 0,
false,
false); }
199 bool newMenu =
false,
bool setCurrent =
false)
201 AddButtonV(title, QVariant::fromValue(slot), newMenu, setCurrent);
205 template <
typename SLOT>
207 bool newMenu =
false,
bool setCurrent =
false)
211 AddButtonV(title, QVariant::fromValue(slot2), newMenu, setCurrent);
215 template <
typename SLOT>
217 bool newMenu =
false,
bool setCurrent =
false)
221 AddButtonV(title, QVariant::fromValue(slot2), newMenu, setCurrent);
225 bool keyPressEvent(QKeyEvent *event)
override;
226 bool inputMethodEvent(QInputMethodEvent *event)
override;
237 void SendEvent(
int res,
const QString& text =
"",
const QVariant& data = 0);
238 void updateMenu(
void);
243 QObject *m_retObject {
nullptr};
245 bool m_useSlots {
false};
247 bool m_fullscreen {
false};
248 bool m_osdDialog {
false};
253 QVariant m_backdata {0};
255 QVariant m_exitdata {0};
276 bool showCancel =
true)
278 m_message(std::move(message)), m_showCancel(showCancel) {}
280 bool Create(
void)
override;
281 void SetReturnEvent(QObject *retobject,
const QString &resultid);
282 void SetData(QVariant data) { m_resultData = std::move(data); }
283 void SetMessage(
const QString &message);
285 bool keyPressEvent(QKeyEvent *event)
override;
291 void sendResult(
bool ok);
294 bool m_showCancel {
true};
295 QObject *m_retObject {
nullptr};
319 bool isPassword =
false,
320 QString defaultValue =
"")
322 m_message(std::move(message)), m_defaultValue(std::move(defaultValue)),
323 m_filter(filter), m_isPassword(isPassword) {}
325 bool Create(
void)
override;
326 void SetReturnEvent(QObject *retobject,
const QString &resultid);
336 bool m_isPassword {
false};
337 QObject *m_retObject {
nullptr};
360 bool Create(
void)
override;
361 void SetReturnEvent(QObject *retobject,
const QString &resultid);
363 void SetRange(
int low,
int high,
int step,
uint pageMultiple=5);
364 void AddSelection(
const QString& label,
int value);
365 void SetValue(
const QString & value);
366 void SetValue(
int value);
375 QObject *m_retObject {
nullptr };
414 bool matchAnywhere =
false,
415 QString defaultValue =
"")
417 m_title(std::move(title)),
418 m_defaultValue(std::move(defaultValue)),
419 m_list(std::move(list)),
420 m_matchAnywhere(matchAnywhere),
423 bool Create(
void)
override;
424 void SetReturnEvent(QObject *retobject,
const QString &resultid);
438 bool m_matchAnywhere {
false };
440 QObject *m_retObject {
nullptr };
444 void slotSendResult(
void);
445 void slotUpdateList(
void);
475 kFutureDates = 0x100,
482 QDateTime startTime = QDateTime::currentDateTime(),
483 int rangeLimit = 14);
485 bool Create()
override;
486 void SetReturnEvent(QObject *retobject,
const QString &resultid);
492 void okClicked(
void);
505 QObject *m_retObject {
nullptr };
510template <
class OBJ,
typename FUNC>
512 FUNC slot,
bool showCancel =
false)
515 if (pop !=
nullptr && parent !=
nullptr)
518 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)
void AddButton(const QString &title)
MythDialogBox(MythMenu *menu, MythScreenStack *parent, const char *name, bool fullscreen=false, bool osd=false)
void AddButton(const QString &title, const MythUICallbackNMF &slot, bool newMenu=false, bool setCurrent=false)
void AddButton(const QString &title, const SLOT &slot, bool newMenu=false, bool setCurrent=false)
void AddButtonD(const QString &title, bool setCurrent)
void Closed(QString, int)
void AddButton(const QString &title, const SLOT &slot, bool newMenu=false, bool setCurrent=false)
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
constexpr bool is_nonconst_member_func_v
constexpr bool is_const_member_func_v
std::function< void(void)> MythUICallbackNMF