[UI] Splitted code to prepare mobile audio implementation
This commit is contained in:
+8
-7
@@ -40,13 +40,14 @@ lms_SOURCES = \
|
||||
$(srcdir)/transcode/InputMediaFile.cpp \
|
||||
$(srcdir)/ui/LmsApplication.cpp \
|
||||
$(srcdir)/ui/auth/LmsAuth.cpp \
|
||||
$(srcdir)/ui/audio/Audio.cpp \
|
||||
$(srcdir)/ui/audio/AudioMediaPlayer.cpp \
|
||||
$(srcdir)/ui/audio/FilterChain.cpp \
|
||||
$(srcdir)/ui/audio/KeywordSearchFilter.cpp \
|
||||
$(srcdir)/ui/audio/PlayQueue.cpp \
|
||||
$(srcdir)/ui/audio/TableFilter.cpp \
|
||||
$(srcdir)/ui/audio/TrackView.cpp \
|
||||
$(srcdir)/ui/audio/desktop/DesktopAudio.cpp \
|
||||
$(srcdir)/ui/audio/desktop/AudioMediaPlayer.cpp \
|
||||
$(srcdir)/ui/audio/desktop/FilterChain.cpp \
|
||||
$(srcdir)/ui/audio/desktop/KeywordSearchFilter.cpp \
|
||||
$(srcdir)/ui/audio/desktop/PlayQueue.cpp \
|
||||
$(srcdir)/ui/audio/desktop/TableFilter.cpp \
|
||||
$(srcdir)/ui/audio/desktop/TrackView.cpp \
|
||||
$(srcdir)/ui/audio/mobile/MobileAudio.cpp \
|
||||
$(srcdir)/ui/common/DirectoryValidator.cpp \
|
||||
$(srcdir)/ui/common/LineEdit.cpp \
|
||||
$(srcdir)/ui/common/SessionData.cpp \
|
||||
|
||||
@@ -17,17 +17,15 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <Wt/WEnvironment>
|
||||
#include <Wt/WBootstrapTheme>
|
||||
#include <Wt/WVBoxLayout>
|
||||
#include <Wt/WHBoxLayout>
|
||||
#include <Wt/WNavigationBar>
|
||||
#include <Wt/WStackedWidget>
|
||||
#include <Wt/WMenu>
|
||||
#include <Wt/WNavigationBar>
|
||||
#include <Wt/WPopupMenu>
|
||||
#include <Wt/WPopupMenuItem>
|
||||
#include <Wt/WVBoxLayout>
|
||||
#include <Wt/WLineEdit>
|
||||
#include <Wt/Auth/Identity>
|
||||
|
||||
#include "logger/Logger.hpp"
|
||||
@@ -36,7 +34,8 @@
|
||||
#include "settings/SettingsFirstConnectionFormView.hpp"
|
||||
|
||||
#include "auth/LmsAuth.hpp"
|
||||
#include "audio/Audio.hpp"
|
||||
#include "audio/desktop/DesktopAudio.hpp"
|
||||
#include "audio/mobile/MobileAudio.hpp"
|
||||
#include "video/VideoWidget.hpp"
|
||||
#include "common/LineEdit.hpp"
|
||||
|
||||
@@ -46,6 +45,16 @@ namespace skeletons {
|
||||
extern const char *AuthStrings_xml1;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
bool agentIsMobile()
|
||||
{
|
||||
const Wt::WEnvironment& env = Wt::WApplication::instance()->environment();
|
||||
|
||||
return (env.agentIsIEMobile() || env.agentIsMobileWebKit());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
@@ -150,7 +159,15 @@ LmsApplication::handleAuthEvent(void)
|
||||
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack);
|
||||
navigation->addMenu(leftMenu);
|
||||
|
||||
Audio *audio = new Audio(_sessionData);
|
||||
const Wt::WEnvironment& env = Wt::WApplication::instance()->environment();
|
||||
|
||||
Audio *audio;
|
||||
|
||||
if (agentIsMobile())
|
||||
audio = new Desktop::Audio(_sessionData);
|
||||
else
|
||||
audio = new Mobile::Audio();
|
||||
|
||||
VideoWidget *videoWidget = new VideoWidget(_sessionData);
|
||||
|
||||
leftMenu->addItem("Audio", audio);
|
||||
|
||||
+5
-49
@@ -17,69 +17,25 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HPP
|
||||
#define AUDIO_HPP
|
||||
#ifndef UI_AUDIO_HPP
|
||||
#define UI_AUDIO_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <Wt/WPopupMenu>
|
||||
#include <Wt/WContainerWidget>
|
||||
|
||||
#include "common/SessionData.hpp"
|
||||
|
||||
#include "AudioMediaPlayer.hpp"
|
||||
#include "TrackView.hpp"
|
||||
#include "PlayQueue.hpp"
|
||||
|
||||
#include "FilterChain.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Audio : public Wt::WContainerWidget
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Audio(SessionData& sessionData, Wt::WContainerWidget* parent = 0);
|
||||
Audio(Wt::WContainerWidget *parent) : Wt::WContainerWidget(parent) {}
|
||||
virtual ~Audio() {}
|
||||
|
||||
void search(const std::string& searchText);
|
||||
virtual void search(std::string text) = 0;
|
||||
|
||||
private:
|
||||
|
||||
void playlistSaveFromPlayqueue(std::string name);
|
||||
void playlistLoadToPlayqueue(std::string name);
|
||||
void playlistShowSaveNewDialog();
|
||||
void playlistShowSaveDialog(std::string name);
|
||||
void playlistShowDeleteDialog(std::string name);
|
||||
void playlistRefreshMenus();
|
||||
|
||||
void playTrack(boost::filesystem::path p);
|
||||
|
||||
enum PlayQueueAddType
|
||||
{
|
||||
PlayQueueAddAllTracks,
|
||||
PlayQueueAddSelectedTracks,
|
||||
};
|
||||
|
||||
void playSelectedTracks(PlayQueueAddType addType);
|
||||
void addSelectedTracks();
|
||||
|
||||
void handlePlaylistSelected(Wt::WString name);
|
||||
|
||||
Database::Handler& _db;
|
||||
|
||||
AudioMediaPlayer* _mediaPlayer;
|
||||
TrackView* _trackView;
|
||||
PlayQueue* _playQueue;
|
||||
|
||||
FilterChain _filterChain;
|
||||
|
||||
Wt::WPopupMenu* _popupMenuSave;
|
||||
Wt::WPopupMenu* _popupMenuLoad;
|
||||
Wt::WPopupMenu* _popupMenuDelete;
|
||||
};
|
||||
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "AudioMediaPlayer.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
Wt::WMediaPlayer::Encoding
|
||||
AudioMediaPlayer::getEncoding()
|
||||
@@ -224,4 +225,5 @@ AudioMediaPlayer::handleVolumeSliderMoved(int value)
|
||||
_mediaPlayer->setVolume( value / 100. );
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "resource/AvConvTranscodeStreamResource.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class AudioMediaPlayer : public Wt::WContainerWidget
|
||||
{
|
||||
@@ -88,6 +89,7 @@ class AudioMediaPlayer : public Wt::WContainerWidget
|
||||
|
||||
};
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "TableFilter.hpp"
|
||||
#include "KeywordSearchFilter.hpp"
|
||||
|
||||
#include "Audio.hpp"
|
||||
#include "DesktopAudio.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -49,9 +49,10 @@ void WPopupMenuClear(Wt::WPopupMenu* menu)
|
||||
}
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
Audio::Audio(SessionData& sessionData, Wt::WContainerWidget* parent)
|
||||
: Wt::WContainerWidget(parent),
|
||||
: UserInterface::Audio(parent),
|
||||
_db(sessionData.getDatabaseHandler()),
|
||||
_mediaPlayer(nullptr),
|
||||
_trackView(nullptr),
|
||||
@@ -418,7 +419,7 @@ Audio::playlistRefreshMenus()
|
||||
}
|
||||
|
||||
void
|
||||
Audio::search(const std::string& searchText)
|
||||
Audio::search(std::string searchText)
|
||||
{
|
||||
_filterChain.searchKeyword(searchText);
|
||||
}
|
||||
@@ -525,6 +526,6 @@ Audio::playTrack(boost::filesystem::path p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UI_AUDIO_DESKTOP_HPP
|
||||
#define UI_AUDIO_DESKTOP_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <Wt/WPopupMenu>
|
||||
|
||||
#include "common/SessionData.hpp"
|
||||
|
||||
#include "AudioMediaPlayer.hpp"
|
||||
#include "TrackView.hpp"
|
||||
#include "PlayQueue.hpp"
|
||||
|
||||
#include "FilterChain.hpp"
|
||||
|
||||
#include "audio/Audio.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class Audio : public UserInterface::Audio
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Audio(SessionData& sessionData, Wt::WContainerWidget* parent = 0);
|
||||
|
||||
void search(std::string searchText);
|
||||
|
||||
private:
|
||||
|
||||
void playlistSaveFromPlayqueue(std::string name);
|
||||
void playlistLoadToPlayqueue(std::string name);
|
||||
void playlistShowSaveNewDialog();
|
||||
void playlistShowSaveDialog(std::string name);
|
||||
void playlistShowDeleteDialog(std::string name);
|
||||
void playlistRefreshMenus();
|
||||
|
||||
void playTrack(boost::filesystem::path p);
|
||||
|
||||
enum PlayQueueAddType
|
||||
{
|
||||
PlayQueueAddAllTracks,
|
||||
PlayQueueAddSelectedTracks,
|
||||
};
|
||||
|
||||
void playSelectedTracks(PlayQueueAddType addType);
|
||||
void addSelectedTracks();
|
||||
|
||||
void handlePlaylistSelected(Wt::WString name);
|
||||
|
||||
Database::Handler& _db;
|
||||
|
||||
AudioMediaPlayer* _mediaPlayer;
|
||||
TrackView* _trackView;
|
||||
PlayQueue* _playQueue;
|
||||
|
||||
FilterChain _filterChain;
|
||||
|
||||
Wt::WPopupMenu* _popupMenuSave;
|
||||
Wt::WPopupMenu* _popupMenuLoad;
|
||||
Wt::WPopupMenu* _popupMenuDelete;
|
||||
};
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class Filter
|
||||
{
|
||||
@@ -58,6 +59,7 @@ class Filter
|
||||
Wt::Signal<void> _update;
|
||||
};
|
||||
|
||||
} // namespace Dekstop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "FilterChain.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
|
||||
FilterChain::FilterChain()
|
||||
@@ -69,5 +70,6 @@ FilterChain::updateFilters(std::size_t startIdx)
|
||||
_refreshingFilters = false;
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "KeywordSearchFilter.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
// FilterChain
|
||||
class FilterChain
|
||||
@@ -52,6 +53,7 @@ class FilterChain
|
||||
bool _refreshingFilters;
|
||||
};
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "KeywordSearchFilter.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
KeywordSearchFilter::KeywordSearchFilter()
|
||||
{
|
||||
@@ -60,5 +61,6 @@ KeywordSearchFilter::getConstraint(Database::SearchFilter& filter)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Filter.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class KeywordSearchFilter : public Filter
|
||||
{
|
||||
@@ -46,6 +47,7 @@ class KeywordSearchFilter : public Filter
|
||||
std::string _lastEmittedText;
|
||||
};
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -58,6 +58,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
enum ColumnId
|
||||
{
|
||||
@@ -610,5 +611,6 @@ PlayQueue::getTracks(std::vector<Database::Track::id_type>& trackIds) const
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "resource/CoverResource.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class PlayQueueItemDelegate;
|
||||
class TrackSelector;
|
||||
@@ -86,7 +87,7 @@ class PlayQueue : public Wt::WTableView
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "TableFilter.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
using namespace Database;
|
||||
|
||||
@@ -253,5 +254,6 @@ TableFilterRelease::getConstraint(SearchFilter& filter)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class TableFilterGenre : public Wt::WTableView, public Filter
|
||||
{
|
||||
@@ -111,6 +112,7 @@ class TableFilterRelease : public Wt::WTableView, public Filter
|
||||
};
|
||||
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "TrackView.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
TrackView::TrackView( Database::Handler& db, Wt::WContainerWidget* parent)
|
||||
: Wt::WTableView( parent ),
|
||||
@@ -169,5 +170,6 @@ TrackView::getTracks(std::vector<Database::Track::id_type>& trackIds)
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks done!";
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Filter.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Desktop {
|
||||
|
||||
class TrackView : public Wt::WTableView, public Filter
|
||||
{
|
||||
@@ -69,6 +70,7 @@ class TrackView : public Wt::WTableView, public Filter
|
||||
|
||||
};
|
||||
|
||||
} // namespace Desktop
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
#include <Wt/WText>
|
||||
|
||||
#include "MobileAudio.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Mobile {
|
||||
|
||||
Audio::Audio(Wt::WContainerWidget *parent)
|
||||
: UserInterface::Audio(parent)
|
||||
{
|
||||
new Wt::WText("Mobile version not implemented", this);
|
||||
}
|
||||
|
||||
} // namespace Mobile
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UI_AUDIO_MOBILE_HPP
|
||||
#define UI_AUDIO_MOBILE_HPP
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
|
||||
#include "audio/Audio.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
namespace Mobile {
|
||||
|
||||
class Audio : public UserInterface::Audio
|
||||
{
|
||||
public:
|
||||
Audio(Wt::WContainerWidget *parent = 0);
|
||||
|
||||
void search(std::string text) {};
|
||||
|
||||
};
|
||||
|
||||
} // namespace Mobile
|
||||
} // namespace UserInterface
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user