From 2956c82091f5305357faa2a6271a8ed0ad5e70b7 Mon Sep 17 00:00:00 2001 From: Bill Winslow Date: Tue, 2 Sep 2014 18:03:55 -0500 Subject: [PATCH 01/11] package version is more appropriate --- debian/changelog | 2 +- debian/control | 4 +++- tools/buildPackages.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1b56f518a..5b1593c67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -qtox (1.0-1) UNRELEASED; urgency=medium local package +qtox (0.01pre-alpha-1) UNRELEASED; urgency=medium local package * Initial release. diff --git a/debian/control b/debian/control index 943501a77..ef73726b7 100644 --- a/debian/control +++ b/debian/control @@ -9,4 +9,6 @@ Package: qtox Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Tox client - qTox is a powerful Tox client that follows the Tox design guidelines + qTox is a powerful Tox client that follows the Tox design guidelines. + Tox is a decentralized and encrypted replacement for Skype, supporting + chats, audio, and video calls. diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index dc01f4a82..d0ec345c0 100755 --- a/tools/buildPackages.sh +++ b/tools/buildPackages.sh @@ -1,7 +1,7 @@ #!/bin/bash # Config (Update me if needed !) -VERSION_UPSTREAM="1.0" +VERSION_UPSTREAM="0.01pre-alpha" VERSION_PACKAGE="1" PACKAGENAME="qtox" UPSTREAM_URL="https://github.com/tux3/qTox/archive/master.tar.gz" From ef2eb5f3c0835a0cc2dccb8e199faa26b720ec3b Mon Sep 17 00:00:00 2001 From: dubslow Date: Wed, 3 Sep 2014 05:22:29 -0500 Subject: [PATCH 02/11] Update buildPackages.sh --- tools/buildPackages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildPackages.sh b/tools/buildPackages.sh index d0ec345c0..dc01f4a82 100755 --- a/tools/buildPackages.sh +++ b/tools/buildPackages.sh @@ -1,7 +1,7 @@ #!/bin/bash # Config (Update me if needed !) -VERSION_UPSTREAM="0.01pre-alpha" +VERSION_UPSTREAM="1.0" VERSION_PACKAGE="1" PACKAGENAME="qtox" UPSTREAM_URL="https://github.com/tux3/qTox/archive/master.tar.gz" From 69b2befe6ffc152a7a28b01c48faa4dc39b2da70 Mon Sep 17 00:00:00 2001 From: dubslow Date: Wed, 3 Sep 2014 05:22:41 -0500 Subject: [PATCH 03/11] Update changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5b1593c67..1b56f518a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -qtox (0.01pre-alpha-1) UNRELEASED; urgency=medium local package +qtox (1.0-1) UNRELEASED; urgency=medium local package * Initial release. From 7576795cca4cada77647866d83cdabe52ff1d4e0 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 4 Sep 2014 22:28:34 +0200 Subject: [PATCH 04/11] Update DHT bootstrap list --- res/settings.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/res/settings.ini b/res/settings.ini index 25d126190..e335c7c8d 100644 --- a/res/settings.ini +++ b/res/settings.ini @@ -1,6 +1,6 @@ [DHT%20Server] dhtServerList\size=9 -dhtServerList\1\name=stqism +dhtServerList\1\name=Nikolai Toryzin dhtServerList\1\userId=951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F dhtServerList\1\address=192.254.75.98 dhtServerList\1\port=33445 @@ -36,3 +36,7 @@ dhtServerList\9\name=SylvieLorxu dhtServerList\9\userId=4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057 dhtServerList\9\address=178.21.112.187 dhtServerList\9\port=33445 +dhtServerList\10\name=Unknown (uTox) +dhtServerList\10\userId=7187969BB10B54C98538BAE94C069CE5C84E650D54F7E596543D8FB1ECF4CF23 +dhtServerList\10\address=95.85.13.245 +dhtServerList\10\port=33445 From bf8e1101c5b64e1081418b820bc2da5771db4f08 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 4 Sep 2014 23:11:46 +0200 Subject: [PATCH 05/11] Fix Make Tox Portable impossible to disable --- settings.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/settings.cpp b/settings.cpp index 92841f4f7..a9461cd15 100644 --- a/settings.cpp +++ b/settings.cpp @@ -48,13 +48,19 @@ Settings& Settings::getInstance() void Settings::load() { - if (loaded) { + if (loaded) return; - } QFile portableSettings(FILENAME); if (portableSettings.exists()) - makeToxPortable=true; + { + QSettings ps(FILENAME, QSettings::IniFormat); + ps.beginGroup("General"); + makeToxPortable = ps.value("makeToxPortable", false).toBool(); + ps.endGroup(); + } + else + makeToxPortable = false; QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME); From 86ca598a483b066520e77b5c43ea322196b61311 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Thu, 4 Sep 2014 23:13:59 +0200 Subject: [PATCH 06/11] Option to use custom list of bootstrap nodes False by default, to allow for auto-updates and fix problems with people who can't connect to the DHT due to the old list not being updated and not working --- core.cpp | 4 ++-- settings.cpp | 57 +++++++++++++++++++++++++++++++++++++++++----------- settings.h | 1 + 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/core.cpp b/core.cpp index 37455d4e3..de5dc66ee 100644 --- a/core.cpp +++ b/core.cpp @@ -882,7 +882,8 @@ void Core::saveConfiguration() return; } - qDebug() << "Core: writing tox_save"; + qDebug() << "Core: Saving"; + uint32_t fileSize = tox_size(tox); if (fileSize > 0 && fileSize <= INT32_MAX) { uint8_t *data = new uint8_t[fileSize]; @@ -892,7 +893,6 @@ void Core::saveConfiguration() delete[] data; } - qDebug() << "Core: writing settings"; Settings::getInstance().save(); } diff --git a/settings.cpp b/settings.cpp index a9461cd15..01c6bed2c 100644 --- a/settings.cpp +++ b/settings.cpp @@ -30,7 +30,7 @@ const QString Settings::FILENAME = "settings.ini"; bool Settings::makeToxPortable{false}; Settings::Settings() : - loaded(false) + loaded(false), useCustomDhtList{false} { load(); } @@ -48,8 +48,9 @@ Settings& Settings::getInstance() void Settings::load() { - if (loaded) + if (loaded) { return; + } QFile portableSettings(FILENAME); if (portableSettings.exists()) @@ -71,19 +72,28 @@ void Settings::load() filePath = ":/conf/" + FILENAME; } + qDebug() << "Settings: Loading from "< dhtServerList; int dhtServerId; bool dontShowDhtDialog; From cac28fbbd5299327e4466c88d94e3624fee4c96d Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Fri, 5 Sep 2014 09:49:27 +0200 Subject: [PATCH 07/11] Italian translation: update --- translations/it.qm | Bin 6395 -> 6053 bytes translations/it.ts | 95 +++++++-------------------------------------- 2 files changed, 15 insertions(+), 80 deletions(-) diff --git a/translations/it.qm b/translations/it.qm index ea977d5d6f78b495a098168cab3963bca62abfee..f62f3726c032f119124a367a83cf8f13405a911e 100644 GIT binary patch delta 510 zcmX9*O-NKx7(FxZ-Z%4R-n%nX29^`SsMRKINRvpiAjxKvs3{^Cl8PmvP%T_NqLc}h zk)~9d34=z`QbzD+Q7x2Q#4IAyB8W;TNDy*SU?fEcT%CJA&iTIYoNp^US~!qpe}L$} z4eZK=NRAULAuEc39Z|U2+W`MJ>|e+QvOb~cp8$*qPF;@!Vi1v|_W)lQiN7nvCX8H= z)D<{=moM_as-4aGL;jeS8R`bGq`kZI6L9y7uH-e=l^BlR1#Gi)`(Zs0_m8n)ZHT8a z2OFeCI;S28%!?O!zX0c$*i3w7qjNI<&}YEhk|mKxTr4Wf+VTL0DO(Pg(||4eyeYsF zma!O(1sdd&-k0PlIhR@iv?aZL&pe<`=pAM`Z0Ni7j??D>J*9Wm?jy0x<;dnD=77tS zKLp5yZM06hGT(19k%w-_jawYJW<--UMB7-bc*cR7#{2P6_GvJ_SX|h9-1B>|i2A+W z;$@=NXr4L9IsR7jY8{QZKbji{o;LwI-&oC4ofIUkSD|HY)j5Ko4x~l5rDb!n4)tlx?q^b^5@2*u-tuu7)yTmvq;;#eQ(;?@ijQ9B? N@sLqD{n)7S{RbMufaL%H delta 823 zcmY*WT}TvB6#mAY+1a1jS+kPzr-sc<14Wm#@F~MAlMTbN@WmM25jS^thTU0WrCOo_ z!^&#SpA>}D$b3*xdgzCeL}G(Lv>pl!3MzsqFi47|Ga6A`?)~n$=bZ0+=iK4KpPno0 z;$OjDx&WlhVEac1FN3`m19%^}$`WAh4EUC2AkBrXQ(MTNiQ;7zu(e@#Gy$+(sM>KI zNLA7IYo2fb1IIYZ3#2%YHv(%mnf7P?p!oNuWcPUhv!)l<76I!sHrB5LahsRzY3l?W zt*a=$W^a^|?JQtNI~XGT%#LN&k$`3PLC!ZI zIRGPYN>K#~eaKz34*_*$~c(|Wl(?N2Dq%iSHC2TZf(mW;=U!+FxI3Y5UR%<7(6 z!nfwwk!jT6z35IIU6*)|Gaa_>`N(cv4{ zDB+bupS((i8OKxC98F}JkVZ$6l6@r9J}PDvx@gpkVpfljUh~E61NDGqn^>dK*QBP3 zHSJ^cMVxpji}J0V;&{^}P2zx`#`DQUL@rD$F^{--1}YGyrP5X);RKxxXoQTQ#VBZ| zZ7-LDN?4YZuo~u#w^f@lcv`V{B{xVJI^F(bAj=I8ogwms2qTC>qh(anjf_0H=99yZ z;L3A^Li{AakHCtYDA}?hEm4-9T~_=@NRt{4%DUwCNFi01B2i6K!@A F{stjp#*+X5 diff --git a/translations/it.ts b/translations/it.ts index 7ada13790..13bcf01fd 100644 --- a/translations/it.ts +++ b/translations/it.ts @@ -75,41 +75,20 @@ La risposta del server DNS non contiene un Tox ID valido - - Camera - - - Camera eror - Errore webcam - - - - Camera format %1 not supported, can't use the camera - Formato webcam %1 non supportato, impossibile usare la webcam - - ChatForm - + Send a file Invia un file - - + + Save chat log Salva il log della chat - - CopyableElideLabel - - - Copy - Copia - - FileTransfertWidget @@ -189,19 +168,19 @@ FriendWidget - + Copy friend ID Menu to copy the Tox ID of that friend Copia Tox ID del contatto - + Invite in group Menu to invite a friend in a groupchat Invita nel gruppo - + Remove friend Menu to remove the friend from our friendlist Rimuovi contatto @@ -234,19 +213,19 @@ GroupWidget - - + + %1 users in chat %1 utenti in chat - - + + 0 users in chat 0 utenti in chat - + Quit group Menu to quit a groupchat Esci dal gruppo @@ -303,7 +282,7 @@ SelfCamView - + Tox video test Title of the window to test the video/webcam qTox video test @@ -371,67 +350,23 @@ Text on smiley pack label Emoticons - - Select smiley pack - Scegli pacchetto emoticons - Widget - Tox - Tox - - - Your name - Tox User - - - Your status - Toxin on qTox - - - Add friends - Aggiungi contatto - - - Create a group chat - Crea un gruppo - - - View completed file transfers - Visualizza i trasferimenti completati - - - (button inactive currently) - (bottone attualmente inattivo) - - - Change your settings - Cambia le impostazioni - - - Close - Chiudi - - - Ctrl+Q - Ctrl+Q - - - + Online Button to set your status to 'Online' Online - + Away Button to set your status to 'Away' Assente - + Busy Button to set your status to 'Busy' Occupato From 02da6803f100356e40e603928e64ddbb81ceec42 Mon Sep 17 00:00:00 2001 From: apprb Date: Fri, 5 Sep 2014 01:09:55 +0700 Subject: [PATCH 08/11] initial merging common parts of chatforms' widget --- qtox.pro | 6 +- widget/form/chatform.cpp | 190 ++------------------------ widget/form/chatform.h | 22 +-- widget/form/genericchatform.cpp | 232 ++++++++++++++++++++++++++++++++ widget/form/genericchatform.h | 72 ++++++++++ widget/form/groupchatform.cpp | 127 ++--------------- widget/form/groupchatform.h | 23 +--- 7 files changed, 338 insertions(+), 334 deletions(-) create mode 100644 widget/form/genericchatform.cpp create mode 100644 widget/form/genericchatform.h diff --git a/qtox.pro b/qtox.pro index 679e6d17e..2e8468c07 100644 --- a/qtox.pro +++ b/qtox.pro @@ -101,7 +101,8 @@ HEADERS += widget/form/addfriendform.h \ widget/adjustingscrollarea.h \ widget/croppinglabel.h \ widget/friendlistwidget.h \ - widget/genericchatroomwidget.h + widget/genericchatroomwidget.h \ + widget/form/genericchatform.h SOURCES += \ widget/form/addfriendform.cpp \ @@ -134,4 +135,5 @@ SOURCES += \ widget/croppinglabel.cpp \ widget/friendlistwidget.cpp \ coreav.cpp \ - widget/genericchatroomwidget.cpp + widget/genericchatroomwidget.cpp \ + widget/form/genericchatform.cpp diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 50f09f5a2..6a7d0e114 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -32,124 +32,16 @@ #include ChatForm::ChatForm(Friend* chatFriend) - : f(chatFriend), curRow{0}, lockSliderToBottom{true} + : f(chatFriend) { - main = new QWidget(), head = new QWidget(), chatAreaWidget = new QWidget(); - name = new QLabel(), avatar = new QLabel(), statusMessage = new QLabel(); - headLayout = new QHBoxLayout(), mainFootLayout = new QHBoxLayout(); - headTextLayout = new QVBoxLayout(), mainLayout = new QVBoxLayout(), - footButtonsSmall = new QVBoxLayout(), volMicLayout = new QVBoxLayout(); - mainChatLayout = new QGridLayout(); - msgEdit = new ChatTextEdit(); - sendButton = new QPushButton(), fileButton = new QPushButton(), emoteButton = new QPushButton(), - callButton = new QPushButton(), videoButton = new QPushButton(), - volButton = new QPushButton(), micButton = new QPushButton(); - chatArea = new QScrollArea(); + nameLabel->setText(f->getName()); + avatarLabel->setPixmap(QPixmap(":/img/contact_dark.png")); + + statusMessageLabel = new QLabel(); netcam = new NetCamView(); - audioInputFlag = false; - - QFont bold; - bold.setBold(true); - name->setText(chatFriend->widget->name.text()); - name->setFont(bold); - statusMessage->setText(chatFriend->widget->statusMessage.text()); - - // No real avatar support in toxcore, better draw a pretty picture - //avatar->setPixmap(*chatFriend->widget->avatar.pixmap()); - avatar->setPixmap(QPixmap(":/img/contact_dark.png")); - - chatAreaWidget->setLayout(mainChatLayout); - chatAreaWidget->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css")); - - chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - chatArea->setWidgetResizable(true); - chatArea->setContextMenuPolicy(Qt::CustomContextMenu); - chatArea->setFrameStyle(QFrame::NoFrame); - - mainChatLayout->setColumnStretch(1,1); - mainChatLayout->setSpacing(5); - - footButtonsSmall->setSpacing(2); - - msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css")); - msgEdit->setFixedHeight(50); - msgEdit->setFrameStyle(QFrame::NoFrame); - - sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css")); - fileButton->setStyleSheet(Style::get(":/ui/fileButton/fileButton.css")); - emoteButton->setStyleSheet(Style::get(":/ui/emoteButton/emoteButton.css")); - - callButton->setObjectName("green"); - callButton->setStyleSheet(Style::get(":/ui/callButton/callButton.css")); - - videoButton->setObjectName("green"); - videoButton->setStyleSheet(Style::get(":/ui/videoButton/videoButton.css")); - - QString volButtonStylesheet = ""; - try - { - QFile f(":/ui/volButton/volButton.css"); - f.open(QFile::ReadOnly | QFile::Text); - QTextStream volButtonStylesheetStream(&f); - volButtonStylesheet = volButtonStylesheetStream.readAll(); - } - catch (int e) {} - volButton->setObjectName("green"); - volButton->setStyleSheet(volButtonStylesheet); - - QString micButtonStylesheet = ""; - try - { - QFile f(":/ui/micButton/micButton.css"); - f.open(QFile::ReadOnly | QFile::Text); - QTextStream micButtonStylesheetStream(&f); - micButtonStylesheet = micButtonStylesheetStream.readAll(); - } - catch (int e) {} - micButton->setObjectName("green"); - micButton->setStyleSheet(micButtonStylesheet); - - main->setLayout(mainLayout); - mainLayout->addWidget(chatArea); - mainLayout->addLayout(mainFootLayout); - mainLayout->setMargin(0); - - footButtonsSmall->addWidget(emoteButton); - footButtonsSmall->addWidget(fileButton); - - mainFootLayout->addWidget(msgEdit); - mainFootLayout->addLayout(footButtonsSmall); - mainFootLayout->addSpacing(5); - mainFootLayout->addWidget(sendButton); - mainFootLayout->setSpacing(0); - - head->setLayout(headLayout); - headLayout->addWidget(avatar); - headLayout->addLayout(headTextLayout); - headLayout->addStretch(); - headLayout->addLayout(volMicLayout); - headLayout->addWidget(callButton); - headLayout->addWidget(videoButton); - - volMicLayout->addWidget(micButton); - volMicLayout->addWidget(volButton); + headTextLayout->addWidget(statusMessageLabel); headTextLayout->addStretch(); - headTextLayout->addWidget(name); - headTextLayout->addWidget(statusMessage); - headTextLayout->addStretch(); - - chatArea->setWidget(chatAreaWidget); - - //Fix for incorrect layouts on OS X as per - //https://bugreports.qt-project.org/browse/QTBUG-14591 - sendButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - // callButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - // videoButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - // msgEdit->setAttribute(Qt::WA_LayoutUsesWidgetRect); - // chatArea->setAttribute(Qt::WA_LayoutUsesWidgetRect); connect(Widget::getInstance()->getCore(), &Core::fileSendStarted, this, &ChatForm::startFileSend); connect(Widget::getInstance()->getCore(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay); @@ -166,29 +58,13 @@ ChatForm::ChatForm(Friend* chatFriend) ChatForm::~ChatForm() { - delete main; - delete head; delete netcam; } -void ChatForm::show(Ui::MainWindow &ui) -{ - ui.mainContent->layout()->addWidget(main); - ui.mainHead->layout()->addWidget(head); - main->show(); - head->show(); -} - -void ChatForm::setName(QString newName) -{ - name->setText(newName); - name->setToolTip(newName); // for overlength names -} - void ChatForm::setStatusMessage(QString newMessage) { - statusMessage->setText(newMessage); - statusMessage->setToolTip(newMessage); // for overlength messsages + statusMessageLabel->setText(newMessage); + statusMessageLabel->setToolTip(newMessage); // for overlength messsages } void ChatForm::onSendTriggered() @@ -204,7 +80,7 @@ void ChatForm::onSendTriggered() void ChatForm::addFriendMessage(QString message) { - QLabel *msgAuthor = new QLabel(name->text()); + QLabel *msgAuthor = new QLabel(nameLabel->text()); QLabel *msgText = new QLabel(message); QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm")); @@ -299,13 +175,6 @@ void ChatForm::onAttachClicked() emit sendFile(f->friendId, fi.fileName(), path, filesize); } -void ChatForm::onSliderRangeChanged() -{ - QScrollBar* scroll = chatArea->verticalScrollBar(); - if (lockSliderToBottom) - scroll->setValue(scroll->maximum()); -} - void ChatForm::startFileSend(ToxFile file) { if (file.friendId != f->friendId) @@ -661,47 +530,6 @@ void ChatForm::onCancelCallTriggered() emit cancelCall(callId, f->friendId); } -void ChatForm::onChatContextMenuRequested(QPoint pos) -{ - QWidget* sender = (QWidget*)QObject::sender(); - pos = sender->mapToGlobal(pos); - QMenu menu; - menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked())); - menu.exec(pos); -} - -void ChatForm::onSaveLogClicked() -{ - QString path = QFileDialog::getSaveFileName(0,tr("Save chat log")); - if (path.isEmpty()) - return; - - QFile file(path); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QString log; - QList labels = chatAreaWidget->findChildren(); - int i=0; - for (QLabel* label : labels) - { - log += label->text(); - if (i==2) - { - i=0; - log += '\n'; - } - else - { - log += '\t'; - i++; - } - } - - file.write(log.toUtf8()); - file.close(); -} - void ChatForm::onEmoteButtonClicked() { // don't show the smiley selection widget if there are no smileys available diff --git a/widget/form/chatform.h b/widget/form/chatform.h index dd746d6c1..c2c530863 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -27,6 +27,7 @@ #include #include +#include "genericchatform.h" #include "widget/tool/chattextedit.h" #include "ui_mainwindow.h" #include "core.h" @@ -37,21 +38,18 @@ struct Friend; -class ChatForm : public QObject +class ChatForm : public GenericChatForm { Q_OBJECT public: ChatForm(Friend* chatFriend); ~ChatForm(); - void show(Ui::MainWindow &ui); - void setName(QString newName); void setStatusMessage(QString newMessage); void addFriendMessage(QString message); void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); void addMessage(QLabel* author, QLabel* message, QLabel* date); signals: - void sendMessage(int, QString); void sendFile(int32_t friendId, QString, QString, long long); void startCall(int friendId); void startVideoCall(int friendId, bool video); @@ -78,31 +76,19 @@ public slots: private slots: void onSendTriggered(); void onAttachClicked(); - void onSliderRangeChanged(); void onCallTriggered(); void onVideoCallTriggered(); void onAnswerCallTriggered(); void onHangupCallTriggered(); void onCancelCallTriggered(); - void onChatContextMenuRequested(QPoint pos); - void onSaveLogClicked(); void onEmoteButtonClicked(); void onEmoteInsertRequested(QString str); private: Friend* f; - QHBoxLayout *headLayout, *mainFootLayout; - QVBoxLayout *headTextLayout, *mainLayout, *footButtonsSmall, *volMicLayout; - QGridLayout *mainChatLayout; - QLabel *avatar, *name, *statusMessage; - ChatTextEdit *msgEdit; - QPushButton *sendButton, *fileButton, *emoteButton, *callButton, *videoButton, *volButton, *micButton; - QScrollArea *chatArea; - QWidget *main, *head, *chatAreaWidget; - QString previousName; + QLabel *statusMessageLabel; NetCamView* netcam; - int curRow; - bool lockSliderToBottom, audioInputFlag; + bool audioInputFlag; int callId; }; diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp new file mode 100644 index 000000000..f28173e72 --- /dev/null +++ b/widget/form/genericchatform.cpp @@ -0,0 +1,232 @@ +/* + Copyright (C) 2014 by Project Tox + + This file is part of qTox, a Qt-based graphical interface for Tox. + + This program is libre software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the COPYING file for more details. +*/ + +#include "genericchatform.h" +#include "ui_mainwindow.h" +#include +#include +#include +#include "style.h" + +GenericChatForm::GenericChatForm(QObject *parent) : + QObject(parent) +{ + lockSliderToBottom = true; + curRow = 0; + + mainWidget = new QWidget(); headWidget = new QWidget(); chatAreaWidget = new QWidget(); + + nameLabel = new QLabel(); + avatarLabel = new QLabel(); + QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout(); + headTextLayout = new QVBoxLayout(); + QVBoxLayout *mainLayout = new QVBoxLayout(); + QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout(); + mainChatLayout = new QGridLayout(); + + msgEdit = new ChatTextEdit(); + + sendButton = new QPushButton(); + emoteButton = new QPushButton(); + + fileButton = new QPushButton(); + callButton = new QPushButton(); + videoButton = new QPushButton(); + volButton = new QPushButton(); + micButton = new QPushButton(); + + chatArea = new QScrollArea(); + + QFont bold; + bold.setBold(true); + nameLabel->setFont(bold); + + chatAreaWidget->setLayout(mainChatLayout); + chatAreaWidget->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css")); + + chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + chatArea->setWidgetResizable(true); + chatArea->setContextMenuPolicy(Qt::CustomContextMenu); + chatArea->setFrameStyle(QFrame::NoFrame); + + mainChatLayout->setColumnStretch(1,1); + mainChatLayout->setSpacing(5); + + footButtonsSmall->setSpacing(2); + + msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css")); + msgEdit->setFixedHeight(50); + msgEdit->setFrameStyle(QFrame::NoFrame); + + sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css")); + fileButton->setStyleSheet(Style::get(":/ui/fileButton/fileButton.css")); + emoteButton->setStyleSheet(Style::get(":/ui/emoteButton/emoteButton.css")); + + callButton->setObjectName("green"); + callButton->setStyleSheet(Style::get(":/ui/callButton/callButton.css")); + + videoButton->setObjectName("green"); + videoButton->setStyleSheet(Style::get(":/ui/videoButton/videoButton.css")); + + QString volButtonStylesheet = ""; + try + { + QFile f(":/ui/volButton/volButton.css"); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream volButtonStylesheetStream(&f); + volButtonStylesheet = volButtonStylesheetStream.readAll(); + } + catch (int e) {} + + volButton->setObjectName("green"); + volButton->setStyleSheet(volButtonStylesheet); + + QString micButtonStylesheet = ""; + try + { + QFile f(":/ui/micButton/micButton.css"); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream micButtonStylesheetStream(&f); + micButtonStylesheet = micButtonStylesheetStream.readAll(); + } + catch (int e) {} + + micButton->setObjectName("green"); + micButton->setStyleSheet(micButtonStylesheet); + + mainWidget->setLayout(mainLayout); + mainLayout->addWidget(chatArea); + mainLayout->addLayout(mainFootLayout); + mainLayout->setMargin(0); + + footButtonsSmall->addWidget(emoteButton); + footButtonsSmall->addWidget(fileButton); + + mainFootLayout->addWidget(msgEdit); + mainFootLayout->addLayout(footButtonsSmall); + mainFootLayout->addSpacing(5); + mainFootLayout->addWidget(sendButton); + mainFootLayout->setSpacing(0); + + headWidget->setLayout(headLayout); + headLayout->addWidget(avatarLabel); + headLayout->addLayout(headTextLayout); + headLayout->addStretch(); + headLayout->addLayout(volMicLayout); + headLayout->addWidget(callButton); + headLayout->addWidget(videoButton); + + volMicLayout->addWidget(micButton); + volMicLayout->addWidget(volButton); + + headTextLayout->addStretch(); + headTextLayout->addWidget(nameLabel); +// headTextLayout->addWidget(statusMessage); +// headTextLayout->addStretch(); + + chatArea->setWidget(chatAreaWidget); + + //Fix for incorrect layouts on OS X as per + //https://bugreports.qt-project.org/browse/QTBUG-14591 + sendButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); + fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); + emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); + + // connect(Widget::getInstance()->getCore(), &Core::fileSendStarted, this, &ChatForm::startFileSend); + // 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) +{ + nameLabel->setText(newName); + nameLabel->setToolTip(newName); // for overlength names +} + +void GenericChatForm::show(Ui::MainWindow &ui) +{ + ui.mainContent->layout()->addWidget(mainWidget); + ui.mainHead->layout()->addWidget(headWidget); + mainWidget->show(); + headWidget->show(); +} + +void GenericChatForm::onChatContextMenuRequested(QPoint pos) +{ + QWidget* sender = (QWidget*)QObject::sender(); + pos = sender->mapToGlobal(pos); + QMenu menu; + menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked())); + menu.exec(pos); +} + +void GenericChatForm::onSliderRangeChanged() +{ + QScrollBar* scroll = chatArea->verticalScrollBar(); + if (lockSliderToBottom) + scroll->setValue(scroll->maximum()); +} + +void GenericChatForm::onSaveLogClicked() +{ + QString path = QFileDialog::getSaveFileName(0,tr("Save chat log")); + if (path.isEmpty()) + return; + + QFile file(path); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + + QString log; + QList labels = chatAreaWidget->findChildren(); + int i=0; + for (QLabel* label : labels) + { + log += label->text(); + if (i==2) + { + i=0; + log += '\n'; + } + else + { + log += '\t'; + i++; + } + } + + file.write(log.toUtf8()); + file.close(); +} + +void GenericChatForm::addMessage(QString author, QString message, QString date) +{ + // +} + +GenericChatForm::~GenericChatForm() +{ + delete mainWidget; + delete headWidget; +} diff --git a/widget/form/genericchatform.h b/widget/form/genericchatform.h new file mode 100644 index 000000000..b223bb395 --- /dev/null +++ b/widget/form/genericchatform.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2014 by Project Tox + + This file is part of qTox, a Qt-based graphical interface for Tox. + + This program is libre software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the COPYING file for more details. +*/ + +#ifndef GENERICCHATFORM_H +#define GENERICCHATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "widget/tool/chattextedit.h" + +namespace Ui { + class MainWindow; +} + +class GenericChatForm : public QObject +{ + Q_OBJECT +public: + GenericChatForm(QObject *parent = 0); + virtual ~GenericChatForm(); + + virtual void setName(const QString &newName); + virtual void show(Ui::MainWindow &ui); + virtual void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); + +signals: + void sendMessage(int, QString); + +public slots: + +protected slots: + void onChatContextMenuRequested(QPoint pos); + void onSliderRangeChanged(); + void onSaveLogClicked(); + +protected: + QLabel *nameLabel, *avatarLabel; + QWidget *mainWidget, *headWidget, *chatAreaWidget; + QScrollArea *chatArea; + QPushButton *fileButton, *emoteButton, *callButton, *videoButton, *volButton, *micButton; + QGridLayout *mainChatLayout; + QVBoxLayout *headTextLayout; + ChatTextEdit *msgEdit; + QPushButton *sendButton; + QString previousName; + int curRow; + bool lockSliderToBottom; +}; + +#endif // GENERICCHATFORM_H diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index e5e630ae1..a48ae539b 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -29,25 +29,25 @@ #include GroupChatForm::GroupChatForm(Group* chatGroup) - : group(chatGroup), curRow{0}, lockSliderToBottom{true} + : group(chatGroup) { - main = new QWidget(), head = new QWidget(), chatAreaWidget = new QWidget(); - headLayout = new QHBoxLayout(), mainFootLayout = new QHBoxLayout(); - headTextLayout = new QVBoxLayout(), mainLayout = new QVBoxLayout(); - mainChatLayout = new QGridLayout(); - avatar = new QLabel(), name = new QLabel(), nusers = new QLabel(), namesList = new QLabel(); - msgEdit = new ChatTextEdit(); - sendButton = new QPushButton(); - chatArea = new QScrollArea(); - QFont bold; - bold.setBold(true); + nusers = new QLabel(); + namesList = new QLabel(); + + fileButton->setEnabled(false); + callButton->setVisible(false); + videoButton->setVisible(false); + volButton->setVisible(false); + micButton->setVisible(false); + QFont small; small.setPixelSize(10); - name->setText(group->widget->name.text()); - name->setFont(bold); + + nameLabel->setText(group->widget->name.text()); nusers->setFont(small); nusers->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); - avatar->setPixmap(QPixmap(":/img/group.png")); + avatarLabel->setPixmap(QPixmap(":/img/group_dark.png")); + QString names; for (QString& s : group->peers) names.append(s+", "); @@ -55,54 +55,17 @@ GroupChatForm::GroupChatForm(Group* chatGroup) namesList->setText(names); namesList->setFont(small); - chatAreaWidget->setLayout(mainChatLayout); - - chatArea->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css")); - chatArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - chatArea->setWidgetResizable(true); - chatArea->setContextMenuPolicy(Qt::CustomContextMenu); - chatArea->setFrameStyle(QFrame::NoFrame); - - mainChatLayout->setColumnStretch(1,1); - mainChatLayout->setSpacing(10); - msgEdit->setObjectName("group"); - msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css")); - msgEdit->setFixedHeight(50); - msgEdit->setFrameStyle(QFrame::NoFrame); mainChatLayout->setColumnStretch(1,1); mainChatLayout->setHorizontalSpacing(10); - sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css")); - sendButton->setFixedSize(50, 50); - - main->setLayout(mainLayout); - mainLayout->addWidget(chatArea); - mainLayout->addLayout(mainFootLayout); - mainLayout->setMargin(0); - - mainFootLayout->addWidget(msgEdit); - mainFootLayout->addWidget(sendButton); - - head->setLayout(headLayout); - headLayout->addWidget(avatar); - headLayout->addLayout(headTextLayout); - headLayout->addStretch(); - headLayout->setMargin(0); - - headTextLayout->addStretch(); - headTextLayout->addWidget(name); headTextLayout->addWidget(nusers); headTextLayout->addWidget(namesList); headTextLayout->setMargin(0); headTextLayout->setSpacing(0); headTextLayout->addStretch(); - chatArea->setWidget(chatAreaWidget); - - sendButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - connect(sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered())); connect(msgEdit, SIGNAL(enterPressed()), this, SLOT(onSendTriggered())); connect(chatArea->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged())); @@ -111,21 +74,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup) GroupChatForm::~GroupChatForm() { - delete head; - delete main; -} -void GroupChatForm::show(Ui::MainWindow &ui) -{ - ui.mainContent->layout()->addWidget(main); - ui.mainHead->layout()->addWidget(head); - main->show(); - head->show(); -} - -void GroupChatForm::setName(QString newName) -{ - name->setText(newName); } void GroupChatForm::onSendTriggered() @@ -203,13 +152,6 @@ void GroupChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) connect(date, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); } -void GroupChatForm::onSliderRangeChanged() -{ - QScrollBar* scroll = chatArea->verticalScrollBar(); - if (lockSliderToBottom) - scroll->setValue(scroll->maximum()); -} - void GroupChatForm::onUserListChanged() { nusers->setText(tr("%1 users in chat").arg(group->nPeers)); @@ -219,44 +161,3 @@ void GroupChatForm::onUserListChanged() names.chop(2); namesList->setText(names); } - -void GroupChatForm::onChatContextMenuRequested(QPoint pos) -{ - QWidget* sender = (QWidget*)QObject::sender(); - pos = sender->mapToGlobal(pos); - QMenu menu; - menu.addAction("Save chat log", this, SLOT(onSaveLogClicked())); - menu.exec(pos); -} - -void GroupChatForm::onSaveLogClicked() -{ - QString path = QFileDialog::getSaveFileName(0,tr("Save chat log")); - if (path.isEmpty()) - return; - - QFile file(path); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QString log; - QList labels = chatAreaWidget->findChildren(); - int i=0; - for (QLabel* label : labels) - { - log += label->text(); - if (i==2) - { - i=0; - log += '\n'; - } - else - { - log += '\t'; - i++; - } - } - - file.write(log.toUtf8()); - file.close(); -} diff --git a/widget/form/groupchatform.h b/widget/form/groupchatform.h index af008476a..519eafb30 100644 --- a/widget/form/groupchatform.h +++ b/widget/form/groupchatform.h @@ -26,6 +26,7 @@ #include #include +#include "genericchatform.h" #include "widget/tool/chattextedit.h" #include "ui_mainwindow.h" @@ -34,41 +35,23 @@ class Group; -class GroupChatForm : public QObject +class GroupChatForm : public GenericChatForm { Q_OBJECT public: GroupChatForm(Group* chatGroup); ~GroupChatForm(); - void show(Ui::MainWindow &ui); - void setName(QString newName); void addGroupMessage(QString message, int peerId); void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); void addMessage(QLabel* author, QLabel* message, QLabel* date); void onUserListChanged(); -signals: - void sendMessage(int, QString); - private slots: void onSendTriggered(); - void onSliderRangeChanged(); - void onChatContextMenuRequested(QPoint pos); - void onSaveLogClicked(); private: Group* group; - QHBoxLayout *headLayout, *mainFootLayout; - QVBoxLayout *headTextLayout, *mainLayout; - QGridLayout *mainChatLayout; - QLabel *avatar, *name, *nusers, *namesList; - ChatTextEdit *msgEdit; - QPushButton *sendButton; - QScrollArea *chatArea; - QWidget *main, *head, *chatAreaWidget; - QString previousName; - int curRow; - bool lockSliderToBottom; + QLabel *nusers, *namesList; }; #endif // GROUPCHATFORM_H From 522d570e62259eedf1838d278fa2c3cf0e8ac535 Mon Sep 17 00:00:00 2001 From: apprb Date: Fri, 5 Sep 2014 22:05:57 +0700 Subject: [PATCH 09/11] code cleanup --- res.qrc | 1 + ui/fileButton/fileButton.css | 5 ++++ ui/fileButton/fileButtonDisabled.png | Bin 0 -> 457 bytes widget/form/chatform.cpp | 28 ----------------- widget/form/chatform.h | 2 -- widget/form/genericchatform.cpp | 43 +++++++++++++++++++-------- widget/form/genericchatform.h | 2 ++ 7 files changed, 38 insertions(+), 43 deletions(-) create mode 100644 ui/fileButton/fileButtonDisabled.png diff --git a/res.qrc b/res.qrc index f413e0209..0b6abfff5 100644 --- a/res.qrc +++ b/res.qrc @@ -124,5 +124,6 @@ ui/micButton/micButtonPressed.png ui/micButton/micButton.css ui/volButton/volButton.css + ui/fileButton/fileButtonDisabled.png diff --git a/ui/fileButton/fileButton.css b/ui/fileButton/fileButton.css index 59b110ced..fd06c6f0e 100644 --- a/ui/fileButton/fileButton.css +++ b/ui/fileButton/fileButton.css @@ -17,6 +17,11 @@ QPushButton:pressed background-image: url(":/ui/fileButton/fileButtonPressed.png"); } +QPushButton[enabled="false"] +{ + background-image: url(":/ui/fileButton/fileButtonDisabled.png"); +} + QPushButton:focus { outline: none; } diff --git a/ui/fileButton/fileButtonDisabled.png b/ui/fileButton/fileButtonDisabled.png new file mode 100644 index 0000000000000000000000000000000000000000..ed024e2df5291c312c8cf89105ec958663a8f6e1 GIT binary patch literal 457 zcmV;)0XF`LP)cIDW zAW+j3igXMudSJz=<9rWQO;@}W8%XuEjjZOIuG==JC05f=z&8VhY!88|O+~LHmOWDR z(V6S!oo4+IsM!#TB(7;HdEgj7aZqNfldWwZvGqAQG$D z6ngG$*5MjvMUt__s(V5&bh0mf!)M1v;LN!-snlzUG#e=DySRLR@zfn7@102Vvh-D1 z<AI!lofDt(Qr{kn z#z6Ra00000NkvXXu0mjfJ#@w~ literal 0 HcmV?d00001 diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 6a7d0e114..2c57fc597 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -52,7 +52,6 @@ ChatForm::ChatForm(Friend* chatFriend) 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())); } @@ -530,33 +529,6 @@ void ChatForm::onCancelCallTriggered() 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(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(QObject::sender()); - if (sender) - msgEdit->insertPlainText(str); - - msgEdit->setFocus(); // refocus so that we can continue typing -} - void ChatForm::onMicMuteToggle() { if (audioInputFlag == true) diff --git a/widget/form/chatform.h b/widget/form/chatform.h index c2c530863..395940663 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -81,8 +81,6 @@ private slots: void onAnswerCallTriggered(); void onHangupCallTriggered(); void onCancelCallTriggered(); - void onEmoteButtonClicked(); - void onEmoteInsertRequested(QString str); private: Friend* f; diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index f28173e72..56ae97558 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -19,6 +19,8 @@ #include #include #include +#include "smileypack.h" +#include "widget/emoticonswidget.h" #include "style.h" GenericChatForm::GenericChatForm(QObject *parent) : @@ -134,8 +136,6 @@ GenericChatForm::GenericChatForm(QObject *parent) : headTextLayout->addStretch(); headTextLayout->addWidget(nameLabel); -// headTextLayout->addWidget(statusMessage); -// headTextLayout->addStretch(); chatArea->setWidget(chatAreaWidget); @@ -145,17 +145,7 @@ GenericChatForm::GenericChatForm(QObject *parent) : fileButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); - // connect(Widget::getInstance()->getCore(), &Core::fileSendStarted, this, &ChatForm::startFileSend); - // 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())); + connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked())); } void GenericChatForm::setName(const QString &newName) @@ -230,3 +220,30 @@ GenericChatForm::~GenericChatForm() delete mainWidget; 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(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(QObject::sender()); + if (sender) + msgEdit->insertPlainText(str); + + msgEdit->setFocus(); // refocus so that we can continue typing +} diff --git a/widget/form/genericchatform.h b/widget/form/genericchatform.h index b223bb395..2b2d9c62e 100644 --- a/widget/form/genericchatform.h +++ b/widget/form/genericchatform.h @@ -54,6 +54,8 @@ protected slots: void onChatContextMenuRequested(QPoint pos); void onSliderRangeChanged(); void onSaveLogClicked(); + void onEmoteButtonClicked(); + void onEmoteInsertRequested(QString str); protected: QLabel *nameLabel, *avatarLabel; From 2826e83cefd1d3173e0f27c5f323434ad954301e Mon Sep 17 00:00:00 2001 From: apprb Date: Fri, 5 Sep 2014 22:24:29 +0700 Subject: [PATCH 10/11] addMessage moved to parent class --- widget/form/chatform.cpp | 75 --------------------------------- widget/form/chatform.h | 6 --- widget/form/genericchatform.cpp | 63 ++++++++++++++++++++++++++- widget/form/genericchatform.h | 3 ++ widget/form/groupchatform.cpp | 63 ++------------------------- widget/form/groupchatform.h | 5 --- widget/widget.cpp | 2 +- 7 files changed, 70 insertions(+), 147 deletions(-) diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 2c57fc597..82d919b09 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -77,81 +77,6 @@ void ChatForm::onSendTriggered() emit sendMessage(f->friendId, msg); } -void ChatForm::addFriendMessage(QString message) -{ - QLabel *msgAuthor = new QLabel(nameLabel->text()); - QLabel *msgText = new QLabel(message); - QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm")); - - addMessage(msgAuthor, msgText, msgDate); -} - -void ChatForm::addMessage(QString author, QString message, QString date) -{ - addMessage(new QLabel(author), new QLabel(message), new QLabel(date)); -} - -void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) -{ - QScrollBar* scroll = chatArea->verticalScrollBar(); - lockSliderToBottom = scroll && scroll->value() == scroll->maximum(); - author->setAlignment(Qt::AlignTop | Qt::AlignRight); - date->setAlignment(Qt::AlignTop); - message->setWordWrap(true); - message->setTextInteractionFlags(Qt::TextBrowserInteraction); - author->setTextInteractionFlags(Qt::TextBrowserInteraction); - date->setTextInteractionFlags(Qt::TextBrowserInteraction); - if (author->text() == Widget::getInstance()->getUsername()) - { - QPalette pal; - pal.setColor(QPalette::WindowText, QColor(100,100,100)); - author->setPalette(pal); - message->setPalette(pal); - } - if (previousName.isEmpty() || previousName != author->text()) - { - if (curRow) - { - mainChatLayout->setRowStretch(curRow, 0); - mainChatLayout->addItem(new QSpacerItem(0,AUTHOR_CHANGE_SPACING),curRow,0,1,3); - } - previousName = author->text(); - curRow++; - } - else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line - author->setText(""); - - QColor greentext(61,204,61); - QString fontTemplate = "%2"; - - QString finalMessage; - QStringList messageLines = message->text().split("\n"); - for (QString& s : messageLines) - { - if (QRegExp("^[ ]*>.*").exactMatch(s)) - finalMessage += fontTemplate.arg(greentext.name(), s.replace(" ", " ")); - else - finalMessage += s.replace(" ", " "); - finalMessage += "
"; - } - message->setText(finalMessage.left(finalMessage.length()-4)); - message->setText(SmileyPack::getInstance().smileyfied(message->text())); - message->setTextFormat(Qt::RichText); - - mainChatLayout->addWidget(author, curRow, 0); - mainChatLayout->addWidget(message, curRow, 1); - mainChatLayout->addWidget(date, curRow, 3); - mainChatLayout->setRowStretch(curRow+1, 1); - mainChatLayout->setRowStretch(curRow, 0); - curRow++; - author->setContextMenuPolicy(Qt::CustomContextMenu); - message->setContextMenuPolicy(Qt::CustomContextMenu); - date->setContextMenuPolicy(Qt::CustomContextMenu); - connect(author, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); - connect(message, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); - connect(date, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); -} - void ChatForm::onAttachClicked() { QString path = QFileDialog::getOpenFileName(0,tr("Send a file")); diff --git a/widget/form/chatform.h b/widget/form/chatform.h index 395940663..9b803ae35 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -33,9 +33,6 @@ #include "core.h" #include "widget/netcamview.h" -// Spacing in px inserted when the author of the last message changes -#define AUTHOR_CHANGE_SPACING 5 - struct Friend; class ChatForm : public GenericChatForm @@ -45,9 +42,6 @@ public: ChatForm(Friend* chatFriend); ~ChatForm(); void setStatusMessage(QString newMessage); - void addFriendMessage(QString message); - void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); - void addMessage(QLabel* author, QLabel* message, QLabel* date); signals: void sendFile(int32_t friendId, QString, QString, long long); diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index 56ae97558..b26bedc03 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -22,6 +22,7 @@ #include "smileypack.h" #include "widget/emoticonswidget.h" #include "style.h" +#include "widget/widget.h" GenericChatForm::GenericChatForm(QObject *parent) : QObject(parent) @@ -212,7 +213,67 @@ void GenericChatForm::onSaveLogClicked() void GenericChatForm::addMessage(QString author, QString message, QString date) { - // + QLabel *authorLabel = new QLabel(author); + QLabel *messageLabel = new QLabel(message); + QLabel *dateLabel = new QLabel(date); + + QScrollBar* scroll = chatArea->verticalScrollBar(); + lockSliderToBottom = scroll && scroll->value() == scroll->maximum(); + authorLabel->setAlignment(Qt::AlignTop | Qt::AlignRight); + dateLabel->setAlignment(Qt::AlignTop); + messageLabel->setWordWrap(true); + messageLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + authorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + dateLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + if (author == Widget::getInstance()->getUsername()) + { + QPalette pal; + pal.setColor(QPalette::WindowText, QColor(100,100,100)); + authorLabel->setPalette(pal); + messageLabel->setPalette(pal); + } + if (previousName.isEmpty() || previousName != author) + { + if (curRow) + { + mainChatLayout->setRowStretch(curRow, 0); + mainChatLayout->addItem(new QSpacerItem(0,AUTHOR_CHANGE_SPACING),curRow,0,1,3); + } + previousName = author; + curRow++; + } + else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line + authorLabel->setText(""); + + QColor greentext(61,204,61); + QString fontTemplate = "%2"; + + QString finalMessage; + QStringList messageLines = message.split("\n"); + for (QString& s : messageLines) + { + if (QRegExp("^[ ]*>.*").exactMatch(s)) + finalMessage += fontTemplate.arg(greentext.name(), s.replace(" ", " ")); + else + finalMessage += s.replace(" ", " "); + finalMessage += "
"; + } + messageLabel->setText(finalMessage.left(finalMessage.length()-4)); + messageLabel->setText(SmileyPack::getInstance().smileyfied(messageLabel->text())); + messageLabel->setTextFormat(Qt::RichText); + + mainChatLayout->addWidget(authorLabel, curRow, 0); + mainChatLayout->addWidget(messageLabel, curRow, 1); + mainChatLayout->addWidget(dateLabel, curRow, 3); + mainChatLayout->setRowStretch(curRow+1, 1); + mainChatLayout->setRowStretch(curRow, 0); + curRow++; + authorLabel->setContextMenuPolicy(Qt::CustomContextMenu); + messageLabel->setContextMenuPolicy(Qt::CustomContextMenu); + dateLabel->setContextMenuPolicy(Qt::CustomContextMenu); + connect(authorLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); + connect(messageLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); + connect(dateLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); } GenericChatForm::~GenericChatForm() diff --git a/widget/form/genericchatform.h b/widget/form/genericchatform.h index 2b2d9c62e..f25ccdc1e 100644 --- a/widget/form/genericchatform.h +++ b/widget/form/genericchatform.h @@ -30,6 +30,9 @@ #include "widget/tool/chattextedit.h" +// Spacing in px inserted when the author of the last message changes +#define AUTHOR_CHANGE_SPACING 5 + namespace Ui { class MainWindow; } diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index a48ae539b..0d743feea 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -88,68 +88,13 @@ void GroupChatForm::onSendTriggered() void GroupChatForm::addGroupMessage(QString message, int peerId) { - QLabel *msgAuthor; + QString msgAuthor; if (group->peers.contains(peerId)) - msgAuthor = new QLabel(group->peers[peerId]); + msgAuthor = group->peers[peerId]; else - msgAuthor = new QLabel(tr("")); + msgAuthor = tr(""); - QLabel *msgText = new QLabel(message); - QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm")); - - addMessage(msgAuthor, msgText, msgDate); -} - -void GroupChatForm::addMessage(QString author, QString message, QString date) -{ - addMessage(new QLabel(author), new QLabel(message), new QLabel(date)); -} - -void GroupChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) -{ - QPalette greentext; - greentext.setColor(QPalette::WindowText, QColor(61,204,61)); - QScrollBar* scroll = chatArea->verticalScrollBar(); - lockSliderToBottom = scroll && scroll->value() == scroll->maximum(); - author->setAlignment(Qt::AlignTop | Qt::AlignLeft); - date->setAlignment(Qt::AlignTop); - message->setWordWrap(true); - message->setTextInteractionFlags(Qt::TextBrowserInteraction); - author->setTextInteractionFlags(Qt::TextBrowserInteraction); - date->setTextInteractionFlags(Qt::TextBrowserInteraction); - if (author->text() == Widget::getInstance()->getUsername()) - { - QPalette pal; - pal.setColor(QPalette::WindowText, Qt::gray); - author->setPalette(pal); - message->setPalette(pal); - } - if (previousName.isEmpty() || previousName != author->text()) - { - if (curRow) - { - mainChatLayout->setRowStretch(curRow, 0); - mainChatLayout->addItem(new QSpacerItem(0,AUTHOR_CHANGE_SPACING),curRow,0,1,3); - } - previousName = author->text(); - curRow++; - } - else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line - author->setText(""); - if (message->text()[0] == '>') - message->setPalette(greentext); - mainChatLayout->addWidget(author, curRow, 0); - mainChatLayout->addWidget(message, curRow, 1); - mainChatLayout->addWidget(date, curRow, 3); - mainChatLayout->setRowStretch(curRow+1, 1); - mainChatLayout->setRowStretch(curRow, 0); - curRow++; - author->setContextMenuPolicy(Qt::CustomContextMenu); - message->setContextMenuPolicy(Qt::CustomContextMenu); - date->setContextMenuPolicy(Qt::CustomContextMenu); - connect(author, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); - connect(message, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); - connect(date, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); + addMessage(msgAuthor, message); } void GroupChatForm::onUserListChanged() diff --git a/widget/form/groupchatform.h b/widget/form/groupchatform.h index 519eafb30..63546751e 100644 --- a/widget/form/groupchatform.h +++ b/widget/form/groupchatform.h @@ -30,9 +30,6 @@ #include "widget/tool/chattextedit.h" #include "ui_mainwindow.h" -// Spacing in px inserted when the author of the last message changes -#define AUTHOR_CHANGE_SPACING 5 - class Group; class GroupChatForm : public GenericChatForm @@ -42,8 +39,6 @@ public: GroupChatForm(Group* chatGroup); ~GroupChatForm(); void addGroupMessage(QString message, int peerId); - void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); - void addMessage(QLabel* author, QLabel* message, QLabel* date); void onUserListChanged(); private slots: diff --git a/widget/widget.cpp b/widget/widget.cpp index 81cd893bf..d08ea0fe1 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -509,7 +509,7 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message) if (!f) return; - f->chatForm->addFriendMessage(message); + f->chatForm->addMessage(f->getName(), message); if (activeChatroomWidget != nullptr) { From 502229a6f250e3dfa01d5187c09c0958cf755ec0 Mon Sep 17 00:00:00 2001 From: apprb Date: Fri, 5 Sep 2014 22:29:14 +0700 Subject: [PATCH 11/11] cleanup --- widget/form/chatform.cpp | 10 ---------- widget/form/chatform.h | 12 ------------ widget/form/genericchatform.cpp | 19 ++++++++++++++++--- widget/form/genericchatform.h | 5 ++++- widget/form/groupchatform.cpp | 21 +++++---------------- widget/form/groupchatform.h | 11 +---------- 6 files changed, 26 insertions(+), 52 deletions(-) diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 82d919b09..141451c4c 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -16,19 +16,11 @@ #include "chatform.h" #include "friend.h" -#include "smileypack.h" #include "widget/friendwidget.h" #include "widget/widget.h" #include "widget/filetransfertwidget.h" -#include "widget/emoticonswidget.h" -#include "style.h" -#include -#include #include #include -#include -#include -#include #include ChatForm::ChatForm(Friend* chatFriend) @@ -50,8 +42,6 @@ ChatForm::ChatForm(Friend* chatFriend) 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(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle())); } diff --git a/widget/form/chatform.h b/widget/form/chatform.h index 9b803ae35..6a7a9362d 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -17,19 +17,7 @@ #ifndef CHATFORM_H #define CHATFORM_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "genericchatform.h" -#include "widget/tool/chattextedit.h" -#include "ui_mainwindow.h" #include "core.h" #include "widget/netcamview.h" diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index b26bedc03..d7727adf7 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -147,6 +147,8 @@ GenericChatForm::GenericChatForm(QObject *parent) : emoteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); connect(emoteButton, SIGNAL(clicked()), this, SLOT(onEmoteButtonClicked())); + connect(chatArea, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); + connect(chatArea->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged())); } void GenericChatForm::setName(const QString &newName) @@ -214,7 +216,7 @@ void GenericChatForm::onSaveLogClicked() void GenericChatForm::addMessage(QString author, QString message, QString date) { QLabel *authorLabel = new QLabel(author); - QLabel *messageLabel = new QLabel(message); + QLabel *messageLabel = new QLabel(); QLabel *dateLabel = new QLabel(date); QScrollBar* scroll = chatArea->verticalScrollBar(); @@ -253,9 +255,9 @@ void GenericChatForm::addMessage(QString author, QString message, QString date) for (QString& s : messageLines) { if (QRegExp("^[ ]*>.*").exactMatch(s)) - finalMessage += fontTemplate.arg(greentext.name(), s.replace(" ", " ")); + finalMessage += fontTemplate.arg(greentext.name(), toHtmlChars(s)); else - finalMessage += s.replace(" ", " "); + finalMessage += toHtmlChars(s); finalMessage += "
"; } messageLabel->setText(finalMessage.left(finalMessage.length()-4)); @@ -308,3 +310,14 @@ void GenericChatForm::onEmoteInsertRequested(QString str) msgEdit->setFocus(); // refocus so that we can continue typing } + +QString GenericChatForm::toHtmlChars(const QString &str) +{ + static QList> replaceList = {{"&","&"}, {" "," "}, {">",">"}, {"<","<"}}; + QString res = str; + + for (auto &it : replaceList) + res = res.replace(it.first,it.second); + + return res; +} diff --git a/widget/form/genericchatform.h b/widget/form/genericchatform.h index f25ccdc1e..59216f755 100644 --- a/widget/form/genericchatform.h +++ b/widget/form/genericchatform.h @@ -46,7 +46,7 @@ public: virtual void setName(const QString &newName); virtual void show(Ui::MainWindow &ui); - virtual void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); + void addMessage(QString author, QString message, QString date=QTime::currentTime().toString("hh:mm")); signals: void sendMessage(int, QString); @@ -72,6 +72,9 @@ protected: QString previousName; int curRow; bool lockSliderToBottom; + +private: + QString toHtmlChars(const QString &str); }; #endif // GENERICCHATFORM_H diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index 0d743feea..e444e0ac3 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -18,20 +18,11 @@ #include "group.h" #include "widget/groupwidget.h" #include "widget/widget.h" -#include "friend.h" -#include "friendlist.h" -#include "style.h" -#include -#include -#include -#include -#include -#include GroupChatForm::GroupChatForm(Group* chatGroup) : group(chatGroup) { - nusers = new QLabel(); + nusersLabel = new QLabel(); namesList = new QLabel(); fileButton->setEnabled(false); @@ -44,8 +35,8 @@ GroupChatForm::GroupChatForm(Group* chatGroup) small.setPixelSize(10); nameLabel->setText(group->widget->name.text()); - nusers->setFont(small); - nusers->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); + nusersLabel->setFont(small); + nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); avatarLabel->setPixmap(QPixmap(":/img/group_dark.png")); QString names; @@ -60,7 +51,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup) mainChatLayout->setColumnStretch(1,1); mainChatLayout->setHorizontalSpacing(10); - headTextLayout->addWidget(nusers); + headTextLayout->addWidget(nusersLabel); headTextLayout->addWidget(namesList); headTextLayout->setMargin(0); headTextLayout->setSpacing(0); @@ -68,8 +59,6 @@ GroupChatForm::GroupChatForm(Group* chatGroup) connect(sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered())); connect(msgEdit, SIGNAL(enterPressed()), this, SLOT(onSendTriggered())); - connect(chatArea->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged())); - connect(chatArea, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint))); } GroupChatForm::~GroupChatForm() @@ -99,7 +88,7 @@ void GroupChatForm::addGroupMessage(QString message, int peerId) void GroupChatForm::onUserListChanged() { - nusers->setText(tr("%1 users in chat").arg(group->nPeers)); + nusersLabel->setText(tr("%1 users in chat").arg(group->nPeers)); QString names; for (QString& s : group->peers) names.append(s+", "); diff --git a/widget/form/groupchatform.h b/widget/form/groupchatform.h index 63546751e..9b4766180 100644 --- a/widget/form/groupchatform.h +++ b/widget/form/groupchatform.h @@ -17,15 +17,6 @@ #ifndef GROUPCHATFORM_H #define GROUPCHATFORM_H -#include -#include -#include -#include -#include -#include -#include -#include - #include "genericchatform.h" #include "widget/tool/chattextedit.h" #include "ui_mainwindow.h" @@ -46,7 +37,7 @@ private slots: private: Group* group; - QLabel *nusers, *namesList; + QLabel *nusersLabel, *namesList; }; #endif // GROUPCHATFORM_H