Version 0.003

This commit is contained in:
LubuWest 2017-03-25 23:36:14 +01:00
commit 10dccdcdbb
572 changed files with 3711 additions and 13631 deletions

View file

@ -0,0 +1,200 @@
<RCC>
<qresource prefix="/">
<file>qml/friendiqa.qml</file>
<file>qml/newsqml/NewsTab.qml</file>
<file>qml/newsqml/Newsitem.qml</file>
<file>qml/newsqml/MessageSend.qml</file>
<file>qml/newsqml/PermissionDialog.qml</file>
<file>qml/newsqml/Conversation.qml</file>
<file>qml/newsqml/ImageDialog.qml</file>
<file>qml/newsqml/FriendicaActivities.qml</file>
<file>qml/contactqml/FriendsTab.qml</file>
<file>qml/contactqml/GroupComponent.qml</file>
<file>qml/contactqml/ContactComponent.qml</file>
<file>qml/contactqml/ContactDetailsComponent.qml</file>
<file>qml/genericqml/BlueButton.qml</file>
<file>qml/photoqml/PhotoComponent.qml</file>
<file>qml/photoqml/PhotogroupComponent.qml</file>
<file>qml/photoqml/PhotoTab.qml</file>
<file>qml/configqml/InfoBox.qml</file>
<file>qml/configqml/ConfigTab.qml</file>
<file>js/layout.js</file>
<file>js/photoworker.js</file>
<file>js/service.js</file>
<file>js/news.js</file>
<file>js/newsworker.js</file>
<file>js/helper.js</file>
<file>images/defaultcontact.jpg</file>
<file>images/fontawesome-webfont.ttf</file>
<file>images/folder-blue.png</file>
<file>qml/configqml/OSSettingsAndroid.qml</file>
<file>qml/configqml/OSSettingsLinux.qml</file>
<file>qml/newsqml/SmileyDialog.qml</file>
<file>js/smiley.js</file>
<file>images/smileys/animals/bee.gif</file>
<file>images/smileys/animals/bigspider.gif</file>
<file>images/smileys/animals/bunny.gif</file>
<file>images/smileys/animals/bunnyflowers.gif</file>
<file>images/smileys/animals/cat.gif</file>
<file>images/smileys/animals/chick.gif</file>
<file>images/smileys/animals/cow.gif</file>
<file>images/smileys/animals/crab.gif</file>
<file>images/smileys/animals/dog.gif</file>
<file>images/smileys/animals/dolphin.gif</file>
<file>images/smileys/animals/dragonfly.gif</file>
<file>images/smileys/animals/elephant.gif</file>
<file>images/smileys/animals/fish.gif</file>
<file>images/smileys/animals/frog.gif</file>
<file>images/smileys/animals/giraffe.gif</file>
<file>images/smileys/animals/hamster.gif</file>
<file>images/smileys/animals/horse.gif</file>
<file>images/smileys/animals/ladybird.gif</file>
<file>images/smileys/animals/monkey.gif</file>
<file>images/smileys/animals/parrot.gif</file>
<file>images/smileys/animals/pig.gif</file>
<file>images/smileys/animals/sheep.gif</file>
<file>images/smileys/animals/snail.gif</file>
<file>images/smileys/animals/tux.gif</file>
<file>images/smileys/babies/baby.gif</file>
<file>images/smileys/babies/babycot.gif</file>
<file>images/smileys/babies/pregnant.gif</file>
<file>images/smileys/babies/stork.gif</file>
<file>images/smileys/confused/confused.gif</file>
<file>images/smileys/confused/dazed.gif</file>
<file>images/smileys/confused/shrug.gif</file>
<file>images/smileys/confused/stupid.gif</file>
<file>images/smileys/cool/affro.gif</file>
<file>images/smileys/cool/cool.gif</file>
<file>images/smileys/devilangel/angel.gif</file>
<file>images/smileys/devilangel/blondedevil.gif</file>
<file>images/smileys/devilangel/catdevil.gif</file>
<file>images/smileys/devilangel/cherub.gif</file>
<file>images/smileys/devilangel/daseesaw.gif</file>
<file>images/smileys/devilangel/devil.gif</file>
<file>images/smileys/devilangel/graveside.gif</file>
<file>images/smileys/devilangel/saint.gif</file>
<file>images/smileys/devilangel/turnevil.gif</file>
<file>images/smileys/disgust/fartblush.gif</file>
<file>images/smileys/disgust/fartinbed.gif</file>
<file>images/smileys/disgust/toilet.gif</file>
<file>images/smileys/disgust/vomit.gif</file>
<file>images/smileys/drink/tea.gif</file>
<file>images/smileys/drool/drool.gif</file>
<file>images/smileys/fantasy/alienmonster.gif</file>
<file>images/smileys/fantasy/barbarian.gif</file>
<file>images/smileys/fantasy/dinosaur.gif</file>
<file>images/smileys/fantasy/dragon.gif</file>
<file>images/smileys/fantasy/dragonwhelp.gif</file>
<file>images/smileys/fantasy/ghost.gif</file>
<file>images/smileys/fantasy/mummy.gif</file>
<file>images/smileys/fight/2guns.gif</file>
<file>images/smileys/fight/acid.gif</file>
<file>images/smileys/fight/alienfight.gif</file>
<file>images/smileys/fight/alpha.png</file>
<file>images/smileys/fight/army.gif</file>
<file>images/smileys/fight/arrowhead.gif</file>
<file>images/smileys/fight/bfg.gif</file>
<file>images/smileys/fight/bowman.gif</file>
<file>images/smileys/fight/chainsaw.gif</file>
<file>images/smileys/fight/crossbow.gif</file>
<file>images/smileys/fight/crusader.gif</file>
<file>images/smileys/fight/dead.gif</file>
<file>images/smileys/fight/gangs.gif</file>
<file>images/smileys/fight/hammersplat.gif</file>
<file>images/smileys/fight/lasergun.gif</file>
<file>images/smileys/fight/machinegun.gif</file>
<file>images/smileys/fight/marine.gif</file>
<file>images/smileys/fight/sabre.gif</file>
<file>images/smileys/fight/samurai.gif</file>
<file>images/smileys/fight/tank.gif</file>
<file>images/smileys/fight/viking.gif</file>
<file>images/smileys/food/apple.gif</file>
<file>images/smileys/food/banana.gif</file>
<file>images/smileys/food/birthdaycake.gif</file>
<file>images/smileys/food/broccoli.gif</file>
<file>images/smileys/food/cake.gif</file>
<file>images/smileys/food/carrot.gif</file>
<file>images/smileys/food/cooking.gif</file>
<file>images/smileys/food/fryegg.gif</file>
<file>images/smileys/food/popcorn.gif</file>
<file>images/smileys/food/tomato.gif</file>
<file>images/smileys/happy/cloud9.gif</file>
<file>images/smileys/happy/tearsofjoy.gif</file>
<file>images/smileys/laugh/hahaha.gif</file>
<file>images/smileys/laugh/loltv.gif</file>
<file>images/smileys/laugh/rofl.gif</file>
<file>images/smileys/love/iloveyou.gif</file>
<file>images/smileys/love/inlove.gif</file>
<file>images/smileys/love/love.gif</file>
<file>images/smileys/love/lovebear.gif</file>
<file>images/smileys/love/lovebed.gif</file>
<file>images/smileys/love/loveheart.gif</file>
<file>images/smileys/music/dj.gif</file>
<file>images/smileys/music/drums.gif</file>
<file>images/smileys/music/elvis.gif</file>
<file>images/smileys/music/guitar.gif</file>
<file>images/smileys/music/trumpet.gif</file>
<file>images/smileys/music/violin.gif</file>
<file>images/smileys/oldcore/beard.png</file>
<file>images/smileys/oldcore/headbang.gif</file>
<file>images/smileys/oldcore/laughing.gif</file>
<file>images/smileys/oldcore/shaka.gif</file>
<file>images/smileys/oldcore/surprised.gif</file>
<file>images/smileys/oldcore/whitebeard.png</file>
<file>images/smileys/respect/bow.gif</file>
<file>images/smileys/respect/bravo.gif</file>
<file>images/smileys/respect/hailking.gif</file>
<file>images/smileys/respect/number1.gif</file>
<file>images/smileys/sad/crying.png</file>
<file>images/smileys/sad/prisoner.gif</file>
<file>images/smileys/sad/sigh.gif</file>
<file>images/smileys/smoking/smoking.gif</file>
<file>images/smileys/sport/archery.gif</file>
<file>images/smileys/sport/basketball.gif</file>
<file>images/smileys/sport/bowling.gif</file>
<file>images/smileys/sport/cycling.gif</file>
<file>images/smileys/sport/darts.gif</file>
<file>images/smileys/sport/fencing.gif</file>
<file>images/smileys/sport/football.gif</file>
<file>images/smileys/sport/golf.gif</file>
<file>images/smileys/sport/horseriding.gif</file>
<file>images/smileys/sport/juggling.gif</file>
<file>images/smileys/sport/skipping.gif</file>
<file>images/smileys/sport/snooker.gif</file>
<file>images/smileys/sport/surfing.gif</file>
<file>images/smileys/sport/tennis.gif</file>
<file>images/smileys/tired/countsheep.gif</file>
<file>images/smileys/tired/hammock.gif</file>
<file>images/smileys/tired/pillow.gif</file>
<file>images/smileys/tired/yawn.gif</file>
<file>images/smileys/core/beer_mug.gif</file>
<file>images/smileys/core/coffee.gif</file>
<file>images/smileys/core/dislike.gif</file>
<file>images/smileys/core/friendica-16.png</file>
<file>images/smileys/core/like.gif</file>
<file>images/smileys/core/rm-16.png</file>
<file>images/smileys/core/smiley-bangheaddesk.gif</file>
<file>images/smileys/core/smiley-brokenheart.gif</file>
<file>images/smileys/core/smiley-cool.gif</file>
<file>images/smileys/core/smiley-cry.gif</file>
<file>images/smileys/core/smiley-embarassed.gif</file>
<file>images/smileys/core/smiley-facepalm.gif</file>
<file>images/smileys/core/smiley-foot-in-mouth.gif</file>
<file>images/smileys/core/smiley-heart.gif</file>
<file>images/smileys/core/smiley-kiss.gif</file>
<file>images/smileys/core/smiley-laughing.gif</file>
<file>images/smileys/core/smiley-Oo.gif</file>
<file>images/smileys/core/smiley-smile.gif</file>
<file>images/smileys/core/smiley-surprised.gif</file>
<file>images/smileys/core/smiley-thumbsup.gif</file>
<file>images/smileys/core/smiley-tongue-out.gif</file>
<file>images/smileys/core/smiley-undecided.gif</file>
<file>images/smileys/core/smiley-wink.gif</file>
<file>images/smileys/core/smiley-frown.gif</file>
<file>images/smileys/adult/bong.gif</file>
<file>images/smileys/adult/drunk.gif</file>
<file>images/smileys/adult/finger.gif</file>
<file>images/smileys/adult/sperm.gif</file>
<file>images/smileys/adult/tits.gif</file>
</qresource>
</RCC>

