Add a few buttons to the toolbar.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2017-10-14 20:42:23 +01:00
parent 8dd454af4d
commit bcf57a4e19
2 changed files with 31 additions and 1 deletions

View file

@ -168,13 +168,17 @@ QApple::QApple(QWidget *parent) :
{ {
setupUi(this); setupUi(this);
actionStart->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
actionPause->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
actionReboot->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward));
myEmulator = new Emulator(mdiArea); myEmulator = new Emulator(mdiArea);
myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
myMSGap = 5; myMSGap = 5;
on_actionPause_triggered();
initialiseEmulator(); initialiseEmulator();
startEmulator(myEmulatorWindow); startEmulator(myEmulatorWindow);
} }
@ -225,6 +229,10 @@ void QApple::on_actionStart_triggered()
myElapsedTimer.start(); myElapsedTimer.start();
actionPause->setEnabled(true); actionPause->setEnabled(true);
actionStart->setEnabled(false); actionStart->setEnabled(false);
actionChange->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
actionChange->disconnect(SIGNAL(triggered(bool)));
connect(actionChange, SIGNAL(triggered(bool)), this, SLOT(on_actionPause_triggered()));
} }
void QApple::on_actionPause_triggered() void QApple::on_actionPause_triggered()
@ -232,6 +240,10 @@ void QApple::on_actionPause_triggered()
stopTimer(); stopTimer();
actionPause->setEnabled(false); actionPause->setEnabled(false);
actionStart->setEnabled(true); actionStart->setEnabled(true);
actionChange->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
actionChange->disconnect(SIGNAL(triggered(bool)));
connect(actionChange, SIGNAL(triggered(bool)), this, SLOT(on_actionStart_triggered()));
} }
void QApple::on_actionX1_triggered() void QApple::on_actionX1_triggered()

View file

@ -79,6 +79,19 @@
<addaction name="actionX2"/> <addaction name="actionX2"/>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionChange"/>
<addaction name="actionReboot"/>
</widget>
<action name="actionStart"> <action name="actionStart">
<property name="text"> <property name="text">
<string>&amp;Start</string> <string>&amp;Start</string>
@ -127,6 +140,11 @@
<string>&amp;Options...</string> <string>&amp;Options...</string>
</property> </property>
</action> </action>
<action name="actionChange">
<property name="text">
<string>Change</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>