mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
zapit/src/bouquets.cpp: decrease channel lock count in deleteBouquet();
add setBouquetLock() with change channel lock count
Origin commit data
------------------
Branch: ni/coolstream
Commit: 27cd2846f2
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-10-13 (Mon, 13 Oct 2014)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -430,16 +430,6 @@ void CBEBouquetWidget::deleteBouquet()
|
||||
if (ShowMsg(LOCALE_FILEBROWSER_DELETE, (*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name, CMessageBox::mbrNo, CMessageBox::mbYes|CMessageBox::mbNo)!=CMessageBox::mbrYes)
|
||||
return;
|
||||
|
||||
if ((*Bouquets)[selected]->bLocked) {
|
||||
ZapitChannelList *channels = &(*Bouquets)[selected]->tvChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount--;
|
||||
|
||||
channels = &(*Bouquets)[selected]->radioChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount--;
|
||||
}
|
||||
|
||||
g_bouquetManager->deleteBouquet(selected);
|
||||
Bouquets = &g_bouquetManager->Bouquets;
|
||||
if (selected >= Bouquets->size())
|
||||
@@ -528,18 +518,8 @@ void CBEBouquetWidget::switchHideBouquet()
|
||||
void CBEBouquetWidget::switchLockBouquet()
|
||||
{
|
||||
bouquetsChanged = true;
|
||||
(*Bouquets)[selected]->bLocked = !(*Bouquets)[selected]->bLocked;
|
||||
g_bouquetManager->setBouquetLock((*Bouquets)[selected], !(*Bouquets)[selected]->bLocked);
|
||||
paint();
|
||||
|
||||
int add = (*Bouquets)[selected]->bLocked * 2 - 1;
|
||||
|
||||
ZapitChannelList *channels = &(*Bouquets)[selected]->tvChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount += add;
|
||||
|
||||
channels = &(*Bouquets)[selected]->radioChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount += add;
|
||||
}
|
||||
|
||||
std::string CBEBouquetWidget::inputName(const char * const defaultName, const neutrino_locale_t caption)
|
||||
|
@@ -123,6 +123,8 @@ class CBouquetManager
|
||||
void deletePosition(t_satellite_position satellitePosition);
|
||||
|
||||
void sortBouquets(void);
|
||||
void setBouquetLock(const unsigned int id, bool state);
|
||||
void setBouquetLock(CZapitBouquet* bouquet, bool state);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -570,12 +570,43 @@ void CBouquetManager::deleteBouquet(const CZapitBouquet* bouquet)
|
||||
BouquetList::iterator it = find(Bouquets.begin(), Bouquets.end(), bouquet);
|
||||
|
||||
if (it != Bouquets.end()) {
|
||||
if ((*it)->bLocked) {
|
||||
ZapitChannelList *channels = &(*it)->tvChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount--;
|
||||
|
||||
channels = &(*it)->radioChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount--;
|
||||
}
|
||||
|
||||
Bouquets.erase(it);
|
||||
delete bouquet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBouquetManager::setBouquetLock(const unsigned int id, bool state)
|
||||
{
|
||||
if (id < Bouquets.size())
|
||||
setBouquetLock(Bouquets[id], state);
|
||||
}
|
||||
|
||||
void CBouquetManager::setBouquetLock(CZapitBouquet* bouquet, bool state)
|
||||
{
|
||||
bouquet->bLocked = state;
|
||||
int add = bouquet->bLocked * 2 - 1;
|
||||
|
||||
ZapitChannelList *channels = &bouquet->tvChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount += add;
|
||||
|
||||
channels = &bouquet->radioChannels;
|
||||
for(unsigned int i = 0; i < channels->size(); i++)
|
||||
((*channels)[i])->bLockCount += add;
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
int str_compare_withoutspace(char const *s1, char const *s2)
|
||||
{
|
||||
|
@@ -1586,8 +1586,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd)
|
||||
case CZapitMessages::CMD_BQ_SET_LOCKSTATE: {
|
||||
CZapitMessages::commandBouquetState msgBouquetLockState;
|
||||
CBasicServer::receive_data(connfd, &msgBouquetLockState, sizeof(msgBouquetLockState)); // bouquet & channel number are already starting at 0!
|
||||
if (msgBouquetLockState.bouquet < g_bouquetManager->Bouquets.size())
|
||||
g_bouquetManager->Bouquets[msgBouquetLockState.bouquet]->bLocked = msgBouquetLockState.state;
|
||||
g_bouquetManager->setBouquetLock(msgBouquetLockState.bouquet, msgBouquetLockState.state);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user