-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor DONE, experimenting with BT
- Loading branch information
Showing
21 changed files
with
420 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "audiosourcebluetooth.h" | ||
|
||
AudioSourceBluetooth::AudioSourceBluetooth(QObject *parent) | ||
: AudioSource{parent} | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::activate() | ||
{ | ||
QMediaMetaData metadata = QMediaMetaData{}; | ||
metadata.insert(QMediaMetaData::Title, "Bluetooth"); | ||
|
||
emit playbackStateChanged(MediaPlayer::StoppedState); | ||
emit positionChanged(0); | ||
emit metadataChanged(metadata); | ||
emit durationChanged(0); | ||
emit eqEnabledChanged(false); | ||
emit plEnabledChanged(false); | ||
emit shuffleEnabledChanged(false); | ||
emit repeatEnabledChanged(false); | ||
} | ||
|
||
void AudioSourceBluetooth::deactivate() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handlePl() | ||
{ | ||
emit plEnabledChanged(false); | ||
} | ||
|
||
void AudioSourceBluetooth::handlePrevious() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handlePlay() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handlePause() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handleStop() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handleNext() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handleOpen() | ||
{ | ||
|
||
} | ||
|
||
void AudioSourceBluetooth::handleShuffle() | ||
{ | ||
emit shuffleEnabledChanged(false); | ||
} | ||
|
||
void AudioSourceBluetooth::handleRepeat() | ||
{ | ||
emit repeatEnabledChanged(false); | ||
} | ||
|
||
void AudioSourceBluetooth::handleSeek(int mseconds) | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef AUDIOSOURCEBLUETOOTH_H | ||
#define AUDIOSOURCEBLUETOOTH_H | ||
|
||
#include <QObject> | ||
|
||
#include "audiosource.h" | ||
|
||
class AudioSourceBluetooth : public AudioSource | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit AudioSourceBluetooth(QObject *parent = nullptr); | ||
|
||
public slots: | ||
void activate(); | ||
void deactivate(); | ||
void handlePl(); | ||
void handlePrevious(); | ||
void handlePlay(); | ||
void handlePause(); | ||
void handleStop(); | ||
void handleNext(); | ||
void handleOpen(); | ||
void handleShuffle(); | ||
void handleRepeat(); | ||
void handleSeek(int mseconds); | ||
}; | ||
|
||
#endif // AUDIOSOURCEBLUETOOTH_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "mainmenuview.h" | ||
#include "ui_mainmenuview.h" | ||
|
||
MainMenuView::MainMenuView(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::MainMenuView) | ||
{ | ||
ui->setupUi(this); | ||
|
||
connect(ui->backButton, &QPushButton::clicked, this, &MainMenuView::backClicked); | ||
connect(ui->fileSourceButton, &QPushButton::clicked, this, &MainMenuView::fileSourceClicked); | ||
connect(ui->btSourceButton, &QPushButton::clicked, this, &MainMenuView::btSourceClicked); | ||
connect(ui->spotifySourceButton, &QPushButton::clicked, this, &MainMenuView::spotifySourceClicked); | ||
connect(ui->shutdownButton, &QPushButton::clicked, this, &MainMenuView::shutdown); | ||
} | ||
|
||
MainMenuView::~MainMenuView() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void MainMenuView::fileSourceClicked() | ||
{ | ||
emit sourceSelected(0); | ||
} | ||
|
||
void MainMenuView::btSourceClicked() | ||
{ | ||
emit sourceSelected(1); | ||
} | ||
|
||
void MainMenuView::spotifySourceClicked() | ||
{ | ||
emit sourceSelected(2); | ||
} | ||
|
||
void MainMenuView::shutdown() | ||
{ | ||
QString appPath = QCoreApplication::applicationDirPath(); | ||
QString cmd = appPath + "/shutdown.sh"; | ||
|
||
shutdownProcess = new QProcess(this); | ||
shutdownProcess->start(cmd); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef MAINMENUVIEW_H | ||
#define MAINMENUVIEW_H | ||
|
||
#include <QWidget> | ||
#include <QProcess> | ||
|
||
namespace Ui { | ||
class MainMenuView; | ||
} | ||
|
||
class MainMenuView : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainMenuView(QWidget *parent = nullptr); | ||
~MainMenuView(); | ||
|
||
signals: | ||
void sourceSelected(int source); | ||
void backClicked(); | ||
|
||
private: | ||
Ui::MainMenuView *ui; | ||
|
||
void fileSourceClicked(); | ||
void btSourceClicked(); | ||
void spotifySourceClicked(); | ||
|
||
QProcess *shutdownProcess = nullptr; | ||
void shutdown(); | ||
}; | ||
|
||
#endif // MAINMENUVIEW_H |
Oops, something went wrong.