DolphinQt: Simplify action setup.

We don't need two sets of actions (one with icons, one without icons)
for Play/Stop, we can just tell Qt not to display the icons in the menus.
This commit is contained in:
waddlesplash 2015-09-12 11:24:00 -04:00
parent 5db4a60995
commit 436f1133dd
2 changed files with 21 additions and 26 deletions

View File

@ -70,10 +70,8 @@ DMainWindow::DMainWindow(QWidget* parent_widget)
connect(m_ui->actionIconView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionPlay, &QAction::triggered, this, &DMainWindow::OnPlay);
connect(m_ui->actionPlay_mnu, &QAction::triggered, this, &DMainWindow::OnPlay);
connect(m_game_tracker, &DGameTracker::StartGame, this, &DMainWindow::OnPlay);
connect(m_ui->actionStop, &QAction::triggered, this, &DMainWindow::OnStop);
connect(m_ui->actionStop_mnu, &QAction::triggered, this, &DMainWindow::OnStop);
connect(m_ui->actionReset, &QAction::triggered, this, &DMainWindow::OnReset);
connect(m_ui->actionWebsite, &QAction::triggered, this, [&]() {
@ -339,13 +337,11 @@ void DMainWindow::OnCoreStateChanged(Core::EState state)
{
m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PAUSE));
m_ui->actionPlay->setText(tr("Pause"));
m_ui->actionPlay_mnu->setText(tr("Pause"));
}
else if (is_paused || is_not_initialized)
{
m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PLAY));
m_ui->actionPlay->setText(tr("Play"));
m_ui->actionPlay_mnu->setText(tr("Play"));
}
m_ui->actionStop->setEnabled(!is_not_initialized);

View File

@ -19,9 +19,6 @@
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>
</property>
@ -32,9 +29,12 @@
<x>0</x>
<y>0</y>
<width>990</width>
<height>19</height>
<height>21</height>
</rect>
</property>
<property name="nativeMenuBar">
<bool>true</bool>
</property>
<widget class="QMenu" name="mnuFile">
<property name="title">
<string>Fi&amp;le</string>
@ -49,8 +49,8 @@
<property name="title">
<string>E&amp;mulation</string>
</property>
<addaction name="actionPlay_mnu"/>
<addaction name="actionStop_mnu"/>
<addaction name="actionPlay"/>
<addaction name="actionStop"/>
<addaction name="actionReset"/>
</widget>
<widget class="QMenu" name="mnuOptions">
@ -108,6 +108,9 @@
<property name="windowTitle">
<string>Toolbar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -160,11 +163,23 @@
<property name="text">
<string>Play</string>
</property>
<property name="shortcut">
<string>F10</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
</action>
<action name="actionStop">
<property name="text">
<string>Stop</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
</action>
<action name="actionAboutQt">
<property name="text">
@ -216,22 +231,6 @@
<string>Exit</string>
</property>
</action>
<action name="actionPlay_mnu">
<property name="text">
<string>&amp;Play</string>
</property>
<property name="shortcut">
<string>F10</string>
</property>
</action>
<action name="actionStop_mnu">
<property name="text">
<string>&amp;Stop</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="actionReset">
<property name="text">
<string>&amp;Reset</string>