WUT_Computer_Science/EGUI/lab1/blogentry.h

46 lines
911 B
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 02:20:29 +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:
void on_saveEntry_clicked();
void saveEntry();
QJsonObject readJsonFile(const QString title);
void saveJsonFile(QJsonObject &users, const QString name) const;
2022-04-06 02:20:29 +02:00
void removeEntry();
void on_pushButton_clicked();
2022-04-06 01:06:01 +02:00
2022-04-06 03:20:04 +02:00
void on_editEntryButton_clicked();
void editEntry();
void saveEditedEntry();
2022-04-06 14:30:57 +02:00
2022-04-04 21:22:50 +02:00
private:
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