Merge branch 'master' into multiple_apis

This commit is contained in:
Luca Beltrame 2015-08-10 17:09:52 +02:00
commit e764ba2c9d
4 changed files with 31 additions and 6 deletions

View file

@ -1,9 +1,9 @@
[Desktop Entry] [Desktop Entry]
Name=Danbooru Client Name=Danbooru Client
Exec=danbooru-client Exec=danbooru_client
Icon=danbooru_client Icon=danbooru_client
Type=Application Type=Application
X-DocPath=danbooru-client/index.html X-DocPath=danbooru-client/index.html
GenericName=A KF5-based client for Danbooru-style image boards GenericName=A KF5-based client for Danbooru-style image boards
Terminal=false Terminal=false
Categories=Graphics;Viewer Categories=Graphics;Viewer

View file

@ -29,6 +29,9 @@ DanbooruSearchWidget::DanbooruSearchWidget(QWidget *parent): QWidget(parent)
{ {
setupUi(this); 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(searchButton, &QPushButton::clicked, this, &DanbooruSearchWidget::accept);
connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept); connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept);
connect(closeButton, &QPushButton::clicked, [this]() { connect(closeButton, &QPushButton::clicked, [this]() {
@ -49,10 +52,6 @@ QStringList DanbooruSearchWidget::selectedTags() const
void DanbooruSearchWidget::accept() void DanbooruSearchWidget::accept()
{ {
if (tagLineEdit->text().isEmpty()) {
return;
}
m_tags = tagLineEdit->text().split(","); m_tags = tagLineEdit->text().split(",");
Q_EMIT(accepted()); Q_EMIT(accepted());
} }

View file

@ -428,6 +428,12 @@ void DanbooruService::processPostList(KJob *job)
// How many posts do we have to fetch? // How many posts do we have to fetch?
if (postList.isEmpty()) {
qCDebug(LIBDANBOORU) << "No posts found";
Q_EMIT(postDownloadFinished());
return;
}
m_postsToFetch = postList.length(); m_postsToFetch = postList.length();
for (auto element : postList) { for (auto element : postList) {

View file

@ -49,11 +49,17 @@ Rectangle {
} }
onDownloadFinished: { onDownloadFinished: {
grid.opacity = 1 grid.opacity = 1
runningIndicator.running = false runningIndicator.running = false
if (danbooruModel.rowCount() == 0) {
warnLabel.visible = true
}
} }
onDownloadStarted: { onDownloadStarted: {
warnLabel.visible = false
grid.opacity = 0.5 grid.opacity = 0.5
runningIndicator.running = true runningIndicator.running = true
} }
@ -68,6 +74,20 @@ Rectangle {
running: false 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 { Component {
id: highlight id: highlight
Rectangle { Rectangle {