file upload stats (gui)

This commit is contained in:
RetroPooh 2023-07-04 18:10:21 +03:00
parent bb533eefc8
commit d749290e50
2 changed files with 44 additions and 3 deletions

View File

@ -61,7 +61,8 @@
#define SHARED_FILES_DIALOG_COLUMN_AGE 3
#define SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS 4
#define SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR 5
#define SHARED_FILES_DIALOG_COLUMN_COUNT 6
#define SHARED_FILES_DIALOG_COLUMN_UPLOADED 6
#define SHARED_FILES_DIALOG_COLUMN_COUNT 7
#define SHARED_FILES_DIALOG_FILTER_STRING "filtered"
@ -235,6 +236,7 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_AGE , charWidth*6 );
header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, charWidth*10 );
header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR , charWidth*20 );
header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_UPLOADED , charWidth*20 );
header->setStretchLastSection(true);
@ -293,6 +295,7 @@ RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
{
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, false) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR, true) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_UPLOADED, true) ;
ui.checkButton->hide() ;
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
@ -490,6 +493,7 @@ void RemoteSharedFilesDialog::showProperColumns()
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_FILENB, false) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, true) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR, true) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_UPLOADED, true) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->hide();
ui.filterPatternLineEdit->hide();
@ -502,6 +506,7 @@ void RemoteSharedFilesDialog::showProperColumns()
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_FILENB, true) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, false) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR, false) ;
ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_UPLOADED, true) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->show();
ui.filterPatternLineEdit->show();

View File

@ -54,7 +54,8 @@
#define REMOTEDIRMODEL_COLUMN_AGE 3
#define REMOTEDIRMODEL_COLUMN_FRIEND_ACCESS 4
#define REMOTEDIRMODEL_COLUMN_WN_VISU_DIR 5
#define REMOTEDIRMODEL_COLUMN_COUNT 6
#define REMOTEDIRMODEL_COLUMN_UPLOADED 6
#define REMOTEDIRMODEL_COLUMN_COUNT 7
#define RETROSHARE_DIR_MODEL_FILTER_STRING "filtered"
static const uint32_t FLAT_VIEW_MAX_REFS_PER_SECOND = 2000 ;
@ -547,7 +548,17 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
return QString();
else
return misc::timeRelativeToNow(details.max_mtime);
case REMOTEDIRMODEL_COLUMN_UPLOADED:
{
if(!RemoteMode && details.id == rsPeers->getOwnId()) // Totals in "My files" row
{
uint64_t n = rsFiles->getCumulativeUploadNum();
if(n)
return QString(misc::friendlyUnit(rsFiles->getCumulativeUploadAll()) + QString(" - %1 files").arg(n));
else
return QString("-");
}
}
default:
return QString() ;
}
@ -580,6 +591,14 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
return QVariant();
case REMOTEDIRMODEL_COLUMN_WN_VISU_DIR:
return getGroupsString(details.flags,details.parent_groups) ;
case REMOTEDIRMODEL_COLUMN_UPLOADED:
{
uint64_t x = rsFiles->getCumulativeUpload(details.hash);
if(x)
return misc::friendlyUnit(x);
else
return QString();
}
default:
return tr("FILE");
@ -606,6 +625,8 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
return QVariant();
case REMOTEDIRMODEL_COLUMN_WN_VISU_DIR:
return getGroupsString(details.flags,details.parent_groups) ;
case REMOTEDIRMODEL_COLUMN_UPLOADED:
return "";
default:
return tr("DIR");
@ -665,6 +686,14 @@ QVariant FlatStyle_RDM::displayRole(const DirDetails& details,int coln) const
case REMOTEDIRMODEL_COLUMN_AGE: return misc::timeRelativeToNow(details.max_mtime);
case REMOTEDIRMODEL_COLUMN_FRIEND_ACCESS: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
case REMOTEDIRMODEL_COLUMN_WN_VISU_DIR: return computeDirectoryPath(details);
case REMOTEDIRMODEL_COLUMN_UPLOADED:
{
uint64_t x = rsFiles->getCumulativeUpload(details.hash);
if(x)
return misc::friendlyUnit(x);
else
return QString();
}
default:
return QVariant() ;
}
@ -733,6 +762,8 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
ind = getAgeIndicatorString(details);
return ind;
}
case REMOTEDIRMODEL_COLUMN_UPLOADED:
return (qulonglong) rsFiles->getCumulativeUpload(details.hash);
default:
return tr("FILE");
}
@ -779,6 +810,7 @@ QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
return computeDirectoryPath(details);
}
case REMOTEDIRMODEL_COLUMN_UPLOADED: return (qulonglong) rsFiles->getCumulativeUpload(details.hash);
}
}
return QVariant();
@ -945,6 +977,8 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int
return tr("What's new");
else
return tr("Visibility");
case REMOTEDIRMODEL_COLUMN_UPLOADED:
return tr("Uploaded");
}
return tr("Column %1").arg(section);
}
@ -991,6 +1025,8 @@ QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int
return tr("Share Flags");
case REMOTEDIRMODEL_COLUMN_WN_VISU_DIR:
return tr("Directory");
case REMOTEDIRMODEL_COLUMN_UPLOADED:
return tr("Uploaded");
}
return tr("Column %1").arg(section);
}