Regroup Upload Items by file in TransfersDialog.

This commit is contained in:
Phenom 2017-09-06 19:57:33 +02:00
parent f9102e5964
commit 3b4e84c6d4
6 changed files with 382 additions and 333 deletions

View file

@ -229,6 +229,8 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, temp); painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, temp);
break; break;
case COLUMN_LASTDL: case COLUMN_LASTDL:
if (index.data().value<QString>().isEmpty())
break;
qi64Value = index.data().value<qint64>(); qi64Value = index.data().value<qint64>();
if (qi64Value < std::numeric_limits<qint64>::max()){ if (qi64Value < std::numeric_limits<qint64>::max()){
QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value); QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value);

File diff suppressed because it is too large Load diff

View file

@ -95,7 +95,7 @@ private slots:
/** removes finished Downloads**/ /** removes finished Downloads**/
void clearcompleted(); void clearcompleted();
void copyLink(); void dlCopyLink();
void pasteLink(); void pasteLink();
void renameFile(); void renameFile();
void setDestinationDirectory(); void setDestinationDirectory();
@ -109,9 +109,9 @@ private slots:
void pauseFileTransfer(); void pauseFileTransfer();
void resumeFileTransfer(); void resumeFileTransfer();
void openFolderTransfer(); void dlOpenFolder();
void openTransfer(); void dlOpenFile();
void previewTransfer(); void dlPreviewFile();
void ulOpenFolder(); void ulOpenFolder();
void ulCopyLink(); void ulCopyLink();
@ -235,7 +235,7 @@ private:
bool m_bProcessSettings; bool m_bProcessSettings;
void processSettings(bool bLoad); void processSettings(bool bLoad);
void getSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows); void getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
void getULSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows); void getULSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
bool controlTransferFile(uint32_t flags); bool controlTransferFile(uint32_t flags);
void changePriority(int priority); void changePriority(int priority);
@ -255,12 +255,11 @@ private:
Ui::TransfersDialog ui; Ui::TransfersDialog ui;
public slots: public slots:
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added // these four functions add entries to the transfers dialog, and return the row id of the entry modified/added
// int addDLItem(int row, const FileInfo &fileInfo);
int addItem(int row, const FileInfo &fileInfo); int addPeerToDLItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo); int addULItem(int row, const FileInfo &fileInfo);
int addPeerToULItem(QStandardItem *ulItem, const RsPeerId& peer_ID, const QString &coreID, qlonglong completed, double ulspeed, const FileProgressInfo& peerInfo);
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
void showFileDetails() ; void showFileDetails() ;

View file

@ -45,7 +45,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
QPixmap pixmap; QPixmap pixmap;
qlonglong fileSize; qlonglong fileSize;
double ulspeed, multi; double ulspeed, multi;
QString temp , status; QString temp;
qlonglong transferred; qlonglong transferred;
// prepare // prepare
@ -65,7 +65,12 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
} }
// draw the background color // draw the background color
if(index.column() != COLUMN_UPROGRESS) { bool bDrawBackground = true;
if(index.column() == COLUMN_UPROGRESS) {
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
bDrawBackground = (pinfo.type == FileProgressInfo::UNINIT);
}
if( bDrawBackground ) {
if(option.showDecorationSelected && (option.state & QStyle::State_Selected)) { if(option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) { if(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
cg = QPalette::Inactive; cg = QPalette::Inactive;
@ -78,6 +83,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
} }
} }
} }
switch(index.column()) { switch(index.column()) {
case COLUMN_USIZE: case COLUMN_USIZE:
fileSize = index.data().toLongLong(); fileSize = index.data().toLongLong();
@ -128,15 +134,17 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
} }
painter->drawText(option.rect, Qt::AlignRight, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case COLUMN_UPROGRESS: case COLUMN_UPROGRESS:
{ {
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ; FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
if (pinfo.type == FileProgressInfo::UNINIT)
break;
// create a xProgressBar // create a xProgressBar
painter->save() ; painter->save() ;
xProgressBar progressBar(pinfo,option.rect,painter,0);// the 3rd param is the color schema (0 is the default value) xProgressBar progressBar(pinfo,option.rect,painter,0);// the 3rd param is the color schema (0 is the default value)
QString ext = QFileInfo(QString::fromStdString(index.sibling(index.row(), COLUMN_UNAME).data().toString().toStdString())).suffix();; QString ext = QFileInfo(QString::fromStdString(index.sibling(index.row(), COLUMN_UNAME).data().toString().toStdString())).suffix();;
if (ext == "rsfc" || ext == "rsrl" || ext == "dist" || ext == "rsfb") if (ext == "rsfc" || ext == "rsrl" || ext == "dist" || ext == "rsfb")
progressBar.setColorSchema( 9); progressBar.setColorSchema( 9);
else else
@ -161,9 +169,6 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
} }
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString()); painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignLeft, index.data().toString());
break; break;
case COLUMN_USTATUS:
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignCenter, index.data().toString());
break;
default: default:
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
} }

View file

@ -30,11 +30,8 @@
#define COLUMN_UTRANSFERRED 2 #define COLUMN_UTRANSFERRED 2
#define COLUMN_ULSPEED 3 #define COLUMN_ULSPEED 3
#define COLUMN_UPROGRESS 4 #define COLUMN_UPROGRESS 4
#define COLUMN_USTATUS 5 #define COLUMN_UHASH 5
#define COLUMN_USERNAME 6 #define COLUMN_UCOUNT 6
#define COLUMN_UHASH 7
#define COLUMN_UUSERID 8
#define COLUMN_UCOUNT 9
#define MAX_CHAR_TMP 128 #define MAX_CHAR_TMP 128

View file

@ -39,7 +39,9 @@
class FileProgressInfo class FileProgressInfo
{ {
public: public:
typedef enum { DOWNLOAD_LINE,UPLOAD_LINE,DOWNLOAD_SOURCE } LineType ; typedef enum { UNINIT, DOWNLOAD_LINE, UPLOAD_LINE, DOWNLOAD_SOURCE } LineType ;
FileProgressInfo() : type(UNINIT), progress(0.0) {}
LineType type ; LineType type ;
CompressedChunkMap cmap ; CompressedChunkMap cmap ;