Commit 5f923e5d authored by Frederik Schwarzer's avatar Frederik Schwarzer

Remove deprecated Phonon; there's no sounds anyway.

parent 79eb7efb
......@@ -19,9 +19,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
)
find_package(KF5KDEGames 4.9.0 REQUIRED)
find_package(Phonon4Qt5 CONFIG REQUIRED)
include_directories(BEFORE ${PHONON_INCLUDES})
include(FeatureSummary)
include(ECMInstallIcons)
......
......@@ -18,7 +18,6 @@ add_executable(bomber ${bomber_SRCS})
target_link_libraries(bomber
KF5KDEGames
Phonon::phonon4qt5
KF5::XmlGui
KF5::I18n
KF5::DBusAddons
......
......@@ -24,7 +24,6 @@
#include "settings.h"
#include <KRandom>
#include <Phonon/MediaObject>
#include <QTimer>
#include <QGraphicsScene>
......@@ -51,7 +50,7 @@ const unsigned int PLANE_EXPLODE_TIME = 2000;
const unsigned int BOMB_EXPLODE_TIME = 1000;
BomberBoard::BomberBoard(KGameRenderer *renderer, QGraphicsView *view, QObject *parent) :
QGraphicsScene(parent), m_renderer(renderer), m_audioPlayer(nullptr), m_bomb(nullptr), m_view(view)
QGraphicsScene(parent), m_renderer(renderer), m_bomb(nullptr), m_view(view)
{
m_clock = new QTimer(this);
m_clock->setInterval(GAME_DELAY);
......@@ -62,8 +61,6 @@ BomberBoard::BomberBoard(KGameRenderer *renderer, QGraphicsView *view, QObject *
m_plane->show();
resetPlane();
clear();
m_soundPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QLatin1Literal("sounds"), QStandardPaths::LocateDirectory);
}
BomberBoard::~BomberBoard()
......@@ -72,7 +69,6 @@ BomberBoard::~BomberBoard()
delete m_plane;
qDeleteAll(m_buildings);
qDeleteAll(m_explodingBombs);
delete m_audioPlayer;
}
void BomberBoard::resetPlane()
......@@ -160,23 +156,6 @@ void BomberBoard::setPaused(bool val)
}
}
void BomberBoard::playSound(const QString &name)
{
if (m_playSounds == true && !name.isEmpty()) {
QString file = m_soundPath.filePath(name);
m_audioPlayer->setCurrentSource(file);
m_audioPlayer->play();
}
}
void BomberBoard::setSounds(bool val)
{
m_playSounds = val;
if (val == true && m_audioPlayer == nullptr) {
m_audioPlayer = Phonon::createPlayer(Phonon::GameCategory);
}
}
void BomberBoard::tick()
{
checkCollisions();
......@@ -263,7 +242,6 @@ void BomberBoard::bombExploded()
void BomberBoard::settingsChanged()
{
setSounds(BomberSettings::playSounds());
setBackgroundBrush(m_renderer->spritePixmap(QLatin1Literal("background"), m_view->size()));
redraw();
}
......@@ -279,7 +257,6 @@ void BomberBoard::crashed()
QPointF pos = m_plane->position();
m_plane->setPosition(pos.x() + 1, pos.y());
m_plane->setState(Plane::State::Exploding);
playSound(QLatin1Literal("explode.ogg"));
QTimer::singleShot(PLANE_EXPLODE_TIME, this, SLOT(planeExploded()));
}
......
......@@ -26,11 +26,6 @@
#include <QQueue>
#include <QDir>
namespace Phonon
{
class MediaObject;
}
class Plane;
class Building;
class Bomb;
......@@ -78,18 +73,6 @@ public:
*/
void setPaused(bool val);
/**
* Used to play a sound
* \param name The sound to play
*/
void playSound(const QString &name);
/**
* Used to activate/deactivate sounds while playing
* \param val True to turn on the sounds, otherwise false
*/
void setSounds(bool val);
/**
* This will convert the tile location to actual cords on the board
* \param pos The cords relative to the tile
......@@ -189,7 +172,6 @@ private:
QSize m_tileSize;
QTimer *m_clock;
Phonon::MediaObject *m_audioPlayer;
bool m_playSounds;
QDir m_soundPath;
......
......@@ -87,7 +87,6 @@ void Bomber::initXMLUI()
KStandardAction::preferences(m_selector, SLOT(showAsDialog()), actionCollection());
m_soundAction = new KToggleAction(i18nc("Menu item used to disable or enable sound", "&Play Sounds"), this);
actionCollection()->addAction(QLatin1String("toggle_sound"), m_soundAction);
connect(m_soundAction, &KToggleAction::triggered, this, &Bomber::setSounds);
QAction *dropBombAction = actionCollection()->addAction(QLatin1String("drop_bomb"));
dropBombAction->setText(i18nc("The name of the action used for dropping bombs", "&Drop bomb"));
......@@ -174,12 +173,6 @@ void Bomber::highscore()
delete ksdialog;
}
void Bomber::setSounds(bool val)
{
BomberSettings::setPlaySounds(val);
m_gameWidget->settingsChanged();
}
void Bomber::displayLevel(unsigned int level)
{
m_level->setText(i18nc(
......
......@@ -50,7 +50,6 @@ private slots:
void pauseGame();
void showHighscore();
void setSounds(bool val);
void displayLevel(unsigned int level);
void displayScore(unsigned int score);
void displayLives(unsigned int lives);
......
......@@ -145,10 +145,6 @@ void BomberGameWidget::settingsChanged()
m_board->settingsChanged();
}
void BomberGameWidget::setSounds(bool val)
{
m_board->setSounds(val);
}
void BomberGameWidget::onPlaneCrashed()
{
......
......@@ -84,11 +84,6 @@ public slots:
*/
void settingsChanged();
/**
* Enabled or disabled the sounds
* \param value True to enable the sounds, otherwise false
*/
void setSounds(bool value);
/**
* Used to toggle the suspended game state. If val is true and the state is currently running,
......
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