summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2020-04-19 11:00:02 +0200
committerAndrej Shadura <andrew.shadura@collabora.co.uk>2020-04-19 11:00:02 +0200
commit692e728c39bdf1514def23e83b2c40250f68ee98 (patch)
tree7afc7bbd31e560d6fc65a905c3ca0624643f7284 /src
parentb58a71636eb07843032e644211285b282a307d97 (diff)
New upstream version 4.0.2
Diffstat (limited to 'src')
-rw-r--r--src/libaudcore/eventqueue.cc25
-rw-r--r--src/libaudcore/internal.h2
-rw-r--r--src/libaudcore/playlist.cc36
-rw-r--r--src/libaudcore/plugin-registry.cc2
-rw-r--r--src/libaudcore/tuple.cc3
-rw-r--r--src/libaudcore/vfs.cc2
-rw-r--r--src/libaudqt/Makefile2
-rw-r--r--src/libaudqt/queue-manager-qt.cc1
-rw-r--r--src/libaudqt/treeview.cc31
-rw-r--r--src/libaudtag/id3/id3v24.cc2
10 files changed, 81 insertions, 25 deletions
diff --git a/src/libaudcore/eventqueue.cc b/src/libaudcore/eventqueue.cc
index d084dc1..767cf1a 100644
--- a/src/libaudcore/eventqueue.cc
+++ b/src/libaudcore/eventqueue.cc
@@ -46,6 +46,7 @@ struct Event : public ListNode
};
static aud::mutex mutex;
+static bool paused;
static List<Event> events;
static QueuedFunc queued_events;
@@ -54,7 +55,7 @@ static void events_execute(void *)
auto mh = mutex.take();
Event * event;
- while ((event = events.head()))
+ while (!paused && (event = events.head()))
{
events.remove(event);
@@ -72,7 +73,7 @@ EXPORT void event_queue(const char * name, void * data,
{
auto mh = mutex.take();
- if (!events.head())
+ if (!paused && !events.head())
queued_events.queue(events_execute, nullptr);
events.append(new Event(name, data, destroy));
@@ -97,6 +98,26 @@ EXPORT void event_queue_cancel(const char * name, void * data)
}
}
+// this is only for use by the playlist, to ensure that queued playlist
+// updates are processed before generic events
+void event_queue_pause()
+{
+ auto mh = mutex.take();
+ if (!paused)
+ queued_events.stop();
+
+ paused = true;
+}
+
+void event_queue_unpause()
+{
+ auto mh = mutex.take();
+ if (paused && events.head())
+ queued_events.queue(events_execute, nullptr);
+
+ paused = false;
+}
+
void event_queue_cancel_all()
{
auto mh = mutex.take();
diff --git a/src/libaudcore/internal.h b/src/libaudcore/internal.h
index 2a79bef..29aebcb 100644
--- a/src/libaudcore/internal.h
+++ b/src/libaudcore/internal.h
@@ -77,6 +77,8 @@ void eq_set_format(int new_channels, int new_rate);
void eq_filter(float * data, int samples);
/* eventqueue.cc */
+void event_queue_pause();
+void event_queue_unpause();
void event_queue_cancel_all();
/* fft.cc */
diff --git a/src/libaudcore/playlist.cc b/src/libaudcore/playlist.cc
index d7543c9..02190f3 100644
--- a/src/libaudcore/playlist.cc
+++ b/src/libaudcore/playlist.cc
@@ -189,6 +189,7 @@ static void update(void *)
update_hooks = 0;
update_level = Playlist::NoUpdate;
update_state = UpdateState::None;
+ event_queue_unpause();
mh.unlock();
@@ -208,6 +209,16 @@ static void update(void *)
hook_call("playback stop", nullptr);
}
+static void queue_update()
+{
+ if (update_state < UpdateState::Queued)
+ {
+ event_queue_pause(); // give playlist updates priority
+ queued_update.queue(update, nullptr);
+ update_state = UpdateState::Queued;
+ }
+}
+
static void queue_update_hooks(int hooks)
{
if ((hooks & PlaybackBegin))
@@ -216,12 +227,7 @@ static void queue_update_hooks(int hooks)
update_hooks &= ~PlaybackBegin;
update_hooks |= hooks;
-
- if (update_state < UpdateState::Queued)
- {
- queued_update.queue(update, nullptr);
- update_state = UpdateState::Queued;
- }
+ queue_update();
}
static void queue_global_update(Playlist::UpdateLevel level, int flags = 0)
@@ -239,11 +245,7 @@ static void queue_global_update(Playlist::UpdateLevel level, int flags = 0)
}
else
{
- if (update_state < UpdateState::Queued)
- {
- queued_update.queue(update, nullptr);
- update_state = UpdateState::Queued;
- }
+ queue_update();
}
update_level = aud::max(update_level, level);
@@ -325,10 +327,7 @@ static void scan_check_complete(PlaylistData * playlist)
playlist->scan_status = PlaylistData::NotScanning;
if (update_state == UpdateState::Delayed)
- {
- queued_update.queue(update, nullptr);
- update_state = UpdateState::Queued;
- }
+ queue_update();
event_queue_cancel("playlist scan complete");
event_queue("playlist scan complete", nullptr);
@@ -497,11 +496,7 @@ void pl_signal_entry_deleted(PlaylistEntry * entry) { scan_cancel(entry); }
void pl_signal_position_changed(Playlist::ID * id)
{
- if (update_state < UpdateState::Queued)
- {
- queued_update.queue(update, nullptr);
- update_state = UpdateState::Queued;
- }
+ queue_update();
if (id == playing_id)
{
@@ -615,6 +610,7 @@ void playlist_clear_updates()
update_level = Playlist::NoUpdate;
update_hooks = 0;
update_state = UpdateState::None;
+ event_queue_unpause();
}
void playlist_end()
diff --git a/src/libaudcore/plugin-registry.cc b/src/libaudcore/plugin-registry.cc
index b5e8167..47ce8dc 100644
--- a/src/libaudcore/plugin-registry.cc
+++ b/src/libaudcore/plugin-registry.cc
@@ -754,7 +754,7 @@ EXPORT Index<const char *> aud_plugin_get_supported_mime_types()
if (!aud_plugin_get_enabled(p))
continue;
- for (auto k : p->keys[InputKey::MIME])
+ for (auto & k : p->keys[InputKey::MIME])
mimes.append((const char *)k);
}
diff --git a/src/libaudcore/tuple.cc b/src/libaudcore/tuple.cc
index 02dde50..f699e7d 100644
--- a/src/libaudcore/tuple.cc
+++ b/src/libaudcore/tuple.cc
@@ -746,6 +746,7 @@ EXPORT void Tuple::generate_fallbacks()
auto artist = get_str(Artist);
auto album = get_str(Album);
+ auto genre = get_str(Genre);
if (artist && album)
return;
@@ -814,7 +815,7 @@ EXPORT void Tuple::generate_fallbacks()
// skip common strings and avoid duplicates
for (auto skip :
- (const char *[]){"~", "music", artist, album, get_str(Genre)})
+ (const char *[]){"~", "music", artist, album, genre})
{
if (first && skip && !strcmp_nocase(first, skip))
{
diff --git a/src/libaudcore/vfs.cc b/src/libaudcore/vfs.cc
index 2005e54..576e3b2 100644
--- a/src/libaudcore/vfs.cc
+++ b/src/libaudcore/vfs.cc
@@ -438,7 +438,7 @@ EXPORT Index<const char *> VFSFile::supported_uri_schemes()
if (!aud_plugin_get_enabled(plugin))
continue;
- for (auto s : transport_plugin_get_schemes(plugin))
+ for (auto & s : transport_plugin_get_schemes(plugin))
schemes.append((const char *)s);
}
diff --git a/src/libaudqt/Makefile b/src/libaudqt/Makefile
index bd3ef16..2a13170 100644
--- a/src/libaudqt/Makefile
+++ b/src/libaudqt/Makefile
@@ -38,6 +38,8 @@ INCLUDES = colorbutton.h \
menu.h \
treeview.h
+CLEAN = images.cc
+
include ../../buildsys.mk
include ../../extra.mk
diff --git a/src/libaudqt/queue-manager-qt.cc b/src/libaudqt/queue-manager-qt.cc
index da6e646..8c5176b 100644
--- a/src/libaudqt/queue-manager-qt.cc
+++ b/src/libaudqt/queue-manager-qt.cc
@@ -172,6 +172,7 @@ QueueManagerDialog::QueueManagerDialog(QWidget * parent) : QDialog(parent)
layout->addWidget(&m_treeview);
layout->addWidget(&m_buttonbox);
+ m_treeview.setAllColumnsShowFocus(true);
m_treeview.setIndentation(0);
m_treeview.setModel(&m_model);
m_treeview.setSelectionMode(QAbstractItemView::ExtendedSelection);
diff --git a/src/libaudqt/treeview.cc b/src/libaudqt/treeview.cc
index 4e8bfaf..188175d 100644
--- a/src/libaudqt/treeview.cc
+++ b/src/libaudqt/treeview.cc
@@ -21,13 +21,44 @@
#include <QKeyEvent>
#include <QMouseEvent>
+#include <QProxyStyle>
+
#include <libaudcore/index.h>
namespace audqt
{
+/*
+ * On some platforms (mainly KDE), there is a feature where
+ * clicking on icons makes them work like hyperlinks. Unfortunately,
+ * the way this is implemented is by making all QAbstractItemView
+ * widgets behave in this way.
+ *
+ * In all situations, it makes no sense for audqt::TreeView
+ * widgets to behave in this way. So we override that feature
+ * with a QProxyStyle.
+ */
+class TreeViewStyleOverrides : public QProxyStyle
+{
+public:
+ int styleHint(StyleHint hint,
+ const QStyleOption * option = nullptr,
+ const QWidget * widget = nullptr,
+ QStyleHintReturn * returnData = nullptr) const override
+ {
+ if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick)
+ return 0;
+
+ return QProxyStyle::styleHint(hint, option, widget, returnData);
+ }
+};
+
EXPORT TreeView::TreeView(QWidget * parent) : QTreeView(parent)
{
+ auto style = new TreeViewStyleOverrides;
+ connect(this, &QObject::destroyed, [style]() { delete style; });
+ setStyle(style);
+
// activate() is perhaps a bit redundant with activated()
connect(this, &QTreeView::activated, this, &TreeView::activate);
}
diff --git a/src/libaudtag/id3/id3v24.cc b/src/libaudtag/id3/id3v24.cc
index 2dda167..be558c9 100644
--- a/src/libaudtag/id3/id3v24.cc
+++ b/src/libaudtag/id3/id3v24.cc
@@ -650,6 +650,8 @@ bool ID3v24TagModule::write_tag (VFSFile & f, const Tuple & tuple)
add_frameFromTupleStr (tuple, Tuple::Artist, ID3_ARTIST, dict);
add_frameFromTupleStr (tuple, Tuple::Album, ID3_ALBUM, dict);
add_frameFromTupleStr (tuple, Tuple::AlbumArtist, ID3_ALBUM_ARTIST, dict);
+ add_frameFromTupleStr (tuple, Tuple::Composer, ID3_COMPOSER, dict);
+ add_frameFromTupleStr (tuple, Tuple::Copyright, ID3_COPYRIGHT, dict);
add_frameFromTupleInt (tuple, Tuple::Year, ID3_YEAR, dict);
add_frameFromTupleInt (tuple, Tuple::Track, ID3_TRACKNR, dict);
add_frameFromTupleStr (tuple, Tuple::Genre, ID3_GENRE, dict);