Example #1
0
MainWindow::MainWindow()
{
    settingsDialog = new SettingsDialog;
    chatDialog = new ChatDialog;
    setCentralWidget(chatDialog);

    loginAct = new QAction(tr("&Connect"), this);
    connect(loginAct, SIGNAL(triggered()), this, SLOT(login()));
    logoutAct = new QAction(tr("&Disconnect"), this);
    connect(logoutAct, SIGNAL(triggered()), this, SLOT(logout()));
    awayAct = new QAction(tr("&Mark As Away"), this);
    connect(awayAct, SIGNAL(triggered()), this, SLOT(markAsAway()));
    awayAct->setCheckable(true);
    listAct = new QAction(tr("&Join Channel"), this);
    connect(listAct, SIGNAL(triggered()), this, SLOT(channelList()));
    closeWindowAct = new QAction(tr("&Close Current Window"), this);
    connect(closeWindowAct, SIGNAL(triggered()), this, SLOT(closeWindow()));

    serverMenu = new QMenu(tr("&Server"), this);
    serverMenu->addAction(loginAct);
    serverMenu->addAction(logoutAct);
    serverMenu->addAction(awayAct);
    serverMenu->addAction(listAct);
    serverMenu->addAction(closeWindowAct);

    menuBar()->addMenu(serverMenu);


    settingsAct = new QAction(tr("&Settings"), this);
    connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings()));

    preferencesMenu = new QMenu(tr("&Preferences"), this);
    preferencesMenu->addAction(settingsAct);

    menuBar()->addMenu(preferencesMenu);


    clearAct = new QAction(tr("&Clear Text"), this);
    connect(clearAct, SIGNAL(triggered()), this, SLOT(clear()));

    windowMenu = new QMenu(tr("&Window"), this);
    windowMenu->addAction(clearAct);

    menuBar()->addMenu(windowMenu);


    aboutAct = new QAction(tr("&About"), this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    helpMenu = new QMenu(tr("&Help"), this);
    helpMenu->addAction(aboutAct);

    menuBar()->addMenu(helpMenu);

    setWindowTitle(tr("qtchat"));
    resize(500, 500);
}
void ProtocolGame::parseChannelList(InputMessage& msg)
{
    int count = msg.getU8();
    std::vector<std::tuple<int, std::string> > channelList(count);
    for(int i = 0; i < count; i++) {
        int id = msg.getU16();
        std::string name = msg.getString();
        channelList.push_back(std::make_tuple(id, name));
    }

    g_lua.callGlobalField("Game", "onChannelList", channelList);
}
void ChannelsReply::networkError()
{
    emit channelList(QStringList(), true);
}
void ChannelsReply::parseData(const QByteArray& data)
{
    emit channelList(mParser.parseChannelList(data), false);
}
Example #5
0
void ChannelData::handleChannels(int id, ChannelInfoList *chanlist)
{
    if (m_guideDataOnly)
    {
        LOG(VB_GENERAL, LOG_NOTICE, "Skipping Channel Updates");
        return;
    }

    ChannelList existingChannels = channelList(id);
    QString fileprefix = SetupIconCacheDirectory();

    QDir::setCurrent(fileprefix);

    fileprefix += "/";

    bool insertChan = insert_chan(id);  // unscannable source

    ChannelInfoList::iterator i = chanlist->begin();
    for (; i != chanlist->end(); ++i)
    {
        if ((*i).xmltvid.isEmpty())
            continue;

        QString localfile;

        if (!(*i).icon.isEmpty())
        {
            QDir remotefile = QDir((*i).icon);
            QString filename = remotefile.dirName();

            localfile = fileprefix + filename;
            QFile actualfile(localfile);
            if (!actualfile.exists() &&
                !GetMythDownloadManager()->download((*i).icon, localfile))
            {
                LOG(VB_GENERAL, LOG_ERR,
                    QString("Failed to fetch icon from '%1'")
                        .arg((*i).icon));
            }

            localfile = filename;
        }

        MSqlQuery query(MSqlQuery::InitCon());

        if (!(*i).old_xmltvid.isEmpty())
        {
            query.prepare(
                "SELECT xmltvid "
                "FROM channel "
                "WHERE xmltvid = :XMLTVID");
            query.bindValue(":XMLTVID", (*i).old_xmltvid);

            if (!query.exec())
            {
                MythDB::DBError("xmltvid conversion 1", query);
            }
            else if (query.next())
            {
                LOG(VB_GENERAL, LOG_INFO,
                    QString("Converting old xmltvid (%1) to new (%2)")
                        .arg((*i).old_xmltvid).arg((*i).xmltvid));

                query.prepare("UPDATE channel "
                              "SET xmltvid = :NEWXMLTVID"
                              "WHERE xmltvid = :OLDXMLTVID");
                query.bindValue(":NEWXMLTVID", (*i).xmltvid);
                query.bindValue(":OLDXMLTVID", (*i).old_xmltvid);

                if (!query.exec())
                {
                    MythDB::DBError("xmltvid conversion 2", query);
                }
            }
        }

        ChannelInfo dbChan = FindMatchingChannel(*i, existingChannels);
        if (dbChan.chanid > 0) // Channel exists, updating
        {
            LOG(VB_XMLTV, LOG_NOTICE,
                    QString("Match found for xmltvid %1 to channel %2 (%3)")
                        .arg((*i).xmltvid).arg(dbChan.name).arg(dbChan.chanid));
            if (m_interactive)
            {

                cout << "### " << endl;
                cout << "### Existing channel found" << endl;
                cout << "### " << endl;
                cout << "### xmltvid  = "
                     << (*i).xmltvid.toLocal8Bit().constData()        << endl;
                cout << "### chanid   = "
                     << dbChan.chanid                                 << endl;
                cout << "### name     = "
                     << dbChan.name.toLocal8Bit().constData()         << endl;
                cout << "### callsign = "
                     << dbChan.callsign.toLocal8Bit().constData()     << endl;
                cout << "### channum  = "
                     << dbChan.channum.toLocal8Bit().constData()      << endl;
                if (m_channelPreset)
                {
                    cout << "### freqid   = "
                         << dbChan.freqid.toLocal8Bit().constData()   << endl;
                }
                cout << "### finetune = "
                     << dbChan.finetune                               << endl;
                cout << "### tvformat = "
                     << dbChan.tvformat.toLocal8Bit().constData()     << endl;
                cout << "### icon     = "
                     << dbChan.icon.toLocal8Bit().constData()         << endl;
                cout << "### " << endl;

                // The only thing the xmltv data supplies here is the icon
                (*i).name = dbChan.name;
                (*i).callsign = dbChan.callsign;
                (*i).channum  = dbChan.channum;
                (*i).finetune = dbChan.finetune;
                (*i).freqid = dbChan.freqid;
                (*i).tvformat = dbChan.tvformat;

                promptForChannelUpdates(i, dbChan.chanid);

                if ((*i).callsign.isEmpty())
                    (*i).callsign = dbChan.name;

                if (dbChan.name     != (*i).name ||
                    dbChan.callsign != (*i).callsign ||
                    dbChan.channum  != (*i).channum ||
                    dbChan.finetune != (*i).finetune ||
                    dbChan.freqid   != (*i).freqid ||
                    dbChan.icon     != localfile ||
                    dbChan.tvformat != (*i).tvformat)
                {
                    MSqlQuery subquery(MSqlQuery::InitCon());
                    subquery.prepare("UPDATE channel SET chanid = :CHANID, "
                                     "name = :NAME, callsign = :CALLSIGN, "
                                     "channum = :CHANNUM, finetune = :FINE, "
                                     "icon = :ICON, freqid = :FREQID, "
                                     "tvformat = :TVFORMAT "
                                     " WHERE xmltvid = :XMLTVID "
                                     "AND sourceid = :SOURCEID;");
                    subquery.bindValue(":CHANID", dbChan.chanid);
                    subquery.bindValue(":NAME", (*i).name);
                    subquery.bindValue(":CALLSIGN", (*i).callsign);
                    subquery.bindValue(":CHANNUM", (*i).channum);
                    subquery.bindValue(":FINE", (*i).finetune);
                    subquery.bindValue(":ICON", localfile);
                    subquery.bindValue(":FREQID", (*i).freqid);
                    subquery.bindValue(":TVFORMAT", (*i).tvformat);
                    subquery.bindValue(":XMLTVID", (*i).xmltvid);
                    subquery.bindValue(":SOURCEID", id);

                    if (!subquery.exec())
                    {
                        MythDB::DBError("update failed", subquery);
                    }
                    else
                    {
                        cout << "### " << endl;
                        cout << "### Change performed" << endl;
                        cout << "### " << endl;
                    }
                }
                else
                {
                    cout << "### " << endl;
                    cout << "### Nothing changed" << endl;
                    cout << "### " << endl;
                }
            }
            else if ((dbChan.icon != localfile) ||
                     (dbChan.xmltvid != (*i).xmltvid))
            {
                LOG(VB_XMLTV, LOG_NOTICE, QString("Updating channel %1 (%2)")
                                        .arg(dbChan.name).arg(dbChan.chanid));

                if (localfile.isEmpty())
                    localfile = dbChan.icon;

                if (dbChan.xmltvid != (*i).xmltvid)
                {
                    MSqlQuery subquery(MSqlQuery::InitCon());

                    subquery.prepare("UPDATE channel SET icon = :ICON "
                            ", xmltvid:= :XMLTVID WHERE "
                                     "chanid = :CHANID;");
                    subquery.bindValue(":ICON", localfile);
                    subquery.bindValue(":XMLTVID", (*i).xmltvid);
                    subquery.bindValue(":CHANID", dbChan.chanid);

                    if (!subquery.exec())
                        MythDB::DBError("Channel icon change", subquery);
                }
                else
                {
                    MSqlQuery subquery(MSqlQuery::InitCon());
                    subquery.prepare("UPDATE channel SET icon = :ICON WHERE "
                                     "chanid = :CHANID;");
                    subquery.bindValue(":ICON", localfile);
                    subquery.bindValue(":CHANID", dbChan.chanid);

                    if (!subquery.exec())
                        MythDB::DBError("Channel icon change", subquery);
                }

            }
        }
        else if (insertChan) // Only insert channels for non-scannable sources
        {
            int major, minor = 0;
            long long freq = 0;
            get_atsc_stuff((*i).channum, id, (*i).freqid.toInt(), major, minor, freq);

            if (m_interactive && ((minor == 0) || (freq > 0)))
            {
                cout << "### " << endl;
                cout << "### New channel found" << endl;
                cout << "### " << endl;
                cout << "### name     = "
                     << (*i).name.toLocal8Bit().constData()     << endl;
                cout << "### callsign = "
                     << (*i).callsign.toLocal8Bit().constData() << endl;
                cout << "### channum  = "
                     << (*i).channum.toLocal8Bit().constData()  << endl;
                if (m_channelPreset)
                {
                    cout << "### freqid   = "
                         << (*i).freqid.toLocal8Bit().constData() << endl;
                }
                cout << "### finetune = "
                     << (*i).finetune                           << endl;
                cout << "### tvformat = "
                     << (*i).tvformat.toLocal8Bit().constData() << endl;
                cout << "### icon     = "
                     << localfile.toLocal8Bit().constData()     << endl;
                cout << "### " << endl;

                uint chanid = promptForChannelUpdates(i,0);

                if ((*i).callsign.isEmpty())
                    (*i).callsign = QString::number(chanid);

                int mplexid = 0;
                if ((chanid > 0) && (minor > 0))
                    mplexid = ChannelUtil::CreateMultiplex(id,   "atsc",
                                                           freq, "8vsb");

                if (((mplexid > 0) || ((minor == 0) && (chanid > 0))) &&
                    ChannelUtil::CreateChannel(
                        mplexid,          id,               chanid,
                        (*i).callsign,    (*i).name,        (*i).channum,
                        0 /*service id*/, major,            minor,
                        false /*use on air guide*/, false /*hidden*/,
                        false /*hidden in guide*/,
                        (*i).freqid,      localfile,        (*i).tvformat,
                        (*i).xmltvid))
                {
                    cout << "### " << endl;
                    cout << "### Channel inserted" << endl;
                    cout << "### " << endl;
                }
                else
                {
                    cout << "### " << endl;
                    cout << "### Channel skipped" << endl;
                    cout << "### " << endl;
                }
            }
            else if ((minor == 0) || (freq > 0))
            {
                // We only do this if we are not asked to skip it with the
                // --update-guide-only (formerly --update) flag.
                int mplexid = 0, chanid = 0;
                if (minor > 0)
                {
                    mplexid = ChannelUtil::CreateMultiplex(
                        id, "atsc", freq, "8vsb");
                }

                if ((mplexid > 0) || (minor == 0))
                    chanid = ChannelUtil::CreateChanID(id, (*i).channum);

                if ((*i).callsign.isEmpty())
                {
                    QStringList words = (*i).name.simplified().toUpper()
                        .split(" ");
                    QString callsign = "";
                    QString w1 = words.size() > 0 ? words[0] : QString();
                    QString w2 = words.size() > 1 ? words[1] : QString();
                    if (w1.isEmpty())
                        callsign = QString::number(chanid);
                    else if (w2.isEmpty())
                        callsign = words[0].left(5);
                    else
                    {
                        callsign = w1.left(w2.length() == 1 ? 4:3);
                        callsign += w2.left(5 - callsign.length());
                    }
                    (*i).callsign = callsign;
                }

                if (chanid > 0)
                {
                    QString cstr = QString((*i).channum);
                    if(m_channelPreset && cstr.isEmpty())
                        cstr = QString::number(chanid % 1000);

                    bool retval = ChannelUtil::CreateChannel(
                                                     mplexid, id,
                                                     chanid,
                                                     (*i).callsign,
                                                     (*i).name, cstr,
                                                     0 /*service id*/,
                                                     major, minor,
                                                     false /*use on air guide*/,
                                                     false /*hidden*/,
                                                     false /*hidden in guide*/,
                                                     (*i).freqid,
                                                     localfile,
                                                     (*i).tvformat,
                                                     (*i).xmltvid
                                                            );
                    if (!retval)
                        cout << "Channel " << chanid << " creation failed"
                             << endl;
                }
            }
        }
    }
}
//
// ----------------------------------------------------------------------------------
// CEventChannel::RunL()
// ----------------------------------------------------------------------------------
//  
void CEventChannel::RunL()
    {
    TBuf<16> location;
    location.Copy( iChannelInfo.iLocation );
    COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - %S" ), &location ) );
    
    switch( iChannelState )
        {
        case EChannelOpening:
            {
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - EChannelOpening" ) ) );
            TInt err( KErrNone );    
            if( iStatus.Int() == KErrNone )
                {
                COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() iChannelState = EChannelOpen" ) ) );
                iChannelState = EChannelOpen;
                
                // Find data channel
                CSensrvChannelFinder* channelFinder = CSensrvChannelFinder::NewLC();
                
                TBufC8<KSensrvLocationLength> location( _L8("First0") );
                TBufC8<KSensrvVendorIdLength> vendorId( _L8( "VendorFirst" ) );
                TSensrvChannelInfo channelInfo( 0, ESensrvContextTypeNotDefined, ESensrvQuantityNotdefined, 0, location, vendorId, 0, 0 );
                RSensrvChannelInfoList channelList(10);
                
                TRAP( err, channelFinder->FindChannelsL( channelList, channelInfo ) );
                
                if( !err && channelList.Count() > 0 )
                    {
                    iChannel = CSensrvChannel::NewL( channelList[ 0 ] );
                    TRAP( err, iChannel->OpenChannelL() );
                    }
                
                CleanupStack::PopAndDestroy( channelFinder );   
                channelList.Reset();                              
                }
            if( err || iStatus.Int() != KErrNone )
                {
                COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() iChannelState = EChannelIdle" ) ) );
                iChannelState = EChannelIdle;
                if( !err )
                    {
                    err = iStatus.Int();
                    }                
                }
                
            iSsyCallback->ChannelOpened( iChannelInfo.iChannelId, err, this, iPropertyProvider );
            break;
            }
        case EChannelClosing:
            {
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - EChannelClosing" ) ) );
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() iChannelState = EChannelIdle" ) ) );
            
            iChannelState = EChannelIdle;
            if( iChannel )
                {
                iChannel->CloseChannel();
                delete iChannel;
                iChannel = NULL;
                }
            iSsyCallback->ChannelClosed( iChannelInfo.iChannelId );
            break;
            }
        case EChannelOpen:
            {
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - EChannelOpen" ) ) );
            break;
            }
        case EChannelListening:
            {
           
            break;
            }
        case EChannelStopListening:
            {
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - EChannelStopListening" ) ) );
            
           
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() iChannelState = EChannelOpen" ) ) );
            iChannelState = EChannelOpen;
            break;
            }
        case EChannelBufferFilled:
        case EChannelForceBufferFilled:
            {
             
            
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() - EChannelForceBufferFilled" ) ) );
            iSsyCallback->BufferFilled( iChannelInfo.iChannelId, iCounter, iDataBuffer, iMaxDataCount );
            iCounter = 0;
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() iChannelState = EChannelListening" ) ) );
            iChannelState = EChannelListening;
            IssueRequest();
            break;
            }
        default:
            {
            COMPONENT_TRACE( ( _L( "EventSsyStub - CEventChannel::RunL() unknown channel state" ) ) );
            }
        }

            
    }
// 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);
	}
}