mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
commit
ae4d8ba095
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
QLabel avatar, name, nusers;
|
||||
QHBoxLayout layout;
|
||||
QVBoxLayout textLayout;
|
||||
void setAsInactiveChatroom();
|
||||
void setAsActiveChatroom();
|
||||
};
|
||||
|
||||
#endif // GROUPWIDGET_H
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -81,6 +81,7 @@ private:
|
|||
SettingsForm settingsForm;
|
||||
static Widget* instance;
|
||||
FriendWidget* activeFriendWidget;
|
||||
GroupWidget* activeGroupWidget;
|
||||
};
|
||||
|
||||
#endif // WIDGET_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user