1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix #416, cleanup

This commit is contained in:
krepa098 2014-10-09 21:20:06 +02:00
parent 118b67a970
commit 2913326fb2
5 changed files with 29 additions and 33 deletions

View File

@ -140,5 +140,6 @@
<file>ui/settings/mainContent.css</file> <file>ui/settings/mainContent.css</file>
<file>ui/settings/mainHead.css</file> <file>ui/settings/mainHead.css</file>
<file>translations/pirate.qm</file> <file>translations/pirate.qm</file>
<file>ui/chatArea/chatHead.css</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -39,15 +39,16 @@
ChatForm::ChatForm(Friend* chatFriend) ChatForm::ChatForm(Friend* chatFriend)
: f(chatFriend) : f(chatFriend)
, audioInputFlag(false)
, callId(0)
{ {
nameLabel->setText(f->getName()); nameLabel->setText(f->getName());
avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent); avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent);
statusMessageLabel = new CroppingLabel(); statusMessageLabel = new CroppingLabel();
statusMessageLabel->setObjectName("statusLabel");
statusMessageLabel->setFont(Style::getFont(Style::Medium)); statusMessageLabel->setFont(Style::getFont(Style::Medium));
QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey));
statusMessageLabel->setPalette(pal);
netcam = new NetCamView(); netcam = new NetCamView();
@ -466,15 +467,11 @@ void ChatForm::onMicMuteToggle()
{ {
emit micMuteToggle(callId); emit micMuteToggle(callId);
if (micButton->objectName() == "red") if (micButton->objectName() == "red")
{
micButton->setObjectName("green"); micButton->setObjectName("green");
micButton->style()->polish(micButton);
}
else else
{
micButton->setObjectName("red"); micButton->setObjectName("red");
micButton->style()->polish(micButton);
} Style::repolish(micButton);
} }
} }

View File

@ -37,9 +37,7 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
headWidget = new QWidget(); headWidget = new QWidget();
nameLabel = new CroppingLabel(); nameLabel = new CroppingLabel();
nameLabel->setFont(Style::getFont(Style::MediumBold)); nameLabel->setObjectName("nameLabel");
QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::DarkGrey));
nameLabel->setPalette(pal);
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png"); avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout(); QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout();
@ -48,8 +46,6 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout(); QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout();
chatWidget = new ChatAreaWidget(); chatWidget = new ChatAreaWidget();
chatWidget->document()->setDefaultStyleSheet(Style::getStylesheet(":ui/chatArea/innerStyle.css"));
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
msgEdit = new ChatTextEdit(); msgEdit = new ChatTextEdit();
@ -62,10 +58,6 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
volButton = new QPushButton(); volButton = new QPushButton();
micButton = new QPushButton(); micButton = new QPushButton();
QFont bold;
bold.setBold(true);
nameLabel->setFont(bold);
footButtonsSmall->setSpacing(2); footButtonsSmall->setSpacing(2);
msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css")); msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css"));
@ -125,6 +117,10 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked())); connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked()));
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
chatWidget->document()->setDefaultStyleSheet(Style::getStylesheet(":ui/chatArea/innerStyle.css"));
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
} }
int GenericChatForm::getNumberOfMessages() int GenericChatForm::getNumberOfMessages()

View File

@ -31,6 +31,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
{ {
nusersLabel = new QLabel(); nusersLabel = new QLabel();
namesList = new QLabel(); namesList = new QLabel();
namesList->setObjectName("peersLabel");
fileButton->setEnabled(false); fileButton->setEnabled(false);
callButton->setVisible(false); callButton->setVisible(false);
@ -38,24 +39,15 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
volButton->setVisible(false); volButton->setVisible(false);
micButton->setVisible(false); micButton->setVisible(false);
QFont small;
small.setPixelSize(10);
nameLabel->setText(group->widget->getName()); nameLabel->setText(group->widget->getName());
nusersLabel->setFont(Style::getFont(Style::Medium)); nusersLabel->setFont(Style::getFont(Style::Medium));
nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size()));
QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); nusersLabel->setObjectName("statusLabel");
nusersLabel->setPalette(pal);
avatar->setPixmap(QPixmap(":/img/group_dark.png"), Qt::transparent); avatar->setPixmap(QPixmap(":/img/group_dark.png"), Qt::transparent);
QString names; namesList->setText(QStringList(group->peers.values()).join(", "));
for (QString& s : group->peers)
names.append(s+", ");
names.chop(2);
namesList->setText(names);
namesList->setFont(small);
msgEdit->setObjectName("group"); msgEdit->setObjectName("group");
@ -83,11 +75,7 @@ void GroupChatForm::onSendTriggered()
void GroupChatForm::onUserListChanged() void GroupChatForm::onUserListChanged()
{ {
nusersLabel->setText(tr("%1 users in chat").arg(group->nPeers)); nusersLabel->setText(tr("%1 users in chat").arg(group->nPeers));
QString names; namesList->setText(QStringList(group->peers.values()).join(", "));
for (QString& s : group->peers)
names.append(s+", ");
names.chop(2);
namesList->setText(names);
} }
void GroupChatForm::dragEnterEvent(QDragEnterEvent *ev) void GroupChatForm::dragEnterEvent(QDragEnterEvent *ev)

14
ui/chatArea/chatHead.css Normal file
View File

@ -0,0 +1,14 @@
#nameLabel {
color: @black;
font: @mediumBold;
}
#statusLabel {
color: @mediumGrey;
font: @medium;
}
#peersLabel {
color: @mediumGrey;
font: @medium;
}