Browse Source

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

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

1
Changelog

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

3
TODO

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

92
src/GUI.cpp

@ -28,6 +28,7 @@
#include <QTcpSocket> #include <QTcpSocket>
#include <QCloseEvent> #include <QCloseEvent>
#include <QMutexLocker> #include <QMutexLocker>
#include <QShortcut>
#include <libtorrent/extensions/metadata_transfer.hpp> #include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_pex.hpp> #include <libtorrent/extensions/ut_pex.hpp>
@ -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("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"); setInfoBar(tr("Be careful, sharing copyrighted material without permission is against the law."), "red");
show(); show();
createKeyboardShortcuts();
qDebug("GUI Built"); qDebug("GUI Built");
} }
@ -208,17 +210,33 @@ GUI::~GUI(){
delete checkConnect; delete checkConnect;
delete refresher; delete refresher;
delete BTSession; delete BTSession;
if(systrayIntegration){ if(systrayIntegration){
delete myTrayIcon; delete myTrayIcon;
delete myTrayIconMenu; delete myTrayIconMenu;
} }
delete DLDelegate; delete DLDelegate;
delete DLListModel; delete DLListModel;
delete tcpServer; delete tcpServer;
previewProcess->kill(); previewProcess->kill();
previewProcess->waitForFinished(); previewProcess->waitForFinished();
delete previewProcess; delete previewProcess;
delete connecStatusLblIcon; 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(){ void GUI::on_actionWebsite_triggered(){
@ -241,6 +259,58 @@ void GUI::writeSettings() {
settings.endGroup(); 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() { void GUI::readSettings() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
settings.beginGroup("MainWindow"); settings.beginGroup("MainWindow");

23
src/GUI.h

@ -53,6 +53,7 @@ class QTcpServer;
class QTcpSocket; class QTcpSocket;
class QCloseEvent; class QCloseEvent;
class RSSImp; class RSSImp;
class QShortcut;
using namespace libtorrent; using namespace libtorrent;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@ -86,6 +87,22 @@ class GUI : public QMainWindow, private Ui::MainWindow{
bool delayedSorting; bool delayedSorting;
Qt::SortOrder delayedSortingOrder; Qt::SortOrder delayedSortingOrder;
QMutex DLListAccess; 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 // Preview
previewSelect *previewSelection; previewSelect *previewSelection;
QProcess *previewProcess; QProcess *previewProcess;
@ -130,6 +147,12 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionExit_triggered(); void on_actionExit_triggered();
void createTrayIcon(); void createTrayIcon();
void addLogPeerBlocked(const QString&); void addLogPeerBlocked(const QString&);
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayDownTab();
void displayUpTab();
void displaySearchTab();
void displayRSSTab();
// Torrent actions // Torrent actions
void showProperties(const QModelIndex &index); void showProperties(const QModelIndex &index);
void on_actionTorrent_Properties_triggered(); void on_actionTorrent_Properties_triggered();

Loading…
Cancel
Save