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->actionIconView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionPlay, &QAction::triggered, this, &DMainWindow::OnPlay); 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_game_tracker, &DGameTracker::StartGame, this, &DMainWindow::OnPlay);
connect(m_ui->actionStop, &QAction::triggered, this, &DMainWindow::OnStop); 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->actionReset, &QAction::triggered, this, &DMainWindow::OnReset);
connect(m_ui->actionWebsite, &QAction::triggered, this, [&]() { 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->setIcon(Resources::GetIcon(Resources::TOOLBAR_PAUSE));
m_ui->actionPlay->setText(tr("Pause")); m_ui->actionPlay->setText(tr("Pause"));
m_ui->actionPlay_mnu->setText(tr("Pause"));
} }
else if (is_paused || is_not_initialized) else if (is_paused || is_not_initialized)
{ {
m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PLAY)); m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PLAY));
m_ui->actionPlay->setText(tr("Play")); m_ui->actionPlay->setText(tr("Play"));
m_ui->actionPlay_mnu->setText(tr("Play"));
} }
m_ui->actionStop->setEnabled(!is_not_initialized); m_ui->actionStop->setEnabled(!is_not_initialized);

View File

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