Browse Source

Enable delete hotkey in web seed and tracker list.

Make delete hotkey in transfer list non-global.
adaptive-webui-19844
Nick Tiskov 11 years ago
parent
commit
107906928a
  1. 5
      src/mainwindow.cpp
  2. 7
      src/properties/propertieswidget.cpp
  3. 1
      src/properties/propertieswidget.h
  4. 2
      src/properties/trackerlist.cpp
  5. 1
      src/properties/trackerlist.h
  6. 2
      src/transferlistwidget.cpp
  7. 1
      src/transferlistwidget.h

5
src/mainwindow.cpp

@ -557,11 +557,6 @@ void MainWindow::createKeyboardShortcuts() {
connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab())); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
actionDocumentation->setShortcut(QKeySequence("F1")); actionDocumentation->setShortcut(QKeySequence("F1"));
actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O"))); actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O")));
#ifdef Q_WS_MAC
actionDelete->setShortcut(QKeySequence("Ctrl+Backspace"));
#else
actionDelete->setShortcut(QKeySequence(QString::fromUtf8("Del")));
#endif
actionStart->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+S"))); actionStart->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+S")));
actionStart_All->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Shift+S"))); actionStart_All->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Shift+S")));
actionPause->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+P"))); actionPause->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+P")));

7
src/properties/propertieswidget.cpp

@ -124,6 +124,8 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
editHotkeyWeb = new QShortcut(QKeySequence("F2"), listWebSeeds, 0, 0, Qt::WidgetShortcut); editHotkeyWeb = new QShortcut(QKeySequence("F2"), listWebSeeds, 0, 0, Qt::WidgetShortcut);
connect(editHotkeyWeb, SIGNAL(activated()), SLOT(editWebSeed())); connect(editHotkeyWeb, SIGNAL(activated()), SLOT(editWebSeed()));
connect(listWebSeeds, SIGNAL(doubleClicked(QModelIndex)), SLOT(editWebSeed())); connect(listWebSeeds, SIGNAL(doubleClicked(QModelIndex)), SLOT(editWebSeed()));
deleteHotkeyWeb = new QShortcut(QKeySequence(QKeySequence::Delete), listWebSeeds, 0, 0, Qt::WidgetShortcut);
connect(deleteHotkeyWeb, SIGNAL(activated()), SLOT(deleteSelectedUrlSeeds()));
} }
PropertiesWidget::~PropertiesWidget() { PropertiesWidget::~PropertiesWidget() {
@ -138,6 +140,7 @@ PropertiesWidget::~PropertiesWidget() {
delete m_tabBar; delete m_tabBar;
delete editHotkeyFile; delete editHotkeyFile;
delete editHotkeyWeb; delete editHotkeyWeb;
delete deleteHotkeyWeb;
qDebug() << Q_FUNC_INFO << "EXIT"; qDebug() << Q_FUNC_INFO << "EXIT";
} }
@ -663,6 +666,8 @@ void PropertiesWidget::askWebSeed() {
void PropertiesWidget::deleteSelectedUrlSeeds() { void PropertiesWidget::deleteSelectedUrlSeeds() {
const QList<QListWidgetItem *> selectedItems = listWebSeeds->selectedItems(); const QList<QListWidgetItem *> selectedItems = listWebSeeds->selectedItems();
if (selectedItems.isEmpty())
return;
bool change = false; bool change = false;
foreach (const QListWidgetItem *item, selectedItems) { foreach (const QListWidgetItem *item, selectedItems) {
QString url_seed = item->text(); QString url_seed = item->text();
@ -691,7 +696,7 @@ void PropertiesWidget::copySelectedWebSeedsToClipboard() const {
void PropertiesWidget::editWebSeed() { void PropertiesWidget::editWebSeed() {
const QList<QListWidgetItem *> selected_items = listWebSeeds->selectedItems(); const QList<QListWidgetItem *> selected_items = listWebSeeds->selectedItems();
if (selected_items.isEmpty()) if (selected_items.size() != 1)
return; return;
const QListWidgetItem *selected_item = selected_items.last(); const QListWidgetItem *selected_item = selected_items.last();

1
src/properties/propertieswidget.h

@ -115,6 +115,7 @@ private:
LineEdit *m_contentFilerLine; LineEdit *m_contentFilerLine;
QShortcut *editHotkeyFile; QShortcut *editHotkeyFile;
QShortcut *editHotkeyWeb; QShortcut *editHotkeyWeb;
QShortcut *deleteHotkeyWeb;
}; };
#endif // PROPERTIESWIDGET_H #endif // PROPERTIESWIDGET_H

2
src/properties/trackerlist.cpp

@ -77,12 +77,14 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
setRowColor(2, QColor("grey")); setRowColor(2, QColor("grey"));
editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(editSelectedTracker()), 0, Qt::WidgetShortcut); editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(editSelectedTracker()), 0, Qt::WidgetShortcut);
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(editSelectedTracker())); connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(editSelectedTracker()));
deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), this, SLOT(deleteSelectedTrackers()), 0, Qt::WidgetShortcut);
loadSettings(); loadSettings();
} }
TrackerList::~TrackerList() { TrackerList::~TrackerList() {
delete editHotkey; delete editHotkey;
delete deleteHotkey;
saveSettings(); saveSettings();
} }

1
src/properties/trackerlist.h

@ -54,6 +54,7 @@ private:
QTreeWidgetItem* pex_item; QTreeWidgetItem* pex_item;
QTreeWidgetItem* lsd_item; QTreeWidgetItem* lsd_item;
QShortcut *editHotkey; QShortcut *editHotkey;
QShortcut *deleteHotkey;
public: public:
TrackerList(PropertiesWidget *properties); TrackerList(PropertiesWidget *properties);

2
src/transferlistwidget.cpp

@ -143,6 +143,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window,
connect(header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLHoSMenu(const QPoint&))); connect(header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLHoSMenu(const QPoint&)));
editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut); editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut);
deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(deleteSelectedTorrents()), 0, Qt::WidgetShortcut);
} }
TransferListWidget::~TransferListWidget() { TransferListWidget::~TransferListWidget() {
@ -156,6 +157,7 @@ TransferListWidget::~TransferListWidget() {
delete listModel; delete listModel;
delete listDelegate; delete listDelegate;
delete editHotkey; delete editHotkey;
delete deleteHotkey;
qDebug() << Q_FUNC_INFO << "EXIT"; qDebug() << Q_FUNC_INFO << "EXIT";
} }

1
src/transferlistwidget.h

@ -118,6 +118,7 @@ private:
QBtSession* BTSession; QBtSession* BTSession;
MainWindow *main_window; MainWindow *main_window;
QShortcut *editHotkey; QShortcut *editHotkey;
QShortcut *deleteHotkey;
}; };
#endif // TRANSFERLISTWIDGET_H #endif // TRANSFERLISTWIDGET_H

Loading…
Cancel
Save