void CEpgScan::AddTransponders()
{
	if(bouquetList->Bouquets.empty())
		return;

	if (current_mode != g_settings.epg_scan) {
		current_mode = g_settings.epg_scan;
		Clear();
	}

	int mode = CNeutrinoApp::getInstance()->GetChannelMode();
	if (g_settings.epg_scan == SCAN_SEL) {
		if (current_bmode != mode) {
			current_bmode = mode;
			current_bnum = -1;
		}
		int bnum = bouquetList->getActiveBouquetNumber();
		bool bscan = bouquetList->Bouquets[bnum]->zapitBouquet &&
			bouquetList->Bouquets[bnum]->zapitBouquet->bScanEpg;

		if ((current_bnum != bnum) && bscan) {
			current_bnum = bnum;
			AddBouquet(bouquetList->Bouquets[current_bnum]->channelList);
		} else {
			AddSelected();
		}
		return;
	}

	if ((g_settings.epg_scan == SCAN_CURRENT) || (mode == LIST_MODE_FAV)) {
		/* current bouquet mode */
		if (current_bmode != mode) {
			current_bmode = mode;
			current_bnum = -1;
		}
		if (current_bnum != bouquetList->getActiveBouquetNumber()) {
			allfav_done = false;
			scanmap.clear();
			current_bnum = bouquetList->getActiveBouquetNumber();
			AddBouquet(bouquetList->Bouquets[current_bnum]->channelList);
			INFO("Added bouquet #%d, scan map size: %d", current_bnum, scanmap.size());
		}
	} else if (g_settings.epg_scan == SCAN_FAV) {
		AddFavorites();
	}
}
void CEpgScan::Next()
{
	bool llocked = false;
#ifdef ENABLE_PIP
	bool plocked = false;
#endif
	next_chid = 0;

	if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby)
		return;
	if (CRecordManager::getInstance()->RecordingStatus() || CStreamManager::getInstance()->StreamStatus())
		return;

	if (g_settings.epg_scan == SCAN_FAV && scanmap.empty())
		AddFavorites();
	if (g_settings.epg_scan == SCAN_SEL && scanmap.empty())
		AddSelected();

	if (!CheckMode() || scanmap.empty()) {
		EnterStandby();
		return;
	}

	/* executed in neutrino thread - possible race with locks in zapit zap NOWAIT :
	   send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time
	*/
	CFEManager::getInstance()->Lock();
	CFrontend *live_fe = NULL;
#ifdef ENABLE_PIP
	CFrontend *pip_fe = NULL;
#endif
	if (!standby) {
		bool webtv = IS_WEBTV(CZapit::getInstance()->GetCurrentChannelID());
		if (!webtv) {
			llocked = true;
			live_fe = CZapit::getInstance()->GetLiveFrontend();
			CFEManager::getInstance()->lockFrontend(live_fe);
		}
#ifdef ENABLE_PIP
		pip_fe = CZapit::getInstance()->GetPipFrontend();
		if (pip_fe /* && pip_fe != live_fe*/) {
			plocked = true;
			CFEManager::getInstance()->lockFrontend(pip_fe);
		}
#endif
	}
_repeat:
	for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) {
		CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second);
		if (newchan == NULL) {
			scanmap.erase(it++);
			continue;
		}
		if (CFEManager::getInstance()->canTune(newchan)) {
			INFO("try to tune [%s]", newchan->getName().c_str());
			next_chid = newchan->getChannelID();
			break;
		} else
			INFO("skip [%s], cannot tune", newchan->getName().c_str());
		++it;
	}
	if (!next_chid && ((g_settings.epg_scan == SCAN_FAV) && AddFavorites()))
		goto _repeat;
	if (!next_chid && ((g_settings.epg_scan == SCAN_SEL) && AddSelected()))
		goto _repeat;

	if (llocked)
		CFEManager::getInstance()->unlockFrontend(live_fe);
#ifdef ENABLE_PIP
	if (plocked)
		CFEManager::getInstance()->unlockFrontend(pip_fe);
