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"));
|
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);
|
applyPriorities(BitTorrent::DownloadPriority::Ignored);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionNotDownloaded);
|
subMenu->addAction(tr("Normal"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionNormal, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::Normal);
|
applyPriorities(BitTorrent::DownloadPriority::Normal);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionNormal);
|
subMenu->addAction(tr("High"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionHigh, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::High);
|
applyPriorities(BitTorrent::DownloadPriority::High);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionHigh);
|
subMenu->addAction(tr("Maximum"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionMaximum, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::Maximum);
|
applyPriorities(BitTorrent::DownloadPriority::Maximum);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionMaximum);
|
|
||||||
|
|
||||||
menu->popup(QCursor::pos());
|
menu->popup(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
@ -449,26 +449,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</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>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -600,8 +600,6 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
|
|||||||
|
|
||||||
if (!m_torrent->isSeed())
|
if (!m_torrent->isSeed())
|
||||||
{
|
{
|
||||||
QMenu *subMenu = menu->addMenu(tr("Priority"));
|
|
||||||
|
|
||||||
const auto applyPriorities = [this, selectedRows](const BitTorrent::DownloadPriority prio)
|
const auto applyPriorities = [this, selectedRows](const BitTorrent::DownloadPriority prio)
|
||||||
{
|
{
|
||||||
for (const QModelIndex &index : selectedRows)
|
for (const QModelIndex &index : selectedRows)
|
||||||
@ -614,29 +612,24 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
|
|||||||
filteredFilesChanged();
|
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);
|
applyPriorities(BitTorrent::DownloadPriority::Ignored);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionNotDownloaded);
|
subMenu->addAction(tr("Normal"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionNormal, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::Normal);
|
applyPriorities(BitTorrent::DownloadPriority::Normal);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionNormal);
|
subMenu->addAction(tr("High"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionHigh, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::High);
|
applyPriorities(BitTorrent::DownloadPriority::High);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionHigh);
|
subMenu->addAction(tr("Maximum"), subMenu, [applyPriorities]()
|
||||||
|
|
||||||
connect(m_ui->actionMaximum, &QAction::triggered, subMenu, [applyPriorities]()
|
|
||||||
{
|
{
|
||||||
applyPriorities(BitTorrent::DownloadPriority::Maximum);
|
applyPriorities(BitTorrent::DownloadPriority::Maximum);
|
||||||
});
|
});
|
||||||
subMenu->addAction(m_ui->actionMaximum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The selected torrent might have disappeared during exec()
|
// The selected torrent might have disappeared during exec()
|
||||||
|
@ -1086,29 +1086,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</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>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
Loading…
Reference in New Issue
Block a user