void UBGraphicsVideoItemDelegate::buildButtons()
{
    mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mFrame);

    mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mFrame);
    mStopButton->hide();

    if (delegated()->isMuted())
        mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mFrame);
    else
        mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mFrame);

    mMuteButton->hide();

    mVideoControl = new DelegateVideoControl(delegated(), mFrame);
    mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2);
    mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true);

    connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
    connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop()));
    connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute()));
    connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute()));

    mButtons << mPlayPauseButton << mStopButton << mMuteButton;

    mMedia->setTickInterval(50);

    connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State)));
    connect(mMedia, SIGNAL(finished()), this, SLOT(updatePlayPauseState()));
    connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64)));
    connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64)));

}
Beispiel #2
0
void QPhoneHandler::callInfoOut(qpjsua::CallInfo aCallInfo)
{
    m_remoteInfo = aCallInfo.getRemoteInfo();
    m_callState = aCallInfo.getStateText();

    switch(aCallInfo.getMediaStatus()) {
    case PJSUA_CALL_MEDIA_NONE:
        m_mediaState = "NONE";
        break;
    case PJSUA_CALL_MEDIA_ACTIVE:
        m_mediaState = "ACTIVE";
        break;
    case PJSUA_CALL_MEDIA_LOCAL_HOLD:
        m_mediaState = "LOCAL HOLD";
        break;
    case PJSUA_CALL_MEDIA_REMOTE_HOLD:
        m_mediaState = "REMOTE HOLD";
        break;
    case PJSUA_CALL_MEDIA_ERROR:
        m_mediaState = "ERROR";
        break;
    default:
        m_mediaState = "ERROR";
    }
    emit mediaStateChanged();
}
Beispiel #3
0
void QSWindow::preload(){
    //file control buttons and shortcuts
    setAcceptDrops(true);
    ui->tabWidget->setAcceptDrops(true);
    connect(ui->actionOpen_File, SIGNAL(triggered()), SLOT(openFile()));
    ui->actionOpen_File->setShortcut(QKeySequence::Open);
    connect(ui->actionSave_File, SIGNAL(triggered()), SLOT(saveFile()));
    ui->actionSave_File->setShortcut(QKeySequence::Save);
    connect(ui->actionSave_File_as, SIGNAL(triggered()), SLOT(saveFileAs()));
    ui->actionSave_File_as->setShortcut(QKeySequence::SaveAs);
    connect(ui->actionClose, SIGNAL(triggered()), SLOT(closeFile()));
    ui->actionClose->setShortcut(QKeySequence::Close);


    connect(ui->actionPreset, SIGNAL(triggered()), SLOT(changePreset()));
    connect(ui->actionDisplay_Keyboard, SIGNAL(triggered()), SLOT(displayKeyBoard()));
    ui->actionDisplay_Keyboard->setShortcut(QKeySequence("ctrl+K"));
    connect(ui->actionDisplay_specturm,SIGNAL(triggered()), SLOT(displaySpectrum()));
    connect(ui->actionScore_to_wav, SIGNAL(triggered()), SLOT(scoreToWav()));
    connect(ui->actionWav_to_score, SIGNAL(triggered()), SLOT(wavToScore()));
    connect(ui->menuOpened, SIGNAL(triggered(QAction*)), SLOT(switchScene(QAction*)));

    connect(this,SIGNAL(addFromLameSignal(QString)),this, SLOT(addFromLame(QString)), Qt::QueuedConnection);
   //music state management
    connect(mediaPlayer, SIGNAL(positionChanged(qint64)),
            this,SLOT(positionChanged(qint64)),Qt::QueuedConnection);
    connect(mediaPlayer, SIGNAL(durationChanged(qint64)),
            this, SLOT(durationChanged(qint64)),Qt::QueuedConnection);
    connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this,
            SLOT(mediaStateChanged(QMediaPlayer::State)),Qt::QueuedConnection);
    connect(positionSlider, SIGNAL(sliderReleased()), this, SLOT(setPosition()),Qt::QueuedConnection);
    connect(playButton, SIGNAL(clicked()), this, SLOT(musicPlay()),Qt::QueuedConnection);

    connect(recorder->recordButton, SIGNAL(clicked()), this, SLOT(record()));
}
VideoPlayer::VideoPlayer(QWidget *parent)
    : QWidget(parent)
    , mediaPlayer(0, QMediaPlayer::VideoSurface)
    , videoItem(0)
    , playButton(0)
    , positionSlider(0)
{
    videoItem = new QGraphicsVideoItem;
    videoItem->setSize(QSizeF(640, 480));

    QGraphicsScene *scene = new QGraphicsScene(this);
    QGraphicsView *graphicsView = new QGraphicsView(scene);

    scene->addItem(videoItem);

    QSlider *rotateSlider = new QSlider(Qt::Horizontal);
    rotateSlider->setRange(-180,  180);
    rotateSlider->setValue(0);

    connect(rotateSlider, SIGNAL(valueChanged(int)),
            this, SLOT(rotateVideo(int)));

    QAbstractButton *openButton = new QPushButton(tr("Open..."));
    connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));

    playButton = new QPushButton;
    playButton->setEnabled(false);
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));

    connect(playButton, SIGNAL(clicked()),
            this, SLOT(play()));

    positionSlider = new QSlider(Qt::Horizontal);
    positionSlider->setRange(0, 0);

    connect(positionSlider, SIGNAL(sliderMoved(int)),
            this, SLOT(setPosition(int)));

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(positionSlider);

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

    setLayout(layout);

    mediaPlayer.setVideoOutput(videoItem);
    connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SLOT(mediaStateChanged(QMediaPlayer::State)));
    connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
}
VideoPlayer::VideoPlayer(QWidget *parent)
    : QWidget(parent)
    , mediaPlayer(0, QMediaPlayer::VideoSurface)
    , playButton(0)
    , positionSlider(0)
    , errorLabel(0)
{
    QVideoWidget *videoWidget = new QVideoWidget;

    QAbstractButton *openButton = new QPushButton(tr("Open..."));
    connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));

    playButton = new QPushButton;
    playButton->setEnabled(false);
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));

    connect(playButton, SIGNAL(clicked()),
            this, SLOT(play()));

    positionSlider = new QSlider(Qt::Horizontal);
    positionSlider->setRange(0, 0);

    connect(positionSlider, SIGNAL(sliderMoved(int)),
            this, SLOT(setPosition(int)));

    errorLabel = new QLabel;
    errorLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(positionSlider);

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

    setLayout(layout);

    mediaPlayer.setVideoOutput(videoWidget);
    connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SLOT(mediaStateChanged(QMediaPlayer::State)));
    connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(handleError()));

    QFileInfo info("C:\\Users\\MichaU\\Desktop\\ResonanceP1.mp4");
    QMediaPlaylist *lista = new QMediaPlaylist;
    lista->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));

    mediaPlayer.setPlaylist(lista);
    mediaPlayer.play();

    connect(lista,SIGNAL(currentIndexChanged(int)),this,SLOT(ChangePlaylist()));
}
Beispiel #6
0
VideoPlayer::VideoPlayer(QWidget *parent)
    : QWidget(parent)
    , mediaPlayer(0, QMediaPlayer::VideoSurface)
    , playButton(0)
    , positionSlider(0)
 //   , errorLabel(0)
{
    QVideoWidget *videoWidget = new QVideoWidget;

    QAbstractButton *openButton = new QPushButton(tr("Open..."));
    connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));

    playButton = new QPushButton;
    playButton->setEnabled(false);
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));

    connect(playButton, SIGNAL(clicked()),
            this, SLOT(play()));

    positionSlider = new QSlider(Qt::Horizontal);
    positionSlider->setRange(0, 0);

    connect(positionSlider, SIGNAL(sliderMoved(int)),
            this, SLOT(setPosition(int)));

    //errorLabel = new QLabel;
    //errorLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(positionSlider);

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

    setLayout(layout);

    mediaPlayer.setVideoOutput(videoWidget);
    connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SLOT(mediaStateChanged(QMediaPlayer::State)));
    connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(handleError()));
}
Beispiel #7
0
void AudioObject::newSource()
{
    this->media = new MediaObject;

    qDebug() << "AudioObject::newSource()" << "called";

    //On connect le changement d'etat pour bloquer l'objet jusqu'a sa
    //disponibilité totale
    QObject::connect(this->media,
                     SIGNAL(stateChanged(Phonon::State, Phonon::State)),
                     this,
                     SLOT(mediaStateChanged(Phonon::State, Phonon::State)));

    QObject::connect(this->media, SIGNAL(finished()), this, SIGNAL(finished()));
    //On va maintenant attendre que le media source soit pret
    this->mutex->lock();


    //On set le source
    this->media->setCurrentSource(*(this->source));

    createPath(this->media, this->audio);



    //On va maintenant attendre le signal du mediaSource qui
    //va nous dire qu'il est pret

    //Ceci va donc bloquer jusqu'a ce qu'il soit pret
    this->mutex->lock();

    //On est arrivé ici, le mediaSource est donc utilisable :)

    //On oublie pas de le débloquer :)
    this->mutex->unlock();


    this->ready = true;


}
Beispiel #8
0
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();
}
Beispiel #9
0
void QPhoneHandler::setMediaState(const QString &state)
{
    m_mediaState = state;
    emit mediaStateChanged();
}
void UBGraphicsAudioItemDelegate::buildButtons()
{
    mPlayPauseButton = new DelegateButton ( ":/images/play.svg", mDelegated, mFrame );

    mStopButton = new DelegateButton ( ":/images/stop.svg", mDelegated, mFrame );
    mStopButton->hide();

    if ( mDelegated->isMuted() )
        mMuteButton = new DelegateButton ( ":/images/soundOff.svg", mDelegated, mFrame );
    else
        mMuteButton = new DelegateButton ( ":/images/soundOn.svg", mDelegated, mFrame );

    mMuteButton->hide();


    connect ( mPlayPauseButton, SIGNAL ( clicked ( bool ) ), this, SLOT ( togglePlayPause() ) );
    connect ( mStopButton, SIGNAL ( clicked ( bool ) ), mDelegated->mediaObject(), SLOT ( stop() ) );
    connect ( mMuteButton, SIGNAL ( clicked ( bool ) ), mDelegated, SLOT ( toggleMute() ) );
    connect ( mMuteButton, SIGNAL ( clicked ( bool ) ), this, SLOT ( toggleMute() ) );

    connect ( mDelegated->mediaObject(), SIGNAL ( stateChanged ( Phonon::State, Phonon::State ) ), this, SLOT ( mediaStateChanged ( Phonon::State, Phonon::State ) ) );
    connect ( mDelegated->mediaObject(), SIGNAL ( finished() ), this, SLOT ( updatePlayPauseState() ) );

    mButtons << mPlayPauseButton << mStopButton << mMuteButton;

}
Beispiel #11
0
myGraphicsScene::myGraphicsScene(const int scrWidth, const int scrHeight,
                                 const int *EnCount, const int *AlCount,
                                 const int *BBCount, const int *TrCount,
                                 const qreal *spMultPerLevel, const int nLevels,
                                 const int *tPLevel, QStringList bGImageList) :
    myScreenWidth(scrWidth),
    myScreenHeight(scrHeight), myEnemyCount(EnCount), myAllyCount(AlCount), myBigBossCount(BBCount),
    myTrapCount(TrCount), mySpeedMultiplierPerLevel(spMultPerLevel), myNumLevels(nLevels),
    myCurrentLevel(0), myTimePerLevel(tPLevel), myBGImageList(bGImageList),
    myTotalTimeUsed(0), myTotalTrapsUsed(0), myMusicPlayer(0), myGameActive(false),
    myIsMinimised(false), myQmlobjectCreated(false), myGlobalMusicPause(false)
{
    //QTimer myAdvanceTimer;
    QObject::connect(&myAdvanceTimer, SIGNAL(timeout()), this, SLOT(advance()));

    // set scene settings
    setSceneRect(0,0, myScreenWidth, myScreenHeight);
    setItemIndexMethod(QGraphicsScene::NoIndex);

    myView = new QGraphicsView;

    myView->setScene(this);
    myView->setFrameShape(QFrame::NoFrame); // disable frame (->true full screen)

    // OpenGL
    myView->QGraphicsView::setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    //QGLFormat format = QGLFormat::defaultFormat();
    //format.setSampleBuffers(false);
    //QGLWidget *glWidget = new QGLWidget(format);
    //myView->QGraphicsView::setViewport(glWidget);
        myView->setViewportUpdateMode(
                QGraphicsView::FullViewportUpdate);

    // disable scrolling
    myView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    myView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    // lock landscape (done in bar-descriptor)

    //antialiasing
    myView->setRenderHint(QPainter::Antialiasing);

//! [4] //! [5]
    myView->setCacheMode(QGraphicsView::CacheBackground);
//! [5] //! [6]
    myView->showFullScreen();

    // Initialise start menu from qml
    myQmlengine = new QDeclarativeEngine(this);
    //myQmlcomponent = new QDeclarativeComponent(myQmlengine, QUrl("asset:///startMenu.qml")); // for now (ugly as ....)
    myQmlcomponent = new QDeclarativeComponent(myQmlengine, QUrl("app/native/assets/startMenu.qml")); // for now (ugly as ....)
    qDebug() << myQmlcomponent->errors();
    myQmlobject =
        qobject_cast<QGraphicsObject *>(myQmlcomponent->create());

    // change default size base on device specs
    myQmlobject->setProperty("width",myScreenWidth);
    myQmlobject->setProperty("height",myScreenHeight);

    addItem(myQmlobject);
    myQmlobjectCreated = true; // this is used in the event handler below
    myQmlobject->setProperty("iAmActive", true);

    //Connect QML signal to handler
    QObject::connect(myQmlobject, SIGNAL(sendQMLMessage(int, bool)), this, SLOT(signalHandler(int, bool)));
    // haptics
    QObject::connect(myQmlobject, SIGNAL(sendRumbleMessage(int)), this, SLOT(myRumbleGenerator(int)));
    //Connect QML exit signal to callingQuits signal (that is connected to QApplication::quit() slot in main.cpp)
    //QObject::connect(myQmlengine, SIGNAL(quit()), this, SIGNAL(callingQuits()));

    // initialise animations for startMenu.qml
    QObject::connect(this, SIGNAL(beginQmlAnimation()),myQmlobject, SIGNAL(beginAnimation()) );
    emit beginQmlAnimation();

    // connect "game finished" signals
    QObject::connect(this, SIGNAL(gameFinished(int, int)), myQmlobject, SIGNAL(gameFinishedQML(int, int)));

    // play music
    myMusicPlayer = new bb::multimedia::MediaPlayer(this);
    QUrl myUrl = QUrl("app/native/assets/music/white_winter_moon_comp.mp3");
    myMusicPlayer->setSourceUrl(myUrl);
    myMusicPlayer->play();
    QObject::connect(myMusicPlayer, SIGNAL(mediaStateChanged(bb::multimedia::MediaState::Type)), this, SLOT(startMyMusic(bb::multimedia::MediaState::Type))); // start from beginning when track ends
    QObject::connect(myQmlobject, SIGNAL(musicPlayPauseQML()), this, SLOT(pausePlayMyMusic()));
    QObject::connect(myQmlengine, SIGNAL(quit()), this, SLOT(stopMyGame()));
}
// 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}"));
}