4 #include <QCoreApplication> 27 (QEvent::Type) QEvent::registerEventType();
31 m_parentMenu(nullptr), m_title(
""), m_text(text), m_resultid(resultid), m_retObject(retobject), m_selectedItem(0)
36 MythMenu::MythMenu(
const QString &title,
const QString &text, QObject *retobject,
const QString &resultid) :
37 m_parentMenu(nullptr), m_title(title), m_text(text), m_resultid(resultid), m_retObject(retobject), m_selectedItem(0)
58 AddItem(item, selected, subMenu);
64 AddItem(item, selected, subMenu);
68 MythMenu *subMenu,
bool selected,
bool checked)
71 AddItem(item, selected, subMenu);
87 QList<MythMenuItem*>::iterator it =
m_menuItems.begin();
94 if (item->
Text == title)
104 QList<MythMenuItem*>::iterator it =
m_menuItems.begin();
111 if (item->
Data == data)
123 bool fullscreen,
bool osd)
146 bool fullscreen,
bool osd)
170 bool fullscreen,
bool osd)
203 QString windowName = (
m_fullscreen ?
"MythDialogBox" :
"MythPopupBox");
220 LOG(VB_GENERAL, LOG_ERR, QString(
"Cannot load screen '%1'")
251 LOG(VB_GENERAL, LOG_ERR,
"UpdateMenu() called before we have a button list to update!");
269 button->
SetData(qVariantFromValue(menuItem));
300 const char *slot = menuItem->
Data.value <
const char * >();
304 Qt::QueuedConnection);
311 Qt::QueuedConnection);
322 const char *slot = item->
GetData().value<
const char *>();
326 Qt::QueuedConnection);
333 Qt::QueuedConnection);
346 const QString &resultid)
385 bool newMenu,
bool setCurrent)
392 button->
SetData(qVariantFromValue(slot));
407 bool handled =
false;
411 for (
int i = 0; i < actions.size() && !handled; i++)
413 QString
action = actions[i];
422 else if ((
action ==
"LEFT" &&
437 else if (
action ==
"MENU")
442 else if ((
action ==
"RIGHT" &&
461 bool handled =
false;
510 const QString &message,
537 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythConfirmationDialog'");
543 connect(cancelButton, SIGNAL(Clicked()), SLOT(
Cancel()));
548 connect(okButton, SIGNAL(Clicked()), SLOT(
Confirm()));
567 bool handled =
false;
571 for (
int i = 0; i < actions.size() && !handled; i++)
573 QString
action = actions[i];
596 const QString &resultid)
635 const char *slot,
bool showCancel)
637 QString
LOC =
"ShowOkPopup('" + message +
"') - ";
647 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no main window?");
653 LOG(VB_GENERAL, LOG_ERR,
LOC +
"no popup stack? " 654 "Is there a MythThemeBase?");
663 QObject::connect(pop, SIGNAL(haveResult(
bool)), parent, slot,
664 Qt::QueuedConnection);
670 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Couldn't Create() Dialog");
679 const QString &message,
682 const QString &defaultValue)
712 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTextInputDialog'");
717 connect(cancelButton, SIGNAL(Clicked()), SLOT(
Close()));
718 connect(okButton, SIGNAL(Clicked()), SLOT(
sendResult()));
732 const QString &resultid)
756 const QString &message)
760 m_retObject(nullptr),
782 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSpinBoxDialog'");
787 connect(cancelButton, SIGNAL(Clicked()), SLOT(
Close()));
788 connect(okButton, SIGNAL(Clicked()), SLOT(
sendResult()));
831 const QString &resultid)
870 const QString &title,
871 const QStringList &list,
873 const QString &defaultValue)
908 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythSearchDialog'");
913 connect(cancelButton, SIGNAL(Clicked()), SLOT(
Close()));
935 const QString &resultid)
964 for (
int x = 0; x <
m_list.size(); x++)
966 QString item =
m_list.at(x);
992 const QString &message,
997 m_message(message), m_startTime(startTime),
998 m_resolution(resolutionFlags), m_rangeLimit(rangeLimit),
999 m_dateList(nullptr), m_timeList(nullptr), m_retObject(nullptr)
1019 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'MythTimeInputDialog'");
1030 const QDate startdate(
m_startTime.toLocalTime().date());
1031 QDate date(startdate);
1046 bool selected =
false;
1047 for (
int x = 0; x <= limit; x++)
1052 date = date.addDays(1);
1058 if (date == startdate)
1063 date = date.addMonths(1);
1064 text = date.toString(
"MMM yyyy");
1066 if ((date.month() == startdate.month()) &&
1067 (date.year() == startdate.year()))
1072 date = date.addYears(1);
1073 text = date.toString(
"yyyy");
1074 if (date.year() == startdate.year())
1079 item->
SetData(QVariant(date));
1090 QDate startdate(
m_startTime.toLocalTime().date());
1091 QTime starttime(
m_startTime.toLocalTime().time());
1094 bool selected =
false;
1098 for (
int x = 0; x < limit; x++)
1103 time = time.addSecs(60);
1104 QDateTime dt = QDateTime(startdate, time, Qt::LocalTime);
1107 if (time == starttime)
1112 time = time.addSecs(60*60);
1113 text = time.toString(
"hh:00");
1115 if (time.hour() == starttime.hour())
1120 item->
SetData(QVariant(time));
1128 if (messageText && !
m_message.isEmpty())
1131 connect(okButton, SIGNAL(Clicked()), SLOT(
okClicked()));
1139 const QString& resultid)
1150 QDateTime dateTime = QDateTime(date, time, Qt::LocalTime).toUTC();
1156 QVariant data(dateTime);
MythConfirmationDialog(MythScreenStack *parent, const QString &message, bool showCancel=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.
void SetMessage(const QString &message)
void AddSelection(QString label, int value)
Dialog asking for user confirmation.
void SetBackAction(const QString &text, QVariant data)
MythTextInputDialog(MythScreenStack *parent, const QString &message, InputFilter filter=FilterNone, bool isPassword=false, const QString &defaultValue="")
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
MythUIText * m_messageText
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
All purpose text widget, displays a text string.
MythUIButtonList * m_itemList
QString GetValue(void) const override
void slotSendResult(void)
void Select(MythUIButtonListItem *item)
MythSpinBoxDialog(MythScreenStack *parent, const QString &message)
void SetFilter(InputFilter filter)
virtual void SetText(const QString &text)
MythScreenStack * GetStack(const QString &stackname)
void SetValue(int val) override
MythScreenStack * GetMainStack()
Gesture gesture(void) const
Get the gesture type.
static MythThemedMenu * menu
void BuildFocusList(void)
bool gestureEvent(MythGestureEvent *) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
MythUISpinBox * m_spinBox
void AddButton(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.
bool Create(void) override
virtual void SetVisible(bool visible)
MythDialogBox(const QString &text, MythScreenStack *parent, const char *name, bool fullscreen=false, bool osd=false)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
virtual MythScreenType * GetTopScreen(void) const
A C++ ripoff of the stroke library for MythTV.
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
void SetReturnEvent(QObject *retobject, const QString &resultid)
void SetReturnEvent(QObject *retobject, const QString &resultid)
MythUIButtonList * m_buttonList
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Do Today/Yesterday/Tomorrow transform.
A custom event that represents a mouse gesture.
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void SetText(const QString &text, bool moveCursor=true)
MythUIType * GetFocusWidget(void) const
MythMainWindow * GetMythMainWindow(void)
bool keyPressEvent(QKeyEvent *) override
Key event handler.
#define LOG(_MASK_, _LEVEL_, _STRING_)
void SetMenuItems(MythMenu *menu)
Button GetButton(void) const
void SetExitAction(const QString &text, QVariant data)
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
MythScreenStack * m_ScreenStack
bool Create(void) override
bool Create(void) override
void slotUpdateList(void)
void SetReturnEvent(QObject *retobject, const QString &resultid)
void SetText(const QString &text)
void SetPassword(bool isPassword)
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
bool SetFocusWidget(MythUIType *widget=nullptr)
Add year to string if not included.
void SetValue(const QString &value)
Can be called only after MythSpinBoxDialog::Create() return successfully The range need to be set bef...
MythUISearchDialog(MythScreenStack *parent, const QString &title, const QStringList &list, bool matchAnywhere=false, const QString &defaultValue="")
the classes constructor
Screen in which all other widgets are contained and rendered.
MythUITextEdit * m_textEdit
MythUIText * m_matchesText
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
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
std::function< void(void)> MythUIButtonCallback
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void SetReturnEvent(QObject *retobject, const QString &resultid)
void Closed(QString, int)
void SetReturnEvent(QObject *retobject, const QString &resultid)
QString GetText(void) const
void SendEvent(int res, QString text="", QVariant data=0)
bool Create(void) override
MythUITextEdit * m_textEdit