2014-07-07 00:19:45 +08:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2014-06-26 06:30:24 +08:00
|
|
|
#ifndef FILETRANSFERTWIDGET_H
|
|
|
|
#define FILETRANSFERTWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
#include "core.h"
|
|
|
|
|
2014-07-01 04:52:03 +08:00
|
|
|
struct ToxFile;
|
2014-06-26 06:30:24 +08:00
|
|
|
|
|
|
|
class FileTransfertWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2014-07-05 07:59:11 +08:00
|
|
|
|
2014-06-26 06:30:24 +08:00
|
|
|
public:
|
2014-06-27 01:45:47 +08:00
|
|
|
FileTransfertWidget(ToxFile File);
|
2014-09-06 03:27:26 +08:00
|
|
|
QString getHtmlImage();
|
|
|
|
uint getId(){return id;}
|
2014-06-26 06:30:24 +08:00
|
|
|
|
|
|
|
public slots:
|
2014-07-13 00:40:01 +08:00
|
|
|
void onFileTransferInfo(int FriendId, int FileNum, int64_t Filesize, int64_t BytesSent, ToxFile::FileDirection Direction);
|
2014-06-27 01:45:47 +08:00
|
|
|
void onFileTransferCancelled(int FriendId, int FileNum, ToxFile::FileDirection Direction);
|
|
|
|
void onFileTransferFinished(ToxFile File);
|
2014-06-26 06:30:24 +08:00
|
|
|
|
2014-09-06 03:27:26 +08:00
|
|
|
void pressFromHtml(QString);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void stateUpdated();
|
|
|
|
|
2014-06-26 07:48:20 +08:00
|
|
|
private slots:
|
|
|
|
void cancelTransfer();
|
2014-06-27 01:45:47 +08:00
|
|
|
void rejectRecvRequest();
|
|
|
|
void acceptRecvRequest();
|
|
|
|
void pauseResumeRecv();
|
|
|
|
void pauseResumeSend();
|
2014-06-26 07:48:20 +08:00
|
|
|
|
2014-06-26 06:30:24 +08:00
|
|
|
private:
|
2014-08-31 18:49:41 +08:00
|
|
|
QString getHumanReadableSize(unsigned long long size);
|
2014-06-26 06:30:24 +08:00
|
|
|
|
|
|
|
private:
|
2014-09-06 03:27:26 +08:00
|
|
|
static uint Idconter;
|
|
|
|
uint id;
|
|
|
|
|
|
|
|
|
2014-06-26 06:30:24 +08:00
|
|
|
QLabel *pic, *filename, *size, *speed, *eta;
|
|
|
|
QPushButton *topright, *bottomright;
|
|
|
|
QProgressBar *progress;
|
|
|
|
QHBoxLayout *mainLayout, *textLayout;
|
|
|
|
QVBoxLayout *infoLayout, *buttonLayout;
|
2014-06-28 21:52:17 +08:00
|
|
|
QWidget* buttonWidget;
|
2014-06-26 06:30:24 +08:00
|
|
|
QDateTime lastUpdate;
|
|
|
|
long long lastBytesSent;
|
2014-06-27 01:45:47 +08:00
|
|
|
int fileNum;
|
|
|
|
int friendId;
|
|
|
|
QString savePath;
|
|
|
|
ToxFile::FileDirection direction;
|
2014-06-28 21:52:17 +08:00
|
|
|
QString stopFileButtonStylesheet, pauseFileButtonStylesheet, acceptFileButtonStylesheet;
|
2014-07-05 07:59:11 +08:00
|
|
|
void paintEvent(QPaintEvent *);
|
2014-06-26 06:30:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FILETRANSFERTWIDGET_H
|