Browse Source

Initialize class variable via constructor

adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
4bf4313862
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/gui/mainwindow.cpp
  2. 8
      src/gui/transferlistfilterswidget.cpp
  3. 4
      src/gui/transferlistfilterswidget.h

3
src/gui/mainwindow.cpp

@ -238,8 +238,7 @@ MainWindow::MainWindow(QWidget *parent) @@ -238,8 +238,7 @@ MainWindow::MainWindow(QWidget *parent)
// m_transferListWidget->setStyleSheet("QTreeView {border: none;}"); // borderless
m_propertiesWidget = new PropertiesWidget(hSplitter);
connect(m_transferListWidget, &TransferListWidget::currentTorrentChanged, m_propertiesWidget, &PropertiesWidget::loadTorrentInfos);
m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget);
m_transferListFiltersWidget->setDownloadTrackerFavicon(isDownloadTrackerFavicon());
m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget, isDownloadTrackerFavicon());
hSplitter->addWidget(m_transferListWidget);
hSplitter->addWidget(m_propertiesWidget);
m_splitter->addWidget(m_transferListFiltersWidget);

8
src/gui/transferlistfilterswidget.cpp

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

4
src/gui/transferlistfilterswidget.h

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

Loading…
Cancel
Save