Exemple #1
0
void WorkerThread::run() {
	m_die = false;
	if(!m_die) runTest();
	if(!m_die) runConfig();
	if(!m_die) runUnzip();
	if(!m_die) runEmulator();
	if(!m_die) runRezip();
}
	void RenderEngine::waitCmd(){
		int key = cvWaitKey(10);
		while(key != 'q'){
			switch(key){
			case 'p':
			case 'P':
				runConfig("data/Config.xml");
				preview();
				break;
			case 'r':
			case 'R':
				cvDestroyAllWindows();
				renderFilm();
				break;
			default:
				break;
			}
			key = cvWaitKey(10);
		}
	}
// Initialise Toolbar, Menus ScrollBar and other
void ktvschedule::init()
{
	// Creates central widgets
	
	tvgridbox = new QGroupBox ( this ); // Group box
	tvgridbox->setInsideMargin ( 15 );
		
	t_TVGrid=new TvGuideTable(this->tvgridbox, "t_TVGrid"); // Add TvGuideTable custom QTable
	
	QGridLayout *tvgridboxLayout = new QGridLayout( tvgridbox->layout() ); //Layout
	tvgridboxLayout->setAlignment ( Qt::AlignTop );
	tvgridboxLayout->addWidget ( t_TVGrid , 0 , 0 );
		
	setCentralWidget( tvgridbox );
  	tvgridbox->show();
	
////////////////////////////////
	//Check for home directory, if it does not exist, create it
	
       QString qstr(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"); //for some reason this only works with gcc 3.3 and not the previous version
       QDir d(qstr);
       if ( !d.exists() )
	{
		d.mkdir(qstr);
	}
	
	/*QDir d( QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule") );
	if ( !d.exists() )
		{
			d.mkdir(QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"));
		}*/ // This worked for gcc 3.4 but not for 3.3

	
	//setRightJustification( TRUE );
	
////////////////////////////////

	this->setIcon( KGlobal::iconLoader()->loadIcon("ktvschedule", KIcon::Desktop) );
	
	// Creates the ToolBar
	KToolBar * TvToolBar = new KToolBar( this, KMainWindow::Top );
	
//////////////////////////////

	// Creates a QDateEdit Widget for future use
	date_show = new QDateEdit( QDate::currentDate() , TvToolBar );
	date_show->setOrder(QDateEdit::DMY);
	
////////////////////////////////
	// Define KActions
	
	 //KAction *actionGoHome = new KAction ( "Now Playing", KGlobal::iconLoader()->loadIcon("gohome", KIcon::NoGroup), CTRL+Key_P , t_TVGrid, SLOT (SetToCurrentTime() ), collector, "Now Playing");
	 
	 KAction *actionGoHome = new KAction ( i18n("Now &Playing"), "gohome", CTRL+Key_P , this, SLOT (SetToCurrentTime() ), actionCollection(), "Now Playing");

	 KAction *actionRefreshGuide = new KAction ( i18n("&Refresh Guide"), "reload", CTRL+Key_R , this, SLOT (RefreshXMLGuide() ), actionCollection(), "Refresh Guide");
	 
	 KAction *actionManageChannels = new KAction ( i18n("&Manage Channels"), "toggle_log", CTRL+Key_M , this, SLOT (channelList() ), actionCollection(), "Manage Channels");
	 
	 KAction *actionConfigure = new KAction ( i18n("&Configure"), "configure", CTRL+Key_C , this, SLOT (runConfig() ), actionCollection(), "Configure");
	 	 
	 KAction *actionExit = KStdAction::quit(this, SLOT(close()), 0);

	 KAction *actionPrevious = new KAction ( i18n("Pre&vious Day"), "previous", CTRL+Key_V , date_show, SLOT ( stepDown() ), actionCollection(), "PreviousDay");
 
	 KAction *actionNext = new KAction ( i18n("&Next Day"), "forward", CTRL+Key_N , date_show, SLOT ( stepUp() ), actionCollection(), "NextDay");
	 
	 KAction *actionEvent = KStdAction::configureNotifications(this, SLOT( notificationsEvent() ), actionCollection(), "settings_notifications" );
	 
	 KAction *actionFindCategory = new KAction (i18n("&Find Next Show"), "find", CTRL+Key_F , this, SLOT( findNextCategory() ), actionCollection(), "findnextshow");

//////////////////////////////////

	// Plug actions to ToolBar
	 
	
	 actionGoHome->plug ( TvToolBar);
	 actionRefreshGuide->plug (TvToolBar);
	 actionExit->plug (TvToolBar);
	 
	 TvToolBar->insertLineSeparator();
	 
	 actionManageChannels->plug (TvToolBar);
	 actionConfigure->plug (TvToolBar);

	 TvToolBar->insertLineSeparator();
	 
	 actionPrevious->plug (TvToolBar);
	 
	 // Add a QDateEdit widget for the ToolBar
	 TvToolBar->insertWidget (actionCollection()->count()+1,13, date_show );
	 
	 actionNext->plug (TvToolBar);
	 
	// Creates the KComboBox and adds it to the Toolbar
	 
	combo_Categories = new KComboBox(TvToolBar);
	combo_Categories->setMinimumWidth( combo_Categories->width ()+60); 
	combo_Categories->insertStringList(Categories);
	
	TvToolBar->insertWidget (actionCollection()->count()+1,15, combo_Categories);
	
	actionFindCategory->plug (TvToolBar);
//////////////////////////////////

	// Create menus
	 
	KPopupMenu *menuGrid = new KPopupMenu( this );
	KPopupMenu *menuConf = new KPopupMenu( this );
	
	menuBar()->insertItem( i18n("&Grid"), menuGrid );
  	menuBar()->insertItem( i18n("&Configure"), menuConf );
	
	// Plug KActions to menus
	
	actionGoHome->plug(menuGrid);
	actionRefreshGuide->plug(menuGrid);
	actionExit->plug(menuGrid);
	
	actionManageChannels->plug(menuConf);
	actionConfigure->plug(menuConf);
        actionEvent->plug(menuConf);
	
	KAboutData *_aboutData = new KAboutData("kTvSchedule", I18N_NOOP("KTvSchedule"), 
              "0.1.8", I18N_NOOP("TV Schedule.\n\n"
              "KDE Front end for TV Schedule programs.\n"
              "created by xmltv (tv_grab_xx)"),
              KAboutData::License_GPL, "(c) 2005, Alexios Beveratos",0,"http://www.kde-apps.org/content/show.php?content=22747","*****@*****.**");
	_aboutData->addAuthor("Alexios Beveratos", I18N_NOOP("Main Developper"), "*****@*****.**");
	_aboutData->addAuthor("Benoit Philipps",0,"*****@*****.**");
	//_aboutData->setHomepage("http://www.kde-apps.org/content/show.php?content=22747");
	//_aboutData->setBugAddress("http://developer.berlios.de/projects/ktvschedule/");
	
	 KHelpMenu *HelpMenu = new KHelpMenu( this, _aboutData );
 	 menuBar()->insertItem(i18n("&Help"), HelpMenu->menu() );	
	
//////////////////////////////////

	// Creates StatusBar
			  
	StatusBar = this->statusBar();
	led = new KLed(QColor ("#2EBB16"), KLed::On, KLed::Raised, KLed::Circular);
	StatusBar->addWidget ( led, 0, TRUE );
	
//////////////////////////////////

	// Other Initialisations
	
	date_show->setDate(QDate::currentDate ());
	date_show->setOrder(QDateEdit::DMY);
	
	FirstInput=QDate::currentDate();
	LastInput=QDate::currentDate();

//////////////////////////////////

	//Add connections
	connect( date_show, SIGNAL( valueChanged(const QDate&) ), this, SLOT( PopulateTvGrid() ) );
	//connect( combo_Categories, SIGNAL( activated(const QString &)),t_TVGrid,SLOT( highlightCategory(const QString& )));
	connect( combo_Categories, SIGNAL( activated(const QString &)),this,SLOT( highlightCategory(const QString& )));
	
	// Creates the scheduler class, and connects it. can be made better
	
	tvShowScheduler= new tvscheduler(); 
	connect( t_TVGrid, SIGNAL (infoContext(TvItem*) ), tvShowScheduler, SLOT (doNotMiss(TvItem*) ) );
	connect( t_TVGrid, SIGNAL (recordProgramSignal(TvItem* ) ), tvShowScheduler, SLOT (recordProgram(TvItem* ) ) );
	
/////////////////////////////////
	//If we use nxtvepg then disable some buttons
	if (Config().m_GrabberToUse == "nxtvepg")
	{
		actionRefreshGuide->setEnabled(FALSE);
		actionManageChannels->setEnabled(FALSE);
	}
}