mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
cleanup
This commit is contained in:
parent
92b2848916
commit
db4c84a222
4
qtox.pro
4
qtox.pro
@ -57,7 +57,7 @@ win32 {
|
||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lvpx -lopenal -lopencv_core -lopencv_highgui
|
||||
}
|
||||
|
||||
contains(JENKINS, YES) {
|
||||
contains(JENKINS, YES) {
|
||||
LIBS = ./libs/lib/libtoxav.a ./libs/lib/libvpx.a ./libs/lib/libopus.a ./libs/lib/libtoxcore.a ./libs/lib/libsodium.a -lopencv_core -lopencv_highgui -lopenal
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,6 @@ HEADERS += widget/form/addfriendform.h \
|
||||
widget/form/filesform.h \
|
||||
widget/tool/chattextedit.h \
|
||||
widget/tool/friendrequestdialog.h \
|
||||
widget/filetransfertwidget.h \
|
||||
widget/friendwidget.h \
|
||||
widget/groupwidget.h \
|
||||
widget/widget.h \
|
||||
@ -115,7 +114,6 @@ SOURCES += \
|
||||
widget/form/filesform.cpp \
|
||||
widget/tool/chattextedit.cpp \
|
||||
widget/tool/friendrequestdialog.cpp \
|
||||
widget/filetransfertwidget.cpp \
|
||||
widget/friendwidget.cpp \
|
||||
widget/groupwidget.cpp \
|
||||
widget/widget.cpp \
|
||||
|
@ -1,387 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
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 "filetransfertwidget.h"
|
||||
#include "widget.h"
|
||||
#include "core.h"
|
||||
#include "math.h"
|
||||
#include "style.h"
|
||||
#include <QFileDialog>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QMessageBox>
|
||||
#include <QBuffer>
|
||||
|
||||
uint FileTransfertWidget::Idconter = 0;
|
||||
|
||||
FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||
: lastUpdate{QDateTime::currentDateTime()}, lastBytesSent{0},
|
||||
fileNum{File.fileNum}, friendId{File.friendId}, direction{File.direction}
|
||||
{
|
||||
id = Idconter++;
|
||||
pic=new QLabel(), filename=new QLabel(), size=new QLabel(), speed=new QLabel(), eta=new QLabel();
|
||||
topright = new QPushButton(), bottomright = new QPushButton();
|
||||
progress = new QProgressBar();
|
||||
mainLayout = new QHBoxLayout(), textLayout = new QHBoxLayout();
|
||||
infoLayout = new QVBoxLayout(), buttonLayout = new QVBoxLayout();
|
||||
buttonWidget = new QWidget();
|
||||
QFont prettysmall;
|
||||
prettysmall.setPixelSize(10);
|
||||
this->setObjectName("default");
|
||||
this->setStyleSheet(Style::get(":/ui/fileTransferWidget/fileTransferWidget.css"));
|
||||
QPalette greybg;
|
||||
greybg.setColor(QPalette::Window, QColor(209,209,209));
|
||||
greybg.setColor(QPalette::Base, QColor(150,150,150));
|
||||
setPalette(greybg);
|
||||
setAutoFillBackground(true);
|
||||
|
||||
setMinimumSize(250,58);
|
||||
setMaximumHeight(58);
|
||||
setLayout(mainLayout);
|
||||
mainLayout->setMargin(0);
|
||||
|
||||
pic->setMaximumHeight(40);
|
||||
pic->setContentsMargins(5,0,0,0);
|
||||
filename->setText(File.fileName);
|
||||
filename->setFont(prettysmall);
|
||||
size->setText(getHumanReadableSize(File.filesize));
|
||||
size->setFont(prettysmall);
|
||||
speed->setText("0B/s");
|
||||
speed->setFont(prettysmall);
|
||||
eta->setText("00:00");
|
||||
eta->setFont(prettysmall);
|
||||
progress->setValue(0);
|
||||
progress->setMinimumHeight(11);
|
||||
progress->setFont(prettysmall);
|
||||
progress->setTextVisible(false);
|
||||
QPalette whitebg;
|
||||
whitebg.setColor(QPalette::Window, QColor(255,255,255));
|
||||
buttonWidget->setPalette(whitebg);
|
||||
buttonWidget->setAutoFillBackground(true);
|
||||
buttonWidget->setLayout(buttonLayout);
|
||||
|
||||
stopFileButtonStylesheet = Style::get(":/ui/stopFileButton/style.css");
|
||||
pauseFileButtonStylesheet = Style::get(":/ui/pauseFileButton/style.css");
|
||||
acceptFileButtonStylesheet = Style::get(":/ui/acceptFileButton/style.css");
|
||||
|
||||
topright->setStyleSheet(stopFileButtonStylesheet);
|
||||
if (File.direction == ToxFile::SENDING)
|
||||
{
|
||||
bottomright->setStyleSheet(pauseFileButtonStylesheet);
|
||||
connect(topright, SIGNAL(clicked()), this, SLOT(cancelTransfer()));
|
||||
connect(bottomright, SIGNAL(clicked()), this, SLOT(pauseResumeSend()));
|
||||
|
||||
QPixmap preview;
|
||||
File.file->seek(0);
|
||||
if (preview.loadFromData(File.file->readAll()))
|
||||
{
|
||||
preview = preview.scaledToHeight(40);
|
||||
pic->setPixmap(preview);
|
||||
}
|
||||
File.file->seek(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bottomright->setStyleSheet(acceptFileButtonStylesheet);
|
||||
connect(topright, SIGNAL(clicked()), this, SLOT(rejectRecvRequest()));
|
||||
connect(bottomright, SIGNAL(clicked()), this, SLOT(acceptRecvRequest()));
|
||||
}
|
||||
|
||||
QPalette toxgreen;
|
||||
toxgreen.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green
|
||||
topright->setIconSize(QSize(10,10));
|
||||
topright->setMinimumSize(25,28);
|
||||
topright->setFlat(true);
|
||||
topright->setAutoFillBackground(true);
|
||||
topright->setPalette(toxgreen);
|
||||
bottomright->setIconSize(QSize(10,10));
|
||||
bottomright->setMinimumSize(25,28);
|
||||
bottomright->setFlat(true);
|
||||
bottomright->setAutoFillBackground(true);
|
||||
bottomright->setPalette(toxgreen);
|
||||
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addWidget(pic);
|
||||
mainLayout->addLayout(infoLayout,3);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addWidget(buttonWidget);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(0);
|
||||
|
||||
infoLayout->addWidget(filename);
|
||||
infoLayout->addLayout(textLayout);
|
||||
infoLayout->addWidget(progress);
|
||||
infoLayout->setMargin(4);
|
||||
infoLayout->setSpacing(4);
|
||||
|
||||
textLayout->addWidget(size);
|
||||
textLayout->addStretch(0);
|
||||
textLayout->addWidget(speed);
|
||||
textLayout->addStretch(0);
|
||||
textLayout->addWidget(eta);
|
||||
textLayout->setMargin(2);
|
||||
textLayout->setSpacing(5);
|
||||
|
||||
buttonLayout->addWidget(topright);
|
||||
buttonLayout->addSpacing(2);
|
||||
buttonLayout->addWidget(bottomright);
|
||||
buttonLayout->setContentsMargins(2,0,0,0);
|
||||
buttonLayout->setSpacing(0);
|
||||
}
|
||||
|
||||
QString FileTransfertWidget::getHumanReadableSize(unsigned long long size)
|
||||
{
|
||||
static const char* suffix[] = {"B","kiB","MiB","GiB","TiB"};
|
||||
int exp = 0;
|
||||
if (size)
|
||||
exp = std::min( (int) (log(size) / log(1024)), (int) (sizeof(suffix) / sizeof(suffix[0]) - 1));
|
||||
return QString().setNum(size / pow(1024, exp),'f',2).append(suffix[exp]);
|
||||
}
|
||||
|
||||
void FileTransfertWidget::onFileTransferInfo(int FriendId, int FileNum, int64_t Filesize, int64_t BytesSent, ToxFile::FileDirection Direction)
|
||||
{
|
||||
if (FileNum != fileNum || FriendId != friendId || Direction != direction)
|
||||
return;
|
||||
QDateTime newtime = QDateTime::currentDateTime();
|
||||
int timediff = lastUpdate.secsTo(newtime);
|
||||
if (timediff <= 0)
|
||||
return;
|
||||
qint64 diff = BytesSent - lastBytesSent;
|
||||
if (diff < 0)
|
||||
{
|
||||
qWarning() << "FileTransfertWidget::onFileTransferInfo: Negative transfer speed !";
|
||||
diff = 0;
|
||||
}
|
||||
long rawspeed = diff / timediff;
|
||||
speed->setText(getHumanReadableSize(rawspeed)+"/s");
|
||||
size->setText(getHumanReadableSize(Filesize));
|
||||
if (!rawspeed)
|
||||
return;
|
||||
int etaSecs = (Filesize - BytesSent) / rawspeed;
|
||||
QTime etaTime(0,0);
|
||||
etaTime = etaTime.addSecs(etaSecs);
|
||||
eta->setText(etaTime.toString("mm:ss"));
|
||||
if (!Filesize)
|
||||
{
|
||||
progress->setValue(0);
|
||||
qDebug() << QString("FT: received %1 bytes of an empty file, stop sending sequential devices, zetok!").arg(BytesSent);
|
||||
}
|
||||
else
|
||||
{
|
||||
progress->setValue(BytesSent*100/Filesize);
|
||||
qDebug() << QString("FT: received %1/%2 bytes, progress is %3%").arg(BytesSent).arg(Filesize).arg(BytesSent*100/Filesize);
|
||||
}
|
||||
lastUpdate = newtime;
|
||||
lastBytesSent = BytesSent;
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::onFileTransferCancelled(int FriendId, int FileNum, ToxFile::FileDirection Direction)
|
||||
{
|
||||
if (FileNum != fileNum || FriendId != friendId || Direction != direction)
|
||||
return;
|
||||
buttonLayout->setContentsMargins(0,0,0,0);
|
||||
disconnect(topright);
|
||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
||||
progress->hide();
|
||||
speed->hide();
|
||||
eta->hide();
|
||||
topright->hide();
|
||||
bottomright->hide();
|
||||
QPalette whiteText;
|
||||
whiteText.setColor(QPalette::WindowText, Qt::white);
|
||||
filename->setPalette(whiteText);
|
||||
size->setPalette(whiteText);
|
||||
this->setObjectName("error");
|
||||
this->style()->polish(this);
|
||||
|
||||
//Toggle window visibility to fix draw order bug
|
||||
this->hide();
|
||||
this->show();
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
||||
{
|
||||
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
||||
return;
|
||||
topright->disconnect();
|
||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
||||
progress->hide();
|
||||
speed->hide();
|
||||
eta->hide();
|
||||
topright->hide();
|
||||
bottomright->hide();
|
||||
buttonLayout->setContentsMargins(0,0,0,0);
|
||||
QPalette whiteText;
|
||||
whiteText.setColor(QPalette::WindowText, Qt::white);
|
||||
filename->setPalette(whiteText);
|
||||
size->setPalette(whiteText);
|
||||
this->setObjectName("success");
|
||||
this->style()->polish(this);
|
||||
|
||||
//Toggle window visibility to fix draw order bug
|
||||
this->hide();
|
||||
this->show();
|
||||
|
||||
if (File.direction == ToxFile::RECEIVING)
|
||||
{
|
||||
QPixmap preview;
|
||||
QFile previewFile(File.filePath);
|
||||
if (previewFile.open(QIODevice::ReadOnly) && previewFile.size() <= 1024*1024*25) // Don't preview big (>25MiB) images
|
||||
{
|
||||
if (preview.loadFromData(previewFile.readAll()))
|
||||
{
|
||||
preview = preview.scaledToHeight(40);
|
||||
pic->setPixmap(preview);
|
||||
}
|
||||
previewFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::cancelTransfer()
|
||||
{
|
||||
Widget::getInstance()->getCore()->cancelFileSend(friendId, fileNum);
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::rejectRecvRequest()
|
||||
{
|
||||
Widget::getInstance()->getCore()->rejectFileRecvRequest(friendId, fileNum);
|
||||
onFileTransferCancelled(friendId, fileNum, direction);
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
// for whatever the fuck reason, QFileInfo::isWritable() always fails for files that don't exist
|
||||
// which makes it useless for our case
|
||||
// since QDir doesn't have an isWritable(), the only option I can think of is to make/delete the file
|
||||
// surely this is a common problem that has a qt-implemented solution?
|
||||
bool isWritable(QString& path)
|
||||
{
|
||||
QFile file(path);
|
||||
bool exists = file.exists();
|
||||
bool out = file.open(QIODevice::WriteOnly);
|
||||
file.close();
|
||||
if (!exists)
|
||||
file.remove();
|
||||
return out;
|
||||
}
|
||||
|
||||
void FileTransfertWidget::acceptRecvRequest()
|
||||
{
|
||||
QString path;
|
||||
while (true)
|
||||
{
|
||||
path = QFileDialog::getSaveFileName(this, tr("Save a file","Title of the file saving dialog"), QDir::current().filePath(filename->text()));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
else
|
||||
{
|
||||
//bool savable = QFileInfo(path).isWritable();
|
||||
//qDebug() << path << " is writable: " << savable;
|
||||
//qDebug() << "/home/bill/bliss.pdf writable: " << QFileInfo("/home/bill/bliss.pdf").isWritable();
|
||||
if (isWritable(path))
|
||||
break;
|
||||
else
|
||||
QMessageBox::warning(this, tr("Location not writable","Title of permissions popup"), tr("You do not have permission to write that location. Choose another, or cancel the save dialog.", "text of permissions popup"));
|
||||
}
|
||||
}
|
||||
|
||||
savePath = path;
|
||||
|
||||
bottomright->setStyleSheet(pauseFileButtonStylesheet);
|
||||
bottomright->disconnect();
|
||||
connect(bottomright, SIGNAL(clicked()), this, SLOT(pauseResumeRecv()));
|
||||
Widget::getInstance()->getCore()->acceptFileRecvRequest(friendId, fileNum, path);
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::pauseResumeRecv()
|
||||
{
|
||||
Widget::getInstance()->getCore()->pauseResumeFileRecv(friendId, fileNum);
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::pauseResumeSend()
|
||||
{
|
||||
Widget::getInstance()->getCore()->pauseResumeFileSend(friendId, fileNum);
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
||||
QString FileTransfertWidget::getHtmlImage()
|
||||
{
|
||||
qDebug() << "QString FileTransfertWidget::getHtmlImage()";
|
||||
auto QImage2base64 = [](const QImage &img)
|
||||
{
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
img.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
return ba.toBase64();
|
||||
};
|
||||
|
||||
auto renderButton = [](QPushButton *pb)
|
||||
{
|
||||
QImage bitmap(pb->size(), QImage::Format_ARGB32);
|
||||
bitmap.fill(Qt::transparent);
|
||||
QPainter painter(&bitmap);
|
||||
|
||||
pb->render(&painter, QPoint(), QRegion(), QWidget::DrawChildren);
|
||||
return bitmap;
|
||||
};
|
||||
|
||||
// QImage rightUp = renderButton(topright);
|
||||
// QImage rightDown = renderButton(bottomright);
|
||||
QImage rightUp(":ui/stopFileButton/default.png");
|
||||
QImage rightDown(":ui/acceptFileButton/default.png");
|
||||
|
||||
QString res;
|
||||
QString widgetId = QString::number(getId());
|
||||
QString strUp = "<img src=\"data:ftrans." + widgetId + ".top/png;base64," + QImage2base64(rightUp) + "\">";
|
||||
QString strDown = "<img src=\"data:ftrans." + widgetId + ".bottom/png;base64," + QImage2base64(rightDown) + "\">";
|
||||
|
||||
res = "<table widht=100% cellspacing=\"2\">\n";
|
||||
res += "<tr>\n<td width=100%>\n";
|
||||
res += "<div class=quote></div>\n";
|
||||
res += "</td>\n<td>\n";
|
||||
if (topright->isVisible() && bottomright->isVisible())
|
||||
res += "<table cellspacing=\"0\"><tr valign=top><td>" + strUp + "</td></tr><tr valign=bottom><td>" + strDown + "</td></tr></table>\n";
|
||||
res += "</td>\n</tr>\n";
|
||||
res += "</table>\n";
|
||||
return res;
|
||||
}
|
||||
|
||||
void FileTransfertWidget::pressFromHtml(QString code)
|
||||
{
|
||||
if (code == "top")
|
||||
topright->clicked();
|
||||
else if (code == "bottom")
|
||||
bottomright->clicked();
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
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 FILETRANSFERTWIDGET_H
|
||||
#define FILETRANSFERTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QProgressBar>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "core.h"
|
||||
|
||||
struct ToxFile;
|
||||
|
||||
class FileTransfertWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileTransfertWidget(ToxFile File);
|
||||
QString getHtmlImage();
|
||||
uint getId(){return id;}
|
||||
|
||||
public slots:
|
||||
void onFileTransferInfo(int FriendId, int FileNum, int64_t Filesize, int64_t BytesSent, ToxFile::FileDirection Direction);
|
||||
void onFileTransferCancelled(int FriendId, int FileNum, ToxFile::FileDirection Direction);
|
||||
void onFileTransferFinished(ToxFile File);
|
||||
|
||||
void pressFromHtml(QString);
|
||||
|
||||
signals:
|
||||
void stateUpdated();
|
||||
|
||||
private slots:
|
||||
void cancelTransfer();
|
||||
void rejectRecvRequest();
|
||||
void acceptRecvRequest();
|
||||
void pauseResumeRecv();
|
||||
void pauseResumeSend();
|
||||
|
||||
private:
|
||||
QString getHumanReadableSize(unsigned long long size);
|
||||
|
||||
private:
|
||||
static uint Idconter;
|
||||
uint id;
|
||||
|
||||
|
||||
QLabel *pic, *filename, *size, *speed, *eta;
|
||||
QPushButton *topright, *bottomright;
|
||||
QProgressBar *progress;
|
||||
QHBoxLayout *mainLayout, *textLayout;
|
||||
QVBoxLayout *infoLayout, *buttonLayout;
|
||||
QWidget* buttonWidget;
|
||||
QDateTime lastUpdate;
|
||||
long long lastBytesSent;
|
||||
int fileNum;
|
||||
int friendId;
|
||||
QString savePath;
|
||||
ToxFile::FileDirection direction;
|
||||
QString stopFileButtonStylesheet, pauseFileButtonStylesheet, acceptFileButtonStylesheet;
|
||||
void paintEvent(QPaintEvent *);
|
||||
};
|
||||
|
||||
#endif // FILETRANSFERTWIDGET_H
|
@ -17,8 +17,8 @@
|
||||
#include "chatform.h"
|
||||
#include "friend.h"
|
||||
#include "widget/friendwidget.h"
|
||||
#include "filetransferinstance.h"
|
||||
#include "widget/widget.h"
|
||||
#include "widget/filetransfertwidget.h"
|
||||
#include <QScrollBar>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@ -44,6 +44,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
||||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||
connect(newChatForm, SIGNAL(onFileTranfertInterract(QString,QString)), this, SLOT(onFileTansBtnClicked(QString,QString)));
|
||||
connect(newChatForm->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
|
||||
}
|
||||
|
||||
ChatForm::~ChatForm()
|
||||
|
@ -31,7 +31,7 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||
lockSliderToBottom = true;
|
||||
curRow = 0;
|
||||
|
||||
mainWidget = new QWidget(); headWidget = new QWidget(); chatAreaWidget = new QWidget();
|
||||
mainWidget = new QWidget(); headWidget = new QWidget();
|
||||
|
||||
nameLabel = new QLabel();
|
||||
avatarLabel = new QLabel();
|
||||
@ -39,7 +39,6 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||
headTextLayout = new QVBoxLayout();
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout();
|
||||
mainChatLayout = new QGridLayout();
|
||||
|
||||
newChatForm = new ChatAreaWidget();
|
||||
newChatForm->document()->setDefaultStyleSheet(Style::get(":ui/chatArea/innerStyle.css"));
|
||||
@ -56,23 +55,10 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||
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"));
|
||||
@ -116,7 +102,6 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||
micButton->setStyleSheet(micButtonStylesheet);
|
||||
|
||||
mainWidget->setLayout(mainLayout);
|
||||
mainLayout->addWidget(chatArea);
|
||||
mainLayout->addWidget(newChatForm);
|
||||
mainLayout->addLayout(mainFootLayout);
|
||||
mainLayout->setMargin(0);
|
||||
@ -144,8 +129,6 @@ GenericChatForm::GenericChatForm(QObject *parent) :
|
||||
headTextLayout->addStretch();
|
||||
headTextLayout->addWidget(nameLabel);
|
||||
|
||||
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);
|
||||
|
@ -65,10 +65,8 @@ protected slots:
|
||||
|
||||
protected:
|
||||
QLabel *nameLabel, *avatarLabel;
|
||||
QWidget *mainWidget, *headWidget, *chatAreaWidget;
|
||||
QScrollArea *chatArea;
|
||||
QWidget *mainWidget, *headWidget;
|
||||
QPushButton *fileButton, *emoteButton, *callButton, *videoButton, *volButton, *micButton;
|
||||
QGridLayout *mainChatLayout;
|
||||
QVBoxLayout *headTextLayout;
|
||||
ChatTextEdit *msgEdit;
|
||||
QPushButton *sendButton;
|
||||
|
@ -48,9 +48,6 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||
|
||||
msgEdit->setObjectName("group");
|
||||
|
||||
mainChatLayout->setColumnStretch(1,1);
|
||||
mainChatLayout->setHorizontalSpacing(10);
|
||||
|
||||
headTextLayout->addWidget(nusersLabel);
|
||||
headTextLayout->addWidget(namesList);
|
||||
headTextLayout->setMargin(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user