Merge pull request #1019 from PhenomRetroShare/Add_GroupedUpLoadItem

Regroup Upload Items by file in TransfersDialog.
This commit is contained in:
csoler 2017-09-07 18:08:34 +02:00 committed by GitHub
commit 1dc6bef985
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);
break;
case COLUMN_LASTDL:
if (index.data().value<QString>().isEmpty())
break;
qi64Value = index.data().value<qint64>();
if (qi64Value < std::numeric_limits<qint64>::max()){
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**/
void clearcompleted();
void copyLink();
void dlCopyLink();
void pasteLink();
void renameFile();
void setDestinationDirectory();
@ -109,9 +109,9 @@ private slots:
void pauseFileTransfer();
void resumeFileTransfer();
void openFolderTransfer();
void openTransfer();
void previewTransfer();
void dlOpenFolder();
void dlOpenFile();
void dlPreviewFile();
void ulOpenFolder();
void ulCopyLink();
@ -235,7 +235,7 @@ private:
bool m_bProcessSettings;
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);
bool controlTransferFile(uint32_t flags);
void changePriority(int priority);
@ -255,12 +255,11 @@ private:
Ui::TransfersDialog ui;
public slots:
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
//
int addItem(int row, const FileInfo &fileInfo);
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, 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);
// 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 addPeerToDLItem(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);
void showFileDetails() ;

View File

@ -45,7 +45,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
QPixmap pixmap;
qlonglong fileSize;
double ulspeed, multi;
QString temp , status;
QString temp;
qlonglong transferred;
// prepare
@ -65,7 +65,12 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
}
// 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(cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
@ -78,6 +83,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
}
}
}
switch(index.column()) {
case COLUMN_USIZE:
fileSize = index.data().toLongLong();
@ -128,15 +134,17 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
}
painter->drawText(option.rect, Qt::AlignRight, temp);
break;
case COLUMN_UPROGRESS:
case COLUMN_UPROGRESS:
{
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
if (pinfo.type == FileProgressInfo::UNINIT)
break;
// create a xProgressBar
painter->save() ;
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")
progressBar.setColorSchema( 9);
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());
break;
case COLUMN_USTATUS:
painter->drawText(option.rect.translated(pixmap.size().width(), 0), Qt::AlignCenter, index.data().toString());
break;
default:
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
}

View File

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

View File

@ -39,7 +39,9 @@
class FileProgressInfo
{
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 ;
CompressedChunkMap cmap ;