diff --git a/retroshare-gui/src/gui/settings/ChannelPage.cpp b/retroshare-gui/src/gui/settings/ChannelPage.cpp index ef2fa6307..857cc972e 100644 --- a/retroshare-gui/src/gui/settings/ChannelPage.cpp +++ b/retroshare-gui/src/gui/settings/ChannelPage.cpp @@ -22,6 +22,7 @@ #include "rsharesettings.h" #include "util/misc.h" #include "gui/notifyqt.h" +#include "retroshare/rsgxschannels.h" ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags) : ConfigPage(parent, flags) @@ -35,6 +36,9 @@ ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags) connect(ui.emoteicon_checkBox,SIGNAL(toggled(bool)),this,SLOT(updateEmotes())) ; + // Connecting the spin box with the maximum auto download size in channels + connect(ui.autoDownloadSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateMaxAutoDownloadSizeLimit(int))); + } ChannelPage::~ChannelPage() @@ -49,6 +53,13 @@ void ChannelPage::load() Settings->beginGroup(QString("ChannelPostsWidget")); whileBlocking(ui.emoteicon_checkBox)->setChecked(Settings->value("Emoteicons_ChannelDecription", true).toBool()); Settings->endGroup(); + + // Getting the maximum auto download size from the configuration + uint64_t maxAutoDownloadSize; + rsGxsChannels->getMaxAutoDownloadSizeLimit(maxAutoDownloadSize); + int temp=(maxAutoDownloadSize/(Size_Of_1_GB)); + whileBlocking(ui.autoDownloadSpinBox)->setValue(temp); + } void ChannelPage::updateEmotes() @@ -57,3 +68,10 @@ void ChannelPage::updateEmotes() Settings->setValue("Emoteicons_ChannelDecription", ui.emoteicon_checkBox->isChecked()); Settings->endGroup(); } + +// Function to update the maximum size allowed for auto download in channels +void ChannelPage::updateMaxAutoDownloadSizeLimit(int value) +{ + uint64_t temp=(static_cast(value)*Size_Of_1_GB); + rsGxsChannels->setMaxAutoDownloadSizeLimit(temp); +} diff --git a/retroshare-gui/src/gui/settings/ChannelPage.h b/retroshare-gui/src/gui/settings/ChannelPage.h index 93f32cabc..adb573711 100644 --- a/retroshare-gui/src/gui/settings/ChannelPage.h +++ b/retroshare-gui/src/gui/settings/ChannelPage.h @@ -25,6 +25,8 @@ #include "ui_ChannelPage.h" #include "gui/common/FilesDefs.h" +#define Size_Of_1_GB (1024 * 1024 * 1024) // It is the size of 1 GB in bytes. + class ChannelPage : public ConfigPage { Q_OBJECT @@ -43,6 +45,9 @@ public: private slots: void updateEmotes(); + // Function to update the maximum size allowed for auto download in channels + void updateMaxAutoDownloadSizeLimit(int value); + private: Ui::ChannelPage ui; }; diff --git a/retroshare-gui/src/gui/settings/ChannelPage.ui b/retroshare-gui/src/gui/settings/ChannelPage.ui index 5e75e442e..8ea42f71a 100644 --- a/retroshare-gui/src/gui/settings/ChannelPage.ui +++ b/retroshare-gui/src/gui/settings/ChannelPage.ui @@ -6,22 +6,23 @@ 0 0 - 423 + 526 334 - - - - - Tabs + + + + + Qt::Vertical - - - - - - + + + 20 + 5 + + + @@ -39,18 +40,43 @@ + + + + Tabs + + + + + + + + - - - Qt::Vertical + + + Downloads - - - 20 - 40 - - - + + + + + 1 + + + 200 + + + + + + + Maximum Auto Download Size (in GBs) + + + + +