TextAutoGenerateText::TextAutoGenerateChatsModel Class

class TextAutoGenerateText::TextAutoGenerateChatsModel

The TextAutoGenerateChatsModel class Author: Laurent Montel <montel@kde.org>. More...

Header: #include <TextAutoGenerateText/TextAutoGenerateChatsModel>
Inherits: QAbstractListModel

Public Types

enum ChatRoles { Title, Archived, Favorite, Identifier, Section, …, Persistence }

Public Functions

TextAutoGenerateChatsModel(QObject *parent = nullptr)
virtual ~TextAutoGenerateChatsModel() override
void addChat(const TextAutoGenerateText::TextAutoGenerateChat &chat)
void archiveDiscussion(const QByteArray &chatId, bool favorite)
void changeFavorite(const QByteArray &chatId, bool favorite)
TextAutoGenerateText::TextAutoGenerateChat chat(const QByteArray &chatId) const
QByteArray chatIdFromChatName(const QString &chatName) const
bool chatInProgress(const QByteArray &chatId) const
bool chatIsArchived(const QByteArray &chatId) const
bool chatIsFavorited(const QByteArray &chatId) const
bool chatIsPersisted(const QByteArray &chatId) const
QByteArray chatProject(const QByteArray &chatId) const
QList<QByteArray> chatTags(const QByteArray &chatId) const
QList<TextAutoGenerateText::TextAutoGenerateChat> chats() const
QList<QByteArray> chatsId() const
void clear()
bool hasAtLeastOneNotArchivedChat() const
bool hasChatInProgress() const
bool isEmpty() const
bool isInitialized(const QByteArray &chatId) const
void messagesChanged(const QByteArray &chatId)
TextAutoGenerateText::TextAutoGenerateMessagesModel *messagesModel(const QByteArray &chatId) const
void removeDiscussion(const QByteArray &chatId)
QList<QByteArray> removeProjectFromChats(const QByteArray &projectId)
QList<QByteArray> removeTagFromChats(const QByteArray &tagId)
void setChatInProgress(const QByteArray &chatId, bool state)
void setChatPersistence(const QByteArray &chatId, TextAutoGenerateText::TextAutoGenerateChat::Persistence persistence)
bool setChatProject(const QByteArray &chatId, const QByteArray &projectId)
bool setChatTags(const QByteArray &chatId, const QList<QByteArray> &tags)
void setChats(const QList<TextAutoGenerateText::TextAutoGenerateChat> &newMessages)
void setInitialized(const QByteArray &chatId, bool state)
void setTextAutoGenerateChatSettings(TextAutoGenerateText::TextAutoGenerateChatSettings *newTextAutoGenerateChatSettings)
void setTextAutoGenerateProjectsManager(TextAutoGenerateText::TextAutoGenerateProjectsManager *newTextAutoGenerateProjectsManager)
void setTextAutoGenerateTagsManager(TextAutoGenerateText::TextAutoGenerateTagsManager *newTextAutoGenerateTagsManager)
TextAutoGenerateText::TextAutoGenerateChatSettings *textAutoGenerateChatSettings() const
TextAutoGenerateText::TextAutoGenerateProjectsManager *textAutoGenerateProjectsManager() const
TextAutoGenerateText::TextAutoGenerateTagsManager *textAutoGenerateTagsManager() const
QString title(const QByteArray &chatId) const

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role) const override
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
virtual int rowCount(const QModelIndex & = {}) const override
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override

Static Public Members

QString sectionName(TextAutoGenerateText::TextAutoGenerateChat::SectionHistory sectionId)

Detailed Description

Member Type Documentation

enum TextAutoGenerateChatsModel::ChatRoles

The ChatRoles enum

Member Function Documentation

[explicit] TextAutoGenerateChatsModel::TextAutoGenerateChatsModel(QObject *parent = nullptr)

Constructs a new TextAutoGenerateChatsModel with the given @p parent.

