From 0db9bff0dee215bf09d9d87d719725269eb3fbcf Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 24 Oct 2024 21:27:40 -0500 Subject: [PATCH] Split slide tag across lines --- src/openlpclient.cpp | 8 ++++---- src/slideview.cpp | 7 +++++-- src/slideview.hpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/openlpclient.cpp b/src/openlpclient.cpp index 7207964..b67a20c 100644 --- a/src/openlpclient.cpp +++ b/src/openlpclient.cpp @@ -190,12 +190,12 @@ void OpenLPClient::handleSlideListResponse(QNetworkReply *reply) { QStringList tagList; auto doc = QJsonDocument::fromJson(data); auto items = doc.object()["results"].toObject()["slides"].toArray(); - for (auto const &item : items) { - auto slide = item.toObject(); + for (auto const&item : items) { + auto const slide = item.toObject(); auto text = slide["text"].toString(); auto tag = slide["tag"].toString(); - slideList.push_back(text); - tagList.push_back(tag); + slideList.push_back(std::move(text)); + tagList.push_back(std::move(tag)); } emit slideListUpdate(tagList, slideList); } diff --git a/src/slideview.cpp b/src/slideview.cpp index 6d4ec93..b0d9147 100644 --- a/src/slideview.cpp +++ b/src/slideview.cpp @@ -43,7 +43,7 @@ QString SlideView::getNextSong() const { } void SlideView::pollUpdate(QString const&songName, int slide) { - auto songItems = m_songSelector->findItems(songName, Qt::MatchFixedString); + auto const songItems = m_songSelector->findItems(songName, Qt::MatchFixedString); if (songItems.empty()) { return; } @@ -68,7 +68,10 @@ void SlideView::changeSong(int song) { } } -void SlideView::slideListUpdate(QStringList const&tagList, QStringList const&slideList) { +void SlideView::slideListUpdate(QStringList tagList, QStringList const&slideList) { + for (auto &tag : tagList) { + tag = tag.split("").join("\n"); + } m_currentSlide = 0; m_slideTable->setRowCount(static_cast(slideList.size())); for (int i = 0; i < slideList.size(); ++i) { diff --git a/src/slideview.hpp b/src/slideview.hpp index d9003ac..1fce43e 100644 --- a/src/slideview.hpp +++ b/src/slideview.hpp @@ -28,7 +28,7 @@ class SlideView: public QWidget { void songListUpdate(QStringList const&songList); - void slideListUpdate(QStringList const&tagList, QStringList const&songList); + void slideListUpdate(QStringList tagList, QStringList const&songList); void reset();