Logo Search packages:      
Sourcecode: kaffeine version File versions

Kaffeine::Kaffeine ( const QStringList &  urls = QStringList(),
const QStringList &  engineParameters = QStringList(),
const QString  device = QString::null,
bool  instantPlay = false,
bool  fullscreen = false,
bool  wizard = false,
QWidget *  parent = 0,
const char *  name = 0 
)

KWin are you there?

get a keycode for a faked key event to hold down screensaver

Definition at line 104 of file kaffeine.cpp.

    : DCOPObject("KaffeineIface"),
      KMainWindow(parent, name), m_mediaPart(NULL), m_simplePart(NULL), m_playerContainer(NULL), m_startWindow(NULL),
      m_systemTray(NULL), m_videoSize(0,0), m_noResize(false), m_autoPaused(false), m_currentPartService(QString::null),
      m_device(device), m_engineParameters(engineParameters)
{
    setAcceptDrops(true);

#ifdef HAVE_LINUX_DVB_FRONTEND_H
    // dvb widget
    if ( DVBconfig::haveDvbDevice() ) {
      kdDebug() << "Found DVB device." << endl;
      dvbPanel = new DvbPanel( this, 0, "dvbpanel" );
    }
    else {
      dvbPanel = 0;
      kdDebug() << "No DVB device found." << endl;
    }
#endif

    setupActions();
    KComboBox* playlistSelector = new KComboBox;
    playlistSelector->setMinimumWidth(150);
    QToolTip::add(playlistSelector, i18n("Select Playlist"));
    KAction* action = new KWidgetAction(playlistSelector, i18n("Select Playlist"), 0, 0, 0, actionCollection(), "playlist_selector");
    action->setWhatsThis(i18n("Select the active playlist. To change playlist name edit it and confirm with 'Return'."));
    setStandardToolBarMenuEnabled(true);
    createStandardStatusBarAction();
    createGUI("kaffeineui.rc");

    //statusBar()->insertItem(i18n("Entries: %1, Playtime: %2  (Total: %3, %4)").arg("0").arg("00:00:00").arg("0").arg("00:00:00"), 9, 0, true);
    statusBar()->insertItem(i18n("Entries: %1, Playtime: %2").arg("0").arg("0:00:00"), 9, 0, true);
    statusBar()->insertItem(i18n("No player"), 10, 0, true);

    QString stamp =  locateLocal("appdata", "wizard_stamp_v0.5");
    if ((!QFile::exists(stamp)) || (wizard))
    {
      WizardDialog* wizardDlg = new WizardDialog( 0, "wizard" );
      wizardDlg->exec();

      KProcess process;
      process << "touch" << stamp;
      process.start(KProcess::Block, KProcess::Stderr);
      process.clearArguments();
    }

    // central tab widget
    m_tabWidget = new TabWidget(this);
    m_tabWidget->setMargin(0);
    setCentralWidget(m_tabWidget);
    connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(slotCurrentTabChanged(QWidget*)));

    // playlist
    m_playlist = new PlayList(playlistSelector, m_tabWidget);
    m_playlist->setFileFilter(DEFAULT_FILTER);
    connect(m_playlist, SIGNAL(signalPlay(const MRL&)), this, SLOT(slotPlay(const MRL&)));
    connect(m_playlist, SIGNAL(signalPlaylistStatus(const QString&)), this, SLOT(slotChangePlaylistStatus(const QString&)));
    connect(m_playlist, SIGNAL(signalRequestForDVD()), this, SLOT(slotOpenDVD()));
    connect(m_playlist, SIGNAL(signalRequestForVCD()), this, SLOT(slotOpenVCD()));
    connect(m_playlist, SIGNAL(signalRequestForAudioCD()), this, SLOT(slotOpenAudioCD()));
    connect(m_playlist, SIGNAL(signalToggleDockState()), this, SLOT(slotTogglePlaylistDockState()));
    m_tabWidget->addTab(m_playlist, i18n("Playlist"));

#ifdef HAVE_LINUX_DVB_FRONTEND_H
    if ( dvbPanel ) {
      dvbPanel->reparent(m_tabWidget, QPoint(0,0), true);
      m_tabWidget->addTab(dvbPanel, i18n("DVB"));
      dvbPanel->checkFirstRun();
    }
#endif

    QTextStream ts(&m_filter, IO_WriteOnly);
    ts << "|" << i18n("Supported Media Formats") << "\n"
       << "*.mp3 *.mpa *mpega *.m4a *.mpc *.mp+ *.MP3 *.MPA *.MPEGA *.M4A *.MPC *.MP+|" <<  i18n("MPEG Audio Files") << "\n"
       << "*.mjpeg *.mpg *.mpeg *.mp2 *.mpv *.vob *.MJPEG *.MPG *.MPEG *.MP2 *.MPV *.VOB|" << i18n("MPEG Video Files") << "\n"
       << "*.ogg *.ogm *.OGG *.OGM|" << i18n("Ogg Vorbis Files") << "\n"
       << "*.avi *.AVI|" << i18n("AVI Files") << "\n"
       << "*.mov *.qt *.MOV *.QT|" << i18n("Quicktime Files") << "\n"
       << "*.rm *.ram *.ra *.rmvb *.RM *.RAM *.RA *.RMVB|" << i18n("Real Media Files") << "\n"
       << "*.mkv *.mka *.MKV *.MKA|" << i18n("Matroska Files") << "\n"
       << "*.flac *.flc *.FLAC *.FLC|" << i18n("FLAC Files") << "\n"
       << "*.wmv *.wma *.asf *.asx *.wvx *.wax *.WMV *.WMA *.ASF *.ASX *.WVX *.WAX|" << i18n("Windows Media Files") << "\n"
       << "*.wav *.WAV|" << i18n("WAV Files") << "\n"
       << "*.m3u *.M3U|" << i18n("M3U Playlists") << "\n"
       << "*.kaffeine *.KAFFEINE|" << i18n("Kaffeine Playlists") << "\n"
       << "*.*|" << i18n("All Files");

/** KWin are you there? **/

    m_haveKWin = KApplication::dcopClient()->isApplicationRegistered("kwin");
    if (m_haveKWin)
      kdDebug() << "Window manager: KWin found" << endl;
     else
      kdDebug() << "Window manager: not KWin - using save fullscreen mode" << endl;

/** get a keycode for a faked key event to hold down screensaver **/

#ifdef HAVE_XTEST
    int a,b,c,d;
    m_haveXTest = XTestQueryExtension(x11Display(), &a, &b, &c, &d);
    if (m_haveXTest)
      m_xTestKeycode = XKeysymToKeycode(x11Display(), XK_Shift_L);
    connect(&m_screensaverTimer, SIGNAL(timeout()), this, SLOT(slotFakeKeyEvent()));
#endif

  KAccel* accel = new KAccel(this);
  accel->insert("Escape Fullscreen", Key_Escape, this, SLOT(slotEscapeFullscreen()));

  loadConfig();
  slotChangeStatusbar(i18n("Kaffeine Player") + " " + VERSION);

  bool rmdvb=true;
#ifdef HAVE_LINUX_DVB_FRONTEND_H
  if ( dvbPanel ) rmdvb = false;
#endif
  if ( rmdvb ) {
      int i, j;
      for ( i=0; i<(int)menuBar()->count(); i++ ) {
            j = menuBar()->idAt(i);
            if (  menuBar()->text(j)==i18n("&DVB") ) {
                  menuBar()->removeItem(j);
                  break;
            }
      }
  }

  // process command line parameters

  if ((!instantPlay) && (!urls.count()) && (m_playlist->parentWidget()))
  {
     if (m_startWindow)
       m_tabWidget->showPage(m_startWindow);
      else
       m_tabWidget->showPage(m_playlist);
  }
  else
  {
    m_tabWidget->showPage(m_playerContainer);
  }

  bool disc = false;
  for (QStringList::ConstIterator it = urls.begin(); it != urls.end(); ++it)
  {
    if ((*it).lower() == "dvd")
    {
      slotOpenDVD();
      disc = true;
    }
    if ((*it).lower() == "vcd")
    {
      slotOpenVCD();
      disc = true;
    }
    if (((*it).lower() == "audiocd") || ((*it).lower() == "cdda"))
    {
      slotOpenAudioCD();
      disc = true;
    }
  }
  if (!disc)
    loadTMP(urls);
  if (fullscr)
    fullscreen();
  if ((instantPlay) && (!disc) && (!urls.count()))
    slotPlaylistPlay();
}


Generated by  Doxygen 1.6.0   Back to index