mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
code cleanup
This commit is contained in:
parent
02da6803f1
commit
522d570e62
1
res.qrc
1
res.qrc
|
@ -124,5 +124,6 @@
|
||||||
<file>ui/micButton/micButtonPressed.png</file>
|
<file>ui/micButton/micButtonPressed.png</file>
|
||||||
<file>ui/micButton/micButton.css</file>
|
<file>ui/micButton/micButton.css</file>
|
||||||
<file>ui/volButton/volButton.css</file>
|
<file>ui/volButton/volButton.css</file>
|
||||||
|
<file>ui/fileButton/fileButtonDisabled.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -17,6 +17,11 @@ QPushButton:pressed
|
||||||
background-image: url(":/ui/fileButton/fileButtonPressed.png");
|
background-image: url(":/ui/fileButton/fileButtonPressed.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPushButton[enabled="false"]
|
||||||
|
{
|
||||||
|
background-image: url(":/ui/fileButton/fileButtonDisabled.png");
|
||||||
|
}
|
||||||
|
|
||||||
QPushButton:focus {
|
QPushButton:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
BIN
ui/fileButton/fileButtonDisabled.png
Normal file
BIN
ui/fileButton/fileButtonDisabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 457 B |
|
@ -52,7 +52,6 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
||||||
connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
|
connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
|
||||||
connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
|
connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
|
||||||
connect(emoteButton, &QPushButton::clicked, this, &ChatForm::onEmoteButtonClicked);
|
|
||||||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,33 +529,6 @@ void ChatForm::onCancelCallTriggered()
|
||||||
emit cancelCall(callId, f->friendId);
|
emit cancelCall(callId, f->friendId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onEmoteButtonClicked()
|
|
||||||
{
|
|
||||||
// don't show the smiley selection widget if there are no smileys available
|
|
||||||
if (SmileyPack::getInstance().getEmoticons().empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
EmoticonsWidget widget;
|
|
||||||
connect(&widget, &EmoticonsWidget::insertEmoticon, this, &ChatForm::onEmoteInsertRequested);
|
|
||||||
|
|
||||||
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
|
||||||
if (sender)
|
|
||||||
{
|
|
||||||
QPoint pos = -QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height()) - QPoint(0, 10);
|
|
||||||
widget.exec(sender->mapToGlobal(pos));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatForm::onEmoteInsertRequested(QString str)
|
|
||||||
{
|
|
||||||
// insert the emoticon
|
|
||||||
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
|
||||||
if (sender)
|
|
||||||
msgEdit->insertPlainText(str);
|
|
||||||
|
|
||||||
msgEdit->setFocus(); // refocus so that we can continue typing
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatForm::onMicMuteToggle()
|
void ChatForm::onMicMuteToggle()
|
||||||
{
|
{
|
||||||
if (audioInputFlag == true)
|
if (audioInputFlag == true)
|
||||||
|
|
|
@ -81,8 +81,6 @@ private slots:
|
||||||
void onAnswerCallTriggered();
|
void onAnswerCallTriggered();
|
||||||
void onHangupCallTriggered();
|
void onHangupCallTriggered();
|
||||||
void onCancelCallTriggered();
|
void onCancelCallTriggered();
|
||||||
void onEmoteButtonClicked();
|
|
||||||
void onEmoteInsertRequested(QString str);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Friend* f;
|
Friend* f;
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include "smileypack.h"
|
||||||
|
#include "widget/emoticonswidget.h"
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
|
|
||||||
GenericChatForm::GenericChatForm(QObject *parent) :
|
GenericChatForm::GenericChatForm(QObject *parent) :
|
||||||
|
@ -134,8 +136,6 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||||
|
|
||||||
headTextLayout->addStretch();
|
headTextLayout->addStretch();
|
||||||
headTextLayout->addWidget(nameLabel);
|
headTextLayout->addWidget(nameLabel);
|
||||||
// headTextLayout->addWidget(statusMessage);
|
|
||||||
// headTextLayout->addStretch();
|
|
||||||
|
|
||||||
chatArea->setWidget(chatAreaWidget);
|
chatArea->setWidget(chatAreaWidget);
|
||||||
|
|
||||||
|
@ -145,17 +145,7 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||||
fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
|
|
||||||
// connect(Widget::getInstance()->getCore(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked()));
|
||||||
// connect(Widget::getInstance()->getCore(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay);
|
|
||||||
// connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
|
||||||
// connect(fileButton, &QPushButton::clicked, this, &ChatForm::onAttachClicked);
|
|
||||||
// connect(callButton, &QPushButton::clicked, this, &ChatForm::onCallTriggered);
|
|
||||||
// connect(videoButton, &QPushButton::clicked, this, &ChatForm::onVideoCallTriggered);
|
|
||||||
// connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
|
||||||
// connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
|
|
||||||
// connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
|
|
||||||
// connect(emoteButton, &QPushButton::clicked, this, &ChatForm::onEmoteButtonClicked);
|
|
||||||
// connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::setName(const QString &newName)
|
void GenericChatForm::setName(const QString &newName)
|
||||||
|
@ -230,3 +220,30 @@ GenericChatForm::~GenericChatForm()
|
||||||
delete mainWidget;
|
delete mainWidget;
|
||||||
delete headWidget;
|
delete headWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::onEmoteButtonClicked()
|
||||||
|
{
|
||||||
|
// don't show the smiley selection widget if there are no smileys available
|
||||||
|
if (SmileyPack::getInstance().getEmoticons().empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
EmoticonsWidget widget;
|
||||||
|
connect(&widget, SIGNAL(insertEmoticon(QString)), this, SLOT(onEmoteInsertRequested(QString)));
|
||||||
|
|
||||||
|
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
||||||
|
if (sender)
|
||||||
|
{
|
||||||
|
QPoint pos = -QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height()) - QPoint(0, 10);
|
||||||
|
widget.exec(sender->mapToGlobal(pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::onEmoteInsertRequested(QString str)
|
||||||
|
{
|
||||||
|
// insert the emoticon
|
||||||
|
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
||||||
|
if (sender)
|
||||||
|
msgEdit->insertPlainText(str);
|
||||||
|
|
||||||
|
msgEdit->setFocus(); // refocus so that we can continue typing
|
||||||
|
}
|
||||||
|
|
|
@ -54,6 +54,8 @@ protected slots:
|
||||||
void onChatContextMenuRequested(QPoint pos);
|
void onChatContextMenuRequested(QPoint pos);
|
||||||
void onSliderRangeChanged();
|
void onSliderRangeChanged();
|
||||||
void onSaveLogClicked();
|
void onSaveLogClicked();
|
||||||
|
void onEmoteButtonClicked();
|
||||||
|
void onEmoteInsertRequested(QString str);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QLabel *nameLabel, *avatarLabel;
|
QLabel *nameLabel, *avatarLabel;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user