Fix minor code issues
This commit is contained in:
4
3rdparty/singleapplication/CMakeLists.txt
vendored
4
3rdparty/singleapplication/CMakeLists.txt
vendored
@@ -7,6 +7,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.0)
|
if(CMAKE_VERSION VERSION_GREATER 3.0)
|
||||||
check_function_exists(geteuid HAVE_GETEUID)
|
check_function_exists(geteuid HAVE_GETEUID)
|
||||||
check_function_exists(getpwuid HAVE_GETPWUID)
|
check_function_exists(getpwuid HAVE_GETPWUID)
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
include_directories(${GLIB_INCLUDE_DIRS})
|
include_directories(${GLIB_INCLUDE_DIRS})
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define gst_fastspectrum_parent_class parent_class
|
#define gst_fastspectrum_parent_class parent_class
|
||||||
G_DEFINE_TYPE (GstFastSpectrum, gst_fastspectrum, GST_TYPE_AUDIO_FILTER);
|
G_DEFINE_TYPE (GstFastSpectrum, gst_fastspectrum, GST_TYPE_AUDIO_FILTER)
|
||||||
|
|
||||||
static void gst_fastspectrum_finalize (GObject * object);
|
static void gst_fastspectrum_finalize (GObject * object);
|
||||||
static void gst_fastspectrum_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
|
static void gst_fastspectrum_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
@@ -260,6 +260,8 @@ static gboolean gst_fastspectrum_stop (GstBaseTransform * trans) {
|
|||||||
|
|
||||||
static void input_data_mixed_float(const guint8* _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_float(const guint8* _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
|
Q_UNUSED(max_value);
|
||||||
|
|
||||||
guint j, ip = 0;
|
guint j, ip = 0;
|
||||||
gfloat *in = (gfloat *) _in;
|
gfloat *in = (gfloat *) _in;
|
||||||
|
|
||||||
@@ -272,6 +274,8 @@ static void input_data_mixed_float(const guint8* _in, double* out, guint len, do
|
|||||||
|
|
||||||
static void input_data_mixed_double (const guint8 * _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_double (const guint8 * _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
|
Q_UNUSED(max_value);
|
||||||
|
|
||||||
guint j, ip = 0;
|
guint j, ip = 0;
|
||||||
gdouble *in = (gdouble *) _in;
|
gdouble *in = (gdouble *) _in;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
core/closure.cpp
|
core/closure.cpp
|
||||||
core/logging.cpp
|
core/logging.cpp
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ class ClosureBase {
|
|||||||
ObjectHelper *helper_;
|
ObjectHelper *helper_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(ClosureBase);
|
Q_DISABLE_COPY(ClosureBase)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// QObject helper as templated QObjects do not work.
|
// QObject helper as templated QObjects do not work.
|
||||||
@@ -71,7 +72,8 @@ class ObjectHelper : public QObject {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<ClosureBase> closure_;
|
std::unique_ptr<ClosureBase> closure_;
|
||||||
Q_DISABLE_COPY(ObjectHelper);
|
Q_DISABLE_COPY(ObjectHelper)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helpers for unpacking a variadic template list.
|
// Helpers for unpacking a variadic template list.
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ static QtMessageHandler sOriginalMessageHandler = nullptr;
|
|||||||
|
|
||||||
void GLog(const char *domain, int level, const char *message, void *user_data) {
|
void GLog(const char *domain, int level, const char *message, void *user_data) {
|
||||||
|
|
||||||
|
Q_UNUSED(domain);
|
||||||
|
Q_UNUSED(user_data);
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case G_LOG_FLAG_RECURSION:
|
case G_LOG_FLAG_RECURSION:
|
||||||
case G_LOG_FLAG_FATAL:
|
case G_LOG_FLAG_FATAL:
|
||||||
@@ -69,6 +72,8 @@ void GLog(const char *domain, int level, const char *message, void *user_data) {
|
|||||||
|
|
||||||
static void MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) {
|
static void MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) {
|
||||||
|
|
||||||
|
Q_UNUSED(context);
|
||||||
|
|
||||||
if (strncmp(kMessageHandlerMagic, message.toLocal8Bit().data(), kMessageHandlerMagicLength) == 0) {
|
if (strncmp(kMessageHandlerMagic, message.toLocal8Bit().data(), kMessageHandlerMagicLength) == 0) {
|
||||||
fprintf(stderr, "%s\n", message.toLocal8Bit().data() + kMessageHandlerMagicLength);
|
fprintf(stderr, "%s\n", message.toLocal8Bit().data() + kMessageHandlerMagicLength);
|
||||||
return;
|
return;
|
||||||
@@ -90,6 +95,7 @@ static void MessageHandler(QtMsgType type, const QMessageLogContext &context, co
|
|||||||
if (type == QtFatalMsg) {
|
if (type == QtFatalMsg) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when a message is received from the socket.
|
// Called when a message is received from the socket.
|
||||||
virtual void MessageArrived(const MessageType &message) {}
|
virtual void MessageArrived(const MessageType &message) { Q_UNUSED(message); }
|
||||||
|
|
||||||
// _MessageHandlerBase
|
// _MessageHandlerBase
|
||||||
bool RawMessageArrived(const QByteArray &data);
|
bool RawMessageArrived(const QByteArray &data);
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(MESSAGES
|
set(MESSAGES
|
||||||
tagreadermessages.proto
|
tagreadermessages.proto
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -478,6 +478,8 @@ void TagReader::ParseOggTag(const TagLib::Ogg::FieldListMap &map, const QTextCod
|
|||||||
|
|
||||||
void TagReader::ParseAPETag(const TagLib::APE::ItemListMap &map, const QTextCodec *codec, QString *disc, QString *compilation, pb::tagreader::SongMetadata *song) const {
|
void TagReader::ParseAPETag(const TagLib::APE::ItemListMap &map, const QTextCodec *codec, QString *disc, QString *compilation, pb::tagreader::SongMetadata *song) const {
|
||||||
|
|
||||||
|
Q_UNUSED(codec);
|
||||||
|
|
||||||
TagLib::APE::ItemListMap::ConstIterator it = map.find("ALBUM ARTIST");
|
TagLib::APE::ItemListMap::ConstIterator it = map.find("ALBUM ARTIST");
|
||||||
if (it != map.end()) {
|
if (it != map.end()) {
|
||||||
TagLib::StringList album_artists = it->second.toStringList();
|
TagLib::StringList album_artists = it->second.toStringList();
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -U__STRICT_ANSI__ -Wall -Woverloaded-virtual -Wno-sign-compare -fpermissive")
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wimplicit-fallthrough=0 -Wpedantic")
|
||||||
|
endif()
|
||||||
|
|
||||||
option(BUILD_WERROR "Build with -Werror" OFF)
|
option(BUILD_WERROR "Build with -Werror" OFF)
|
||||||
|
|
||||||
if(BUILD_WERROR)
|
if(BUILD_WERROR)
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ void Rainbow::RainbowAnalyzer::timerEvent(QTimerEvent* e) {
|
|||||||
|
|
||||||
void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent* e) {
|
void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent* e) {
|
||||||
|
|
||||||
|
Q_UNUSED(e);
|
||||||
|
|
||||||
// Invalidate the buffer so it's recreated from scratch in the next paint event.
|
// Invalidate the buffer so it's recreated from scratch in the next paint event.
|
||||||
buffer_[0] = QPixmap();
|
buffer_[0] = QPixmap();
|
||||||
buffer_[1] = QPixmap();
|
buffer_[1] = QPixmap();
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ void SCollection::Stopped() {
|
|||||||
|
|
||||||
void SCollection::CurrentSongChanged(const Song &song) { // FIXME
|
void SCollection::CurrentSongChanged(const Song &song) { // FIXME
|
||||||
|
|
||||||
|
Q_UNUSED(song);
|
||||||
|
|
||||||
TagReaderReply *reply = nullptr;
|
TagReaderReply *reply = nullptr;
|
||||||
|
|
||||||
if (reply) {
|
if (reply) {
|
||||||
@@ -177,4 +179,5 @@ void SCollection::CurrentSongChanged(const Song &song) { // FIXME
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SCollection::SongsStatisticsChanged(const SongList &songs) {
|
void SCollection::SongsStatisticsChanged(const SongList &songs) {
|
||||||
|
Q_UNUSED(songs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1222,6 +1222,8 @@ void CollectionBackend::IncrementPlayCount(int id) {
|
|||||||
|
|
||||||
void CollectionBackend::IncrementSkipCount(int id, float progress) {
|
void CollectionBackend::IncrementSkipCount(int id, float progress) {
|
||||||
|
|
||||||
|
Q_UNUSED(progress);
|
||||||
|
|
||||||
if (id == -1) return;
|
if (id == -1) return;
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
|
|||||||
@@ -587,6 +587,8 @@ QVariant CollectionModel::AlbumIcon(const QModelIndex &idx) {
|
|||||||
|
|
||||||
void CollectionModel::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void CollectionModel::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (!pending_art_.contains(id)) return;
|
if (!pending_art_.contains(id)) return;
|
||||||
|
|
||||||
ItemAndCacheKey item_and_cache_key = pending_art_.take(id);
|
ItemAndCacheKey item_and_cache_key = pending_art_.take(id);
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ class CollectionItem;
|
|||||||
|
|
||||||
class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(GroupBy);
|
|
||||||
|
Q_ENUMS(GroupBy)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CollectionModel(CollectionBackend *backend, Application *app, QObject *parent = nullptr);
|
CollectionModel(CollectionBackend *backend, Application *app, QObject *parent = nullptr);
|
||||||
@@ -285,7 +286,7 @@ signals:
|
|||||||
QSet<QString> pending_cache_keys_;
|
QSet<QString> pending_cache_keys_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(CollectionModel::Grouping);
|
Q_DECLARE_METATYPE(CollectionModel::Grouping)
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &s, const CollectionModel::Grouping &g);
|
QDataStream &operator<<(QDataStream &s, const CollectionModel::Grouping &g);
|
||||||
QDataStream &operator>>(QDataStream &s, CollectionModel::Grouping &g);
|
QDataStream &operator>>(QDataStream &s, CollectionModel::Grouping &g);
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ QVariant ContextAlbumsModel::AlbumIcon(const QModelIndex &index) {
|
|||||||
|
|
||||||
void ContextAlbumsModel::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void ContextAlbumsModel::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (!pending_art_.contains(id)) return;
|
if (!pending_art_.contains(id)) return;
|
||||||
|
|
||||||
ItemAndCacheKey item_and_cache_key = pending_art_.take(id);
|
ItemAndCacheKey item_and_cache_key = pending_art_.take(id);
|
||||||
|
|||||||
@@ -535,6 +535,8 @@ void ContextView::handlePaintEvent(QObject *object, QEvent *event) {
|
|||||||
|
|
||||||
void ContextView::PaintEventAlbum(QEvent *event) {
|
void ContextView::PaintEventAlbum(QEvent *event) {
|
||||||
|
|
||||||
|
Q_UNUSED(event);
|
||||||
|
|
||||||
QPainter p(ui_->label_play_album);
|
QPainter p(ui_->label_play_album);
|
||||||
|
|
||||||
DrawImage(&p);
|
DrawImage(&p);
|
||||||
@@ -544,6 +546,7 @@ void ContextView::PaintEventAlbum(QEvent *event) {
|
|||||||
p.setOpacity(pixmap_previous_opacity_);
|
p.setOpacity(pixmap_previous_opacity_);
|
||||||
p.drawPixmap(0, 0, pixmap_previous_);
|
p.drawPixmap(0, 0, pixmap_previous_);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextView::DrawImage(QPainter *p) {
|
void ContextView::DrawImage(QPainter *p) {
|
||||||
@@ -595,6 +598,8 @@ void ContextView::ScaleCover() {
|
|||||||
|
|
||||||
void ContextView::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
void ContextView::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (song != song_playing_ || image == image_original_) return;
|
if (song != song_playing_ || image == image_original_) return;
|
||||||
|
|
||||||
active_ = true;
|
active_ = true;
|
||||||
|
|||||||
@@ -440,6 +440,8 @@ void Database::ExecSongTablesCommands(QSqlDatabase &db, const QStringList &song_
|
|||||||
|
|
||||||
QStringList Database::SongsTables(QSqlDatabase &db, int schema_version) const {
|
QStringList Database::SongsTables(QSqlDatabase &db, int schema_version) const {
|
||||||
|
|
||||||
|
Q_UNUSED(schema_version);
|
||||||
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
|
||||||
// look for the tables in the main db
|
// look for the tables in the main db
|
||||||
|
|||||||
@@ -2069,10 +2069,14 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ForceShowOSD(const Song &song, const bool toggle) {
|
void MainWindow::ForceShowOSD(const Song &song, const bool toggle) {
|
||||||
|
|
||||||
|
Q_UNUSED(song);
|
||||||
|
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
osd_->SetPrettyOSDToggleMode(toggle);
|
osd_->SetPrettyOSDToggleMode(toggle);
|
||||||
}
|
}
|
||||||
osd_->ReshowCurrentSong();
|
osd_->ReshowCurrentSong();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Activate() {
|
void MainWindow::Activate() {
|
||||||
@@ -2385,11 +2389,13 @@ void MainWindow::PlaylistViewSelectionModelChanged() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
|
void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
|
||||||
|
|
||||||
const QModelIndex source_current =app_->playlist_manager()->current()->proxy()->mapToSource(proxy_current);
|
const QModelIndex source_current =app_->playlist_manager()->current()->proxy()->mapToSource(proxy_current);
|
||||||
|
|
||||||
// If the user moves the current index using the keyboard and then presses
|
// If the user moves the current index using the keyboard and then presses
|
||||||
// F2, we don't want that editing the last column that was right clicked on.
|
// F2, we don't want that editing the last column that was right clicked on.
|
||||||
if (source_current != playlist_menu_index_) playlist_menu_index_ = QModelIndex();
|
if (source_current != playlist_menu_index_) playlist_menu_index_ = QModelIndex();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Raise() {
|
void MainWindow::Raise() {
|
||||||
@@ -2399,10 +2405,16 @@ void MainWindow::Raise() {
|
|||||||
|
|
||||||
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) {
|
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) {
|
||||||
|
|
||||||
|
Q_UNUSED(eventType);
|
||||||
|
Q_UNUSED(result);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
MSG *msg = static_cast<MSG*>(message);
|
MSG *msg = static_cast<MSG*>(message);
|
||||||
thumbbar_->HandleWinEvent(msg);
|
thumbbar_->HandleWinEvent(msg);
|
||||||
|
#else
|
||||||
|
Q_UNUSED(message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
using std::unique_ptr;
|
using std::unique_ptr;
|
||||||
|
|
||||||
class About;
|
class About;
|
||||||
class AlbumCoverManager;;
|
class AlbumCoverManager;
|
||||||
class Application;
|
class Application;
|
||||||
class ContextView;
|
class ContextView;
|
||||||
class CollectionViewContainer;
|
class CollectionViewContainer;
|
||||||
|
|||||||
@@ -388,6 +388,8 @@ void Mpris2::CurrentSongChanged(const Song &song) {
|
|||||||
// ... and we add the cover information later, when it's available.
|
// ... and we add the cover information later, when it's available.
|
||||||
void Mpris2::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
void Mpris2::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(image);
|
||||||
|
|
||||||
last_metadata_ = QVariantMap();
|
last_metadata_ = QVariantMap();
|
||||||
song.ToXesam(&last_metadata_);
|
song.ToXesam(&last_metadata_);
|
||||||
|
|
||||||
@@ -502,19 +504,31 @@ TrackIds Mpris2::Tracks() const {
|
|||||||
bool Mpris2::CanEditTracks() const { return false; }
|
bool Mpris2::CanEditTracks() const { return false; }
|
||||||
|
|
||||||
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds &tracks) const {
|
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds &tracks) const {
|
||||||
|
|
||||||
|
Q_UNUSED(tracks);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return TrackMetadata();
|
return TrackMetadata();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::AddTrack(const QString &uri, const QDBusObjectPath &afterTrack, bool setAsCurrent) {
|
void Mpris2::AddTrack(const QString &uri, const QDBusObjectPath &afterTrack, bool setAsCurrent) {
|
||||||
|
|
||||||
|
Q_UNUSED(uri);
|
||||||
|
Q_UNUSED(afterTrack);
|
||||||
|
Q_UNUSED(setAsCurrent);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::RemoveTrack(const QDBusObjectPath &trackId) {
|
void Mpris2::RemoveTrack(const QDBusObjectPath &trackId) {
|
||||||
|
Q_UNUSED(trackId);
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::GoTo(const QDBusObjectPath &trackId) {
|
void Mpris2::GoTo(const QDBusObjectPath &trackId) {
|
||||||
|
Q_UNUSED(trackId);
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,6 +585,8 @@ void Mpris2::ActivatePlaylist(const QDBusObjectPath &playlist_id) {
|
|||||||
// TODO: Support sort orders.
|
// TODO: Support sort orders.
|
||||||
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count, const QString &order, bool reverse_order) {
|
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count, const QString &order, bool reverse_order) {
|
||||||
|
|
||||||
|
Q_UNUSED(order);
|
||||||
|
|
||||||
MprisPlaylistList ret;
|
MprisPlaylistList ret;
|
||||||
for (Playlist *p : app_->playlist_manager()->GetAllPlaylists()) {
|
for (Playlist *p : app_->playlist_manager()->GetAllPlaylists()) {
|
||||||
MprisPlaylist mpris_playlist;
|
MprisPlaylist mpris_playlist;
|
||||||
@@ -597,6 +613,7 @@ void Mpris2::PlaylistChanged(Playlist *playlist) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::PlaylistCollectionChanged(Playlist *playlist) {
|
void Mpris2::PlaylistCollectionChanged(Playlist *playlist) {
|
||||||
|
Q_UNUSED(playlist);
|
||||||
EmitNotification("PlaylistCount", "", "org.mpris.MediaPlayer2.Playlists");
|
EmitNotification("PlaylistCount", "", "org.mpris.MediaPlayer2.Playlists");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Playlist;
|
|||||||
|
|
||||||
typedef QList<QVariantMap> TrackMetadata;
|
typedef QList<QVariantMap> TrackMetadata;
|
||||||
typedef QList<QDBusObjectPath> TrackIds;
|
typedef QList<QDBusObjectPath> TrackIds;
|
||||||
Q_DECLARE_METATYPE(TrackMetadata);
|
Q_DECLARE_METATYPE(TrackMetadata)
|
||||||
|
|
||||||
struct MprisPlaylist {
|
struct MprisPlaylist {
|
||||||
QDBusObjectPath id;
|
QDBusObjectPath id;
|
||||||
@@ -57,14 +57,14 @@ struct MprisPlaylist {
|
|||||||
QString icon; // Uri
|
QString icon; // Uri
|
||||||
};
|
};
|
||||||
typedef QList<MprisPlaylist> MprisPlaylistList;
|
typedef QList<MprisPlaylist> MprisPlaylistList;
|
||||||
Q_DECLARE_METATYPE(MprisPlaylist);
|
Q_DECLARE_METATYPE(MprisPlaylist)
|
||||||
Q_DECLARE_METATYPE(MprisPlaylistList);
|
Q_DECLARE_METATYPE(MprisPlaylistList)
|
||||||
|
|
||||||
struct MaybePlaylist {
|
struct MaybePlaylist {
|
||||||
bool valid;
|
bool valid;
|
||||||
MprisPlaylist playlist;
|
MprisPlaylist playlist;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(MaybePlaylist);
|
Q_DECLARE_METATYPE(MaybePlaylist)
|
||||||
|
|
||||||
QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist);
|
QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist);
|
||||||
const QDBusArgument &operator>> (const QDBusArgument &arg, MprisPlaylist &playlist);
|
const QDBusArgument &operator>> (const QDBusArgument &arg, MprisPlaylist &playlist);
|
||||||
|
|||||||
@@ -76,21 +76,21 @@ class MusicStorage {
|
|||||||
|
|
||||||
virtual TranscodeMode GetTranscodeMode() const { return Transcode_Never; }
|
virtual TranscodeMode GetTranscodeMode() const { return Transcode_Never; }
|
||||||
virtual Song::FileType GetTranscodeFormat() const { return Song::FileType_Unknown; }
|
virtual Song::FileType GetTranscodeFormat() const { return Song::FileType_Unknown; }
|
||||||
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) { return true; }
|
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) { Q_UNUSED(ret); return true; }
|
||||||
|
|
||||||
virtual bool StartCopy(QList<Song::FileType>* supported_types) { return true;}
|
virtual bool StartCopy(QList<Song::FileType>* supported_types) { Q_UNUSED(supported_types); return true; }
|
||||||
virtual bool CopyToStorage(const CopyJob& job) = 0;
|
virtual bool CopyToStorage(const CopyJob& job) = 0;
|
||||||
virtual void FinishCopy(bool success) {}
|
virtual void FinishCopy(bool success) { Q_UNUSED(success); }
|
||||||
|
|
||||||
virtual void StartDelete() {}
|
virtual void StartDelete() {}
|
||||||
virtual bool DeleteFromStorage(const DeleteJob& job) = 0;
|
virtual bool DeleteFromStorage(const DeleteJob& job) = 0;
|
||||||
virtual void FinishDelete(bool success) {}
|
virtual void FinishDelete(bool success) { Q_UNUSED(success); }
|
||||||
|
|
||||||
virtual void Eject() {}
|
virtual void Eject() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(MusicStorage*);
|
Q_DECLARE_METATYPE(MusicStorage*)
|
||||||
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
|
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>)
|
||||||
|
|
||||||
#endif // MUSICSTORAGE_H
|
#endif // MUSICSTORAGE_H
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
class PoTranslator : public QTranslator {
|
class PoTranslator : public QTranslator {
|
||||||
public:
|
public:
|
||||||
QString translate(const char *context, const char *source_text, const char *disambiguation = 0, int n = -1) const {
|
QString translate(const char *context, const char *source_text, const char *disambiguation = 0, int n = -1) const {
|
||||||
|
Q_UNUSED(n);
|
||||||
QString ret = QTranslator::translate(context, source_text, disambiguation);
|
QString ret = QTranslator::translate(context, source_text, disambiguation);
|
||||||
if (!ret.isEmpty()) return ret;
|
if (!ret.isEmpty()) return ret;
|
||||||
return QTranslator::translate(nullptr, source_text, disambiguation);
|
return QTranslator::translate(nullptr, source_text, disambiguation);
|
||||||
|
|||||||
@@ -362,10 +362,10 @@ class Song {
|
|||||||
|
|
||||||
QSharedDataPointer<Private> d;
|
QSharedDataPointer<Private> d;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(Song);
|
Q_DECLARE_METATYPE(Song)
|
||||||
|
|
||||||
typedef QList<Song> SongList;
|
typedef QList<Song> SongList;
|
||||||
Q_DECLARE_METATYPE(QList<Song>);
|
Q_DECLARE_METATYPE(QList<Song>)
|
||||||
|
|
||||||
uint qHash(const Song &song);
|
uint qHash(const Song &song);
|
||||||
// Hash function using field checked in IsSimilar function
|
// Hash function using field checked in IsSimilar function
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ void StandardItemIconLoader::ModelReset() {
|
|||||||
|
|
||||||
void StandardItemIconLoader::ImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void StandardItemIconLoader::ImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
QStandardItem *item = pending_covers_.take(id);
|
QStandardItem *item = pending_covers_.take(id);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ SystemTrayIcon::SystemTrayIcon(QObject *parent)
|
|||||||
|
|
||||||
QPixmap SystemTrayIcon::CreateIcon(const QPixmap &icon, const QPixmap &grey_icon) {
|
QPixmap SystemTrayIcon::CreateIcon(const QPixmap &icon, const QPixmap &grey_icon) {
|
||||||
|
|
||||||
|
Q_UNUSED(grey_icon);
|
||||||
|
|
||||||
QRect rect(icon.rect());
|
QRect rect(icon.rect());
|
||||||
|
|
||||||
// The angle of the line that's used to cover the icon.
|
// The angle of the line that's used to cover the icon.
|
||||||
@@ -97,8 +99,12 @@ void SystemTrayIcon::SetPaused() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SystemTrayIcon::SetPlaying(bool enable_play_pause) {
|
void SystemTrayIcon::SetPlaying(bool enable_play_pause) {
|
||||||
|
|
||||||
|
Q_UNUSED(enable_play_pause);
|
||||||
|
|
||||||
current_state_icon_ = playing_icon_;
|
current_state_icon_ = playing_icon_;
|
||||||
UpdateIcon();
|
UpdateIcon();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTrayIcon::SetStopped() {
|
void SystemTrayIcon::SetStopped() {
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ class SystemTrayIcon : public QObject {
|
|||||||
virtual void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *love, QAction *quit) = 0;
|
virtual void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *love, QAction *quit) = 0;
|
||||||
|
|
||||||
virtual bool IsVisible() const { return true; }
|
virtual bool IsVisible() const { return true; }
|
||||||
virtual void SetVisible(bool visible) {}
|
virtual void SetVisible(bool visible) { Q_UNUSED(visible); }
|
||||||
|
|
||||||
// Called by the OSD
|
// Called by the OSD
|
||||||
virtual void ShowPopup(const QString &summary, const QString &message, int timeout) {}
|
virtual void ShowPopup(const QString &summary, const QString &message, int timeout) { Q_UNUSED(summary); Q_UNUSED(message); Q_UNUSED(timeout); }
|
||||||
// If this gets invoked with image_path equal to nullptr, the tooltip should still be shown - just without the cover art.
|
// If this gets invoked with image_path equal to nullptr, the tooltip should still be shown - just without the cover art.
|
||||||
virtual void SetNowPlaying(const Song &song, const QUrl &cover_url) {}
|
virtual void SetNowPlaying(const Song &song, const QUrl &cover_url) { Q_UNUSED(song); Q_UNUSED(cover_url); }
|
||||||
virtual void ClearNowPlaying() {}
|
virtual void ClearNowPlaying() {}
|
||||||
|
|
||||||
virtual bool MuteEnabled() { return false; }
|
virtual bool MuteEnabled() { return false; }
|
||||||
virtual void SetMuteEnabled(bool enabled) {}
|
virtual void SetMuteEnabled(bool enabled) { Q_UNUSED(enabled); }
|
||||||
|
|
||||||
static SystemTrayIcon *CreateSystemTrayIcon(QObject *parent = nullptr);
|
static SystemTrayIcon *CreateSystemTrayIcon(QObject *parent = nullptr);
|
||||||
|
|
||||||
@@ -60,9 +60,9 @@ class SystemTrayIcon : public QObject {
|
|||||||
virtual void SetPaused();
|
virtual void SetPaused();
|
||||||
virtual void SetPlaying(bool enable_play_pause = false);
|
virtual void SetPlaying(bool enable_play_pause = false);
|
||||||
virtual void SetStopped();
|
virtual void SetStopped();
|
||||||
virtual void LoveVisibilityChanged(bool value) {}
|
virtual void LoveVisibilityChanged(bool value) { Q_UNUSED(value); }
|
||||||
virtual void LoveStateChanged(bool value) {}
|
virtual void LoveStateChanged(bool value) { Q_UNUSED(value); }
|
||||||
virtual void MuteButtonStateChanged(bool value) {}
|
virtual void MuteButtonStateChanged(bool value) { Q_UNUSED(value); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ChangeVolume(int delta);
|
void ChangeVolume(int delta);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class TaskManager : public QObject {
|
|||||||
const int task_id_;
|
const int task_id_;
|
||||||
TaskManager *task_manager_;
|
TaskManager *task_manager_;
|
||||||
|
|
||||||
Q_DISABLE_COPY(ScopedTask);
|
Q_DISABLE_COPY(ScopedTask)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Everything here is thread safe
|
// Everything here is thread safe
|
||||||
@@ -80,7 +80,7 @@ signals:
|
|||||||
QMap<int, Task> tasks_;
|
QMap<int, Task> tasks_;
|
||||||
int next_task_id_;
|
int next_task_id_;
|
||||||
|
|
||||||
Q_DISABLE_COPY(TaskManager);
|
Q_DISABLE_COPY(TaskManager)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TASKMANAGER_H
|
#endif // TASKMANAGER_H
|
||||||
|
|||||||
@@ -791,20 +791,26 @@ QString UnicodeToAscii(const QString &unicode) {
|
|||||||
if (conv == (iconv_t) -1) return QString();
|
if (conv == (iconv_t) -1) return QString();
|
||||||
|
|
||||||
QByteArray utf8 = unicode.toUtf8();
|
QByteArray utf8 = unicode.toUtf8();
|
||||||
|
|
||||||
size_t input_len = utf8.length() + 1;
|
size_t input_len = utf8.length() + 1;
|
||||||
char input[input_len];
|
char *input = new char[input_len];
|
||||||
|
char *input_ptr = input;
|
||||||
|
|
||||||
|
size_t output_len = input_len*2;
|
||||||
|
char *output = new char[output_len];
|
||||||
|
char *output_ptr = output;
|
||||||
|
|
||||||
snprintf(input, input_len, "%s", utf8.constData());
|
snprintf(input, input_len, "%s", utf8.constData());
|
||||||
|
|
||||||
char output[input_len*2];
|
iconv(conv, &input, &input_len, &output, &output_len);
|
||||||
size_t output_len = sizeof(output);
|
|
||||||
|
|
||||||
char *input_ptr = input;
|
|
||||||
char *output_ptr = output;
|
|
||||||
iconv(conv, &input_ptr, &input_len, &output_ptr, &output_len);
|
|
||||||
iconv_close(conv);
|
iconv_close(conv);
|
||||||
|
|
||||||
return QString(output);
|
QString ret(output_ptr);
|
||||||
|
|
||||||
|
delete[] input_ptr;
|
||||||
|
delete[] output_ptr;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class ScopedWCharArray {
|
|||||||
int bytes() const { return (chars_ + 1) *sizeof(wchar_t); }
|
int bytes() const { return (chars_ + 1) *sizeof(wchar_t); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(ScopedWCharArray);
|
Q_DISABLE_COPY(ScopedWCharArray)
|
||||||
|
|
||||||
int chars_;
|
int chars_;
|
||||||
std::unique_ptr<wchar_t[]> data_;
|
std::unique_ptr<wchar_t[]> data_;
|
||||||
|
|||||||
@@ -318,6 +318,8 @@ void AlbumCoverChoiceController::SearchCoverAutomatically(const Song &song) {
|
|||||||
|
|
||||||
void AlbumCoverChoiceController::AlbumCoverFetched(const quint64 id, const QUrl &cover_url, const QImage &image, const CoverSearchStatistics &statistics) {
|
void AlbumCoverChoiceController::AlbumCoverFetched(const quint64 id, const QUrl &cover_url, const QImage &image, const CoverSearchStatistics &statistics) {
|
||||||
|
|
||||||
|
Q_UNUSED(statistics);
|
||||||
|
|
||||||
Song song;
|
Song song;
|
||||||
if (cover_fetching_tasks_.contains(id)) {
|
if (cover_fetching_tasks_.contains(id)) {
|
||||||
song = cover_fetching_tasks_.take(id);
|
song = cover_fetching_tasks_.take(id);
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ struct CoverSearchResult {
|
|||||||
float score;
|
float score;
|
||||||
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(CoverSearchResult);
|
Q_DECLARE_METATYPE(CoverSearchResult)
|
||||||
|
|
||||||
// This is a complete result of a single search request (a list of results, each describing one image, actually).
|
// This is a complete result of a single search request (a list of results, each describing one image, actually).
|
||||||
typedef QList<CoverSearchResult> CoverSearchResults;
|
typedef QList<CoverSearchResult> CoverSearchResults;
|
||||||
Q_DECLARE_METATYPE(QList<CoverSearchResult>);
|
Q_DECLARE_METATYPE(QList<CoverSearchResult>)
|
||||||
|
|
||||||
// This class searches for album covers for a given query or artist/album and returns URLs. It's NOT thread-safe.
|
// This class searches for album covers for a given query or artist/album and returns URLs. It's NOT thread-safe.
|
||||||
class AlbumCoverFetcher : public QObject {
|
class AlbumCoverFetcher : public QObject {
|
||||||
|
|||||||
@@ -359,6 +359,8 @@ void AlbumCoverManager::ArtistChanged(QListWidgetItem *current) {
|
|||||||
|
|
||||||
void AlbumCoverManager::CoverImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void AlbumCoverManager::CoverImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (!cover_loading_tasks_.contains(id)) return;
|
if (!cover_loading_tasks_.contains(id)) return;
|
||||||
|
|
||||||
QListWidgetItem *item = cover_loading_tasks_.take(id);
|
QListWidgetItem *item = cover_loading_tasks_.take(id);
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ void AlbumCoverSearcher::SearchFinished(const quint64 id, const CoverSearchResul
|
|||||||
|
|
||||||
void AlbumCoverSearcher::ImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void AlbumCoverSearcher::ImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (!cover_loading_tasks_.contains(id)) return;
|
if (!cover_loading_tasks_.contains(id)) return;
|
||||||
QStandardItem *item = cover_loading_tasks_.take(id);
|
QStandardItem *item = cover_loading_tasks_.take(id);
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class CoverProvider : public QObject {
|
|||||||
// The provider should remember the ID and emit it along with the result when it finishes.
|
// The provider should remember the ID and emit it along with the result when it finishes.
|
||||||
virtual bool StartSearch(const QString &artist, const QString &album, int id) = 0;
|
virtual bool StartSearch(const QString &artist, const QString &album, int id) = 0;
|
||||||
|
|
||||||
virtual void CancelSearch(int id) {}
|
virtual void CancelSearch(int id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SearchFinished(int id, const CoverSearchResults& results);
|
void SearchFinished(int id, const CoverSearchResults& results);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class CoverProviders : public QObject {
|
|||||||
void ProviderDestroyed();
|
void ProviderDestroyed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(CoverProviders);
|
Q_DISABLE_COPY(CoverProviders)
|
||||||
|
|
||||||
QMap<CoverProvider*, QString> cover_providers_;
|
QMap<CoverProvider*, QString> cover_providers_;
|
||||||
QMutex mutex_;
|
QMutex mutex_;
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ void CurrentAlbumCoverLoader::LoadAlbumCover(const Song &song) {
|
|||||||
|
|
||||||
void CurrentAlbumCoverLoader::TempAlbumCoverLoaded(const quint64 id, const QUrl &remote_url, const QImage &image) {
|
void CurrentAlbumCoverLoader::TempAlbumCoverLoaded(const quint64 id, const QUrl &remote_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(remote_url);
|
||||||
|
|
||||||
if (id != id_) return;
|
if (id != id_) return;
|
||||||
id_ = 0;
|
id_ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const int DeezerCoverProvider::kLimit = 10;
|
|||||||
|
|
||||||
DeezerCoverProvider::DeezerCoverProvider(Application *app, QObject *parent): CoverProvider("Deezer", 2.0, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
DeezerCoverProvider::DeezerCoverProvider(Application *app, QObject *parent): CoverProvider("Deezer", 2.0, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
||||||
|
|
||||||
bool DeezerCoverProvider::StartSearch(const QString &artist, const QString &album, int id) {
|
bool DeezerCoverProvider::StartSearch(const QString &artist, const QString &album, const int id) {
|
||||||
|
|
||||||
typedef QPair<QString, QString> Param;
|
typedef QPair<QString, QString> Param;
|
||||||
typedef QList<Param> Params;
|
typedef QList<Param> Params;
|
||||||
@@ -80,7 +80,7 @@ bool DeezerCoverProvider::StartSearch(const QString &artist, const QString &albu
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeezerCoverProvider::CancelSearch(int id) {}
|
void DeezerCoverProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
QByteArray DeezerCoverProvider::GetReplyData(QNetworkReply *reply) {
|
QByteArray DeezerCoverProvider::GetReplyData(QNetworkReply *reply) {
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ QByteArray DeezerCoverProvider::GetReplyData(QNetworkReply *reply) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject DeezerCoverProvider::ExtractJsonObj(QByteArray &data) {
|
QJsonObject DeezerCoverProvider::ExtractJsonObj(const QByteArray &data) {
|
||||||
|
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
|
QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
|
||||||
@@ -161,7 +161,7 @@ QJsonObject DeezerCoverProvider::ExtractJsonObj(QByteArray &data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonValue DeezerCoverProvider::ExtractData(QByteArray &data) {
|
QJsonValue DeezerCoverProvider::ExtractData(const QByteArray &data) {
|
||||||
|
|
||||||
QJsonObject json_obj = ExtractJsonObj(data);
|
QJsonObject json_obj = ExtractJsonObj(data);
|
||||||
if (json_obj.isEmpty()) return QJsonObject();
|
if (json_obj.isEmpty()) return QJsonObject();
|
||||||
@@ -193,7 +193,7 @@ QJsonValue DeezerCoverProvider::ExtractData(QByteArray &data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, int id) {
|
void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, int id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeezerCoverProvider::Error(QString error, QVariant debug) {
|
void DeezerCoverProvider::Error(const QString &error, const QVariant &debug) {
|
||||||
qLog(Error) << "Deezer:" << error;
|
qLog(Error) << "Deezer:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,20 +43,20 @@ class DeezerCoverProvider : public CoverProvider {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DeezerCoverProvider(Application *app, QObject *parent = nullptr);
|
explicit DeezerCoverProvider(Application *app, QObject *parent = nullptr);
|
||||||
bool StartSearch(const QString &artist, const QString &album, int id);
|
bool StartSearch(const QString &artist, const QString &album, const int id);
|
||||||
void CancelSearch(int id);
|
void CancelSearch(const int id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, int id);
|
void HandleSearchReply(QNetworkReply *reply, const int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char *kApiUrl;
|
static const char *kApiUrl;
|
||||||
static const int kLimit;
|
static const int kLimit;
|
||||||
|
|
||||||
QByteArray GetReplyData(QNetworkReply *reply);
|
QByteArray GetReplyData(QNetworkReply *reply);
|
||||||
QJsonObject ExtractJsonObj(QByteArray &data);
|
QJsonObject ExtractJsonObj(const QByteArray &data);
|
||||||
QJsonValue ExtractData(QByteArray &data);
|
QJsonValue ExtractData(const QByteArray &data);
|
||||||
void Error(QString error, QVariant debug = QVariant());
|
void Error(const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
QNetworkAccessManager *network_;
|
QNetworkAccessManager *network_;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const char *DiscogsCoverProvider::kSecretKeyB64 = "ZkFIcmlaSER4aHhRSlF2U3d0bm5ZV
|
|||||||
|
|
||||||
DiscogsCoverProvider::DiscogsCoverProvider(Application *app, QObject *parent) : CoverProvider("Discogs", 0.0, false, app, parent), network_(new NetworkAccessManager(this)) {}
|
DiscogsCoverProvider::DiscogsCoverProvider(Application *app, QObject *parent) : CoverProvider("Discogs", 0.0, false, app, parent), network_(new NetworkAccessManager(this)) {}
|
||||||
|
|
||||||
bool DiscogsCoverProvider::StartSearch(const QString &artist, const QString &album, int s_id) {
|
bool DiscogsCoverProvider::StartSearch(const QString &artist, const QString &album, const int s_id) {
|
||||||
|
|
||||||
DiscogsCoverSearchContext *s_ctx = new DiscogsCoverSearchContext;
|
DiscogsCoverSearchContext *s_ctx = new DiscogsCoverSearchContext;
|
||||||
|
|
||||||
@@ -71,12 +71,12 @@ bool DiscogsCoverProvider::StartSearch(const QString &artist, const QString &alb
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscogsCoverProvider::CancelSearch(int id) {
|
void DiscogsCoverProvider::CancelSearch(const int id) {
|
||||||
delete requests_search_.take(id);
|
delete requests_search_.take(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DiscogsCoverProvider::StartRelease(DiscogsCoverSearchContext *s_ctx, int r_id, QString &resource_url) {
|
bool DiscogsCoverProvider::StartRelease(DiscogsCoverSearchContext *s_ctx, const int r_id, const QString &resource_url) {
|
||||||
|
|
||||||
DiscogsCoverReleaseContext *r_ctx = new DiscogsCoverReleaseContext;
|
DiscogsCoverReleaseContext *r_ctx = new DiscogsCoverReleaseContext;
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ QJsonObject DiscogsCoverProvider::ExtractJsonObj(const QByteArray &data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonValue DiscogsCoverProvider::ExtractData(const QByteArray &data, const QString name, const bool silent) {
|
QJsonValue DiscogsCoverProvider::ExtractData(const QByteArray &data, const QString &name, const bool silent) {
|
||||||
|
|
||||||
QJsonObject json_obj = ExtractJsonObj(data);
|
QJsonObject json_obj = ExtractJsonObj(data);
|
||||||
if (json_obj.isEmpty()) return QJsonObject();
|
if (json_obj.isEmpty()) return QJsonObject();
|
||||||
@@ -323,7 +323,7 @@ void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, int s_id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, int s_id, int r_id) {
|
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int s_id, const int r_id) {
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ void DiscogsCoverProvider::EndSearch(DiscogsCoverReleaseContext *r_ctx) {
|
|||||||
delete requests_release_.take(r_ctx->id);
|
delete requests_release_.take(r_ctx->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscogsCoverProvider::Error(QString error, QVariant debug) {
|
void DiscogsCoverProvider::Error(const QString &error, const QVariant &debug) {
|
||||||
qLog(Error) << "Discogs:" << error;
|
qLog(Error) << "Discogs:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,13 +71,13 @@ class DiscogsCoverProvider : public CoverProvider {
|
|||||||
public:
|
public:
|
||||||
explicit DiscogsCoverProvider(Application *app, QObject *parent = nullptr);
|
explicit DiscogsCoverProvider(Application *app, QObject *parent = nullptr);
|
||||||
|
|
||||||
bool StartSearch(const QString &artist, const QString &album, int s_id);
|
bool StartSearch(const QString &artist, const QString &album, const int s_id);
|
||||||
|
|
||||||
void CancelSearch(int id);
|
void CancelSearch(const int id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, int s_id);
|
void HandleSearchReply(QNetworkReply *reply, const int s_id);
|
||||||
void HandleReleaseReply(QNetworkReply *reply, int s_id, int r_id);
|
void HandleReleaseReply(QNetworkReply *reply, const int s_id, const int r_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char *kUrlSearch;
|
static const char *kUrlSearch;
|
||||||
@@ -89,17 +89,17 @@ class DiscogsCoverProvider : public CoverProvider {
|
|||||||
QHash<int, DiscogsCoverSearchContext*> requests_search_;
|
QHash<int, DiscogsCoverSearchContext*> requests_search_;
|
||||||
QHash<int, DiscogsCoverReleaseContext*> requests_release_;
|
QHash<int, DiscogsCoverReleaseContext*> requests_release_;
|
||||||
|
|
||||||
bool StartRelease(DiscogsCoverSearchContext *s_ctx, int r_id, QString &resource_url);
|
bool StartRelease(DiscogsCoverSearchContext *s_ctx, const int r_id, const QString &resource_url);
|
||||||
|
|
||||||
void SendSearchRequest(DiscogsCoverSearchContext *s_ctx);
|
void SendSearchRequest(DiscogsCoverSearchContext *s_ctx);
|
||||||
void SendReleaseRequest(DiscogsCoverSearchContext *s_ctx, DiscogsCoverReleaseContext *r_ctx);
|
void SendReleaseRequest(DiscogsCoverSearchContext *s_ctx, DiscogsCoverReleaseContext *r_ctx);
|
||||||
QByteArray GetReplyData(QNetworkReply *reply);
|
QByteArray GetReplyData(QNetworkReply *reply);
|
||||||
QJsonObject ExtractJsonObj(const QByteArray &data);
|
QJsonObject ExtractJsonObj(const QByteArray &data);
|
||||||
QJsonValue ExtractData(const QByteArray &data, const QString name, const bool silent = false);
|
QJsonValue ExtractData(const QByteArray &data, const QString &name, const bool silent = false);
|
||||||
void EndSearch(DiscogsCoverSearchContext *s_ctx, DiscogsCoverReleaseContext *r_ctx);
|
void EndSearch(DiscogsCoverSearchContext *s_ctx, DiscogsCoverReleaseContext *r_ctx);
|
||||||
void EndSearch(DiscogsCoverSearchContext *s_ctx);
|
void EndSearch(DiscogsCoverSearchContext *s_ctx);
|
||||||
void EndSearch(DiscogsCoverReleaseContext *r_ctx);
|
void EndSearch(DiscogsCoverReleaseContext *r_ctx);
|
||||||
void Error(QString error, QVariant debug = QVariant());
|
void Error(const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const char *LastFmCoverProvider::kSecret = "80fd738f49596e9709b1bf9319c444a8";
|
|||||||
|
|
||||||
LastFmCoverProvider::LastFmCoverProvider(Application *app, QObject *parent) : CoverProvider("last.fm", 1.0, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
LastFmCoverProvider::LastFmCoverProvider(Application *app, QObject *parent) : CoverProvider("last.fm", 1.0, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
||||||
|
|
||||||
bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &album, int id) {
|
bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &album, const int id) {
|
||||||
|
|
||||||
typedef QPair<QString, QString> Param;
|
typedef QPair<QString, QString> Param;
|
||||||
typedef QPair<QByteArray, QByteArray> EncodedParam;
|
typedef QPair<QByteArray, QByteArray> EncodedParam;
|
||||||
@@ -90,7 +90,7 @@ bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &albu
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, int id) {
|
void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id) {
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
@@ -290,12 +290,12 @@ QJsonValue LastFmCoverProvider::ExtractResults(const QByteArray &data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastFmCoverProvider::Error(QString error, QVariant debug) {
|
void LastFmCoverProvider::Error(const QString &error, const QVariant &debug) {
|
||||||
qLog(Error) << "LastFm:" << error;
|
qLog(Error) << "LastFm:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
LastFmCoverProvider::LastFmImageSize LastFmCoverProvider::ImageSizeFromString(const QString size) {
|
LastFmCoverProvider::LastFmImageSize LastFmCoverProvider::ImageSizeFromString(const QString &size) {
|
||||||
if (size == "small") return LastFmImageSize::Small;
|
if (size == "small") return LastFmImageSize::Small;
|
||||||
else if (size == "medium") return LastFmImageSize::Medium;
|
else if (size == "medium") return LastFmImageSize::Medium;
|
||||||
else if (size == "large") return LastFmImageSize::Large;
|
else if (size == "large") return LastFmImageSize::Large;
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ class LastFmCoverProvider : public CoverProvider {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LastFmCoverProvider(Application *app, QObject *parent = nullptr);
|
explicit LastFmCoverProvider(Application *app, QObject *parent = nullptr);
|
||||||
bool StartSearch(const QString &artist, const QString &album, int id);
|
bool StartSearch(const QString &artist, const QString &album, const int id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void QueryFinished(QNetworkReply *reply, int id);
|
void QueryFinished(QNetworkReply *reply, const int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char *kUrl;
|
static const char *kUrl;
|
||||||
@@ -62,12 +62,11 @@ class LastFmCoverProvider : public CoverProvider {
|
|||||||
QByteArray GetReplyData(QNetworkReply *reply);
|
QByteArray GetReplyData(QNetworkReply *reply);
|
||||||
QJsonObject ExtractJsonObj(const QByteArray &data);
|
QJsonObject ExtractJsonObj(const QByteArray &data);
|
||||||
QJsonValue ExtractResults(const QByteArray &data);
|
QJsonValue ExtractResults(const QByteArray &data);
|
||||||
LastFmImageSize ImageSizeFromString(const QString size);
|
LastFmImageSize ImageSizeFromString(const QString &size);
|
||||||
void Error(QString error, QVariant debug = QVariant());
|
void Error(const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
QNetworkAccessManager *network_;
|
QNetworkAccessManager *network_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LASTFMCOVERPROVIDER_H
|
#endif // LASTFMCOVERPROVIDER_H
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const int MusicbrainzCoverProvider::kLimit = 8;
|
|||||||
|
|
||||||
MusicbrainzCoverProvider::MusicbrainzCoverProvider(Application *app, QObject *parent): CoverProvider("MusicBrainz", 1.5, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
MusicbrainzCoverProvider::MusicbrainzCoverProvider(Application *app, QObject *parent): CoverProvider("MusicBrainz", 1.5, true, app, parent), network_(new NetworkAccessManager(this)) {}
|
||||||
|
|
||||||
bool MusicbrainzCoverProvider::StartSearch(const QString &artist, const QString &album, int id) {
|
bool MusicbrainzCoverProvider::StartSearch(const QString &artist, const QString &album, const int id) {
|
||||||
|
|
||||||
QString query = QString("release:\"%1\" AND artist:\"%2\"").arg(album.trimmed().replace('"', "\\\"")).arg(artist.trimmed().replace('"', "\\\""));
|
QString query = QString("release:\"%1\" AND artist:\"%2\"").arg(album.trimmed().replace('"', "\\\"")).arg(artist.trimmed().replace('"', "\\\""));
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ bool MusicbrainzCoverProvider::StartSearch(const QString &artist, const QString
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MusicbrainzCoverProvider::CancelSearch(int id) {}
|
void MusicbrainzCoverProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, int search_id) {
|
void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int search_id) {
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ class MusicbrainzCoverProvider : public CoverProvider {
|
|||||||
public:
|
public:
|
||||||
explicit MusicbrainzCoverProvider(Application *app, QObject *parent = nullptr);
|
explicit MusicbrainzCoverProvider(Application *app, QObject *parent = nullptr);
|
||||||
|
|
||||||
bool StartSearch(const QString &artist, const QString &album, int id);
|
bool StartSearch(const QString &artist, const QString &album, const int id);
|
||||||
void CancelSearch(int id);
|
void CancelSearch(const int id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, int search_id);
|
void HandleSearchReply(QNetworkReply *reply, const int search_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray GetReplyData(QNetworkReply *reply);
|
QByteArray GetReplyData(QNetworkReply *reply);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ bool TidalCoverProvider::StartSearch(const QString &artist, const QString &album
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TidalCoverProvider::CancelSearch(int id) {}
|
void TidalCoverProvider::CancelSearch(int id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
QNetworkReply *TidalCoverProvider::CreateRequest(const QString &ressource_name, const ParamList ¶ms_supplied) {
|
QNetworkReply *TidalCoverProvider::CreateRequest(const QString &ressource_name, const ParamList ¶ms_supplied) {
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ class DeviceLister : public QObject {
|
|||||||
virtual quint64 DeviceCapacity(const QString &id) = 0;
|
virtual quint64 DeviceCapacity(const QString &id) = 0;
|
||||||
virtual quint64 DeviceFreeSpace(const QString &id) = 0;
|
virtual quint64 DeviceFreeSpace(const QString &id) = 0;
|
||||||
virtual QVariantMap DeviceHardwareInfo(const QString &id) = 0;
|
virtual QVariantMap DeviceHardwareInfo(const QString &id) = 0;
|
||||||
virtual bool DeviceNeedsMount(const QString &id) { return false; }
|
virtual bool DeviceNeedsMount(const QString &id) { Q_UNUSED(id); return false; }
|
||||||
|
|
||||||
// When connecting to a device for the first time, do we want an user's confirmation for scanning it? (by default yes)
|
// When connecting to a device for the first time, do we want an user's confirmation for scanning it? (by default yes)
|
||||||
virtual bool AskForScan(const QString&) const { return true; }
|
virtual bool AskForScan(const QString &id) const { Q_UNUSED(id); return true; }
|
||||||
|
|
||||||
virtual QString MakeFriendlyName(const QString &id) = 0;
|
virtual QString MakeFriendlyName(const QString &id) = 0;
|
||||||
virtual QList<QUrl> MakeDeviceUrls(const QString &id) = 0;
|
virtual QList<QUrl> MakeDeviceUrls(const QString &id) = 0;
|
||||||
@@ -74,7 +74,7 @@ class DeviceLister : public QObject {
|
|||||||
virtual void UpdateDeviceFreeSpace(const QString &id) = 0;
|
virtual void UpdateDeviceFreeSpace(const QString &id) = 0;
|
||||||
virtual void ShutDown() {}
|
virtual void ShutDown() {}
|
||||||
virtual void MountDevice(const QString &id, const int ret);
|
virtual void MountDevice(const QString &id, const int ret);
|
||||||
virtual void UnmountDevice(const QString &id) {}
|
virtual void UnmountDevice(const QString &id) { Q_UNUSED(id); }
|
||||||
virtual void Exit();
|
virtual void Exit();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -757,6 +757,8 @@ DeviceLister *DeviceManager::GetLister(QModelIndex idx) const {
|
|||||||
|
|
||||||
void DeviceManager::Disconnect(DeviceInfo *info, QModelIndex idx) {
|
void DeviceManager::Disconnect(DeviceInfo *info, QModelIndex idx) {
|
||||||
|
|
||||||
|
Q_UNUSED(idx);
|
||||||
|
|
||||||
info->device_->Close();
|
info->device_->Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -901,6 +903,8 @@ void DeviceManager::Unmount(QModelIndex idx) {
|
|||||||
|
|
||||||
void DeviceManager::DeviceSongCountUpdated(int count) {
|
void DeviceManager::DeviceSongCountUpdated(int count) {
|
||||||
|
|
||||||
|
Q_UNUSED(count);
|
||||||
|
|
||||||
ConnectedDevice *device = qobject_cast<ConnectedDevice*>(sender());
|
ConnectedDevice *device = qobject_cast<ConnectedDevice*>(sender());
|
||||||
if (!device) return;
|
if (!device) return;
|
||||||
|
|
||||||
@@ -915,11 +919,14 @@ void DeviceManager::DeviceSongCountUpdated(int count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::LazyPopulate(DeviceInfo *parent, bool signal) {
|
void DeviceManager::LazyPopulate(DeviceInfo *parent, bool signal) {
|
||||||
|
|
||||||
|
Q_UNUSED(signal);
|
||||||
if (parent->lazy_loaded) return;
|
if (parent->lazy_loaded) return;
|
||||||
parent->lazy_loaded = true;
|
parent->lazy_loaded = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceManager::DeviceNameByID(QString unique_id) {
|
QString DeviceManager::DeviceNameByID(const QString &unique_id) {
|
||||||
|
|
||||||
DeviceInfo *info = FindDeviceById(unique_id);
|
DeviceInfo *info = FindDeviceById(unique_id);
|
||||||
if (!info) return QString();
|
if (!info) return QString();
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
|
|||||||
|
|
||||||
DeviceInfo *FindDeviceById(const QString &id) const;
|
DeviceInfo *FindDeviceById(const QString &id) const;
|
||||||
DeviceInfo *FindDeviceByUrl(const QList<QUrl> &url) const;
|
DeviceInfo *FindDeviceByUrl(const QList<QUrl> &url) const;
|
||||||
QString DeviceNameByID(QString unique_id);
|
QString DeviceNameByID(const QString &unique_id);
|
||||||
DeviceInfo *FindEquivalentDevice(DeviceInfo *info) const;
|
DeviceInfo *FindEquivalentDevice(DeviceInfo *info) const;
|
||||||
|
|
||||||
// Actions on devices
|
// Actions on devices
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ DeviceStateFilterModel::DeviceStateFilterModel(QObject *parent, DeviceManager::S
|
|||||||
connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
|
connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
|
||||||
connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
|
connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(ProxyRowCountChanged(QModelIndex, int, int)));
|
||||||
connect(this, SIGNAL(modelReset()), this, SLOT(ProxyRowCountChanged()));
|
connect(this, SIGNAL(modelReset()), this, SLOT(ProxyRowCountChanged()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceStateFilterModel::filterAcceptsRow(int row, const QModelIndex&) const {
|
bool DeviceStateFilterModel::filterAcceptsRow(int row, const QModelIndex&) const {
|
||||||
@@ -46,12 +47,19 @@ void DeviceStateFilterModel::ProxyRowCountChanged() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceStateFilterModel::ProxyRowCountChanged(QModelIndex index, int first, int last) {
|
void DeviceStateFilterModel::ProxyRowCountChanged(QModelIndex index, int first, int last) {
|
||||||
|
|
||||||
|
Q_UNUSED(index);
|
||||||
|
Q_UNUSED(first);
|
||||||
|
Q_UNUSED(last);
|
||||||
emit IsEmptyChanged(rowCount() == 0);
|
emit IsEmptyChanged(rowCount() == 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceStateFilterModel::setSourceModel(QAbstractItemModel *sourceModel) {
|
void DeviceStateFilterModel::setSourceModel(QAbstractItemModel *sourceModel) {
|
||||||
|
|
||||||
QSortFilterProxyModel::setSourceModel(sourceModel);
|
QSortFilterProxyModel::setSourceModel(sourceModel);
|
||||||
setDynamicSortFilter(true);
|
setDynamicSortFilter(true);
|
||||||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
sort(0);
|
sort(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ QVariantList GioLister::DeviceIcons(const QString &id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GioLister::DeviceManufacturer(const QString &id) { return QString(); }
|
QString GioLister::DeviceManufacturer(const QString &id) { Q_UNUSED(id); return QString(); }
|
||||||
|
|
||||||
QString GioLister::DeviceModel(const QString &id) {
|
QString GioLister::DeviceModel(const QString &id) {
|
||||||
|
|
||||||
|
|||||||
@@ -106,10 +106,12 @@ QStringList iLister::DeviceUniqueIDs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVariantList iLister::DeviceIcons(const QString &id) {
|
QVariantList iLister::DeviceIcons(const QString &id) {
|
||||||
|
Q_UNUSED(id);
|
||||||
return QVariantList() << "ipodtouchicon";
|
return QVariantList() << "ipodtouchicon";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString iLister::DeviceManufacturer(const QString &id) {
|
QString iLister::DeviceManufacturer(const QString &id) {
|
||||||
|
Q_UNUSED(id);
|
||||||
return "Apple";
|
return "Apple";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ bool iMobileDeviceConnection::Exists(const QString &path) {
|
|||||||
|
|
||||||
QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const Song &metadata) {
|
QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const Song &metadata) {
|
||||||
|
|
||||||
|
Q_UNUSED(itdb);
|
||||||
|
|
||||||
// This function does the same as itdb_cp_get_dest_filename, except it accesses the device's filesystem through imobiledevice.
|
// This function does the same as itdb_cp_get_dest_filename, except it accesses the device's filesystem through imobiledevice.
|
||||||
|
|
||||||
// Get the total number of F.. directories
|
// Get the total number of F.. directories
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
bool is_valid() { return device_ && afc_; }
|
bool is_valid() { return device_ && afc_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(iMobileDeviceConnection);
|
Q_DISABLE_COPY(iMobileDeviceConnection)
|
||||||
|
|
||||||
idevice_t device_;
|
idevice_t device_;
|
||||||
afc_client_t afc_;
|
afc_client_t afc_;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
bool GetSupportedFiletypes(QList<Song::FileType> *ret);
|
bool GetSupportedFiletypes(QList<Song::FileType> *ret);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(MtpConnection);
|
Q_DISABLE_COPY(MtpConnection)
|
||||||
|
|
||||||
LIBMTP_mtpdevice_t *device_;
|
LIBMTP_mtpdevice_t *device_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ QStringList Udisks2Lister::DeviceUniqueIDs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVariantList Udisks2Lister::DeviceIcons(const QString &id) {
|
QVariantList Udisks2Lister::DeviceIcons(const QString &id) {
|
||||||
|
Q_UNUSED(id);
|
||||||
return QVariantList();
|
return QVariantList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,6 +246,7 @@ void Udisks2Lister::DBusInterfaceAdded(const QDBusObjectPath &path, const Interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Udisks2Lister::DBusInterfaceRemoved(const QDBusObjectPath &path, const QStringList &ifaces) {
|
void Udisks2Lister::DBusInterfaceRemoved(const QDBusObjectPath &path, const QStringList &ifaces) {
|
||||||
|
Q_UNUSED(ifaces);
|
||||||
if (!isPendingJob(path)) RemoveDevice(path);
|
if (!isPendingJob(path)) RemoveDevice(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,6 +298,8 @@ QList<QDBusObjectPath> Udisks2Lister::GetMountedPartitionsFromDBusArgument(const
|
|||||||
|
|
||||||
void Udisks2Lister::JobCompleted(bool success, const QString &message) {
|
void Udisks2Lister::JobCompleted(bool success, const QString &message) {
|
||||||
|
|
||||||
|
Q_UNUSED(message);
|
||||||
|
|
||||||
auto job = qobject_cast<OrgFreedesktopUDisks2JobInterface*>(sender());
|
auto job = qobject_cast<OrgFreedesktopUDisks2JobInterface*>(sender());
|
||||||
QDBusObjectPath jobPath(job->path());
|
QDBusObjectPath jobPath(job->path());
|
||||||
|
|
||||||
|
|||||||
@@ -563,6 +563,8 @@ void EditTagDialog::UpdateStatisticsTab(const Song &song) {
|
|||||||
|
|
||||||
void EditTagDialog::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &scaled, const QImage &original) {
|
void EditTagDialog::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &scaled, const QImage &original) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (id == cover_art_id_) {
|
if (id == cover_art_id_) {
|
||||||
ui_->art->setPixmap(QPixmap::fromImage(scaled));
|
ui_->art->setPixmap(QPixmap::fromImage(scaled));
|
||||||
original_ = original;
|
original_ = original;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef ENGINE_FWD_H
|
#ifndef ENGINE_FWD_H
|
||||||
#define ENGINE_FWD_H
|
#define ENGINE_FWD_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
/// Used by eg engineobserver.h, and thus we reduce header dependencies on enginebase.h
|
/// Used by eg engineobserver.h, and thus we reduce header dependencies on enginebase.h
|
||||||
|
|
||||||
namespace Engine {
|
namespace Engine {
|
||||||
@@ -31,7 +33,7 @@ enum TrackChangeType {
|
|||||||
SameAlbum = 0x10,
|
SameAlbum = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(TrackChangeFlags, TrackChangeType);
|
Q_DECLARE_FLAGS(TrackChangeFlags, TrackChangeType)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ void Engine::Base::EmitAboutToEnd() {
|
|||||||
|
|
||||||
bool Engine::Base::ValidOutput(const QString &output) {
|
bool Engine::Base::ValidOutput(const QString &output) {
|
||||||
|
|
||||||
|
Q_UNUSED(output);
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,23 +69,23 @@ public:
|
|||||||
|
|
||||||
virtual bool Init() = 0;
|
virtual bool Init() = 0;
|
||||||
virtual State state() const = 0;
|
virtual State state() const = 0;
|
||||||
virtual void StartPreloading(const QUrl &stream_url, const QUrl &original_url, bool, qint64, qint64) {}
|
virtual void StartPreloading(const QUrl&, const QUrl&, const bool, const qint64, const qint64) {}
|
||||||
virtual bool Load(const QUrl &stream_url, const QUrl &original_url, TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
virtual bool Load(const QUrl &stream_url, const QUrl &original_url, const TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
virtual bool Play(quint64 offset_nanosec) = 0;
|
virtual bool Play(const quint64 offset_nanosec) = 0;
|
||||||
virtual void Stop(bool stop_after = false) = 0;
|
virtual void Stop(const bool stop_after = false) = 0;
|
||||||
virtual void Pause() = 0;
|
virtual void Pause() = 0;
|
||||||
virtual void Unpause() = 0;
|
virtual void Unpause() = 0;
|
||||||
virtual void Seek(quint64 offset_nanosec) = 0;
|
virtual void Seek(const quint64 offset_nanosec) = 0;
|
||||||
virtual void SetVolumeSW(uint percent) = 0;
|
virtual void SetVolumeSW(const uint percent) = 0;
|
||||||
|
|
||||||
virtual qint64 position_nanosec() const = 0;
|
virtual qint64 position_nanosec() const = 0;
|
||||||
virtual qint64 length_nanosec() const = 0;
|
virtual qint64 length_nanosec() const = 0;
|
||||||
|
|
||||||
virtual const Scope &scope(int chunk_length) { return scope_; }
|
virtual const Scope &scope(const int chunk_length) { Q_UNUSED(chunk_length); return scope_; }
|
||||||
|
|
||||||
// Sets new values for the beginning and end markers of the currently playing song.
|
// Sets new values for the beginning and end markers of the currently playing song.
|
||||||
// This doesn't change the state of engine or the stream's current position.
|
// This doesn't change the state of engine or the stream's current position.
|
||||||
virtual void RefreshMarkers(quint64 beginning_nanosec, qint64 end_nanosec) {
|
virtual void RefreshMarkers(const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
beginning_nanosec_ = beginning_nanosec;
|
beginning_nanosec_ = beginning_nanosec;
|
||||||
end_nanosec_ = end_nanosec;
|
end_nanosec_ = end_nanosec;
|
||||||
}
|
}
|
||||||
@@ -98,9 +98,9 @@ public:
|
|||||||
|
|
||||||
// Plays a media stream represented with the URL 'u' from the given 'beginning' to the given 'end' (usually from 0 to a song's length).
|
// Plays a media stream represented with the URL 'u' from the given 'beginning' to the given 'end' (usually from 0 to a song's length).
|
||||||
// Both markers should be passed in nanoseconds. 'end' can be negative, indicating that the real length of 'u' stream is unknown.
|
// Both markers should be passed in nanoseconds. 'end' can be negative, indicating that the real length of 'u' stream is unknown.
|
||||||
bool Play(const QUrl &stream_url, const QUrl &original_url, TrackChangeFlags c, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
bool Play(const QUrl &stream_url, const QUrl &original_url, const TrackChangeFlags c, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
void SetVolume(uint value);
|
void SetVolume(const uint value);
|
||||||
static uint MakeVolumeLogarithmic(uint volume);
|
static uint MakeVolumeLogarithmic(const uint volume);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ReloadSettings();
|
virtual void ReloadSettings();
|
||||||
@@ -125,12 +125,12 @@ public:
|
|||||||
|
|
||||||
QVariant device() { return device_; }
|
QVariant device() { return device_; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void SetEqualizerEnabled(bool) {}
|
virtual void SetEqualizerEnabled(const bool) {}
|
||||||
virtual void SetEqualizerParameters(int preamp, const QList<int> &bandGains) {}
|
virtual void SetEqualizerParameters(const int preamp, const QList<int> &bandGains) { Q_UNUSED(preamp); Q_UNUSED(bandGains); }
|
||||||
virtual void SetStereoBalance(float value) {}
|
virtual void SetStereoBalance(float value) { Q_UNUSED(value); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Emitted when crossfading is enabled and the track is crossfade_duration_ away from finishing
|
// Emitted when crossfading is enabled and the track is crossfade_duration_ away from finishing
|
||||||
void TrackAboutToEnd();
|
void TrackAboutToEnd();
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool about_to_end_emitted_;
|
bool about_to_end_emitted_;
|
||||||
Q_DISABLE_COPY(Base);
|
Q_DISABLE_COPY(Base)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -226,6 +226,6 @@ struct SimpleMetaBundle {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(EngineBase::OutputDetails);
|
Q_DECLARE_METATYPE(EngineBase::OutputDetails)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,6 +40,6 @@ QString EngineName(Engine::EngineType enginetype);
|
|||||||
QString EngineDescription(Engine::EngineType enginetype);
|
QString EngineDescription(Engine::EngineType enginetype);
|
||||||
|
|
||||||
}
|
}
|
||||||
Q_DECLARE_METATYPE(Engine::EngineType);
|
Q_DECLARE_METATYPE(Engine::EngineType)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ Engine::State GstEngine::state() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url, bool force_stop_at_end, qint64 beginning_nanosec, qint64 end_nanosec) {
|
void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialised();
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
|
bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialised();
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::T
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEngine::Play(quint64 offset_nanosec) {
|
bool GstEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialised();
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ bool GstEngine::Play(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::Stop(bool stop_after) {
|
void GstEngine::Stop(const bool stop_after) {
|
||||||
|
|
||||||
StopTimers();
|
StopTimers();
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ void GstEngine::Unpause() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::Seek(quint64 offset_nanosec) {
|
void GstEngine::Seek(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!current_pipeline_) return;
|
if (!current_pipeline_) return;
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ void GstEngine::Seek(quint64 offset_nanosec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::SetVolumeSW(uint percent) {
|
void GstEngine::SetVolumeSW(const uint percent) {
|
||||||
if (current_pipeline_) current_pipeline_->SetVolume(percent);
|
if (current_pipeline_) current_pipeline_->SetVolume(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ qint64 GstEngine::length_nanosec() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Engine::Scope &GstEngine::scope(int chunk_length) {
|
const Engine::Scope &GstEngine::scope(const int chunk_length) {
|
||||||
|
|
||||||
// The new buffer could have a different size
|
// The new buffer could have a different size
|
||||||
if (have_new_buffer_) {
|
if (have_new_buffer_) {
|
||||||
@@ -392,7 +392,7 @@ void GstEngine::ReloadSettings() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin, bool showerror) {
|
GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin, const bool showerror) {
|
||||||
|
|
||||||
// Make a unique name
|
// Make a unique name
|
||||||
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
||||||
@@ -411,7 +411,7 @@ GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::ConsumeBuffer(GstBuffer *buffer, int pipeline_id) {
|
void GstEngine::ConsumeBuffer(GstBuffer *buffer, const int pipeline_id) {
|
||||||
|
|
||||||
// Schedule this to run in the GUI thread. The buffer gets added to the queue and unreffed by UpdateScope.
|
// Schedule this to run in the GUI thread. The buffer gets added to the queue and unreffed by UpdateScope.
|
||||||
if (!QMetaObject::invokeMethod(this, "AddBufferToScope", Q_ARG(GstBuffer*, buffer), Q_ARG(int, pipeline_id))) {
|
if (!QMetaObject::invokeMethod(this, "AddBufferToScope", Q_ARG(GstBuffer*, buffer), Q_ARG(int, pipeline_id))) {
|
||||||
@@ -420,14 +420,14 @@ void GstEngine::ConsumeBuffer(GstBuffer *buffer, int pipeline_id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::SetEqualizerEnabled(bool enabled) {
|
void GstEngine::SetEqualizerEnabled(const bool enabled) {
|
||||||
|
|
||||||
equalizer_enabled_ = enabled;
|
equalizer_enabled_ = enabled;
|
||||||
|
|
||||||
if (current_pipeline_) current_pipeline_->SetEqualizerEnabled(enabled);
|
if (current_pipeline_) current_pipeline_->SetEqualizerEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::SetEqualizerParameters(int preamp, const QList<int> &band_gains) {
|
void GstEngine::SetEqualizerParameters(const int preamp, const QList<int> &band_gains) {
|
||||||
|
|
||||||
equalizer_preamp_ = preamp;
|
equalizer_preamp_ = preamp;
|
||||||
equalizer_gains_ = band_gains;
|
equalizer_gains_ = band_gains;
|
||||||
@@ -437,7 +437,7 @@ void GstEngine::SetEqualizerParameters(int preamp, const QList<int> &band_gains)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::SetStereoBalance(float value) {
|
void GstEngine::SetStereoBalance(const float value) {
|
||||||
|
|
||||||
stereo_balance_ = value;
|
stereo_balance_ = value;
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ void GstEngine::timerEvent(QTimerEvent *e) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::EndOfStreamReached(int pipeline_id, bool has_next_track) {
|
void GstEngine::EndOfStreamReached(const int pipeline_id, const bool has_next_track) {
|
||||||
|
|
||||||
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id)
|
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id)
|
||||||
return;
|
return;
|
||||||
@@ -513,14 +513,14 @@ void GstEngine::HandlePipelineError(int pipeline_id, const QString &message, int
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::NewMetaData(int pipeline_id, const Engine::SimpleMetaBundle &bundle) {
|
void GstEngine::NewMetaData(const int pipeline_id, const Engine::SimpleMetaBundle &bundle) {
|
||||||
|
|
||||||
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return;
|
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return;
|
||||||
emit MetaData(bundle);
|
emit MetaData(bundle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::AddBufferToScope(GstBuffer *buf, int pipeline_id) {
|
void GstEngine::AddBufferToScope(GstBuffer *buf, const int pipeline_id) {
|
||||||
|
|
||||||
if (!current_pipeline_ || current_pipeline_->id() != pipeline_id) {
|
if (!current_pipeline_ || current_pipeline_->id() != pipeline_id) {
|
||||||
gst_buffer_unref(buf);
|
gst_buffer_unref(buf);
|
||||||
@@ -618,7 +618,7 @@ void GstEngine::BufferingStarted() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::BufferingProgress(int percent) {
|
void GstEngine::BufferingProgress(const int percent) {
|
||||||
task_manager_->SetTaskProgress(buffering_task_id_, percent, 100);
|
task_manager_->SetTaskProgress(buffering_task_id_, percent, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +761,7 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QByteArray &gst_url, const QUrl &original_url, qint64 end_nanosec) {
|
shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QByteArray &gst_url, const QUrl &original_url, const qint64 end_nanosec) {
|
||||||
|
|
||||||
shared_ptr<GstEnginePipeline> ret = CreatePipeline();
|
shared_ptr<GstEnginePipeline> ret = CreatePipeline();
|
||||||
if (!ret->InitFromUrl(gst_url, original_url, end_nanosec)) ret.reset();
|
if (!ret->InitFromUrl(gst_url, original_url, end_nanosec)) ret.reset();
|
||||||
@@ -769,7 +769,7 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QByteArray &gst_ur
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::UpdateScope(int chunk_length) {
|
void GstEngine::UpdateScope(const int chunk_length) {
|
||||||
|
|
||||||
typedef Engine::Scope::value_type sample_type;
|
typedef Engine::Scope::value_type sample_type;
|
||||||
|
|
||||||
|
|||||||
@@ -69,21 +69,21 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
Engine::State state() const;
|
Engine::State state() const;
|
||||||
void StartPreloading(const QUrl &stream_url, const QUrl &original_url, bool force_stop_at_end, qint64 beginning_nanosec, qint64 end_nanosec);
|
void StartPreloading(const QUrl &stream_url, const QUrl &original_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
bool Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
bool Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
bool Play(quint64 offset_nanosec);
|
bool Play(const quint64 offset_nanosec);
|
||||||
void Stop(bool stop_after = false);
|
void Stop(const bool stop_after = false);
|
||||||
void Pause();
|
void Pause();
|
||||||
void Unpause();
|
void Unpause();
|
||||||
void Seek(quint64 offset_nanosec);
|
void Seek(const quint64 offset_nanosec);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetVolumeSW(uint percent);
|
void SetVolumeSW(const uint percent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qint64 position_nanosec() const;
|
qint64 position_nanosec() const;
|
||||||
qint64 length_nanosec() const;
|
qint64 length_nanosec() const;
|
||||||
const Engine::Scope &scope(int chunk_length);
|
const Engine::Scope &scope(const int chunk_length);
|
||||||
|
|
||||||
OutputDetailsList GetOutputsList() const;
|
OutputDetailsList GetOutputsList() const;
|
||||||
bool ValidOutput(const QString &output);
|
bool ValidOutput(const QString &output);
|
||||||
@@ -94,7 +94,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
void SetStartup(GstStartup *gst_startup) { gst_startup_ = gst_startup; }
|
void SetStartup(GstStartup *gst_startup) { gst_startup_ = gst_startup; }
|
||||||
void EnsureInitialised() { gst_startup_->EnsureInitialised(); }
|
void EnsureInitialised() { gst_startup_->EnsureInitialised(); }
|
||||||
|
|
||||||
GstElement *CreateElement(const QString &factoryName, GstElement *bin = nullptr, bool showerror = true);
|
GstElement *CreateElement(const QString &factoryName, GstElement *bin = nullptr, const bool showerror = true);
|
||||||
void ConsumeBuffer(GstBuffer *buffer, int pipeline_id);
|
void ConsumeBuffer(GstBuffer *buffer, int pipeline_id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -102,13 +102,13 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
|
||||||
/** Set whether equalizer is enabled */
|
/** Set whether equalizer is enabled */
|
||||||
void SetEqualizerEnabled(bool);
|
void SetEqualizerEnabled(const bool);
|
||||||
|
|
||||||
/** Set equalizer preamp and gains, range -100..100. Gains are 10 values. */
|
/** Set equalizer preamp and gains, range -100..100. Gains are 10 values. */
|
||||||
void SetEqualizerParameters(int preamp, const QList<int> &bandGains);
|
void SetEqualizerParameters(const int preamp, const QList<int> &bandGains);
|
||||||
|
|
||||||
/** Set Stereo balance, range -1.0f..1.0f */
|
/** Set Stereo balance, range -1.0f..1.0f */
|
||||||
void SetStereoBalance(float value);
|
void SetStereoBalance(const float value);
|
||||||
|
|
||||||
void AddBufferConsumer(GstBufferConsumer *consumer);
|
void AddBufferConsumer(GstBufferConsumer *consumer);
|
||||||
void RemoveBufferConsumer(GstBufferConsumer *consumer);
|
void RemoveBufferConsumer(GstBufferConsumer *consumer);
|
||||||
@@ -121,10 +121,10 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
void timerEvent(QTimerEvent*);
|
void timerEvent(QTimerEvent*);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void EndOfStreamReached(int pipeline_id, bool has_next_track);
|
void EndOfStreamReached(const int pipeline_id, const bool has_next_track);
|
||||||
void HandlePipelineError(int pipeline_id, const QString &message, int domain, int error_code);
|
void HandlePipelineError(const int pipeline_id, const QString &message, const int domain, const int error_code);
|
||||||
void NewMetaData(int pipeline_id, const Engine::SimpleMetaBundle &bundle);
|
void NewMetaData(const int pipeline_id, const Engine::SimpleMetaBundle &bundle);
|
||||||
void AddBufferToScope(GstBuffer *buf, int pipeline_id);
|
void AddBufferToScope(GstBuffer *buf, const int pipeline_id);
|
||||||
void FadeoutFinished();
|
void FadeoutFinished();
|
||||||
void FadeoutPauseFinished();
|
void FadeoutPauseFinished();
|
||||||
void SeekNow();
|
void SeekNow();
|
||||||
@@ -158,7 +158,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
void StopTimers();
|
void StopTimers();
|
||||||
|
|
||||||
std::shared_ptr<GstEnginePipeline> CreatePipeline();
|
std::shared_ptr<GstEnginePipeline> CreatePipeline();
|
||||||
std::shared_ptr<GstEnginePipeline> CreatePipeline(const QByteArray &gst_url, const QUrl &original_url, qint64 end_nanosec);
|
std::shared_ptr<GstEnginePipeline> CreatePipeline(const QByteArray &gst_url, const QUrl &original_url, const qint64 end_nanosec);
|
||||||
|
|
||||||
void UpdateScope(int chunk_length);
|
void UpdateScope(int chunk_length);
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void GstEnginePipeline::set_replaygain(bool enabled, int mode, float preamp, boo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::set_buffer_duration_nanosec(qint64 buffer_duration_nanosec) {
|
void GstEnginePipeline::set_buffer_duration_nanosec(const qint64 buffer_duration_nanosec) {
|
||||||
buffer_duration_nanosec_ = buffer_duration_nanosec;
|
buffer_duration_nanosec_ = buffer_duration_nanosec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ bool GstEnginePipeline::InitFromString(const QString &pipeline) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEnginePipeline::InitFromUrl(const QByteArray &stream_url, const QUrl original_url, qint64 end_nanosec) {
|
bool GstEnginePipeline::InitFromUrl(const QByteArray &stream_url, const QUrl original_url, const qint64 end_nanosec) {
|
||||||
|
|
||||||
stream_url_ = stream_url;
|
stream_url_ = stream_url;
|
||||||
original_url_ = original_url;
|
original_url_ = original_url;
|
||||||
@@ -758,6 +758,8 @@ void GstEnginePipeline::BufferingMessageReceived(GstMessage *msg) {
|
|||||||
void GstEnginePipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer self) {
|
void GstEnginePipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer self) {
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
if (!instance) return;
|
||||||
|
|
||||||
GstPad *const audiopad = gst_element_get_static_pad(instance->audiobin_, "sink");
|
GstPad *const audiopad = gst_element_get_static_pad(instance->audiobin_, "sink");
|
||||||
|
|
||||||
// Link decodebin's sink pad to audiobin's src pad.
|
// Link decodebin's sink pad to audiobin's src pad.
|
||||||
@@ -787,6 +789,8 @@ void GstEnginePipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer self)
|
|||||||
GstPadProbeReturn GstEnginePipeline::DecodebinProbe(GstPad *pad, GstPadProbeInfo *info, gpointer data) {
|
GstPadProbeReturn GstEnginePipeline::DecodebinProbe(GstPad *pad, GstPadProbeInfo *info, gpointer data) {
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(data);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(data);
|
||||||
|
if (!instance) return GST_PAD_PROBE_OK;
|
||||||
|
|
||||||
const GstPadProbeType info_type = GST_PAD_PROBE_INFO_TYPE(info);
|
const GstPadProbeType info_type = GST_PAD_PROBE_INFO_TYPE(info);
|
||||||
|
|
||||||
if (info_type & GST_PAD_PROBE_TYPE_BUFFER) {
|
if (info_type & GST_PAD_PROBE_TYPE_BUFFER) {
|
||||||
@@ -826,6 +830,8 @@ GstPadProbeReturn GstEnginePipeline::DecodebinProbe(GstPad *pad, GstPadProbeInfo
|
|||||||
GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad*, GstPadProbeInfo *info, gpointer self) {
|
GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad*, GstPadProbeInfo *info, gpointer self) {
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
if (!instance) return GST_PAD_PROBE_OK;
|
||||||
|
|
||||||
GstBuffer *buf = gst_pad_probe_info_get_buffer(info);
|
GstBuffer *buf = gst_pad_probe_info_get_buffer(info);
|
||||||
|
|
||||||
QList<GstBufferConsumer*> consumers;
|
QList<GstBufferConsumer*> consumers;
|
||||||
@@ -872,6 +878,8 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad*, GstPadProbeInfo *i
|
|||||||
GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*, GstPadProbeInfo *info, gpointer self) {
|
GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*, GstPadProbeInfo *info, gpointer self) {
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
if (!instance) return GST_PAD_PROBE_OK;
|
||||||
|
|
||||||
GstEvent *e = gst_pad_probe_info_get_event(info);
|
GstEvent *e = gst_pad_probe_info_get_event(info);
|
||||||
|
|
||||||
qLog(Debug) << instance->id() << "event" << GST_EVENT_TYPE_NAME(e);
|
qLog(Debug) << instance->id() << "event" << GST_EVENT_TYPE_NAME(e);
|
||||||
@@ -897,7 +905,10 @@ GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*, GstPadProbeIn
|
|||||||
|
|
||||||
void GstEnginePipeline::AboutToFinishCallback(GstPlayBin *bin, gpointer self) {
|
void GstEnginePipeline::AboutToFinishCallback(GstPlayBin *bin, gpointer self) {
|
||||||
|
|
||||||
|
Q_UNUSED(bin);
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
if (!instance) return;
|
||||||
|
|
||||||
if (instance->has_next_valid_url() && !instance->next_uri_set_) {
|
if (instance->has_next_valid_url() && !instance->next_uri_set_) {
|
||||||
// Set the next uri. When the current song ends it will be played automatically and a STREAM_START message is send to the bus.
|
// Set the next uri. When the current song ends it will be played automatically and a STREAM_START message is send to the bus.
|
||||||
@@ -910,7 +921,11 @@ void GstEnginePipeline::AboutToFinishCallback(GstPlayBin *bin, gpointer self) {
|
|||||||
|
|
||||||
void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *pspec, gpointer self) {
|
void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *pspec, gpointer self) {
|
||||||
|
|
||||||
|
Q_UNUSED(pspec);
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
if (!instance) return;
|
||||||
|
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
g_object_get(bin, "source", &element, nullptr);
|
g_object_get(bin, "source", &element, nullptr);
|
||||||
if (!element) {
|
if (!element) {
|
||||||
@@ -927,12 +942,6 @@ void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *pspec,
|
|||||||
QString user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion());
|
QString user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion());
|
||||||
g_object_set(element, "user-agent", user_agent.toUtf8().constData(), nullptr);
|
g_object_set(element, "user-agent", user_agent.toUtf8().constData(), nullptr);
|
||||||
g_object_set(element, "ssl-strict", FALSE, nullptr);
|
g_object_set(element, "ssl-strict", FALSE, nullptr);
|
||||||
|
|
||||||
//#ifdef Q_OS_MACOS
|
|
||||||
//g_object_set(element, "tls-database", instance->engine_->tls_database(), nullptr);
|
|
||||||
//g_object_set(element, "ssl-use-system-ca-file", false, nullptr);
|
|
||||||
//g_object_set(element, "ssl-strict", TRUE, nullptr);
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the pipeline was buffering we stop that now.
|
// If the pipeline was buffering we stop that now.
|
||||||
@@ -978,7 +987,7 @@ QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEnginePipeline::Seek(qint64 nanosec) {
|
bool GstEnginePipeline::Seek(const qint64 nanosec) {
|
||||||
|
|
||||||
if (ignore_next_seek_) {
|
if (ignore_next_seek_) {
|
||||||
ignore_next_seek_ = false;
|
ignore_next_seek_ = false;
|
||||||
@@ -1011,7 +1020,7 @@ void GstEnginePipeline::SetEqualizerEnabled(bool enabled) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SetEqualizerParams(int preamp, const QList<int>& band_gains) {
|
void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList<int>& band_gains) {
|
||||||
|
|
||||||
eq_preamp_ = preamp;
|
eq_preamp_ = preamp;
|
||||||
eq_band_gains_ = band_gains;
|
eq_band_gains_ = band_gains;
|
||||||
@@ -1019,7 +1028,7 @@ void GstEnginePipeline::SetEqualizerParams(int preamp, const QList<int>& band_ga
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SetStereoBalance(float value) {
|
void GstEnginePipeline::SetStereoBalance(const float value) {
|
||||||
|
|
||||||
stereo_balance_ = value;
|
stereo_balance_ = value;
|
||||||
UpdateStereoBalance();
|
UpdateStereoBalance();
|
||||||
@@ -1059,13 +1068,13 @@ void GstEnginePipeline::UpdateStereoBalance() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SetVolume(int percent) {
|
void GstEnginePipeline::SetVolume(const int percent) {
|
||||||
if (!volume_) return;
|
if (!volume_) return;
|
||||||
volume_percent_ = percent;
|
volume_percent_ = percent;
|
||||||
UpdateVolume();
|
UpdateVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SetVolumeModifier(qreal mod) {
|
void GstEnginePipeline::SetVolumeModifier(const qreal mod) {
|
||||||
if (!volume_) return;
|
if (!volume_) return;
|
||||||
volume_modifier_ = mod;
|
volume_modifier_ = mod;
|
||||||
UpdateVolume();
|
UpdateVolume();
|
||||||
@@ -1077,7 +1086,7 @@ void GstEnginePipeline::UpdateVolume() {
|
|||||||
g_object_set(G_OBJECT(volume_), "volume", vol, nullptr);
|
g_object_set(G_OBJECT(volume_), "volume", vol, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::StartFader(qint64 duration_nanosec, QTimeLine::Direction direction, QTimeLine::CurveShape shape, bool use_fudge_timer) {
|
void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction, const QTimeLine::CurveShape shape, const bool use_fudge_timer) {
|
||||||
|
|
||||||
const int duration_msec = duration_nanosec / kNsecPerMsec;
|
const int duration_msec = duration_nanosec / kNsecPerMsec;
|
||||||
|
|
||||||
@@ -1153,7 +1162,7 @@ void GstEnginePipeline::RemoveAllBufferConsumers() {
|
|||||||
buffer_consumers_.clear();
|
buffer_consumers_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SetNextUrl(const QByteArray &stream_url, const QUrl &original_url, qint64 beginning_nanosec, qint64 end_nanosec) {
|
void GstEnginePipeline::SetNextUrl(const QByteArray &stream_url, const QUrl &original_url, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
next_stream_url_ = stream_url;
|
next_stream_url_ = stream_url;
|
||||||
next_original_url_ = original_url;
|
next_original_url_ = original_url;
|
||||||
@@ -1164,6 +1173,9 @@ void GstEnginePipeline::SetNextUrl(const QByteArray &stream_url, const QUrl &ori
|
|||||||
|
|
||||||
void GstEnginePipeline::StreamDiscovered(GstDiscoverer *discoverer, GstDiscovererInfo *info, GError *err, gpointer self) {
|
void GstEnginePipeline::StreamDiscovered(GstDiscoverer *discoverer, GstDiscovererInfo *info, GError *err, gpointer self) {
|
||||||
|
|
||||||
|
Q_UNUSED(discoverer);
|
||||||
|
Q_UNUSED(err);
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
if (!instance) return;
|
if (!instance) return;
|
||||||
|
|
||||||
@@ -1218,6 +1230,8 @@ void GstEnginePipeline::StreamDiscovered(GstDiscoverer *discoverer, GstDiscovere
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::StreamDiscoveryFinished(GstDiscoverer *discoverer, gpointer self) {
|
void GstEnginePipeline::StreamDiscoveryFinished(GstDiscoverer *discoverer, gpointer self) {
|
||||||
|
Q_UNUSED(discoverer);
|
||||||
|
Q_UNUSED(self);
|
||||||
//GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
//GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ class GstEnginePipeline : public QObject {
|
|||||||
|
|
||||||
// Call these setters before Init
|
// Call these setters before Init
|
||||||
void set_output_device(const QString &sink, const QVariant &device);
|
void set_output_device(const QString &sink, const QVariant &device);
|
||||||
void set_volume_control(bool volume_control);
|
void set_volume_control(const bool volume_control);
|
||||||
void set_replaygain(bool enabled, int mode, float preamp, bool compression);
|
void set_replaygain(const bool enabled, const int mode, const float preamp, const bool compression);
|
||||||
void set_buffer_duration_nanosec(qint64 duration_nanosec);
|
void set_buffer_duration_nanosec(qint64 duration_nanosec);
|
||||||
void set_buffer_min_fill(int percent);
|
void set_buffer_min_fill(int percent);
|
||||||
|
|
||||||
// Creates the pipeline, returns false on error
|
// Creates the pipeline, returns false on error
|
||||||
bool InitFromUrl(const QByteArray &stream_url, const QUrl original_url, qint64 end_nanosec);
|
bool InitFromUrl(const QByteArray &stream_url, const QUrl original_url, const qint64 end_nanosec);
|
||||||
bool InitFromString(const QString &pipeline);
|
bool InitFromString(const QString &pipeline);
|
||||||
|
|
||||||
// GstBufferConsumers get fed audio data. Thread-safe.
|
// GstBufferConsumers get fed audio data. Thread-safe.
|
||||||
@@ -84,13 +84,13 @@ class GstEnginePipeline : public QObject {
|
|||||||
void RemoveAllBufferConsumers();
|
void RemoveAllBufferConsumers();
|
||||||
|
|
||||||
// Control the music playback
|
// Control the music playback
|
||||||
QFuture<GstStateChangeReturn> SetState(GstState state);
|
QFuture<GstStateChangeReturn> SetState(const GstState state);
|
||||||
Q_INVOKABLE bool Seek(qint64 nanosec);
|
Q_INVOKABLE bool Seek(const qint64 nanosec);
|
||||||
void SetEqualizerEnabled(bool enabled);
|
void SetEqualizerEnabled(const bool enabled);
|
||||||
void SetEqualizerParams(int preamp, const QList<int> &band_gains);
|
void SetEqualizerParams(const int preamp, const QList<int> &band_gains);
|
||||||
void SetVolume(int percent);
|
void SetVolume(const int percent);
|
||||||
void SetStereoBalance(float value);
|
void SetStereoBalance(const float value);
|
||||||
void StartFader(qint64 duration_nanosec, QTimeLine::Direction direction = QTimeLine::Forward, QTimeLine::CurveShape shape = QTimeLine::LinearCurve, bool use_fudge_timer = true);
|
void StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction = QTimeLine::Forward, const QTimeLine::CurveShape shape = QTimeLine::LinearCurve, const bool use_fudge_timer = true);
|
||||||
|
|
||||||
// If this is set then it will be loaded automatically when playback finishes for gapless playback
|
// If this is set then it will be loaded automatically when playback finishes for gapless playback
|
||||||
void SetNextUrl(const QByteArray &stream_url, const QUrl &original_url, qint64 beginning_nanosec, qint64 end_nanosec);
|
void SetNextUrl(const QByteArray &stream_url, const QUrl &original_url, qint64 beginning_nanosec, qint64 end_nanosec);
|
||||||
@@ -121,11 +121,11 @@ class GstEnginePipeline : public QObject {
|
|||||||
void SetVolumeModifier(qreal mod);
|
void SetVolumeModifier(qreal mod);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void EndOfStreamReached(int pipeline_id, bool has_next_track);
|
void EndOfStreamReached(const int pipeline_id, const bool has_next_track);
|
||||||
void MetadataFound(int pipeline_id, const Engine::SimpleMetaBundle &bundle);
|
void MetadataFound(const int pipeline_id, const Engine::SimpleMetaBundle &bundle);
|
||||||
// This indicates an error, delegated from GStreamer, in the pipeline.
|
// This indicates an error, delegated from GStreamer, in the pipeline.
|
||||||
// The message, domain and error_code are related to GStreamer's GError.
|
// The message, domain and error_code are related to GStreamer's GError.
|
||||||
void Error(int pipeline_id, const QString &message, int domain, int error_code);
|
void Error(const int pipeline_id, const QString &message, const int domain, const int error_code);
|
||||||
void FaderFinished();
|
void FaderFinished();
|
||||||
|
|
||||||
void BufferingStarted();
|
void BufferingStarted();
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ PhononEngine::PhononEngine(TaskManager *task_manager)
|
|||||||
state_timer_(new QTimer(this)),
|
state_timer_(new QTimer(this)),
|
||||||
seek_offset_(-1) {
|
seek_offset_(-1) {
|
||||||
|
|
||||||
|
Q_UNUSED(task_manager);
|
||||||
|
|
||||||
type_ = Engine::Phonon;
|
type_ = Engine::Phonon;
|
||||||
|
|
||||||
Phonon::createPath(media_object_, audio_output_);
|
Phonon::createPath(media_object_, audio_output_);
|
||||||
@@ -61,16 +63,24 @@ bool PhononEngine::Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::CanDecode(const QUrl &url) {
|
bool PhononEngine::CanDecode(const QUrl &url) {
|
||||||
|
Q_UNUSED(url);
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
|
bool PhononEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
|
Q_UNUSED(original_url);
|
||||||
|
Q_UNUSED(change);
|
||||||
|
Q_UNUSED(force_stop_at_end);
|
||||||
|
Q_UNUSED(beginning_nanosec);
|
||||||
|
Q_UNUSED(end_nanosec);
|
||||||
|
|
||||||
media_object_->setCurrentSource(Phonon::MediaSource(stream_url));
|
media_object_->setCurrentSource(Phonon::MediaSource(stream_url));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::Play(quint64 offset_nanosec) {
|
bool PhononEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
// The seek happens in PhononStateChanged - phonon doesn't seem to change currentTime() if we seek before we start playing :S
|
// The seek happens in PhononStateChanged - phonon doesn't seem to change currentTime() if we seek before we start playing :S
|
||||||
seek_offset_ = (offset_nanosec / kNsecPerMsec);
|
seek_offset_ = (offset_nanosec / kNsecPerMsec);
|
||||||
@@ -80,7 +90,8 @@ bool PhononEngine::Play(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhononEngine::Stop(bool stop_after) {
|
void PhononEngine::Stop(const bool stop_after) {
|
||||||
|
Q_UNUSED(stop_after);
|
||||||
media_object_->stop();
|
media_object_->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,12 +130,12 @@ uint PhononEngine::length() const {
|
|||||||
return media_object_->totalTime();
|
return media_object_->totalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhononEngine::Seek(quint64 offset_nanosec) {
|
void PhononEngine::Seek(const quint64 offset_nanosec) {
|
||||||
int offset = (offset_nanosec / kNsecPerMsec);
|
int offset = (offset_nanosec / kNsecPerMsec);
|
||||||
media_object_->seek(offset);
|
media_object_->seek(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhononEngine::SetVolumeSW(uint volume) {
|
void PhononEngine::SetVolumeSW(const uint volume) {
|
||||||
audio_output_->setVolume(volume);
|
audio_output_->setVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +143,7 @@ void PhononEngine::PhononFinished() {
|
|||||||
emit TrackEnded();
|
emit TrackEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhononEngine::PhononStateChanged(Phonon::State new_state) {
|
void PhononEngine::PhononStateChanged(const Phonon::State new_state) {
|
||||||
|
|
||||||
if (new_state == Phonon::ErrorState) {
|
if (new_state == Phonon::ErrorState) {
|
||||||
emit Error(media_object_->errorString());
|
emit Error(media_object_->errorString());
|
||||||
@@ -159,6 +170,7 @@ qint64 PhononEngine::position_nanosec() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 PhononEngine::length_nanosec() const {
|
qint64 PhononEngine::length_nanosec() const {
|
||||||
|
|
||||||
if (state() == Engine::Empty) return 0;
|
if (state() == Engine::Empty) return 0;
|
||||||
const qint64 result = end_nanosec_ - beginning_nanosec_;
|
const qint64 result = end_nanosec_ - beginning_nanosec_;
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
@@ -168,9 +180,11 @@ qint64 PhononEngine::length_nanosec() const {
|
|||||||
// Get the length from the pipeline if we don't know.
|
// Get the length from the pipeline if we don't know.
|
||||||
return (length() * kNsecPerMsec);
|
return (length() * kNsecPerMsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EngineBase::OutputDetailsList PhononEngine::GetOutputsList() const {
|
EngineBase::OutputDetailsList PhononEngine::GetOutputsList() const {
|
||||||
|
|
||||||
OutputDetailsList ret;
|
OutputDetailsList ret;
|
||||||
OutputDetails output;
|
OutputDetails output;
|
||||||
output.name = "none";
|
output.name = "none";
|
||||||
@@ -178,6 +192,7 @@ EngineBase::OutputDetailsList PhononEngine::GetOutputsList() const {
|
|||||||
output.iconname = "soundcard";
|
output.iconname = "soundcard";
|
||||||
ret << output;
|
ret << output;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::ValidOutput(const QString &output) {
|
bool PhononEngine::ValidOutput(const QString &output) {
|
||||||
@@ -187,9 +202,11 @@ bool PhononEngine::ValidOutput(const QString &output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::CustomDeviceSupport(const QString &output) {
|
bool PhononEngine::CustomDeviceSupport(const QString &output) {
|
||||||
|
Q_UNUSED(output);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhononEngine::ALSADeviceSupport(const QString &output) {
|
bool PhononEngine::ALSADeviceSupport(const QString &output) {
|
||||||
|
Q_UNUSED(output);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ class PhononEngine : public Engine::Base {
|
|||||||
|
|
||||||
bool CanDecode(const QUrl &url);
|
bool CanDecode(const QUrl &url);
|
||||||
|
|
||||||
bool Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
bool Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
bool Play(quint64 offset_nanosec);
|
bool Play(const quint64 offset_nanosec);
|
||||||
void Stop(bool stop_after = false);
|
void Stop(const bool stop_after = false);
|
||||||
void Pause();
|
void Pause();
|
||||||
void Unpause();
|
void Unpause();
|
||||||
|
|
||||||
@@ -59,22 +59,22 @@ class PhononEngine : public Engine::Base {
|
|||||||
uint position() const;
|
uint position() const;
|
||||||
uint length() const;
|
uint length() const;
|
||||||
|
|
||||||
void Seek(quint64 offset_nanosec);
|
void Seek(const quint64 offset_nanosec);
|
||||||
|
|
||||||
qint64 position_nanosec() const;
|
qint64 position_nanosec() const;
|
||||||
qint64 length_nanosec() const;
|
qint64 length_nanosec() const;
|
||||||
|
|
||||||
QString DefaultOutput() { return ""; }
|
QString DefaultOutput() { return QString(""); }
|
||||||
bool ValidOutput(const QString &output);
|
bool ValidOutput(const QString &output);
|
||||||
bool CustomDeviceSupport(const QString &output);
|
bool CustomDeviceSupport(const QString &output);
|
||||||
bool ALSADeviceSupport(const QString &output);
|
bool ALSADeviceSupport(const QString &output);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetVolumeSW( uint percent );
|
void SetVolumeSW(const uint percent );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void PhononFinished();
|
void PhononFinished();
|
||||||
void PhononStateChanged(Phonon::State new_state);
|
void PhononStateChanged(const Phonon::State new_state);
|
||||||
void StateTimeoutExpired();
|
void StateTimeoutExpired();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -117,7 +117,10 @@ retry:
|
|||||||
|
|
||||||
void PulseDeviceFinder::GetSinkInfoCallback(pa_context *c, const pa_sink_info *info, int eol, void *state_voidptr) {
|
void PulseDeviceFinder::GetSinkInfoCallback(pa_context *c, const pa_sink_info *info, int eol, void *state_voidptr) {
|
||||||
|
|
||||||
|
Q_UNUSED(c);
|
||||||
|
|
||||||
ListDevicesState *state = reinterpret_cast<ListDevicesState*>(state_voidptr);
|
ListDevicesState *state = reinterpret_cast<ListDevicesState*>(state_voidptr);
|
||||||
|
if (!state) return;
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
Device dev;
|
Device dev;
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ VLCEngine::VLCEngine(TaskManager *task_manager)
|
|||||||
player_(nullptr),
|
player_(nullptr),
|
||||||
state_(Engine::Empty) {
|
state_(Engine::Empty) {
|
||||||
|
|
||||||
|
Q_UNUSED(task_manager);
|
||||||
|
|
||||||
type_ = Engine::VLC;
|
type_ = Engine::VLC;
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
|
|
||||||
@@ -98,7 +100,13 @@ bool VLCEngine::Init() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VLCEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
|
bool VLCEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
|
Q_UNUSED(original_url);
|
||||||
|
Q_UNUSED(change);
|
||||||
|
Q_UNUSED(force_stop_at_end);
|
||||||
|
Q_UNUSED(beginning_nanosec);
|
||||||
|
Q_UNUSED(end_nanosec);
|
||||||
|
|
||||||
if (!Initialised()) return false;
|
if (!Initialised()) return false;
|
||||||
|
|
||||||
@@ -111,7 +119,7 @@ bool VLCEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::T
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VLCEngine::Play(quint64 offset_nanosec) {
|
bool VLCEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!Initialised()) return false;
|
if (!Initialised()) return false;
|
||||||
|
|
||||||
@@ -135,7 +143,9 @@ bool VLCEngine::Play(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::Stop(bool stop_after) {
|
void VLCEngine::Stop(const bool stop_after) {
|
||||||
|
|
||||||
|
Q_UNUSED(stop_after);
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialised()) return;
|
||||||
libvlc_media_player_stop(player_);
|
libvlc_media_player_stop(player_);
|
||||||
@@ -156,7 +166,7 @@ void VLCEngine::Unpause() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::Seek(quint64 offset_nanosec) {
|
void VLCEngine::Seek(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialised()) return;
|
||||||
|
|
||||||
@@ -171,7 +181,7 @@ void VLCEngine::Seek(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::SetVolumeSW(uint percent) {
|
void VLCEngine::SetVolumeSW(const uint percent) {
|
||||||
if (!Initialised()) return;
|
if (!Initialised()) return;
|
||||||
if (!volume_control_ && percent != 100) return;
|
if (!volume_control_ && percent != 100) return;
|
||||||
libvlc_audio_set_volume(player_, percent);
|
libvlc_audio_set_volume(player_, percent);
|
||||||
@@ -261,7 +271,7 @@ uint VLCEngine::length() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VLCEngine::CanDecode(const QUrl &url) { return true; }
|
bool VLCEngine::CanDecode(const QUrl &url) { Q_UNUSED(url); return true; }
|
||||||
|
|
||||||
void VLCEngine::AttachCallback(libvlc_event_manager_t *em, libvlc_event_type_t type, libvlc_callback_t callback) {
|
void VLCEngine::AttachCallback(libvlc_event_manager_t *em, libvlc_event_type_t type, libvlc_callback_t callback) {
|
||||||
|
|
||||||
@@ -336,7 +346,9 @@ EngineBase::PluginDetailsList VLCEngine::GetPluginList() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::GetDevicesList(QString output) const {
|
void VLCEngine::GetDevicesList(const QString &output) const {
|
||||||
|
|
||||||
|
Q_UNUSED(output);
|
||||||
|
|
||||||
libvlc_audio_output_device_t *audio_output_device_list = libvlc_audio_output_device_list_get(instance_, output_.toUtf8().constData());
|
libvlc_audio_output_device_t *audio_output_device_list = libvlc_audio_output_device_list_get(instance_, output_.toUtf8().constData());
|
||||||
for (libvlc_audio_output_device_t *audio_device = audio_output_device_list ; audio_device ; audio_device = audio_device->p_next) {
|
for (libvlc_audio_output_device_t *audio_device = audio_output_device_list ; audio_device ; audio_device = audio_device->p_next) {
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ class VLCEngine : public Engine::Base {
|
|||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
Engine::State state() const { return state_; }
|
Engine::State state() const { return state_; }
|
||||||
bool Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
|
bool Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
|
||||||
bool Play(quint64 offset_nanosec);
|
bool Play(const quint64 offset_nanosec);
|
||||||
void Stop(bool stop_after = false);
|
void Stop(const bool stop_after = false);
|
||||||
void Pause();
|
void Pause();
|
||||||
void Unpause();
|
void Unpause();
|
||||||
void Seek(quint64 offset_nanosec);
|
void Seek(const quint64 offset_nanosec);
|
||||||
protected:
|
protected:
|
||||||
void SetVolumeSW(uint percent);
|
void SetVolumeSW(const uint percent);
|
||||||
public:
|
public:
|
||||||
virtual qint64 position_nanosec() const;
|
virtual qint64 position_nanosec() const;
|
||||||
virtual qint64 length_nanosec() const;
|
virtual qint64 length_nanosec() const;
|
||||||
@@ -79,7 +79,7 @@ class VLCEngine : public Engine::Base {
|
|||||||
static void StateChangedCallback(const libvlc_event_t* e, void* data);
|
static void StateChangedCallback(const libvlc_event_t* e, void* data);
|
||||||
|
|
||||||
PluginDetailsList GetPluginList() const;
|
PluginDetailsList GetPluginList() const;
|
||||||
void GetDevicesList(QString output) const;
|
void GetDevicesList(const QString &output) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ class VlcScopedRef {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void VlcScopedRef_Release(T* ptr);
|
void VlcScopedRef_Release(T* ptr);
|
||||||
|
|
||||||
VLCSCOPEDREF_DEFINE2(instance, libvlc_release);
|
VLCSCOPEDREF_DEFINE2(instance, libvlc_release)
|
||||||
VLCSCOPEDREF_DEFINE(media_player);
|
VLCSCOPEDREF_DEFINE(media_player)
|
||||||
VLCSCOPEDREF_DEFINE(media);
|
VLCSCOPEDREF_DEFINE(media)
|
||||||
|
|
||||||
template <> void VlcScopedRef_Release<char>(char* ptr) { free(ptr); }
|
template <> void VlcScopedRef_Release<char>(char* ptr) { free(ptr); }
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ XineEngine::XineEngine(TaskManager *task_manager)
|
|||||||
preamp_(1.0),
|
preamp_(1.0),
|
||||||
have_metadata_(false) {
|
have_metadata_(false) {
|
||||||
|
|
||||||
|
Q_UNUSED(task_manager);
|
||||||
|
|
||||||
type_ = Engine::Xine;
|
type_ = Engine::Xine;
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
|
|
||||||
@@ -306,7 +308,7 @@ Engine::State XineEngine::state() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XineEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
|
bool XineEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
if (!EnsureStream()) return false;
|
if (!EnsureStream()) return false;
|
||||||
|
|
||||||
@@ -333,7 +335,7 @@ bool XineEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XineEngine::Play(quint64 offset_nanosec) {
|
bool XineEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!EnsureStream()) return false;
|
if (!EnsureStream()) return false;
|
||||||
|
|
||||||
@@ -354,7 +356,9 @@ bool XineEngine::Play(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XineEngine::Stop(bool stop_after) {
|
void XineEngine::Stop(const bool stop_after) {
|
||||||
|
|
||||||
|
Q_UNUSED(stop_after);
|
||||||
|
|
||||||
if (!stream_) return;
|
if (!stream_) return;
|
||||||
|
|
||||||
@@ -394,7 +398,7 @@ void XineEngine::Unpause() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XineEngine::Seek(quint64 offset_nanosec) {
|
void XineEngine::Seek(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!EnsureStream()) return;
|
if (!EnsureStream()) return;
|
||||||
|
|
||||||
@@ -409,7 +413,7 @@ void XineEngine::Seek(quint64 offset_nanosec) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XineEngine::SetVolumeSW(uint vol) {
|
void XineEngine::SetVolumeSW(const uint vol) {
|
||||||
|
|
||||||
if (!stream_) return;
|
if (!stream_) return;
|
||||||
if (!volume_control_ && vol != 100) return;
|
if (!volume_control_ && vol != 100) return;
|
||||||
@@ -582,7 +586,7 @@ bool XineEngine::CanDecode(const QUrl &url) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XineEngine::SetEqualizerEnabled(bool enabled) {
|
void XineEngine::SetEqualizerEnabled(const bool enabled) {
|
||||||
|
|
||||||
if (!stream_) return;
|
if (!stream_) return;
|
||||||
|
|
||||||
@@ -609,7 +613,7 @@ void XineEngine::SetEqualizerEnabled(bool enabled) {
|
|||||||
pre: (-100..100)
|
pre: (-100..100)
|
||||||
post: (1..200) - (1 = down, 100 = middle, 200 = up, 0 = off)
|
post: (1..200) - (1 = down, 100 = middle, 200 = up, 0 = off)
|
||||||
*/
|
*/
|
||||||
void XineEngine::SetEqualizerParameters(int preamp, const QList<int> &gains) {
|
void XineEngine::SetEqualizerParameters(const int preamp, const QList<int> &gains) {
|
||||||
|
|
||||||
if (!stream_) return;
|
if (!stream_) return;
|
||||||
|
|
||||||
@@ -902,7 +906,9 @@ void XineEngine::DetermineAndShowErrorMessage() {
|
|||||||
|
|
||||||
#ifdef XINE_ANALYZER
|
#ifdef XINE_ANALYZER
|
||||||
|
|
||||||
const Engine::Scope &XineEngine::scope(int chunk_length) {
|
const Engine::Scope &XineEngine::scope(const int chunk_length) {
|
||||||
|
|
||||||
|
Q_UNUSED(chunk_length);
|
||||||
|
|
||||||
if (!post_ || !stream_ || xine_get_status(stream_) != XINE_STATUS_PLAY)
|
if (!post_ || !stream_ || xine_get_status(stream_) != XINE_STATUS_PLAY)
|
||||||
return scope_;
|
return scope_;
|
||||||
|
|||||||
@@ -303,12 +303,16 @@ void Equalizer::Save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Equalizer::closeEvent(QCloseEvent *e) {
|
void Equalizer::closeEvent(QCloseEvent *e) {
|
||||||
|
|
||||||
|
Q_UNUSED(e);
|
||||||
|
|
||||||
QString name = ui_->preset->currentText();
|
QString name = ui_->preset->currentText();
|
||||||
if (!presets_.contains(name)) return;
|
if (!presets_.contains(name)) return;
|
||||||
|
|
||||||
if (presets_[name] == current_params()) return;
|
if (presets_[name] == current_params()) return;
|
||||||
|
|
||||||
SavePreset();
|
SavePreset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Equalizer::Params::Params() : preamp(0) {
|
Equalizer::Params::Params() : preamp(0) {
|
||||||
@@ -342,6 +346,7 @@ bool Equalizer::Params::operator !=(const Equalizer::Params& other) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Equalizer::StereoSliderChanged(int value) {
|
void Equalizer::StereoSliderChanged(int value) {
|
||||||
|
Q_UNUSED(value);
|
||||||
emit StereoBalanceChanged(stereo_balance());
|
emit StereoBalanceChanged(stereo_balance());
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class Equalizer : public QDialog {
|
|||||||
|
|
||||||
QMap<QString, Params> presets_;
|
QMap<QString, Params> presets_;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(Equalizer::Params);
|
Q_DECLARE_METATYPE(Equalizer::Params)
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &s, const Equalizer::Params &p);
|
QDataStream &operator<<(QDataStream &s, const Equalizer::Params &p);
|
||||||
QDataStream &operator>>(QDataStream &s, Equalizer::Params &p);
|
QDataStream &operator>>(QDataStream &s, Equalizer::Params &p);
|
||||||
|
|||||||
@@ -54,4 +54,4 @@ InternetCollectionViewContainer::InternetCollectionViewContainer(QWidget *parent
|
|||||||
|
|
||||||
InternetCollectionViewContainer::~InternetCollectionViewContainer() { delete ui_; }
|
InternetCollectionViewContainer::~InternetCollectionViewContainer() { delete ui_; }
|
||||||
|
|
||||||
void InternetCollectionViewContainer::contextMenuEvent(QContextMenuEvent *e) {}
|
void InternetCollectionViewContainer::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }
|
||||||
|
|||||||
@@ -221,6 +221,8 @@ int InternetSearch::LoadAlbumCoverAsync(const InternetSearch::Result &result) {
|
|||||||
|
|
||||||
void InternetSearch::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
void InternetSearch::AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||||
|
|
||||||
|
Q_UNUSED(cover_url);
|
||||||
|
|
||||||
if (!cover_loader_tasks_.contains(id)) return;
|
if (!cover_loader_tasks_.contains(id)) return;
|
||||||
int orig_id = cover_loader_tasks_.take(id);
|
int orig_id = cover_loader_tasks_.take(id);
|
||||||
|
|
||||||
|
|||||||
@@ -575,14 +575,17 @@ void InternetSearchView::SetGroupBy(const CollectionModel::Grouping &g) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InternetSearchView::SearchArtistsClicked(bool checked) {
|
void InternetSearchView::SearchArtistsClicked(bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
SetSearchType(InternetSearch::SearchType_Artists);
|
SetSearchType(InternetSearch::SearchType_Artists);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternetSearchView::SearchAlbumsClicked(bool checked) {
|
void InternetSearchView::SearchAlbumsClicked(bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
SetSearchType(InternetSearch::SearchType_Albums);
|
SetSearchType(InternetSearch::SearchType_Albums);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternetSearchView::SearchSongsClicked(bool checked) {
|
void InternetSearchView::SearchSongsClicked(bool checked) {
|
||||||
|
Q_UNUSED(checked);
|
||||||
SetSearchType(InternetSearch::SearchType_Songs);
|
SetSearchType(InternetSearch::SearchType_Songs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ class InternetService : public QObject {
|
|||||||
virtual void InitialLoadSettings() {}
|
virtual void InitialLoadSettings() {}
|
||||||
virtual void ReloadSettings() {}
|
virtual void ReloadSettings() {}
|
||||||
virtual QIcon Icon() { return Song::IconForSource(source_); }
|
virtual QIcon Icon() { return Song::IconForSource(source_); }
|
||||||
virtual const bool oauth() { return false; }
|
virtual bool oauth() { return false; }
|
||||||
virtual const bool authenticated() { return false; }
|
virtual bool authenticated() { return false; }
|
||||||
virtual int Search(const QString &query, InternetSearch::SearchType type) { return 0; }
|
virtual int Search(const QString &query, InternetSearch::SearchType type) { Q_UNUSED(query); Q_UNUSED(type); return 0; }
|
||||||
virtual void CancelSearch() {}
|
virtual void CancelSearch() {}
|
||||||
|
|
||||||
virtual CollectionBackend *artists_collection_backend() { return nullptr; }
|
virtual CollectionBackend *artists_collection_backend() { return nullptr; }
|
||||||
@@ -133,6 +133,6 @@ class InternetService : public QObject {
|
|||||||
QString url_scheme_;
|
QString url_scheme_;
|
||||||
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(InternetService*);
|
Q_DECLARE_METATYPE(InternetService*)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ InternetSongsView::~InternetSongsView() { delete ui_; }
|
|||||||
|
|
||||||
void InternetSongsView::ReloadSettings() {}
|
void InternetSongsView::ReloadSettings() {}
|
||||||
|
|
||||||
void InternetSongsView::contextMenuEvent(QContextMenuEvent *e) {}
|
void InternetSongsView::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }
|
||||||
|
|
||||||
void InternetSongsView::GetSongs() {
|
void InternetSongsView::GetSongs() {
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class InternetSongsView : public QWidget {
|
|||||||
private slots:
|
private slots:
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
void contextMenuEvent(QContextMenuEvent *e);
|
||||||
void GetSongs();
|
void GetSongs();
|
||||||
void AbortGetSongs();;
|
void AbortGetSongs();
|
||||||
void SongsFinished(const SongList &songs, const QString &error);
|
void SongsFinished(const SongList &songs, const QString &error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -177,8 +177,7 @@ InternetTabsView::~InternetTabsView() {
|
|||||||
|
|
||||||
void InternetTabsView::ReloadSettings() { ui_->search_view->ReloadSettings(); }
|
void InternetTabsView::ReloadSettings() { ui_->search_view->ReloadSettings(); }
|
||||||
|
|
||||||
void InternetTabsView::contextMenuEvent(QContextMenuEvent *e) {
|
void InternetTabsView::contextMenuEvent(QContextMenuEvent *e) { Q_UNUSED(e); }
|
||||||
}
|
|
||||||
|
|
||||||
void InternetTabsView::GetArtists() {
|
void InternetTabsView::GetArtists() {
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ void LocalRedirectServer::incomingConnection(qintptr socket_descriptor) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalRedirectServer::SSLErrors(const QList<QSslError> &errors) {}
|
void LocalRedirectServer::SSLErrors(const QList<QSslError> &errors) { Q_UNUSED(errors); }
|
||||||
|
|
||||||
void LocalRedirectServer::Encrypted() {}
|
void LocalRedirectServer::Encrypted() {}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ AuddLyricsProvider::AuddLyricsProvider(QObject *parent) : JsonLyricsProvider("Au
|
|||||||
|
|
||||||
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||||
|
|
||||||
|
Q_UNUSED(album);
|
||||||
|
|
||||||
const ParamList params = ParamList() << Param("api_token", QByteArray::fromBase64(kAPITokenB64))
|
const ParamList params = ParamList() << Param("api_token", QByteArray::fromBase64(kAPITokenB64))
|
||||||
<< Param("q", QString(artist + " " + title));
|
<< Param("q", QString(artist + " " + title));
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuddLyricsProvider::CancelSearch(quint64 id) {}
|
void AuddLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||||
|
|
||||||
@@ -164,7 +166,7 @@ QJsonArray AuddLyricsProvider::ExtractResult(QNetworkReply *reply, const quint64
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuddLyricsProvider::Error(const quint64 id, const QString &error, QVariant debug) {
|
void AuddLyricsProvider::Error(const quint64 id, const QString &error, const QVariant &debug) {
|
||||||
qLog(Error) << "AudDLyrics:" << error;
|
qLog(Error) << "AudDLyrics:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
emit SearchFinished(id, LyricsSearchResults());
|
emit SearchFinished(id, LyricsSearchResults());
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class AuddLyricsProvider : public JsonLyricsProvider {
|
|||||||
explicit AuddLyricsProvider(QObject *parent = nullptr);
|
explicit AuddLyricsProvider(QObject *parent = nullptr);
|
||||||
|
|
||||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id);
|
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id);
|
||||||
void CancelSearch(quint64 id);
|
void CancelSearch(const quint64 id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||||
@@ -50,7 +50,7 @@ class AuddLyricsProvider : public JsonLyricsProvider {
|
|||||||
static const char *kAPITokenB64;
|
static const char *kAPITokenB64;
|
||||||
static const int kMaxLength;
|
static const int kMaxLength;
|
||||||
QNetworkAccessManager *network_;
|
QNetworkAccessManager *network_;
|
||||||
void Error(const quint64 id, const QString &error, QVariant debug = QVariant());
|
void Error(const quint64 id, const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
QJsonArray ExtractResult(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
QJsonArray ExtractResult(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class JsonLyricsProvider : public LyricsProvider {
|
|||||||
QJsonObject ExtractJsonObj(QNetworkReply *reply, const quint64 id);
|
QJsonObject ExtractJsonObj(QNetworkReply *reply, const quint64 id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void Error(const quint64 id, const QString &error, QVariant debug = QVariant()) = 0;
|
virtual void Error(const quint64 id, const QString &error, const QVariant &debug = QVariant()) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ LoloLyricsProvider::LoloLyricsProvider(QObject *parent) : LyricsProvider("LoloLy
|
|||||||
|
|
||||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||||
|
|
||||||
|
Q_UNUSED(album);
|
||||||
|
|
||||||
const ParamList params = ParamList() << Param("artist", artist)
|
const ParamList params = ParamList() << Param("artist", artist)
|
||||||
<< Param("track", title);
|
<< Param("track", title);
|
||||||
|
|
||||||
@@ -66,7 +68,7 @@ bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoloLyricsProvider::CancelSearch(const quint64 id) {}
|
void LoloLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||||
|
|
||||||
@@ -132,7 +134,7 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoloLyricsProvider::Error(const quint64 id, const QString &error, QVariant debug) {
|
void LoloLyricsProvider::Error(const quint64 id, const QString &error, const QVariant &debug) {
|
||||||
|
|
||||||
qLog(Error) << "LoloLyrics:" << error;
|
qLog(Error) << "LoloLyrics:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class LoloLyricsProvider : public LyricsProvider {
|
|||||||
explicit LoloLyricsProvider(QObject *parent = nullptr);
|
explicit LoloLyricsProvider(QObject *parent = nullptr);
|
||||||
|
|
||||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id);
|
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id);
|
||||||
void CancelSearch(quint64 id);
|
void CancelSearch(const quint64 id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||||
@@ -49,7 +49,7 @@ class LoloLyricsProvider : public LyricsProvider {
|
|||||||
private:
|
private:
|
||||||
static const char *kUrlSearch;
|
static const char *kUrlSearch;
|
||||||
QNetworkAccessManager *network_;
|
QNetworkAccessManager *network_;
|
||||||
void Error(const quint64 id, const QString &error, QVariant debug = QVariant());
|
void Error(const quint64 id, const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ struct LyricsSearchResult {
|
|||||||
QString lyrics;
|
QString lyrics;
|
||||||
float score;
|
float score;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(LyricsSearchResult);
|
Q_DECLARE_METATYPE(LyricsSearchResult)
|
||||||
|
|
||||||
typedef QList<LyricsSearchResult> LyricsSearchResults;
|
typedef QList<LyricsSearchResult> LyricsSearchResults;
|
||||||
Q_DECLARE_METATYPE(QList<LyricsSearchResult>);
|
Q_DECLARE_METATYPE(QList<LyricsSearchResult>)
|
||||||
|
|
||||||
class LyricsFetcher : public QObject {
|
class LyricsFetcher : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class LyricsProvider : public QObject {
|
|||||||
QString name() const { return name_; }
|
QString name() const { return name_; }
|
||||||
|
|
||||||
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) = 0;
|
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) = 0;
|
||||||
virtual void CancelSearch(const quint64 id) {}
|
virtual void CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SearchFinished(const quint64 id, const LyricsSearchResults &results);
|
void SearchFinished(const quint64 id, const LyricsSearchResults &results);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class LyricsProviders : public QObject {
|
|||||||
void ProviderDestroyed();
|
void ProviderDestroyed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(LyricsProviders);
|
Q_DISABLE_COPY(LyricsProviders)
|
||||||
|
|
||||||
QMap<LyricsProvider *, QString> lyrics_providers_;
|
QMap<LyricsProvider *, QString> lyrics_providers_;
|
||||||
QMutex mutex_;
|
QMutex mutex_;
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ OVHLyricsProvider::OVHLyricsProvider(QObject *parent) : JsonLyricsProvider("Lyri
|
|||||||
|
|
||||||
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||||
|
|
||||||
|
Q_UNUSED(album);
|
||||||
|
|
||||||
QUrl url(kUrlSearch + QString(QUrl::toPercentEncoding(artist)) + "/" + QString(QUrl::toPercentEncoding(title)));
|
QUrl url(kUrlSearch + QString(QUrl::toPercentEncoding(artist)) + "/" + QString(QUrl::toPercentEncoding(title)));
|
||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
@@ -59,7 +61,7 @@ bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OVHLyricsProvider::CancelSearch(quint64 id) {}
|
void OVHLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||||
|
|
||||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OVHLyricsProvider::Error(const quint64 id, const QString &error, QVariant debug) {
|
void OVHLyricsProvider::Error(const quint64 id, const QString &error, const QVariant &debug) {
|
||||||
|
|
||||||
qLog(Error) << "OVHLyrics:" << error;
|
qLog(Error) << "OVHLyrics:" << error;
|
||||||
if (debug.isValid()) qLog(Debug) << debug;
|
if (debug.isValid()) qLog(Debug) << debug;
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
|||||||
public:
|
public:
|
||||||
explicit OVHLyricsProvider(QObject *parent = nullptr);
|
explicit OVHLyricsProvider(QObject *parent = nullptr);
|
||||||
|
|
||||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id);
|
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id);
|
||||||
void CancelSearch(quint64 id);
|
void CancelSearch(const quint64 id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||||
@@ -50,7 +50,7 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
|||||||
private:
|
private:
|
||||||
static const char *kUrlSearch;
|
static const char *kUrlSearch;
|
||||||
QNetworkAccessManager *network_;
|
QNetworkAccessManager *network_;
|
||||||
void Error(const quint64 id, const QString &error, QVariant debug = QVariant());
|
void Error(const quint64 id, const QString &error, const QVariant &debug = QVariant());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,10 @@ void MoodbarProxyStyle::NextState() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoodbarProxyStyle::FaderValueChanged(qreal value) { slider_->update(); }
|
void MoodbarProxyStyle::FaderValueChanged(qreal value) {
|
||||||
|
Q_UNUSED(value);
|
||||||
|
slider_->update();
|
||||||
|
}
|
||||||
|
|
||||||
bool MoodbarProxyStyle::eventFilter(QObject* object, QEvent* event) {
|
bool MoodbarProxyStyle::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
|
||||||
@@ -324,6 +327,8 @@ void MoodbarProxyStyle::DrawArrow(const QStyleOptionSlider* option, QPainter* pa
|
|||||||
|
|
||||||
QPixmap MoodbarProxyStyle::MoodbarPixmap(const ColorVector& colors, const QSize& size, const QPalette& palette, const QStyleOptionSlider* opt) {
|
QPixmap MoodbarProxyStyle::MoodbarPixmap(const ColorVector& colors, const QSize& size, const QPalette& palette, const QStyleOptionSlider* opt) {
|
||||||
|
|
||||||
|
Q_UNUSED(opt);
|
||||||
|
|
||||||
QRect rect(QPoint(0, 0), size);
|
QRect rect(QPoint(0, 0), size);
|
||||||
QRect border_rect(rect);
|
QRect border_rect(rect);
|
||||||
border_rect.adjust(kMarginSize, kMarginSize, -kMarginSize, -kMarginSize);
|
border_rect.adjust(kMarginSize, kMarginSize, -kMarginSize, -kMarginSize);
|
||||||
|
|||||||
@@ -333,6 +333,8 @@ void Organise::UpdateProgress() {
|
|||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
void Organise::FileTranscoded(const QString &input, const QString &output, bool success) {
|
void Organise::FileTranscoded(const QString &input, const QString &output, bool success) {
|
||||||
|
|
||||||
|
Q_UNUSED(output);
|
||||||
|
|
||||||
qLog(Info) << "File finished" << input << success;
|
qLog(Info) << "File finished" << input << success;
|
||||||
transcode_progress_timer_.stop();
|
transcode_progress_timer_.stop();
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ void Playlist::MoodbarUpdated(const QModelIndex& index) {
|
|||||||
|
|
||||||
bool Playlist::setData(const QModelIndex &index, const QVariant &value, int role) {
|
bool Playlist::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||||
|
|
||||||
|
Q_UNUSED(role);
|
||||||
|
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
PlaylistItemPtr item = item_at(row);
|
PlaylistItemPtr item = item_at(row);
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ class SortItems;
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef QMap<int, Qt::Alignment> ColumnAlignmentMap;
|
typedef QMap<int, Qt::Alignment> ColumnAlignmentMap;
|
||||||
Q_DECLARE_METATYPE(Qt::Alignment);
|
Q_DECLARE_METATYPE(Qt::Alignment)
|
||||||
Q_DECLARE_METATYPE(ColumnAlignmentMap);
|
Q_DECLARE_METATYPE(ColumnAlignmentMap)
|
||||||
|
|
||||||
// Objects that may prevent a song being added to the playlist.
|
// Objects that may prevent a song being added to the playlist.
|
||||||
// When there is something about to be inserted into it,
|
// When there is something about to be inserted into it,
|
||||||
@@ -198,7 +198,7 @@ class Playlist : public QAbstractListModel {
|
|||||||
void set_special_type(const QString &v) { special_type_ = v; }
|
void set_special_type(const QString &v) { special_type_ = v; }
|
||||||
|
|
||||||
const PlaylistItemPtr &item_at(int index) const { return items_[index]; }
|
const PlaylistItemPtr &item_at(int index) const { return items_[index]; }
|
||||||
const bool has_item_at(int index) const { return index >= 0 && index < rowCount(); }
|
bool has_item_at(int index) const { return index >= 0 && index < rowCount(); }
|
||||||
|
|
||||||
PlaylistItemPtr current_item() const;
|
PlaylistItemPtr current_item() const;
|
||||||
|
|
||||||
|
|||||||
@@ -319,6 +319,8 @@ QString SizeItemDelegate::displayText(const QVariant &value, const QLocale&) con
|
|||||||
|
|
||||||
QString DateItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
|
QString DateItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
|
||||||
|
|
||||||
|
Q_UNUSED(locale);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int time = value.toInt(&ok);
|
int time = value.toInt(&ok);
|
||||||
|
|
||||||
@@ -343,6 +345,8 @@ QString LastPlayedItemDelegate::displayText(const QVariant &value, const QLocale
|
|||||||
|
|
||||||
QString FileTypeItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
|
QString FileTypeItemDelegate::displayText(const QVariant &value, const QLocale &locale) const {
|
||||||
|
|
||||||
|
Q_UNUSED(locale);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
Song::FileType type = Song::FileType(value.toInt(&ok));
|
Song::FileType type = Song::FileType(value.toInt(&ok));
|
||||||
|
|
||||||
@@ -352,7 +356,9 @@ QString FileTypeItemDelegate::displayText(const QVariant &value, const QLocale &
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *TextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
QWidget *TextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &idx) const {
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(idx);
|
||||||
return new QLineEdit(parent);
|
return new QLineEdit(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,6 +452,7 @@ QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLoca
|
|||||||
SongSourceDelegate::SongSourceDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
|
SongSourceDelegate::SongSourceDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
|
||||||
|
|
||||||
QString SongSourceDelegate::displayText(const QVariant &value, const QLocale&) const {
|
QString SongSourceDelegate::displayText(const QVariant &value, const QLocale&) const {
|
||||||
|
Q_UNUSED(value);
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class FilterTree {
|
|||||||
// trivial filter that accepts *anything*
|
// trivial filter that accepts *anything*
|
||||||
class NopFilter : public FilterTree {
|
class NopFilter : public FilterTree {
|
||||||
public:
|
public:
|
||||||
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const { return true; }
|
virtual bool accept(int row, const QModelIndex &parent, const QAbstractItemModel *const model) const { Q_UNUSED(row); Q_UNUSED(parent); Q_UNUSED(model); return true; }
|
||||||
virtual FilterType type() { return Nop; }
|
virtual FilterType type() { return Nop; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user