Commit fe614a98 authored by Yann Boucher's avatar Yann Boucher
Browse files

Removed dependency to the multimedia module

parent e2f17afd
Pipeline #79401 canceled with stage
......@@ -18,7 +18,7 @@
#include <QTextStream>
#include <QInputDialog>
#include <QTimer>
#include <QMediaPlayer>
#include <QElapsedTimer>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
......@@ -637,11 +637,14 @@ void MainWindow::play_bad_apple()
static QJsonArray bad_apple_frame_list;
static QTimer bad_apple_timer;
static bool bad_apple_connected;
static QMediaPlayer bad_apple_player;
static QElapsedTimer bad_apple_elapsed;
QFile f("bad_apple.json");
QFile f("extras/bad_apple.json");
if (!f.open(QFile::ReadOnly | QFile::Text))
throw ModelLoadingException("Impossible de lire le fichier");
{
QMessageBox::warning(this, "", "Can't find 'extras/bad_apple.json'\n");
return;
}
QTextStream in(&f);
QJsonParseError parseError;
......@@ -655,10 +658,8 @@ void MainWindow::play_bad_apple()
{
bad_apple_timer.callOnTimeout([this]
{
if (bad_apple_player.mediaStatus() == QMediaPlayer::EndOfMedia)
return;
unsigned frame_idx = bad_apple_player.position()/(1000.f/30);
unsigned frame_idx = bad_apple_elapsed.elapsed()/(1000.f/30);
if ((int)frame_idx >= bad_apple_frame_list.size())
{
bad_apple_timer.stop();
......@@ -686,9 +687,10 @@ void MainWindow::play_bad_apple()
});
}
bad_apple_player.setMedia(QUrl::fromLocalFile("bad-apple.mp3"));
bad_apple_player.play();
//bad_apple_player.setMedia(QUrl::fromLocalFile("bad-apple.mp3"));
//bad_apple_player.play();
;
bad_apple_elapsed.start();
bad_apple_timer.start(24);
statusBar()->showMessage("Original : \"Bad Apple!!\" feat. Nomico by Alstroemeria Records", 60000);
}
......
QT += core gui multimedia
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment