void ProgFinder::Init(void) { m_allowKeypress = true; initAlphabetList(); gCoreContext->addListener(this); connect(m_timesList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(updateInfo())); connect(m_timesList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(select())); connect(m_timesList, SIGNAL(LosingFocus()), SLOT(timesListLosingFocus())); connect(m_timesList, SIGNAL(TakingFocus()), SLOT(timesListTakeFocus())); connect(m_alphabetList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(alphabetListItemSelected(MythUIButtonListItem*))); connect(m_alphabetList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(select())); connect(m_showList, SIGNAL(TakingFocus()), SLOT(showListTakeFocus())); connect(m_showList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(select())); m_alphabetList->MoveToNamedPosition("A"); }
MythUITextEdit::MythUITextEdit(MythUIType *parent, const QString &name) : MythUIType(parent, name) { m_Message = ""; m_Filter = FilterNone; m_isPassword = false; m_blinkInterval = 0; m_cursorBlinkRate = 40; m_Position = -1; m_maxLength = 255; m_backgroundState = NULL; m_cursorImage = NULL; m_Text = NULL; m_keyboardPosition = VK_POSBELOWEDIT; connect(this, SIGNAL(TakingFocus()), SLOT(Select())); connect(this, SIGNAL(LosingFocus()), SLOT(Deselect())); m_CanHaveFocus = true; m_initialized = false; m_lastKeyPress.start(); }
void MythUIButton::Select() { if (!IsEnabled() || m_Pushed) return; SetState("selected"); emit TakingFocus(this); }
bool MythUIType::TakeFocus(void) { if (!m_CanHaveFocus || m_HasFocus) return false; m_HasFocus = true; Refresh(); emit TakingFocus(); return true; }
bool SourceSetup::Create() { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("weather-ui.xml", "source-setup", this); if (!foundtheme) return false; m_sourceList = dynamic_cast<MythUIButtonList *> (GetChild("srclist")); m_updateSpinbox = dynamic_cast<MythUISpinBox *> (GetChild("update_spinbox")); m_retrieveSpinbox = dynamic_cast<MythUISpinBox *> (GetChild("retrieve_spinbox")); m_finishButton = dynamic_cast<MythUIButton *> (GetChild("finishbutton")); m_sourceText = dynamic_cast<MythUIText *> (GetChild("srcinfo")); if (!m_sourceList || !m_updateSpinbox || !m_retrieveSpinbox || !m_finishButton || !m_sourceText) { LOG(VB_GENERAL, LOG_ERR, "Theme is missing required elements."); return false; } BuildFocusList(); SetFocusWidget(m_sourceList); connect(m_sourceList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(sourceListItemSelected(MythUIButtonListItem *))); #if 0 connect(m_sourceList, SIGNAL(TakingFocus()), this, SLOT(sourceListItemSelected())); #endif // 12 Hour max interval m_updateSpinbox->SetRange(10, 720, 10); connect(m_updateSpinbox, SIGNAL(LosingFocus()), SLOT(updateSpinboxUpdate())); // 2 Minute retrieval timeout max m_retrieveSpinbox->SetRange(10, 120, 5); connect(m_retrieveSpinbox, SIGNAL(LosingFocus()), SLOT(retrieveSpinboxUpdate())); m_finishButton->SetText(tr("Finish")); connect(m_finishButton, SIGNAL(Clicked()), SLOT(saveData())); loadData(); return true; }
MythUICheckBox::MythUICheckBox(MythUIType *parent, const QString &name) : MythUIType(parent, name) { m_currentCheckState = MythUIStateType::Off; m_state = "active"; m_BackgroundState = m_CheckState = NULL; connect(this, SIGNAL(TakingFocus()), this, SLOT(Select())); connect(this, SIGNAL(LosingFocus()), this, SLOT(Deselect())); connect(this, SIGNAL(Enabling()), this, SLOT(Enable())); connect(this, SIGNAL(Disabling()), this, SLOT(Disable())); SetCanTakeFocus(true); }
MythUIButtonTree::MythUIButtonTree(MythUIType *parent, const QString &name) : MythUIType(parent, name) { m_initialized = false; m_numLists = 1; m_visibleLists = 0; m_currentDepth = m_oldDepth = m_depthOffset = 0; m_rootNode = m_currentNode = NULL; m_listSpacing = 0; m_activeList = NULL; m_activeListID = 0; m_active = true; m_listTemplate = NULL; SetCanTakeFocus(true); connect(this, SIGNAL(TakingFocus()), this, SLOT(Select())); connect(this, SIGNAL(LosingFocus()), this, SLOT(Deselect())); }
MythUIButton::MythUIButton(MythUIType *parent, const QString &name) : MythUIType(parent, name) { m_clickTimer = new QTimer(); m_clickTimer->setSingleShot(true); m_Pushed = false; m_Lockable = false; m_Text = NULL; m_BackgroundState = NULL; connect(m_clickTimer, SIGNAL(timeout()), SLOT(UnPush())); connect(this, SIGNAL(TakingFocus()), SLOT(Select())); connect(parent, SIGNAL(LosingFocus()), SLOT(Deselect())); connect(this, SIGNAL(LosingFocus()), SLOT(Deselect())); connect(this, SIGNAL(Enabling()), SLOT(Enable())); connect(this, SIGNAL(Disabling()), SLOT(Disable())); SetCanTakeFocus(true); }
/** * \brief Loads UI elements from theme * * \return true if all UI elements load successfully. */ bool MythControls::Create(void) { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("controls-ui.xml", "controls", this); if (!foundtheme) return false; m_description = dynamic_cast<MythUIText *>(GetChild("description")); m_leftList = dynamic_cast<MythUIButtonList *>(GetChild("leftlist")); m_rightList = dynamic_cast<MythUIButtonList *>(GetChild("rightlist")); m_leftDescription = dynamic_cast<MythUIText *>(GetChild("leftdesc")); m_rightDescription = dynamic_cast<MythUIText *>(GetChild("rightdesc")); if (!m_description || !m_leftList || !m_rightList || !m_leftDescription || !m_rightDescription) { LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements."); return false; } connect(m_leftList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(LeftSelected(MythUIButtonListItem*))); connect(m_leftList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(LeftPressed(MythUIButtonListItem*))); connect(m_rightList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(RightSelected(MythUIButtonListItem*))); connect(m_rightList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(RightPressed(MythUIButtonListItem*))); connect(m_rightList, SIGNAL(TakingFocus()), SLOT(RefreshKeyInformation())); for (uint i = 0; i < Action::kMaximumNumberOfBindings; i++) { MythUIButton *button = dynamic_cast<MythUIButton *> (GetChild(QString("action_%1").arg(i))); if (!button) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Unable to load action button action_%1").arg(i)); return false; } connect(button, SIGNAL(Clicked()), SLOT(ActionButtonPressed())); m_actionButtons.append(button); } BuildFocusList(); LoadData(gCoreContext->GetHostName()); /* start off with the actions by contexts view */ m_currentView = kActionsByContext; SetListContents(m_leftList, m_bindings->GetContexts(), true); UpdateRightList(); return true; }