mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Add option to hide status bar (#5983)
* reorganize actions * add setting to settingsCache * use setting * add shortcut * fix typo
This commit is contained in:
parent
f059643187
commit
da2488f7d8
7 changed files with 44 additions and 3 deletions
|
|
@ -62,6 +62,7 @@
|
|||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QPixmapCache>
|
||||
#include <QStatusBar>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
|
@ -665,6 +666,7 @@ void MainWindow::retranslateUi()
|
|||
aFullScreen->setText(tr("&Full screen"));
|
||||
aRegister->setText(tr("&Register to server..."));
|
||||
aForgotPassword->setText(tr("&Restore password..."));
|
||||
aStatusBar->setText(tr("Show Status Bar"));
|
||||
aSettings->setText(tr("&Settings..."));
|
||||
aSettings->setIcon(QPixmap("theme:icons/settings"));
|
||||
aExit->setText(tr("&Exit"));
|
||||
|
|
@ -709,6 +711,10 @@ void MainWindow::createActions()
|
|||
connect(aSinglePlayer, &QAction::triggered, this, &MainWindow::actSinglePlayer);
|
||||
aWatchReplay = new QAction(this);
|
||||
connect(aWatchReplay, &QAction::triggered, this, &MainWindow::actWatchReplay);
|
||||
aStatusBar = new QAction(this);
|
||||
aStatusBar->setCheckable(true);
|
||||
aStatusBar->setChecked(SettingsCache::instance().getShowStatusBar());
|
||||
connect(aStatusBar, &QAction::triggered, &SettingsCache::instance(), &SettingsCache::setShowStatusBar);
|
||||
aFullScreen = new QAction(this);
|
||||
aFullScreen->setCheckable(true);
|
||||
connect(aFullScreen, &QAction::toggled, this, &MainWindow::actFullScreen);
|
||||
|
|
@ -795,8 +801,10 @@ void MainWindow::createMenus()
|
|||
cockatriceMenu->addAction(aSinglePlayer);
|
||||
cockatriceMenu->addAction(aWatchReplay);
|
||||
cockatriceMenu->addSeparator();
|
||||
cockatriceMenu->addAction(aStatusBar);
|
||||
cockatriceMenu->addAction(aFullScreen);
|
||||
cockatriceMenu->addSeparator();
|
||||
|
||||
cockatriceMenu->addAction(aSettings);
|
||||
cockatriceMenu->addAction(aExit);
|
||||
|
||||
|
|
@ -878,6 +886,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
createTrayIcon();
|
||||
}
|
||||
|
||||
// status bar
|
||||
connect(&SettingsCache::instance(), &SettingsCache::showStatusBarChanged, this,
|
||||
[this](bool show) { statusBar()->setVisible(show); });
|
||||
statusBar()->setVisible(SettingsCache::instance().getShowStatusBar());
|
||||
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&MainWindow::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
|
@ -1277,6 +1290,7 @@ void MainWindow::refreshShortcuts()
|
|||
aDisconnect->setShortcuts(shortcuts.getShortcut("MainWindow/aDisconnect"));
|
||||
aSinglePlayer->setShortcuts(shortcuts.getShortcut("MainWindow/aSinglePlayer"));
|
||||
aWatchReplay->setShortcuts(shortcuts.getShortcut("MainWindow/aWatchReplay"));
|
||||
aStatusBar->setShortcuts(shortcuts.getShortcut("MainWindow/aStatusBar"));
|
||||
aFullScreen->setShortcuts(shortcuts.getShortcut("MainWindow/aFullScreen"));
|
||||
aRegister->setShortcuts(shortcuts.getShortcut("MainWindow/aRegister"));
|
||||
aSettings->setShortcuts(shortcuts.getShortcut("MainWindow/aSettings"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue