SlideShow::SlideShow(QWidget *parent) : QMainWindow(parent) , imageViewer(0) , playlist(0) , statusLabel(0) , countdownLabel(0) , playAction(0) , stopAction(0) { imageViewer = new QMediaImageViewer(this); connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)), this, SLOT(stateChanged(QMediaImageViewer::State))); connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)), this, SLOT(statusChanged(QMediaImageViewer::MediaStatus))); connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int))); playlist = new QMediaPlaylist; imageViewer->bind(playlist); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); QVideoWidget *videoWidget = new QVideoWidget; imageViewer->setVideoOutput(videoWidget); menuBar()->addAction(tr("Open Directory..."), this, SLOT(openDirectory())); menuBar()->addAction(tr("Open Playlist..."), this, SLOT(openPlaylist())); toolBar = new QToolBar; toolBar->setMovable(false); toolBar->setFloatable(false); toolBar->setEnabled(false); toolBar->addAction( style()->standardIcon(QStyle::SP_MediaSkipBackward), tr("Previous"), playlist, SLOT(previous())); stopAction = toolBar->addAction( style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), imageViewer, SLOT(stop())); playAction = toolBar->addAction( style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this, SLOT(play())); toolBar->addAction( style()->standardIcon(QStyle::SP_MediaSkipForward), tr("Next"), playlist, SLOT(next())); addToolBar(Qt::BottomToolBarArea, toolBar); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); countdownLabel = new QLabel; countdownLabel->setAlignment(Qt::AlignRight); statusBar()->addPermanentWidget(statusLabel, 1); statusBar()->addPermanentWidget(countdownLabel); setCentralWidget(videoWidget); }
void MainWindow::createConnections() { connect(this, SIGNAL(windowWasShown()), this, SLOT(initUpdates()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection)); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT(currentWidget(QWidget *))); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), _recorder, SLOT(currentWidget(QWidget *))); connect(_playlistTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_scheduleTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_showInfoTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(ui->actionSupport, SIGNAL(triggered()), this, SLOT(support())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano())); connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui->actionLogoutExit, SIGNAL(triggered()), this, SLOT(exitLogout())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exit())); connect(ui->actionTop, SIGNAL(triggered()), this, SLOT(top())); connect(ui->actionLite, SIGNAL(triggered()), this, SLOT(lite())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openPlaylist())); connect(ui->actionOpenFile, SIGNAL(triggered()), _mediaPlayer, SLOT(openFile())); connect(ui->actionOpenUrl, SIGNAL(triggered()), _mediaPlayer, SLOT(openUrl())); connect(ui->actionSchedule, SIGNAL(triggered()), this, SLOT(showSchedule())); connect(ui->actionScheduleCurrent, SIGNAL(triggered()), this, SLOT(showScheduleCurrent())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); connect(ui->actionSettingsShortcuts, SIGNAL(triggered()), this, SLOT(showSettingsShortcuts())); connect(ui->actionEditPlaylist, SIGNAL(triggered()), this, SLOT(showPlaylistEditor())); connect(ui->actionPlay, SIGNAL(triggered()), _mediaPlayer, SLOT(togglePause())); connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stop())); connect(ui->actionPreview, SIGNAL(triggered(bool)), this, SLOT(preview(bool))); connect(_playlistTab->playlist(), SIGNAL(itemSelected(Channel *)), this, SLOT(playChannel(Channel *))); connect(_previewTimer, SIGNAL(timeout()), ui->actionNext, SLOT(trigger())); if (_trayIcon) { connect(_trayIcon, SIGNAL(restoreClick()), this, SLOT(tray())); connect(ui->actionTray, SIGNAL(triggered()), this, SLOT(tray())); } connect(ui->actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen(bool))); connect(ui->actionMute, SIGNAL(toggled(bool)), _mediaPlayer->osd(), SLOT(mute(bool))); connect(ui->actionVolumeDown, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeDown())); connect(ui->actionVolumeUp, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeUp())); #if defined(Q_OS_LINUX) if (_mediaPlayer->teletextEnabled()) { connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer->osd(), SLOT(teletext(bool))); connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer, SLOT(teletext(bool))); connect(_mediaPlayer->osd(), SIGNAL(teletextClicked()), ui->actionTeletext, SLOT(trigger())); }
// Init functions void MainWindow::createGui() { _mouseTimer = new QTimer(this); _playlistTab = new PlaylistTab(this); _playlistTab->playlist()->setPlaylistModel(_model); ui->tabs->insertTab(0, _playlistTab, QIcon::fromTheme("video-x-generic"), tr("Channels")); ui->tabs->setTabEnabled(0, true); _scheduleTab = new ScheduleTab(this); _scheduleTab->playlist()->setPlaylistModel(_model); ui->tabs->insertTab(1, _scheduleTab, QIcon::fromTheme("x-office-calendar"), tr("Schedule")); ui->tabs->setTabEnabled(1, true); _showInfoTab = new ShowInfoTab(this); ui->tabs->insertTab(2, _showInfoTab, QIcon::fromTheme("dialog-information"), tr("Show Info")); ui->tabs->setTabEnabled(2, true); _recorder = new Recorder(); _recorder->setWidgets(ui->actionRecord); _recorder->setMediaInstance(_mediaPlayer->mediaInstance()); _recorder->createSettings(); _recorder->setPlaylistModel(_model); ui->tabs->insertTab(3, _recorder, QIcon::fromTheme("media-record"), tr("Recorder"), true); ui->tabs->setTabEnabled(3, true); _recordNow = false; ui->tabs->addStaticWidget(_mediaPlayer); ui->tabs->setCurrentIndex(0); _osdFloat = new OsdFloat(this); _osdFloat->resize(_osdFloat->width(), _mediaPlayer->osd()->height()); _osdFloat->setControls(); openPlaylist(true); setState(Vlc::Idle); #if !defined(Q_OS_LINUX) ui->menuMedia->removeAction(ui->actionTeletext); #endif if (globalConfig && !globalConfig->editorEnabled()) ui->menuOptions->removeAction(ui->actionEditPlaylist); qDebug() << "Initialised: GUI"; }
SlideShow::SlideShow(QWidget *parent) : QWidget(parent) , imageViewer(0) , playlist(0) , statusLabel(0) , countdownLabel(0) , playButton(0) , stopButton(0) , viewerLayout(0) { imageViewer = new QMediaImageViewer(this); connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)), this, SLOT(stateChanged(QMediaImageViewer::State))); connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)), this, SLOT(statusChanged(QMediaImageViewer::MediaStatus))); connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int))); playlist = new QMediaPlaylist; imageViewer->bind(playlist); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); QVideoWidget *videoWidget = new QVideoWidget; imageViewer->bind(videoWidget); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); QMenu *openMenu = new QMenu(this); openMenu->addAction(tr("Directory..."), this, SLOT(openDirectory())); openMenu->addAction(tr("Playlist..."), this, SLOT(openPlaylist())); QToolButton *openButton = new QToolButton; openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton)); openButton->setMenu(openMenu); openButton->setPopupMode(QToolButton::InstantPopup); playButton = new QToolButton; playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); playButton->setEnabled(false); connect(playButton, SIGNAL(clicked()), this, SLOT(play())); connect(this, SIGNAL(enableButtons(bool)), playButton, SLOT(setEnabled(bool))); stopButton = new QToolButton; stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setEnabled(false); connect(stopButton, SIGNAL(clicked()), imageViewer, SLOT(stop())); QAbstractButton *nextButton = new QToolButton; nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward)); nextButton->setEnabled(false); connect(nextButton, SIGNAL(clicked()), playlist, SLOT(next())); connect(this, SIGNAL(enableButtons(bool)), nextButton, SLOT(setEnabled(bool))); QAbstractButton *previousButton = new QToolButton; previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); previousButton->setEnabled(false); connect(previousButton, SIGNAL(clicked()), playlist, SLOT(previous())); connect(this, SIGNAL(enableButtons(bool)), previousButton, SLOT(setEnabled(bool))); countdownLabel = new QLabel; QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(previousButton); controlLayout->addWidget(stopButton); controlLayout->addWidget(playButton); controlLayout->addWidget(nextButton); controlLayout->addStretch(1); controlLayout->addWidget(countdownLabel); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(viewerLayout); layout->addLayout(controlLayout); setLayout(layout); }