mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-28 02:38:17 +03:00
parent
42d7465cba
commit
a1317e24f9
3 changed files with 34 additions and 4 deletions
|
@ -82,6 +82,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
|
||||||
m_ui->contentFilterLayout->insertWidget(3, m_contentFilterLine);
|
m_ui->contentFilterLayout->insertWidget(3, m_contentFilterLine);
|
||||||
|
|
||||||
m_ui->filesList->setDoubleClickAction(TorrentContentWidget::DoubleClickAction::Open);
|
m_ui->filesList->setDoubleClickAction(TorrentContentWidget::DoubleClickAction::Open);
|
||||||
|
m_ui->filesList->setOpenByEnterKey(true);
|
||||||
|
|
||||||
// SIGNAL/SLOTS
|
// SIGNAL/SLOTS
|
||||||
connect(m_ui->selectAllButton, &QPushButton::clicked, m_ui->filesList, &TorrentContentWidget::checkAll);
|
connect(m_ui->selectAllButton, &QPushButton::clicked, m_ui->filesList, &TorrentContentWidget::checkAll);
|
||||||
|
|
|
@ -89,10 +89,6 @@ TorrentContentWidget::TorrentContentWidget(QWidget *parent)
|
||||||
|
|
||||||
const auto *renameFileHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
const auto *renameFileHotkey = new QShortcut(Qt::Key_F2, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
connect(renameFileHotkey, &QShortcut::activated, this, &TorrentContentWidget::renameSelectedFile);
|
connect(renameFileHotkey, &QShortcut::activated, this, &TorrentContentWidget::renameSelectedFile);
|
||||||
const auto *openFileHotkeyReturn = new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(openFileHotkeyReturn, &QShortcut::activated, this, &TorrentContentWidget::openSelectedFile);
|
|
||||||
const auto *openFileHotkeyEnter = new QShortcut(Qt::Key_Enter, this, nullptr, nullptr, Qt::WidgetShortcut);
|
|
||||||
connect(openFileHotkeyEnter, &QShortcut::activated, this, &TorrentContentWidget::openSelectedFile);
|
|
||||||
|
|
||||||
connect(model(), &QAbstractItemModel::modelReset, this, &TorrentContentWidget::expandRecursively);
|
connect(model(), &QAbstractItemModel::modelReset, this, &TorrentContentWidget::expandRecursively);
|
||||||
}
|
}
|
||||||
|
@ -118,6 +114,32 @@ void TorrentContentWidget::refresh()
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TorrentContentWidget::openByEnterKey() const
|
||||||
|
{
|
||||||
|
return m_openFileHotkeyEnter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TorrentContentWidget::setOpenByEnterKey(const bool value)
|
||||||
|
{
|
||||||
|
if (value == openByEnterKey())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
m_openFileHotkeyReturn = new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(m_openFileHotkeyReturn, &QShortcut::activated, this, &TorrentContentWidget::openSelectedFile);
|
||||||
|
m_openFileHotkeyEnter = new QShortcut(Qt::Key_Enter, this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||||
|
connect(m_openFileHotkeyEnter, &QShortcut::activated, this, &TorrentContentWidget::openSelectedFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete m_openFileHotkeyEnter;
|
||||||
|
m_openFileHotkeyEnter = nullptr;
|
||||||
|
delete m_openFileHotkeyReturn;
|
||||||
|
m_openFileHotkeyReturn = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TorrentContentWidget::DoubleClickAction TorrentContentWidget::doubleClickAction() const
|
TorrentContentWidget::DoubleClickAction TorrentContentWidget::doubleClickAction() const
|
||||||
{
|
{
|
||||||
return m_doubleClickAction;
|
return m_doubleClickAction;
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "base/bittorrent/downloadpriority.h"
|
#include "base/bittorrent/downloadpriority.h"
|
||||||
#include "base/pathfwd.h"
|
#include "base/pathfwd.h"
|
||||||
|
|
||||||
|
class QShortcut;
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
class Torrent;
|
class Torrent;
|
||||||
|
@ -78,6 +80,9 @@ public:
|
||||||
BitTorrent::TorrentContentHandler *contentHandler() const;
|
BitTorrent::TorrentContentHandler *contentHandler() const;
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
|
bool openByEnterKey() const;
|
||||||
|
void setOpenByEnterKey(bool value);
|
||||||
|
|
||||||
DoubleClickAction doubleClickAction() const;
|
DoubleClickAction doubleClickAction() const;
|
||||||
void setDoubleClickAction(DoubleClickAction action);
|
void setDoubleClickAction(DoubleClickAction action);
|
||||||
|
|
||||||
|
@ -118,4 +123,6 @@ private:
|
||||||
TorrentContentFilterModel *m_filterModel;
|
TorrentContentFilterModel *m_filterModel;
|
||||||
DoubleClickAction m_doubleClickAction = DoubleClickAction::Rename;
|
DoubleClickAction m_doubleClickAction = DoubleClickAction::Rename;
|
||||||
ColumnsVisibilityMode m_columnsVisibilityMode = ColumnsVisibilityMode::Editable;
|
ColumnsVisibilityMode m_columnsVisibilityMode = ColumnsVisibilityMode::Editable;
|
||||||
|
QShortcut *m_openFileHotkeyEnter = nullptr;
|
||||||
|
QShortcut *m_openFileHotkeyReturn = nullptr;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue