From d62c71b14f43a3f5e02fa905c4e343354f7a3a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Tue, 8 Nov 2022 21:12:41 +0100 Subject: [PATCH 1/3] Do not allow construction of tags with no name --- src/qtgui/bookmarks.cpp | 3 +-- src/qtgui/bookmarks.h | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/qtgui/bookmarks.cpp b/src/qtgui/bookmarks.cpp index c57ba7442..227daafea 100644 --- a/src/qtgui/bookmarks.cpp +++ b/src/qtgui/bookmarks.cpp @@ -245,8 +245,7 @@ TagInfo &Bookmarks::findOrAddTag(QString tagName) if (idx != -1) return m_TagList[idx]; - TagInfo info; - info.name=tagName; + TagInfo info(tagName); m_TagList.append(info); emit TagListChanged(); return m_TagList.last(); diff --git a/src/qtgui/bookmarks.h b/src/qtgui/bookmarks.h index cfb795e3a..ed9491991 100644 --- a/src/qtgui/bookmarks.h +++ b/src/qtgui/bookmarks.h @@ -40,11 +40,6 @@ struct TagInfo static const QColor DefaultColor; static const QString strUntagged; - TagInfo() - { - active=true; - this->color=DefaultColor; - } TagInfo(QString name) { active=true; From eb079e31d846c4117cf65fe77e55f291fed40f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Tue, 8 Nov 2022 21:14:18 +0100 Subject: [PATCH 2/3] Do not convert tag back and forth between pointer and reference --- src/qtgui/bookmarks.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qtgui/bookmarks.cpp b/src/qtgui/bookmarks.cpp index 227daafea..d1a925613 100644 --- a/src/qtgui/bookmarks.cpp +++ b/src/qtgui/bookmarks.cpp @@ -164,8 +164,7 @@ bool Bookmarks::save() BookmarkInfo& info = m_BookmarkList[iBookmark]; for(int iTag = 0; iTag < info.tags.size(); ++iTag) { - TagInfo& tag = *info.tags[iTag]; - usedTags.insert(&tag); + usedTags.insert(info.tags[iTag]); } } From 70c38d4f83712ce2c7f38c7f182ae78cb122cefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Tue, 8 Nov 2022 23:03:29 +0100 Subject: [PATCH 3/3] Ensure tags are not duplicates during bookmark load Duplicates can be introduced in several ways. User can add duplicate tag now, but it seems tath past and current GQRX contains some bugs related to bookmarks/tags and the saved content is sometimes crappy. --- src/qtgui/bookmarks.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qtgui/bookmarks.cpp b/src/qtgui/bookmarks.cpp index d1a925613..05ddf1d9c 100644 --- a/src/qtgui/bookmarks.cpp +++ b/src/qtgui/bookmarks.cpp @@ -127,7 +127,10 @@ bool Bookmarks::load() QStringList TagList = strTags.split(","); for(int iTag=0; iTag