add UI for upload stats retention and move clear button to new Upload Statistics group

This commit is contained in:
jolavillette 2026-02-08 11:20:04 +01:00
parent 939f283a92
commit 030f37f613
3 changed files with 76 additions and 6 deletions

View File

@ -65,6 +65,7 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
QObject::connect(ui.minimumFontSize_SB, SIGNAL(valueChanged(int)), this, SLOT(updateFontSize())) ;
QObject::connect(ui.clearuploadStatsButton, SIGNAL(clicked( bool ) ), this , SLOT(clearUploadStatistics() ) );
QObject::connect(ui.uploadStatsRetention_SB, SIGNAL(valueChanged(int)), this, SLOT(updateUploadStatsRetention(int)));
QObject::connect(ui.autoCheckDirectories_CB, SIGNAL(toggled(bool)), this,SLOT(updateAutoCheckDirectories())) ;
QObject::connect(ui.autoCheckDirectoriesDelay_SB,SIGNAL(valueChanged(int)),this,SLOT(updateAutoScanDirectoriesPeriod())) ;
@ -182,6 +183,8 @@ void TransferPage::load()
default: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(2) ; break ;
}
whileBlocking(ui.uploadStatsRetention_SB)->setValue(rsFiles->getUploadStatsRetentionDays());
std::list<std::string> suffixes, prefixes;
uint32_t ignore_flags ;
@ -341,3 +344,4 @@ void TransferPage::updateAutoCheckDirectories() { rsFiles->setWatchEnab
void TransferPage::updateAutoScanDirectoriesPeriod() { rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()); }
void TransferPage::updateShareDownloadDirectory() { rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());}
void TransferPage::updateFollowSymLinks() { rsFiles->setFollowSymLinks(ui.followSymLinks_CB->isChecked()); ui.ignoreDuplicates_CB->setEnabled(ui.followSymLinks_CB->isChecked());}
void TransferPage::updateUploadStatsRetention(int days) { rsFiles->setUploadStatsRetentionDays(days); }

View File

@ -60,6 +60,7 @@ class TransferPage: public ConfigPage
void toggleTrustFriendNodesWithBannedFiles(bool);
void updateFontSize();
void clearUploadStatistics();
void updateUploadStatsRetention(int);
void updateAutoCheckDirectories() ;
void updateAutoScanDirectoriesPeriod() ;
void updateShareDownloadDirectory() ;

View File

@ -35,11 +35,17 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="clearuploadStatsButton">
<property name="text">
<string>Clear upload statistics</string>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="shareDownloadDirectoryCB">
@ -291,6 +297,65 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="uploadStatsGBox">
<property name="title">
<string>Upload Statistics</string>
</property>
<layout class="QGridLayout" name="uploadStatsGBoxLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="uploadStatsRetentionHLayout">
<item>
<widget class="QLabel" name="uploadStatsRetentionLabel">
<property name="text">
<string>Keep upload statistics for:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="uploadStatsRetention_SB">
<property name="suffix">
<string> days (0 = forever)</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>3650</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Upload statistics older than this number of days will be deleted. Set to 0 to keep them forever.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearuploadStatsButton">
<property name="text">
<string>Clear upload statistics</string>
</property>
</widget>
</item>
<item>
<spacer name="uploadStatsHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
@ -308,7 +373,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<layout class="QHBoxLayout" name="minimumFontSizeHLayout">
<item>
<widget class="QLabel" name="minimumFontSizeLabel">
@ -342,7 +407,7 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="5" column="0">
<item row="6" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>