Skip to content

Commit

Permalink
stability fix, auto refresh peers setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aliakseis committed Mar 19, 2019
1 parent 932f48e commit 251b58d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -33,7 +33,7 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)

project(${PROJECT_NAME} VERSION 0.1.0.6)
project(${PROJECT_NAME} VERSION 0.1.0.7)
message("Building ${PROJECT_NAME} version ${PROJECT_VERSION}")

###################################################
Expand Down
9 changes: 9 additions & 0 deletions src/gui/torrentdetailsform.cpp
Expand Up @@ -9,11 +9,13 @@

#include "peersinfomodel.h"
#include "peersinfoform_proxy_model.h"
#include "settings_declaration.h"

#include <QMessageBox>
#include <QDateTime>
#include <QFileDialog>
#include <QDebug>
#include <QSettings>

#include <QKeyEvent>
#include "branding.hxx"
Expand Down Expand Up @@ -95,6 +97,12 @@ void TorrentDetailsForm::initPeersInfoTab()
VERIFY(connect(ui->peersView->header(), SIGNAL(sectionDoubleClicked(int)), SLOT(adaptColumns(int))));
ui->peersView->setSortingEnabled(true);

const bool autoRefresh = QSettings().value(
app_settings::TorrentDetailsAutoRefreshPeers,
app_settings::TorrentDetailsAutoRefreshPeers_Default).toBool();
ui->chbAutoRefresh->setChecked(autoRefresh);
m_refreshPeers = autoRefresh;

connect(this, &TorrentDetailsForm::updatePeersInfo,
m_PeersInfomodel, &PeersInfoModel::updatePeersInfo);
connect(ui->chbAutoRefresh, &QCheckBox::clicked,
Expand Down Expand Up @@ -168,6 +176,7 @@ void TorrentDetailsForm::onItemExpanded(const QModelIndex& index)
void TorrentDetailsForm::onRefreshPeersClicked(bool checked)
{
m_refreshPeers = checked;
QSettings().setValue(app_settings::TorrentDetailsAutoRefreshPeers, checked);
}

void TorrentDetailsForm::updateDiskSpaceLabel()
Expand Down
6 changes: 4 additions & 2 deletions src/logic/downloadcollectiontreeview.cpp
Expand Up @@ -480,8 +480,10 @@ void DownloadCollectionTreeView::showTorrentDetailsDialog(TreeItem* item)
{
try
{
auto dlg = std::make_shared<TorrentDetailsForm>(handle, utilities::getMainWindow());
const int id = item->getID();
std::shared_ptr<TorrentDetailsForm> dlg(
new TorrentDetailsForm(handle, utilities::getMainWindow()),
std::mem_fn(&QObject::deleteLater));
const auto id = item->getID();
auto progressConnection = connect(
&TorrentsListener::instance(),
&TorrentsListener::sizeCurrDownlChange,
Expand Down
3 changes: 3 additions & 0 deletions src/main/settings_declaration.h
Expand Up @@ -62,4 +62,7 @@ const bool ShowSysTrayNotificationOnHide_Default = true;
const char DeleteToRecycleBin[] = "DeleteToRecycleBin";
const bool DeleteToRecycleBin_Default = true;

const char TorrentDetailsAutoRefreshPeers[] = "TorrentDetailsAutoRefreshPeers";
const bool TorrentDetailsAutoRefreshPeers_Default = true;

} // namespace app_settings

0 comments on commit 251b58d

Please sign in to comment.