Skip to content

Commit

Permalink
opt: remove words zoom in(out) from the menu and keep the shortcut (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang authored Dec 31, 2024
1 parent 68522ad commit 861c1d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/ui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <QGuiApplication>
#include <QWebEngineSettings>
#include <QProxyStyle>
#include <QShortcut>

#ifdef HAVE_X11
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
Expand Down Expand Up @@ -392,16 +393,16 @@ MainWindow::MainWindow( Config::Class & cfg_ ):

ui.menuZoom->addSeparator();

wordsZoomIn = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomin.png" ), tr( "Words Zoom In" ) );
wordsZoomIn->setShortcuts( QList< QKeySequence >() << QKeySequence( "Alt++" ) << QKeySequence( "Alt+=" ) );
wordsZoomOut = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomout.png" ), tr( "Words Zoom Out" ) );
wordsZoomOut->setShortcut( QKeySequence( "Alt+-" ) );
wordsZoomBase = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoombase.png" ), tr( "Words Normal Size" ) );
wordsZoomBase->setShortcut( QKeySequence( "Alt+0" ) );
wordsZoomIn = new QShortcut( this );
wordsZoomIn->setKey( QKeySequence( "Alt+=" ) );
wordsZoomOut = new QShortcut( this );
wordsZoomOut->setKey( QKeySequence( "Alt+-" ) );
wordsZoomBase = new QShortcut( this );
wordsZoomBase->setKey( QKeySequence( "Alt+0" ) );

connect( wordsZoomIn, &QAction::triggered, this, &MainWindow::doWordsZoomIn );
connect( wordsZoomOut, &QAction::triggered, this, &MainWindow::doWordsZoomOut );
connect( wordsZoomBase, &QAction::triggered, this, &MainWindow::doWordsZoomBase );
connect( wordsZoomIn, &QShortcut::activated, this, &MainWindow::doWordsZoomIn );
connect( wordsZoomOut, &QShortcut::activated, this, &MainWindow::doWordsZoomOut );
connect( wordsZoomBase, &QShortcut::activated, this, &MainWindow::doWordsZoomBase );

// tray icon
#ifndef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
Expand Down
3 changes: 2 additions & 1 deletion src/ui/mainwindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#endif
//must place the qactiongroup after fixx11h.h, None in QActionGroup conflict with X.h's macro None.
#include <QActionGroup>
#include <QShortcut>

using std::string;
using std::vector;
Expand Down Expand Up @@ -118,7 +119,7 @@ private:
QAction *navBack, *navForward, *navPronounce, *enableScanningAction;
QAction * beforeOptionsSeparator;
QAction *zoomIn, *zoomOut, *zoomBase;
QAction *wordsZoomIn, *wordsZoomOut, *wordsZoomBase;
QShortcut *wordsZoomIn, *wordsZoomOut, *wordsZoomBase;
QAction *addToFavorites, *beforeAddToFavoritesSeparator;
QMenu trayIconMenu;
QMenu * tabMenu;
Expand Down

0 comments on commit 861c1d4

Please sign in to comment.