TitlePlayDialog::TitlePlayDialog(QWidget *parent, AudioPlayerBridge *apb, API *api, Song *song) : QDialog(parent), ui(new Ui::TitlePlayDialog) { this->setAttribute(Qt::WA_QuitOnClose, false); this->setAttribute(Qt::WA_DeleteOnClose); posChanging = false; posTimer = new QTimer(this); posTimer->setInterval(200); posTimer->setSingleShot(false); connect(posTimer, SIGNAL(timeout()), this , SLOT(timerTick())); posTimer->start(); this->apb = new AudioPlayerBridge(this, false); this->apb->setVolume(apb->getVolume()); this->api = api; this->song = song; ui->setupUi(this); this->setWindowFlags(this->windowFlags() & ~(Qt::WindowFullscreenButtonHint)); QRect geometry = QApplication::desktop()->screenGeometry(); this->setGeometry((geometry.width() - this->width()) / 2, (geometry.height() - this->height()) / 2, this->width(), this->height()); this->setFixedSize(this->size()); this->setWindowTitle(QString::fromStdString(song->getSongName() + " - " + song->getArtistName())); ui->lblSong->setText(QString::fromStdString(song->getSongName() + " - " + song->getArtistName())); ui->sldVolume->setValue(this->apb->getVolume()); ui->sldVolume->setStyle(new MyVolumeStyle); ui->sldPosition->setStyle(new MyVolumeStyle); connect(api, SIGNAL(streamKeyReady(StreamInformation*)), this, SLOT(gotSongInformation(StreamInformation*))); connect(this->apb, SIGNAL(startedPlaying()), this, SLOT(songStarted())); connect(this->apb, SIGNAL(songFinished()), this, SLOT(songFinished())); connect(api, SIGNAL(songError(int)), this, SLOT(songFailed(int))); play(); }
CuteSong::CuteSong(QWidget *parent) : QMainWindow(parent), ui(new Ui::CuteSong) { ui->setupUi(this); ui->tabWidget->setCurrentIndex(0); database.getDatabaseFromFile("QSQLITE","CuteSong.sqlite"); // initialisation du 'lecteur media' audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject,SIGNAL(tick(qint64)),this,SLOT(tickOfMediaObject(qint64))); Phonon::createPath(mediaObject, audioOutput); // intialisation de l'afficheur LCD de progression du temps de la musique QTime displayTime(0,0); ui->lcdProgress->display(displayTime.toString("mm:ss")); // affichage du message de binvenue dans la statusBar (en bas) statusBar()->showMessage("Welcome to CuteSong !"); // initialisation du volume ui->volumeSlider->setAudioOutput(audioOutput); ui->volumeSlider->setMuteVisible(true); audioOutput->setVolume(0); // genere la vue makeBddView(); makePlaylistView(); allowPlayControlManager(false); ui->coverLabel->setScaledContents(true); ui->playFilesButton->setEnabled(false); ui->rmButton->setEnabled(false); ui->actionExport_to_PLS->setEnabled(false); currentSong = new Song(); // faire tous les connect connect (mediaObject,SIGNAL(finished()),this,SLOT(songFinished())); connect (ui->actionOuvrir_fichier,SIGNAL(triggered()),this,SLOT(addFile())); connect (ui->actionQuit,SIGNAL(triggered()),this,SLOT(close())); connect (ui->actionAjouter_dossier,SIGNAL(triggered()),this,SLOT(addDirToBdd())); connect (ui->actionAjouter_fichiers,SIGNAL(triggered()),this,SLOT(on_addButton_clicked())); connect (ui->actionSauver_playlist_courante,SIGNAL(triggered()),this,SLOT(popPlaylistDialog())); connect (ui->actionOpen_Directory,SIGNAL(triggered()),this,SLOT(addDirToPlaylist())); connect (ui->actionChange_cover,SIGNAL(triggered()),this,SLOT(on_button_changeCover_clicked())); connect (ui->actionMute,SIGNAL(triggered()),this,SLOT(muteManager())); connect (ui->actionNext,SIGNAL(triggered()),this,SLOT(next())); connect (ui->actionPause,SIGNAL(triggered()),this->mediaObject,SLOT(pause())); connect (ui->actionPlay,SIGNAL(triggered()),this->mediaObject,SLOT(play())); connect (ui->actionPrevious,SIGNAL(triggered()),this,SLOT(previous())); connect (ui->actionStop,SIGNAL(triggered()),this,SLOT(stopStateManager())); connect (ui->actionVolume_Down,SIGNAL(triggered()),this,SLOT(volumeDown())); connect (ui->actionVolume_up,SIGNAL(triggered()),this,SLOT(volumeUp())); connect (ui->actionEdit_song_s_tag,SIGNAL(triggered()),this,SLOT(editCurrentSongTag())); connect (ui->actionExport_to_PLS,SIGNAL(triggered()),this,SLOT(PLSExport())); connect (ui->actionImport_from_PLS,SIGNAL(triggered()),this,SLOT(PLSImport())); }
void AudioAbstracter::emitSongFinished () { emit songFinished (); }