Browse Source

Merge pull request #6294

Mick Sayson (1):
      refactor(chatform): Use IChatLog to get date in GenericChatForm
reviewable/pr6235/r9
Anthony Bilinski 5 years ago
parent
commit
fe421d11a1
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 21
      src/chatlog/chatlog.cpp
  2. 3
      src/chatlog/chatlog.h
  3. 8
      src/widget/form/genericchatform.cpp
  4. 1
      src/widget/form/genericchatform.h

21
src/chatlog/chatlog.cpp

@ -595,27 +595,6 @@ ChatLine::Ptr ChatLog::getTypingNotification() const @@ -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

3
src/chatlog/chatlog.h

@ -67,9 +67,6 @@ public: @@ -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;

8
src/widget/form/genericchatform.cpp

@ -404,12 +404,10 @@ void GenericChatForm::hideFileMenu() @@ -404,12 +404,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()

1
src/widget/form/genericchatform.h

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

Loading…
Cancel
Save