コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: SSE4/vmf-1
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    coordinatesIsNeeded(true)
{
    ui->setupUi(this);
    ui->enableGpsCheckbox->setChecked(coordinatesIsNeeded);
    ui->videoSlider->setEnabled(false);
    connect(ui->actionOpen, SIGNAL(triggered()), SLOT(openFile()));
    connect(&timer, SIGNAL(timeout()), this, SLOT(stepVideo()));
    connect(ui->videoSlider, SIGNAL(sliderMoved(int)), this, SLOT(startVideo(int)));
    connect(ui->videoSlider, SIGNAL(valueChanged(int)), this, SLOT(startVideo(int)));
    connect(ui->calcSpeedButton, SIGNAL(clicked()), this, SLOT(calculateSpeed()));
    connect(ui->enableGpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(changeGpsOutputState(int)));
    connect(ui->playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
    connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
    ui->playPauseButton->setIcon(icon);

    icon = pStyle->standardIcon(QStyle::SP_MediaStop);
    ui->stopButton->setIcon(icon);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
コード例 #2
0
ファイル: aplayer.cpp プロジェクト: chemikadze/oldschool
APlayer::APlayer()
{
	old = 0;

	m_fsModel = new QFileSystemModel(this);
	m_fsModel->setRootPath("/");
	m_fsModel->setFilter(QDir::Dirs | QDir::Drives | QDir::NoDotAndDotDot);

	w_fileSystemTree = new QTreeView();
	w_fileSystemTree->setModel(m_fsModel);
	w_fileSystemTree->setSelectionMode(QAbstractItemView::SingleSelection);

	w_folderContents = new QTreeWidget();
	w_folderContents->setHeaderLabels(QStringList() << "Artist" << "Title" << "Album" << "Year");

	w_splitter = new QSplitter();
	w_splitter->setOrientation(Qt::Horizontal);
	w_splitter->addWidget(w_fileSystemTree);
	w_splitter->addWidget(w_folderContents);
	w_splitter->setStretchFactor(0, 40);
	w_splitter->setStretchFactor(1, 60);

	w_playPause = new QPushButton(QIcon::fromTheme("media-playback-start"), tr(""));
	w_stop = new QPushButton(QIcon::fromTheme("media-playback-stop"), tr(""));
	w_sound = new QPushButton(QIcon::fromTheme("player-volume"), tr(""));

	w_progress = new QSlider(Qt::Horizontal);

	m_media = Phonon::createPlayer(Phonon::MusicCategory);
	m_media->setTickInterval(1000);

	la_playerButtons = new QHBoxLayout();
	la_playerButtons->addWidget(w_playPause);
	la_playerButtons->addWidget(w_stop);
	la_playerButtons->addWidget(w_sound);
	la_playerButtons->addWidget(w_progress);

	la_mainWindow = new QVBoxLayout();
	la_mainWindow->addWidget(w_splitter);
	la_mainWindow->addLayout(la_playerButtons);

	QWidget *w = new QWidget();
	w->setLayout(la_mainWindow);
	setCentralWidget(w);


	connect(w_fileSystemTree, SIGNAL(clicked(QModelIndex)), this, SLOT(treeItemClicked(QModelIndex)));

	connect(w_playPause, SIGNAL(clicked()), this, SLOT(playPause()));
	connect(w_stop, SIGNAL(clicked()), this, SLOT(stop()));

	connect(w_fileSystemTree, SIGNAL(collapsed(QModelIndex)), this, SLOT(treeChanged()));
	connect(w_fileSystemTree, SIGNAL(expanded(QModelIndex)), this, SLOT(treeChanged()));

	connect(m_media, SIGNAL(tick(qint64)), this, SLOT(setPlaybackState(qint64)));
	connect(m_media, SIGNAL(totalTimeChanged(qint64)), this, SLOT(setPlaybackMax(qint64)));

	connect(w_folderContents, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(fileDoubleClicked(QTreeWidgetItem*,int)));
}
コード例 #3
0
PlayerWidget::PlayerWidget(QWidget *parent) :
		QWidget(parent)
{
	infoLabel = new QLabel;
	imageLabel = new QLabel;
	playPauseButton = new QPushButton;
	stopButton = new QPushButton;
	positionSlider = new QSlider(Qt::Horizontal);
	playTimer = new QTimer;
	fpsSpinBox = new MyDoubleSpinBox;

	currentIndex = 0;
	playTimer->setInterval(30);
	playPauseButton->setEnabled(true);
	playPauseButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
	stopButton->setEnabled(true);
	stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
	imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	imageLabel->setAlignment(Qt::AlignCenter);
	fpsSpinBox->setMinimum(0.01);
	fpsSpinBox->setMaximum(100);
	fpsSpinBox->setDecimals(2);
	fpsSpinBox->setValue(30);

	QLabel *fpsLabel = new QLabel("FPS");
	QHBoxLayout *controlLayout = new QHBoxLayout;
	controlLayout->setMargin(5);
	controlLayout->addWidget(stopButton);
	controlLayout->addWidget(playPauseButton);
	controlLayout->addWidget(positionSlider);
	controlLayout->addWidget(fpsLabel);
	controlLayout->addWidget(fpsSpinBox);
	controlLayout->addWidget(infoLabel);

	QBoxLayout *layout = new QVBoxLayout;

	layout->setMargin(0);
	layout->addWidget(imageLabel);
	layout->addLayout(controlLayout);
	layout->setStretch(0, 1);
	setLayout(layout);

//	QDir imageDir = QDir(gPar->Get<QString>("anim_flight_dir"));
//	QStringList imageFileExtensions;
//	imageFileExtensions << "*.jpg" << "*.jpeg" << "*.png";
//	imageDir.setNameFilters(imageFileExtensions);
//	imageFiles = imageDir.entryList(QDir::NoDotAndDotDot | QDir::Files);

	connect(positionSlider, SIGNAL(sliderMoved(int)), this, SLOT(setPosition(int)));
	connect(playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
	connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));
	connect(playTimer, SIGNAL(timeout()), this, SLOT(nextFrame()));
	connect(fpsSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setFPS(double)));
	QApplication::connect(&imageFolderWatcher,
												SIGNAL(directoryChanged(const QString&)),
												this,
												SLOT(updateFromFolder()));
}
コード例 #4
0
ファイル: PhMediaPanel.cpp プロジェクト: Alexandr-Galko/Joker
void PhMediaPanel::onPlayPause()
{
	if(_clock) {
		if(_clock->rate())
			_clock->setRate(0);
		else
			_clock->setRate(1);
	}
	emit playPause();
}
コード例 #5
0
ファイル: mainwindow.cpp プロジェクト: lilemon63/ProjetSI2
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    m_areaMode( Default ),
    m_extractor(new VideoExtractor() ),
    m_isHandleActived(true),
    m_isPlay(false),
    m_subImage(nullptr),
    m_subImageSource1(nullptr),
    m_subImageSource2(nullptr),
    m_subResults(nullptr),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->mdiArea->setMainWindow(this);

    connect(ui->actionQuitter, SIGNAL(triggered()), qApp, SLOT( quit() ) );

    connect(ui->buttonPrevious, SIGNAL(clicked()), m_extractor, SLOT(previous()));
    connect(ui->buttonNext, SIGNAL(clicked()), m_extractor, SLOT(next()));

    ui->mdiAreaMode->addItem("Default", Default);
    ui->mdiAreaMode->addItem("Tabulation", Tabulation);
    ui->mdiAreaMode->addItem("Libre", Free);

    int max = 1<<(sizeof(int)*8-2) ;

    m_extractor->changeHandleParameters( new ComboBox("Traitement", VirtualHandle::getAllHandleName(),
                                                      MainHandle),
                                            ui->parametersArea );
    m_extractor->changePeriodeParameters( new Slider("Time", 200000000, 0, max) ,
                                          ui->parametersArea );

    /* obligatoire, à n'appeler qu'une unique fois et dans une fonction /!\ */
    qRegisterMetaType<ImageDataPtr>("ImageDataPtr");
    connect( m_extractor, SIGNAL(imageHandled(ImageDataPtr,ImageDataPtr,ImageDataPtr) ),
             this, SLOT(setImage(ImageDataPtr,ImageDataPtr,ImageDataPtr) ) );
    connect( m_extractor, SIGNAL(streamFinished()), this, SLOT(playPause()));

    VideoReader * cam1 = new VideoReader();
    cam1->useCamera(); //or FolderReader * cam1 = new FolderReader("img/");

    m_extractor->useSource(cam1, 0);
    m_extractor->showParameters( ui->parametersArea );

    ui->mdiAreaMode->setCurrentIndex( ui->mdiAreaMode->findData(m_areaMode) );
    VirtualHandle::setView(ui->mdiArea);

    ui->sliderCurseur->setTracking(true);

    m_extractor->start();
    updateSeek();
}
コード例 #6
0
ファイル: timeToolBar.cpp プロジェクト: davidmueller13/vexx
timeToolBar::timeToolBar( timeDock *d ) : _dock( d )
{
    addAction( QIcon(":/skipBw.png"), "Skip Backwards", this, SLOT(skipBw()) );

    addAction( QIcon(":/stepBw.png"), "Step Backwards", _dock, SLOT(stepBw()) )->setShortcut( QKeySequence( Qt::Key_Left ) );

    _playPause = addAction( QIcon(":/play.png"), "Play" );
    _playPause->setShortcut( QKeySequence( Qt::Key_Space ) );
    _playPause->setData( FALSE );
    connect( _playPause, SIGNAL(triggered()), this, SLOT(playPause()) );

    addAction( QIcon(":/stepFw.png"), "Step Forwards", _dock, SLOT(stepFw()) )->setShortcut( QKeySequence( Qt::Key_Right ) );

    addAction( QIcon(":/skipFw.png"), "Skip Forwards", this, SLOT(skipFw()) );
}
コード例 #7
0
ファイル: MediaPlayer.cpp プロジェクト: Argoday/IPL
MediaPlayer::MediaPlayer(Data::DataManager * const _dataManager)
	:dataManager(_dataManager)
	,player(_dataManager)
{
	auto videoWidget = new Video::Widget();
	auto surface = videoWidget->videoSurface();

	player.start(surface);
	mediaControl = player.getMediaControl();

	playPauseButton = new QPushButton;
	playPauseButton->setEnabled(false);
	playPauseButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
	playPauseButton->setText("PlayPause");

	connect(playPauseButton, SIGNAL(clicked()),this, SLOT(playPause()));

	positionSlider = new QSlider(Qt::Horizontal);
	positionSlider->setRange(0, 10000);
	connect(positionSlider, SIGNAL(sliderMoved(int)),this, SLOT(sliderChanged(int)));
	connect(positionSlider, SIGNAL(sliderPressed()),this, SLOT(sliderPressed()));
	connect(positionSlider, SIGNAL(sliderReleased()),this, SLOT(sliderReleased()));

	connect(surface, SIGNAL(frameChanged(I8u)),this, SLOT(frameChanged(I8u)));
	connect(surface, SIGNAL(durationFramesChanged(I8u)),this, SLOT(durationFramesChanged(I8u)));

	connect(this, SIGNAL(setSlider(int)),positionSlider, SLOT(setValue(int)));
	
	QBoxLayout * controlLayout = new QHBoxLayout;
	controlLayout->addWidget(playPauseButton);
	controlLayout->addWidget(positionSlider);

	QBoxLayout * layout = new QVBoxLayout;
	layout->addWidget(videoWidget);
	layout->addLayout(controlLayout);

	createActions();
	createMenus();

	auto window = new QWidget;
	window->setLayout(layout);
	setCentralWidget(window);

	setWindowTitle(tr("Media Player"));
	resize(600, 600);
	
}
コード例 #8
0
ファイル: qxtmediakeys.cpp プロジェクト: FCR001/cantata
void QxtMediaKeys::createShortcuts()
{
    if (!shortcuts.isEmpty()) {
        return;
    }
    QxtGlobalShortcut *shortcut = new QxtGlobalShortcut(Qt::Key_MediaPlay, this);
    connect(shortcut, SIGNAL(activated()), this, SIGNAL(playPause()));
    shortcuts.append(shortcut);
    shortcut = new QxtGlobalShortcut(Qt::Key_MediaStop, this);
    connect(shortcut, SIGNAL(activated()), this, SIGNAL(stop()));
    shortcuts.append(shortcut);
    shortcut = new QxtGlobalShortcut(Qt::Key_MediaNext, this);
    connect(shortcut, SIGNAL(activated()), this, SIGNAL(next()));
    shortcuts.append(shortcut);
    shortcut = new QxtGlobalShortcut(Qt::Key_MediaPrevious, this);
    connect(shortcut, SIGNAL(activated()), this, SIGNAL(previous()));
    shortcuts.append(shortcut);
}
コード例 #9
0
void OnKeyPress(int key)
{
	if (key == '1') mgr->setNumWorkerThreads(1);
	if (key == '2') mgr->setNumWorkerThreads(2);
	if (key == '3') mgr->setNumWorkerThreads(3);
	if (key == '4') mgr->setNumWorkerThreads(4);
	if (key >= 1 && key <= 4) playPause(key-1); // Function keys are used for play/pause

	if (key == 5 || key == 6 || key == 7)
	{
		TheoraOutputMode mode;
		if (key == 5) mode=TH_RGB;
		if (key == 6) mode=TH_YUV;
		if (key == 7) mode=TH_GREY3;

		for (int i=0;i<4;i++) clips[i]->setOutputMode(mode);
	}
}
コード例 #10
0
ファイル: window.cpp プロジェクト: Amos-zq/marsyas
Window::Window(const QString & inAudioFileName)
{

  mainWidget = new QWidget();

  setCentralWidget(mainWidget);

  glWidget = new GLWidget(inAudioFileName);

  glWidget->setMinimumSize(500,500);
  glWidget->setMaximumSize(500,500);

  createActions();
  createMenus();

  // A play/pause button
  playpause_button  = new QPushButton(tr("Play/Pause"));
  // Connect a click signal on the go button to a slot to start the rotation time
  connect(playpause_button, SIGNAL(clicked()), glWidget, SLOT(playPause()));

  // A main layout to hold everything
  QHBoxLayout *layout = new QHBoxLayout;

  // The OpenGL window and the sliders to move it interactively
  QVBoxLayout *gl_layout = new QVBoxLayout;
  gl_layout->addWidget(glWidget);


  // Controls for the animation
  QVBoxLayout *buttons_layout = new QVBoxLayout;
  // buttons_layout->addWidget(powerSpectrumModeLabel);
  // buttons_layout->addWidget(powerSpectrumModeCombo);
  buttons_layout->addWidget(playpause_button);
  gl_layout->addLayout(buttons_layout);

  layout->addLayout(gl_layout);

  // Set the layout for this widget to the layout we just created
  mainWidget->setLayout(layout);

  setWindowTitle(tr("MarSndPeek"));
}
コード例 #11
0
void MainWindow::setShortcuts() {
    // Global shortcuts
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_W), this, SLOT(showHide()), "Show/Hide");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_P), this, SLOT(showHide()), "Show/Hide");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_X), &player_, SLOT(play()), "Play");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_C), &player_, SLOT(playPause()),
                      "Play/Pause");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_A), &player_, SLOT(prev()), "Prev");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Z), &player_, SLOT(next()), "Next");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_V), &player_, SLOT(stop()), "Stop");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_PageUp), this, SLOT(increaseVolume()),
                      "Increase volume");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_PageDown), this, SLOT(decreaseVolume()),
                      "Decrease volume");

    // App shortcuts
    addShortcut(QKeySequence(Qt::CTRL + Qt::Key_J), SLOT(focusFilter()));
    //     addShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), SLOT(removeActivePlaylist()));
    addShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), SLOT(showHideConsole()),
                Qt::ApplicationShortcut);
}
コード例 #12
0
// constructor: warm up all stuff
MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
//,audioInfo(QAudioDeviceInfo::defaultInputDevice())
{
  // draws the ui
  ui->setupUi(this);

  // test for saving settings
  QCoreApplication::setOrganizationName("Agostinho");

  /** some settings attempt
   */
  QSettings settings; /*!<aloha */
  settings.setValue("alo","maria");

  // defines sample size equals to spectrum size
  sample.resize(SPECSIZE);

  // threads are as separate processes running within the same
  // program. for fft calculation, it is better to move it
  // to another thread to make the calcs faster.
  // moreover, it will not slow down the ui
//  fftThread = new QThread(this);

  calculator = new FFTCalc();
 // calculator->moveToThread(fftThread);

  // launches the new media player
  player = new QMediaPlayer();

  // starts a new playlist
  playlist = new QMediaPlaylist();

  // starts the playlist model
  playlistModel = new PlaylistModel(this);

  // tell playlistmodel where is the playlist
  playlistModel->setPlaylist(playlist);

  // attach the listView to the playlistModel
  ui->listViewPlaylist->setModel(playlistModel);

  // set current index to the first element
  ui->listViewPlaylist->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));

  loadPlaylist();

  // attachs the playlist to the player
  player->setPlaylist(playlist);

  // playlist plays in loop mode. It restarts after last song has finished playing.
  playlist->setPlaybackMode(QMediaPlaylist::Loop);

  // this allow the user to select the media it wants to play
  connect(ui->listViewPlaylist, SIGNAL(doubleClicked(QModelIndex)),
          this, SLOT(goToItem(QModelIndex)));

  // if some metadata changed for media, display it somewhere
  // it seems not work on windows
  // but works for linux :)
  connect(player,SIGNAL(metaDataChanged()),
          this, SLOT(metaDataChanged()));

  // the media status changed (new stream has arrived)
  connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
          this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));

  // the user selected a new position on music to play
  // perharps using some scrollbar
  connect(this,SIGNAL(positionChanged(qint64)),
          player,SLOT(setPosition(qint64)));

  connect(player,SIGNAL(volumeChanged(int)),
                        ui->control,SLOT(onVolumeChanged(int)));

  connect(player,SIGNAL(stateChanged(QMediaPlayer::State)),
          SLOT(mediaStateChanged(QMediaPlayer::State)));
  // that is the audio probe object that "listen to"
  // the music. It will help with fft stuff
  probe = new QAudioProbe();

  // fft is delivered using a QVector<double> but
  // signal/slot scheme does not recognizes this type by default
  // therefore, we have to register it
  qRegisterMetaType< QVector<double> >("QVector<double>");

  // here goes the control unit event handlers
  connect(ui->control, SIGNAL(playPause()), this, SLOT(playPause()));
  connect(ui->control, SIGNAL(prev()), this, SLOT(prev()));
  connect(ui->control, SIGNAL(next()), this, SLOT(next()));
  connect(this, SIGNAL(playPauseChanged(bool)),
          ui->control,SLOT(onPlayerStateChanged(bool)));

  // when the music position changes on player, it has to be
  // informed to the control unit to redraw it ui
  connect(player, SIGNAL(positionChanged(qint64)),
          ui->control,SLOT(onElapsedChanged(qint64)));

  // fft goes here...
  // if a new audio buffer is ok, we have to make some
  // calcs (fft) to display the spectrum
  connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),
          this, SLOT(processBuffer(QAudioBuffer)));

  // when fft is available, we deliver it to
  // the visualization widget
  connect(this,  SIGNAL(spectrumChanged(QVector<double>&)),
          ui->visualizer,SLOT(loadSamples(QVector<double>&)));

  // communicate the left and right audio levels...
  // ...mean levels
  connect(this,  SIGNAL(levels(double,double)),
          ui->visualizer,SLOT(loadLevels(double,double)));

  // when fft is available, we deliver it to
  // the visualization widget
  //connect(this,  SIGNAL(spectrumChanged(QVector<double>&)),
  //       ui->glVisualizer,SLOT(loadSamples(QVector<double>&)));

  // communicate the left and right audio levels...
  // ...mean levels
  //connect(this,  SIGNAL(levels(double,double)),
  //       ui->glVisualizer,SLOT(loadLevels(double,double)));

  // if the user selected a new position on stream to play
  // we have to tell it to the player
  connect(ui->control, SIGNAL(elapsedSelected(qint64)),
          player, SLOT(setPosition(qint64)));

  // changing audio volume
  connect(ui->control, SIGNAL(volumeSelected(int)),
          player, SLOT(setVolume(int)));

  // calculator is the thead that calcs the ffts we need to display
  // every time a new spectrum is available, the calculator
  // emits a calculatedSpectrum signal
  connect(calculator, SIGNAL(calculatedSpectrum(QVector<double>)),
          this, SLOT(spectrumAvailable(QVector<double>)));

  connect(ui->library,SIGNAL(addMediaToPlayList(QString)),
          SLOT(onAddMediaToPlayList(QString)));

  // tells the probe what to probe
  probe->setSource(player);

  // load directories to library
  connect(ui->actionLoadDirectory,SIGNAL(triggered()),this,SLOT(onAddFolderToLibrary()));

  // load a single file to library
  connect(ui->actionLoadFile,SIGNAL(triggered()),this,SLOT(loadMedia()));

  // it connects the signals emiteds via the visualizer to the buttons (ui->control) and the lightCycle(ui->widgetInfo)
  connect(ui->visualizer,SIGNAL(trocaCor(QColor)),ui->control,SLOT(onColorChanged(QColor)));
  connect(ui->visualizer,SIGNAL(trocaCor(QColor)),ui->widgetInfo,SLOT(changedColor(QColor)));

  //this->setStyleSheet(QString("QMainWindow {background-color: black}"));
}
コード例 #13
0
ファイル: capture.cpp プロジェクト: KDE/phonon
CaptureWidget::CaptureWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f)
{
    // Create the objects used for capture
    m_media = new Phonon::MediaObject(this);

    // Create the audio and video outputs (sinks)
    m_audioOutput = new Phonon::AudioOutput(this);
    m_videoWidget = new Phonon::VideoWidget(this);

    /*
     * Set up the buttons and layouts and widgets
     */
    m_playButton = new QPushButton(this);
    m_playButton->setText(tr("Play"));
    connect(m_playButton, SIGNAL(clicked()), this, SLOT(playPause()));

    m_stopButton = new QPushButton(this);
    m_stopButton->setText(tr("Stop"));
    m_stopButton->setEnabled(false);
    connect(m_stopButton, SIGNAL(clicked()), m_media, SLOT(stop()));

    setLayout(new QVBoxLayout);

    // Configure the video widget a bit
    m_videoWidget->setMinimumSize(QSize(400, 300));
    m_videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    layout()->addWidget(m_videoWidget);

    QHBoxLayout *buttonsLayout = new QHBoxLayout();
    buttonsLayout->addWidget(m_playButton);
    buttonsLayout->addWidget(m_stopButton);
    layout()->addItem(buttonsLayout);

    /*
     * Create the paths from the capture object to the outputs
     * If the paths are invalid, then probably the backend doesn't support capture
     */
    Phonon::Path audioPath = Phonon::createPath(m_media, m_audioOutput);
    Phonon::Path videoPath = Phonon::createPath(m_media, m_videoWidget);

    if (!audioPath.isValid()) {
        QMessageBox::critical(this, "Error", "Your backend may not support audio capturing.");
    }
    if (!videoPath.isValid()) {
        QMessageBox::critical(this, "Error", "Your backend may not support video capturing.");
    }

    /*
     * Set up the devices used for capture
     * Phonon can easily get you the devices appropriate for a specific category.
     */
    Phonon::MediaSource source(Phonon::Capture::VideoType, Phonon::NoCaptureCategory);
    m_media->setCurrentSource(source);

    // Connect the stateChanged signal from the media object used for capture
    connect(m_media, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
            this, SLOT(mediaStateChanged(Phonon::State)));

    // Start capturing
    playPause();
}
コード例 #14
0
int audioMultiPlayer::playSound(string songPath, string songName, bool firstStart, pthread_mutex_t* mut) {
    int key;

    /*
        Create a System object and initialize.
     */
    result = FMOD::System_Create(&system);
    utilities::ERRCHECK(result);

    result = system->setOutput(FMOD_OUTPUTTYPE_ALSA);
    utilities::ERRCHECK(result);

    result = system->init(32, FMOD_INIT_NORMAL, 0);
    utilities::ERRCHECK(result);

    /* INIT SONG */
    result = system->createSound(songPath.c_str(), FMOD_SOFTWARE, 0, &sound1);
    utilities::ERRCHECK(result);

    

    if (firstStart) {
        printf("===================================================================\n");
        printf("Lecteur Audio (Mix)\n");
        printf("===================================================================\n");
        printf("1) %s\n", songName.c_str());
    } else if (!firstStart) {
		sleep(1);
        printf("2) %s\n", songName.c_str());
        printf("===================================================================\n");
        printf("\n");
        printf("'Space' -> FadIn/FadOut\n");
        printf("'Esc'   -> Quitter\n");
        printf("\n");
    }
	
	/* PLAY SONG */
    result = system->playSound(FMOD_CHANNEL_FREE, sound1, 0, &channel);
    utilities::ERRCHECK(result);
	
	if(!firstStart) {
		channel->setVolume(0.0f);
        playPause();
	}

    do {
        //FADIN
        if (flagFadIn) {
            float volume;
            channel->getVolume(&volume);
            channel->setVolume(volume + 0.0005f);
            usleep(1000);
            if (volume == 1.0f) {
                flagFadIn = false;
                pthread_mutex_unlock(mut);
                if (firstStart) {
                    printf("FadIn finish for first song (mutex unlock)\n");
                } else {
                    printf("FadIn finish for second song (mutex unlock)\n");
                }
                fflush(stdout);
            }
        }

        //FADOUT
        if (flagFadOut) {
            float volume;
            channel->getVolume(&volume);
            channel->setVolume(volume - 0.0005f);
            usleep(1000);
            if (volume == 0.0f) {
                flagFadOut = false;
                playPause();
                ualarm(1,0);
                if (firstStart) {
                    printf("FadOut finish for first song\n");
                } else {
                    printf("FadOut finish for second song\n");
                }
                fflush(stdout);
            }
        }

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            bool playing = 0;
            bool paused = 0;

            if (channel) {
                FMOD::Sound *currentsound = 0;

                result = channel->isPlaying(&playing);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN)) {
                    utilities::ERRCHECK(result);
                }

                result = channel->getPaused(&paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN)) {
                    utilities::ERRCHECK(result);
                }

                result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN)) {
                    utilities::ERRCHECK(result);
                }

                channel->getCurrentSound(&currentsound);
                if (currentsound) {
                    result = currentsound->getLength(&lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN)) {
                        utilities::ERRCHECK(result);
                    }
                }
            }
        }
    } while (key != 27);

    printf("\n");

    release();
    return 0;
}
コード例 #15
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    play_or_pause_ = true;
    selected_item_ = NULL;
    SceneContainer::viewer_reference_ = ui->viewer;

    this->setWindowTitle(QString("Animation Studio"));
    connect( ui->button_play, SIGNAL(clicked()), ui->viewer, SLOT(play()) );
    connect( ui->button_stop, SIGNAL(clicked()), ui->viewer, SLOT(stop()));
    connect( ui->button_stop, SIGNAL(clicked()), this, SLOT(stop()));

    connect(ui->button_play,SIGNAL(clicked()),this,SLOT(playPause()));

    connect(ui->viewer,SIGNAL(signalUpdateObjects()),this,SLOT(updateObjects()));

    connect( ui->timebar, SIGNAL(setSelectedFrame(int)), ui->viewer, SLOT(setCurrentFrame(int)));
    connect( ui->timebar, SIGNAL(setSelectedFrame(int)), this, SLOT(selectedFramePause()) );
    connect( ui->viewer, SIGNAL(currentFrame(int)), ui->timebar, SLOT(setCurrentFrame(int)));

    connect( ui->spin_frame_count, SIGNAL(valueChanged(int)), this, SLOT(updateFrameCount(int)));

    connect( ui->combo_velocity_control, SIGNAL(activated(int)), this, SLOT(updateSpeedControl(int)));

    connect( ui->combo_pos_interpolator, SIGNAL(activated(int)), this, SLOT(updatePositionInterpolation(int)));
    connect( ui->combo_ori_interpolator, SIGNAL(activated(int)), this, SLOT(updateOrientationInterpolation(int)));

    connect( ui->checkbox_freeze_pos, SIGNAL(clicked()), this, SLOT(updateFreeze()));
    connect( ui->checkbox_freeze_ori, SIGNAL(clicked()), this, SLOT(updateFreeze()));

    // Object 3D Manipulation

    connect( ui->line_edit_label, SIGNAL(textChanged(QString)), this, SLOT(updateSelectedLabel(QString)));

    connect( ui->add_keyframe_pos, SIGNAL(pressed()), this, SLOT(addPositionKeyframe()));
    connect( ui->add_keyframe_ori, SIGNAL(pressed()), this, SLOT(addOrientationKeyframe()));
    connect( ui->rem_keyframe_pos, SIGNAL(pressed()), this, SLOT(removePositionKeyframe()));
    connect( ui->rem_keyframe_ori, SIGNAL(pressed()), this, SLOT(removeOrientationKeyframe()));

    connect( ui->push_button_traj_pos, SIGNAL(toggled(bool)), this, SLOT(displayTrajectoryPosition(bool)));
    connect( ui->push_button_traj_ori, SIGNAL(toggled(bool)), this, SLOT(displayTrajectoryOrientation(bool)));

    //render
    connect( ui->checkbox_render_box, SIGNAL(toggled(bool)), this, SLOT(updateRenderBox(bool)) );
    connect( ui->checkBox_render_bones, SIGNAL(toggled(bool)), this, SLOT(updateRenderBones(bool)) );

    connect( ui->comboBox_shader, SIGNAL(currentIndexChanged(int)), ui->viewer, SLOT(setCurrentShader(int)) );

    //scene
    connect( ui->comboBox_scene, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCurrentScene(int)) );

    connect( ui->viewer, SIGNAL(updateSelected(int)), this, SLOT(setSelectedByID(int)) );

    //connect( ui->push_ikmode, SIGNAL(toggled(bool)), this, SLOT(setIKMode(bool)) );

    connect( ui->inverse, SIGNAL(currentIndexChanged(int)), this, SLOT(setInverse(int)) );

    connect(ui->tab_widget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));

    connect(ui->combo_end, SIGNAL(currentIndexChanged(int)), this, SLOT(setIKTarget()) );

    connect(ui->spinx, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );
    connect(ui->spiny, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );
    connect(ui->spinz, SIGNAL(valueChanged(double)), this, SLOT(changeGoal()) );

    connect(ui->save_orientations, SIGNAL(clicked()), this, SLOT(saveAngles()) ) ;

    connect(ui->spin_frame, SIGNAL(valueChanged(int)), this, SLOT(changeCurrentFrame(int)) );


    // interface
    this->showMaximized();

    play_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/play.png")));
    pause_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/pause.png")));
    stop_icon = QIcon(QPixmap::fromImage(QImage(":/buttons/stop.png")));
}
コード例 #16
0
ファイル: musiclayouta.cpp プロジェクト: aarontc/mcar
void MusicLayoutA::on_btnPlayPause_clicked() {
	emit playPause();
}
コード例 #17
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
	m_ui(new Ui::MainWindow),
	m_currentSubtitle(0),
	m_currentTrack(0)
{
	m_subtitles.append(QList<Subtitle>());
	m_subtitles.append(QList<Subtitle>());

	m_ui->setupUi(this);

	Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(this);
	audioOutput->setVolume(QSettings().value("volume", 0.8).toReal());

	m_mediaObject = new Phonon::MediaObject(this);
	m_mediaObject->setTickInterval(100);

	Phonon::createPath(m_mediaObject, m_ui->videoWidget);
	Phonon::createPath(m_mediaObject, audioOutput);

	m_ui->actionPlayPause->setIcon(QIcon::fromTheme("media-playback-start", style()->standardIcon(QStyle::SP_MediaPlay)));
	m_ui->actionPlayPause->setShortcut(tr("Space"));
	m_ui->actionPlayPause->setDisabled(true);

	m_ui->actionStop->setIcon(QIcon::fromTheme("media-playback-stop", style()->standardIcon(QStyle::SP_MediaStop)));
	m_ui->actionStop->setDisabled(true);

	m_fileNameLabel = new QLabel(tr("No file loaded"), this);
	m_fileNameLabel->setMaximumWidth(300);
	m_timeLabel = new QLabel("00:00.0 / 00:00.0", this);

	m_ui->actionOpen->setIcon(QIcon::fromTheme("document-open", style()->standardIcon(QStyle::SP_DirOpenIcon)));
	m_ui->actionSave->setIcon(QIcon::fromTheme("document-save", style()->standardIcon(QStyle::SP_DialogSaveButton)));
	m_ui->actionSaveAs->setIcon(QIcon::fromTheme("document-save-as"));
	m_ui->actionExit->setIcon(QIcon::fromTheme("application-exit", style()->standardIcon(QStyle::SP_DialogCloseButton)));
	m_ui->actionAdd->setIcon(QIcon::fromTheme("list-add"));
	m_ui->actionRemove->setIcon(QIcon::fromTheme("list-remove"));
	m_ui->actionPrevious->setIcon(QIcon::fromTheme("go-previous"));
	m_ui->actionNext->setIcon(QIcon::fromTheme("go-next"));
	m_ui->actionRescale->setIcon(QIcon::fromTheme("chronometer"));
	m_ui->actionAboutApplication->setIcon(QIcon::fromTheme("help-about"));
	m_ui->playPauseButton->setDefaultAction(m_ui->actionPlayPause);
	m_ui->stopButton->setDefaultAction(m_ui->actionStop);
	m_ui->addButton->setDefaultAction(m_ui->actionAdd);
	m_ui->removeButton->setDefaultAction(m_ui->actionRemove);
	m_ui->previousButton->setDefaultAction(m_ui->actionPrevious);
	m_ui->nextButton->setDefaultAction(m_ui->actionNext);
	m_ui->seekSlider->setMediaObject(m_mediaObject);
	m_ui->volumeSlider->setAudioOutput(audioOutput);
	m_ui->statusBar->addPermanentWidget(m_fileNameLabel);
	m_ui->statusBar->addPermanentWidget(m_timeLabel);

	resize(QSettings().value("Window/size", size()).toSize());
	move(QSettings().value("Window/position", pos()).toPoint());
	restoreState(QSettings().value("Window/state", QByteArray()).toByteArray());

	setWindowTitle(tr("%1 - Unnamed").arg("Subtitles Editor"));

	connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen()));
	connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(actionSave()));
	connect(m_ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs()));
	connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(m_ui->actionAdd, SIGNAL(triggered()), this, SLOT(addSubtitle()));
	connect(m_ui->actionRemove, SIGNAL(triggered()), this, SLOT(removeSubtitle()));
	connect(m_ui->actionPrevious, SIGNAL(triggered()), this, SLOT(previousSubtitle()));
	connect(m_ui->actionNext, SIGNAL(triggered()), this, SLOT(nextSubtitle()));
	connect(m_ui->actionRescale, SIGNAL(triggered()), this, SLOT(rescaleSubtitles()));
	connect(m_ui->actionPlayPause, SIGNAL(triggered()), this, SLOT(playPause()));
	connect(m_ui->actionStop, SIGNAL(triggered()), m_mediaObject, SLOT(stop()));
	connect(m_ui->actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt()));
	connect(m_ui->actionAboutApplication, SIGNAL(triggered()), this, SLOT(actionAboutApplication()));
	connect(m_ui->trackComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectTrack(int)));
	connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State)));
	connect(m_mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick()));
	connect(m_mediaObject, SIGNAL(finished()), this, SLOT(finished()));
}
コード例 #18
0
ファイル: window.cpp プロジェクト: Amos-zq/marsyas
Window::Window(const QString & inAudioFileName)
{

  mainWidget = new QWidget();

  setCentralWidget(mainWidget);

  glWidget = new GLWidget(inAudioFileName);

  glWidget->setMinimumSize(500,500);
  glWidget->setMaximumSize(500,500);

  createActions();
  createMenus();

  // Create the x,y,z sliders
  xSlider = createRotationSlider();
  ySlider = createRotationSlider();
  zSlider = createRotationSlider();

  // The y-scale slider
  yScaleSlider = createSlider(0,1000,10,100,50);

  // A play/pause button
  playpause_button  = new QPushButton(tr("Play/Pause"));

  // A combo box for choosing the power spectrum calculation
  powerSpectrumModeCombo = new QComboBox;
  powerSpectrumModeCombo->addItem(tr("Power"));
  powerSpectrumModeCombo->addItem(tr("Magnitude"));
  powerSpectrumModeCombo->addItem(tr("Decibels"));
  powerSpectrumModeCombo->addItem(tr("Power Density"));

  powerSpectrumModeLabel = new QLabel(tr("&PowerSpectrum mode:"));
  powerSpectrumModeLabel->setBuddy(powerSpectrumModeCombo);

  //   // A combo box for choosing the fft bin size
  //   fftBinsModeCombo = new QComboBox;
  //   fftBinsModeCombo->addItem(tr("32"));
  //   fftBinsModeCombo->addItem(tr("64"));
  //   fftBinsModeCombo->addItem(tr("128"));
  //   fftBinsModeCombo->addItem(tr("256"));
  //   fftBinsModeCombo->addItem(tr("1024"));
  //   fftBinsModeCombo->addItem(tr("2048"));
  //   fftBinsModeCombo->addItem(tr("4096"));
  //   fftBinsModeCombo->addItem(tr("8192"));
  //   fftBinsModeCombo->addItem(tr("16384"));
  //   fftBinsModeCombo->addItem(tr("32768"));

  //   fftBinsModeLabel = new QLabel(tr("&Number of FFT Bins:"));
  //   fftBinsModeLabel->setBuddy(fftBinsModeCombo);

//     waterfallCheckBox = new QCheckBox(tr("&Waterfall"));
//     waterfallCheckBox->setChecked(true);

  // 	// Connect a click signal on the go button to a slot to start the rotation time
  connect(playpause_button, SIGNAL(clicked()), glWidget, SLOT(playPause()));

  // Connect up the x,y,z sliders with slots to set the rotation values
  connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
  connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
  connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
  connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
  connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
  connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));

  // Scale sliders
  connect(yScaleSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYScale(int)));

  connect(powerSpectrumModeCombo, SIGNAL(currentIndexChanged(int)), glWidget, SLOT(powerSpectrumModeChanged(int)));

