Created UserInterface namespace, WebServerService -> UserInterfaceService.
This commit is contained in:
+11
-7
@@ -5,11 +5,13 @@ SUBDIRS = test .
|
|||||||
|
|
||||||
bin_PROGRAMS = lms
|
bin_PROGRAMS = lms
|
||||||
|
|
||||||
|
lms2_CXXFLAGS=-std=c++11 -Wall -I$(top_srcdir)/boost/ -I$(top_srcdir)/ui -I$(top_srcdir)/remote
|
||||||
|
|
||||||
lms_SOURCES = \
|
lms_SOURCES = \
|
||||||
$(top_srcdir)/main/main.cpp \
|
$(top_srcdir)/main/main.cpp \
|
||||||
$(top_srcdir)/main/ServiceManager.cpp \
|
$(top_srcdir)/main/ServiceManager.cpp \
|
||||||
$(top_srcdir)/main/DatabaseRefreshService.cpp \
|
$(top_srcdir)/main/DatabaseRefreshService.cpp \
|
||||||
$(top_srcdir)/main/WebServerService.cpp \
|
$(top_srcdir)/main/UserInterfaceService.cpp \
|
||||||
$(top_srcdir)/av/CodecContext.cpp \
|
$(top_srcdir)/av/CodecContext.cpp \
|
||||||
$(top_srcdir)/av/Common.cpp \
|
$(top_srcdir)/av/Common.cpp \
|
||||||
$(top_srcdir)/av/Dictionary.cpp \
|
$(top_srcdir)/av/Dictionary.cpp \
|
||||||
@@ -23,6 +25,7 @@ lms_SOURCES = \
|
|||||||
$(top_srcdir)/ui/audio/SearchFilterWidget.cpp \
|
$(top_srcdir)/ui/audio/SearchFilterWidget.cpp \
|
||||||
$(top_srcdir)/ui/audio/TableFilterWidget.cpp \
|
$(top_srcdir)/ui/audio/TableFilterWidget.cpp \
|
||||||
$(top_srcdir)/ui/audio/TrackWidget.cpp \
|
$(top_srcdir)/ui/audio/TrackWidget.cpp \
|
||||||
|
$(top_srcdir)/ui/common/SessionData.cpp \
|
||||||
$(top_srcdir)/ui/resource/AvConvTranscodeStreamResource.cpp \
|
$(top_srcdir)/ui/resource/AvConvTranscodeStreamResource.cpp \
|
||||||
$(top_srcdir)/ui/video/VideoWidget.cpp \
|
$(top_srcdir)/ui/video/VideoWidget.cpp \
|
||||||
$(top_srcdir)/ui/video/VideoDatabaseWidget.cpp \
|
$(top_srcdir)/ui/video/VideoDatabaseWidget.cpp \
|
||||||
@@ -43,12 +46,13 @@ lms_SOURCES = \
|
|||||||
$(top_srcdir)/transcode/Parameters.cpp \
|
$(top_srcdir)/transcode/Parameters.cpp \
|
||||||
$(top_srcdir)/transcode/InputMediaFile.cpp \
|
$(top_srcdir)/transcode/InputMediaFile.cpp \
|
||||||
$(top_srcdir)/metadata/AvFormat.cpp \
|
$(top_srcdir)/metadata/AvFormat.cpp \
|
||||||
|
$(top_srcdir)/main/RemoteServerService.cpp \
|
||||||
|
$(top_srcdir)/remote/server/Connection.cpp \
|
||||||
|
$(top_srcdir)/remote/server/ConnectionManager.cpp \
|
||||||
|
$(top_srcdir)/remote/server/RequestHandler.cpp \
|
||||||
|
$(top_srcdir)/remote/server/Server.cpp \
|
||||||
$(top_srcdir)/metadata/Utils.cpp
|
$(top_srcdir)/metadata/Utils.cpp
|
||||||
|
|
||||||
#$(top_srcdir)/main/RemoteServerService.cpp
|
|
||||||
#$(top_srcdir)/remote/server/Connection.cpp
|
|
||||||
#$(top_srcdir)/remote/server/ConnectionManager.cpp
|
|
||||||
#$(top_srcdir)/remote/server/Server.cpp
|
|
||||||
|
|
||||||
lms_CXXFLAGS=-std=c++11 -Wall -I$(top_srcdir)/boost/ -I$(top_srcdir)/ui -I$(top_srcdir)/remote
|
lms_CXXFLAGS=-std=c++11 -Wall -I$(top_srcdir)/boost/ -I$(top_srcdir)/ui -I$(top_srcdir)/remote
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -12,10 +12,10 @@ AC_CHECK_HEADERS([Wt/WApplication],
|
|||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR([Header not found or unusable !])])
|
[AC_MSG_ERROR([Header not found or unusable !])])
|
||||||
|
|
||||||
#AC_CHECK_LIB([pthread],
|
AC_CHECK_LIB([pthread],
|
||||||
# [pthread_create],
|
[pthread_create],
|
||||||
# ,
|
,
|
||||||
# [AC_MSG_ERROR([libpthread not found!])])
|
[AC_MSG_ERROR([libpthread not found!])])
|
||||||
|
|
||||||
AC_CHECK_LIB([avutil],
|
AC_CHECK_LIB([avutil],
|
||||||
[av_free],
|
[av_free],
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
#include "RemoteServerService.hpp"
|
#include "RemoteServerService.hpp"
|
||||||
|
|
||||||
RemoteServerService::RemoteServerService(const Remote::Server::Server::endpoint_type& endpoint)
|
RemoteServerService::RemoteServerService(const Remote::Server::Server::endpoint_type& endpoint, boost::filesystem::path dbPath)
|
||||||
: _server(endpoint)
|
: _server(endpoint, dbPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef REMOTE_SERVER_SERVICE_HPP
|
#ifndef REMOTE_SERVER_SERVICE_HPP
|
||||||
#define REMOTE_SERVER_SERVICE_HPP
|
#define REMOTE_SERVER_SERVICE_HPP
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#include "Service.hpp"
|
#include "Service.hpp"
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ class RemoteServerService : public Service
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RemoteServerService(const Remote::Server::Server::endpoint_type& endpoint);
|
RemoteServerService(const Remote::Server::Server::endpoint_type& endpoint, boost::filesystem::path dbPath);
|
||||||
|
|
||||||
void start(void);
|
void start(void);
|
||||||
void stop(void);
|
void stop(void);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#include <csignal>
|
//#include <csignal>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
@@ -7,15 +7,15 @@
|
|||||||
#include "ServiceManager.hpp"
|
#include "ServiceManager.hpp"
|
||||||
|
|
||||||
ServiceManager::ServiceManager()
|
ServiceManager::ServiceManager()
|
||||||
/*: _signalSet(_ioService) */
|
: _signalSet(_ioService)
|
||||||
{
|
{
|
||||||
/* _signalSet.add(SIGINT);
|
_signalSet.add(SIGINT);
|
||||||
_signalSet.add(SIGTERM);
|
_signalSet.add(SIGTERM);
|
||||||
#if defined(SIGQUIT)
|
#if defined(SIGQUIT)
|
||||||
_signalSet.add(SIGQUIT);
|
_signalSet.add(SIGQUIT);
|
||||||
#endif // defined(SIGQUIT)
|
#endif // defined(SIGQUIT)
|
||||||
|
|
||||||
_signalSet.add(SIGHUP);*/
|
_signalSet.add(SIGHUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -27,15 +27,16 @@ ServiceManager::run()
|
|||||||
// Wait for events
|
// Wait for events
|
||||||
_ioService.run();
|
_ioService.run();
|
||||||
|
|
||||||
|
std::cout << "ServiceManager::run complete!" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServiceManager::asyncWaitSignals(void)
|
ServiceManager::asyncWaitSignals(void)
|
||||||
{
|
{
|
||||||
/* _signalSet.async_wait(boost::bind(&ServiceManager::handleSignal,
|
_signalSet.async_wait(boost::bind(&ServiceManager::handleSignal,
|
||||||
this,
|
this,
|
||||||
boost::asio::placeholders::error,
|
boost::asio::placeholders::error,
|
||||||
boost::asio::placeholders::signal_number));*/
|
boost::asio::placeholders::signal_number));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class ServiceManager
|
|||||||
boost::asio::io_service _ioService;
|
boost::asio::io_service _ioService;
|
||||||
|
|
||||||
// Listen for interesting signals
|
// Listen for interesting signals
|
||||||
// boost::asio::signal_set _signalSet;
|
boost::asio::signal_set _signalSet;
|
||||||
|
|
||||||
std::set<Service::pointer> _services;
|
std::set<Service::pointer> _services;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include "UserInterfaceService.hpp"
|
||||||
|
#include "ui/LmsApplication.hpp"
|
||||||
|
|
||||||
|
UserInterfaceService::UserInterfaceService( int argc, char* argv[], boost::filesystem::path dbPath)
|
||||||
|
: _server(argv[0], "")
|
||||||
|
{
|
||||||
|
// TODO configure server using another way (config file?)
|
||||||
|
_server.setServerConfiguration (argc, argv, WTHTTP_CONFIGURATION);
|
||||||
|
|
||||||
|
// bind entry point
|
||||||
|
_server.addEntryPoint(Wt::Application, boost::bind(UserInterface::LmsApplication::create, _1, dbPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserInterfaceService::start(void)
|
||||||
|
{
|
||||||
|
_server.start();
|
||||||
|
std::cout << "UserInterfaceService::start -> Service started..." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserInterfaceService::stop(void)
|
||||||
|
{
|
||||||
|
std::cout << "UserInterfaceService::stop -> stopping..." << std::endl;
|
||||||
|
_server.stop();
|
||||||
|
std::cout << "UserInterfaceService::stop -> stopped!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserInterfaceService::restart(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
#ifndef WEB_SERVER_SERVICE_HPP
|
#ifndef WEB_SERVER_SERVICE_HPP
|
||||||
#define WEB_SERVER_SERVICE_HPP
|
#define WEB_SERVER_SERVICE_HPP
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#include <Wt/WServer>
|
#include <Wt/WServer>
|
||||||
|
|
||||||
#include "Service.hpp"
|
#include "Service.hpp"
|
||||||
|
|
||||||
class WebServerService : public Service
|
class UserInterfaceService : public Service
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WebServerService( int argc, char* argv[]);
|
UserInterfaceService( int argc, char* argv[], boost::filesystem::path dbPath);
|
||||||
|
|
||||||
void start(void);
|
void start(void);
|
||||||
void stop(void);
|
void stop(void);
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
#include "WebServerService.hpp"
|
|
||||||
#include "ui/LmsApplication.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
static Wt::WApplication *createApplication(const Wt::WEnvironment& env)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* You could read information from the environment to decide whether
|
|
||||||
* the user has permission to start a new application
|
|
||||||
*/
|
|
||||||
std::cout << "Creating new Application" << std::endl;
|
|
||||||
return new LmsApplication(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
WebServerService::WebServerService( int argc, char* argv[])
|
|
||||||
: _server(argv[0], "")
|
|
||||||
{
|
|
||||||
|
|
||||||
std::cout << "Constructing server... argv[0] = '" << argv[0] << "' argc = " << argc << std::endl;
|
|
||||||
|
|
||||||
// TODO configure server
|
|
||||||
_server.setServerConfiguration (argc, argv, WTHTTP_CONFIGURATION);
|
|
||||||
|
|
||||||
// bind entry point
|
|
||||||
|
|
||||||
_server.addEntryPoint(Wt::Application, createApplication);
|
|
||||||
|
|
||||||
std::cout << "WebServerService done!" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
WebServerService::start(void)
|
|
||||||
{
|
|
||||||
std::cout << "Starting service..." << std::endl;
|
|
||||||
|
|
||||||
bool res = _server.start();
|
|
||||||
std::cout << "_server.start returned " << std::boolalpha << res << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Service started..." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
WebServerService::stop(void)
|
|
||||||
{
|
|
||||||
_server.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
WebServerService::restart(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+11
-31
@@ -1,26 +1,18 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <Wt/WServer>
|
#include <Wt/WServer>
|
||||||
|
#include <Wt/WIOService>
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
#include "transcode/AvConvTranscoder.hpp"
|
#include "transcode/AvConvTranscoder.hpp"
|
||||||
#include "av/Common.hpp"
|
#include "av/Common.hpp"
|
||||||
|
|
||||||
#include "ServiceManager.hpp"
|
#include "ServiceManager.hpp"
|
||||||
#include "DatabaseRefreshService.hpp"
|
#include "DatabaseRefreshService.hpp"
|
||||||
#include "WebServerService.hpp"
|
#include "UserInterfaceService.hpp"
|
||||||
#include "RemoteServerService.hpp"
|
#include "RemoteServerService.hpp"
|
||||||
|
|
||||||
#include "ui/LmsApplication.hpp"
|
#include "ui/LmsApplication.hpp"
|
||||||
|
|
||||||
static Wt::WApplication *createApplication(const Wt::WEnvironment& env)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* You could read information from the environment to decide whether
|
|
||||||
* the user has permission to start a new application
|
|
||||||
*/
|
|
||||||
std::cout << "Creating new Application" << std::endl;
|
|
||||||
return new LmsApplication(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -28,32 +20,20 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// ServiceManager serviceManager;
|
ServiceManager serviceManager;
|
||||||
|
|
||||||
|
// TODO Retreive the database path in some config file
|
||||||
|
const boost::filesystem::path dbPath("test.db");
|
||||||
|
|
||||||
// lib init
|
// lib init
|
||||||
Av::AvInit();
|
Av::AvInit();
|
||||||
Transcode::AvConvTranscoder::init();
|
Transcode::AvConvTranscoder::init();
|
||||||
|
|
||||||
return Wt::WRun(argc, argv, createApplication);
|
serviceManager.startService( std::make_shared<DatabaseRefreshService>( dbPath) );
|
||||||
/* Wt::WServer server(argv[0], "");
|
serviceManager.startService( std::make_shared<UserInterfaceService>(argc, argv, dbPath) );
|
||||||
|
serviceManager.startService( std::make_shared<RemoteServerService>( Remote::Server::Server::endpoint_type(), dbPath) );
|
||||||
|
|
||||||
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
|
serviceManager.run();
|
||||||
server.addEntryPoint(Wt::Application, createApplication);
|
|
||||||
if (server.start()) {
|
|
||||||
int sig = Wt::WServer::waitForShutdown(argv[0]);
|
|
||||||
std::cerr << "Shutdown (signal = " << sig << ")" << std::endl;
|
|
||||||
server.stop();
|
|
||||||
if (sig == SIGHUP)
|
|
||||||
Wt::WServer::restart(argc, argv, environ);
|
|
||||||
}*/
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
|
|
||||||
// serviceManager.startService( std::make_shared<DatabaseRefreshService>( "test.db" ) );
|
|
||||||
// serviceManager.startService( std::make_shared<WebServerService>(argc, argv) );
|
|
||||||
// serviceManager.startService( std::make_shared<RemoteServerService>( Remote::Server::Server::endpoint_type() ) );
|
|
||||||
|
|
||||||
// serviceManager.run();
|
|
||||||
|
|
||||||
res = EXIT_SUCCESS;
|
res = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
|||||||
@@ -78,5 +78,4 @@ void Connection::handleWrite(const boost::system::error_code& error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "messages/Header.hpp"
|
#include "messages/Header.hpp"
|
||||||
|
|
||||||
namespace Remote {
|
namespace Remote {
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
class ConnectionManager;
|
class ConnectionManager;
|
||||||
@@ -71,7 +70,6 @@ class Connection : public std::enable_shared_from_this<Connection>
|
|||||||
|
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "ConnectionManager.hpp"
|
#include "ConnectionManager.hpp"
|
||||||
|
|
||||||
namespace Remote {
|
namespace Remote {
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
ConnectionManager::ConnectionManager()
|
ConnectionManager::ConnectionManager()
|
||||||
@@ -39,7 +38,6 @@ ConnectionManager::stopAll()
|
|||||||
|
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "Connection.hpp"
|
#include "Connection.hpp"
|
||||||
|
|
||||||
namespace Remote {
|
namespace Remote {
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
/// Manages open connections so that they may be cleanly stopped when the server
|
/// Manages open connections so that they may be cleanly stopped when the server
|
||||||
@@ -35,7 +34,6 @@ class ConnectionManager
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
#include "RequestHandler.hpp"
|
||||||
|
|
||||||
|
namespace Remote {
|
||||||
|
namespace Server {
|
||||||
|
|
||||||
|
RequestHandler::RequestHandler(boost::filesystem::path dbPath)
|
||||||
|
: _db( dbPath )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Server
|
||||||
|
} // namespace Remote
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,18 +1,30 @@
|
|||||||
#ifndef REMOTE_REQUEST_HANDLER
|
#ifndef REMOTE_REQUEST_HANDLER
|
||||||
#define REMOTE_REQUEST_HANDLER
|
#define REMOTE_REQUEST_HANDLER
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
#include "database/DatabaseHandler.hpp"
|
||||||
|
|
||||||
// #include "remote/messages/
|
// #include "remote/messages/
|
||||||
|
|
||||||
|
namespace Remote {
|
||||||
|
namespace Server {
|
||||||
|
|
||||||
class RequestHandler
|
class RequestHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
RequestHandler(boost::filesystem::path dbPath);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
DatabaseHandler _db;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Server
|
||||||
|
} // namespace Remote
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
#include "Server.hpp"
|
#include "Server.hpp"
|
||||||
|
|
||||||
namespace Remote {
|
namespace Remote {
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
Server::Server(const endpoint_type& endpoint)
|
Server::Server(const endpoint_type& endpoint, boost::filesystem::path dbPath)
|
||||||
:
|
:
|
||||||
_acceptor(_ioService),
|
_acceptor(_ioService),
|
||||||
_connectionManager(),
|
_connectionManager(),
|
||||||
_socket(_ioService)
|
_socket(_ioService),
|
||||||
|
_requestHandler(dbPath)
|
||||||
{
|
{
|
||||||
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
|
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
|
||||||
boost::asio::ip::tcp::resolver resolver(_ioService);
|
boost::asio::ip::tcp::resolver resolver(_ioService);
|
||||||
@@ -72,5 +72,4 @@ Server::stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define REMOTE_SERVER_HPP
|
#define REMOTE_SERVER_HPP
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#include "Connection.hpp"
|
#include "Connection.hpp"
|
||||||
#include "ConnectionManager.hpp"
|
#include "ConnectionManager.hpp"
|
||||||
@@ -9,7 +10,6 @@
|
|||||||
#include "RequestHandler.hpp"
|
#include "RequestHandler.hpp"
|
||||||
|
|
||||||
namespace Remote {
|
namespace Remote {
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
@@ -22,7 +22,7 @@ class Server
|
|||||||
typedef boost::asio::ip::tcp::endpoint endpoint_type;
|
typedef boost::asio::ip::tcp::endpoint endpoint_type;
|
||||||
|
|
||||||
// Serve up data from the given database
|
// Serve up data from the given database
|
||||||
Server(const endpoint_type& endpoint);
|
Server(const endpoint_type& endpoint, boost::filesystem::path dbPath);
|
||||||
|
|
||||||
// Run the server's io_service loop.
|
// Run the server's io_service loop.
|
||||||
void run();
|
void run();
|
||||||
@@ -50,7 +50,6 @@ class Server
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Server
|
} // namespace Server
|
||||||
|
|
||||||
} // namespace Remote
|
} // namespace Remote
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+19
-4
@@ -11,6 +11,18 @@
|
|||||||
|
|
||||||
#include "LmsApplication.hpp"
|
#include "LmsApplication.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
|
Wt::WApplication*
|
||||||
|
LmsApplication::create(const Wt::WEnvironment& env, boost::filesystem::path dbPath)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* You could read information from the environment to decide whether
|
||||||
|
* the user has permission to start a new application
|
||||||
|
*/
|
||||||
|
std::cout << "Creating new Application" << std::endl;
|
||||||
|
return new LmsApplication(env, dbPath);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The env argument contains information about the new session, and
|
* The env argument contains information about the new session, and
|
||||||
@@ -18,8 +30,9 @@
|
|||||||
* constructor so it is typically also an argument for your custom
|
* constructor so it is typically also an argument for your custom
|
||||||
* application constructor.
|
* application constructor.
|
||||||
*/
|
*/
|
||||||
LmsApplication::LmsApplication(const Wt::WEnvironment& env)
|
LmsApplication::LmsApplication(const Wt::WEnvironment& env, boost::filesystem::path dbPath)
|
||||||
: Wt::WApplication(env)
|
: Wt::WApplication(env),
|
||||||
|
_sessionData(dbPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
setTheme(new Wt::WBootstrapTheme());
|
setTheme(new Wt::WBootstrapTheme());
|
||||||
@@ -40,8 +53,8 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env)
|
|||||||
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack, container);
|
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack, container);
|
||||||
navigation->addMenu(leftMenu);
|
navigation->addMenu(leftMenu);
|
||||||
|
|
||||||
_audioWidget = new AudioWidget();
|
_audioWidget = new AudioWidget(_sessionData);
|
||||||
_videoWidget = new VideoWidget();
|
_videoWidget = new VideoWidget(_sessionData);
|
||||||
|
|
||||||
leftMenu->addItem("Audio", _audioWidget);
|
leftMenu->addItem("Audio", _audioWidget);
|
||||||
leftMenu->addItem("Video", _videoWidget);
|
leftMenu->addItem("Video", _videoWidget);
|
||||||
@@ -79,3 +92,5 @@ LmsApplication::handleSearch(void)
|
|||||||
_audioWidget->search( _searchEdit->text().toUTF8() );
|
_audioWidget->search( _searchEdit->text().toUTF8() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace DatabaseHandler
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -5,19 +5,28 @@
|
|||||||
#include "audio/AudioWidget.hpp"
|
#include "audio/AudioWidget.hpp"
|
||||||
#include "video/VideoWidget.hpp"
|
#include "video/VideoWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
|
|
||||||
class LmsApplication : public Wt::WApplication
|
class LmsApplication : public Wt::WApplication
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LmsApplication(const Wt::WEnvironment& env);
|
static Wt::WApplication *create(const Wt::WEnvironment& env, boost::filesystem::path dbPath);
|
||||||
|
|
||||||
|
LmsApplication(const Wt::WEnvironment& env, boost::filesystem::path dbPath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void handleSearch();
|
void handleSearch();
|
||||||
|
|
||||||
|
SessionData _sessionData;
|
||||||
|
|
||||||
Wt::WLineEdit* _searchEdit;
|
Wt::WLineEdit* _searchEdit;
|
||||||
AudioWidget* _audioWidget;
|
AudioWidget* _audioWidget;
|
||||||
VideoWidget* _videoWidget;
|
VideoWidget* _videoWidget;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
#include "SearchFilterWidget.hpp"
|
#include "SearchFilterWidget.hpp"
|
||||||
#include "TrackWidget.hpp"
|
#include "TrackWidget.hpp"
|
||||||
|
|
||||||
AudioDatabaseWidget::AudioDatabaseWidget( Wt::WContainerWidget *parent)
|
namespace UserInterface {
|
||||||
|
|
||||||
|
AudioDatabaseWidget::AudioDatabaseWidget( DatabaseHandler& db, Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent),
|
||||||
_db("test.db"), // TODO
|
|
||||||
_refreshingFilters(false)
|
_refreshingFilters(false)
|
||||||
{
|
{
|
||||||
std::size_t idFilter (0);
|
std::size_t idFilter (0);
|
||||||
@@ -22,23 +23,23 @@ _refreshingFilters(false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TableFilterWidget* filterTable = new TableFilterWidget(_db, "genre", "name", this);
|
TableFilterWidget* filterTable = new TableFilterWidget(db, "genre", "name", this);
|
||||||
_filters.push_back( filterTable );
|
_filters.push_back( filterTable );
|
||||||
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TableFilterWidget* filterTable = new TableFilterWidget(_db, "artist", "name", this);
|
TableFilterWidget* filterTable = new TableFilterWidget(db, "artist", "name", this);
|
||||||
_filters.push_back( filterTable );
|
_filters.push_back( filterTable );
|
||||||
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TableFilterWidget* filterTable = new TableFilterWidget(_db, "release", "name", this);
|
TableFilterWidget* filterTable = new TableFilterWidget(db, "release", "name", this);
|
||||||
_filters.push_back( filterTable );
|
_filters.push_back( filterTable );
|
||||||
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
filterTable->update().connect( boost::bind(&AudioDatabaseWidget::handleFilterUpdated, this, idFilter++) );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TrackWidget* track = new TrackWidget(_db, this);
|
TrackWidget* track = new TrackWidget(db, this);
|
||||||
_filters.push_back( track );
|
_filters.push_back( track );
|
||||||
track->trackSelected().connect(this, &AudioDatabaseWidget::handleTrackSelected);
|
track->trackSelected().connect(this, &AudioDatabaseWidget::handleTrackSelected);
|
||||||
}
|
}
|
||||||
@@ -104,5 +105,6 @@ AudioDatabaseWidget::selectNextTrack(void)
|
|||||||
trackWidget->selectNextTrack();
|
trackWidget->selectNextTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,16 @@
|
|||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
#include <Wt/WSignal>
|
#include <Wt/WSignal>
|
||||||
|
|
||||||
#include "database/DatabaseHandler.hpp"
|
#include "common/SessionData.hpp"
|
||||||
|
|
||||||
#include "FilterWidget.hpp"
|
#include "FilterWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class AudioDatabaseWidget : public Wt::WContainerWidget
|
class AudioDatabaseWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AudioDatabaseWidget( Wt::WContainerWidget *parent = 0);
|
AudioDatabaseWidget( DatabaseHandler& db, Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
void search(const std::string& text);
|
void search(const std::string& text);
|
||||||
|
|
||||||
@@ -24,8 +26,6 @@ class AudioDatabaseWidget : public Wt::WContainerWidget
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DatabaseHandler _db;
|
|
||||||
|
|
||||||
Wt::Signal< boost::filesystem::path > _trackSelected;
|
Wt::Signal< boost::filesystem::path > _trackSelected;
|
||||||
|
|
||||||
void handleTrackSelected(boost::filesystem::path p);
|
void handleTrackSelected(boost::filesystem::path p);
|
||||||
@@ -37,6 +37,7 @@ class AudioDatabaseWidget : public Wt::WContainerWidget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "AudioMediaPlayerWidget.hpp"
|
#include "AudioMediaPlayerWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
AudioMediaPlayerWidget::AudioMediaPlayerWidget( Wt::WContainerWidget *parent)
|
AudioMediaPlayerWidget::AudioMediaPlayerWidget( Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent),
|
||||||
@@ -155,3 +156,5 @@ AudioMediaPlayerWidget::handleVolumeSliderMoved(int value)
|
|||||||
{
|
{
|
||||||
_mediaPlayer->setVolume( value / 100. );
|
_mediaPlayer->setVolume( value / 100. );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -10,10 +10,11 @@
|
|||||||
#include <Wt/WLink>
|
#include <Wt/WLink>
|
||||||
#include <Wt/WText>
|
#include <Wt/WText>
|
||||||
|
|
||||||
|
|
||||||
#include "transcode/Parameters.hpp"
|
#include "transcode/Parameters.hpp"
|
||||||
#include "resource/AvConvTranscodeStreamResource.hpp"
|
#include "resource/AvConvTranscodeStreamResource.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class AudioMediaPlayerWidget : public Wt::WContainerWidget
|
class AudioMediaPlayerWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -63,6 +64,7 @@ class AudioMediaPlayerWidget : public Wt::WContainerWidget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,17 @@
|
|||||||
|
|
||||||
#include "metadata/Extractor.hpp"
|
#include "metadata/Extractor.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
AudioWidget::AudioWidget(Wt::WContainerWidget* parent)
|
AudioWidget::AudioWidget(SessionData& sessionData, Wt::WContainerWidget* parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent),
|
||||||
|
_sessionData(sessionData),
|
||||||
_audioDbWidget(nullptr),
|
_audioDbWidget(nullptr),
|
||||||
_mediaPlayer(nullptr),
|
_mediaPlayer(nullptr),
|
||||||
_imgResource(nullptr),
|
_imgResource(nullptr),
|
||||||
_img(nullptr)
|
_img(nullptr)
|
||||||
{
|
{
|
||||||
_audioDbWidget = new AudioDatabaseWidget(this);
|
_audioDbWidget = new AudioDatabaseWidget(sessionData.getDatabaseHandler(), this);
|
||||||
|
|
||||||
_audioDbWidget->trackSelected().connect(this, &AudioWidget::playTrack);
|
_audioDbWidget->trackSelected().connect(this, &AudioWidget::playTrack);
|
||||||
|
|
||||||
@@ -78,4 +80,5 @@ AudioWidget::handleTrackEnded(void)
|
|||||||
_audioDbWidget->selectNextTrack();
|
_audioDbWidget->selectNextTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,14 @@
|
|||||||
#include "audio/AudioMediaPlayerWidget.hpp"
|
#include "audio/AudioMediaPlayerWidget.hpp"
|
||||||
#include "audio/AudioDatabaseWidget.hpp"
|
#include "audio/AudioDatabaseWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class AudioWidget : public Wt::WContainerWidget
|
class AudioWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AudioWidget(Wt::WContainerWidget* parent = 0);
|
AudioWidget(SessionData& sessionData, Wt::WContainerWidget* parent = 0);
|
||||||
|
|
||||||
void search(const std::string& searchText);
|
void search(const std::string& searchText);
|
||||||
|
|
||||||
@@ -26,6 +28,8 @@ class AudioWidget : public Wt::WContainerWidget
|
|||||||
|
|
||||||
void handleTrackEnded(void);
|
void handleTrackEnded(void);
|
||||||
|
|
||||||
|
SessionData& _sessionData;
|
||||||
|
|
||||||
AudioDatabaseWidget* _audioDbWidget;
|
AudioDatabaseWidget* _audioDbWidget;
|
||||||
|
|
||||||
AudioMediaPlayerWidget* _mediaPlayer;
|
AudioMediaPlayerWidget* _mediaPlayer;
|
||||||
@@ -39,5 +43,7 @@ class AudioWidget : public Wt::WContainerWidget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "database/SqlQuery.hpp"
|
#include "database/SqlQuery.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class FilterWidget : public Wt::WContainerWidget {
|
class FilterWidget : public Wt::WContainerWidget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -39,8 +41,6 @@ class FilterWidget : public Wt::WContainerWidget {
|
|||||||
Wt::Signal<void> _update;
|
Wt::Signal<void> _update;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "SearchFilterWidget.hpp"
|
#include "SearchFilterWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
SearchFilterWidget::SearchFilterWidget(Wt::WContainerWidget* parent)
|
SearchFilterWidget::SearchFilterWidget(Wt::WContainerWidget* parent)
|
||||||
: FilterWidget( parent )
|
: FilterWidget( parent )
|
||||||
@@ -30,4 +31,5 @@ SearchFilterWidget::getConstraint(Constraint& constraint)
|
|||||||
// else no constraint!
|
// else no constraint!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "FilterWidget.hpp"
|
#include "FilterWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class SearchFilterWidget : public FilterWidget {
|
class SearchFilterWidget : public FilterWidget {
|
||||||
public:
|
public:
|
||||||
SearchFilterWidget(Wt::WContainerWidget* parent = 0);
|
SearchFilterWidget(Wt::WContainerWidget* parent = 0);
|
||||||
@@ -24,9 +26,7 @@ class SearchFilterWidget : public FilterWidget {
|
|||||||
std::string _lastEmittedText;
|
std::string _lastEmittedText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "TableFilterWidget.hpp"
|
#include "TableFilterWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
TableFilterWidget::TableFilterWidget(DatabaseHandler& db, std::string table, std::string field, Wt::WContainerWidget* parent)
|
TableFilterWidget::TableFilterWidget(DatabaseHandler& db, std::string table, std::string field, Wt::WContainerWidget* parent)
|
||||||
: FilterWidget( parent ),
|
: FilterWidget( parent ),
|
||||||
_db(db),
|
_db(db),
|
||||||
@@ -88,3 +90,5 @@ TableFilterWidget::getConstraint(Constraint& constraint)
|
|||||||
constraint.where.And( clause );
|
constraint.where.And( clause );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include "FilterWidget.hpp"
|
#include "FilterWidget.hpp"
|
||||||
#include "database/DatabaseHandler.hpp"
|
#include "database/DatabaseHandler.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class TableFilterWidget : public FilterWidget
|
class TableFilterWidget : public FilterWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ class TableFilterWidget : public FilterWidget
|
|||||||
Wt::WTableView* _tableView;
|
Wt::WTableView* _tableView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "TrackWidget.hpp"
|
#include "TrackWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
TrackWidget::TrackWidget( DatabaseHandler& db, Wt::WContainerWidget* parent)
|
TrackWidget::TrackWidget( DatabaseHandler& db, Wt::WContainerWidget* parent)
|
||||||
: FilterWidget( parent ),
|
: FilterWidget( parent ),
|
||||||
_db(db),
|
_db(db),
|
||||||
@@ -132,3 +134,5 @@ TrackWidget::selectNextTrack(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "FilterWidget.hpp"
|
#include "FilterWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class TrackWidget : public FilterWidget
|
class TrackWidget : public FilterWidget
|
||||||
{
|
{
|
||||||
@@ -45,5 +46,7 @@ class TrackWidget : public FilterWidget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#include "SessionData.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
|
SessionData::SessionData(boost::filesystem::path dbPath)
|
||||||
|
: _db(dbPath)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef UI_SESSION_DATA_HPP
|
||||||
|
#define UI_SESSION_DATA_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
#include "database/DatabaseHandler.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
|
class SessionData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
SessionData(boost::filesystem::path dbPath);
|
||||||
|
|
||||||
|
void setAuthenticatedUser(std::string user);
|
||||||
|
|
||||||
|
|
||||||
|
DatabaseHandler& getDatabaseHandler() { return _db;}
|
||||||
|
const DatabaseHandler& getDatabaseHandler() const { return _db;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
DatabaseHandler _db;
|
||||||
|
std::string _authenticatedUser;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
#include <Wt/Http/Response>
|
#include <Wt/Http/Response>
|
||||||
#include "AvConvTranscodeStreamResource.hpp"
|
#include "AvConvTranscodeStreamResource.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
AvConvTranscodeStreamResource::AvConvTranscodeStreamResource(const Transcode::Parameters& parameters, Wt::WObject *parent)
|
AvConvTranscodeStreamResource::AvConvTranscodeStreamResource(const Transcode::Parameters& parameters, Wt::WObject *parent)
|
||||||
: Wt::WResource(parent),
|
: Wt::WResource(parent),
|
||||||
_parameters( parameters )
|
_parameters( parameters )
|
||||||
@@ -71,6 +73,6 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
|||||||
std::cout << "No more data!" << std::endl;
|
std::cout << "No more data!" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#ifndef AVCONV_TRANSCODE_STREAM_RESOURCE_HPP
|
#ifndef AVCONV_TRANSCODE_STREAM_RESOURCE_HPP
|
||||||
#define AVCONV_TRANSCODE_STREAM_RESOURCE_HPP
|
#define AVCONV_TRANSCODE_STREAM_RESOURCE_HPP
|
||||||
|
|
||||||
#include <deque>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
#include <Wt/WResource>
|
#include <Wt/WResource>
|
||||||
|
|
||||||
#include "transcode/AvConvTranscoder.hpp"
|
#include "transcode/AvConvTranscoder.hpp"
|
||||||
|
#include "transcode/Parameters.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class AvConvTranscodeStreamResource : public Wt::WResource
|
class AvConvTranscodeStreamResource : public Wt::WResource
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ class AvConvTranscodeStreamResource : public Wt::WResource
|
|||||||
static const std::size_t _bufferSize = 8192*16;
|
static const std::size_t _bufferSize = 8192*16;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
#include "VideoDatabaseWidget.hpp"
|
#include "VideoDatabaseWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
VideoDatabaseWidget::VideoDatabaseWidget( Wt::WContainerWidget *parent)
|
VideoDatabaseWidget::VideoDatabaseWidget(DatabaseHandler& db, Wt::WContainerWidget *parent)
|
||||||
: Wt::WContainerWidget(parent),
|
: Wt::WContainerWidget(parent),
|
||||||
_db("test.db") // TODO
|
_db(db)
|
||||||
{
|
{
|
||||||
_table = new Wt::WTable( this );
|
_table = new Wt::WTable( this );
|
||||||
_table->setHeaderCount(1);
|
_table->setHeaderCount(1);
|
||||||
@@ -137,3 +138,5 @@ VideoDatabaseWidget::handlePlayVideo(const boost::filesystem::path& videoFilePat
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,15 @@
|
|||||||
#include <Wt/WTable>
|
#include <Wt/WTable>
|
||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
|
|
||||||
#include "database/DatabaseHandler.hpp"
|
#include "common/SessionData.hpp"
|
||||||
#include "database/FileTypes.hpp"
|
#include "database/FileTypes.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class VideoDatabaseWidget : public Wt::WContainerWidget
|
class VideoDatabaseWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VideoDatabaseWidget( Wt::WContainerWidget *parent = 0);
|
VideoDatabaseWidget( DatabaseHandler& db, Wt::WContainerWidget *parent = 0);
|
||||||
|
|
||||||
// Signals
|
// Signals
|
||||||
Wt::Signal< boost::filesystem::path >& playVideo() { return _playVideo; }
|
Wt::Signal< boost::filesystem::path >& playVideo() { return _playVideo; }
|
||||||
@@ -26,13 +28,14 @@ class VideoDatabaseWidget : public Wt::WContainerWidget
|
|||||||
void addDirectory(const std::string& name, const boost::filesystem::path& path);
|
void addDirectory(const std::string& name, const boost::filesystem::path& path);
|
||||||
void addVideo(const std::string& name, const boost::posix_time::time_duration& duration, const boost::filesystem::path& path);
|
void addVideo(const std::string& name, const boost::posix_time::time_duration& duration, const boost::filesystem::path& path);
|
||||||
|
|
||||||
Wt::Signal< boost::filesystem::path > _playVideo;
|
DatabaseHandler& _db;
|
||||||
|
|
||||||
DatabaseHandler _db;
|
Wt::Signal< boost::filesystem::path > _playVideo;
|
||||||
|
|
||||||
Wt::WTable* _table;
|
Wt::WTable* _table;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "VideoMediaPlayerWidget.hpp"
|
#include "VideoMediaPlayerWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
Wt::WMediaPlayer::Encoding
|
Wt::WMediaPlayer::Encoding
|
||||||
convert(Transcode::Format format)
|
convert(Transcode::Format format)
|
||||||
@@ -178,3 +179,5 @@ VideoMediaPlayerWidget::handleParametersDone(Wt::WDialog::DialogCode code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include "transcode/Parameters.hpp"
|
#include "transcode/Parameters.hpp"
|
||||||
#include "resource/AvConvTranscodeStreamResource.hpp"
|
#include "resource/AvConvTranscodeStreamResource.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class VideoMediaPlayerWidget : public Wt::WContainerWidget
|
class VideoMediaPlayerWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -58,6 +60,7 @@ class VideoMediaPlayerWidget : public Wt::WContainerWidget
|
|||||||
VideoParametersDialog* _dialog;
|
VideoParametersDialog* _dialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
using namespace Transcode;
|
using namespace Transcode;
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
static const std::list<Stream::Type> streamTypes = {Stream::Video, Stream::Audio, Stream::Subtitle};
|
static const std::list<Stream::Type> streamTypes = {Stream::Video, Stream::Audio, Stream::Subtitle};
|
||||||
|
|
||||||
VideoParametersDialog::VideoParametersDialog(const Wt::WString &windowTitle, Wt::WDialog* parent)
|
VideoParametersDialog::VideoParametersDialog(const Wt::WString &windowTitle, Wt::WDialog* parent)
|
||||||
@@ -165,4 +167,5 @@ VideoParametersDialog::save(Transcode::Parameters& parameters)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "transcode/Parameters.hpp"
|
#include "transcode/Parameters.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class VideoParametersDialog : public Wt::WDialog
|
class VideoParametersDialog : public Wt::WDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -43,5 +45,7 @@ class VideoParametersDialog : public Wt::WDialog
|
|||||||
std::map<Transcode::Stream::Type, std::pair<Wt::WComboBox*, Wt::WStringListModel* > > _streamSelection;
|
std::map<Transcode::Stream::Type, std::pair<Wt::WComboBox*, Wt::WStringListModel* > > _streamSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
#include "VideoWidget.hpp"
|
#include "VideoWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
VideoWidget::VideoWidget(Wt::WContainerWidget* parent )
|
VideoWidget::VideoWidget(SessionData& sessionData, Wt::WContainerWidget* parent )
|
||||||
: Wt::WContainerWidget(parent)
|
: Wt::WContainerWidget(parent),
|
||||||
|
_sessionData(sessionData)
|
||||||
{
|
{
|
||||||
|
|
||||||
_videoDbWidget = new VideoDatabaseWidget(this);
|
_videoDbWidget = new VideoDatabaseWidget(_sessionData.getDatabaseHandler(), this);
|
||||||
|
|
||||||
_videoDbWidget->playVideo().connect(this, &VideoWidget::playVideo);
|
_videoDbWidget->playVideo().connect(this, &VideoWidget::playVideo);
|
||||||
|
|
||||||
@@ -61,3 +63,5 @@ VideoWidget::playVideo(boost::filesystem::path p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,18 @@
|
|||||||
|
|
||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
|
|
||||||
|
#include "common/SessionData.hpp"
|
||||||
|
|
||||||
#include "video/VideoMediaPlayerWidget.hpp"
|
#include "video/VideoMediaPlayerWidget.hpp"
|
||||||
#include "video/VideoDatabaseWidget.hpp"
|
#include "video/VideoDatabaseWidget.hpp"
|
||||||
|
|
||||||
|
namespace UserInterface {
|
||||||
|
|
||||||
class VideoWidget : public Wt::WContainerWidget
|
class VideoWidget : public Wt::WContainerWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VideoWidget(Wt::WContainerWidget* parent = 0);
|
VideoWidget(SessionData& sessionData, Wt::WContainerWidget* parent = 0);
|
||||||
|
|
||||||
void search(const std::string& searchText);
|
void search(const std::string& searchText);
|
||||||
|
|
||||||
@@ -21,10 +25,14 @@ class VideoWidget : public Wt::WContainerWidget
|
|||||||
void backToList(void);
|
void backToList(void);
|
||||||
void playVideo(boost::filesystem::path p);
|
void playVideo(boost::filesystem::path p);
|
||||||
|
|
||||||
|
SessionData& _sessionData;
|
||||||
|
|
||||||
VideoDatabaseWidget* _videoDbWidget;
|
VideoDatabaseWidget* _videoDbWidget;
|
||||||
VideoMediaPlayerWidget* _mediaPlayer;
|
VideoMediaPlayerWidget* _mediaPlayer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace UserInterface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user