mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 19:43:26 -08:00
[Client] Settings: add top-right cogwheel shortcut (#7485)
* [Client] Settings: add top-right cogwheel shortcut Add a subtle flat settings button to the tab bar corner that opens the settings dialog via the existing menu action slot. Icon and tooltip follow the menu action in retranslateUi. * [Client] Settings: flat black-cogwheel corner entry per review --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
860625be4d
commit
4974cac59a
2 changed files with 20 additions and 0 deletions
|
|
@ -82,10 +82,12 @@
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QSize>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QStringLiteral>
|
#include <QStringLiteral>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
@ -355,6 +357,9 @@ void MainWindow::retranslateUi()
|
||||||
aForgotPassword->setText(tr("&Restore password..."));
|
aForgotPassword->setText(tr("&Restore password..."));
|
||||||
aSettings->setText(tr("&Settings..."));
|
aSettings->setText(tr("&Settings..."));
|
||||||
aSettings->setIcon(themePixmap(QStringLiteral("icons/settings")));
|
aSettings->setIcon(themePixmap(QStringLiteral("icons/settings")));
|
||||||
|
settingsButton->setToolTip(tr("Settings"));
|
||||||
|
settingsButton->setAccessibleName(tr("Settings"));
|
||||||
|
settingsButton->setIcon(themePixmap(QStringLiteral("icons/cogwheel")));
|
||||||
aExit->setText(tr("&Exit"));
|
aExit->setText(tr("&Exit"));
|
||||||
|
|
||||||
#if defined(__APPLE__) /* For OSX */
|
#if defined(__APPLE__) /* For OSX */
|
||||||
|
|
@ -559,6 +564,19 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
setCentralWidget(tabSupervisor);
|
setCentralWidget(tabSupervisor);
|
||||||
|
|
||||||
|
// Unobtrusive settings entry in the tab bar corner: flat icon-only button that blends into the tab
|
||||||
|
// bar until hovered, mirroring the menu action for discoverability
|
||||||
|
settingsButton = new QToolButton(tabSupervisor);
|
||||||
|
settingsButton->setAutoRaise(true);
|
||||||
|
settingsButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
|
settingsButton->setIconSize(QSize(16, 16));
|
||||||
|
settingsButton->setCursor(Qt::PointingHandCursor);
|
||||||
|
settingsButton->setFocusPolicy(Qt::NoFocus);
|
||||||
|
settingsButton->setStyleSheet(
|
||||||
|
QStringLiteral("QToolButton { border: none; background: transparent; padding: 4px; }"));
|
||||||
|
connect(settingsButton, &QToolButton::clicked, this, &MainWindow::actSettings);
|
||||||
|
tabSupervisor->setCornerWidget(settingsButton, Qt::TopRightCorner);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
if (!restoreGeometry(SettingsCache::instance().layouts().getMainWindowGeometry())) {
|
if (!restoreGeometry(SettingsCache::instance().layouts().getMainWindowGeometry())) {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
#include <qtmetamacros.h>
|
#include <qtmetamacros.h>
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QToolButton;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
struct LocalGameOptions;
|
struct LocalGameOptions;
|
||||||
|
|
||||||
|
|
@ -178,6 +179,7 @@ private:
|
||||||
QList<QMenu *> tabMenus;
|
QList<QMenu *> tabMenus;
|
||||||
QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu;
|
QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu;
|
||||||
QAction *aAbout, *aSettings, *aShow, *aExit;
|
QAction *aAbout, *aSettings, *aShow, *aExit;
|
||||||
|
QToolButton *settingsButton = nullptr;
|
||||||
QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aFullScreen;
|
QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aFullScreen;
|
||||||
QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet,
|
QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet,
|
||||||
*aReloadCardDatabase;
|
*aReloadCardDatabase;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue