new ttrss stuff
This commit is contained in:
parent
87585b44ec
commit
307b8ffae0
8 changed files with 176 additions and 22 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
.DS_Store
|
||||
FeedMonkey.pro.user
|
||||
FeedMonkey.pro.user*
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ TEMPLATE = app
|
|||
|
||||
QT += qml quick
|
||||
|
||||
SOURCES += main.cpp
|
||||
SOURCES += main.cpp \
|
||||
tinytinyrss.cpp
|
||||
|
||||
RESOURCES += qml.qrc \
|
||||
html.qrc
|
||||
|
@ -20,3 +21,6 @@ OTHER_FILES += \
|
|||
content.html \
|
||||
content.css \
|
||||
content.js
|
||||
|
||||
HEADERS += \
|
||||
tinytinyrss.h
|
||||
|
|
62
Login.qml
Normal file
62
Login.qml
Normal file
|
@ -0,0 +1,62 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
|
||||
Rectangle {
|
||||
color: "white"
|
||||
anchors.fill: parent
|
||||
|
||||
function login() {
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
anchors.margins: 20
|
||||
|
||||
Text {
|
||||
text: qsTr("Please specify a server url, a username and a password.")
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: serverUrl
|
||||
placeholderText: "http://example.com/ttrss/"
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
validator: RegExpValidator { regExp: /https?:\/\/.+/ }
|
||||
onAccepted: login()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: userName
|
||||
placeholderText: qsTr("username")
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
onAccepted: login()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: password
|
||||
placeholderText: qsTr("password")
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
echoMode: TextInput.Password
|
||||
onAccepted: login()
|
||||
}
|
||||
|
||||
Button {
|
||||
id: loginButton
|
||||
text: "Ok"
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
onClicked: login()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,83 +2,95 @@ import QtQuick.Controls 1.2
|
|||
|
||||
MenuBar {
|
||||
|
||||
function loggedIn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "File"
|
||||
title: qsTr("File")
|
||||
MenuItem {
|
||||
text: "Close"
|
||||
text: qsTr("Close")
|
||||
shortcut: "Ctrl+W"
|
||||
}
|
||||
MenuItem {
|
||||
text: "Log Out"
|
||||
text: qsTr("Log Out")
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuSeparator { }
|
||||
MenuItem {
|
||||
text: "Exit"
|
||||
text: qsTr("Exit")
|
||||
shortcut: "Ctrl+Q"
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Action"
|
||||
title: qsTr("Action")
|
||||
MenuItem {
|
||||
text: "Reload"
|
||||
text: qsTr("Reload")
|
||||
shortcut: "R"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Show &Starred"
|
||||
text: qsTr("Show &Starred")
|
||||
shortcut: "Ctrl+S"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Set &Starred"
|
||||
text: qsTr("Set &Starred")
|
||||
shortcut: "S"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Set &Unread"
|
||||
text: qsTr("Set &Unread")
|
||||
shortcut: "U"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Next"
|
||||
text: qsTr("Next")
|
||||
shortcut: "J"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Previous"
|
||||
text: qsTr("Previous")
|
||||
shortcut: "K"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Open in Browser"
|
||||
text: qsTr("Open in Browser")
|
||||
shortcut: "N"
|
||||
enabled: loggedIn()
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "View"
|
||||
title: qsTr("View")
|
||||
MenuItem {
|
||||
text: "Zoom In"
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
}
|
||||
MenuItem {
|
||||
text: "Zoom Out"
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
}
|
||||
MenuItem {
|
||||
text: "Reset"
|
||||
text: qsTr("Reset")
|
||||
shortcut: "Ctrl+0"
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Window"
|
||||
title: qsTr("Window")
|
||||
MenuItem {
|
||||
text: "Reset to default"
|
||||
text: qsTr("Reset to default")
|
||||
shortcut: "Ctrl+D"
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Help"
|
||||
title: qsTr("Help")
|
||||
MenuItem {
|
||||
text: "About"
|
||||
text: qsTr("About")
|
||||
onTriggered: Qt.openUrlExternally("http://jabs.nu/feedthemonkey");
|
||||
}
|
||||
}
|
||||
|
|
6
main.qml
6
main.qml
|
@ -11,5 +11,11 @@ ApplicationWindow {
|
|||
|
||||
Content {
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
}
|
||||
|
||||
Login {
|
||||
anchors.fill: parent
|
||||
visible: true
|
||||
}
|
||||
}
|
||||
|
|
1
qml.qrc
1
qml.qrc
|
@ -3,5 +3,6 @@
|
|||
<file>main.qml</file>
|
||||
<file>TheMenuBar.qml</file>
|
||||
<file>Content.qml</file>
|
||||
<file>Login.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
44
tinytinyrss.cpp
Normal file
44
tinytinyrss.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include "tinytinyrss.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
TinyTinyRSS::TinyTinyRSS(QString serverUrl, QString sessionId)
|
||||
{
|
||||
this->serverUrl = serverUrl;
|
||||
this->sessionId = sessionId;
|
||||
}
|
||||
|
||||
TinyTinyRSS::~TinyTinyRSS()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TinyTinyRSS::doOperation(QString operation, QVariantMap opts) {
|
||||
QVariantMap options;
|
||||
options.insert("sid", this->sessionId);
|
||||
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);
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||
|
||||
QUrl url(this->serverUrl + "/api/");
|
||||
QNetworkRequest request(url);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
|
||||
QObject::connect(manager, &QNetworkAccessManager::finished, this, &TinyTinyRSS::replyFinishedOperation);
|
||||
manager->post(request, json);
|
||||
}
|
||||
|
||||
void TinyTinyRSS::replyFinishedOperation(QNetworkReply *reply) {
|
||||
|
||||
}
|
25
tinytinyrss.h
Normal file
25
tinytinyrss.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef TINYTINYRSS_H
|
||||
#define TINYTINYRSS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickItem>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
|
||||
class TinyTinyRSS : QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TinyTinyRSS(QString serverUrl, QString sessionId);
|
||||
~TinyTinyRSS();
|
||||
|
||||
private:
|
||||
QString serverUrl;
|
||||
QString sessionId;
|
||||
|
||||
void doOperation(QString operation, QVariantMap opts);
|
||||
void replyFinishedOperation(QNetworkReply *reply);
|
||||
};
|
||||
|
||||
#endif // TINYTINYRSS_H
|
Loading…
Add table
Add a link
Reference in a new issue