View file

@ -0,0 +1,81 @@
#include "filesystem.h"
FILESYSTEM *FILESYSTEM::instance()
{
static FILESYSTEM filesystem;
return &filesystem;
}
FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){}
void FILESYSTEM::setDirectory(QString Directory)
{
if (Directory!=m_Directory) {
m_Directory = Directory;
emit directoryChanged();
}
}
QString FILESYSTEM::Directory() const
{
return m_Directory;
}
QString FILESYSTEM::homePath() const
{
QDir dir(m_Directory);
QString homeDir=dir.homePath();
//qDebug(homeDir);
return homeDir;
}
//QString FILESYSTEM::cameraPath() const
//{
//QAndroidJniObject object = QAndroidJniObject::getStaticObjectField<jstring>("android.os.Environment", "DIRECTORY_DCIM");
//QAndroidJniObject dcim =QAndroidJniObject::callStaticObjectMethod("android.os.Environment","getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", object.object<jobject>());
// return dcim.toString;
//}
//bool FILESYSTEM::direxist(QString Directory) const
//{QDir dir(Directory);
// return dir.exists();
//}
void FILESYSTEM::makeDir(QString name)
{
QDir dir(m_Directory);
if (dir.mkdir(name)){
emit success(name);
}
else {emit error(name,1);}
}
void FILESYSTEM::rmDir()
{
QDir dir(m_Directory);
if (dir.removeRecursively()){
emit success(m_Directory);
}
else {emit error(m_Directory,1);}
}
void FILESYSTEM::rmFile(QString name)
{
QDir dir(m_Directory);
if(dir.remove(name)){
emit success(name);
}
else {emit error(name,1);}
}
QFileInfoList FILESYSTEM::fileList()
{
QDir dir(m_Directory);
QStringList filters;
filters << "*.png" <<"*.PNG" << "*.jpg" << "*.JPG" << "*.JPEG";
dir.setNameFilters(filters);
dir.setSorting(QDir::Time | QDir::Reversed);
//QStringList m_Filelist=dir.entryInfoList();
//qDebug() << "filelist " << m_Filelist;
return dir.entryInfoList();
}

View file

@ -0,0 +1,45 @@
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include <QDir>
#include <QObject>
//#include <QtAndroidExtras>
class FILESYSTEM : public QObject
{
Q_OBJECT
Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged)
//Q_PROPERTY(bool direxist READ direxist)
Q_PROPERTY(QString homePath READ homePath)
//Q_PROPERTY(QString cameraPath READ cameraPath)
public:
static FILESYSTEM *instance();
explicit FILESYSTEM(QObject *parent = 0);
void setDirectory(QString Directory);
QString Directory() const;
QFileInfoList fileList();
//bool direxist(QString Directory);
QString homePath() const;
QString cameraPath() const;
signals:
void directoryChanged();
//void fileListContent(QList data);
void success(QString data);
void error(QString data, int code);
public slots:
void makeDir(QString name);
void rmDir();
void rmFile(QString name);
//void fileList();
private:
QString m_Directory;
QString homeDir;
//QList m_Filelist;
};
#endif // FILSYSTEM_H

View file

@ -0,0 +1,22 @@
#include <QApplication>
#include <QtQml/QQmlEngine>
#include <QtQuick>
#include "xhr.h"
#include "filesystem.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QQuickView view;
XHR* xhr = XHR::instance();
view.rootContext()->setContextProperty("xhr", xhr);
FILESYSTEM* filesystem = FILESYSTEM::instance();
view.rootContext()->setContextProperty("filesystem", filesystem);
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
view.show();
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();
}

View file

@ -0,0 +1,90 @@
#include "uploadableimage.h"
#include <QBuffer>
#include <QDebug>
#include <QFileInfo>
#include <QUrl>
void UploadableImage::setSource(const QString &a) {
if (a != m_source) {
m_source = a;
//m_base64 = "";
m_mimetype = "";
m_filename = "";
qDebug() << "UploadableImage::setSource : " << m_source;
if (m_source=="") {
emit sourceChanged();
//emit base64Changed();
emit mimetypeChanged();
emit filenameChanged();
return;
}
QImage fullimage = QImage(QUrl(m_source).toLocalFile());
if (fullimage.width() > 800 || fullimage.height() > 800) {
if (fullimage.width() > fullimage.height()) {
m_image = fullimage.scaledToWidth(800);
} else {
m_image = fullimage.scaledToHeight(800);
}
} else {
m_image = fullimage;
}
qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height();
emit sourceChanged();
QFileInfo fi(m_source);
m_filename = fi.fileName();
emit filenameChanged();
QString filetype = fi.suffix().toUpper();
if (filetype!="PNG" && filetype!="JPG") {
filetype = "JPG";
}
qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype;
m_mimetype = "image/"+filetype.toLower();
emit mimetypeChanged();
/*
QByteArray byteArray;
QBuffer buffer(&byteArray);
m_image.save(&buffer, filetype.toLatin1().constData());
QString b64 = QString::fromLatin1(byteArray.toBase64().data());
for(int k=0; k<b64.length(); k+=76) {
m_base64 += b64.mid(k,76) + "\n";
}
m_base64 = m_base64.trimmed();
emit base64Changed();
*/
}
}
QString UploadableImage::source() const {
return m_source;
}
//QString UploadableImage::base64() const {
// return m_base64;
//}
QString UploadableImage::filename() const {
return m_filename;
}
QString UploadableImage::mimetype() const {
return m_mimetype;
}
QByteArray UploadableImage::bytes() {
QByteArray byteArray;
QBuffer buffer(&byteArray);
m_image.save(&buffer, "PNG");
return byteArray;
}

