mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #2 from F1ynn/master
Add emote button (disabled), color for active friend
This commit is contained in:
commit
4af09eebf6
|
@ -14,10 +14,10 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
main = new QWidget(), head = new QWidget(), chatAreaWidget = new QWidget();
|
main = new QWidget(), head = new QWidget(), chatAreaWidget = new QWidget();
|
||||||
name = new QLabel(), avatar = new QLabel(), statusMessage = new QLabel();
|
name = new QLabel(), avatar = new QLabel(), statusMessage = new QLabel();
|
||||||
headLayout = new QHBoxLayout(), mainFootLayout = new QHBoxLayout();
|
headLayout = new QHBoxLayout(), mainFootLayout = new QHBoxLayout();
|
||||||
headTextLayout = new QVBoxLayout(), mainLayout = new QVBoxLayout();
|
headTextLayout = new QVBoxLayout(), mainLayout = new QVBoxLayout(), footButtonsSmall = new QVBoxLayout();
|
||||||
mainChatLayout = new QGridLayout();
|
mainChatLayout = new QGridLayout();
|
||||||
msgEdit = new ChatTextEdit();
|
msgEdit = new ChatTextEdit();
|
||||||
sendButton = new QPushButton(), fileButton = new QPushButton(), callButton = new QPushButton();
|
sendButton = new QPushButton(), fileButton = new QPushButton(), emoteButton = new QPushButton(), callButton = new QPushButton();
|
||||||
chatArea = new QScrollArea();
|
chatArea = new QScrollArea();
|
||||||
|
|
||||||
QFont bold;
|
QFont bold;
|
||||||
|
@ -33,34 +33,46 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
mainChatLayout->setColumnStretch(1,1);
|
mainChatLayout->setColumnStretch(1,1);
|
||||||
mainChatLayout->setSpacing(10);
|
mainChatLayout->setSpacing(10);
|
||||||
|
|
||||||
|
footButtonsSmall->setSpacing(2);
|
||||||
|
|
||||||
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_2x.png"));
|
sendButton->setIcon(QIcon("img/button icons/sendmessage.svg"));
|
||||||
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(25,25));
|
sendButton->setIconSize(QSize(32,32));
|
||||||
fileButton->setIcon(QIcon("img/button icons/attach_2x.png"));
|
fileButton->setIcon(QIcon("img/button icons/attach.svg"));
|
||||||
fileButton->setFlat(true);
|
fileButton->setFlat(true);
|
||||||
fileButton->setPalette(toxgreen);
|
fileButton->setPalette(toxgreen);
|
||||||
fileButton->setAutoFillBackground(true);
|
fileButton->setAutoFillBackground(true);
|
||||||
fileButton->setIconSize(QSize(20,20));
|
fileButton->setIconSize(QSize(16,16));
|
||||||
fileButton->setFixedSize(50,40);
|
fileButton->setFixedSize(24,24);
|
||||||
callButton->setIcon(QIcon("img/button icons/call_2x.png"));
|
emoteButton->setIcon(QIcon("img/button icons/emoticon.svg"));
|
||||||
|
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->setFlat(true);
|
callButton->setFlat(true);
|
||||||
callButton->setPalette(toxgreen);
|
callButton->setPalette(toxgreen);
|
||||||
callButton->setAutoFillBackground(true);
|
callButton->setAutoFillBackground(true);
|
||||||
callButton->setIconSize(QSize(20,20));
|
callButton->setIconSize(QSize(32,32));
|
||||||
callButton->setFixedSize(50,40);
|
callButton->setFixedSize(50,50);
|
||||||
|
|
||||||
main->setLayout(mainLayout);
|
main->setLayout(mainLayout);
|
||||||
mainLayout->addWidget(chatArea);
|
mainLayout->addWidget(chatArea);
|
||||||
mainLayout->addLayout(mainFootLayout);
|
mainLayout->addLayout(mainFootLayout);
|
||||||
mainLayout->setMargin(0);
|
mainLayout->setMargin(0);
|
||||||
|
|
||||||
|
footButtonsSmall->addWidget(emoteButton);
|
||||||
|
footButtonsSmall->addWidget(fileButton);
|
||||||
|
|
||||||
mainFootLayout->addWidget(msgEdit);
|
mainFootLayout->addWidget(msgEdit);
|
||||||
|
mainFootLayout->addLayout(footButtonsSmall);
|
||||||
mainFootLayout->addWidget(sendButton);
|
mainFootLayout->addWidget(sendButton);
|
||||||
|
|
||||||
head->setLayout(headLayout);
|
head->setLayout(headLayout);
|
||||||
|
@ -68,7 +80,6 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
headLayout->addLayout(headTextLayout);
|
headLayout->addLayout(headTextLayout);
|
||||||
headLayout->addStretch();
|
headLayout->addStretch();
|
||||||
headLayout->addWidget(callButton);
|
headLayout->addWidget(callButton);
|
||||||
headLayout->addWidget(fileButton);
|
|
||||||
|
|
||||||
headTextLayout->addStretch();
|
headTextLayout->addStretch();
|
||||||
headTextLayout->addWidget(name);
|
headTextLayout->addWidget(name);
|
||||||
|
|
|
@ -59,11 +59,11 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Friend* f;
|
Friend* f;
|
||||||
QHBoxLayout *headLayout, *mainFootLayout;
|
QHBoxLayout *headLayout, *mainFootLayout;
|
||||||
QVBoxLayout *headTextLayout, *mainLayout;
|
QVBoxLayout *headTextLayout, *mainLayout, *footButtonsSmall;
|
||||||
QGridLayout *mainChatLayout;
|
QGridLayout *mainChatLayout;
|
||||||
QLabel *avatar, *name, *statusMessage;
|
QLabel *avatar, *name, *statusMessage;
|
||||||
ChatTextEdit *msgEdit;
|
ChatTextEdit *msgEdit;
|
||||||
QPushButton *sendButton, *fileButton, *callButton;
|
QPushButton *sendButton, *fileButton, *emoteButton, *callButton;
|
||||||
QScrollArea *chatArea;
|
QScrollArea *chatArea;
|
||||||
QWidget *main, *head, *chatAreaWidget;
|
QWidget *main, *head, *chatAreaWidget;
|
||||||
QString previousName;
|
QString previousName;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
FriendWidget::FriendWidget(int FriendId, QString id)
|
FriendWidget::FriendWidget(int FriendId, QString id)
|
||||||
: friendId(FriendId)
|
: friendId(FriendId)
|
||||||
{
|
{
|
||||||
|
this->setAutoFillBackground(true);
|
||||||
this->setLayout(&layout);
|
this->setLayout(&layout);
|
||||||
this->setFixedWidth(225);
|
this->setFixedWidth(225);
|
||||||
this->setFixedHeight(55);
|
this->setFixedHeight(55);
|
||||||
|
@ -60,3 +61,35 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendWidget::setAsActiveFriend()
|
||||||
|
{
|
||||||
|
QFont small;
|
||||||
|
small.setPixelSize(10);
|
||||||
|
statusMessage.setFont(small);
|
||||||
|
QPalette pal;
|
||||||
|
pal.setColor(QPalette::WindowText,Qt::darkGray);
|
||||||
|
statusMessage.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 FriendWidget::setAsInactiveFriend()
|
||||||
|
{
|
||||||
|
QFont small;
|
||||||
|
small.setPixelSize(10);
|
||||||
|
statusMessage.setFont(small);
|
||||||
|
QPalette pal;
|
||||||
|
pal.setColor(QPalette::WindowText,Qt::gray);
|
||||||
|
statusMessage.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);
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +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 setAsInactiveFriend();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendWidgetClicked(FriendWidget* widget);
|
void friendWidgetClicked(FriendWidget* widget);
|
||||||
|
|
|
@ -296,6 +296,12 @@ void Widget::onFriendUsernameLoaded(int friendId, const QString& username)
|
||||||
|
|
||||||
void Widget::onFriendWidgetClicked(FriendWidget *widget)
|
void Widget::onFriendWidgetClicked(FriendWidget *widget)
|
||||||
{
|
{
|
||||||
|
if (activeFriendWidget != 0)
|
||||||
|
{
|
||||||
|
activeFriendWidget->setAsInactiveFriend();
|
||||||
|
}
|
||||||
|
activeFriendWidget = widget;
|
||||||
|
widget->setAsActiveFriend();
|
||||||
Friend* f = FriendList::findFriend(widget->friendId);
|
Friend* f = FriendList::findFriend(widget->friendId);
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -80,6 +80,7 @@ private:
|
||||||
AddFriendForm friendForm;
|
AddFriendForm friendForm;
|
||||||
SettingsForm settingsForm;
|
SettingsForm settingsForm;
|
||||||
static Widget* instance;
|
static Widget* instance;
|
||||||
|
FriendWidget* activeFriendWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIDGET_H
|
#endif // WIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user