diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 3801f7017..de4fb6b0c 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -38,25 +38,25 @@ ChatForm::ChatForm(Friend* chatFriend) msgEdit->setFixedHeight(50); QPalette toxgreen; toxgreen.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green - sendButton->setIcon(QIcon("img/button icons/sendmessage.svg")); + sendButton->setIcon(QIcon("img/button icons/sendmessage_2x.png")); sendButton->setFlat(true); sendButton->setPalette(toxgreen); sendButton->setAutoFillBackground(true); sendButton->setFixedSize(50, 50); sendButton->setIconSize(QSize(32,32)); - fileButton->setIcon(QIcon("img/button icons/attach.svg")); + fileButton->setIcon(QIcon("img/button icons/attach_2x.png")); fileButton->setFlat(true); fileButton->setPalette(toxgreen); fileButton->setAutoFillBackground(true); fileButton->setIconSize(QSize(16,16)); fileButton->setFixedSize(24,24); - emoteButton->setIcon(QIcon("img/button icons/emoticon.svg")); + emoteButton->setIcon(QIcon("img/button icons/emoticon_2x.png")); emoteButton->setFlat(true); emoteButton->setPalette(toxgreen); emoteButton->setAutoFillBackground(true); emoteButton->setIconSize(QSize(16,16)); emoteButton->setFixedSize(24,24); - callButton->setIcon(QIcon("img/button icons/call.svg")); + callButton->setIcon(QIcon("img/button icons/call_2x.png")); callButton->setFlat(true); callButton->setPalette(toxgreen); callButton->setAutoFillBackground(true); diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index fa37d5bcc..03c6aed3f 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -42,6 +42,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup) mainChatLayout->setHorizontalSpacing(10); sendButton->setIcon(QIcon("img/button icons/sendmessage_2x.png")); + sendButton->setIconSize(QSize(32,32)); sendButton->setFlat(true); QPalette pal; pal.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index 265cde30c..cf4fd81f0 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -62,7 +62,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) } } -void FriendWidget::setAsActiveFriend() +void FriendWidget::setAsActiveChatroom() { QFont small; small.setPixelSize(10); @@ -78,7 +78,7 @@ void FriendWidget::setAsActiveFriend() this->setPalette(pal3); } -void FriendWidget::setAsInactiveFriend() +void FriendWidget::setAsInactiveChatroom() { QFont small; small.setPixelSize(10); diff --git a/widget/friendwidget.h b/widget/friendwidget.h index f5d0f4f6a..3d733c63d 100644 --- a/widget/friendwidget.h +++ b/widget/friendwidget.h @@ -13,8 +13,8 @@ public: FriendWidget(int FriendId, QString id); void mouseReleaseEvent (QMouseEvent* event); void contextMenuEvent(QContextMenuEvent * event); - void setAsActiveFriend(); - void setAsInactiveFriend(); + void setAsActiveChatroom(); + void setAsInactiveChatroom(); signals: void friendWidgetClicked(FriendWidget* widget); diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index 9cb54a6ad..c6c7a5c28 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -8,6 +8,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name) : groupId{GroupId} { + this->setAutoFillBackground(true); this->setLayout(&layout); this->setFixedWidth(225); this->setFixedHeight(55); @@ -73,3 +74,35 @@ void GroupWidget::onUserListChanged() else nusers.setText("0 users in chat"); } + +void GroupWidget::setAsActiveChatroom() +{ + QFont small; + small.setPixelSize(10); + nusers.setFont(small); + QPalette pal; + pal.setColor(QPalette::WindowText,Qt::darkGray); + nusers.setPalette(pal); + QPalette pal2; + pal2.setColor(QPalette::WindowText,Qt::black); + name.setPalette(pal2); + QPalette pal3; + pal3.setColor(QPalette::Background, Qt::white); + this->setPalette(pal3); +} + +void GroupWidget::setAsInactiveChatroom() +{ + QFont small; + small.setPixelSize(10); + nusers.setFont(small); + QPalette pal; + pal.setColor(QPalette::WindowText,Qt::gray); + nusers.setPalette(pal); + QPalette pal2; + pal2.setColor(QPalette::WindowText,Qt::white); + name.setPalette(pal2); + QPalette pal3; + pal3.setColor(QPalette::Background, QColor(63,63,63,255)); + this->setPalette(pal3); +} diff --git a/widget/groupwidget.h b/widget/groupwidget.h index 3ab5ae18e..b88262f02 100644 --- a/widget/groupwidget.h +++ b/widget/groupwidget.h @@ -24,6 +24,8 @@ public: QLabel avatar, name, nusers; QHBoxLayout layout; QVBoxLayout textLayout; + void setAsInactiveChatroom(); + void setAsActiveChatroom(); }; #endif // GROUPWIDGET_H diff --git a/widget/widget.cpp b/widget/widget.cpp index 809b29287..21dbc1fcc 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -15,7 +15,7 @@ Widget *Widget::instance{nullptr}; Widget::Widget(QWidget *parent) : - QWidget(parent), ui(new Ui::Widget), activeFriendWidget{nullptr} + QWidget(parent), ui(new Ui::Widget), activeFriendWidget{nullptr}, activeGroupWidget{nullptr} { ui->setupUi(this); ui->mainContent->setLayout(new QVBoxLayout()); @@ -173,7 +173,14 @@ void Widget::hideMainForms() item->widget()->hide(); while ((item = ui->mainContent->layout()->takeAt(0)) != 0) item->widget()->hide(); - activeFriendWidget->setAsInactiveFriend(); + if (activeFriendWidget != nullptr) + { + activeFriendWidget->setAsInactiveChatroom(); + } + if (activeGroupWidget != nullptr) + { + activeGroupWidget->setAsInactiveChatroom(); + } } void Widget::onUsernameChanged(const QString& newUsername) @@ -301,18 +308,18 @@ void Widget::onFriendUsernameLoaded(int friendId, const QString& username) void Widget::onFriendWidgetClicked(FriendWidget *widget) { - if (activeFriendWidget != nullptr) - { - activeFriendWidget->setAsInactiveFriend(); - } - activeFriendWidget = widget; - widget->setAsActiveFriend(); Friend* f = FriendList::findFriend(widget->friendId); if (!f) return; hideMainForms(); f->chatForm->show(*ui); + if (activeFriendWidget != nullptr) + { + activeFriendWidget->setAsInactiveChatroom(); + } + activeFriendWidget = widget; + widget->setAsActiveChatroom(); } void Widget::onFriendMessageReceived(int friendId, const QString& message) @@ -388,6 +395,12 @@ void Widget::onGroupWidgetClicked(GroupWidget* widget) hideMainForms(); g->chatForm->show(*ui); + if (activeGroupWidget != nullptr) + { + activeGroupWidget->setAsInactiveChatroom(); + } + activeGroupWidget = widget; + widget->setAsActiveChatroom(); } void Widget::removeGroup(int groupId) diff --git a/widget/widget.h b/widget/widget.h index b12657fab..939a86a18 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -81,6 +81,7 @@ private: SettingsForm settingsForm; static Widget* instance; FriendWidget* activeFriendWidget; + GroupWidget* activeGroupWidget; }; #endif // WIDGET_H