mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
- fix pagedown logic, but this time for real (i hope)
Why this was so difficult code? I don't know.
This commit is contained in:
@@ -292,13 +292,11 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
|||||||
if (!(Bouquets->empty())) {
|
if (!(Bouquets->empty())) {
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = selected + step;
|
int new_selected = selected + step;
|
||||||
if (new_selected >= (int) Bouquets->size()) {
|
if (new_selected > (int) Bouquets->size() - 1) {
|
||||||
if (((Bouquets->size() - listmaxshow -1 < selected) && (step != 1)) || (selected != (Bouquets->size() - 1)))
|
if ((selected != Bouquets->size() - 1))
|
||||||
new_selected = Bouquets->size() - 1;
|
new_selected = Bouquets->size() - 1;
|
||||||
else if (((Bouquets->size() / listmaxshow) + 1) * listmaxshow == Bouquets->size() + listmaxshow) // last page has full entries
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
else
|
||||||
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((Bouquets->size() / listmaxshow)+1) * listmaxshow))) ? (Bouquets->size() - 1) : 0;
|
new_selected = 0;
|
||||||
}
|
}
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
|
@@ -380,14 +380,12 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
|
|||||||
if (!(Channels->empty())) {
|
if (!(Channels->empty())) {
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = selected + step;
|
int new_selected = selected + step;
|
||||||
if (new_selected >= (int) Channels->size()) {
|
if (new_selected > (int) Channels->size() - 1) {
|
||||||
if (((Channels->size() - listmaxshow -1 < selected) && (step != 1)) || (selected != (Channels->size() - 1)))
|
if ((selected != Channels->size() - 1))
|
||||||
new_selected = Channels->size() - 1;
|
new_selected = Channels->size() - 1;
|
||||||
else if (((Channels->size() / listmaxshow) + 1) * listmaxshow == Channels->size() + listmaxshow) // last page has full entries
|
else
|
||||||
new_selected = 0;
|
new_selected = 0;
|
||||||
else
|
}
|
||||||
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((Channels->size() / listmaxshow)+1) * listmaxshow))) ? (Channels->size() - 1) : 0;
|
|
||||||
}
|
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -546,13 +546,11 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
if (!Bouquets.empty()) {
|
if (!Bouquets.empty()) {
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = selected + step;
|
int new_selected = selected + step;
|
||||||
if (new_selected >= (int) Bouquets.size()) {
|
if (new_selected > (int) Bouquets.size() - 1) {
|
||||||
if (((Bouquets.size() - listmaxshow -1 < selected) && (step != 1)) || (selected != (Bouquets.size() - 1)))
|
if ((selected != Bouquets.size() - 1))
|
||||||
new_selected = Bouquets.size() - 1;
|
new_selected = Bouquets.size() - 1;
|
||||||
else if (((Bouquets.size() / listmaxshow) + 1) * listmaxshow == Bouquets.size() + listmaxshow) // last page has full entries
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
else
|
||||||
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((Bouquets.size() / listmaxshow)+1) * listmaxshow))) ? (Bouquets.size() - 1) : 0;
|
new_selected = 0;
|
||||||
}
|
}
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
|
@@ -742,13 +742,11 @@ int CChannelList::show()
|
|||||||
displayList = 1;
|
displayList = 1;
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = selected + step;
|
int new_selected = selected + step;
|
||||||
if (new_selected >= (int) (*chanlist).size()) {
|
if (new_selected > (int) (*chanlist).size() - 1) {
|
||||||
if ((((*chanlist).size() - listmaxshow -1 < selected) && (step != 1)) || (selected != ((*chanlist).size() - 1)))
|
if ((selected != (*chanlist).size() - 1))
|
||||||
new_selected = (*chanlist).size() - 1;
|
new_selected = (*chanlist).size() - 1;
|
||||||
else if ((((*chanlist).size() / listmaxshow) + 1) * listmaxshow == (*chanlist).size() + listmaxshow) // last page has full entries
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
else
|
||||||
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) ((((*chanlist).size() / listmaxshow)+1) * listmaxshow))) ? ((*chanlist).size() - 1) : 0;
|
new_selected = 0;
|
||||||
}
|
}
|
||||||
actzap = updateSelection(new_selected);
|
actzap = updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
|
@@ -504,13 +504,11 @@ void CUpnpBrowserGui::selectDevice()
|
|||||||
{
|
{
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = m_selecteddevice + step;
|
int new_selected = m_selecteddevice + step;
|
||||||
if (new_selected >= (int) m_devices.size()) {
|
if (new_selected > (int) m_devices.size() - 1) {
|
||||||
if (((m_devices.size() - m_listmaxshow -1 < m_selecteddevice) && (step != 1)) || (m_selecteddevice != (m_devices.size() - 1)))
|
if ((m_selecteddevice != m_devices.size() - 1))
|
||||||
new_selected = m_devices.size() - 1;
|
new_selected = m_devices.size() - 1;
|
||||||
else if (((m_devices.size() / m_listmaxshow) + 1) * m_listmaxshow == m_devices.size() + m_listmaxshow) // last page has full entries
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
else
|
||||||
new_selected = ((step == (int) m_listmaxshow) && (new_selected < (int) (((m_devices.size() / m_listmaxshow)+1) * m_listmaxshow))) ? (m_devices.size() - 1) : 0;
|
new_selected = 0;
|
||||||
}
|
}
|
||||||
updateDeviceSelection(new_selected);
|
updateDeviceSelection(new_selected);
|
||||||
}
|
}
|
||||||
|
@@ -208,13 +208,11 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
|||||||
if(getItemCount()!=0) {
|
if(getItemCount()!=0) {
|
||||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
int new_selected = selected + step;
|
int new_selected = selected + step;
|
||||||
if (new_selected >= (int) getItemCount()) {
|
if (new_selected > (int) getItemCount() - 1) {
|
||||||
if (((getItemCount() - listmaxshow -1 < selected) && (step != 1)) || (selected != (getItemCount() - 1)))
|
if ((selected != getItemCount() - 1))
|
||||||
new_selected = getItemCount() - 1;
|
new_selected = getItemCount() - 1;
|
||||||
else if (((getItemCount() / listmaxshow) + 1) * listmaxshow == getItemCount() + listmaxshow) // last page has full entries
|
|
||||||
new_selected = 0;
|
|
||||||
else
|
else
|
||||||
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((getItemCount() / listmaxshow)+1) * listmaxshow))) ? (getItemCount() - 1) : 0;
|
new_selected = 0;
|
||||||
}
|
}
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user