Run astyle-kdelibs on the source
This commit is contained in:
parent
4b85d63d68
commit
39aac8c95b
22 changed files with 1227 additions and 1264 deletions
|
@ -17,8 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "danbooruclientview.h"
|
||||
|
||||
// Own
|
||||
|
@ -35,7 +33,8 @@
|
|||
#include <KRun>
|
||||
#include <KFileDialog>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
DanbooruClientView::DanbooruClientView(QWidget *parent): QWidget(parent),
|
||||
m_model(new DanbooruPostModel(this)),
|
||||
|
@ -60,9 +59,8 @@ namespace Danbooru {
|
|||
|
||||
connect(m_delegate, &DanbooruPostDelegate::postDownloadRequested, this, &DanbooruClientView::slotHandleDownload);
|
||||
connect(m_delegate, &DanbooruPostDelegate::postViewRequested, this, &DanbooruClientView::slotHandleView);
|
||||
// connect(m_listView, SIGNAL(clicked(const QModelIndex&)), parent(),
|
||||
// SLOT(displayInfo(const QModelIndex&));
|
||||
|
||||
// connect(m_listView, SIGNAL(clicked(QModelIndex)), parent(),
|
||||
// SLOT(displayInfo(QModelIndex));
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,5 +82,4 @@ namespace Danbooru {
|
|||
runViewer->setAutoDelete(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
class QTimer;
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruPostModel;
|
||||
class DanbooruPostDelegate;
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
#include <KWallet>
|
||||
|
||||
|
||||
using KWallet::Wallet;
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
const QMap< QUrl, QString > initBoardSalts()
|
||||
{
|
||||
|
@ -122,7 +122,6 @@ void DanbooruConnectWidget::getWalletData()
|
|||
|
||||
if (m_wallet->hasEntry(key)) {
|
||||
|
||||
|
||||
if (m_wallet->readMap(key, valueMap) != 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +132,6 @@ void DanbooruConnectWidget::getWalletData()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DanbooruConnectWidget::toggleLineEdits(int state)
|
||||
{
|
||||
if (state == Qt::Unchecked) {
|
||||
|
@ -145,7 +143,6 @@ void DanbooruConnectWidget::toggleLineEdits(int state)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DanbooruConnectWidget::emitRejected()
|
||||
{
|
||||
Q_EMIT rejected();
|
||||
|
@ -161,7 +158,6 @@ QString DanbooruConnectWidget::username() const
|
|||
return m_username;
|
||||
}
|
||||
|
||||
|
||||
QString DanbooruConnectWidget::password() const
|
||||
{
|
||||
return m_password;
|
||||
|
@ -197,5 +193,4 @@ void DanbooruConnectWidget::accept()
|
|||
hide();
|
||||
}
|
||||
|
||||
|
||||
}; // namespace Danbooru
|
||||
|
|
|
@ -28,17 +28,20 @@
|
|||
|
||||
#include <QUrl>
|
||||
|
||||
namespace KWallet {
|
||||
namespace KWallet
|
||||
{
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruService;
|
||||
|
||||
const QMap< QUrl, QString > initBoardSalts();
|
||||
|
||||
class DanbooruConnectWidget: public QWidget, public Ui::DanbooruConnectWidget {
|
||||
class DanbooruConnectWidget: public QWidget, public Ui::DanbooruConnectWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -61,7 +64,6 @@ namespace Danbooru {
|
|||
void connectionEstablished(DanbooruService *service);
|
||||
void rejected();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void checkWallet(bool);
|
||||
void getWalletData();
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
* @file danbooru.h
|
||||
*
|
||||
**/
|
||||
namespace Danbooru {
|
||||
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
}; // namespace Danbooru
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
#include "danboorupool.h"
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
DanbooruPool::DanbooruPool(const QVariantMap &postData, QObject *parent):
|
||||
QObject(parent), m_posts(QList<int>())
|
||||
|
@ -76,5 +77,4 @@ void DanbooruPool::addPosts(const QStringList& posts)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
#include <QtCore/QStringList>
|
||||
#include <QtXml/QXmlStreamAttributes>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Class representing a Danbooru pool.
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include "danboorupost.h"
|
||||
|
||||
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
|
@ -73,12 +72,10 @@ DanbooruPost::DanbooruPost(QXmlStreamAttributes& postData, QPixmap pixmap, QObje
|
|||
m_rating = RATING_MAP.value(postData.value("rating").toString());
|
||||
}
|
||||
|
||||
|
||||
DanbooruPost::~DanbooruPost()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const QMap< QString, DanbooruPost::Rating > DanbooruPost::initRatingMap()
|
||||
{
|
||||
|
||||
|
@ -91,13 +88,11 @@ const QMap< QString, DanbooruPost::Rating > DanbooruPost::initRatingMap()
|
|||
|
||||
}
|
||||
|
||||
|
||||
bool DanbooruPost::operator==(const Danbooru::DanbooruPost &other)
|
||||
{
|
||||
return m_url == other.m_url && m_id == other.m_id;
|
||||
}
|
||||
|
||||
|
||||
void DanbooruPost::setPixmap(const QPixmap &pixmap)
|
||||
{
|
||||
m_pixmap = pixmap;
|
||||
|
@ -155,7 +150,5 @@ Danbooru::DanbooruPost::Rating DanbooruPost::rating() const
|
|||
return m_rating;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
|
||||
#include "danbooru.h"
|
||||
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A class representing a Danbooru post.
|
||||
|
@ -91,7 +91,6 @@ namespace Danbooru {
|
|||
};
|
||||
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QPixmap m_pixmap;
|
||||
|
@ -212,11 +211,8 @@ namespace Danbooru {
|
|||
* **/
|
||||
const QString toString();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(DanbooruPost::Ratings)
|
||||
|
||||
}; // namespace Danbooru
|
||||
|
|
|
@ -71,7 +71,6 @@ DanbooruService::~DanbooruService()
|
|||
|
||||
}
|
||||
|
||||
|
||||
void DanbooruService::getPostList(int page, QStringList tags, int limit)
|
||||
{
|
||||
|
||||
|
@ -97,7 +96,6 @@ void DanbooruService::getPostList(int page, QStringList tags, int limit)
|
|||
|
||||
connect(job, &KIO::StoredTransferJob::result, this, &DanbooruService::processPostList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DanbooruService::getTagList(int limit, QString name)
|
||||
|
@ -164,7 +162,6 @@ void DanbooruService::getPool(int poolId, int page)
|
|||
|
||||
//qDebug() << "Final constructed pool URL" << danbooruUrl.url();
|
||||
|
||||
|
||||
KIO::StoredTransferJob *job = KIO::storedGet(danbooruUrl, KIO::NoReload,
|
||||
KIO::HideProgressInfo);
|
||||
|
||||
|
@ -329,7 +326,6 @@ void DanbooruService::setBlacklist(const QSet< QString >& blacklist)
|
|||
|
||||
}
|
||||
|
||||
|
||||
const QSet< QString > DanbooruService::blacklist() const
|
||||
{
|
||||
return m_blacklist;
|
||||
|
@ -469,21 +465,24 @@ void DanbooruService::processPostList(KJob* job)
|
|||
|
||||
connect(pixmapJob, &StoredTransferJob::result, [post, this, pix](KJob * job) mutable {
|
||||
|
||||
if (job->error()) {
|
||||
if (job->error())
|
||||
{
|
||||
Q_EMIT(downloadError(job->errorString()));
|
||||
return;
|
||||
}
|
||||
|
||||
StoredTransferJob *jobResult = qobject_cast<StoredTransferJob *>(job);
|
||||
|
||||
if (!pix.loadFromData(jobResult->data())) {
|
||||
if (!pix.loadFromData(jobResult->data()))
|
||||
{
|
||||
Q_EMIT(downloadError(QString("Pixmap data could not be loaded")));
|
||||
return;
|
||||
}
|
||||
|
||||
post->setPixmap(pix);
|
||||
|
||||
if (m_cache) {
|
||||
if (m_cache)
|
||||
{
|
||||
//qDebug() << "Inserting item in cache";
|
||||
m_cache->insertPixmap(post->thumbnailUrl().url(), pix);
|
||||
}
|
||||
|
@ -493,7 +492,8 @@ void DanbooruService::processPostList(KJob* job)
|
|||
//qDebug() << "Current posts remaining" << m_currentPosts;
|
||||
Q_EMIT(postDownloaded(post));
|
||||
|
||||
if (m_postsToFetch == 0) {
|
||||
if (m_postsToFetch == 0)
|
||||
{
|
||||
qDebug() << "Post download finished";
|
||||
Q_EMIT(postDownloadFinished());
|
||||
}
|
||||
|
@ -504,8 +504,6 @@ void DanbooruService::processPostList(KJob* job)
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DanbooruService::processTagList(KJob *job)
|
||||
|
@ -513,7 +511,6 @@ void DanbooruService::processTagList(KJob* job)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void DanbooruService::processRelatedTagList(KJob *job)
|
||||
{
|
||||
|
||||
|
@ -522,7 +519,6 @@ void DanbooruService::processRelatedTagList(KJob* job)
|
|||
void DanbooruService::processPoolList(KJob *job)
|
||||
{
|
||||
|
||||
|
||||
if (job->error()) {
|
||||
Q_EMIT(downloadError(job->errorString()));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#ifndef DANBOORUSERVICE_H
|
||||
#define DANBOORUSERVICE_H
|
||||
|
||||
|
||||
/**
|
||||
* @brief Classes to interact with Danbooru boards
|
||||
* @file danbooruservice.h
|
||||
|
@ -56,7 +55,8 @@ class KJob;
|
|||
|
||||
using Danbooru::DanbooruTag;
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruPool;
|
||||
|
||||
|
@ -231,7 +231,6 @@ namespace Danbooru {
|
|||
**/
|
||||
void poolDownloadFinished();
|
||||
|
||||
|
||||
/**
|
||||
* Emitted when a download error occurred.
|
||||
*
|
||||
|
|
|
@ -82,5 +82,4 @@ Danbooru::DanbooruTag::TagType DanbooruTag::type() const
|
|||
return m_tagType;
|
||||
}
|
||||
|
||||
|
||||
}; // namespace Danbooru
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORUTAG_H
|
||||
#define DANBOORUTAG_H
|
||||
|
||||
|
@ -29,7 +28,8 @@
|
|||
|
||||
#include "danbooru.h"
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruTag : public QObject
|
||||
{
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
QUrl requestUrl(QUrl &url, const QString &path,
|
||||
const QString &username, const QString &password,
|
||||
|
@ -173,8 +174,8 @@ namespace Danbooru {
|
|||
return postData;
|
||||
}
|
||||
|
||||
|
||||
bool isPostBlacklisted(DanbooruPost *post, QSet<QString> blacklist, DanbooruPost::Ratings maxRating ) {
|
||||
bool isPostBlacklisted(DanbooruPost *post, QSet<QString> blacklist, DanbooruPost::Ratings maxRating)
|
||||
{
|
||||
|
||||
if (post->rating() > maxRating) {
|
||||
return true;
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
*
|
||||
**/
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
typedef QMap<QString, QString> dictMap;
|
||||
|
||||
|
@ -66,7 +67,6 @@ namespace Danbooru {
|
|||
const QString &password, const dictMap ¶meters,
|
||||
const QStringList &tags);
|
||||
|
||||
|
||||
/** @brief Generate a request URL for a Danbooru board.
|
||||
*
|
||||
* This is an overloaded function provided for convenience.
|
||||
|
@ -87,7 +87,6 @@ namespace Danbooru {
|
|||
QUrl requestUrl(QUrl &url, const QString &path, const QString &username,
|
||||
const QString &password, const dictMap ¶meters);
|
||||
|
||||
|
||||
/** @brief Generate a request URL for a Danbooru board.
|
||||
*
|
||||
* This is an overloaded function provided for convenience.
|
||||
|
@ -105,7 +104,6 @@ namespace Danbooru {
|
|||
QUrl requestUrl(QUrl &url, const QString &path, const QString &username,
|
||||
const QString &password);
|
||||
|
||||
|
||||
QList<QVariant> parseDanbooruResult(QByteArray data, QString xlmElement,
|
||||
bool *result);
|
||||
QVariant parseDanbooruResult(QByteArray data, bool *result);
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -53,23 +53,16 @@ int main(int argc, char **argv)
|
|||
danbooru_client *widget = new danbooru_client;
|
||||
|
||||
// see if we are starting with session management
|
||||
if (app.isSessionRestored())
|
||||
{
|
||||
if (app.isSessionRestored()) {
|
||||
RESTORE(danbooru_client);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// no session.. just start up normally
|
||||
if (parser.positionalArguments().count() == 0)
|
||||
{
|
||||
if (parser.positionalArguments().count() == 0) {
|
||||
//danbooru_client *widget = new danbooru_client;
|
||||
widget->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int i = 0;
|
||||
for (; i < parser.positionalArguments().count(); i++)
|
||||
{
|
||||
for (; i < parser.positionalArguments().count(); i++) {
|
||||
//danbooru_client *widget = new danbooru_client;
|
||||
widget->show();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
#include <KLocale>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
DanbooruMainWindow::DanbooruMainWindow()
|
||||
: KXmlGuiWindow(),
|
||||
|
@ -54,7 +55,6 @@ namespace Danbooru {
|
|||
// toolbar position, icon size, etc.
|
||||
setupGUI();
|
||||
|
||||
|
||||
}
|
||||
|
||||
DanbooruMainWindow::~DanbooruMainWindow()
|
||||
|
@ -64,8 +64,6 @@ namespace Danbooru {
|
|||
void DanbooruMainWindow::setupActions()
|
||||
{
|
||||
|
||||
|
||||
|
||||
QAction *connectAction = new QAction(
|
||||
QIcon::fromTheme(QLatin1String("document-open-remote")),
|
||||
i18n("Connect..."),
|
||||
|
@ -109,7 +107,6 @@ namespace Danbooru {
|
|||
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
||||
#include "DanbooruMainWindow.moc"
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
#ifndef DANBOORU_CLIENT_H
|
||||
#define DANBOORU_CLIENT_H
|
||||
|
||||
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruClientView;
|
||||
class DanbooruService;
|
||||
|
@ -70,7 +70,6 @@ namespace Danbooru {
|
|||
DanbooruService *m_service;
|
||||
DanbooruConnectWidget *m_connectWidget;
|
||||
|
||||
|
||||
};
|
||||
} // namespace Danbooru
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include <KIconLoader>
|
||||
#include <KFormat>
|
||||
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
const int DanbooruPostDelegate::MARGIN = 5;
|
||||
|
||||
|
@ -124,7 +124,6 @@ namespace Danbooru {
|
|||
Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation);
|
||||
|
||||
|
||||
QRect pixRect = scaled.rect();
|
||||
pixRect.moveCenter(rect.center());
|
||||
|
||||
|
@ -257,5 +256,4 @@ namespace Danbooru {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
|
|
@ -37,8 +37,8 @@ class QListView;
|
|||
class QPainter;
|
||||
class QPushButton;
|
||||
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Specific delegate for Danbooru items.
|
||||
|
@ -81,7 +81,6 @@ namespace Danbooru {
|
|||
*/
|
||||
void postViewRequested(QUrl postUrl);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Emitted when the download button is clicked.
|
||||
*
|
||||
|
@ -90,13 +89,10 @@ namespace Danbooru {
|
|||
*/
|
||||
void postDownloadRequested(QUrl postUrl);
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void viewButtonClicked();
|
||||
void downloadButtonClicked();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace Danbooru
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include <QDebug>
|
||||
#include <QPixmap>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
DanbooruPostModel::DanbooruPostModel(QObject *parent): QAbstractListModel(parent)
|
||||
{
|
||||
|
@ -101,7 +102,8 @@ namespace Danbooru {
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
void DanbooruPostModel::clear() {
|
||||
void DanbooruPostModel::clear()
|
||||
{
|
||||
|
||||
if (m_items.isEmpty()) {
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
#include <QAbstractListModel>
|
||||
#include <QVector>
|
||||
|
||||
namespace Danbooru {
|
||||
namespace Danbooru
|
||||
{
|
||||
|
||||
class DanbooruPost;
|
||||
|
||||
|
@ -76,5 +77,4 @@ namespace Danbooru {
|
|||
};
|
||||
}; // namespace Danbooru
|
||||
|
||||
|
||||
#endif // DANBOORUPOSTMODEL_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue