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