Browse Source

Add Select All/None buttons in new torrent dialog

adaptive-webui-19844
thalieht 3 years ago
parent
commit
78d69bcbf0
  1. 4
      src/gui/addnewtorrentdialog.cpp
  2. 69
      src/gui/addnewtorrentdialog.ui

4
src/gui/addnewtorrentdialog.cpp

@ -201,7 +201,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->startTorrentCheckBox->setChecked(!m_torrentParams.addPaused.value_or(session->isAddTorrentPaused())); m_ui->startTorrentCheckBox->setChecked(!m_torrentParams.addPaused.value_or(session->isAddTorrentPaused()));
m_ui->comboTTM->blockSignals(true); // the TreeView size isn't correct if the slot does it job at this point m_ui->comboTTM->blockSignals(true); // the TreeView size isn't correct if the slot does its job at this point
m_ui->comboTTM->setCurrentIndex(session->isAutoTMMDisabledByDefault() ? 0 : 1); m_ui->comboTTM->setCurrentIndex(session->isAutoTMMDisabledByDefault() ? 0 : 1);
m_ui->comboTTM->blockSignals(false); m_ui->comboTTM->blockSignals(false);
@ -899,6 +899,8 @@ void AddNewTorrentDialog::setupTreeview()
connect(m_ui->contentTreeView, &QAbstractItemView::clicked, m_ui->contentTreeView connect(m_ui->contentTreeView, &QAbstractItemView::clicked, m_ui->contentTreeView
, qOverload<const QModelIndex &>(&QAbstractItemView::edit)); , qOverload<const QModelIndex &>(&QAbstractItemView::edit));
connect(m_ui->contentTreeView, &QWidget::customContextMenuRequested, this, &AddNewTorrentDialog::displayContentTreeMenu); connect(m_ui->contentTreeView, &QWidget::customContextMenuRequested, this, &AddNewTorrentDialog::displayContentTreeMenu);
connect(m_ui->buttonSelectAll, &QPushButton::clicked, m_contentModel, &TorrentContentFilterModel::selectAll);
connect(m_ui->buttonSelectNone, &QPushButton::clicked, m_contentModel, &TorrentContentFilterModel::selectNone);
const auto contentLayout = ((m_ui->contentLayoutComboBox->currentIndex() == 0) const auto contentLayout = ((m_ui->contentLayoutComboBox->currentIndex() == 0)
? BitTorrent::detectContentLayout(m_torrentInfo.filePaths()) ? BitTorrent::detectContentLayout(m_torrentInfo.filePaths())

69
src/gui/addnewtorrentdialog.ui

@ -392,22 +392,59 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="TorrentContentTreeView" name="contentTreeView"> <widget class="QWidget" name="layoutWidget">
<property name="sizePolicy"> <layout class="QVBoxLayout" name="verticalLayout_5">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <item>
<horstretch>1</horstretch> <layout class="QHBoxLayout" name="contentFilterLayout">
<verstretch>0</verstretch> <item>
</sizepolicy> <widget class="QPushButton" name="buttonSelectAll">
</property> <property name="text">
<property name="contextMenuPolicy"> <string>Select All</string>
<enum>Qt::CustomContextMenu</enum> </property>
</property> </widget>
<property name="selectionMode"> </item>
<enum>QAbstractItemView::ExtendedSelection</enum> <item>
</property> <widget class="QPushButton" name="buttonSelectNone">
<property name="sortingEnabled"> <property name="text">
<bool>true</bool> <string>Select None</string>
</property> </property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>168</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="TorrentContentTreeView" name="contentTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</item> </item>

Loading…
Cancel
Save