View file

@ -0,0 +1,40 @@
#ifndef UPLOADABLEIMAGE_H
#define UPLOADABLEIMAGE_H
#include <QObject>
#include <QQuickItem>
#include <QImage>
class UploadableImage : public QObject
{
Q_OBJECT
Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
//Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed)
Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged)
Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged)
Q_PROPERTY(QByteArray bytes READ bytes)
public:
void setSource(const QString &a);
QString source() const;
//QString base64() const;
QString filename() const;
QString mimetype() const;
QByteArray bytes();
signals:
void sourceChanged();
//void base64Changed();
void filenameChanged();
void mimetypeChanged();
private:
QString m_source;
QImage m_image;
//QString m_base64;
QString m_filename;
QString m_mimetype;
};
#endif // UPLOADABLEIMAGE_H

231
source-linux/common/xhr.cpp Normal file
View file

@ -0,0 +1,231 @@
#include "xhr.h"
#include <QHttpPart>
#include <QTextCodec>
#include <QUrlQuery>
#include "uploadableimage.h"
XHR *XHR::instance()
{
static XHR xhr;
return &xhr;
}
XHR::XHR(QObject *parent) : QObject(parent)
{
request.setSslConfiguration(QSslConfiguration::defaultConfiguration());
}
void XHR::setUrl(QString url)
{
if (url!=m_url) {
m_url = url;
emit urlChanged();
}
}
void XHR::setLogin(QString login)
{
if (login!=m_login) {
m_login = login;
emit loginChanged();
}
}
void XHR::setFilename(QString filename)
{
if (filename!=m_filename) {
m_filename = filename;
emit filenameChanged();
}
}
void XHR::setDownloadtype(QString downloadtype)
{
if (downloadtype!=m_downloadtype) {
m_downloadtype = downloadtype;
emit downloadtypeChanged();
}
}
QString XHR::url() const
{
return m_url;
}
QString XHR::login() const
{
return m_login;
}
QString XHR::filename() const
{
return m_filename;
}
QString XHR::downloadtype() const
{
return m_downloadtype;
}
void XHR::setParam(QString name, QString value)
{
params.insert(name, value);
}
void XHR::setImageFileParam(QString name, QString url)
{
files.insert(name, url);
}
void XHR::clearParams()
{
files.clear();
params.clear();
}
void XHR::download()
{
QUrl requrl(m_url);
request.setUrl(requrl);
reply = manager.get(request);
// reply->ignoreSslErrors();
connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead);
//connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64)));
connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished);
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
}
void XHR::get()
{
QUrlQuery query;
QHashIterator<QString, QString> i(params);
while(i.hasNext()) {
i.next();
query.addQueryItem(i.key(), i.value());
}
QUrl requrl(m_url);
requrl.setQuery(query);
QByteArray loginData = m_login.toLocal8Bit().toBase64();
QString headerData = "Basic " + loginData;
request.setRawHeader("Authorization", headerData.toLocal8Bit());
request.setUrl(requrl);
reply = manager.get(request);
connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
}
void XHR::post()
{
qDebug() << "start post to " << m_url;
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QHashIterator<QString, QString> iparams(params);
while(iparams.hasNext()) {
iparams.next();
qDebug() << "\t add param " << iparams.key() << " : " << iparams.value();
QHttpPart textPart;
textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\""));
textPart.setBody(iparams.value().toUtf8());
multiPart->append(textPart);
}
UploadableImage uimg;
QHashIterator<QString, QString> ifiles(files);
while(ifiles.hasNext()) {
ifiles.next();
uimg.setSource(ifiles.value());
qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key();
QHttpPart imagePart;
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype()));
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\""));
imagePart.setBody(uimg.bytes());
multiPart->append(imagePart);
}
QByteArray loginData = m_login.toLocal8Bit().toBase64();
QString headerData = "Basic " + loginData;
request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit());
request.setUrl(m_url);
reply = manager.post(request, multiPart);
qDebug() << "\t request sent";
connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
qDebug() << "\t reply signals connected";
}
void XHR::onReplyError(QNetworkReply::NetworkError code)
{
qDebug() << code;
emit this->error( bufferToString(), (int) code);
buffer.clear();
reply->deleteLater();
}
void XHR::onReplySuccess()
{
qDebug() << "!";
emit this->success( bufferToString() );
buffer.clear();
reply->deleteLater();
}
void XHR::onRequestFinished()
{
// Save the file here
//qDebug() << "buffer downloaded "<<buffer;
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,1);}
else {QFile file(m_filename);
file.open(QIODevice::WriteOnly);
file.write(buffer);
buffer.clear();
file.close();
emit this->downloaded(m_downloadtype);
//reply->deleteLater();
}
}
void XHR::onReadyRead()
{
qDebug() << ".";
buffer += reply->readAll();
}
//void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
//{
// qDebug() << "Bytes: " << bytesRead<<" / "<<totalBytes;
//}
void XHR::onSSLError(const QList<QSslError> &errors)
{
qDebug() << "XHR::onSSLError :" ;
QListIterator<QSslError> ierrs(errors);
while(ierrs.hasNext()) {
qDebug() << "\t" << ierrs.next().errorString();
}
}
QString XHR::bufferToString()
{
return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
}

73
source-linux/common/xhr.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef XHR_H
#define XHR_H
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QObject>
class XHR : public QObject
{
Q_OBJECT
Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged)
Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged)
public:
static XHR *instance();
explicit XHR(QObject *parent = 0);
QString url() const;
QString login() const;
QString filename() const;
QString downloadtype() const;
signals:
void urlChanged();
void loginChanged();
void filenameChanged();
void downloadtypeChanged();
void downloaded(QString data);
void success(QString data);
void error(QString data, int code);
public slots:
void setUrl(QString url);
void setLogin(QString login);
void setDownloadtype(QString downloadtype);
void setFilename(QString filename);
void setParam(QString name, QString value);
void setImageFileParam(QString name, QString url);
void clearParams();
void post();
void get();
void download();
private slots:
void onReplyError(QNetworkReply::NetworkError code);
void onReplySuccess();
void onRequestFinished();
void onReadyRead();
void onSSLError(const QList<QSslError> &errors);
//void updateDownloadProgress(qint64 bytesRead, qint64 totalBytes);
private:
QByteArray buffer;
QString m_url;
QString m_login;
QString m_filename;
QString m_downloadtype;
QHash<QString, QString> params;
QHash<QString, QString> files;
QNetworkAccessManager manager;
QNetworkRequest request;
QNetworkReply *reply;
QString bufferToString();
};
#endif // XHR_H

View file

@ -0,0 +1,44 @@
# NOTICE:
#
# Application name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, the following needs to be done
# to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
# - translation filenames have to be changed
# The name of your application
TARGET = friendiqa
CONFIG += debug
QT += qml quick gui widgets
SOURCES += common/friendiqa.cpp \
common/uploadableimage.cpp \
common/xhr.cpp \
common/filesystem.cpp
RESOURCES = application.qrc
OTHER_FILES += qml/friendiqa.qml \
translations/*.ts \
qml/*.qml
qml/newsqml/*.qml
qml/contactqml/*.qml
qml/photoqml/*.qml
qml/configqml/*.qml
js/*.js
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/friendiqa-de.ts
HEADERS += \
common/uploadableimage.h \
common/xhr.h \
common/filesystem.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Some files were not shown because too many files have changed in this diff Show more