forked from lubuwest/Friendiqa
Native colors and new message create window
This commit is contained in:
parent
17f25d6809
commit
2debd8f2ab
122 changed files with 3525 additions and 3122 deletions
|
@ -47,6 +47,7 @@ void ALARM::setAlarm(int interval)
|
|||
QVariantMap message;
|
||||
message["value"] = interval;
|
||||
AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
|
||||
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setPostNotification", message);
|
||||
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setSchedule", message);
|
||||
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.stopService", message);
|
||||
}
|
||||
|
|
262
source-linux/common/documenthandler.cpp
Normal file
262
source-linux/common/documenthandler.cpp
Normal file
|
@ -0,0 +1,262 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <QQuickTextDocument>
|
||||
#include <QTextCharFormat>
|
||||
#include <QStringDecoder>
|
||||
#include <QTextDocument>
|
||||
#include <QTextDocumentFragment>
|
||||
#include <QTextList>
|
||||
#include <QDebug>
|
||||
#include "documenthandler.h"
|
||||
|
||||
DocumentHandler::DocumentHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_document(nullptr)
|
||||
, m_cursorPosition(-1)
|
||||
, m_selectionStart(0)
|
||||
, m_selectionEnd(0)
|
||||
{
|
||||
}
|
||||
|
||||
QQuickTextDocument *DocumentHandler::document() const
|
||||
{
|
||||
return m_document;
|
||||
}
|
||||
|
||||
void DocumentHandler::setDocument(QQuickTextDocument *document)
|
||||
{
|
||||
if (document == m_document)
|
||||
return;
|
||||
|
||||
if (m_document)
|
||||
disconnect(m_document->textDocument(), &QTextDocument::modificationChanged, this, &DocumentHandler::modifiedChanged);
|
||||
m_document = document;
|
||||
if (m_document)
|
||||
connect(m_document->textDocument(), &QTextDocument::modificationChanged, this, &DocumentHandler::modifiedChanged);
|
||||
emit documentChanged();
|
||||
}
|
||||
|
||||
int DocumentHandler::cursorPosition() const
|
||||
{
|
||||
return m_cursorPosition;
|
||||
}
|
||||
|
||||
void DocumentHandler::setCursorPosition(int position)
|
||||
{
|
||||
if (position == m_cursorPosition)
|
||||
return;
|
||||
|
||||
m_cursorPosition = position;
|
||||
emit cursorPositionChanged();
|
||||
}
|
||||
|
||||
int DocumentHandler::selectionStart() const
|
||||
{
|
||||
return m_selectionStart;
|
||||
}
|
||||
|
||||
void DocumentHandler::setSelectionStart(int position)
|
||||
{
|
||||
if (position == m_selectionStart)
|
||||
return;
|
||||
|
||||
m_selectionStart = position;
|
||||
emit selectionStartChanged();
|
||||
}
|
||||
|
||||
int DocumentHandler::selectionEnd() const
|
||||
{
|
||||
return m_selectionEnd;
|
||||
}
|
||||
|
||||
void DocumentHandler::setSelectionEnd(int position)
|
||||
{
|
||||
if (position == m_selectionEnd)
|
||||
return;
|
||||
|
||||
m_selectionEnd = position;
|
||||
emit selectionEndChanged();
|
||||
}
|
||||
|
||||
QTextCursor DocumentHandler::textCursor() const
|
||||
{
|
||||
QTextDocument *doc = textDocument();
|
||||
if (!doc)
|
||||
return QTextCursor();
|
||||
QTextCursor cursor = QTextCursor(doc);
|
||||
if (m_selectionStart != m_selectionEnd) {
|
||||
cursor.setPosition(m_selectionStart);
|
||||
cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor);
|
||||
} else {
|
||||
cursor.setPosition(m_cursorPosition);
|
||||
}
|
||||
return cursor;
|
||||
}
|
||||
|
||||
QTextDocument *DocumentHandler::textDocument() const
|
||||
{
|
||||
if (!m_document)
|
||||
return nullptr;
|
||||
|
||||
return m_document->textDocument();
|
||||
}
|
||||
|
||||
void DocumentHandler::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
if (!cursor.hasSelection())
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
cursor.mergeCharFormat(format);
|
||||
}
|
||||
|
||||
bool DocumentHandler::modified() const
|
||||
{
|
||||
return m_document && m_document->textDocument()->isModified();
|
||||
}
|
||||
|
||||
void DocumentHandler::setModified(bool m)
|
||||
{
|
||||
if (m_document)
|
||||
m_document->textDocument()->setModified(m);
|
||||
}
|
||||
|
||||
QFont DocumentHandler::font() const
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
if (cursor.isNull())
|
||||
return m_document->textDocument()->defaultFont();
|
||||
QTextCharFormat format = cursor.charFormat();
|
||||
return format.font();
|
||||
}
|
||||
|
||||
void DocumentHandler::setFont(const QFont & font){
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
if (!cursor.isNull() && cursor.charFormat().font() == font)
|
||||
return;
|
||||
|
||||
QTextCharFormat format;
|
||||
format.setFont(font);
|
||||
mergeFormatOnWordOrSelection(format);
|
||||
|
||||
emit fontChanged();
|
||||
}
|
||||
|
||||
bool DocumentHandler::bold() const
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (cursor.isNull())
|
||||
return m_document->textDocument()->defaultFont().bold();
|
||||
return cursor.charFormat().font().bold();
|
||||
}
|
||||
|
||||
void DocumentHandler::setBold(bool bold)
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (!cursor.isNull() && cursor.charFormat().font().bold() == bold)
|
||||
return;
|
||||
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setBold(bold);
|
||||
QTextCharFormat format;
|
||||
format.setFont(font);
|
||||
mergeFormatOnWordOrSelection(format);
|
||||
|
||||
emit boldChanged();
|
||||
}
|
||||
|
||||
bool DocumentHandler::italic() const
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (cursor.isNull())
|
||||
return m_document->textDocument()->defaultFont().italic();
|
||||
return cursor.charFormat().font().italic();
|
||||
}
|
||||
|
||||
void DocumentHandler::setItalic(bool italic)
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (!cursor.isNull() && cursor.charFormat().font().italic() == italic)
|
||||
return;
|
||||
|
||||
QFont font = cursor.charFormat().font();
|
||||
font.setItalic(italic);
|
||||
QTextCharFormat format;
|
||||
format.setFont(font);
|
||||
mergeFormatOnWordOrSelection(format);
|
||||
|
||||
emit italicChanged();
|
||||
}
|
||||
|
||||
bool DocumentHandler::liststyle() const
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (cursor.isNull())
|
||||
return false;
|
||||
return bool(cursor.currentList());
|
||||
}
|
||||
|
||||
void DocumentHandler::setListstyle(bool liststyle)
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
if (!cursor.isNull() && !liststyle){
|
||||
cursor.currentList()->remove(cursor.block());
|
||||
emit liststyleChanged();
|
||||
}else{
|
||||
cursor.createList(QTextListFormat::ListDisc);
|
||||
emit liststyleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool DocumentHandler::codeblock() const
|
||||
{
|
||||
const QTextCursor cursor = textCursor();
|
||||
if (cursor.isNull())
|
||||
return false;
|
||||
qDebug()<< QTextDocumentFragment(cursor).toPlainText();
|
||||
return bool(QTextDocumentFragment(cursor).toMarkdown().contains("```"));
|
||||
}
|
||||
|
||||
void DocumentHandler::setCodeblock(bool codeblock)
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
if (!cursor.isNull() && !codeblock){
|
||||
qDebug()<< "!codeblock ```\n" + QTextDocumentFragment(cursor).toMarkdown() + "\n```";
|
||||
cursor.insertMarkdown("```\n" + QTextDocumentFragment(cursor).toMarkdown() + "\n```");
|
||||
emit codeblockChanged();
|
||||
}
|
||||
else{
|
||||
qDebug()<< "```\n" + QTextDocumentFragment(cursor).toMarkdown() + "\n```";
|
||||
cursor.insertMarkdown(QTextDocumentFragment(cursor).toMarkdown().remove("```"));
|
||||
emit codeblockChanged();
|
||||
}
|
||||
}
|
114
source-linux/common/documenthandler.h
Normal file
114
source-linux/common/documenthandler.h
Normal file
|
@ -0,0 +1,114 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DOCUMENTHANDLER_H
|
||||
#define DOCUMENTHANDLER_H
|
||||
|
||||
//#include <QFont>
|
||||
#include <QObject>
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
#include <QQuickTextDocument>
|
||||
//QT_BEGIN_NAMESPACE
|
||||
//class QTextDocument;
|
||||
//class QQuickTextDocument;
|
||||
//QT_END_NAMESPACE
|
||||
|
||||
class DocumentHandler : public QObject{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QQuickTextDocument *document READ document WRITE setDocument NOTIFY documentChanged)
|
||||
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
|
||||
Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
|
||||
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
|
||||
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
|
||||
Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged)
|
||||
Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged)
|
||||
Q_PROPERTY(bool liststyle READ liststyle WRITE setListstyle NOTIFY liststyleChanged)
|
||||
Q_PROPERTY(bool codeblock READ codeblock WRITE setCodeblock NOTIFY codeblockChanged)
|
||||
Q_PROPERTY(bool modified READ modified WRITE setModified NOTIFY modifiedChanged)
|
||||
|
||||
public:
|
||||
explicit DocumentHandler(QObject *parent = nullptr);
|
||||
|
||||
QQuickTextDocument *document() const;
|
||||
void setDocument(QQuickTextDocument *document);
|
||||
|
||||
int cursorPosition() const;
|
||||
void setCursorPosition(int position);
|
||||
|
||||
int selectionStart() const;
|
||||
void setSelectionStart(int position);
|
||||
|
||||
int selectionEnd() const;
|
||||
void setSelectionEnd(int position);
|
||||
|
||||
QFont font() const;
|
||||
void setFont(const QFont & font);
|
||||
|
||||
bool bold() const;
|
||||
void setBold(bool bold);
|
||||
|
||||
bool italic() const;
|
||||
void setItalic(bool italic);
|
||||
|
||||
bool liststyle() const;
|
||||
void setListstyle(bool liststyle);
|
||||
|
||||
bool modified() const;
|
||||
void setModified(bool m);
|
||||
|
||||
bool codeblock() const;
|
||||
void setCodeblock(bool codeblock);
|
||||
|
||||
signals:
|
||||
void documentChanged();
|
||||
void cursorPositionChanged();
|
||||
void selectionStartChanged();
|
||||
void selectionEndChanged();
|
||||
void fontChanged();
|
||||
void boldChanged();
|
||||
void italicChanged();
|
||||
void liststyleChanged();
|
||||
void codeblockChanged();
|
||||
void error(const QString &message);
|
||||
void modifiedChanged();
|
||||
|
||||
private:
|
||||
QTextCursor textCursor() const;
|
||||
QTextDocument *textDocument() const;
|
||||
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
||||
QQuickTextDocument *m_document;
|
||||
int m_cursorPosition;
|
||||
int m_selectionStart;
|
||||
int m_selectionEnd;
|
||||
};
|
||||
|
||||
#endif // DOCUMENTHANDLER_H
|
|
@ -177,7 +177,13 @@ void FILESYSTEM::setAutostart(bool autostart) {
|
|||
|
||||
QString FILESYSTEM::osType() const
|
||||
{
|
||||
return QSysInfo::productType();
|
||||
QString m_osType;
|
||||
if(QSysInfo::productType()==QString("android")){
|
||||
m_osType="Android";
|
||||
}else{
|
||||
m_osType="Linux";
|
||||
}
|
||||
return m_osType;
|
||||
}
|
||||
|
||||
QString FILESYSTEM::hostname() const
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QtQml/QQmlEngine>
|
||||
#include <QtQml/qqml.h>
|
||||
//#include <QtWebEngine>
|
||||
//#include <QAndroidService>
|
||||
//#include <QtAndroid>
|
||||
|
@ -38,9 +39,10 @@
|
|||
#include "xhr.h"
|
||||
#include "updatenews.h"
|
||||
#include "filesystem.h"
|
||||
#include "remoteauthasyncimageprovider.h"
|
||||
//#include "remoteauthasyncimageprovider.h"
|
||||
#include "alarm.h"
|
||||
#include "oauth.h"
|
||||
#include "documenthandler.h"
|
||||
//#include "AndroidNative/systemdispatcher.h"
|
||||
//#include "AndroidNative/environment.h"
|
||||
//#include "AndroidNative/debug.h"
|
||||
|
@ -48,6 +50,7 @@
|
|||
//#include <QQuickWidget>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
|
||||
// Declare a user-defined data type to work with an icon in QML
|
||||
Q_DECLARE_METATYPE(QSystemTrayIcon::ActivationReason)
|
||||
|
@ -59,11 +62,11 @@ Q_DECLARE_METATYPE(QSystemTrayIcon::ActivationReason)
|
|||
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
Q_UNUSED(vm);
|
||||
qDebug("NativeInterface::JNI_OnLoad()"); // It must call this function within JNI_OnLoad to enable System Dispatcher
|
||||
qDebug("NativeInterface::JNI_OnLoad()"); // It must call this function within JNI_OnLoad to enable System Dispatcher
|
||||
|
||||
AndroidNative::SystemDispatcher::registerNatives();
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
AndroidNative::SystemDispatcher::registerNatives();
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -83,45 +86,47 @@ int main(int argc, char *argv[]) {
|
|||
//return app.exec();
|
||||
}
|
||||
else{
|
||||
//QtWebEngine::initialize();
|
||||
QApplication app(argc, argv);
|
||||
QQmlApplicationEngine view;
|
||||
//QQuickView view;
|
||||
//view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
app.setWindowIcon(QIcon(":/images/Friendiqa.ico"));
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
|
||||
app.installTranslator(&qtTranslator);
|
||||
RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
|
||||
view.addImageProvider("remoteauthimage",imageProvider);
|
||||
view.rootContext()->setContextProperty("remoteauth", imageProvider);
|
||||
XHR* xhr = XHR::instance();
|
||||
view.rootContext()->setContextProperty("xhr", xhr);
|
||||
FILESYSTEM* filesystem = FILESYSTEM::instance();
|
||||
if (qstrcmp(argv[1],"-background")==0){
|
||||
filesystem->setVisibility(false);
|
||||
} else{filesystem->setVisibility(true);}
|
||||
//QtWebEngine::initialize();
|
||||
QGuiApplication::setApplicationName("Friendiqa");
|
||||
QGuiApplication::setOrganizationName("Friendiqa");
|
||||
QApplication app(argc, argv);
|
||||
QQmlApplicationEngine view;
|
||||
//view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
app.setWindowIcon(QIcon(":/images/Friendiqa.ico"));
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
|
||||
app.installTranslator(&qtTranslator);
|
||||
// RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
|
||||
// view.addImageProvider("remoteauthimage",imageProvider);
|
||||
// view.rootContext()->setContextProperty("remoteauth", imageProvider);
|
||||
XHR* xhr = XHR::instance();
|
||||
view.rootContext()->setContextProperty("xhr", xhr);
|
||||
FILESYSTEM* filesystem = FILESYSTEM::instance();
|
||||
if (qstrcmp(argv[1],"-background")==0){
|
||||
filesystem->setVisibility(false);
|
||||
} else{filesystem->setVisibility(true);}
|
||||
|
||||
view.rootContext()->setContextProperty("filesystem", filesystem);
|
||||
ALARM* alarm = ALARM::instance();
|
||||
view.rootContext()->setContextProperty("alarm", alarm);
|
||||
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||
view.rootContext()->setContextProperty("filesystem", filesystem);
|
||||
ALARM* alarm = ALARM::instance();
|
||||
view.rootContext()->setContextProperty("alarm", alarm);
|
||||
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||
updatenews->setDatabase();
|
||||
OAuthWrapper* oauth2 = OAuthWrapper::instance();
|
||||
view.rootContext()->setContextProperty("oauth2", oauth2);
|
||||
qmlRegisterType<DocumentHandler>("io.qt.examples.texteditor", 1, 0, "DocumentHandler");
|
||||
qmlRegisterType<QSystemTrayIcon>("QSystemTrayIcon", 1, 0, "QSystemTrayIcon");
|
||||
qRegisterMetaType<QSystemTrayIcon::ActivationReason>("ActivationReason");
|
||||
view.rootContext()->setContextProperty("iconTrayBlack", QIcon(QPixmap(":/images/friendica-tray-black.svg")));
|
||||
view.rootContext()->setContextProperty("iconTrayWhite", QIcon(QPixmap(":/images/friendica-tray-white.svg")));
|
||||
|
||||
OAuthWrapper* oauth2 = OAuthWrapper::instance();
|
||||
view.rootContext()->setContextProperty("oauth2", oauth2);
|
||||
|
||||
qmlRegisterType<QSystemTrayIcon>("QSystemTrayIcon", 1, 0, "QSystemTrayIcon");
|
||||
qRegisterMetaType<QSystemTrayIcon::ActivationReason>("ActivationReason");
|
||||
view.rootContext()->setContextProperty("iconTray", QIcon(":/images/Friendica_monochrome.png"));
|
||||
view.rootContext()->setContextProperty("iconTrayAvailable", QSystemTrayIcon::isSystemTrayAvailable());
|
||||
|
||||
view.load(QUrl("qrc:/qml/friendiqa.qml"));
|
||||
//view.show();
|
||||
|
||||
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||
return app.exec();
|
||||
view.rootContext()->setContextProperty("iconTrayAvailable", QSystemTrayIcon::isSystemTrayAvailable());
|
||||
if(updatenews->getStyle() != 0){
|
||||
QQuickStyle::setStyle("Material");
|
||||
}
|
||||
view.load(QUrl("qrc:/qml/friendiqa.qml"));
|
||||
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||
return app.exec();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,17 @@ void UPDATENEWS::setDatabase()
|
|||
}
|
||||
}
|
||||
|
||||
int UPDATENEWS::getStyle()
|
||||
{
|
||||
QSqlQuery syncquery("SELECT * FROM globaloptions",m_db);
|
||||
while (syncquery.next()){
|
||||
if (syncquery.value(0).toString()=="view_darkmode"){
|
||||
return syncquery.value(1).toInt();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
QJsonArray UPDATENEWS::getAccounts(QString filtername, QString filtervalue){
|
||||
QString filterstring="";
|
||||
|
|
|
@ -57,6 +57,7 @@ signals:
|
|||
public slots:
|
||||
void setSyncAll(bool syncAll);
|
||||
void setDatabase();
|
||||
int getStyle();
|
||||
void login();
|
||||
void timeline();
|
||||
void replies();
|
||||
|
|
|
@ -227,7 +227,7 @@ void XHR::download()
|
|||
//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)));
|
||||
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||
}
|
||||
|
||||
void XHR::get()
|
||||
|
@ -254,7 +254,7 @@ void XHR::get()
|
|||
reply = manager.get(request);
|
||||
connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess);
|
||||
//connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64)));
|
||||
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
|
||||
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ void XHR::post()
|
|||
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, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
|
||||
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue