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:
parent
a556762c54
commit
233cc412ac
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user