mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Move menu actions out of .ui files
This is to move related code together.
This commit is contained in:
parent
17fa615bd3
commit
3985d58d3c
@ -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());
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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 &)
|
||||
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()
|
||||
|
@ -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…
Reference in New Issue
Block a user