1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(filetransferwidget): Added ability to check activity

This commit is contained in:
Diadlo 2016-07-30 16:14:18 +03:00
parent a556762c54
commit 233cc412ac
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 11 additions and 0 deletions

View File

@ -47,6 +47,7 @@ FileTransferWidget::FileTransferWidget(QWidget *parent, ToxFile file)
, lastTick(QTime::currentTime())
, backgroundColor(Style::getColor(Style::LightGrey))
, buttonColor(Style::getColor(Style::Yellow))
, active(true)
{
ui->setupUi(this);
@ -132,6 +133,11 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path)
qWarning() << "Cannot write to " << filepath;
}
bool FileTransferWidget::isActive() const
{
return active;
}
void FileTransferWidget::acceptTransfer(const QString &filepath)
{
if (filepath.isEmpty())
@ -292,6 +298,7 @@ void FileTransferWidget::onFileTransferCancelled(ToxFile file)
return;
fileInfo = file;
active = false;
setBackgroundColor(Style::getColor(Style::Red), true);
@ -347,6 +354,7 @@ void FileTransferWidget::onFileTransferFinished(ToxFile file)
return;
fileInfo = file;
active = false;
setBackgroundColor(Style::getColor(Style::Green), true);

View File

@ -42,6 +42,7 @@ public:
explicit FileTransferWidget(QWidget *parent, ToxFile file);
virtual ~FileTransferWidget();
void autoAcceptTransfer(const QString& path);
bool isActive() const;
protected slots:
void onFileTransferInfo(ToxFile file);
@ -88,6 +89,8 @@ private:
static const uint8_t TRANSFER_ROLLING_AVG_COUNT = 4;
uint8_t meanIndex = 0;
qreal meanData[TRANSFER_ROLLING_AVG_COUNT] = {0.0};
bool active;
};
#endif // FILETRANSFERWIDGET_H