Browse Source

Move menu actions out of .ui files

This is to move related code together.
adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
3985d58d3c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 15
      src/gui/addnewtorrentdialog.cpp
  2. 20
      src/gui/addnewtorrentdialog.ui
  3. 19
      src/gui/properties/propertieswidget.cpp
  4. 23
      src/gui/properties/propertieswidget.ui

15
src/gui/addnewtorrentdialog.cpp

@ -525,29 +525,22 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &) @@ -525,29 +525,22 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &)
QMenu *subMenu = menu->addMenu(tr("Priority"));
connect(m_ui->actionNotDownloaded, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("Do not download"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Ignored);
});
subMenu->addAction(m_ui->actionNotDownloaded);
connect(m_ui->actionNormal, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("Normal"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Normal);
});
subMenu->addAction(m_ui->actionNormal);
connect(m_ui->actionHigh, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("High"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::High);
});
subMenu->addAction(m_ui->actionHigh);
connect(m_ui->actionMaximum, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("Maximum"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Maximum);
});
subMenu->addAction(m_ui->actionMaximum);
menu->popup(QCursor::pos());
}

20
src/gui/addnewtorrentdialog.ui

@ -449,26 +449,6 @@ @@ -449,26 +449,6 @@
</layout>
</item>
</layout>
<action name="actionNormal">
<property name="text">
<string>Normal</string>
</property>
</action>
<action name="actionHigh">
<property name="text">
<string>High</string>
</property>
</action>
<action name="actionMaximum">
<property name="text">
<string>Maximum</string>
</property>
</action>
<action name="actionNotDownloaded">
<property name="text">
<string>Do not download</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

19
src/gui/properties/propertieswidget.cpp

@ -600,8 +600,6 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &) @@ -600,8 +600,6 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
if (!m_torrent->isSeed())
{
QMenu *subMenu = menu->addMenu(tr("Priority"));
const auto applyPriorities = [this, selectedRows](const BitTorrent::DownloadPriority prio)
{
for (const QModelIndex &index : selectedRows)
@ -614,29 +612,24 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &) @@ -614,29 +612,24 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
filteredFilesChanged();
};
connect(m_ui->actionNotDownloaded, &QAction::triggered, subMenu, [applyPriorities]()
QMenu *subMenu = menu->addMenu(tr("Priority"));
subMenu->addAction(tr("Do not download"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Ignored);
});
subMenu->addAction(m_ui->actionNotDownloaded);
connect(m_ui->actionNormal, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("Normal"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Normal);
});
subMenu->addAction(m_ui->actionNormal);
connect(m_ui->actionHigh, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("High"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::High);
});
subMenu->addAction(m_ui->actionHigh);
connect(m_ui->actionMaximum, &QAction::triggered, subMenu, [applyPriorities]()
subMenu->addAction(tr("Maximum"), subMenu, [applyPriorities]()
{
applyPriorities(BitTorrent::DownloadPriority::Maximum);
});
subMenu->addAction(m_ui->actionMaximum);
}
// The selected torrent might have disappeared during exec()

23
src/gui/properties/propertieswidget.ui

@ -1086,29 +1086,6 @@ @@ -1086,29 +1086,6 @@
</widget>
</item>
</layout>
<action name="actionNotDownloaded">
<property name="text">
<string>Do not download</string>
</property>
<property name="toolTip">
<string>Do not download</string>
</property>
</action>
<action name="actionMaximum">
<property name="text">
<string>Maximum</string>
</property>
</action>
<action name="actionHigh">
<property name="text">
<string>High</string>
</property>
</action>
<action name="actionNormal">
<property name="text">
<string>Normal</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

Loading…
Cancel
Save