mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -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 <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
#include <QStatusBar>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
@ -665,6 +666,7 @@ void MainWindow::retranslateUi()
|
||||||
aFullScreen->setText(tr("&Full screen"));
|
aFullScreen->setText(tr("&Full screen"));
|
||||||
aRegister->setText(tr("&Register to server..."));
|
aRegister->setText(tr("&Register to server..."));
|
||||||
aForgotPassword->setText(tr("&Restore password..."));
|
aForgotPassword->setText(tr("&Restore password..."));
|
||||||
|
aStatusBar->setText(tr("Show Status Bar"));
|
||||||
aSettings->setText(tr("&Settings..."));
|
aSettings->setText(tr("&Settings..."));
|
||||||
aSettings->setIcon(QPixmap("theme:icons/settings"));
|
aSettings->setIcon(QPixmap("theme:icons/settings"));
|
||||||
aExit->setText(tr("&Exit"));
|
aExit->setText(tr("&Exit"));
|
||||||
|
|
@ -709,6 +711,10 @@ void MainWindow::createActions()
|
||||||
connect(aSinglePlayer, &QAction::triggered, this, &MainWindow::actSinglePlayer);
|
connect(aSinglePlayer, &QAction::triggered, this, &MainWindow::actSinglePlayer);
|
||||||
aWatchReplay = new QAction(this);
|
aWatchReplay = new QAction(this);
|
||||||
connect(aWatchReplay, &QAction::triggered, this, &MainWindow::actWatchReplay);
|
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 = new QAction(this);
|
||||||
aFullScreen->setCheckable(true);
|
aFullScreen->setCheckable(true);
|
||||||
connect(aFullScreen, &QAction::toggled, this, &MainWindow::actFullScreen);
|
connect(aFullScreen, &QAction::toggled, this, &MainWindow::actFullScreen);
|
||||||
|
|
@ -795,8 +801,10 @@ void MainWindow::createMenus()
|
||||||
cockatriceMenu->addAction(aSinglePlayer);
|
cockatriceMenu->addAction(aSinglePlayer);
|
||||||
cockatriceMenu->addAction(aWatchReplay);
|
cockatriceMenu->addAction(aWatchReplay);
|
||||||
cockatriceMenu->addSeparator();
|
cockatriceMenu->addSeparator();
|
||||||
|
cockatriceMenu->addAction(aStatusBar);
|
||||||
cockatriceMenu->addAction(aFullScreen);
|
cockatriceMenu->addAction(aFullScreen);
|
||||||
cockatriceMenu->addSeparator();
|
cockatriceMenu->addSeparator();
|
||||||
|
|
||||||
cockatriceMenu->addAction(aSettings);
|
cockatriceMenu->addAction(aSettings);
|
||||||
cockatriceMenu->addAction(aExit);
|
cockatriceMenu->addAction(aExit);
|
||||||
|
|
||||||
|
|
@ -878,6 +886,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
createTrayIcon();
|
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,
|
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||||
&MainWindow::refreshShortcuts);
|
&MainWindow::refreshShortcuts);
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
@ -1277,6 +1290,7 @@ void MainWindow::refreshShortcuts()
|
||||||
aDisconnect->setShortcuts(shortcuts.getShortcut("MainWindow/aDisconnect"));
|
aDisconnect->setShortcuts(shortcuts.getShortcut("MainWindow/aDisconnect"));
|
||||||
aSinglePlayer->setShortcuts(shortcuts.getShortcut("MainWindow/aSinglePlayer"));
|
aSinglePlayer->setShortcuts(shortcuts.getShortcut("MainWindow/aSinglePlayer"));
|
||||||
aWatchReplay->setShortcuts(shortcuts.getShortcut("MainWindow/aWatchReplay"));
|
aWatchReplay->setShortcuts(shortcuts.getShortcut("MainWindow/aWatchReplay"));
|
||||||
|
aStatusBar->setShortcuts(shortcuts.getShortcut("MainWindow/aStatusBar"));
|
||||||
aFullScreen->setShortcuts(shortcuts.getShortcut("MainWindow/aFullScreen"));
|
aFullScreen->setShortcuts(shortcuts.getShortcut("MainWindow/aFullScreen"));
|
||||||
aRegister->setShortcuts(shortcuts.getShortcut("MainWindow/aRegister"));
|
aRegister->setShortcuts(shortcuts.getShortcut("MainWindow/aRegister"));
|
||||||
aSettings->setShortcuts(shortcuts.getShortcut("MainWindow/aSettings"));
|
aSettings->setShortcuts(shortcuts.getShortcut("MainWindow/aSettings"));
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,12 @@ private:
|
||||||
|
|
||||||
QList<QMenu *> tabMenus;
|
QList<QMenu *> tabMenus;
|
||||||
QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu;
|
QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu;
|
||||||
QAction *aConnect, *aDisconnect, *aSinglePlayer, *aWatchReplay, *aFullScreen, *aSettings, *aExit, *aAbout, *aTips,
|
QAction *aAbout, *aSettings, *aShow, *aExit;
|
||||||
*aCheckCardUpdates, *aRegister, *aForgotPassword, *aUpdate, *aViewLog, *aManageSets, *aEditTokens,
|
QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aStatusBar,
|
||||||
*aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet, *aReloadCardDatabase, *aShow, *aOpenSettingsFolder;
|
*aFullScreen;
|
||||||
|
QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet,
|
||||||
|
*aReloadCardDatabase;
|
||||||
|
QAction *aTips, *aUpdate, *aCheckCardUpdates, *aViewLog, *aOpenSettingsFolder;
|
||||||
|
|
||||||
TabSupervisor *tabSupervisor;
|
TabSupervisor *tabSupervisor;
|
||||||
WndSets *wndSets;
|
WndSets *wndSets;
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ SettingsCache::SettingsCache()
|
||||||
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
||||||
|
|
||||||
picDownload = settings->value("personal/picturedownload", true).toBool();
|
picDownload = settings->value("personal/picturedownload", true).toBool();
|
||||||
|
showStatusBar = settings->value("personal/showStatusBar", true).toBool();
|
||||||
|
|
||||||
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
|
||||||
tokenDialogGeometry = settings->value("interface/token_dialog_geometry").toByteArray();
|
tokenDialogGeometry = settings->value("interface/token_dialog_geometry").toByteArray();
|
||||||
|
|
@ -589,6 +590,13 @@ void SettingsCache::setPicDownload(QT_STATE_CHANGED_T _picDownload)
|
||||||
emit picDownloadChanged();
|
emit picDownloadChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setShowStatusBar(bool value)
|
||||||
|
{
|
||||||
|
showStatusBar = value;
|
||||||
|
settings->setValue("personal/showStatusBar", showStatusBar);
|
||||||
|
emit showStatusBarChanged(value);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled)
|
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled)
|
||||||
{
|
{
|
||||||
notificationsEnabled = static_cast<bool>(_notificationsEnabled);
|
notificationsEnabled = static_cast<bool>(_notificationsEnabled);
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ signals:
|
||||||
void cardDatabasePathChanged();
|
void cardDatabasePathChanged();
|
||||||
void themeChanged();
|
void themeChanged();
|
||||||
void picDownloadChanged();
|
void picDownloadChanged();
|
||||||
|
void showStatusBarChanged(bool state);
|
||||||
void displayCardNamesChanged();
|
void displayCardNamesChanged();
|
||||||
void overrideAllCardArtWithPersonalPreferenceChanged(bool _overrideAllCardArtWithPersonalPreference);
|
void overrideAllCardArtWithPersonalPreferenceChanged(bool _overrideAllCardArtWithPersonalPreference);
|
||||||
void bumpSetsWithCardsInDeckToTopChanged();
|
void bumpSetsWithCardsInDeckToTopChanged();
|
||||||
|
|
@ -222,6 +223,7 @@ private:
|
||||||
QList<ReleaseChannel *> releaseChannels;
|
QList<ReleaseChannel *> releaseChannels;
|
||||||
bool isPortableBuild;
|
bool isPortableBuild;
|
||||||
bool roundCardCorners;
|
bool roundCardCorners;
|
||||||
|
bool showStatusBar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsCache();
|
SettingsCache();
|
||||||
|
|
@ -333,6 +335,10 @@ public:
|
||||||
{
|
{
|
||||||
return picDownload;
|
return picDownload;
|
||||||
}
|
}
|
||||||
|
bool getShowStatusBar() const
|
||||||
|
{
|
||||||
|
return showStatusBar;
|
||||||
|
}
|
||||||
bool getNotificationsEnabled() const
|
bool getNotificationsEnabled() const
|
||||||
{
|
{
|
||||||
return notificationsEnabled;
|
return notificationsEnabled;
|
||||||
|
|
@ -828,6 +834,7 @@ public slots:
|
||||||
void setChatMentionColor(const QString &_chatMentionColor);
|
void setChatMentionColor(const QString &_chatMentionColor);
|
||||||
void setChatHighlightColor(const QString &_chatHighlightColor);
|
void setChatHighlightColor(const QString &_chatHighlightColor);
|
||||||
void setPicDownload(QT_STATE_CHANGED_T _picDownload);
|
void setPicDownload(QT_STATE_CHANGED_T _picDownload);
|
||||||
|
void setShowStatusBar(bool value);
|
||||||
void setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled);
|
void setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled);
|
||||||
void setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T _spectatorNotificationsEnabled);
|
void setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T _spectatorNotificationsEnabled);
|
||||||
void setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T _buddyConnectNotificationsEnabled);
|
void setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T _buddyConnectNotificationsEnabled);
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,9 @@ private:
|
||||||
ShortcutGroup::Main_Window)},
|
ShortcutGroup::Main_Window)},
|
||||||
{"MainWindow/aExit",
|
{"MainWindow/aExit",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exit"), parseSequenceString(""), ShortcutGroup::Main_Window)},
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exit"), parseSequenceString(""), ShortcutGroup::Main_Window)},
|
||||||
|
{"MainWindow/aStatusBar", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Show Status Bar"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Main_Window)},
|
||||||
{"MainWindow/aFullScreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Full screen"),
|
{"MainWindow/aFullScreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Full screen"),
|
||||||
parseSequenceString("Ctrl+F"),
|
parseSequenceString("Ctrl+F"),
|
||||||
ShortcutGroup::Main_Window)},
|
ShortcutGroup::Main_Window)},
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,9 @@ void SettingsCache::setTabLogOpen(bool /*value*/)
|
||||||
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
|
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setShowStatusBar(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */)
|
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,9 @@ void SettingsCache::setTabLogOpen(bool /*value*/)
|
||||||
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
|
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setShowStatusBar(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */)
|
void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue