for fast-scan and cable-scan, put bouquets to beginning of favorites list

This commit is contained in:
[CST] Focus
2014-04-07 13:28:05 +04:00
parent f51c47f597
commit 65c811e762
4 changed files with 11 additions and 7 deletions

View File

@@ -110,7 +110,7 @@ class CBouquetManager
void loadBouquets(bool ignoreBouquetFile = false);
void renumServices();
CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false);
CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false, bool to_begin = false);
void deleteBouquet(const unsigned int id);
void deleteBouquet(const CZapitBouquet* bouquet);
int existsBouquet(char const * const name, bool ignore_user = false);

View File

@@ -511,7 +511,7 @@ void CBouquetManager::renumServices()
makeRemainingChannelsBouquet();
}
CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bool myfav)
CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bool myfav, bool to_begin)
{
CZapitBouquet* newBouquet = new CZapitBouquet(myfav ? "favorites" : name);
newBouquet->bUser = ub;
@@ -521,9 +521,13 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo
//printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO");
if(ub) {
BouquetList::iterator it;
for(it = Bouquets.begin(); it != Bouquets.end(); ++it)
if(!(*it)->bUser)
break;
if (to_begin) {
it = Bouquets.begin();
} else {
for(it = Bouquets.begin(); it != Bouquets.end(); ++it)
if(!(*it)->bUser)
break;
}
Bouquets.insert(it, newBouquet);
} else
Bouquets.push_back(newBouquet);

View File

@@ -485,7 +485,7 @@ bool CServiceScan::ParseFst(unsigned short pid, fast_scan_operator_t * op)
bouquetId = g_bouquetManager->existsUBouquet(op->name);
if (bouquetId == -1) {
bouquet = g_bouquetManager->addBouquet(std::string(op->name), true);
bouquet = g_bouquetManager->addBouquet(std::string(op->name), true, false, true);
bouquetId = g_bouquetManager->existsUBouquet(op->name);
}
else

View File

@@ -334,7 +334,7 @@ _repeat:
CZapitBouquet* bouquet;
int bouquetId = g_bouquetManager->existsUBouquet(pname.c_str());
if (bouquetId == -1)
bouquet = g_bouquetManager->addBouquet(pname, true);
bouquet = g_bouquetManager->addBouquet(pname, true, false, true);
else
bouquet = g_bouquetManager->Bouquets[bouquetId];