[override virtual noexcept] TextAutoGenerateChatsModel::~TextAutoGenerateChatsModel()

Destroys the TextAutoGenerateChatsModel object.

void TextAutoGenerateChatsModel::addChat(const TextAutoGenerateText::TextAutoGenerateChat &chat)

Adds the given @p chat to the model.

void TextAutoGenerateChatsModel::archiveDiscussion(const QByteArray &chatId, bool favorite)

Archives or unarchives the discussion with the given @p chatId based on the @p favorite flag.

void TextAutoGenerateChatsModel::changeFavorite(const QByteArray &chatId, bool favorite)

Sets the favorite status of the chat with the given @p chatId to @p favorite.

TextAutoGenerateText::TextAutoGenerateChat TextAutoGenerateChatsModel::chat(const QByteArray &chatId) const

Returns the chat with the given @p chatId, or an empty chat if not found.

QByteArray TextAutoGenerateChatsModel::chatIdFromChatName(const QString &chatName) const

Returns the chat ID for the chat with the given @p chatName, or empty if not found.

bool TextAutoGenerateChatsModel::chatInProgress(const QByteArray &chatId) const

Returns whether the chat with the given @p chatId is currently in progress.

See also setChatInProgress().

bool TextAutoGenerateChatsModel::chatIsArchived(const QByteArray &chatId) const

Returns whether the chat with the given @p chatId is archived.

bool TextAutoGenerateChatsModel::chatIsFavorited(const QByteArray &chatId) const

Returns whether the chat with the given @p chatId is marked as favorite.

bool TextAutoGenerateChatsModel::chatIsPersisted(const QByteArray &chatId) const

chatIsPersisted chatId Returns

QByteArray TextAutoGenerateChatsModel::chatProject(const QByteArray &chatId) const

Returns the identifier of the project the chat with the given @p chatId belongs to, or an empty identifier when it doesn't belong to any project.

See also setChatProject().

QList<QByteArray> TextAutoGenerateChatsModel::chatTags(const QByteArray &chatId) const

Returns the tag identifiers assigned to the chat with the given @p chatId.

See also setChatTags().

QList<TextAutoGenerateText::TextAutoGenerateChat> TextAutoGenerateChatsModel::chats() const

Returns all chats in the model.

See also setChats().

QList<QByteArray> TextAutoGenerateChatsModel::chatsId() const

Returns a list of all chat IDs in the model.

void TextAutoGenerateChatsModel::clear()

clear

[override virtual] QVariant TextAutoGenerateChatsModel::data(const QModelIndex &index, int role) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

Returns the data for the given @p index and @p role.

See also setData().

[override virtual] Qt::ItemFlags TextAutoGenerateChatsModel::flags(const QModelIndex &index) const

Reimplements: QAbstractListModel::flags(const QModelIndex &index) const.

Returns the flags for the given @p index.

bool TextAutoGenerateChatsModel::hasAtLeastOneNotArchivedChat() const

hasAtLeastOneNotArchivedChat Returns true if at least one chat is not archived

bool TextAutoGenerateChatsModel::hasChatInProgress() const

hasChatInProgress Returns true if there is at least one chat in progress.

bool TextAutoGenerateChatsModel::isEmpty() const

Returns whether the model is empty (contains no chats).

bool TextAutoGenerateChatsModel::isInitialized(const QByteArray &chatId) const

void TextAutoGenerateChatsModel::messagesChanged(const QByteArray &chatId)

Notifies that messages have changed for the chat with the given @p chatId.

TextAutoGenerateText::TextAutoGenerateMessagesModel *TextAutoGenerateChatsModel::messagesModel(const QByteArray &chatId) const

Returns the messages model for the chat with the given @p chatId.

void TextAutoGenerateChatsModel::removeDiscussion(const QByteArray &chatId)

Removes the discussion (chat) with the given @p chatId.

QList<QByteArray> TextAutoGenerateChatsModel::removeProjectFromChats(const QByteArray &projectId)

