add removal of chat sessions, auto title + icon, proper stick-to-bottom as response is streamed
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
|
||||
#include "session.hpp"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QSqlDatabase>
|
||||
#include <QString>
|
||||
#include <QVariantList>
|
||||
|
||||
namespace ZShell {
|
||||
@@ -19,6 +20,7 @@ class ChatStore : public QObject {
|
||||
|
||||
public:
|
||||
explicit ChatStore(QObject* parent = nullptr);
|
||||
~ChatStore();
|
||||
|
||||
[[nodiscard]] int count() const;
|
||||
[[nodiscard]] QVariantList values() const;
|
||||
@@ -32,24 +34,25 @@ class ChatStore : public QObject {
|
||||
|
||||
[[nodiscard]] ChatSession* sessionById(const QString& id);
|
||||
void persist(ChatSession* session);
|
||||
void saveMeta(ChatSession* session);
|
||||
void loadMessagesInto(ChatSession* session);
|
||||
|
||||
Q_SIGNALS:
|
||||
void countChanged();
|
||||
void valuesChanged();
|
||||
|
||||
private:
|
||||
void openDb();
|
||||
void load();
|
||||
void migrateLegacy();
|
||||
bool saveSession(ChatSession* session);
|
||||
void sortAndNotify();
|
||||
void removeSession(ChatSession* session);
|
||||
bool isStreaming(ChatSession* session) const;
|
||||
void notify(const QList<ChatSession*>& before);
|
||||
|
||||
QList<ChatSession*> m_sessions;
|
||||
QString m_connectionName;
|
||||
|
||||
static QString dir();
|
||||
static QString pathFor(const QString& id);
|
||||
static bool writeFile(const QString& path, const QJsonObject& doc);
|
||||
[[nodiscard]] QSqlDatabase db() const;
|
||||
|
||||
friend class Chat;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user