Add more UI events and get backend threaded up.
This commit is contained in:
@@ -9,6 +9,6 @@ find_package(Wt REQUIRED)
|
||||
find_package(Groove REQUIRED)
|
||||
|
||||
add_executable(arbitrateor src/main.cpp src/WebInterface.cpp src/GroovePlayer.cpp src/ui/LoginInterface.cpp src/ui/PlayerInterface.cpp)
|
||||
target_link_libraries(arbitrateor ${Wt_LIBRARIES} ${GROOVE_LIBRARY})
|
||||
target_link_libraries(arbitrateor ${Wt_LIBRARIES} ${GROOVE_LIBRARY} pthread) #TODO get threading links based on platform.
|
||||
|
||||
install(TARGETS arbitrateor RUNTIME DESTINATION bin)
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
|
||||
#include "GroovePlayer.h"
|
||||
#include "db/User.h"
|
||||
#include "db/AudioTrack.h"
|
||||
#include "db/UserAction.h"
|
||||
#include <Wt/WLogger>
|
||||
#include <Wt/WServer>
|
||||
@@ -39,8 +37,29 @@ GroovePlayer::GroovePlayer(std::string dbFile) : sqliteConnection(dbFile)
|
||||
{
|
||||
Wt::log("info") << "Using Existing DB.";
|
||||
}
|
||||
|
||||
grooveAudioScanner = new std::thread(grooveAudioScannerLoop);
|
||||
grooveEvents = new std::thread(grooveEventLoop);
|
||||
}
|
||||
|
||||
std::vector<AudioTrack*> GroovePlayer::getNextVoteBatch()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
void GroovePlayer::grooveEventLoop()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
void GroovePlayer::grooveAudioScannerLoop()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO:use this code when sending to UI.
|
||||
// Wt::WServer::instance()->postAll([]() {
|
||||
// Wt::WApplication* app = Wt::WApplication::instance();
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include <Wt/Dbo/Session>
|
||||
#include <Wt/Dbo/backend/Sqlite3>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include "db/User.h"
|
||||
#include "db/AudioTrack.h"
|
||||
|
||||
class GroovePlayer
|
||||
{
|
||||
@@ -37,6 +41,13 @@ private:
|
||||
Wt::Dbo::backend::Sqlite3 sqliteConnection;
|
||||
Wt::Dbo::Session sqlSession;
|
||||
|
||||
std::vector<AudioTrack*> requestQueue;
|
||||
std::thread* grooveEvents;
|
||||
static void grooveEventLoop();
|
||||
std::vector<AudioTrack*> getNextVoteBatch();
|
||||
std::thread* grooveAudioScanner;
|
||||
static void grooveAudioScannerLoop();
|
||||
|
||||
};
|
||||
|
||||
#endif // GROOVEPLAYER_H
|
||||
|
||||
@@ -80,3 +80,15 @@ void WebInterface::voteUpdateFromServer(User* userVoting, bool forSkip)
|
||||
priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"vote");
|
||||
triggerUpdate();
|
||||
}
|
||||
|
||||
void WebInterface::voteNextSongFromServer(User* userVoting, AudioTrack* trackVoted)
|
||||
{
|
||||
priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"nextvote");
|
||||
triggerUpdate();
|
||||
}
|
||||
|
||||
void WebInterface::voteNextPollClosedFromServer()
|
||||
{
|
||||
priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"voteclosed");
|
||||
triggerUpdate();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
void songChangedFromServer(AudioTrack* nextTrack);
|
||||
void skipVotedFromServer(User* userRequestingToSkipCurrentTrack);
|
||||
void voteUpdateFromServer(User* userVoting, bool forSkip);
|
||||
void voteNextSongFromServer(User* userVoting, AudioTrack* trackVoted);
|
||||
void voteNextPollClosedFromServer();
|
||||
private:
|
||||
struct internal;
|
||||
internal* priv_int = 0;
|
||||
|
||||
Reference in New Issue
Block a user