Use kdelibs coding style
This commit is contained in:
parent
0084798a2c
commit
d965371d23
31 changed files with 201 additions and 234 deletions
|
@ -20,7 +20,8 @@
|
||||||
#include "blacklistpage.h"
|
#include "blacklistpage.h"
|
||||||
#include "danboorusettings.h"
|
#include "danboorusettings.h"
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
BlacklistPage::BlacklistPage(DanbooruSettings *preferences, QWidget *parent): QWidget(parent)
|
BlacklistPage::BlacklistPage(DanbooruSettings *preferences, QWidget *parent): QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -29,10 +30,8 @@ BlacklistPage::BlacklistPage(DanbooruSettings *preferences, QWidget *parent): QW
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BlacklistPage::~BlacklistPage()
|
BlacklistPage::~BlacklistPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
|
@ -22,11 +22,13 @@
|
||||||
|
|
||||||
#include "ui_blacklistpage.h"
|
#include "ui_blacklistpage.h"
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruSettings;
|
class DanbooruSettings;
|
||||||
|
|
||||||
class BlacklistPage: public QWidget, public Ui::BlacklistPage {
|
class BlacklistPage: public QWidget, public Ui::BlacklistPage
|
||||||
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -36,8 +38,6 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,4 +20,3 @@
|
||||||
#include "danbooru_client_debug.h"
|
#include "danbooru_client_debug.h"
|
||||||
Q_LOGGING_CATEGORY(DANBOORU_CLIENT, "org.dennogumi.danbooru_client")
|
Q_LOGGING_CATEGORY(DANBOORU_CLIENT, "org.dennogumi.danbooru_client")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,9 @@ DanbooruConnectWidget::DanbooruConnectWidget(QVector< QUrl > urlList,
|
||||||
connect(anonCheckBox, &QCheckBox::stateChanged, this, &DanbooruConnectWidget::toggleLineEdits);
|
connect(anonCheckBox, &QCheckBox::stateChanged, this, &DanbooruConnectWidget::toggleLineEdits);
|
||||||
|
|
||||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &DanbooruConnectWidget::accept);
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &DanbooruConnectWidget::accept);
|
||||||
connect(closeButton, &QPushButton::clicked, [this]() {Q_EMIT(rejected());} );
|
connect(closeButton, &QPushButton::clicked, [this]() {
|
||||||
|
Q_EMIT(rejected());
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +157,8 @@ void DanbooruConnectWidget::toggleLineEdits(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruConnectWidget::setBoards(const QVector<QUrl> &urlList) {
|
void DanbooruConnectWidget::setBoards(const QVector<QUrl> &urlList)
|
||||||
|
{
|
||||||
|
|
||||||
danbooruUrlComboBox->clear();
|
danbooruUrlComboBox->clear();
|
||||||
|
|
||||||
|
@ -212,7 +215,8 @@ void DanbooruConnectWidget::accept()
|
||||||
Q_EMIT(accepted());
|
Q_EMIT(accepted());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DanbooruConnectWidget::isAnonymous() const {
|
bool DanbooruConnectWidget::isAnonymous() const
|
||||||
|
{
|
||||||
|
|
||||||
return anonCheckBox->isChecked();
|
return anonCheckBox->isChecked();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
DanbooruSearchWidget::DanbooruSearchWidget(QWidget *parent): QWidget(parent)
|
DanbooruSearchWidget::DanbooruSearchWidget(QWidget *parent): QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +31,9 @@ DanbooruSearchWidget::DanbooruSearchWidget(QWidget* parent): QWidget(parent)
|
||||||
|
|
||||||
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]() { Q_EMIT(rejected()); });
|
connect(closeButton, &QPushButton::clicked, [this]() {
|
||||||
|
Q_EMIT(rejected());
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +46,8 @@ QStringList DanbooruSearchWidget::selectedTags() const
|
||||||
return m_tags;
|
return m_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruSearchWidget::accept() {
|
void DanbooruSearchWidget::accept()
|
||||||
|
{
|
||||||
|
|
||||||
if (tagLineEdit->text().isEmpty()) {
|
if (tagLineEdit->text().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -53,5 +57,4 @@ void DanbooruSearchWidget::accept() {
|
||||||
Q_EMIT(accepted());
|
Q_EMIT(accepted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
|
@ -22,9 +22,11 @@
|
||||||
|
|
||||||
#include "ui_searchwidget.h"
|
#include "ui_searchwidget.h"
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruSearchWidget: public QWidget, Ui::SearchWidget {
|
class DanbooruSearchWidget: public QWidget, Ui::SearchWidget
|
||||||
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -47,5 +49,4 @@ namespace Danbooru {
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -21,7 +21,8 @@
|
||||||
#include "model/danboorutagmodel.h"
|
#include "model/danboorutagmodel.h"
|
||||||
#include "libdanbooru/danboorutag.h"
|
#include "libdanbooru/danboorutag.h"
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
DanbooruTagWidget::DanbooruTagWidget(QWidget *parent): QListView(parent)
|
DanbooruTagWidget::DanbooruTagWidget(QWidget *parent): QListView(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruTag;
|
class DanbooruTag;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
static QLatin1String urlRegex("(http|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?");
|
static QLatin1String urlRegex("(http|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?");
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
GeneralPage::GeneralPage(DanbooruSettings *preferences, QWidget *parent): QWidget(parent)
|
GeneralPage::GeneralPage(DanbooruSettings *preferences, QWidget *parent): QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -44,5 +45,4 @@ GeneralPage::~GeneralPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
|
@ -22,11 +22,13 @@
|
||||||
|
|
||||||
#include "ui_generalpage.h"
|
#include "ui_generalpage.h"
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruSettings;
|
class DanbooruSettings;
|
||||||
|
|
||||||
class GeneralPage: public QWidget, public Ui::GeneralPage {
|
class GeneralPage: public QWidget, public Ui::GeneralPage
|
||||||
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,11 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORU_H
|
#ifndef DANBOORU_H
|
||||||
#define DANBOORU_H
|
#define DANBOORU_H
|
||||||
|
|
||||||
#include "libdanbooru_version.h"
|
#include "libdanbooru_version.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The Danbooru namespace.
|
* @brief The Danbooru namespace.
|
||||||
* @file danbooru.h
|
* @file danbooru.h
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "danboorupool.h"
|
#include "danboorupool.h"
|
||||||
|
|
||||||
namespace Danbooru
|
namespace Danbooru
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORUPOOL_H
|
#ifndef DANBOORUPOOL_H
|
||||||
#define DANBOORUPOOL_H
|
#define DANBOORUPOOL_H
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
@ -48,7 +47,6 @@ DanbooruPost::DanbooruPost(QObject* parent): QObject(parent)
|
||||||
m_rating = Questionable;
|
m_rating = Questionable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
|
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
|
||||||
QObject *parent):
|
QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
|
@ -149,7 +147,6 @@ const QUrl DanbooruPost::sampleUrl() const
|
||||||
return m_sampleUrl;
|
return m_sampleUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap DanbooruPost::pixmap() const
|
QPixmap DanbooruPost::pixmap() const
|
||||||
{
|
{
|
||||||
return m_pixmap;
|
return m_pixmap;
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORUPOST_H
|
#ifndef DANBOORUPOST_H
|
||||||
#define DANBOORUPOST_H
|
#define DANBOORUPOST_H
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@ public:
|
||||||
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
||||||
Q_ENUMS(Rating)
|
Q_ENUMS(Rating)
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QPixmap m_pixmap;
|
QPixmap m_pixmap;
|
||||||
|
@ -227,6 +225,5 @@ Q_DECLARE_METATYPE(Danbooru::DanbooruPost *)
|
||||||
Q_DECLARE_METATYPE(Danbooru::DanbooruPost::Rating)
|
Q_DECLARE_METATYPE(Danbooru::DanbooruPost::Rating)
|
||||||
Q_DECLARE_METATYPE(QSet<QString>)
|
Q_DECLARE_METATYPE(QSet<QString>)
|
||||||
|
|
||||||
|
|
||||||
#endif // DANBOORUPOST_H
|
#endif // DANBOORUPOST_H
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// STL
|
// STL
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -100,7 +99,6 @@ void DanbooruService::getPostList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DanbooruService::getTagList(int limit, QString name)
|
void DanbooruService::getTagList(int limit, QString name)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> parameters;
|
QMap<QString, QString> parameters;
|
||||||
|
@ -237,7 +235,6 @@ void DanbooruService::getRelatedTags(const QStringList &tags,
|
||||||
|
|
||||||
// qCDebug(LIBDANBOORU) << "Final constructed related tag URL" << danbooruUrl;
|
// qCDebug(LIBDANBOORU) << "Final constructed related tag URL" << danbooruUrl;
|
||||||
|
|
||||||
|
|
||||||
StoredTransferJob *job = KIO::storedGet(
|
StoredTransferJob *job = KIO::storedGet(
|
||||||
danbooruUrl, KIO::NoReload,
|
danbooruUrl, KIO::NoReload,
|
||||||
KIO::HideProgressInfo
|
KIO::HideProgressInfo
|
||||||
|
@ -291,7 +288,6 @@ void DanbooruService::getRelatedTags(const QStringList &tags,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QSet< QString > DanbooruService::blacklist() const
|
const QSet< QString > DanbooruService::blacklist() const
|
||||||
{
|
{
|
||||||
return m_blacklist;
|
return m_blacklist;
|
||||||
|
@ -322,7 +318,6 @@ int DanbooruService::currentPage() const
|
||||||
return m_currentPage;
|
return m_currentPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DanbooruPost::Ratings DanbooruService::maximumAllowedRating() const
|
const DanbooruPost::Ratings DanbooruService::maximumAllowedRating() const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -347,7 +342,6 @@ void DanbooruService::nextPoolPage()
|
||||||
getPoolList();
|
getPoolList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList DanbooruService::postTags() const
|
QStringList DanbooruService::postTags() const
|
||||||
{
|
{
|
||||||
return m_tags;
|
return m_tags;
|
||||||
|
@ -362,7 +356,8 @@ void DanbooruService::reset()
|
||||||
|
|
||||||
// Slots
|
// Slots
|
||||||
|
|
||||||
void DanbooruService::processTagList(KJob *job) {
|
void DanbooruService::processTagList(KJob *job)
|
||||||
|
{
|
||||||
|
|
||||||
if (job->error()) {
|
if (job->error()) {
|
||||||
Q_EMIT(downloadError(job->errorString()));
|
Q_EMIT(downloadError(job->errorString()));
|
||||||
|
@ -437,7 +432,6 @@ void DanbooruService::processPostList(KJob *job)
|
||||||
|
|
||||||
for (auto element : postList) {
|
for (auto element : postList) {
|
||||||
|
|
||||||
|
|
||||||
QVariantMap map = element.toMap();
|
QVariantMap map = element.toMap();
|
||||||
DanbooruPost *post = new DanbooruPost(map);
|
DanbooruPost *post = new DanbooruPost(map);
|
||||||
|
|
||||||
|
@ -469,7 +463,6 @@ void DanbooruService::processPostList(KJob *job)
|
||||||
StoredTransferJob *pixmapJob = KIO::storedGet(post->thumbnailUrl(),
|
StoredTransferJob *pixmapJob = KIO::storedGet(post->thumbnailUrl(),
|
||||||
KIO::NoReload, KIO::HideProgressInfo);
|
KIO::NoReload, KIO::HideProgressInfo);
|
||||||
|
|
||||||
|
|
||||||
// We don't want to overload the servers, so set some rational
|
// We don't want to overload the servers, so set some rational
|
||||||
// priority
|
// priority
|
||||||
|
|
||||||
|
@ -523,7 +516,6 @@ void DanbooruService::processPostList(KJob *job)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DanbooruService::downloadAllTags(KJob *job)
|
void DanbooruService::downloadAllTags(KJob *job)
|
||||||
{
|
{
|
||||||
Q_UNUSED(job)
|
Q_UNUSED(job)
|
||||||
|
@ -608,13 +600,15 @@ void DanbooruService::setImageCache(KImageCache* cache)
|
||||||
m_cache = cache;
|
m_cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruService::setMaxPosts(int number) {
|
void DanbooruService::setMaxPosts(int number)
|
||||||
|
{
|
||||||
|
|
||||||
m_maxPosts = number < 100 ? number : 100;
|
m_maxPosts = number < 100 ? number : 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruService::setCurrentPage(int page) {
|
void DanbooruService::setCurrentPage(int page)
|
||||||
|
{
|
||||||
m_currentPage = page;
|
m_currentPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORUSERVICE_H
|
#ifndef DANBOORUSERVICE_H
|
||||||
#define DANBOORUSERVICE_H
|
#define DANBOORUSERVICE_H
|
||||||
|
|
||||||
|
@ -102,7 +101,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a default instance of the service.
|
* @brief Construct a default instance of the service.
|
||||||
*
|
*
|
||||||
|
@ -284,7 +282,6 @@ public:
|
||||||
|
|
||||||
void setPostTags(const QStringList &tags);
|
void setPostTags(const QStringList &tags);
|
||||||
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void processPostList(KJob *job);
|
void processPostList(KJob *job);
|
||||||
void processTagList(KJob *job);
|
void processTagList(KJob *job);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "danboorutag.h"
|
#include "danboorutag.h"
|
||||||
|
|
||||||
namespace Danbooru
|
namespace Danbooru
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORUTAG_H
|
#ifndef DANBOORUTAG_H
|
||||||
#define DANBOORUTAG_H
|
#define DANBOORUTAG_H
|
||||||
|
|
||||||
|
@ -78,5 +77,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(TagTypes)
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Danbooru::DanbooruTag *)
|
Q_DECLARE_METATYPE(Danbooru::DanbooruTag *)
|
||||||
|
|
||||||
|
|
||||||
#endif // DANBOORUTAG_H
|
#endif // DANBOORUTAG_H
|
||||||
|
|
|
@ -20,4 +20,3 @@
|
||||||
#include "libdanbooru_debug.h"
|
#include "libdanbooru_debug.h"
|
||||||
Q_LOGGING_CATEGORY(LIBDANBOORU, "org.dennogumi.libdanbooru")
|
Q_LOGGING_CATEGORY(LIBDANBOORU, "org.dennogumi.libdanbooru")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Own
|
// Own
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -69,7 +68,6 @@ QUrl requestUrl(QUrl &url, const QString &path,
|
||||||
danbooruUrl.setPassword(password);
|
danbooruUrl.setPassword(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return danbooruUrl;
|
return danbooruUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,6 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
|
||||||
m_tableView->setModel(m_poolModel);
|
m_tableView->setModel(m_poolModel);
|
||||||
m_tagWidget->setModel(m_proxyModel);
|
m_tagWidget->setModel(m_proxyModel);
|
||||||
|
|
||||||
|
|
||||||
// Set up declarative bindings for the QQuickWidget
|
// Set up declarative bindings for the QQuickWidget
|
||||||
|
|
||||||
m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
@ -216,8 +215,8 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_view->rootObject(), SIGNAL(downloadRequested(const QUrl&, QVariant)), this,
|
connect(m_view->rootObject(), SIGNAL(downloadRequested(QUrl,QVariant)), this,
|
||||||
SLOT(slotHandleDownload(const QUrl&, QVariant)));
|
SLOT(slotHandleDownload(QUrl,QVariant)));
|
||||||
|
|
||||||
connect(m_tagWidget, &QListView::doubleClicked, this, &DanbooruMainWindow::searchTag);
|
connect(m_tagWidget, &QListView::doubleClicked, this, &DanbooruMainWindow::searchTag);
|
||||||
|
|
||||||
|
@ -261,7 +260,6 @@ void DanbooruMainWindow::loadSettings()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DanbooruMainWindow::setupActions()
|
void DanbooruMainWindow::setupActions()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -329,7 +327,6 @@ void DanbooruMainWindow::setupActions()
|
||||||
actionCollection()->action(QLatin1String("morePools"))->setEnabled(true);
|
actionCollection()->action(QLatin1String("morePools"))->setEnabled(true);
|
||||||
m_tableView->show();
|
m_tableView->show();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
poolDockWidget->hide();
|
poolDockWidget->hide();
|
||||||
actionCollection()->action(QLatin1String("morePools"))->setEnabled(false);
|
actionCollection()->action(QLatin1String("morePools"))->setEnabled(false);
|
||||||
|
@ -382,8 +379,8 @@ void DanbooruMainWindow::setupActions()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DanbooruMainWindow::setupDockWidgets()
|
||||||
void DanbooruMainWindow::setupDockWidgets() {
|
{
|
||||||
|
|
||||||
// Set up PoolWidget
|
// Set up PoolWidget
|
||||||
|
|
||||||
|
@ -459,7 +456,6 @@ void DanbooruMainWindow::downloadPosts()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handlePostDownload(QStringList(), false);
|
handlePostDownload(QStringList(), false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -477,8 +473,8 @@ void DanbooruMainWindow::optionsPreferences()
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruMainWindow::slotHandleDownload(const QUrl &url, const QVariant tags) {
|
void DanbooruMainWindow::slotHandleDownload(const QUrl &url, const QVariant tags)
|
||||||
|
{
|
||||||
|
|
||||||
QStringList tagList = tags.toStringList();
|
QStringList tagList = tags.toStringList();
|
||||||
|
|
||||||
|
@ -506,7 +502,6 @@ void DanbooruMainWindow::slotHandleDownload(const QUrl &url, const QVariant tags
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// TODO: Remember last user directory - settings?
|
// TODO: Remember last user directory - settings?
|
||||||
|
|
||||||
if (!localFile.isEmpty()) {
|
if (!localFile.isEmpty()) {
|
||||||
|
@ -554,7 +549,6 @@ void DanbooruMainWindow::clearModels()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DanbooruMainWindow::handlePostDownload(const QStringList &tags, bool relatedTags)
|
void DanbooruMainWindow::handlePostDownload(const QStringList &tags, bool relatedTags)
|
||||||
{
|
{
|
||||||
clearModels();
|
clearModels();
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
#include <KSharedDataCache>
|
#include <KSharedDataCache>
|
||||||
#include <KImageCache>
|
#include <KImageCache>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QQuickWidget;
|
class QQuickWidget;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
|
||||||
|
|
||||||
namespace Danbooru
|
namespace Danbooru
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,16 @@
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
DanbooruPoolModel::DanbooruPoolModel(QObject *parent): QAbstractTableModel(parent)
|
DanbooruPoolModel::DanbooruPoolModel(QObject *parent): QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList DanbooruPoolModel::m_headerNames = { i18n("ID"),
|
const QStringList DanbooruPoolModel::m_headerNames = { i18n("ID"),
|
||||||
i18n("Name"), i18n("Posts"), i18n("Description") };
|
i18n("Name"), i18n("Posts"), i18n("Description")
|
||||||
|
};
|
||||||
|
|
||||||
DanbooruPoolModel::~DanbooruPoolModel()
|
DanbooruPoolModel::~DanbooruPoolModel()
|
||||||
{
|
{
|
||||||
|
@ -120,6 +122,4 @@ DanbooruPool* DanbooruPoolModel::poolAt(int index) const
|
||||||
return m_items.at(index);
|
return m_items.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
|
@ -23,7 +23,8 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruPool;
|
class DanbooruPool;
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
DanbooruPool *poolAt(int index) const;
|
DanbooruPool *poolAt(int index) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<DanbooruPool *> m_items;
|
QVector<DanbooruPool *> m_items;
|
||||||
static const QStringList m_headerNames;
|
static const QStringList m_headerNames;
|
||||||
|
@ -52,9 +52,6 @@ public Q_SLOTS:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Own
|
// Own
|
||||||
|
|
||||||
#include "danboorupostmodel.h"
|
#include "danboorupostmodel.h"
|
||||||
|
@ -81,16 +80,14 @@ QVariant DanbooruPostModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole: {
|
||||||
{
|
|
||||||
QVariant variant;
|
QVariant variant;
|
||||||
variant.setValue(post);
|
variant.setValue(post);
|
||||||
|
|
||||||
return variant;
|
return variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole: {
|
||||||
{
|
|
||||||
const QPixmap pixmap = post->pixmap();
|
const QPixmap pixmap = post->pixmap();
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
@ -106,8 +103,7 @@ QVariant DanbooruPostModel::data(const QModelIndex &index, int role) const
|
||||||
return QSize(post->width(), post->height());
|
return QSize(post->width(), post->height());
|
||||||
case RatingRole:
|
case RatingRole:
|
||||||
return post->rating();
|
return post->rating();
|
||||||
case TagRole:
|
case TagRole: {
|
||||||
{
|
|
||||||
QStringList tagList = post->tags().toList();
|
QStringList tagList = post->tags().toList();
|
||||||
return tagList;
|
return tagList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef DANBOORUPOSTMODEL_H
|
#ifndef DANBOORUPOSTMODEL_H
|
||||||
#define DANBOORUPOSTMODEL_H
|
#define DANBOORUPOSTMODEL_H
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "danboorutagmodel.h"
|
#include "danboorutagmodel.h"
|
||||||
#include "libdanbooru/danboorutag.h"
|
#include "libdanbooru/danboorutag.h"
|
||||||
#include "danbooru_client_debug.h"
|
#include "danbooru_client_debug.h"
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
DanbooruTagModel::DanbooruTagModel(QObject *parent): QAbstractListModel(parent)
|
DanbooruTagModel::DanbooruTagModel(QObject *parent): QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,6 @@ DanbooruTagModel::~DanbooruTagModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DanbooruTagModel::rowCount(const QModelIndex &parent) const
|
int DanbooruTagModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
|
@ -86,7 +85,8 @@ void DanbooruTagModel::addTag(DanbooruTag* tag)
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruTagModel::clear() {
|
void DanbooruTagModel::clear()
|
||||||
|
{
|
||||||
|
|
||||||
if (m_items.isEmpty()) {
|
if (m_items.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru
|
||||||
|
{
|
||||||
|
|
||||||
class DanbooruTag;
|
class DanbooruTag;
|
||||||
|
|
||||||
|
@ -53,7 +54,6 @@ public Q_SLOTS:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue