From d1c042ed5e608b0ddb381912be68ecfa9df655eb Mon Sep 17 00:00:00 2001 From: dubslow Date: Sun, 5 Oct 2014 22:47:12 -0500 Subject: [PATCH 1/6] add Kappa emote --- smileys/default/Kappa.png | Bin 0 -> 1242 bytes smileys/default/emoticons.xml | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 smileys/default/Kappa.png diff --git a/smileys/default/Kappa.png b/smileys/default/Kappa.png new file mode 100644 index 0000000000000000000000000000000000000000..a7ebbec4d90af0efba51de1a263d08793ce3a67a GIT binary patch literal 1242 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoO!2%@hbniq1DW)WEcNYeRRlUkaKptm-M`SUO z_5fqIli7Aa6^A`t978NlmtOJCo|7uk@bLBQmn!jUlYP?E)K+$?nO&e-OZw?oizWA8?#p0*xnjemD)|Aek7ijS0@{5&Eu5VbPmhBpTYemmI z)75Y@A8(s2wX8>D=OcC9%JWv{ z3gL%cHLuS-Hcxl^lu}XMij$g)laiB+<0K|*Uu1un)v>AR`<$)M_N^24)7qKgace{7 z(PsYBGfPiSv5ibVHYZ^EMPbj`+m~uw3$pf5^VMFl`t@mvNt41a1|C_mrzg?cjBiq> zhU~9jm#n0AHFd4pGp&$6WJ~XjYc?JkS;~v^<6T3~f1b52<94X|+RXPC_x@8a4B@MM z+@vV{YtyG7G2NR2U#7Y&I@}VzID4V0_9WxH!={e+_eBKX+R^5}=r~8Ibx~5N^Ng^~ zYm^MvX1u*vZ!5U;y_3>n?TVvwLQ_{)b(Q7(QmXPg{=;a(c8%q$(xQV??ml;S%`}K_ zU$cjkwKlpeq^3rp&Rs~ay|&iU@$9_wd{;lk>zWCB&W*|x0H$lz64!{5l*E!$tK_0o zAjM#0U}&UkV61Ck7Gh{>WngS&Y^rNuVP#;zu(-L1;F+74p6Z*Jo|&AjV5SFzx<(2>D-CqPwkiY~nki(IloVL$>z9|8>t%ve z12IswUVc%!gP83hpotP76GJjebCayBT=J7kb5rw5tgHfnN{bl`m;c|b4^$(Lqy}uK zl~qP+W_m^mgONq>=|vnsC1RLL!ZTA!G8l|Z!&TXD + + :Kappa: + From 227e483bdd43fb2759ac07b7b35f15a5b5661e02 Mon Sep 17 00:00:00 2001 From: dubslow Date: Mon, 6 Oct 2014 00:49:26 -0500 Subject: [PATCH 2/6] tweak buildPackages --- tools/buildPackages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index 0c12e11c6..501d7b429 100755 --- a/tools/buildPackages.sh +++ b/tools/buildPackages.sh @@ -87,7 +87,7 @@ mv qTox-master $VERNAME # Build packages cd $VERNAME -./bootstrap.sh +./bootstrap.sh --local debuild -us -uc -aamd64 debuild -us -uc -ai386 cd .. From 9e2195c03cb8291115e4bc4deef46fcda1b4627c Mon Sep 17 00:00:00 2001 From: dubslow Date: Mon, 6 Oct 2014 01:46:30 -0500 Subject: [PATCH 3/6] simplify groupchat names, fix #379, more simplification is possible --- core.cpp | 5 +-- core.h | 2 +- group.cpp | 57 +++------------------------------ group.h | 6 ---- widget/form/genericchatform.cpp | 6 ++++ widget/form/groupchatform.cpp | 11 ------- widget/form/groupchatform.h | 1 - widget/widget.cpp | 10 +++--- widget/widget.h | 2 +- 9 files changed, 20 insertions(+), 80 deletions(-) diff --git a/core.cpp b/core.cpp index f6b7a2a5c..fddca6eda 100644 --- a/core.cpp +++ b/core.cpp @@ -402,9 +402,10 @@ void Core::onGroupInvite(Tox*, int friendnumber, const uint8_t *group_public_key emit static_cast(core)->groupInviteReceived(friendnumber, group_public_key,length); } -void Core::onGroupMessage(Tox*, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *core) +void Core::onGroupMessage(Tox*, int groupnumber, int peernumber, const uint8_t * message, uint16_t length, void *_core) { - emit static_cast(core)->groupMessageReceived(groupnumber, friendgroupnumber, CString::toString(message, length)); + Core* core = static_cast(_core); + emit core->groupMessageReceived(groupnumber, CString::toString(message, length), core->getGroupPeerName(groupnumber, peernumber)); } void Core::onGroupNamelistChange(Tox*, int groupnumber, int peernumber, uint8_t change, void *core) diff --git a/core.h b/core.h index b1b8c3f43..51d885688 100644 --- a/core.h +++ b/core.h @@ -118,7 +118,7 @@ signals: void emptyGroupCreated(int groupnumber); void groupInviteReceived(int friendnumber, const uint8_t *group_public_key,uint16_t length); - void groupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); + void groupMessageReceived(int groupnumber, const QString& message, const QString& author); void groupNamelistChanged(int groupnumber, int peernumber, uint8_t change); void usernameSet(const QString& username); diff --git a/group.cpp b/group.cpp index 4898f525a..d74610131 100644 --- a/group.cpp +++ b/group.cpp @@ -24,16 +24,14 @@ #include Group::Group(int GroupId, QString Name) - : groupId(GroupId), nPeers{0}, hasPeerInfo{false}, peerInfoTimer{new QTimer} + : groupId(GroupId), nPeers{0} { widget = new GroupWidget(groupId, Name); chatForm = new GroupChatForm(this); - connect(peerInfoTimer, SIGNAL(timeout()), this, SLOT(queryPeerInfo())); - peerInfoTimer->setInterval(500); - peerInfoTimer->setSingleShot(false); - //peerInfoTimer.start(); - //in groupchats, we only notify on messages containing your name + //in groupchats, we only notify on messages containing your name <-- dumb + // sound notifications should be on all messages, but system popup notification + // on naming is appropriate hasNewMessages = 0; userWasMentioned = 0; } @@ -42,53 +40,6 @@ Group::~Group() { delete chatForm; delete widget; - delete peerInfoTimer; -} - -void Group::queryPeerInfo() -{ - const Core* core = Core::getInstance(); - int nPeersResult = core->getGroupNumberPeers(groupId); - if (nPeersResult == -1) - { - qDebug() << "Group::queryPeerInfo: Can't get number of peers"; - return; - } - nPeers = nPeersResult; - widget->onUserListChanged(); - chatForm->onUserListChanged(); - - if (nPeersResult == 0) - return; - - bool namesOk = true; - QList names = core->getGroupPeerNames(groupId); - if (names.isEmpty()) - { - qDebug() << "Group::queryPeerInfo: Can't get names of peers"; - return; - } - for (int i=0; ionUserListChanged(); - chatForm->onUserListChanged(); - - if (namesOk) - { - qDebug() << "Group::queryPeerInfo: Successfully loaded names"; - hasPeerInfo = true; - peerInfoTimer->stop(); - } } void Group::addPeer(int peerId, QString name) diff --git a/group.h b/group.h index fed4b11ee..cd263538f 100644 --- a/group.h +++ b/group.h @@ -25,7 +25,6 @@ struct Friend; class GroupWidget; class GroupChatForm; -class QTimer; class Group : public QObject { @@ -37,17 +36,12 @@ public: void removePeer(int peerId); void updatePeer(int peerId, QString newName); -private slots: - void queryPeerInfo(); - public: int groupId; QMap peers; int nPeers; GroupWidget* widget; GroupChatForm* chatForm; - bool hasPeerInfo; - QTimer* peerInfoTimer; int hasNewMessages, userWasMentioned; }; diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index 4a73d3938..08e8040bb 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -172,6 +172,12 @@ void GenericChatForm::addMessage(QString author, QString message, bool isAction, QString date = datetime.toString(Settings::getInstance().getTimestampFormat()); bool isMe = (author == Widget::getInstance()->getUsername()); + if (!isAction && message.startsWith("/me ")) + { // always render actions regardless of what core thinks + isAction = true; + message = message.right(message.length()-4); + } + if (isAction) { chatWidget->insertMessage(new ActionAction (getElidedName(author), message, date, isMe)); diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index 412ef46e8..5e97d22df 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -80,17 +80,6 @@ void GroupChatForm::onSendTriggered() emit sendMessage(group->groupId, msg); } -void GroupChatForm::addGroupMessage(QString message, int peerId) -{ - QString msgAuthor; - if (group->peers.contains(peerId)) - msgAuthor = group->peers[peerId]; - else - msgAuthor = tr(""); - - addMessage(msgAuthor, message); -} - void GroupChatForm::onUserListChanged() { nusersLabel->setText(tr("%1 users in chat").arg(group->nPeers)); diff --git a/widget/form/groupchatform.h b/widget/form/groupchatform.h index a544034de..6b3984b06 100644 --- a/widget/form/groupchatform.h +++ b/widget/form/groupchatform.h @@ -28,7 +28,6 @@ class GroupChatForm : public GenericChatForm public: GroupChatForm(Group* chatGroup); - void addGroupMessage(QString message, int peerId); void onUserListChanged(); private slots: diff --git a/widget/widget.cpp b/widget/widget.cpp index bfe0a483a..5cbaa74ee 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -209,7 +209,7 @@ void Widget::closeEvent(QCloseEvent *event) QString Widget::getUsername() { - return ui->nameLabel->text(); + return core->getUsername(); } Camera* Widget::getCamera() @@ -558,21 +558,21 @@ void Widget::onGroupInviteReceived(int32_t friendId, const uint8_t* publicKey,ui } } -void Widget::onGroupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message) +void Widget::onGroupMessageReceived(int groupnumber, const QString& message, const QString& author) { Group* g = GroupList::findGroup(groupnumber); if (!g) return; - g->chatForm->addGroupMessage(message, friendgroupnumber); + g->chatForm->addMessage(author, message); if ((static_cast(g->widget) != activeChatroomWidget) || isMinimized() || !isActiveWindow()) { g->hasNewMessages = 1; + newMessageAlert(); // sound alert on any message, not just naming user if (message.contains(core->getUsername(), Qt::CaseInsensitive)) { - newMessageAlert(); - g->userWasMentioned = 1; + g->userWasMentioned = 1; // useful for highlighting line or desktop notifications } g->widget->updateStatusLight(); } diff --git a/widget/widget.h b/widget/widget.h index 3d7858e78..7e17f565f 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -92,7 +92,7 @@ private slots: void onFriendRequestReceived(const QString& userId, const QString& message); void onEmptyGroupCreated(int groupId); void onGroupInviteReceived(int32_t friendId, const uint8_t *publicKey,uint16_t length); - void onGroupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); + void onGroupMessageReceived(int groupnumber, const QString& message, const QString& author); void onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t change); void removeFriend(int friendId); void copyFriendIdToClipboard(int friendId); From 200c6d30e9d77be52de914b12d85adbef5358ef4 Mon Sep 17 00:00:00 2001 From: dubslow Date: Mon, 6 Oct 2014 03:21:47 -0500 Subject: [PATCH 4/6] reduce font size and space between chat lines --- ui/chatArea/innerStyle.css | 14 +++++++------- widget/chatareawidget.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/chatArea/innerStyle.css b/ui/chatArea/innerStyle.css index 823c8dfbe..444d4381b 100644 --- a/ui/chatArea/innerStyle.css +++ b/ui/chatArea/innerStyle.css @@ -1,36 +1,36 @@ div.name { color: @black; - font: @bigBold; + font: @mediumBold; } div.message { color: @black; - font: @big; + font: @medium; } div.action { color: #1818FF; - font: @big; + font: @medium; } div.date { color: @black; - font: @big; + font: @medium; } div.name_me { color: @mediumGrey; - font: @big; + font: @medium; } div.message_me { color: @black; - font: @big; + font: @medium; } div.date_me { color: @black; - font: @big; + font: @medium; } span.quote { diff --git a/widget/chatareawidget.cpp b/widget/chatareawidget.cpp index c743574fa..d3d326b63 100644 --- a/widget/chatareawidget.cpp +++ b/widget/chatareawidget.cpp @@ -38,7 +38,7 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) setFrameStyle(QFrame::NoFrame); QTextTableFormat tableFormat; - tableFormat.setCellSpacing(15); + tableFormat.setCellSpacing(5); tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_None); tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::FixedLength,nameWidth), QTextLength(QTextLength::PercentageLength,100), From d42f9d31662a4d805d92ef80ea7f49a43d99fbee Mon Sep 17 00:00:00 2001 From: dubslow Date: Mon, 6 Oct 2014 09:57:50 -0500 Subject: [PATCH 5/6] Revert "reduce font size and space between chat lines", use #386 This reverts commit 200c6d30e9d77be52de914b12d85adbef5358ef4. --- ui/chatArea/innerStyle.css | 14 +++++++------- widget/chatareawidget.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/chatArea/innerStyle.css b/ui/chatArea/innerStyle.css index 444d4381b..823c8dfbe 100644 --- a/ui/chatArea/innerStyle.css +++ b/ui/chatArea/innerStyle.css @@ -1,36 +1,36 @@ div.name { color: @black; - font: @mediumBold; + font: @bigBold; } div.message { color: @black; - font: @medium; + font: @big; } div.action { color: #1818FF; - font: @medium; + font: @big; } div.date { color: @black; - font: @medium; + font: @big; } div.name_me { color: @mediumGrey; - font: @medium; + font: @big; } div.message_me { color: @black; - font: @medium; + font: @big; } div.date_me { color: @black; - font: @medium; + font: @big; } span.quote { diff --git a/widget/chatareawidget.cpp b/widget/chatareawidget.cpp index d3d326b63..c743574fa 100644 --- a/widget/chatareawidget.cpp +++ b/widget/chatareawidget.cpp @@ -38,7 +38,7 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) setFrameStyle(QFrame::NoFrame); QTextTableFormat tableFormat; - tableFormat.setCellSpacing(5); + tableFormat.setCellSpacing(15); tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_None); tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::FixedLength,nameWidth), QTextLength(QTextLength::PercentageLength,100), From b9a666159aa84cd000891d7778d6bad7ae7a22bc Mon Sep 17 00:00:00 2001 From: dubslow Date: Mon, 6 Oct 2014 09:58:48 -0500 Subject: [PATCH 6/6] reduce space between chat lines --- widget/chatareawidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/chatareawidget.cpp b/widget/chatareawidget.cpp index c743574fa..d3d326b63 100644 --- a/widget/chatareawidget.cpp +++ b/widget/chatareawidget.cpp @@ -38,7 +38,7 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) setFrameStyle(QFrame::NoFrame); QTextTableFormat tableFormat; - tableFormat.setCellSpacing(15); + tableFormat.setCellSpacing(5); tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_None); tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::FixedLength,nameWidth), QTextLength(QTextLength::PercentageLength,100),