Ticket #12071: 0002-MythNetvision-Add-page-navigation.patch

File 0002-MythNetvision-Add-page-navigation.patch, 4.3 KB (added by angela.schmid@…, 10 years ago)
  • mythplugins/mythnetvision/mythnetvision/main.cpp

    From c15766559633cb76caa48df1359144991281b6ca Mon Sep 17 00:00:00 2001
    From: angelaschmid <angela.schmid@wolke7.net>
    Date: Sat, 31 May 2014 15:21:24 +0200
    Subject: [PATCH] MythNetvision: Add page navigation.
    
    Implemented page navigation previous/next and 10 pages previous/next.
    ---
     mythplugins/mythnetvision/mythnetvision/main.cpp   |  5 +++
     .../mythnetvision/mythnetvision/netsearch.cpp      | 44 +++++++++++++++++++---
     .../mythnetvision/mythnetvision/netsearch.h        |  2 +
     3 files changed, 45 insertions(+), 6 deletions(-)
    
    diff --git a/mythplugins/mythnetvision/mythnetvision/main.cpp b/mythplugins/mythnetvision/mythnetvision/main.cpp
    index 4960ef3..cd9fe9a 100644
    a b static void setupKeys(void) 
    7878        "Internet Television Client - Search"), "", runNetVision);
    7979    REG_JUMP("MythNetTree", QT_TRANSLATE_NOOP("MythControls",
    8080        "Internet Television Client - Site/Tree View"), "", runNetTree);
     81
     82    REG_KEY("Internet Video", "PAGELEFT", QT_TRANSLATE_NOOP("MythControls",
     83            "Previous Page"), ",,<");
     84    REG_KEY("Internet Video", "PAGERIGHT", QT_TRANSLATE_NOOP("MythControls",
     85            "Next Page"), ">,.");
    8186}
    8287
    8388int mythplugin_init(const char *libversion)
  • mythplugins/mythnetvision/mythnetvision/netsearch.cpp

    diff --git a/mythplugins/mythnetvision/mythnetvision/netsearch.cpp b/mythplugins/mythnetvision/mythnetvision/netsearch.cpp
    index 20a8c00..0452da6 100644
    a b bool NetSearch::keyPressEvent(QKeyEvent *event) 
    177177        if (action == "MENU")
    178178        {
    179179            showMenu();
     180        } else if (action == "PAGELEFT" && m_pagenum > 1)
     181        {
     182            skipPagesBack();
     183        } else if (action == "PAGERIGHT" && m_searchResultList->GetCount() > 0 && m_pagenum + 10 < m_maxpage)
     184        {
     185            skipPagesForward();
     186        } else if (action == "PREVVIEW" && m_pagenum > 1)
     187        {
     188            getLastResults();
     189        } else if (action == "NEXTVIEW" && m_searchResultList->GetCount() > 0 && m_pagenum < m_maxpage)
     190        {
     191            getMoreResults();
    180192        }
    181193        else
    182194            handled = false;
    void NetSearch::showMenu(void) 
    258270                    menuPopup->AddButton(tr("Delete"), SLOT(slotDeleteVideo()));
    259271                }
    260272            }
    261 
    262             if (m_pagenum > 1)
    263                 menuPopup->AddButton(tr("Previous Page"), SLOT(getLastResults()));
    264             if (m_searchResultList->GetCount() > 0 && m_pagenum < m_maxpage)
    265                 menuPopup->AddButton(tr("Next Page"), SLOT(getMoreResults()));
    266273        }
    267         menuPopup->AddButton(tr("Manage Search Scripts"), SLOT(runSearchEditor()));
    268274
     275        if (m_pagenum > 1)
     276            menuPopup->AddButton(tr("Previous Page"), SLOT(getLastResults()));
     277        if (m_searchResultList->GetCount() > 0 && m_pagenum < m_maxpage)
     278            menuPopup->AddButton(tr("Next Page"), SLOT(getMoreResults()));
     279        if (m_pagenum > 1)
     280            menuPopup->AddButton(tr("Skip 10 Pages back"), SLOT(skipPagesBack()));
     281        if (m_searchResultList->GetCount() > 0 && m_pagenum < m_maxpage)
     282            menuPopup->AddButton(tr("Skip 10 Pages forward"), SLOT(skipPagesForward()));
     283
     284        menuPopup->AddButton(tr("Manage Search Scripts"), SLOT(runSearchEditor()));
    269285    }
    270286    else
    271287    {
    void NetSearch::getMoreResults() 
    386402    m_reply = m_netSearch->get(QNetworkRequest(req));
    387403}
    388404
     405void NetSearch::skipPagesBack()
     406{
     407    if (m_pagenum < 11)
     408        m_pagenum = 2;
     409    else
     410        m_pagenum = m_pagenum - 10 + 1;
     411
     412    getLastResults();
     413}
     414
     415void NetSearch::skipPagesForward()
     416{
     417    m_pagenum = m_pagenum + 10 - 1;
     418    getMoreResults();
     419}
     420
    389421void NetSearch::searchFinished(void)
    390422{
    391423    if (m_busyPopup)
  • mythplugins/mythnetvision/mythnetvision/netsearch.h

    diff --git a/mythplugins/mythnetvision/mythnetvision/netsearch.h b/mythplugins/mythnetvision/mythnetvision/netsearch.h
    index 140bce0..246cd80 100644
    a b class NetSearch : public MythScreenType 
    9191    void showMenu(void);
    9292    void getMoreResults();
    9393    void getLastResults();
     94    void skipPagesBack();
     95    void skipPagesForward();
    9496    void runSearchEditor();
    9597    void doListRefresh();
    9698