scaffold: start v3 rewrite from scratch
Remove all Qt5/C++/QML source files to begin a full rewrite in Rust + GTK4 + libadwaita. The BACKLOG.md describes the plan.
This commit is contained in:
parent
efbd570830
commit
3196988c98
26 changed files with 0 additions and 12385 deletions
50
src/main.cpp
50
src/main.cpp
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <qdebug.h>
|
||||
#include <QMetaType>
|
||||
#include <QtQml>
|
||||
#include <QIcon>
|
||||
#include <QtWebEngine/qtwebengineglobal.h>
|
||||
|
||||
#include "tinytinyrsslogin.h"
|
||||
#include "tinytinyrss.h"
|
||||
#include "post.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setOrganizationName("Jeena");
|
||||
app.setOrganizationDomain("jeena.net");
|
||||
app.setApplicationName("FeedTheMonkey");
|
||||
|
||||
QtWebEngine::initialize();
|
||||
|
||||
qmlRegisterType<TinyTinyRSSLogin>("TTRSS", 1, 0, "ServerLogin");
|
||||
qmlRegisterType<TinyTinyRSS>("TTRSS", 1, 0, "Server");
|
||||
qmlRegisterType<Post>("TTRSS", 1, 0, "Post");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
79
src/post.cpp
79
src/post.cpp
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "post.h"
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QTextDocument>
|
||||
|
||||
Post::Post(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Post::Post(QJsonObject post, QObject *parent) : QObject(parent)
|
||||
{
|
||||
mTitle = html2text(post.value("title").toString().trimmed());
|
||||
mFeedTitle = html2text(post.value("feed_title").toString().trimmed());
|
||||
mId = post.value("id").toInt();
|
||||
mFeedId = post.value("feed_id").toString().trimmed();
|
||||
mAuthor = post.value("author").toString().trimmed();
|
||||
QUrl url(post.value("link").toString().trimmed());
|
||||
mLink = url;
|
||||
QDateTime timestamp;
|
||||
timestamp.setTime_t(post.value("updated").toInt());
|
||||
mDate = timestamp;
|
||||
mContent = post.value("content").toString().trimmed();
|
||||
mExcerpt = html2text(post.value("excerpt").toString().remove(QRegExp("<[^>]*>")).replace("…", " ...").trimmed().replace("(\\s+)", " ").replace("\n", ""));
|
||||
mStarred = post.value("marked").toBool();
|
||||
mRead = !post.value("unread").toBool();
|
||||
mDontChangeRead = false;
|
||||
|
||||
QJsonDocument doc(post);
|
||||
QString result(doc.toJson(QJsonDocument::Indented));
|
||||
mJsonString = result;
|
||||
}
|
||||
|
||||
Post::~Post()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Post::setRead(bool r)
|
||||
{
|
||||
if(mRead == r) return;
|
||||
|
||||
mRead = r;
|
||||
emit readChanged(mRead);
|
||||
}
|
||||
|
||||
void Post::setDontChangeRead(bool r)
|
||||
{
|
||||
if(mDontChangeRead == r) return;
|
||||
|
||||
mDontChangeRead = r;
|
||||
emit dontChangeReadChanged(mDontChangeRead);
|
||||
}
|
||||
|
||||
QString Post::html2text(const QString htmlString)
|
||||
{
|
||||
QTextDocument doc;
|
||||
doc.setHtml(htmlString);
|
||||
return doc.toPlainText();
|
||||
}
|
||||
89
src/post.h
89
src/post.h
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef POST_H
|
||||
#define POST_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QDate>
|
||||
#include <QJsonObject>
|
||||
|
||||
class Post : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString title READ title CONSTANT)
|
||||
Q_PROPERTY(QString feedTitle READ feedTitle CONSTANT)
|
||||
Q_PROPERTY(int id READ id CONSTANT)
|
||||
Q_PROPERTY(QString feedId READ feedId CONSTANT)
|
||||
Q_PROPERTY(QString author READ author CONSTANT)
|
||||
Q_PROPERTY(QUrl link READ link CONSTANT)
|
||||
Q_PROPERTY(QDateTime date READ date CONSTANT)
|
||||
Q_PROPERTY(QString content READ content CONSTANT)
|
||||
Q_PROPERTY(QString excerpt READ excerpt CONSTANT)
|
||||
Q_PROPERTY(bool starred READ starred NOTIFY starredChanged)
|
||||
Q_PROPERTY(bool read READ read WRITE setRead NOTIFY readChanged)
|
||||
Q_PROPERTY(bool dontChangeRead READ dontChangeRead WRITE setDontChangeRead NOTIFY dontChangeReadChanged)
|
||||
Q_PROPERTY(QString jsonString READ jsonString CONSTANT)
|
||||
|
||||
public:
|
||||
Post(QObject *parent = 0);
|
||||
Post(QJsonObject post, QObject *parent = 0);
|
||||
~Post();
|
||||
QString title() const { return mTitle; }
|
||||
QString feedTitle() const { return mFeedTitle; }
|
||||
int id() const { return mId; }
|
||||
QString feedId() const { return mFeedId; }
|
||||
QString author() const { return mAuthor; }
|
||||
QUrl link() const { return mLink; }
|
||||
QDateTime date() const { return mDate; }
|
||||
QString content() const { return mContent; }
|
||||
QString excerpt() const { return mExcerpt; }
|
||||
bool starred() const { return mStarred; }
|
||||
bool read() { return mRead; }
|
||||
void setRead(bool r);
|
||||
bool dontChangeRead() const { return mDontChangeRead; }
|
||||
void setDontChangeRead(bool r);
|
||||
QString jsonString() const { return mJsonString; }
|
||||
|
||||
signals:
|
||||
void starredChanged(bool);
|
||||
void readChanged(bool);
|
||||
void dontChangeReadChanged(bool);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QString mTitle;
|
||||
QString mFeedTitle;
|
||||
int mId;
|
||||
QString mFeedId;
|
||||
QString mAuthor;
|
||||
QUrl mLink;
|
||||
QDateTime mDate;
|
||||
QString mContent;
|
||||
QString mExcerpt;
|
||||
bool mStarred;
|
||||
bool mRead;
|
||||
bool mDontChangeRead;
|
||||
QString mJsonString;
|
||||
QString html2text(const QString htmlString);
|
||||
};
|
||||
|
||||
#endif // POST_H
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "tinytinyrss.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QJsonArray>
|
||||
|
||||
TinyTinyRSS::TinyTinyRSS(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<QList<Post *> >();
|
||||
|
||||
mNetworkManager = new QNetworkAccessManager(this);
|
||||
mPosts = QList<Post *>();
|
||||
}
|
||||
|
||||
TinyTinyRSS::~TinyTinyRSS()
|
||||
{
|
||||
mPosts.clear();
|
||||
delete mNetworkManager;
|
||||
}
|
||||
|
||||
void TinyTinyRSS::initialize(const QString serverUrl, const QString sessionId)
|
||||
{
|
||||
mServerUrl = serverUrl;
|
||||
mSessionId = sessionId;
|
||||
reload();
|
||||
}
|
||||
|
||||
void TinyTinyRSS::reload()
|
||||
{
|
||||
QVariantMap opts;
|
||||
opts.insert("show_excerpt", false);
|
||||
opts.insert("view_mode", "unread");
|
||||
opts.insert("show_content", true);
|
||||
opts.insert("feed_id", -4);
|
||||
opts.insert("skip", 0);
|
||||
|
||||
doOperation("getHeadlines", opts, [this] (const QJsonObject &json) {
|
||||
|
||||
mPosts.clear();
|
||||
|
||||
QJsonArray posts = json.value("content").toArray();
|
||||
for(int i = 0; i < posts.count(); i++)
|
||||
{
|
||||
QJsonObject postJson = posts.at(i).toObject();
|
||||
Post *post = new Post(postJson, this);
|
||||
connect(post, SIGNAL(readChanged(bool)), this, SLOT(onPostReadChanged(bool)));
|
||||
mPosts.append(post);
|
||||
}
|
||||
|
||||
emit postsChanged(mPosts);
|
||||
});
|
||||
}
|
||||
|
||||
void TinyTinyRSS::loggedOut()
|
||||
{
|
||||
mServerUrl = nullptr;
|
||||
mSessionId = nullptr;
|
||||
mPosts.clear();
|
||||
emit postsChanged(mPosts);
|
||||
}
|
||||
|
||||
void TinyTinyRSS::doOperation(QString operation, QVariantMap opts, std::function<void (const QJsonObject &json)> callback)
|
||||
{
|
||||
QVariantMap options;
|
||||
options.insert("sid", mSessionId);
|
||||
options.insert("op", operation);
|
||||
|
||||
QMapIterator<QString, QVariant> i(opts);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
options.insert(i.key(), i.value());
|
||||
}
|
||||
|
||||
QJsonObject jsonobj = QJsonObject::fromVariantMap(options);
|
||||
QJsonDocument json = QJsonDocument(jsonobj);
|
||||
|
||||
QNetworkRequest request(mServerUrl);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QNetworkReply *reply = mNetworkManager->post(request, json.toJson());
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [callback, reply] () {
|
||||
if (reply) {
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
QString jsonString = QString(reply->readAll());
|
||||
QJsonDocument json = QJsonDocument::fromJson(jsonString.toUtf8());
|
||||
callback(json.object());
|
||||
} else {
|
||||
int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
//do some error management
|
||||
qWarning() << "HTTP error: " << httpStatus;
|
||||
}
|
||||
reply->deleteLater();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TinyTinyRSS::onPostReadChanged(bool r)
|
||||
{
|
||||
Post *post = (Post *)sender();
|
||||
|
||||
updateArticle(post->id(), 2, !r, [post] (const QJsonObject &) {
|
||||
// not doing anything with this yet.
|
||||
});
|
||||
}
|
||||
|
||||
void TinyTinyRSS::updateArticle(int articleId, int field, bool trueFalse, std::function<void (const QJsonObject &json)> callback)
|
||||
{
|
||||
QVariantMap opts;
|
||||
opts.insert("article_ids", articleId);
|
||||
opts.insert("field", field);
|
||||
opts.insert("mode", trueFalse ? 1 : 0);
|
||||
|
||||
doOperation("updateArticle", opts, callback);
|
||||
}
|
||||
|
||||
QQmlListProperty<Post> TinyTinyRSS::posts()
|
||||
{
|
||||
return QQmlListProperty<Post>(this, mPosts);
|
||||
}
|
||||
|
||||
int TinyTinyRSS::postsCount() const
|
||||
{
|
||||
return mPosts.count();
|
||||
}
|
||||
|
||||
Post *TinyTinyRSS::post(int index) const
|
||||
{
|
||||
return mPosts.at(index);
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TINYTINYRSS_H
|
||||
#define TINYTINYRSS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
#include <QList>
|
||||
#include <QQmlListProperty>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "post.h"
|
||||
|
||||
class TinyTinyRSS : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QQmlListProperty<Post> posts READ posts NOTIFY postsChanged)
|
||||
|
||||
public:
|
||||
TinyTinyRSS(QObject *parent = 0);
|
||||
~TinyTinyRSS();
|
||||
|
||||
Q_INVOKABLE void initialize(const QString serverUrl, const QString sessionId);
|
||||
Q_INVOKABLE void reload();
|
||||
Q_INVOKABLE void loggedOut();
|
||||
|
||||
|
||||
QQmlListProperty<Post> posts();
|
||||
int postsCount() const;
|
||||
Post *post(int) const;
|
||||
|
||||
signals:
|
||||
void postsChanged(QList<Post *>);
|
||||
|
||||
private slots:
|
||||
void onPostReadChanged(bool);
|
||||
|
||||
private:
|
||||
void doOperation(QString operation, QVariantMap opts, std::function<void (const QJsonObject &json)> callback);
|
||||
void updateArticle(int articleId, int field, bool trueFalse, std::function<void (const QJsonObject &json)> callback);
|
||||
|
||||
QString mServerUrl;
|
||||
QString mSessionId;
|
||||
QList<Post*> mPosts;
|
||||
QNetworkAccessManager *mNetworkManager;
|
||||
};
|
||||
|
||||
#endif // TINYTINYRSS_H
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "tinytinyrsslogin.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkReply>
|
||||
#include <QSettings>
|
||||
|
||||
#define APP_URL "net.jeena"
|
||||
#define APP_NAME "FeedTheMonkey"
|
||||
|
||||
TinyTinyRSSLogin::TinyTinyRSSLogin(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
mNetworkManager = new QNetworkAccessManager(this);
|
||||
|
||||
QSettings settings;
|
||||
mSessionId = settings.value("sessionId").toString();
|
||||
mServerUrl = settings.value("serverUrl").toString();
|
||||
}
|
||||
|
||||
TinyTinyRSSLogin::~TinyTinyRSSLogin()
|
||||
{
|
||||
delete mNetworkManager;
|
||||
}
|
||||
|
||||
bool TinyTinyRSSLogin::loggedIn()
|
||||
{
|
||||
return !mSessionId.isEmpty();
|
||||
}
|
||||
|
||||
void TinyTinyRSSLogin::login(const QString serverUrl, const QString user, const QString password)
|
||||
{
|
||||
mServerUrl = QUrl(serverUrl + "/api/");
|
||||
|
||||
QVariantMap options;
|
||||
options.insert("op", "login");
|
||||
options.insert("user", user);
|
||||
options.insert("password", password);
|
||||
|
||||
QJsonObject jsonobj = QJsonObject::fromVariantMap(options);
|
||||
QJsonDocument json = QJsonDocument(jsonobj);
|
||||
|
||||
QNetworkRequest request(mServerUrl);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QNetworkReply *reply = mNetworkManager->post(request, json.toJson());
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(reply()));
|
||||
}
|
||||
|
||||
void TinyTinyRSSLogin::logout()
|
||||
{
|
||||
if(mSessionId.length() > 0 && mServerUrl.toString().length() > 0) {
|
||||
QVariantMap options;
|
||||
options.insert("op", "logout");
|
||||
options.insert("sid", mSessionId);
|
||||
|
||||
QJsonObject jsonobj = QJsonObject::fromVariantMap(options);
|
||||
QJsonDocument json = QJsonDocument(jsonobj);
|
||||
|
||||
QNetworkRequest request(mServerUrl);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QNetworkReply *reply = mNetworkManager->post(request, json.toJson());
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(reply()));
|
||||
}
|
||||
}
|
||||
|
||||
void TinyTinyRSSLogin::reply()
|
||||
{
|
||||
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
|
||||
|
||||
if (reply) {
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
|
||||
QString jsonString = QString(reply->readAll());
|
||||
QJsonDocument json = QJsonDocument::fromJson(jsonString.toUtf8());
|
||||
if(json.object().value("content").toObject().value("error").toString().length() > 0) {
|
||||
|
||||
mLoginError = json.object().value("content").toObject().value("error").toString();
|
||||
qWarning() << mLoginError;
|
||||
emit loginErrorChanged(mLoginError);
|
||||
|
||||
if(mLoginError == "NOT_LOGGED_IN") {
|
||||
mSessionId = nullptr;
|
||||
mServerUrl = nullptr;
|
||||
|
||||
QSettings settings;
|
||||
settings.remove("sessionId");
|
||||
settings.remove("serverUrl");
|
||||
settings.sync();
|
||||
|
||||
emit sessionIdChanged(mSessionId);
|
||||
}
|
||||
|
||||
} else {
|
||||
mSessionId = json.object().value("content").toObject().value("session_id").toString();
|
||||
|
||||
emit sessionIdChanged(mSessionId);
|
||||
|
||||
QSettings settings;
|
||||
settings.setValue("sessionId", mSessionId);
|
||||
settings.setValue("serverUrl", mServerUrl);
|
||||
settings.sync();
|
||||
}
|
||||
} else {
|
||||
mLoginError = "HTTP error: "
|
||||
+ reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString()
|
||||
+ " :: "
|
||||
+ reply->errorString();
|
||||
qWarning() << mLoginError;
|
||||
|
||||
emit loginErrorChanged(mLoginError);
|
||||
}
|
||||
reply->deleteLater();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* This file is part of FeedTheMonkey.
|
||||
*
|
||||
* Copyright 2015 Jeena
|
||||
*
|
||||
* FeedTheMonkey is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FeedTheMonkey is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FeedTheMonkey. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TINYTINYRSSLOGIN_H
|
||||
#define TINYTINYRSSLOGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaType>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
class TinyTinyRSSLogin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString sessionId READ sessionId NOTIFY sessionIdChanged)
|
||||
Q_PROPERTY(QUrl serverUrl READ serverUrl)
|
||||
Q_PROPERTY(QString loginError READ loginError NOTIFY loginErrorChanged)
|
||||
|
||||
public:
|
||||
TinyTinyRSSLogin(QObject *parent = 0);
|
||||
~TinyTinyRSSLogin();
|
||||
QString sessionId() const { return mSessionId; }
|
||||
QUrl serverUrl() const { return mServerUrl; }
|
||||
QString loginError() const { return mLoginError; }
|
||||
|
||||
Q_INVOKABLE bool loggedIn();
|
||||
Q_INVOKABLE void login(const QString serverUrl, const QString user, const QString password);
|
||||
Q_INVOKABLE void logout();
|
||||
|
||||
signals:
|
||||
void sessionIdChanged(QString);
|
||||
void loginErrorChanged(QString);
|
||||
|
||||
private slots:
|
||||
void reply();
|
||||
|
||||
private:
|
||||
QString mSessionId;
|
||||
QUrl mServerUrl;
|
||||
QString mLoginError;
|
||||
QNetworkAccessManager *mNetworkManager;
|
||||
};
|
||||
|
||||
#endif // TINYTINYRSSLOGIN_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue