mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Qt: Make toolbar more dynamic
This commit is contained in:
@ -18,10 +18,13 @@ static QSize ICON_SIZE(32, 32);
|
||||
ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
|
||||
{
|
||||
setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
setMovable(false);
|
||||
setMovable(!Settings::Instance().AreWidgetsLocked());
|
||||
setFloatable(false);
|
||||
setIconSize(ICON_SIZE);
|
||||
|
||||
setWindowTitle(tr("Toolbar"));
|
||||
setObjectName(QStringLiteral("toolbar"));
|
||||
|
||||
MakeActions();
|
||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &ToolBar::UpdateIcons);
|
||||
UpdateIcons();
|
||||
@ -31,6 +34,11 @@ ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
|
||||
|
||||
connect(&Settings::Instance(), &Settings::DebugModeToggled, this, &ToolBar::OnDebugModeToggled);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ToolBarVisibilityChanged, this, &ToolBar::setVisible);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::WidgetLockChanged, this,
|
||||
[this](bool locked) { setMovable(!locked); });
|
||||
|
||||
OnEmulationStateChanged(Core::GetState());
|
||||
OnDebugModeToggled(Settings::Instance().IsDebugModeEnabled());
|
||||
}
|
||||
@ -49,6 +57,11 @@ void ToolBar::OnEmulationStateChanged(Core::State state)
|
||||
m_pause_action->setVisible(playing);
|
||||
}
|
||||
|
||||
void ToolBar::closeEvent(QCloseEvent*)
|
||||
{
|
||||
Settings::Instance().SetToolBarVisible(false);
|
||||
}
|
||||
|
||||
void ToolBar::OnDebugModeToggled(bool enabled)
|
||||
{
|
||||
m_step_action->setVisible(enabled);
|
||||
|
Reference in New Issue
Block a user