//   connect(waterfallCheckBox, SIGNAL(toggled(bool)), glWidget, SLOT(setWaterfallVisible(bool)));

  // A main layout to hold everything
  QHBoxLayout *layout = new QHBoxLayout;

  // The OpenGL window and the sliders to move it interactively
  QVBoxLayout *gl_layout = new QVBoxLayout;
  gl_layout->addWidget(glWidget);

  QHBoxLayout *x_slider_layout = new QHBoxLayout;
  QLabel *x_slider_label = new QLabel(("X"));
  x_slider_layout->addWidget(x_slider_label);
  x_slider_layout->addWidget(xSlider);
  gl_layout->addLayout(x_slider_layout);

  QHBoxLayout *y_slider_layout = new QHBoxLayout;
  QLabel *y_slider_label = new QLabel(("Y"));
  y_slider_layout->addWidget(y_slider_label);
  y_slider_layout->addWidget(ySlider);
  gl_layout->addLayout(y_slider_layout);

  QHBoxLayout *z_slider_layout = new QHBoxLayout;
  QLabel *z_slider_label = new QLabel(("Z"));
  z_slider_layout->addWidget(z_slider_label);
  z_slider_layout->addWidget(zSlider);
  gl_layout->addLayout(z_slider_layout);

  layout->addLayout(gl_layout);

  // All the controls on the right side of the window
  QVBoxLayout *controls_layout = new QVBoxLayout;
  layout->addLayout(controls_layout);

  // The scaling sliders
  QVBoxLayout *scale_layout = new QVBoxLayout;
  QLabel *scale_label = new QLabel(("Scale"));
  scale_layout->addWidget(scale_label);
  scale_layout->addWidget(yScaleSlider);
  controls_layout->addLayout(scale_layout);

  // Controls for the animation
  QVBoxLayout *buttons_layout = new QVBoxLayout;
  buttons_layout->addWidget(powerSpectrumModeLabel);
  buttons_layout->addWidget(powerSpectrumModeCombo);
  buttons_layout->addWidget(playpause_button);
  controls_layout->addLayout(buttons_layout);

  // Set the layout for this widget to the layout we just created
  mainWidget->setLayout(layout);

  // Set some nice defaults for all the sliders
  xSlider->setValue(0 * 16);
  ySlider->setValue(0 * 16);
  zSlider->setValue(0 * 16);

  yScaleSlider->setValue(350);

  setWindowTitle(tr("MarSndPeek"));
}
コード例 #19
0
ファイル: navigation.cpp プロジェクト: berntsim/sonetta
void NavigationAttached::customEvent(QEvent *event)
{
    if (event->type() == NavEventType)
    {
        NavEvent *nEvent = static_cast<NavEvent *>(event);
        QuickNavEvent qne(nEvent->key(), nEvent->isAutoRepeat());

        emit navigationEvent(&qne);

        nEvent->setAccepted(qne.isAccepted());

        if (!nEvent->isAccepted())
        {
            switch (nEvent->key())
            {
            case Navigation::Left:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::left)))
                {
                    qne.setAccepted(true);
                    emit left(&qne);
                }
                break;
            case Navigation::Right:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::right)))
                {
                    qne.setAccepted(true);
                    emit right(&qne);
                }
                break;
            case Navigation::Up:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::up)))
                {
                    qne.setAccepted(true);
                    emit up(&qne);
                }
                break;
            case Navigation::Down:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::down)))
                {
                    qne.setAccepted(true);
                    emit down(&qne);
                }
                break;
            case Navigation::OK:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::ok)))
                {
                    qne.setAccepted(true);
                    emit ok(&qne);
                }
                break;
            case Navigation::Back:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::back)))
                {
                    qne.setAccepted(true);
                    emit back(&qne);
                }
                break;
            case Navigation::Play:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::play)))
                {
                    qne.setAccepted(true);
                    emit play(&qne);
                }
                break;
            case Navigation::PlayPause:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::playPause)))
                {
                    qne.setAccepted(true);
                    emit playPause(&qne);
                }
                break;
            case Navigation::Pause:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::pause)))
                {
                    qne.setAccepted(true);
                    emit pause(&qne);
                }
                break;
            case Navigation::Stop:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::stop)))
                {
                    qne.setAccepted(true);
                    emit stop(&qne);
                }
                break;
            case Navigation::Next:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::next)))
                {
                    qne.setAccepted(true);
                    emit next(&qne);
                }
                break;
            case Navigation::Previous:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::previous)))
                {
                    qne.setAccepted(true);
                    emit previous(&qne);
                }
                break;

            case Navigation::Record:
                if (isSignalConnected(QMetaMethod::fromSignal(&NavigationAttached::record)))
                {
                    qne.setAccepted(true);
                    emit record(&qne);
                }
                break;
            default:
                break;
            }

            event->setAccepted(qne.isAccepted());
        }
    }
}
コード例 #20
0
// the folowing method is (almost) self-explained
void Controls::onPlayPauseClicked(void){
  emit playPause();
}
コード例 #21
0
void cwVideoPlayer::pause(bool value)
{
	isPause = value;
	playPause();
}
コード例 #22
0
void
ActionCollection::initActions()
{
    QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
    latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
    m_actionCollection[ "latchOn" ] = latchOn;
    QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this );
    latchOff->setIcon( QIcon( RESPATH "images/headphones-off.png" ) );
    m_actionCollection[ "latchOff" ] = latchOff;

    QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this );
    realtimeFollowingAlong->setCheckable( true );
    m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong;

    bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
    QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this );
    privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
    privacyToggle->setIconVisibleInMenu( isPublic );
    m_actionCollection[ "togglePrivacy" ] = privacyToggle;
    connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );

    m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this );
    m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
    m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
    m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
    m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
    m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
    m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
    m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );

    // connect actions to AudioEngine
    AudioEngine *ae = AudioEngine::instance();
    connect( m_actionCollection[ "playPause" ],     SIGNAL( triggered() ), ae,   SLOT( playPause() ), Qt::UniqueConnection );
    connect( m_actionCollection[ "stop" ],          SIGNAL( triggered() ), ae,   SLOT( stop() ),      Qt::UniqueConnection );
    connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae,   SLOT( previous() ),  Qt::UniqueConnection );
    connect( m_actionCollection[ "nextTrack" ],     SIGNAL( triggered() ), ae,   SLOT( next() ),      Qt::UniqueConnection );
}
コード例 #23
0
ファイル: ActionCollection.cpp プロジェクト: Nskif/tomahawk
void
ActionCollection::initActions()
{
    QAction *latchOn = new QAction( tr( "&Listen Along" ), this );
    latchOn->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones.svg" ) );
    m_actionCollection[ "latchOn" ] = latchOn;
    QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this );
    latchOff->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones-off.svg" ) );
    m_actionCollection[ "latchOff" ] = latchOff;

    QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this );
    realtimeFollowingAlong->setCheckable( true );
    m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong;

    bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
    QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this );
    privacyToggle->setIcon( ImageRegistry::instance()->icon( RESPATH "images/private-listening.svg" ) );
    privacyToggle->setIconVisibleInMenu( isPublic );
    m_actionCollection[ "togglePrivacy" ] = privacyToggle;
    connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );

    m_actionCollection[ "loadPlaylist" ] =   new QAction( tr( "&Load Playlist" ), this );
    m_actionCollection[ "loadStation" ] =    new QAction( tr( "&Load Station" ), this );
    m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
    m_actionCollection[ "renameStation" ] = new QAction( tr( "&Rename Station" ), this );
    m_actionCollection[ "copyPlaylist" ] =   new QAction( tr( "&Copy Playlist Link" ), this );
    m_actionCollection[ "playPause" ] =      new QAction( tr( "&Play" ), this );
    m_actionCollection[ "playPause" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/play-rest.svg" ) );
    m_actionCollection[ "playPause" ]->setShortcut( Qt::Key_Space );
    m_actionCollection[ "playPause" ]->setShortcutContext( Qt::ApplicationShortcut );
    m_actionCollection[ "stop" ] =           new QAction( tr( "&Stop" ), this );
    m_actionCollection[ "previousTrack" ] =  new QAction( tr( "&Previous Track" ), this );
    m_actionCollection[ "previousTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/back-rest.svg" ) );
    m_actionCollection[ "nextTrack" ] =      new QAction( tr( "&Next Track" ), this );
    m_actionCollection[ "nextTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/skip-rest.svg" ) );
    m_actionCollection[ "quit" ] =           new QAction( tr( "&Quit" ), this );
    m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
    m_actionCollection[ "quit" ]->setShortcutContext( Qt::ApplicationShortcut );
    m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );

    // connect actions to AudioEngine
    AudioEngine *ae = AudioEngine::instance();
    connect( m_actionCollection[ "playPause" ],     SIGNAL( triggered() ), ae,   SLOT( playPause() ), Qt::UniqueConnection );
    connect( m_actionCollection[ "stop" ],          SIGNAL( triggered() ), ae,   SLOT( stop() ),      Qt::UniqueConnection );
    connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae,   SLOT( previous() ),  Qt::UniqueConnection );
    connect( m_actionCollection[ "nextTrack" ],     SIGNAL( triggered() ), ae,   SLOT( next() ),      Qt::UniqueConnection );

    // main menu actions
    m_actionCollection[ "loadXSPF" ] = new QAction( tr( "Load &XSPF..." ), this );
    m_actionCollection[ "updateCollection" ] = new QAction( tr( "U&pdate Collection" ), this );
    m_actionCollection[ "rescanCollection" ] = new QAction( tr( "Fully &Rescan Collection" ), this );
    m_actionCollection[ "showOfflineSources" ] = new QAction( tr( "Show Offline Sources" ), this );
    m_actionCollection[ "showOfflineSources" ]->setCheckable( true );
    m_actionCollection[ "preferences" ] = new QAction( tr( "&Configure Tomahawk..." ), this );
    m_actionCollection[ "preferences" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/configure.svg" ) );
    m_actionCollection[ "preferences" ]->setMenuRole( QAction::PreferencesRole );
#ifdef Q_OS_MAC
    m_actionCollection[ "minimize" ] = new QAction( tr( "Minimize" ), this );
    m_actionCollection[ "minimize" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
    m_actionCollection[ "zoom" ] = new QAction( tr( "Zoom" ), this );
    m_actionCollection[ "zoom" ]->setShortcut( QKeySequence( "Meta+Ctrl+Z" ) );
    m_actionCollection[ "fullscreen" ] = new QAction( tr( "Enter Full Screen" ), this );
    m_actionCollection[ "fullscreen" ]->setShortcut( QKeySequence( "Meta+Ctrl+F" ) );
#else
    m_actionCollection[ "toggleMenuBar" ] = new QAction( tr( "Hide Menu Bar" ), this );
    m_actionCollection[ "toggleMenuBar" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
    m_actionCollection[ "toggleMenuBar" ]->setShortcutContext( Qt::ApplicationShortcut );
#endif
    m_actionCollection[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
    m_actionCollection[ "diagnostics" ]->setMenuRole( QAction::ApplicationSpecificRole );
    m_actionCollection[ "aboutTomahawk" ] = new QAction( tr( "About &Tomahawk..." ), this );
    m_actionCollection[ "aboutTomahawk" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/info.svg" ) );
    m_actionCollection[ "aboutTomahawk" ]->setMenuRole( QAction::AboutRole );
    m_actionCollection[ "legalInfo" ] = new QAction( tr( "&Legal Information..." ), this );
    m_actionCollection[ "legalInfo" ]->setMenuRole( QAction::ApplicationSpecificRole );
    m_actionCollection[ "openLogfile" ] = new QAction( tr( "&View Logfile" ), this );
    m_actionCollection[ "openLogfile" ]->setMenuRole( QAction::ApplicationSpecificRole );
    #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) || defined( Q_WS_WIN )
    m_actionCollection[ "checkForUpdates" ] = new QAction( tr( "Check For Updates..." ), this );
    m_actionCollection[ "checkForUpdates" ]->setMenuRole( QAction::ApplicationSpecificRole );
#endif
    m_actionCollection[ "crashNow" ] = new QAction( "Crash now...", this );
}
コード例 #24
0
ファイル: videoplayer.cpp プロジェクト: caoyanjie/Sprite
VideoPlayer::VideoPlayer(QString programPath, QWidget *parent) :
    QWidget(parent)
  ,programDir(programPath)
  ,WIDTH(600)
  ,HEIGHT(380)
  ,videoNameWidth(300)
  ,videoListWidth(200)
  ,hideButtonsTime(2000)
  ,forwardStep(5)
  ,retreatStep(5)
  ,volumnChangeStep(5)
  ,hideCursor(false)
  ,keepAwakeTimes(0)
{
    //设置窗口无边框
    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
    this->installEventFilter(this);

    //初始化窗口位置、大小
    QDesktopWidget desktop;
    setGeometry((desktop.width()-WIDTH)/2, (desktop.height()-HEIGHT)/2, WIDTH, HEIGHT);
    setObjectName("videoPlayer");

    //背景label
    lab_background = new QLabel(this);
    lab_background->setGeometry(0, 0, WIDTH, HEIGHT);
    lab_background->setObjectName("lab_background");

//    videoList = new VideoList(0, 25, videoListWidth, this->height()-50, false, this);
//    videoList->show();

    //设置鼠标跟踪,响应鼠标移动事件
    this->setMouseTracking(true);
    lab_background->setMouseTracking(true);

    //
    videoWidget = new VideoWidget;
    videoWidget->hide();
    videoWidget->installEventFilter(this);
    videoWidget->setMouseTracking(true);

    //保持视频屏幕常亮
    helpKeepAwake = new HelpKeepAwake;

    //布局
    layout_top = new QGridLayout;
    layout_top->addWidget(lab_background, 0, 0, 1, 1);
    layout_top->addWidget(videoWidget, 0, 0, 1, 1);
    layout_top->setSpacing(0);
    layout_top->setMargin(0);
    this->setLayout(layout_top);

    //
    videoContral = new VideoContral(this);
    videoContral->setGeometry(this->x(), this->y(), this->width(), this->height());

    tbn_openVideoFile = new QToolButton(this);
    tbn_openVideoFile->setText("放入视频");
    tbn_openVideoFile->setGeometry((this->width()-126-32)/2+35, (this->height()-41)/2+95, 80, 30);
    tbn_openVideoFile->setObjectName("tbn_openVideoFile");

    //初始化多媒体播放器
    player = new QMediaPlayer(this);
    QMediaPlaylist *playlist = new QMediaPlaylist;
    QMediaPlaylist *playlistHistory = new QMediaPlaylist;

    playlist_list.append(playlistHistory);
    playlist_list.append(playlist);

    player->setVideoOutput(videoWidget);
    player->setPlaylist(playlist);
    player->setVolume(60);

    connect(tbn_openVideoFile,SIGNAL(clicked()), this, SLOT(openVideoFile()));
    connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
/*    connect(this, SIGNAL(moveWindow(QPoint)), videoList, SLOT(toMoveWindow(QPoint)));*/

    //设置样式表
    setStyleSheet(
                "#videoPlayer{"
//                    "border-radius: 3px;"
                "}"
                "#lab_background{"
//                    "border-radius: 3px;"
                    "border-image: url(:/Images/videoPlayerBg.png);"
                "}"
                "#tbn_openVideoFile{"
                    "background: rgba(0, 0, 0, 30);"
                    "color: rgba(200, 255, 255, 255);"
                "}"
                );

    //创建定时器(1.5秒无鼠标动作按钮自动隐藏)
    timerHideWidgets = new QTimer(this);
    timerHideWidgets->start(hideButtonsTime);
    connect(timerHideWidgets, SIGNAL(timeout()), this, SLOT(hideWidgets_timeout()));


    //操作控制
    connect(videoWidget, SIGNAL(clicked()), this, SLOT(videoPlayPause()));
    connect(videoWidget, SIGNAL(switchFullScreen()), this, SLOT(switchFullScreen()));
//    connect(videoWidget, SIGNAL(goForward()), this, SLOT(videoGoForward()));
//    connect(videoWidget, SIGNAL(retreat()), this, SLOT(videoRetreat()));
    connect(videoWidget, SIGNAL(playJump(int)), this, SLOT(videoPlayJump(int)));
    connect(videoWidget, SIGNAL(volumnAdd()), this, SLOT(volumnAdd()));
    connect(videoWidget, SIGNAL(volumnReduce()), this, SLOT(volumnReduce()));

    connect(videoContral, SIGNAL(isHideWidget(bool)), this, SLOT(isHideWidget(bool)));
    connect(videoContral, SIGNAL(playerStop()), player, SLOT(stop()));
    connect(videoContral, SIGNAL(playPause()), this, SLOT(videoPlayPause()));
    connect(videoContral, SIGNAL(playNext()), player->playlist(), SLOT(next()));
    connect(videoContral, SIGNAL(currentMediaEnd()), this, SLOT(currentMediaEnd()));
//    connect(videoContral, SIGNAL(goForward()), this, SLOT(videoGoForward()));
//    connect(videoContral, SIGNAL(retreat()), this, SLOT(videoRetreat()));
    connect(videoContral, SIGNAL(playJump(int)), this, SLOT(videoPlayJump(int)));
    connect(videoContral, SIGNAL(switchFullScreen()), this, SLOT(switchFullScreen()));

    connect(player, SIGNAL(durationChanged(qint64)), videoContral, SLOT(durationChanged(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(setVideoTitle()));
    connect(player, SIGNAL(positionChanged(qint64)), videoContral, SLOT(positionChanged(qint64)));
    connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playStateChanged(QMediaPlayer::State)));

    //
    connect(videoContral, SIGNAL(itemDoubleClicked(int, int)), this, SLOT(itemDoubleClicked(int, int)));

//    videoWidget->setFocus();
    timerKeepAwake = new QTimer(this);
    connect(timerKeepAwake, SIGNAL(timeout()), this, SLOT(timeoutKeepAwake()));
}