Browse Source

Merge pull request #10445 from Chocobo1/crash

Work around crashing in Qt networking library
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
3a3dec1707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/gui/mainwindow.cpp
  2. 8
      src/gui/transferlistfilterswidget.cpp
  3. 4
      src/gui/transferlistfilterswidget.h

5
src/gui/mainwindow.cpp

@ -238,8 +238,7 @@ MainWindow::MainWindow(QWidget *parent)
// m_transferListWidget->setStyleSheet("QTreeView {border: none;}"); // borderless // m_transferListWidget->setStyleSheet("QTreeView {border: none;}"); // borderless
m_propertiesWidget = new PropertiesWidget(hSplitter); m_propertiesWidget = new PropertiesWidget(hSplitter);
connect(m_transferListWidget, &TransferListWidget::currentTorrentChanged, m_propertiesWidget, &PropertiesWidget::loadTorrentInfos); connect(m_transferListWidget, &TransferListWidget::currentTorrentChanged, m_propertiesWidget, &PropertiesWidget::loadTorrentInfos);
m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget); m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget, isDownloadTrackerFavicon());
m_transferListFiltersWidget->setDownloadTrackerFavicon(isDownloadTrackerFavicon());
hSplitter->addWidget(m_transferListWidget); hSplitter->addWidget(m_transferListWidget);
hSplitter->addWidget(m_propertiesWidget); hSplitter->addWidget(m_propertiesWidget);
m_splitter->addWidget(m_transferListFiltersWidget); m_splitter->addWidget(m_transferListFiltersWidget);
@ -518,7 +517,7 @@ void MainWindow::setTorrentAddedNotificationsEnabled(bool value)
bool MainWindow::isDownloadTrackerFavicon() const bool MainWindow::isDownloadTrackerFavicon() const
{ {
return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, true).toBool(); return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, false).toBool();
} }
void MainWindow::setDownloadTrackerFavicon(bool value) void MainWindow::setDownloadTrackerFavicon(bool value)

8
src/gui/transferlistfilterswidget.cpp

@ -192,10 +192,10 @@ void StatusFilterWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {}
void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {} void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {}
TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList) TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)
: BaseFilterWidget(parent, transferList) : BaseFilterWidget(parent, transferList)
, m_totalTorrents(0) , m_totalTorrents(0)
, m_downloadTrackerFavicon(true) , m_downloadTrackerFavicon(downloadFavicon)
{ {
auto *allTrackers = new QListWidgetItem(this); auto *allTrackers = new QListWidgetItem(this);
allTrackers->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the tracker filter"))); allTrackers->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the tracker filter")));
@ -545,7 +545,7 @@ QStringList TrackerFiltersList::getHashes(int row)
return m_trackers.value(trackerFromRow(row)); return m_trackers.value(trackerFromRow(row));
} }
TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList) TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)
: QFrame(parent) : QFrame(parent)
, m_transferList(transferList) , m_transferList(transferList)
{ {
@ -625,7 +625,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
trackerLabel->setFont(font); trackerLabel->setFont(font);
frameLayout->addWidget(trackerLabel); frameLayout->addWidget(trackerLabel);
m_trackerFilters = new TrackerFiltersList(this, transferList); m_trackerFilters = new TrackerFiltersList(this, transferList, downloadFavicon);
frameLayout->addWidget(m_trackerFilters); frameLayout->addWidget(m_trackerFilters);
connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter); connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter);

4
src/gui/transferlistfilterswidget.h

@ -98,7 +98,7 @@ class TrackerFiltersList : public BaseFilterWidget
Q_DISABLE_COPY(TrackerFiltersList) Q_DISABLE_COPY(TrackerFiltersList)
public: public:
TrackerFiltersList(QWidget *parent, TransferListWidget *transferList); TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, bool downloadFavicon);
~TrackerFiltersList() override; ~TrackerFiltersList() override;
// Redefine addItem() to make sure the list stays sorted // Redefine addItem() to make sure the list stays sorted
@ -144,7 +144,7 @@ class TransferListFiltersWidget : public QFrame
Q_OBJECT Q_OBJECT
public: public:
TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList); TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList, bool downloadFavicon);
void setDownloadTrackerFavicon(bool value); void setDownloadTrackerFavicon(bool value);
public slots: public slots:

Loading…
Cancel
Save