mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix bug in new file transfer widget
This commit is contained in:
parent
9c7998d38b
commit
b5eddef8a9
|
@ -10,6 +10,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#success {
|
#success {
|
||||||
border-radius: 6px;
|
|
||||||
background-color: rgb(107,194,96);
|
background-color: rgb(107,194,96);
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QProgressBar {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid black;
|
||||||
|
height: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background-color: black;
|
||||||
|
width: 2px;
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||||
: lastUpdate{QDateTime::currentDateTime()}, lastBytesSent{0},
|
: lastUpdate{QDateTime::currentDateTime()}, lastBytesSent{0},
|
||||||
fileNum{File.fileNum}, friendId{File.friendId}, direction{File.direction}
|
fileNum{File.fileNum}, friendId{File.friendId}, direction{File.direction}
|
||||||
{
|
{
|
||||||
background = new QFrame;
|
|
||||||
pic=new QLabel(), filename=new QLabel(), size=new QLabel(), speed=new QLabel(), eta=new QLabel();
|
pic=new QLabel(), filename=new QLabel(), size=new QLabel(), speed=new QLabel(), eta=new QLabel();
|
||||||
topright = new QPushButton(), bottomright = new QPushButton();
|
topright = new QPushButton(), bottomright = new QPushButton();
|
||||||
progress = new QProgressBar();
|
progress = new QProgressBar();
|
||||||
|
@ -48,6 +47,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||||
progress->setValue(0);
|
progress->setValue(0);
|
||||||
progress->setMinimumHeight(11);
|
progress->setMinimumHeight(11);
|
||||||
progress->setFont(prettysmall);
|
progress->setFont(prettysmall);
|
||||||
|
progress->setTextVisible(false);
|
||||||
QPalette whitebg;
|
QPalette whitebg;
|
||||||
whitebg.setColor(QPalette::Window, QColor(255,255,255));
|
whitebg.setColor(QPalette::Window, QColor(255,255,255));
|
||||||
buttonWidget->setPalette(whitebg);
|
buttonWidget->setPalette(whitebg);
|
||||||
|
@ -118,9 +118,11 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||||
infoLayout->setSpacing(4);
|
infoLayout->setSpacing(4);
|
||||||
|
|
||||||
textLayout->addWidget(size);
|
textLayout->addWidget(size);
|
||||||
|
textLayout->addStretch(.5);
|
||||||
textLayout->addWidget(speed);
|
textLayout->addWidget(speed);
|
||||||
|
textLayout->addStretch(.5);
|
||||||
textLayout->addWidget(eta);
|
textLayout->addWidget(eta);
|
||||||
textLayout->setMargin(0);
|
textLayout->setMargin(2);
|
||||||
textLayout->setSpacing(5);
|
textLayout->setSpacing(5);
|
||||||
|
|
||||||
buttonLayout->addWidget(topright);
|
buttonLayout->addWidget(topright);
|
||||||
|
@ -185,13 +187,16 @@ void FileTransfertWidget::onFileTransferCancelled(int FriendId, int FileNum, Tox
|
||||||
size->setPalette(whiteText);
|
size->setPalette(whiteText);
|
||||||
this->setObjectName("error");
|
this->setObjectName("error");
|
||||||
this->style()->polish(this);
|
this->style()->polish(this);
|
||||||
|
|
||||||
|
//Toggle window visibility to fix draw order bug
|
||||||
|
this->hide();
|
||||||
|
this->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
||||||
{
|
{
|
||||||
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
||||||
return;
|
return;
|
||||||
buttonLayout->setContentsMargins(0,0,0,0);
|
|
||||||
topright->disconnect();
|
topright->disconnect();
|
||||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
||||||
progress->hide();
|
progress->hide();
|
||||||
|
@ -199,6 +204,7 @@ void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
||||||
eta->hide();
|
eta->hide();
|
||||||
topright->hide();
|
topright->hide();
|
||||||
bottomright->hide();
|
bottomright->hide();
|
||||||
|
buttonLayout->setContentsMargins(0,0,0,0);
|
||||||
QPalette whiteText;
|
QPalette whiteText;
|
||||||
whiteText.setColor(QPalette::WindowText, Qt::white);
|
whiteText.setColor(QPalette::WindowText, Qt::white);
|
||||||
filename->setPalette(whiteText);
|
filename->setPalette(whiteText);
|
||||||
|
@ -206,6 +212,10 @@ void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
||||||
this->setObjectName("success");
|
this->setObjectName("success");
|
||||||
this->style()->polish(this);
|
this->style()->polish(this);
|
||||||
|
|
||||||
|
//Toggle window visibility to fix draw order bug
|
||||||
|
this->hide();
|
||||||
|
this->show();
|
||||||
|
|
||||||
if (File.direction == ToxFile::RECEIVING)
|
if (File.direction == ToxFile::RECEIVING)
|
||||||
{
|
{
|
||||||
QFile saveFile(savePath);
|
QFile saveFile(savePath);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user