Browse Source

Merge pull request #14567 from glassez/desktop

Clean up the code
adaptive-webui-19844
Vladimir Golovnev 4 years ago committed by GitHub
parent
commit
ea1c4a8fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      src/gui/mainwindow.cpp
  2. 2
      src/gui/torrentcontentmodelitem.cpp
  3. 5
      src/gui/utils.cpp

33
src/gui/mainwindow.cpp

@ -30,6 +30,7 @@
#include <chrono> #include <chrono>
#include <QActionGroup>
#include <QClipboard> #include <QClipboard>
#include <QCloseEvent> #include <QCloseEvent>
#include <QDebug> #include <QDebug>
@ -876,36 +877,36 @@ void MainWindow::createKeyboardShortcuts()
m_ui->actionOpen->setShortcut(QKeySequence::Open); m_ui->actionOpen->setShortcut(QKeySequence::Open);
m_ui->actionDelete->setShortcut(QKeySequence::Delete); m_ui->actionDelete->setShortcut(QKeySequence::Delete);
m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here
m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_O);
m_ui->actionExit->setShortcut(Qt::CTRL + Qt::Key_Q); m_ui->actionExit->setShortcut(Qt::CTRL | Qt::Key_Q);
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
m_ui->actionCloseWindow->setShortcut(QKeySequence::Close); m_ui->actionCloseWindow->setShortcut(QKeySequence::Close);
#else #else
m_ui->actionCloseWindow->setVisible(false); m_ui->actionCloseWindow->setVisible(false);
#endif #endif
const auto *switchTransferShortcut = new QShortcut(Qt::ALT + Qt::Key_1, this); const auto *switchTransferShortcut = new QShortcut((Qt::ALT | Qt::Key_1), this);
connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab); connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab);
const auto *switchSearchShortcut = new QShortcut(Qt::ALT + Qt::Key_2, this); const auto *switchSearchShortcut = new QShortcut((Qt::ALT | Qt::Key_2), this);
connect(switchSearchShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displaySearchTab)); connect(switchSearchShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displaySearchTab));
const auto *switchRSSShortcut = new QShortcut(Qt::ALT + Qt::Key_3, this); const auto *switchRSSShortcut = new QShortcut((Qt::ALT | Qt::Key_3), this);
connect(switchRSSShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displayRSSTab)); connect(switchRSSShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displayRSSTab));
const auto *switchExecutionLogShortcut = new QShortcut(Qt::ALT + Qt::Key_4, this); const auto *switchExecutionLogShortcut = new QShortcut((Qt::ALT | Qt::Key_4), this);
connect(switchExecutionLogShortcut, &QShortcut::activated, this, &MainWindow::displayExecutionLogTab); connect(switchExecutionLogShortcut, &QShortcut::activated, this, &MainWindow::displayExecutionLogTab);
const auto *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, m_transferListWidget); const auto *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, m_transferListWidget);
connect(switchSearchFilterShortcut, &QShortcut::activated, this, &MainWindow::focusSearchFilter); connect(switchSearchFilterShortcut, &QShortcut::activated, this, &MainWindow::focusSearchFilter);
m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents); m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents);
m_ui->actionOptions->setShortcut(Qt::ALT + Qt::Key_O); m_ui->actionOptions->setShortcut(Qt::ALT | Qt::Key_O);
m_ui->actionStatistics->setShortcut(Qt::CTRL + Qt::Key_I); m_ui->actionStatistics->setShortcut(Qt::CTRL | Qt::Key_I);
m_ui->actionStart->setShortcut(Qt::CTRL + Qt::Key_S); m_ui->actionStart->setShortcut(Qt::CTRL | Qt::Key_S);
m_ui->actionStartAll->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); m_ui->actionStartAll->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_S);
m_ui->actionPause->setShortcut(Qt::CTRL + Qt::Key_P); m_ui->actionPause->setShortcut(Qt::CTRL | Qt::Key_P);
m_ui->actionPauseAll->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_P); m_ui->actionPauseAll->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_P);
m_ui->actionBottomQueuePos->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); m_ui->actionBottomQueuePos->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Minus);
m_ui->actionDecreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Minus); m_ui->actionDecreaseQueuePos->setShortcut(Qt::CTRL | Qt::Key_Minus);
m_ui->actionIncreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Plus); m_ui->actionIncreaseQueuePos->setShortcut(Qt::CTRL | Qt::Key_Plus);
m_ui->actionTopQueuePos->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Plus); m_ui->actionTopQueuePos->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Plus);
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
m_ui->actionMinimize->setShortcut(Qt::CTRL + Qt::Key_M); m_ui->actionMinimize->setShortcut(Qt::CTRL + Qt::Key_M);
addAction(m_ui->actionMinimize); addAction(m_ui->actionMinimize);

2
src/gui/torrentcontentmodelitem.cpp

@ -142,7 +142,7 @@ QString TorrentContentModelItem::displayData(const int column) const
const QString value = (avail >= 1) const QString value = (avail >= 1)
? QString::fromLatin1("100") ? QString::fromLatin1("100")
: Utils::String::fromDouble((avail * 100), 1); : Utils::String::fromDouble((avail * 100), 1);
return {value + C_THIN_SPACE + QLatin1Char('%')}; return (value + C_THIN_SPACE + QLatin1Char('%'));
} }
default: default:
Q_ASSERT(false); Q_ASSERT(false);

5
src/gui/utils.cpp

@ -35,7 +35,6 @@
#include <QApplication> #include <QApplication>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDesktopWidget>
#include <QFileInfo> #include <QFileInfo>
#include <QIcon> #include <QIcon>
#include <QPixmap> #include <QPixmap>
@ -49,6 +48,10 @@
#include <QWidget> #include <QWidget>
#include <QWindow> #include <QWindow>
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) && defined(Q_OS_WIN)
#include <QDesktopWidget>
#endif
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "base/utils/version.h" #include "base/utils/version.h"

Loading…
Cancel
Save