Qt/QML App for Friendiqa
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

updatenews.h 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // This file is part of Friendiqa
  2. // https://git.friendi.ca/lubuwest/Friendiqa
  3. // Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // In addition, as a special exception, the copyright holders give
  11. // permission to link the code of portions of this program with the
  12. // OpenSSL library under certain conditions as described in each
  13. // individual source file, and distribute linked combinations including
  14. // the two.
  15. //
  16. // You must obey the GNU General Public License in all respects for all
  17. // of the code used other than OpenSSL. If you modify file(s) with this
  18. // exception, you may extend this exception to your version of the
  19. // file(s), but you are not obligated to do so. If you do not wish to do
  20. // so, delete this exception statement from your version. If you delete
  21. // this exception statement from all source files in the program, then
  22. // also delete it here.
  23. //
  24. // This program is distributed in the hope that it will be useful,
  25. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. // GNU General Public License for more details.
  28. //
  29. // You should have received a copy of the GNU General Public License
  30. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  31. #ifndef UPDATENEWS_H
  32. #define UPDATENEWS_H
  33. #include <QObject>
  34. #include <QJsonObject>
  35. #include <QSqlDatabase>
  36. #include "xhr.h"
  37. #include "alarm.h"
  38. #include "AndroidNative/systemdispatcher.h"
  39. class UPDATENEWS : public QObject
  40. {
  41. Q_OBJECT
  42. Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
  43. // Q_PROPERTY(QString login READ login NOTIFY loginChanged)
  44. public:
  45. static UPDATENEWS *instance();
  46. explicit UPDATENEWS(QObject *parent = 0);
  47. QString url() const;
  48. //QString login() const;
  49. signals:
  50. void urlChanged(QString url);
  51. void success(QString api);
  52. void error(QString api, QString content);
  53. void quitapp();
  54. public slots:
  55. void setUrl(QString url);
  56. void setDatabase();
  57. void login();
  58. void timeline();
  59. //void startservice(QString type,QVariantMap map);
  60. void startImagedownload();
  61. void updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index);
  62. void store(QByteArray serverreply,QString apiname);
  63. void showError(QString data, QString url,QString api, int code);
  64. private:
  65. QString m_url;
  66. QString m_api;
  67. QString m_imagedir;
  68. QString m_login;
  69. QString username;
  70. QSqlDatabase m_db;
  71. QList<QJsonValue> findNewContacts(QJsonDocument news);
  72. int m_updateInterval;
  73. //void timeline();
  74. //void store(QByteArray serverreply,QString apiname);
  75. void updateContacts(QList<QJsonValue> contacts);
  76. XHR xhr;
  77. ALARM alarm;
  78. QList<QString> newcontactimagelinks;
  79. QList<QString> newcontactnames;
  80. };
  81. #endif // UPDATENEWS_H