diff --git a/src/Chat/Chat.cpp b/src/Chat/Chat.cpp index 30a827d..f76222d 100644 --- a/src/Chat/Chat.cpp +++ b/src/Chat/Chat.cpp @@ -7,43 +7,43 @@ Chat::Chat() {} ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QTextEdit(parent) { - QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay); + QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplayChat); } -void ChatMemoEdit::updateDisplay() { +void ChatMemoEdit::updateDisplayChat() { QString txt = this->toPlainText(); - if (lenDisplayLabel) - lenDisplayLabel->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlen)); + if (lenDisplayLabelchat) + lenDisplayLabelchat->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlenchat)); - if (txt.toUtf8().size() <= maxlen) { + if (txt.toUtf8().size() <= maxlenchat) { // Everything is fine if (sendChatButton) sendChatButton->setEnabled(true); - if (lenDisplayLabel) - lenDisplayLabel->setStyleSheet(""); + if (lenDisplayLabelchat) + lenDisplayLabelchat->setStyleSheet(""); } else { // Overweight if (sendChatButton) sendChatButton->setEnabled(false); - if (lenDisplayLabel) - lenDisplayLabel->setStyleSheet("color: red;"); + if (lenDisplayLabelchat) + lenDisplayLabelchat->setStyleSheet("color: red;"); } } -void ChatMemoEdit::setMaxLen(int len) { - this->maxlen = len; - updateDisplay(); +void ChatMemoEdit::setMaxLenChat(int len) { + this->maxlenchat = len; + updateDisplayChat(); } void ChatMemoEdit::SetSendChatButton(QPushButton* button) { this->sendChatButton = button; } -void ChatMemoEdit::setLenDisplayLabel(QLabel* label) { - this->lenDisplayLabel = label; +void ChatMemoEdit::setLenDisplayLabelChat(QLabel* label) { + this->lenDisplayLabelchat = label; } void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label) @@ -93,5 +93,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label) ui->listChat->setModel(chat); } } - } -} \ No newline at end of file + } +} + + \ No newline at end of file diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 91e46d5..0e636b2 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -8,7 +8,6 @@ #include "ui_mainwindow.h" #include "ui_requestContactDialog.h" #include "addressbook.h" -#include "ui_memodialog.h" #include "ui_contactrequest.h" #include #include diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1f16a60..4f6c428 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1365,7 +1365,7 @@ void MainWindow::setupchatTab() { }); -ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat); +ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 7ec42ba..fb08fdb 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -60,8 +60,8 @@ public: void stopWebsocket(); void saveContact(); void saveandsendContact(); - void setMaxLen(int len); - void updateDisplay(); + // void setmaxlenChat(int len); + // void updateDisplay(); void balancesReady(); @@ -199,14 +199,14 @@ class ChatMemoEdit : public QTextEdit public: ChatMemoEdit(QWidget* parent); - void setMaxLen(int len); - void setLenDisplayLabel(QLabel* label); + void setMaxLenChat(int len); + void setLenDisplayLabelChat(QLabel* label); void SetSendChatButton(QPushButton* button); - void updateDisplay(); + void updateDisplayChat(); private: - int maxlen = 512; - QLabel* lenDisplayLabel = nullptr; + int maxlenchat = 512; + QLabel* lenDisplayLabelchat = nullptr; QPushButton* sendChatButton = nullptr; }; diff --git a/src/memodialog.ui b/src/memodialog.ui index 1c144e0..d365221 100644 --- a/src/memodialog.ui +++ b/src/memodialog.ui @@ -74,7 +74,7 @@ MemoEdit QPlainTextEdit -
memoedit.h
+
memoedit.h