Browse Source

- Added keyboard shortcuts for main actions (thanks Alexander Kuzmenkov)

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
99959b1aa3
  1. 1
      Changelog
  2. 3
      TODO
  3. 70
      src/GUI.cpp
  4. 23
      src/GUI.h

1
Changelog

@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
- FEATURE: Allow to set global upload/download limits from tray icon menu
- FEATURE: IPv6 is now fully supported
- FEATURE: Real torrent share ratio is now displayed in transfer list
- FEATURE: Added keyboard shortcuts for main actions (see wiki)
- I18N: Added Hungarian translation
- BUGFIX: Progress of paused torrents is now correct on restart
- BUGFIX: Progress column gets sorted on restart it is was during last execution

3
TODO

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
// Easy
- Translations into as many languages as possible
- Improve man page
- Add more keyboard shortcuts
// Intermediate
- Port on MacOS, Windows (and create an installer for Windows) - Progressing
@ -43,6 +42,8 @@ @@ -43,6 +42,8 @@
- Fix sorting with Qt 4.3 - Reported to Trolltech, waiting for fix
- update sorting when a new torrent is added?
- Allow to hide columns
- Allow to set priorities for multiple files at once
- Document keyboard shortcuts on wiki
* beta2
- Wait for some bug fixes in libtorrent :
- upload/download limit per torrent

