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);
|
msgEdit->setFixedHeight(50);
|
||||||
QPalette toxgreen;
|
QPalette toxgreen;
|
||||||
toxgreen.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green
|
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->setFlat(true);
|
||||||
sendButton->setPalette(toxgreen);
|
sendButton->setPalette(toxgreen);
|
||||||
sendButton->setAutoFillBackground(true);
|
sendButton->setAutoFillBackground(true);
|
||||||
sendButton->setFixedSize(50, 50);
|
sendButton->setFixedSize(50, 50);
|
||||||
sendButton->setIconSize(QSize(32,32));
|
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->setFlat(true);
|
||||||
fileButton->setPalette(toxgreen);
|
fileButton->setPalette(toxgreen);
|
||||||
fileButton->setAutoFillBackground(true);
|
fileButton->setAutoFillBackground(true);
|
||||||
fileButton->setIconSize(QSize(16,16));
|
fileButton->setIconSize(QSize(16,16));
|
||||||
fileButton->setFixedSize(24,24);
|
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->setFlat(true);
|
||||||
emoteButton->setPalette(toxgreen);
|
emoteButton->setPalette(toxgreen);
|
||||||
emoteButton->setAutoFillBackground(true);
|
emoteButton->setAutoFillBackground(true);
|
||||||
emoteButton->setIconSize(QSize(16,16));
|
emoteButton->setIconSize(QSize(16,16));
|
||||||
emoteButton->setFixedSize(24,24);
|
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->setFlat(true);
|
||||||
callButton->setPalette(toxgreen);
|
callButton->setPalette(toxgreen);
|
||||||
callButton->setAutoFillBackground(true);
|
callButton->setAutoFillBackground(true);
|
||||||
|
|
|
@ -42,6 +42,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
mainChatLayout->setHorizontalSpacing(10);
|
mainChatLayout->setHorizontalSpacing(10);
|
||||||
|
|
||||||
sendButton->setIcon(QIcon("img/button icons/sendmessage_2x.png"));
|
sendButton->setIcon(QIcon("img/button icons/sendmessage_2x.png"));
|
||||||
|
sendButton->setIconSize(QSize(32,32));
|
||||||
sendButton->setFlat(true);
|
sendButton->setFlat(true);
|
||||||
QPalette pal;
|
QPalette pal;
|
||||||
pal.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green
|
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;
|
QFont small;
|
||||||
small.setPixelSize(10);
|
small.setPixelSize(10);
|
||||||
|
@ -78,7 +78,7 @@ void FriendWidget::setAsActiveFriend()
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendWidget::setAsInactiveFriend()
|
void FriendWidget::setAsInactiveChatroom()
|
||||||
{
|
{
|
||||||
QFont small;
|
QFont small;
|
||||||
small.setPixelSize(10);
|
small.setPixelSize(10);
|
||||||
|
|
|
@ -13,8 +13,8 @@ public:
|
||||||
FriendWidget(int FriendId, QString id);
|
FriendWidget(int FriendId, QString id);
|
||||||
void mouseReleaseEvent (QMouseEvent* event);
|
void mouseReleaseEvent (QMouseEvent* event);
|
||||||
void contextMenuEvent(QContextMenuEvent * event);
|
void contextMenuEvent(QContextMenuEvent * event);
|
||||||
void setAsActiveFriend();
|
void setAsActiveChatroom();
|
||||||
void setAsInactiveFriend();
|
void setAsInactiveChatroom();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendWidgetClicked(FriendWidget* widget);
|
void friendWidgetClicked(FriendWidget* widget);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
GroupWidget::GroupWidget(int GroupId, QString Name)
|
GroupWidget::GroupWidget(int GroupId, QString Name)
|
||||||
: groupId{GroupId}
|
: groupId{GroupId}
|
||||||
{
|
{
|
||||||
|
this->setAutoFillBackground(true);
|
||||||
this->setLayout(&layout);
|
this->setLayout(&layout);
|
||||||
this->setFixedWidth(225);
|
this->setFixedWidth(225);
|
||||||
this->setFixedHeight(55);
|
this->setFixedHeight(55);
|
||||||
|
@ -73,3 +74,35 @@ void GroupWidget::onUserListChanged()
|
||||||
else
|
else
|
||||||
nusers.setText("0 users in chat");
|
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;
|
QLabel avatar, name, nusers;
|
||||||
QHBoxLayout layout;
|
QHBoxLayout layout;
|
||||||
QVBoxLayout textLayout;
|
QVBoxLayout textLayout;
|
||||||
|
void setAsInactiveChatroom();
|
||||||
|
void setAsActiveChatroom();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GROUPWIDGET_H
|
#endif // GROUPWIDGET_H
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
Widget *Widget::instance{nullptr};
|
Widget *Widget::instance{nullptr};
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent) :
|
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->setupUi(this);
|
||||||
ui->mainContent->setLayout(new QVBoxLayout());
|
ui->mainContent->setLayout(new QVBoxLayout());
|
||||||
|
@ -173,7 +173,14 @@ void Widget::hideMainForms()
|
||||||
item->widget()->hide();
|
item->widget()->hide();
|
||||||
while ((item = ui->mainContent->layout()->takeAt(0)) != 0)
|
while ((item = ui->mainContent->layout()->takeAt(0)) != 0)
|
||||||
item->widget()->hide();
|
item->widget()->hide();
|
||||||
activeFriendWidget->setAsInactiveFriend();
|
if (activeFriendWidget != nullptr)
|
||||||
|
{
|
||||||
|
activeFriendWidget->setAsInactiveChatroom();
|
||||||
|
}
|
||||||
|
if (activeGroupWidget != nullptr)
|
||||||
|
{
|
||||||
|
activeGroupWidget->setAsInactiveChatroom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onUsernameChanged(const QString& newUsername)
|
void Widget::onUsernameChanged(const QString& newUsername)
|
||||||
|
@ -301,18 +308,18 @@ void Widget::onFriendUsernameLoaded(int friendId, const QString& username)
|
||||||
|
|
||||||
void Widget::onFriendWidgetClicked(FriendWidget *widget)
|
void Widget::onFriendWidgetClicked(FriendWidget *widget)
|
||||||
{
|
{
|
||||||
if (activeFriendWidget != nullptr)
|
|
||||||
{
|
|
||||||
activeFriendWidget->setAsInactiveFriend();
|
|
||||||
}
|
|
||||||
activeFriendWidget = widget;
|
|
||||||
widget->setAsActiveFriend();
|
|
||||||
Friend* f = FriendList::findFriend(widget->friendId);
|
Friend* f = FriendList::findFriend(widget->friendId);
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hideMainForms();
|
hideMainForms();
|
||||||
f->chatForm->show(*ui);
|
f->chatForm->show(*ui);
|
||||||
|
if (activeFriendWidget != nullptr)
|
||||||
|
{
|
||||||
|
activeFriendWidget->setAsInactiveChatroom();
|
||||||
|
}
|
||||||
|
activeFriendWidget = widget;
|
||||||
|
widget->setAsActiveChatroom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onFriendMessageReceived(int friendId, const QString& message)
|
void Widget::onFriendMessageReceived(int friendId, const QString& message)
|
||||||
|
@ -388,6 +395,12 @@ void Widget::onGroupWidgetClicked(GroupWidget* widget)
|
||||||
|
|
||||||
hideMainForms();
|
hideMainForms();
|
||||||
g->chatForm->show(*ui);
|
g->chatForm->show(*ui);
|
||||||
|
if (activeGroupWidget != nullptr)
|
||||||
|
{
|
||||||
|
activeGroupWidget->setAsInactiveChatroom();
|
||||||
|
}
|
||||||
|
activeGroupWidget = widget;
|
||||||
|
widget->setAsActiveChatroom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::removeGroup(int groupId)
|
void Widget::removeGroup(int groupId)
|
||||||
|
|
|
@ -81,6 +81,7 @@ private:
|
||||||
SettingsForm settingsForm;
|
SettingsForm settingsForm;
|
||||||
static Widget* instance;
|
static Widget* instance;
|
||||||
FriendWidget* activeFriendWidget;
|
FriendWidget* activeFriendWidget;
|
||||||
|
GroupWidget* activeGroupWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIDGET_H
|
#endif // WIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user