Make GroovePlayer a singleton to avoid being created for each browser. Add login UI component to eventually hold landing screen. Actually start server with initial interface.
This commit is contained in:
@@ -18,3 +18,8 @@
|
||||
*/
|
||||
|
||||
#include "GroovePlayer.h"
|
||||
|
||||
GroovePlayer::GroovePlayer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
|
||||
class GroovePlayer
|
||||
{
|
||||
public:
|
||||
static GroovePlayer* getInstance() {
|
||||
static GroovePlayer instance;
|
||||
return &instance;
|
||||
};
|
||||
GroovePlayer(GroovePlayer const&) = delete;
|
||||
void operator=(GroovePlayer const&) = delete;
|
||||
private:
|
||||
GroovePlayer();
|
||||
};
|
||||
|
||||
#endif // GROOVEPLAYER_H
|
||||
|
||||
@@ -18,3 +18,25 @@
|
||||
*/
|
||||
|
||||
#include "WebInterface.h"
|
||||
#include "ui/LoginInterface.h"
|
||||
#include <Wt/WText>
|
||||
|
||||
struct WebInterface::internal
|
||||
{
|
||||
LoginInterface* loginUI;
|
||||
};
|
||||
|
||||
WebInterface::WebInterface(const Wt::WEnvironment& env) : Wt::WApplication(env)
|
||||
{
|
||||
priv_int = new internal;
|
||||
setTitle("Arbitrateor - Audio Jukebox");
|
||||
priv_int->loginUI = new LoginInterface(this);
|
||||
root()->addWidget(priv_int->loginUI);
|
||||
}
|
||||
|
||||
void WebInterface::loginCompleted()
|
||||
{
|
||||
//Login completed, now bring up main inteface.
|
||||
root()->removeWidget(priv_int->loginUI);
|
||||
root()->addWidget(new Wt::WText("you did it"));
|
||||
}
|
||||
|
||||
@@ -21,9 +21,16 @@
|
||||
#define WEBINTERFACE_H
|
||||
|
||||
#include <Wt/WApplication>
|
||||
#include "GroovePlayer.h"
|
||||
|
||||
class WebInterface : public Wt::WApplication
|
||||
{
|
||||
public:
|
||||
WebInterface(const Wt::WEnvironment& env);
|
||||
void loginCompleted();
|
||||
private:
|
||||
struct internal;
|
||||
internal* priv_int = 0;
|
||||
};
|
||||
|
||||
#endif // WEBINTERFACE_H
|
||||
|
||||
26
src/main.cpp
26
src/main.cpp
@@ -1,8 +1,30 @@
|
||||
#include <iostream>
|
||||
#include "WebInterface.h"
|
||||
#include <Wt/WServer>
|
||||
#include <Wt/WConfig.h>
|
||||
#include "GroovePlayer.h"
|
||||
|
||||
Wt::WApplication* createApplication(const Wt::WEnvironment& env)
|
||||
{
|
||||
return new WebInterface(env);
|
||||
}
|
||||
|
||||
int main ( int argc, char** argv )
|
||||
{
|
||||
std::cout << "Hello, world!" << std::endl;
|
||||
return 0;
|
||||
try {
|
||||
Wt::WServer server(argv[0]);
|
||||
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
|
||||
server.addEntryPoint(Wt::Application, createApplication);
|
||||
if(server.start())
|
||||
{
|
||||
int sig = Wt::WServer::waitForShutdown(argv[0]);
|
||||
server.stop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Wt::WServer::Exception& e)
|
||||
{
|
||||
std::cerr << e.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user