Split slide tag across lines

This commit is contained in:
Gary Talent 2024-10-24 21:27:40 -05:00
parent a0a1cd8af1
commit 0db9bff0de
3 changed files with 10 additions and 7 deletions

View File

@ -191,11 +191,11 @@ void OpenLPClient::handleSlideListResponse(QNetworkReply *reply) {
auto doc = QJsonDocument::fromJson(data); auto doc = QJsonDocument::fromJson(data);
auto items = doc.object()["results"].toObject()["slides"].toArray(); auto items = doc.object()["results"].toObject()["slides"].toArray();
for (auto const&item : items) { for (auto const&item : items) {
auto slide = item.toObject(); auto const slide = item.toObject();
auto text = slide["text"].toString(); auto text = slide["text"].toString();
auto tag = slide["tag"].toString(); auto tag = slide["tag"].toString();
slideList.push_back(text); slideList.push_back(std::move(text));
tagList.push_back(tag); tagList.push_back(std::move(tag));
} }
emit slideListUpdate(tagList, slideList); emit slideListUpdate(tagList, slideList);
} }

View File

@ -43,7 +43,7 @@ QString SlideView::getNextSong() const {
} }
void SlideView::pollUpdate(QString const&songName, int slide) { 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()) { if (songItems.empty()) {
return; 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_currentSlide = 0;
m_slideTable->setRowCount(static_cast<int>(slideList.size())); m_slideTable->setRowCount(static_cast<int>(slideList.size()));
for (int i = 0; i < slideList.size(); ++i) { for (int i = 0; i < slideList.size(); ++i) {

View File

@ -28,7 +28,7 @@ class SlideView: public QWidget {
void songListUpdate(QStringList const&songList); void songListUpdate(QStringList const&songList);
void slideListUpdate(QStringList const&tagList, QStringList const&songList); void slideListUpdate(QStringList tagList, QStringList const&songList);
void reset(); void reset();