mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-10 01:10:35 +00:00
Respond to translation events by invalidating the model.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
parent
d515ad3b18
commit
8f261d06db
@ -29,7 +29,17 @@ ChatListModel *ChatListModel::globalInstance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChatListModel::ChatListModel()
|
ChatListModel::ChatListModel()
|
||||||
: QAbstractListModel(nullptr) {}
|
: QAbstractListModel(nullptr) {
|
||||||
|
|
||||||
|
QCoreApplication::instance()->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChatListModel::eventFilter(QObject *obj, QEvent *ev)
|
||||||
|
{
|
||||||
|
if (obj == QCoreApplication::instance() && ev->type() == QEvent::LanguageChange)
|
||||||
|
emit dataChanged(index(0, 0), index(m_chats.size() - 1, 0));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ChatListModel::loadChats()
|
void ChatListModel::loadChats()
|
||||||
{
|
{
|
||||||
|
@ -242,6 +242,9 @@ Q_SIGNALS:
|
|||||||
void requestSaveChats(const QVector<Chat*> &);
|
void requestSaveChats(const QVector<Chat*> &);
|
||||||
void saveChatsFinished();
|
void saveChatsFinished();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void newChatCountChanged()
|
void newChatCountChanged()
|
||||||
{
|
{
|
||||||
|
@ -483,6 +483,8 @@ ModelList::ModelList()
|
|||||||
, m_discoverResultsCompleted(0)
|
, m_discoverResultsCompleted(0)
|
||||||
, m_discoverInProgress(false)
|
, m_discoverInProgress(false)
|
||||||
{
|
{
|
||||||
|
QCoreApplication::instance()->installEventFilter(this);
|
||||||
|
|
||||||
m_installedModels->setSourceModel(this);
|
m_installedModels->setSourceModel(this);
|
||||||
m_selectableModels->setSourceModel(this);
|
m_selectableModels->setSourceModel(this);
|
||||||
m_downloadableModels->setSourceModel(this);
|
m_downloadableModels->setSourceModel(this);
|
||||||
@ -508,6 +510,15 @@ ModelList::ModelList()
|
|||||||
updateModelsFromJson();
|
updateModelsFromJson();
|
||||||
updateModelsFromSettings();
|
updateModelsFromSettings();
|
||||||
updateModelsFromDirectory();
|
updateModelsFromDirectory();
|
||||||
|
|
||||||
|
QCoreApplication::instance()->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelList::eventFilter(QObject *obj, QEvent *ev)
|
||||||
|
{
|
||||||
|
if (obj == QCoreApplication::instance() && ev->type() == QEvent::LanguageChange)
|
||||||
|
emit dataChanged(index(0, 0), index(m_models.size() - 1, 0));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ModelList::incompleteDownloadPath(const QString &modelFile)
|
QString ModelList::incompleteDownloadPath(const QString &modelFile)
|
||||||
|
@ -460,6 +460,9 @@ Q_SIGNALS:
|
|||||||
void discoverProgressChanged();
|
void discoverProgressChanged();
|
||||||
void discoverInProgressChanged();
|
void discoverInProgressChanged();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void resortModel();
|
void resortModel();
|
||||||
void updateModelsFromJson();
|
void updateModelsFromJson();
|
||||||
|
Loading…
Reference in New Issue
Block a user