-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuilogic.h
More file actions
68 lines (59 loc) · 1.87 KB
/
Copy pathuilogic.h
File metadata and controls
68 lines (59 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/////////////////////////////////////////////////////////////////////////////
// Name: uilogic.h
// Purpose: QListWidget & QTextEdit logic, JSON conversion (header)
// Author: Jan Buchholz
// Created: 2025-10-13
// Changed: 2026-05-22
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <QTextEdit>
#include <QTextBrowser>
#include <QJsonObject>
#include <QByteArray>
#include <QMainWindow>
#include "jblistwidget.h"
class UILogic : public QObject {
Q_OBJECT
public:
explicit UILogic(QMainWindow *parent);
~UILogic();
typedef struct {
int id;
int icon;
QString subject;
QString payload;
} journalData;
QListWidget* getListWidget() const {return m_listWidget;}
QTextEdit* getEditor() const {return m_Editor;}
void resetAll();
void startUp(const QByteArray ba, QString workDir);
bool addListItem();
bool editListItem();
bool deleteListItem();
UILogic::journalData getSelectedListItem();
bool getTextChangeIgnore() const {return m_textChangeIgnore;}
void openListSettingsDialog();
bool isAnyItemSelected();
int getItemCount();
QByteArray dataToJson();
private:
QMainWindow* m_mainWindow;
JBListWidget* m_listWidget;
QTextEdit* m_Editor;
QVector<journalData> m_data;
int m_id;
bool m_textChangeIgnore;
void createListWidget();
void createEditor();
void setPayload(int id, QString payload);
QString getPayLoad(int id);
void jsonToData(QByteArray ba);
QJsonObject journalDataToJson(journalData data);
journalData journalDataFromJson(QJsonObject json);
private slots:
void onCurrentItemChanged(QListWidgetItem*, QListWidgetItem*);
void onJBListDropEvent();
signals:
void listChanged();
};