70
src/GUI.cpp

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
#include <QTcpSocket>
#include <QCloseEvent>
#include <QMutexLocker>
#include <QShortcut>
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_pex.hpp>
@ -197,6 +198,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ @@ -197,6 +198,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
setInfoBar(tr("qBittorrent %1 started.", "e.g: qBittorrent v0.x started.").arg(QString(VERSION)));
setInfoBar(tr("Be careful, sharing copyrighted material without permission is against the law."), "red");
show();
createKeyboardShortcuts();
qDebug("GUI Built");
}
@ -219,6 +221,22 @@ GUI::~GUI(){ @@ -219,6 +221,22 @@ GUI::~GUI(){
previewProcess->waitForFinished();
delete previewProcess;
delete connecStatusLblIcon;
// Keyboard shortcuts
delete createShortcut;
delete openShortcut;
delete quitShortcut;
delete switchSearchShortcut;
delete switchDownShortcut;
delete switchUpShortcut;
delete switchRSSShortcut;
delete propertiesShortcut;
delete optionsShortcut;
delete delShortcut;
delete delPermShortcut;
delete startShortcut;
delete startAllShortcut;
delete pauseShortcut;
delete pauseAllPermShortcut;
}
void GUI::on_actionWebsite_triggered(){
@ -241,6 +259,58 @@ void GUI::writeSettings() { @@ -241,6 +259,58 @@ void GUI::writeSettings() {
settings.endGroup();
}
void GUI::createKeyboardShortcuts(){
createShortcut = new QShortcut(QKeySequence("Ctrl+N"), this);
connect(createShortcut, SIGNAL(activated()), this, SLOT(on_actionCreate_torrent_triggered()));
openShortcut = new QShortcut(QKeySequence("Ctrl+O"), this);
connect(openShortcut, SIGNAL(activated()), this, SLOT(on_actionOpen_triggered()));
quitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this);
connect(quitShortcut, SIGNAL(activated()), this, SLOT(on_actionExit_triggered()));
switchDownShortcut = new QShortcut(QKeySequence(tr("Alt+1", "shortcut to switch to first tab")), this);
connect(switchDownShortcut, SIGNAL(activated()), this, SLOT(displayDownTab()));
switchUpShortcut = new QShortcut(QKeySequence(tr("Alt+2", "shortcut to switch to second tab")), this);
connect(switchUpShortcut, SIGNAL(activated()), this, SLOT(displayUpTab()));
switchSearchShortcut = new QShortcut(QKeySequence(tr("Alt+3", "shortcut to switch to third tab")), this);
connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab()));
switchRSSShortcut = new QShortcut(QKeySequence(tr("Alt+4", "shortcut to switch to fourth tab")), this);
connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
propertiesShortcut = new QShortcut(QKeySequence("Alt+P"), this);
connect(propertiesShortcut, SIGNAL(activated()), this, SLOT(on_actionTorrent_Properties_triggered()));
optionsShortcut = new QShortcut(QKeySequence("Alt+O"), this);
connect(optionsShortcut, SIGNAL(activated()), this, SLOT(on_actionOptions_triggered()));
delShortcut = new QShortcut(QKeySequence("Del"), this);
connect(delShortcut, SIGNAL(activated()), this, SLOT(on_actionDelete_triggered()));
delPermShortcut = new QShortcut(QKeySequence("Shift+Del"), this);
connect(delPermShortcut, SIGNAL(activated()), this, SLOT(on_actionDelete_Permanently_triggered()));
startShortcut = new QShortcut(QKeySequence("Ctrl+S"), this);
connect(startShortcut, SIGNAL(activated()), this, SLOT(on_actionStart_triggered()));
startAllShortcut = new QShortcut(QKeySequence("Ctrl+Shift+S"), this);
connect(startAllShortcut, SIGNAL(activated()), this, SLOT(on_actionStart_All_triggered()));
pauseShortcut = new QShortcut(QKeySequence("Ctrl+P"), this);
connect(pauseShortcut, SIGNAL(activated()), this, SLOT(on_actionPause_triggered()));
pauseAllPermShortcut = new QShortcut(QKeySequence("Ctrl+Shift+P"), this);
connect(pauseAllPermShortcut, SIGNAL(activated()), this, SLOT(on_actionPause_All_triggered()));
}
// Keyboard shortcuts slots
void GUI::displayDownTab(){
tabs->setCurrentIndex(0);
}
void GUI::displayUpTab(){
tabs->setCurrentIndex(1);
}
void GUI::displaySearchTab(){
tabs->setCurrentIndex(2);
}
void GUI::displayRSSTab(){
tabs->setCurrentIndex(3);
}
// End of keyboard shortcuts slots
void GUI::readSettings() {
QSettings settings("qBittorrent", "qBittorrent");
settings.beginGroup("MainWindow");

23
src/GUI.h

@ -53,6 +53,7 @@ class QTcpServer; @@ -53,6 +53,7 @@ class QTcpServer;
class QTcpSocket;
class QCloseEvent;
class RSSImp;
class QShortcut;
using namespace libtorrent;
namespace fs = boost::filesystem;
@ -86,6 +87,22 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -86,6 +87,22 @@ class GUI : public QMainWindow, private Ui::MainWindow{
bool delayedSorting;
Qt::SortOrder delayedSortingOrder;
QMutex DLListAccess;
// Keyboard shortcuts
QShortcut *createShortcut;
QShortcut *openShortcut;
QShortcut *quitShortcut;
QShortcut *switchSearchShortcut;
QShortcut *switchDownShortcut;
QShortcut *switchUpShortcut;
QShortcut *switchRSSShortcut;
QShortcut *propertiesShortcut;
QShortcut *optionsShortcut;
QShortcut *delShortcut;
QShortcut *delPermShortcut;
QShortcut *startShortcut;
QShortcut *startAllShortcut;
QShortcut *pauseShortcut;
QShortcut *pauseAllPermShortcut;
// Preview
previewSelect *previewSelection;
QProcess *previewProcess;
@ -130,6 +147,12 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -130,6 +147,12 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionExit_triggered();
void createTrayIcon();
void addLogPeerBlocked(const QString&);
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayDownTab();
void displayUpTab();
void displaySearchTab();
void displayRSSTab();
// Torrent actions
void showProperties(const QModelIndex &index);
void on_actionTorrent_Properties_triggered();

Loading…
Cancel
Save