1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(chatform): Use IChatLog to get date in GenericChatForm

* Allows for deletion of APIs returning ChatLine::Ptr from ChatLog
* Bonus removal of unused "getFirstTime" function from GenericChatForm
This commit is contained in:
Mick Sayson 2021-01-30 17:02:40 -08:00 committed by Anthony Bilinski
parent ef47c00c8d
commit d0f4c336ba
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
4 changed files with 3 additions and 30 deletions

View File

@ -595,27 +595,6 @@ ChatLine::Ptr ChatLog::getTypingNotification() const
return typingNotification;
}
QVector<ChatLine::Ptr> ChatLog::getLines()
{
return lines;
}
ChatLine::Ptr ChatLog::getLatestLine() const
{
if (!lines.empty()) {
return lines.last();
}
return nullptr;
}
ChatLine::Ptr ChatLog::getFirstLine() const
{
if (!lines.empty()) {
return lines.first();
}
return nullptr;
}
/**
* @brief Finds the chat line object at a position on screen
* @param pos Position on screen in global coordinates

View File

@ -67,9 +67,6 @@ public:
bool hasTextToBeCopied() const;
ChatLine::Ptr getTypingNotification() const;
QVector<ChatLine::Ptr> getLines();
ChatLine::Ptr getLatestLine() const;
ChatLine::Ptr getFirstLine() const;
ChatLineContent* getContentFromGlobalPos(QPoint pos) const;
const uint repNameAfter = 5 * 60;

View File

@ -402,12 +402,10 @@ void GenericChatForm::hideFileMenu()
QDateTime GenericChatForm::getLatestTime() const
{
return getTime(chatWidget->getLatestLine());
}
if (chatLog.getFirstIdx() == chatLog.getNextIdx())
return QDateTime();
QDateTime GenericChatForm::getFirstTime() const
{
return getTime(chatWidget->getFirstLine());
return chatLog.at(chatLog.getNextIdx() - 1).getTimestamp();
}
void GenericChatForm::reloadTheme()

View File

@ -80,7 +80,6 @@ public:
const QDateTime& datetime);
static QString resolveToxPk(const ToxPk& pk);
QDateTime getLatestTime() const;
QDateTime getFirstTime() const;
signals:
void messageInserted();