Removes the project identified by @p projectId from every chat which belongs to it, and returns the identifiers of the chats which changed.

QList<QByteArray> TextAutoGenerateChatsModel::removeTagFromChats(const QByteArray &tagId)

Removes the tag identified by @p tagId from every chat which uses it, and returns the identifiers of the chats which changed.

[override virtual] int TextAutoGenerateChatsModel::rowCount(const QModelIndex & = {}) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns the number of rows in the model.

[static] QString TextAutoGenerateChatsModel::sectionName(TextAutoGenerateText::TextAutoGenerateChat::SectionHistory sectionId)

Returns the translated section name for the given @p sectionId.

void TextAutoGenerateChatsModel::setChatInProgress(const QByteArray &chatId, bool state)

Sets the in-progress status of the chat with the given @p chatId to @p state.

See also chatInProgress().

void TextAutoGenerateChatsModel::setChatPersistence(const QByteArray &chatId, TextAutoGenerateText::TextAutoGenerateChat::Persistence persistence)

setChatPersistence chatId persistence

bool TextAutoGenerateChatsModel::setChatProject(const QByteArray &chatId, const QByteArray &projectId)

Moves the chat with the given @p chatId to the project @p projectId, an empty identifier removing it from its project. Returns true when the chat was found and its project changed, so that the caller can store the chat.

See also chatProject().

bool TextAutoGenerateChatsModel::setChatTags(const QByteArray &chatId, const QList<QByteArray> &tags)

Assigns @p tags (tag identifiers) to the chat with the given @p chatId. Returns true when the chat was found and its tags changed, so that the caller can store the chat.

See also chatTags().

void TextAutoGenerateChatsModel::setChats(const QList<TextAutoGenerateText::TextAutoGenerateChat> &newMessages)

Sets the chats to the given list of @p newMessages.

See also chats().

[override virtual] bool TextAutoGenerateChatsModel::setData(const QModelIndex &index, const QVariant &value, int role)

Reimplements: QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role).

Sets the @p value for the given @p index and @p role.

See also data().

void TextAutoGenerateChatsModel::setInitialized(const QByteArray &chatId, bool state)

See also isInitialized().

void TextAutoGenerateChatsModel::setTextAutoGenerateChatSettings(TextAutoGenerateText::TextAutoGenerateChatSettings *newTextAutoGenerateChatSettings)

Sets the TextAutoGenerateChatSettings to @p newTextAutoGenerateChatSettings.

See also textAutoGenerateChatSettings().

void TextAutoGenerateChatsModel::setTextAutoGenerateProjectsManager(TextAutoGenerateText::TextAutoGenerateProjectsManager *newTextAutoGenerateProjectsManager)

setTextAutoGenerateProjectsManager newTextAutoGenerateProjectsManager

See also textAutoGenerateProjectsManager().

void TextAutoGenerateChatsModel::setTextAutoGenerateTagsManager(TextAutoGenerateText::TextAutoGenerateTagsManager *newTextAutoGenerateTagsManager)

setTextAutoGenerateTagsManager newTextAutoGenerateTagsManager

See also textAutoGenerateTagsManager().

TextAutoGenerateText::TextAutoGenerateChatSettings *TextAutoGenerateChatsModel::textAutoGenerateChatSettings() const

Returns the associated TextAutoGenerateChatSettings.

See also setTextAutoGenerateChatSettings().

TextAutoGenerateText::TextAutoGenerateProjectsManager *TextAutoGenerateChatsModel::textAutoGenerateProjectsManager() const

textAutoGenerateProjectsManager Returns

See also setTextAutoGenerateProjectsManager().

TextAutoGenerateText::TextAutoGenerateTagsManager *TextAutoGenerateChatsModel::textAutoGenerateTagsManager() const

textAutoGenerateTagsManager Returns

See also setTextAutoGenerateTagsManager().

QString TextAutoGenerateChatsModel::title(const QByteArray &chatId) const

Returns the title of the chat with the given @p chatId.