Merge pull request #4094
Diadlo (5): feat(chatform): Changed mic and vol buttons fix(chatform): Fixed buttons refactor: Small Generic chat form refactoring refactor(buttons): Mic and vol buttons now are QToolButton refactor(chatform): Small ChatForm refactoring. Zetok Zalbavar (1): refactor: adjust to changes in Friend and ToxPk classes
10
res.qrc
|
@ -65,10 +65,7 @@
|
|||
<file>ui/fileTransferWidget/fileTransferWidget.css</file>
|
||||
<file>ui/friendList/friendList.css</file>
|
||||
<file>ui/micButton/micButton.css</file>
|
||||
<file>ui/micButton/micButton.png</file>
|
||||
<file>ui/micButton/micButtonDisabled.png</file>
|
||||
<file>ui/micButton/micButtonHover.png</file>
|
||||
<file>ui/micButton/micButtonPressed.png</file>
|
||||
<file>ui/micButton/micButton.svg</file>
|
||||
<file>ui/msgEdit/msgEdit.css</file>
|
||||
<file>ui/sendButton/sendButton.css</file>
|
||||
<file>ui/sendButton/sendButton.svg</file>
|
||||
|
@ -78,10 +75,8 @@
|
|||
<file>ui/statusButton/menu_indicator.svg</file>
|
||||
<file>ui/videoButton/videoButton.css</file>
|
||||
<file>ui/videoButton/videoButton.svg</file>
|
||||
<file>ui/volButton/volButton.png</file>
|
||||
<file>ui/volButton/volButtonHover.png</file>
|
||||
<file>ui/volButton/volButtonPressed.png</file>
|
||||
<file>ui/volButton/volButton.css</file>
|
||||
<file>ui/volButton/volButton.svg</file>
|
||||
<file>ui/window/statusPanel.css</file>
|
||||
<file>ui/window/window.css</file>
|
||||
<file>ui/chatArea/info.svg</file>
|
||||
|
@ -97,7 +92,6 @@
|
|||
<file>ui/fileTransferInstance/filetransferWidget.css</file>
|
||||
<file>ui/acceptCall/acceptCall.svg</file>
|
||||
<file>ui/rejectCall/rejectCall.svg</file>
|
||||
<file>ui/volButton/volButtonDisabled.png</file>
|
||||
<file>img/login_logo.svg</file>
|
||||
<file>ui/notificationEdge/notificationEdge.css</file>
|
||||
<file>ui/loginScreen/loginScreen.css</file>
|
||||
|
|
|
@ -197,10 +197,13 @@ void ChatForm::onSendTriggered()
|
|||
|
||||
void ChatForm::onTextEditChanged()
|
||||
{
|
||||
Core* core = Core::getInstance();
|
||||
if (!Settings::getInstance().getTypingNotification())
|
||||
{
|
||||
if (isTyping)
|
||||
Core::getInstance()->sendTyping(f->getFriendId(), false);
|
||||
{
|
||||
core->sendTyping(f->getFriendId(), false);
|
||||
}
|
||||
|
||||
isTyping = false;
|
||||
return;
|
||||
|
@ -210,24 +213,28 @@ void ChatForm::onTextEditChanged()
|
|||
{
|
||||
typingTimer.start(3000);
|
||||
if (!isTyping)
|
||||
Core::getInstance()->sendTyping(f->getFriendId(), (isTyping = true));
|
||||
{
|
||||
isTyping = true;
|
||||
core->sendTyping(f->getFriendId(), isTyping);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Core::getInstance()->sendTyping(f->getFriendId(), (isTyping = false));
|
||||
isTyping = false;
|
||||
core->sendTyping(f->getFriendId(), isTyping);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatForm::onAttachClicked()
|
||||
{
|
||||
QStringList paths = QFileDialog::getOpenFileNames(this,
|
||||
tr("Send a file"),
|
||||
QDir::homePath(),
|
||||
0,
|
||||
0,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QStringList paths = QFileDialog::getOpenFileNames(
|
||||
this, tr("Send a file"), QDir::homePath(),
|
||||
0, 0, QFileDialog::DontUseNativeDialog);
|
||||
|
||||
if (paths.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Core* core = Core::getInstance();
|
||||
for (QString path : paths)
|
||||
|
@ -235,21 +242,23 @@ void ChatForm::onAttachClicked()
|
|||
QFile file(path);
|
||||
if (!file.exists() || !file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("Unable to open"),
|
||||
tr("qTox wasn't able to open %1").arg(QFileInfo(path).fileName()));
|
||||
QString fileName = QFileInfo(path).fileName();
|
||||
QMessageBox::warning(
|
||||
this, tr("Unable to open"),
|
||||
tr("qTox wasn't able to open %1").arg(fileName));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file.isSequential())
|
||||
{
|
||||
QMessageBox::critical(this,
|
||||
tr("Bad idea"),
|
||||
QMessageBox::critical(
|
||||
this, tr("Bad idea"),
|
||||
tr("You're trying to send a sequential file,"
|
||||
" which is not going to work!"));
|
||||
file.close();
|
||||
continue;
|
||||
}
|
||||
|
||||
qint64 filesize = file.size();
|
||||
file.close();
|
||||
QFileInfo fi(path);
|
||||
|
@ -261,7 +270,9 @@ void ChatForm::onAttachClicked()
|
|||
void ChatForm::startFileSend(ToxFile file)
|
||||
{
|
||||
if (file.friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString name;
|
||||
const Core* core = Core::getInstance();
|
||||
|
@ -272,7 +283,8 @@ void ChatForm::startFileSend(ToxFile file)
|
|||
previousId = self;
|
||||
}
|
||||
|
||||
insertChatMessage(ChatMessage::createFileTransferMessage(name, file, true, QDateTime::currentDateTime()));
|
||||
insertChatMessage(ChatMessage::createFileTransferMessage(
|
||||
name, file, true, QDateTime::currentDateTime()));
|
||||
|
||||
Widget::getInstance()->updateFriendActivity(f);
|
||||
}
|
||||
|
@ -280,7 +292,9 @@ void ChatForm::startFileSend(ToxFile file)
|
|||
void ChatForm::onFileRecvRequest(ToxFile file)
|
||||
{
|
||||
if (file.friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget::getInstance()->newFriendMessageAlert(file.friendId);
|
||||
|
||||
|
@ -292,7 +306,8 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
|||
previousId = friendId;
|
||||
}
|
||||
|
||||
ChatMessage::Ptr msg = ChatMessage::createFileTransferMessage(name, file, false, QDateTime::currentDateTime());
|
||||
ChatMessage::Ptr msg = ChatMessage::createFileTransferMessage(
|
||||
name, file, false, QDateTime::currentDateTime());
|
||||
insertChatMessage(msg);
|
||||
|
||||
ChatLineContentProxy* proxy = static_cast<ChatLineContentProxy*>(msg->getContent(1));
|
||||
|
@ -315,12 +330,15 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
|||
void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
||||
{
|
||||
if (friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
callConfirm = new CallConfirmWidget(video ? videoButton : callButton, *f);
|
||||
insertChatMessage(ChatMessage::createChatInfoMessage(tr("%1 calling").arg(f->getDisplayedName()),
|
||||
ChatMessage::INFO,
|
||||
QDateTime::currentDateTime()));
|
||||
insertChatMessage(ChatMessage::createChatInfoMessage(
|
||||
tr("%1 calling").arg(f->getDisplayedName()),
|
||||
ChatMessage::INFO, QDateTime::currentDateTime()));
|
||||
|
||||
/* AutoAcceptCall is set for this friend */
|
||||
if ((video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Video)) ||
|
||||
(!video && Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(Settings::AutoAcceptCall::Audio)))
|
||||
|
@ -328,7 +346,8 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
|||
uint32_t friendId = f->getFriendId();
|
||||
qDebug() << "automatic call answer";
|
||||
CoreAV* coreav = Core::getInstance()->getAv();
|
||||
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection, Q_ARG(uint32_t, friendId));
|
||||
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection,
|
||||
Q_ARG(uint32_t, friendId));
|
||||
onAvStart(friendId,video);
|
||||
}
|
||||
else
|
||||
|
@ -352,30 +371,40 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
|||
}
|
||||
}
|
||||
|
||||
void ChatForm::onAvStart(uint32_t FriendId, bool video)
|
||||
void ChatForm::onAvStart(uint32_t friendId, bool video)
|
||||
{
|
||||
if (FriendId != f->getFriendId())
|
||||
if (friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (video)
|
||||
{
|
||||
showNetcam();
|
||||
}
|
||||
else
|
||||
{
|
||||
hideNetcam();
|
||||
}
|
||||
|
||||
updateCallButtons();
|
||||
startCounter();
|
||||
}
|
||||
|
||||
void ChatForm::onAvEnd(uint32_t FriendId)
|
||||
void ChatForm::onAvEnd(uint32_t friendId)
|
||||
{
|
||||
if (FriendId != f->getFriendId())
|
||||
if (friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
delete callConfirm;
|
||||
|
||||
//Fixes an OS X bug with ending a call while in full screen
|
||||
if (netcam && netcam->isFullScreen())
|
||||
{
|
||||
netcam->showNormal();
|
||||
}
|
||||
|
||||
Audio::getInstance().stopLoop();
|
||||
|
||||
|
@ -525,16 +554,21 @@ void ChatForm::onVolMuteToggle()
|
|||
void ChatForm::onFileSendFailed(uint32_t friendId, const QString &fname)
|
||||
{
|
||||
if (friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
addSystemInfoMessage(tr("Failed to send file \"%1\"").arg(fname), ChatMessage::ERROR, QDateTime::currentDateTime());
|
||||
addSystemInfoMessage(tr("Failed to send file \"%1\"").arg(fname),
|
||||
ChatMessage::ERROR, QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
|
||||
{
|
||||
// Disable call buttons if friend is offline
|
||||
if(friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == Status::Offline)
|
||||
{
|
||||
|
@ -572,13 +606,17 @@ void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
|
|||
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping)
|
||||
{
|
||||
if (friendId == f->getFriendId())
|
||||
{
|
||||
setFriendTyping(isTyping);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatForm::onFriendNameChanged(const QString& name)
|
||||
{
|
||||
if (sender() == f)
|
||||
{
|
||||
setName(name);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatForm::onFriendMessageReceived(quint32 friendId, const QString& message,
|
||||
|
@ -625,7 +663,8 @@ GenericNetCamView *ChatForm::createNetcam()
|
|||
uint32_t friendId = f->getFriendId();
|
||||
NetCamView* view = new NetCamView(friendId, this);
|
||||
CoreAV* av = Core::getInstance()->getAv();
|
||||
view->show(av->getVideoSourceFromCall(friendId), f->getDisplayedName());
|
||||
VideoSource* source = av->getVideoSourceFromCall(friendId);
|
||||
view->show(source, f->getDisplayedName());
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -645,9 +684,10 @@ void ChatForm::dropEvent(QDropEvent *ev)
|
|||
for (QUrl url : ev->mimeData()->urls())
|
||||
{
|
||||
QFileInfo info(url.path());
|
||||
|
||||
QFile file(info.absoluteFilePath());
|
||||
if (url.isValid() && !url.isLocalFile() && (url.toString().length() < TOX_MAX_MESSAGE_LENGTH))
|
||||
|
||||
if (url.isValid() && !url.isLocalFile() &&
|
||||
url.toString().length() < TOX_MAX_MESSAGE_LENGTH)
|
||||
{
|
||||
SendMessageStr(url.toString());
|
||||
continue;
|
||||
|
@ -686,10 +726,12 @@ void ChatForm::dropEvent(QDropEvent *ev)
|
|||
}
|
||||
}
|
||||
|
||||
void ChatForm::onAvatarRemoved(uint32_t FriendId)
|
||||
void ChatForm::onAvatarRemoved(uint32_t friendId)
|
||||
{
|
||||
if (FriendId != f->getFriendId())
|
||||
if (friendId != f->getFriendId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
avatar->setPixmap(QPixmap(":/img/contact_dark.svg"));
|
||||
}
|
||||
|
@ -708,7 +750,9 @@ void ChatForm::onDeliverOfflineMessages()
|
|||
void ChatForm::onLoadChatHistory()
|
||||
{
|
||||
if (sender() == f)
|
||||
{
|
||||
loadHistory(QDateTime::currentDateTime().addDays(-7), true);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Split on smaller methods (style)
|
||||
|
@ -717,12 +761,16 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
|||
QDateTime now = historyBaselineDate.addMSecs(-1);
|
||||
|
||||
if (since > now)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!earliestMessage.isNull())
|
||||
{
|
||||
if (earliestMessage < since)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (earliestMessage < now)
|
||||
{
|
||||
|
@ -731,7 +779,9 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
|||
}
|
||||
}
|
||||
|
||||
auto msgs = Nexus::getProfile()->getHistory()->getChatHistory(f->getPublicKey().toString(), since, now);
|
||||
History* history = Nexus::getProfile()->getHistory();
|
||||
QString pk = f->getPublicKey().toString();
|
||||
QList<History::HistMessage> msgs = history->getChatHistory(pk, since, now);
|
||||
|
||||
ToxPk storedPrevId = previousId;
|
||||
ToxPk prevId;
|
||||
|
@ -749,10 +799,10 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
|||
{
|
||||
lastDate = msgDate;
|
||||
QString dateText = msgDate.toString(Settings::getInstance().getDateFormat());
|
||||
historyMessages.append(
|
||||
ChatMessage::createChatInfoMessage(dateText,
|
||||
auto msg = ChatMessage::createChatInfoMessage(dateText,
|
||||
ChatMessage::INFO,
|
||||
QDateTime()));
|
||||
QDateTime());
|
||||
historyMessages.append(msg);
|
||||
}
|
||||
|
||||
// Show each messages
|
||||
|
@ -777,32 +827,30 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
|||
bool isAction = it.message.startsWith(ACTION_PREFIX, Qt::CaseInsensitive);
|
||||
bool needSending = !it.isSent && isSelf;
|
||||
|
||||
ChatMessage::Ptr msg =
|
||||
ChatMessage::createChatMessage(authorStr,
|
||||
isAction ? it.message.mid(4) : it.message,
|
||||
isAction ? ChatMessage::ACTION : ChatMessage::NORMAL,
|
||||
isSelf,
|
||||
needSending ? QDateTime() : msgDateTime);
|
||||
QString messageText = isAction ? it.message.mid(4) : it.message;
|
||||
ChatMessage::MessageType type = isAction ? ChatMessage::ACTION : ChatMessage::NORMAL;
|
||||
QDateTime dateTime = needSending ? QDateTime() : msgDateTime;
|
||||
auto msg = ChatMessage::createChatMessage(
|
||||
authorStr, messageText, type, isSelf, dateTime);
|
||||
|
||||
if (!isAction && (prevId == authorPk) && (prevMsgDateTime.secsTo(msgDateTime) < getChatLog()->repNameAfter) )
|
||||
uint prev = prevMsgDateTime.secsTo(msgDateTime);
|
||||
if (!isAction && prevId == authorPk && prev < getChatLog()->repNameAfter)
|
||||
{
|
||||
msg->hideSender();
|
||||
}
|
||||
|
||||
prevId = authorPk;
|
||||
prevMsgDateTime = msgDateTime;
|
||||
|
||||
if (needSending)
|
||||
if (needSending && processUndelivered)
|
||||
{
|
||||
if (processUndelivered)
|
||||
{
|
||||
int rec;
|
||||
if (!isAction)
|
||||
rec = Core::getInstance()->sendMessage(f->getFriendId(), msg->toString());
|
||||
else
|
||||
rec = Core::getInstance()->sendAction(f->getFriendId(), msg->toString());
|
||||
|
||||
Core* core = Core::getInstance();
|
||||
uint32_t friendId = f->getFriendId();
|
||||
int rec = isAction ? core->sendAction(friendId, msg->toString())
|
||||
: core->sendMessage(friendId, msg->toString());
|
||||
getOfflineMsgEngine()->registerReceipt(rec, it.id, msg);
|
||||
}
|
||||
}
|
||||
|
||||
historyMessages.append(msg);
|
||||
}
|
||||
|
||||
|
@ -914,7 +962,6 @@ void ChatForm::updateMuteMicButton()
|
|||
const CoreAV* av = Core::getInstance()->getAv();
|
||||
|
||||
micButton->setEnabled(av->isCallActive(f));
|
||||
|
||||
if (micButton->isEnabled())
|
||||
{
|
||||
if (av->isCallInputMuted(f))
|
||||
|
@ -928,8 +975,15 @@ void ChatForm::updateMuteMicButton()
|
|||
micButton->setToolTip(tr("Mute microphone"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
micButton->setObjectName("");
|
||||
micButton->setToolTip(tr("Microphone can be muted only during a call"));
|
||||
}
|
||||
|
||||
micButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/micButton/micButton.css")));
|
||||
QString stylePath = QStringLiteral(":/ui/micButton/micButton.css");
|
||||
QString style = Style::getStylesheet(stylePath);
|
||||
micButton->setStyleSheet(style);
|
||||
}
|
||||
|
||||
void ChatForm::updateMuteVolButton()
|
||||
|
@ -937,8 +991,7 @@ void ChatForm::updateMuteVolButton()
|
|||
const CoreAV* av = Core::getInstance()->getAv();
|
||||
|
||||
volButton->setEnabled(av->isCallActive(f));
|
||||
|
||||
if (videoButton->isEnabled())
|
||||
if (volButton->isEnabled())
|
||||
{
|
||||
if (av->isCallOutputMuted(f))
|
||||
{
|
||||
|
@ -951,8 +1004,15 @@ void ChatForm::updateMuteVolButton()
|
|||
volButton->setToolTip(tr("Mute call"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
volButton->setObjectName("");
|
||||
volButton->setToolTip(tr("Sound can be disabled only during a call"));
|
||||
}
|
||||
|
||||
volButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/volButton/volButton.css")));
|
||||
QString stylePath = QStringLiteral(":/ui/volButton/volButton.css");
|
||||
QString style = Style::getStylesheet(stylePath);
|
||||
volButton->setStyleSheet(style);
|
||||
}
|
||||
|
||||
void ChatForm::startCounter()
|
||||
|
@ -1005,12 +1065,20 @@ QString ChatForm::secondsToDHMS(quint32 duration)
|
|||
|
||||
// I assume no one will ever have call longer than a month
|
||||
if (days)
|
||||
{
|
||||
return cD + res.sprintf("%dd%02dh %02dm %02ds", days, hours, minutes, seconds);
|
||||
else if (hours)
|
||||
}
|
||||
|
||||
if (hours)
|
||||
{
|
||||
return cD + res.sprintf("%02dh %02dm %02ds", hours, minutes, seconds);
|
||||
else if (minutes)
|
||||
}
|
||||
|
||||
if (minutes)
|
||||
{
|
||||
return cD + res.sprintf("%02dm %02ds", minutes, seconds);
|
||||
else
|
||||
}
|
||||
|
||||
return cD + res.sprintf("%02ds", seconds);
|
||||
}
|
||||
|
||||
|
@ -1087,20 +1155,21 @@ void ChatForm::SendMessageStr(QString msg)
|
|||
|
||||
ChatMessage::Ptr ma = addSelfMessage(qt_msg, isAction, timestamp, false);
|
||||
|
||||
int rec;
|
||||
if (isAction)
|
||||
rec = Core::getInstance()->sendAction(f->getFriendId(), qt_msg);
|
||||
else
|
||||
rec = Core::getInstance()->sendMessage(f->getFriendId(), qt_msg);
|
||||
|
||||
Core* core = Core::getInstance();
|
||||
uint32_t friendId = f->getFriendId();
|
||||
int rec = isAction ? core->sendAction(friendId, qt_msg)
|
||||
: core->sendMessage(friendId, qt_msg);
|
||||
|
||||
Profile* profile = Nexus::getProfile();
|
||||
if (profile->isHistoryEnabled())
|
||||
{
|
||||
auto* offMsgEngine = getOfflineMsgEngine();
|
||||
profile->getHistory()->addNewMessage(f->getPublicKey().toString(), qt_msg_hist,
|
||||
Core::getInstance()->getSelfId().toString(), timestamp, status, Core::getInstance()->getUsername(),
|
||||
[offMsgEngine,rec,ma](int64_t id)
|
||||
QString selfPk = Core::getInstance()->getSelfId().toString();
|
||||
QString pk = f->getPublicKey().toString();
|
||||
QString name = Core::getInstance()->getUsername();
|
||||
profile->getHistory()->addNewMessage(
|
||||
pk, qt_msg_hist, selfPk, timestamp, status,
|
||||
name, [offMsgEngine, rec, ma](int64_t id)
|
||||
{
|
||||
offMsgEngine->registerReceipt(rec, id, ma);
|
||||
});
|
||||
|
@ -1128,5 +1197,7 @@ void ChatForm::retranslateUi()
|
|||
updateMuteVolButton();
|
||||
|
||||
if (netcam)
|
||||
{
|
||||
netcam->setShowMessages(chatWidget->isVisible());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QShortcut>
|
||||
#include <QSplitter>
|
||||
#include <QClipboard>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "src/chatlog/chatlog.h"
|
||||
#include "src/chatlog/content/timestamp.h"
|
||||
|
@ -49,7 +50,18 @@
|
|||
#include "src/widget/translator.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
GenericChatForm::GenericChatForm(QWidget* parent)
|
||||
/**
|
||||
* @class GenericChatForm
|
||||
* @brief Parent class for all chatforms. It's provide the minimum required UI
|
||||
* elements and methods to work with chat messages.
|
||||
*
|
||||
* TODO: reword
|
||||
* @var GenericChatForm::historyBaselineDate
|
||||
* @brief Used by HistoryKeeper to load messages from t to historyBaselineDate
|
||||
* (excluded)
|
||||
*/
|
||||
|
||||
GenericChatForm::GenericChatForm(QWidget *parent)
|
||||
: QWidget(parent, Qt::Window)
|
||||
, audioInputFlag(false)
|
||||
, audioOutputFlag(false)
|
||||
|
@ -94,14 +106,17 @@ GenericChatForm::GenericChatForm(QWidget* parent)
|
|||
screenshotButton = new QPushButton;
|
||||
callButton = new QPushButton();
|
||||
callButton->setFixedSize(50,40);
|
||||
|
||||
videoButton = new QPushButton();
|
||||
videoButton->setFixedSize(50,40);
|
||||
volButton = new QPushButton();
|
||||
//volButton->setFixedSize(25,20);
|
||||
volButton->setToolTip("");
|
||||
micButton = new QPushButton();
|
||||
// micButton->setFixedSize(25,20);
|
||||
micButton->setToolTip("");
|
||||
|
||||
volButton = new QToolButton();
|
||||
volButton->setFixedSize(22, 18);
|
||||
|
||||
micButton = new QToolButton();
|
||||
micButton->setFixedSize(22, 18);
|
||||
// TODO: Make updateCallButtons (see ChatForm) abstract
|
||||
// and call here to set tooltips.
|
||||
|
||||
fileFlyout = new FlyoutOverlayWidget;
|
||||
QHBoxLayout *fileLayout = new QHBoxLayout(fileFlyout);
|
||||
|
@ -162,9 +177,8 @@ GenericChatForm::GenericChatForm(QWidget* parent)
|
|||
headTextLayout->addWidget(nameLabel);
|
||||
headTextLayout->addStretch();
|
||||
|
||||
micButtonsLayout->setSpacing(0);
|
||||
micButtonsLayout->setSpacing(4);
|
||||
micButtonsLayout->addWidget(micButton, Qt::AlignTop | Qt::AlignRight);
|
||||
micButtonsLayout->addSpacing(4);
|
||||
micButtonsLayout->addWidget(volButton, Qt::AlignTop | Qt::AlignRight);
|
||||
|
||||
buttonsLayout->addLayout(micButtonsLayout, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignRight);
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
#ifndef GENERICCHATFORM_H
|
||||
#define GENERICCHATFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPoint>
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include "src/core/corestructs.h"
|
||||
#include "src/chatlog/chatmessage.h"
|
||||
#include "src/core/toxid.h"
|
||||
|
@ -47,6 +48,7 @@ class FlyoutOverlayWidget;
|
|||
class ContentLayout;
|
||||
class QSplitter;
|
||||
class GenericNetCamView;
|
||||
class QToolButton;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
|
@ -123,15 +125,18 @@ protected:
|
|||
int curRow;
|
||||
CroppingLabel *nameLabel;
|
||||
MaskablePixmapWidget *avatar;
|
||||
QWidget* headWidget;
|
||||
QPushButton *fileButton, *screenshotButton, *emoteButton, *callButton, *videoButton, *volButton, *micButton;
|
||||
QWidget *headWidget;
|
||||
QPushButton* fileButton, *screenshotButton, *emoteButton, *callButton;
|
||||
QPushButton* videoButton;
|
||||
QToolButton *volButton, *micButton;
|
||||
FlyoutOverlayWidget *fileFlyout;
|
||||
QVBoxLayout *headTextLayout;
|
||||
ChatTextEdit *msgEdit;
|
||||
QPushButton *sendButton;
|
||||
ChatLog *chatWidget;
|
||||
QDateTime earliestMessage;
|
||||
QDateTime historyBaselineDate = QDateTime::currentDateTime(); // used by HistoryKeeper to load messages from t to historyBaselineDate (excluded)
|
||||
|
||||
QDateTime historyBaselineDate = QDateTime::currentDateTime();
|
||||
bool audioInputFlag;
|
||||
bool audioOutputFlag;
|
||||
QSplitter* bodySplitter;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QDragEnterEvent>
|
||||
#include <QMimeData>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "tabcompleter.h"
|
||||
#include "src/group.h"
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
QToolButton
|
||||
{
|
||||
image: url(":/ui/micButton/micButton.svg");
|
||||
}
|
||||
|
||||
QAbstractButton
|
||||
{
|
||||
background-color: transparent;
|
||||
background-image: url(":/ui/micButton/micButton.png");
|
||||
background-repeat: none;
|
||||
border-radius: 5px;
|
||||
border: none;
|
||||
background-repeat: none;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
QAbstractButton:disabled
|
||||
{
|
||||
background-image: url(":/ui/micButton/micButtonDisabled.png");
|
||||
background-color: #919191;
|
||||
}
|
||||
|
||||
QAbstractButton:focus
|
||||
|
@ -16,12 +21,47 @@ QAbstractButton:focus
|
|||
outline: none;
|
||||
}
|
||||
|
||||
QAbstractButton#green
|
||||
{
|
||||
background-color: #6bc260;
|
||||
}
|
||||
|
||||
QAbstractButton#green:hover
|
||||
{
|
||||
background-image: url(":/ui/micButton/micButtonHover.png");
|
||||
background-color: #79c76f;
|
||||
}
|
||||
|
||||
QAbstractButton#green:pressed
|
||||
{
|
||||
background-color: #51b244;
|
||||
}
|
||||
|
||||
QAbstractButton#red
|
||||
{
|
||||
background-image: url(":/ui/micButton/micButtonPressed.png");
|
||||
background-color: #c84e4e;
|
||||
}
|
||||
|
||||
QAbstractButton#red:hover
|
||||
{
|
||||
background-color: #e87474;
|
||||
}
|
||||
|
||||
QAbstractButton#red:pressed
|
||||
{
|
||||
background-color: #df3b3b;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow
|
||||
{
|
||||
background-color: #e6e465;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow:hover
|
||||
{
|
||||
background-color: #e8e774;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow:pressed
|
||||
{
|
||||
background-color: #e3e155;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 593 B |
89
ui/micButton/micButton.svg
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg4867"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
width="27.5"
|
||||
height="22.5"
|
||||
viewBox="0 0 27.5 22.5"
|
||||
sodipodi:docname="micButton.svg">
|
||||
<metadata
|
||||
id="metadata4873">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs4871" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="965"
|
||||
id="namedview4869"
|
||||
showgrid="false"
|
||||
inkscape:zoom="22.627418"
|
||||
inkscape:cx="11.743876"
|
||||
inkscape:cy="5.7111464"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="96"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4867" />
|
||||
<g
|
||||
id="g4144"
|
||||
transform="matrix(1.1244169,0,0,1.1264917,-1.7361911,-1.4498809)">
|
||||
<rect
|
||||
ry="2.6881006"
|
||||
y="1.2870765"
|
||||
x="9.962924"
|
||||
height="13.585805"
|
||||
width="7.5794492"
|
||||
id="rect5419"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.70899999;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<rect
|
||||
rx="0.33368644"
|
||||
ry="0.65545553"
|
||||
y="19.949682"
|
||||
x="8.5805082"
|
||||
height="1.3109111"
|
||||
width="10.344279"
|
||||
id="rect5423"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.70899999;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<rect
|
||||
ry="0"
|
||||
rx="0"
|
||||
y="17.113348"
|
||||
x="12.513242"
|
||||
height="3.5990469"
|
||||
width="2.1451259"
|
||||
id="rect5427"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.70899999;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="csc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5431"
|
||||
d="m 7.0765239,9.8278885 c 0,0 -0.9033248,7.8098235 6.4139421,7.8098235 7.317267,0 7.022576,-7.8534036 7.022576,-7.8534036"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.89999998;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 521 B |
|
@ -1,14 +1,19 @@
|
|||
QToolButton
|
||||
{
|
||||
image: url(":/ui/volButton/volButton.svg");
|
||||
}
|
||||
|
||||
QAbstractButton
|
||||
{
|
||||
background-color: transparent;
|
||||
background-image: url(":/ui/volButton/volButton.png");
|
||||
background-repeat: none;
|
||||
border-radius: 5px;
|
||||
border: none;
|
||||
background-repeat: none;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
QAbstractButton:disabled
|
||||
{
|
||||
background-image: url(":/ui/volButton/volButtonDisabled.png");
|
||||
background-color: #919191;
|
||||
}
|
||||
|
||||
QAbstractButton:focus
|
||||
|
@ -16,12 +21,47 @@ QAbstractButton:focus
|
|||
outline: none;
|
||||
}
|
||||
|
||||
QAbstractButton#green
|
||||
{
|
||||
background-color: #6bc260;
|
||||
}
|
||||
|
||||
QAbstractButton#green:hover
|
||||
{
|
||||
background-image: url(":/ui/volButton/volButtonHover.png");
|
||||
background-color: #79c76f;
|
||||
}
|
||||
|
||||
QAbstractButton#green:pressed
|
||||
{
|
||||
background-color: #51b244;
|
||||
}
|
||||
|
||||
QAbstractButton#red
|
||||
{
|
||||
background-image: url(":/ui/volButton/volButtonPressed.png");
|
||||
background-color: #c84e4e;
|
||||
}
|
||||
|
||||
QAbstractButton#red:hover
|
||||
{
|
||||
background-color: #e87474;
|
||||
}
|
||||
|
||||
QAbstractButton#red:pressed
|
||||
{
|
||||
background-color: #df3b3b;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow
|
||||
{
|
||||
background-color: #e6e465;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow:hover
|
||||
{
|
||||
background-color: #e8e774;
|
||||
}
|
||||
|
||||
QAbstractButton#yellow:pressed
|
||||
{
|
||||
background-color: #e3e155;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 624 B |
83
ui/volButton/volButton.svg
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg5872"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
width="20.625"
|
||||
height="16.875"
|
||||
viewBox="0 0 20.625 16.875"
|
||||
sodipodi:docname="volButton.svg">
|
||||
<metadata
|
||||
id="metadata5878">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs5876" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="965"
|
||||
id="namedview5874"
|
||||
showgrid="false"
|
||||
inkscape:zoom="22.627417"
|
||||
inkscape:cx="11.342775"
|
||||
inkscape:cy="5.7587929"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="96"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg5872" />
|
||||
<g
|
||||
id="g3465"
|
||||
transform="matrix(1.1540409,0,0,1.1540409,-0.84812976,-1.3955943)">
|
||||
<rect
|
||||
rx="1.281631"
|
||||
ry="1.4363106"
|
||||
y="5.6757092"
|
||||
x="1.8454813"
|
||||
height="5.5364447"
|
||||
width="5.2330775"
|
||||
id="rect6422"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.89999998;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path6434"
|
||||
d="m 13.014741,4.9931342 c 0,0 2.696002,3.0409607 0,7.7105728"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path6438"
|
||||
d="m 15.269462,2.9706889 c 0,0 4.044848,4.3654114 0,10.8453631"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 6.337401,6.1307596 10.26,2.246 l 0,12.586 -4.0174011,-4.384584 z"
|
||||
id="path4750"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 617 B |