From ef46a379a06775a5328ced0d4b2636e2fbe322e5 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sun, 31 May 2015 17:07:05 +0200 Subject: [PATCH 1/4] Fix typo in .desktop file --- src/danbooru_client.desktop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/danbooru_client.desktop b/src/danbooru_client.desktop index b5209b5..80e8f67 100644 --- a/src/danbooru_client.desktop +++ b/src/danbooru_client.desktop @@ -1,9 +1,9 @@ [Desktop Entry] Name=Danbooru Client -Exec=danbooru-client +Exec=danbooru_client Icon=danbooru_client Type=Application X-DocPath=danbooru-client/index.html GenericName=A KF5-based client for Danbooru-style image boards Terminal=false -Categories=Graphics;Viewer \ No newline at end of file +Categories=Graphics;Viewer From 4550f54f321951662f5ca1d6dbaf90a8728d634f Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Mon, 10 Aug 2015 12:40:55 +0200 Subject: [PATCH 2/4] Return gracefully if posts are not found This fixes the spinner going on forever when non-existent tags are added. --- src/libdanbooru/danbooruservice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libdanbooru/danbooruservice.cpp b/src/libdanbooru/danbooruservice.cpp index fdab09e..db0c316 100644 --- a/src/libdanbooru/danbooruservice.cpp +++ b/src/libdanbooru/danbooruservice.cpp @@ -428,6 +428,12 @@ void DanbooruService::processPostList(KJob *job) // How many posts do we have to fetch? + if (postList.isEmpty()) { + qCDebug(LIBDANBOORU) << "No posts found"; + Q_EMIT(postDownloadFinished()); + return; + } + m_postsToFetch = postList.length(); for (auto element : postList) { From c740558ca48c514182e0f2fc66cb77802ed9cded Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Mon, 10 Aug 2015 12:41:35 +0200 Subject: [PATCH 3/4] Support pressing Return to search all posts Add a placeholder text and a tool tip to clarify this. --- src/danboorusearchwidget.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/danboorusearchwidget.cpp b/src/danboorusearchwidget.cpp index 371829f..124f66f 100644 --- a/src/danboorusearchwidget.cpp +++ b/src/danboorusearchwidget.cpp @@ -29,6 +29,9 @@ DanbooruSearchWidget::DanbooruSearchWidget(QWidget *parent): QWidget(parent) { setupUi(this); + tagLineEdit->setPlaceholderText(i18n("Type search tags.")); + tagLineEdit->setToolTip(i18n("Type search tags. An empty string searches all posts.")); + connect(searchButton, &QPushButton::clicked, this, &DanbooruSearchWidget::accept); connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept); connect(closeButton, &QPushButton::clicked, [this]() { @@ -49,10 +52,6 @@ QStringList DanbooruSearchWidget::selectedTags() const void DanbooruSearchWidget::accept() { - if (tagLineEdit->text().isEmpty()) { - return; - } - m_tags = tagLineEdit->text().split(","); Q_EMIT(accepted()); } From b5153b00b12bb286ba9433a5c4eea1c15144a230 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Mon, 10 Aug 2015 12:42:17 +0200 Subject: [PATCH 4/4] Show a label when no posts are found --- src/qml/danbooruimageview.qml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/qml/danbooruimageview.qml b/src/qml/danbooruimageview.qml index 216d81a..1d32e36 100644 --- a/src/qml/danbooruimageview.qml +++ b/src/qml/danbooruimageview.qml @@ -48,11 +48,17 @@ Rectangle { } onDownloadFinished: { + grid.opacity = 1 runningIndicator.running = false + + if (danbooruModel.rowCount() == 0) { + warnLabel.visible = true + } } onDownloadStarted: { + warnLabel.visible = false grid.opacity = 0.5 runningIndicator.running = true } @@ -67,6 +73,20 @@ Rectangle { running: false } + Label { + id: warnLabel + z: 1 + width: grid.cellWidth / 2 + height: grid.cellHeight / 2 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + visible: false + text: "No posts found." + color: black + + + } + Component { id: highlight Rectangle {