#endif

	CFEManager::getInstance()->Unlock();
	if (next_chid)
		g_Zapit->zapTo_epg(next_chid, standby);
	else 
		EnterStandby();
}
Example #3
0
   TaskEditor::TaskEditor(QWidget* parent)
      : QDialog(parent)
   {
      //dtUtil::Log::GetInstance("taskeditor.cpp").SetLogLevel(dtUtil::Log::LOG_DEBUG);
      QGroupBox*   group = new QGroupBox(tr("Tasks"));
      QGridLayout* grid  = new QGridLayout(group);

      QVBoxLayout* rightSideLayout = new QVBoxLayout;
      QLabel*      child = new QLabel(tr("Children"));
      grid->addWidget(child, 0, 0);


      mChildrenView = new QTableWidget(NULL);
      mChildrenView->setSelectionMode(QAbstractItemView::SingleSelection);
      mChildrenView->setSelectionBehavior(QAbstractItemView::SelectRows);
      mChildrenView->setAlternatingRowColors(true);
      mChildrenView->setEditTriggers(QAbstractItemView::NoEditTriggers);
      grid->addWidget(mChildrenView, 1, 0);

      mAddExisting = new QPushButton(tr("Add Existing"));

      mComboBox = new QComboBox;
      mComboBox->setEditable(false);

      mShowTasksWithParents = new QCheckBox("Show Tasks With Parents");
      mShowTasksWithParents->setCheckState(Qt::Unchecked);
      mShowTasksWithParents->setTristate(false);

      rightSideLayout->addWidget(mAddExisting);
      rightSideLayout->addWidget(mComboBox);
      rightSideLayout->addWidget(mShowTasksWithParents);
      rightSideLayout->addStretch(1);

      grid->addLayout(rightSideLayout, 0, 1, 2, 1);

      QHBoxLayout* buttonLayout = new QHBoxLayout;
      mMoveUp = new QPushButton(tr("Move Up"));
      mMoveDown = new QPushButton(tr("Move Down"));
      buttonLayout->addWidget(mMoveUp);
      buttonLayout->addStretch(1);
      buttonLayout->addWidget(mMoveDown);
      grid->addLayout(buttonLayout, 2, 0);

      mRemoveChild = new QPushButton(tr("Remove Child"));
      grid->addWidget(mRemoveChild, 3, 0);

      QHBoxLayout* okCancelLayout = new QHBoxLayout;
      QPushButton* ok             = new QPushButton(tr("OK"));
      QPushButton* cancel         = new QPushButton(tr("Cancel"));
      okCancelLayout->addStretch(1);
      okCancelLayout->addWidget(ok);
      okCancelLayout->addStretch(1);
      okCancelLayout->addWidget(cancel);
      okCancelLayout->addStretch(1);

      QVBoxLayout* mainLayout = new QVBoxLayout(this);
      mainLayout->addWidget(group);
      mainLayout->addLayout(okCancelLayout);

      setModal(true);
      setWindowTitle(tr("Task Editor"));
      //setMinimumSize(360, 375);

      connect(mComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboSelectionChanged(int)));
      connect(mAddExisting, SIGNAL(clicked()), this, SLOT(AddSelected()));

      connect(mShowTasksWithParents, SIGNAL(stateChanged(int)), this, SLOT(OnShowTasksWithParentsChanged(int)));

      connect(mMoveUp,       SIGNAL(clicked()), this, SLOT(OnMoveUpClicked()));
      connect(mMoveDown,     SIGNAL(clicked()), this, SLOT(OnMoveDownClicked()));
      connect(mRemoveChild,  SIGNAL(clicked()), this, SLOT(OnRemoveChildClicked()));
      connect(ok,            SIGNAL(clicked()), this, SLOT(OnOkClicked()));
      connect(cancel,        SIGNAL(clicked()), this, SLOT(close()));
      connect(mChildrenView, SIGNAL(itemSelectionChanged()), this, SLOT(EnableEditButtons()));

      RefreshComboBox("");
   }