From 31418fd4e437a8d3f075eb194e09f71a68ceb23f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 27 Feb 2020 21:23:47 +0100 Subject: [PATCH] hide hintbox with selectResult menu Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ae49f0814761468c6a3e8101c14586ab67b3de4b Author: Jacek Jendrzej Date: 2020-02-27 (Thu, 27 Feb 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/tmdb.cpp | 21 ++++++++++++++++----- src/gui/tmdb.h | 3 ++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gui/tmdb.cpp b/src/gui/tmdb.cpp index d424918ec..0e4ea2223 100644 --- a/src/gui/tmdb.cpp +++ b/src/gui/tmdb.cpp @@ -37,7 +37,6 @@ #include "system/settings.h" #include "system/set_threadname.h" -#include "gui/widget/hintbox.h" #include @@ -60,6 +59,7 @@ cTmdb::cTmdb() #else key = g_settings.tmdb_api_key; #endif + hintbox = NULL; } cTmdb::~cTmdb() @@ -71,15 +71,19 @@ void cTmdb::setTitle(std::string epgtitle) { minfo.epgtitle = epgtitle; - CHintBox hintbox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_TMDB_READ_DATA)); - hintbox.paint(); + hintbox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_TMDB_READ_DATA)); + hintbox->paint(); std::string lang = Lang2ISO639_1(g_settings.language); GetMovieDetails(lang); if ((minfo.result < 1 || minfo.overview.empty()) && lang != "en") GetMovieDetails("en", true); - hintbox.hide(); + if(hintbox){ + hintbox->hide(); + delete hintbox; + hintbox = NULL; + } } bool cTmdb::GetData(std::string url, Json::Value *root) @@ -118,8 +122,9 @@ bool cTmdb::GetMovieDetails(std::string lang, bool second) url = urlapi + "search/multi?api_key="+key+"&language="+lang+"&query=" + encodeUrl(title); if(!(GetData(url, &root))) return false; + + minfo.result = root.get("total_results",0).asInt(); } - minfo.result = root.get("total_results",0).asInt(); } printf("[TMDB]: results: %d\n",minfo.result); @@ -213,6 +218,12 @@ void cTmdb::cleanup() void cTmdb::selectResult(Json::Value elements, int results, int &use_result) { + if(hintbox){ + hintbox->hide(); + delete hintbox; + hintbox = NULL; + } + int select = 0; CMenuWidget *m = new CMenuWidget(LOCALE_TMDB_READ_DATA, NEUTRINO_ICON_SETTINGS); diff --git a/src/gui/tmdb.h b/src/gui/tmdb.h index c83fa5b75..16912850e 100644 --- a/src/gui/tmdb.h +++ b/src/gui/tmdb.h @@ -23,6 +23,7 @@ #include #include "system/helpers.h" #include +#include "gui/widget/hintbox.h" #define TMDB_COVER "/tmp/tmdb.jpg" @@ -49,7 +50,7 @@ class cTmdb { private: tmdbinfo minfo; - + CHintBox* hintbox; std::string key; // tmdb api key bool GetMovieDetails(std::string lang, bool second = false); bool GetData(std::string url, Json::Value *root);