Skip to content

Commit

Permalink
Switch the time search list to use MythTimeInputDialog and remove the…
Browse files Browse the repository at this point in the history
… old TimePopup
  • Loading branch information
stuartm committed Feb 12, 2012
1 parent 75fc713 commit f1aee8c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 158 deletions.
6 changes: 5 additions & 1 deletion mythtv/programs/mythfrontend/proglist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,11 @@ void ProgLister::ShowChooseViewMenu(void)
(m_curView >= 0) ? m_viewList[m_curView] : QString());
break;
case plTime:
screen = new TimePopup(popupStack, this);
QString message = tr("Start search from date and time");
int flags = (MythTimeInputDialog::kDay |
MythTimeInputDialog::kHours |
MythTimeInputDialog::kFutureDates);
screen = new MythTimeInputDialog(popupStack, message, flags);
connect_string = false;
break;
}
Expand Down
76 changes: 0 additions & 76 deletions mythtv/programs/mythfrontend/proglist_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,82 +225,6 @@ void PhrasePopup::recordClicked(void)

///////////////////////////////////////////////////////////////////////////////

TimePopup::TimePopup(MythScreenStack *parentStack, ProgLister *parent)
: MythScreenType(parentStack, "timepopup"),
m_parent(parent), m_dateList(NULL), m_timeList(NULL),
m_okButton(NULL)
{
}

bool TimePopup::Create()
{
if (!LoadWindowFromXML("schedule-ui.xml", "timepopup", this))
return false;

bool err = false;
UIUtilE::Assign(this, m_dateList, "date_list", &err);
UIUtilE::Assign(this, m_timeList, "time_list", &err);
UIUtilE::Assign(this, m_okButton, "ok_button", &err);

if (err)
{
LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'timepopup'");
return false;
}

// date
for (int x = -1; x <= 14; x++)
{
QString text = MythDateTimeToString(m_parent->m_startTime.addDays(x),
kDateFull | kSimplify);
new MythUIButtonListItem(
m_dateList, text,
NULL, false);

if (m_parent->m_startTime.addDays(x).toString("MMdd") ==
m_parent->m_searchTime.toString("MMdd"))
m_dateList->SetItemCurrent(m_dateList->GetCount() - 1);
}

// time
QTime hr;
for (int x = 0; x < 24; x++)
{
hr.setHMS(x, 0, 0);
QString text = MythTimeToString(hr, kTime);
new MythUIButtonListItem(m_timeList, text, NULL, false);

if (hr.toString("hh") == m_parent->m_searchTime.toString("hh"))
m_timeList->SetItemCurrent(x);
}

connect(m_okButton, SIGNAL(Clicked()), this, SLOT(okClicked()));

BuildFocusList();

SetFocusWidget(m_dateList);

return true;
}

void TimePopup::okClicked(void)
{
QDateTime startTime = m_parent->m_startTime;
int dayOffset = m_dateList->GetCurrentPos() -1;

startTime.setDate(startTime.addDays(dayOffset).date());

QTime hr;
hr.setHMS(m_timeList->GetCurrentPos(), 0, 0);
startTime.setTime(hr);

emit haveResult(startTime);

Close();
}

//////////////////////////////////////////////////////////////////////////////

PowerSearchPopup::PowerSearchPopup(MythScreenStack *parentStack,
ProgLister *parent,
RecSearchType searchType,
Expand Down
25 changes: 0 additions & 25 deletions mythtv/programs/mythfrontend/proglist_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,6 @@ class PhrasePopup : public MythScreenType
MythUIButton *m_recordButton;
};

class TimePopup : public MythScreenType
{
Q_OBJECT

public:
TimePopup(MythScreenStack *parentStack, ProgLister *parent);

bool Create();

signals:
void haveResult(QDateTime time);

private slots:
void okClicked(void);

private:
ProgLister *m_parent;
QStringList m_list;
QString m_currentValue;

MythUIButtonList *m_dateList;
MythUIButtonList *m_timeList;
MythUIButton *m_okButton;
};

class PowerSearchPopup : public MythScreenType
{
Q_OBJECT
Expand Down
28 changes: 0 additions & 28 deletions mythtv/themes/default-wide/schedule-ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -974,34 +974,6 @@

</window>

<window name="timepopup">
<area>-1,-1,580,165</area>

<imagetype name="box">
<filename>mythprogressdialog-background.png</filename>
</imagetype>

<textarea name="title" from="basetextarea">
<area>0,10,580,40</area>
<font>baselarge</font>
<align>hcenter,top</align>
<value>Select Time</value>
</textarea>

<buttonlist name="date_list" from="baseselector">
<position>40,60</position>
</buttonlist>

<buttonlist name="time_list" from="baseselector">
<position>330,60</position>
</buttonlist>

<button name="ok_button" from="basebutton">
<position>220,115</position>
</button>

</window>

<window name="powersearchpopup">
<area>-1,-1,500,500</area>

Expand Down
28 changes: 0 additions & 28 deletions mythtv/themes/default/schedule-ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,34 +1048,6 @@

</window>

<window name="timepopup">
<area>-1,-1,580,165</area>

<imagetype name="box">
<filename>mythprogressdialog-background.png</filename>
</imagetype>

<textarea name="title" from="basetextarea">
<area>0,10,580,40</area>
<font>baselarge</font>
<align>hcenter,top</align>
<value>Select Time</value>
</textarea>

<buttonlist name="date_list" from="baseselector">
<position>40,60</position>
</buttonlist>

<buttonlist name="time_list" from="baseselector">
<position>330,60</position>
</buttonlist>

<button name="ok_button" from="basebutton">
<position>220,115</position>
</button>

</window>

<window name="powersearchpopup">
<area>-1,-1,500,500</area>

Expand Down

0 comments on commit f1aee8c

Please sign in to comment.