WUT_Computer_Science/Programming/EGUI/lab1/blogentry.h

58 lines
1.3 KiB
C
Raw Normal View History

2022-04-04 21:22:50 +02:00
#ifndef BLOGENTRY_H
#define BLOGENTRY_H
#include <QWidget>
2022-04-05 00:26:36 +02:00
#include <QJsonObject>
#include <QFile>
#include <QJsonDocument>
2022-04-04 21:22:50 +02:00
namespace Ui {
class blogEntry;
}
class blogEntry : public QWidget
{
Q_OBJECT
public:
explicit blogEntry(QWidget *parent = nullptr);
~blogEntry();
2022-04-05 00:26:36 +02:00
void setUserId(const QString &userId);
2022-04-06 01:06:01 +02:00
void setBlogId(const QString &blogId);
2022-04-06 19:44:14 +02:00
void setUpBlogEntryFromJson(const QJsonObject &entry);
2022-04-04 21:22:50 +02:00
2022-04-05 00:26:36 +02:00
private slots:
2022-04-06 01:06:01 +02:00
2022-04-06 19:44:14 +02:00
private:
void removeEntry();
void enableEdition();
void disableEdition();
void saveEntryMethod();
void enableEditing();
2022-04-06 03:20:04 +02:00
void editEntry();
void saveEditedEntry();
2022-04-06 19:44:14 +02:00
void defineConnections() const;
void editEntryClicked();
void saveEntry(QJsonObject &blogEntryJson, QJsonObject &blogsFile);
void saveItemToBlogEntryToBlogsFile(QJsonArray &items, QJsonObject &blogEntryJson, QJsonObject &blogsFile);
void fillEntry(const QJsonObject &entry);
2022-04-06 03:20:04 +02:00
2022-04-06 19:44:14 +02:00
int findEntry(const QJsonArray &items);
QJsonArray removeEntryFromArray(const QJsonObject &blogEntryJson);
QJsonArray addEdit(const QJsonObject &blogEntryJson);
QJsonArray getItemsList();
QJsonObject setDateTime(QJsonObject &entry);
QJsonObject setEntry();
2022-04-06 14:30:57 +02:00
2022-04-04 21:22:50 +02:00
Ui::blogEntry *ui;
2022-04-05 00:26:36 +02:00
QString userId;
2022-04-06 01:06:01 +02:00
QString blogId;
2022-04-06 03:20:04 +02:00
QString dateTime;
bool editMode;
2022-04-04 21:22:50 +02:00
};
#endif // BLOGENTRY_H