Fix window title, close event, scrollbars, fast timer when disk spins.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
fe0730c4d3
commit
1192f7b584
6 changed files with 63 additions and 4 deletions
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Apple ][ Video</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "emulator.h"
|
||||
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -40,6 +42,8 @@ namespace
|
|||
|
||||
CheckCpu();
|
||||
|
||||
SetWindowTitle();
|
||||
|
||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||
|
||||
MemInitialize();
|
||||
|
@ -127,9 +131,17 @@ QApple::QApple(QWidget *parent) :
|
|||
myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
|
||||
myMSGap = 5;
|
||||
myCurrentGap = myMSGap;
|
||||
|
||||
initialiseEmulator();
|
||||
startEmulator();
|
||||
|
||||
myEmulatorWindow->setWindowTitle(g_pAppTitle);
|
||||
}
|
||||
|
||||
void QApple::closeEvent(QCloseEvent *)
|
||||
{
|
||||
uninitialiseEmulator();
|
||||
}
|
||||
|
||||
void QApple::timerEvent(QTimerEvent *)
|
||||
|
@ -149,11 +161,26 @@ void QApple::timerEvent(QTimerEvent *)
|
|||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
myEmulator->redrawScreen();
|
||||
}
|
||||
|
||||
// 0 means run as soon as possible (i.e. no pending events)
|
||||
const int nextGap = DiskIsSpinning() ? 0 : myMSGap;
|
||||
setNextTimer(nextGap);
|
||||
}
|
||||
|
||||
void QApple::setNextTimer(int ms)
|
||||
{
|
||||
if (ms != myCurrentGap)
|
||||
{
|
||||
killTimer(myTimerID);
|
||||
myCurrentGap = ms;
|
||||
myTimerID = startTimer(myCurrentGap);
|
||||
}
|
||||
}
|
||||
|
||||
void QApple::on_actionStart_triggered()
|
||||
{
|
||||
myTimerID = startTimer(0);
|
||||
// always restart with the same timer gap that was last used
|
||||
myTimerID = startTimer(myCurrentGap);
|
||||
actionPause->setEnabled(true);
|
||||
actionStart->setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
explicit QApple(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * event);
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
|
||||
private slots:
|
||||
|
@ -27,10 +28,15 @@ private slots:
|
|||
void on_action4_3_triggered();
|
||||
|
||||
private:
|
||||
|
||||
void setNextTimer(int ms);
|
||||
|
||||
QMdiSubWindow * myEmulatorWindow;
|
||||
Emulator * myEmulator;
|
||||
|
||||
int myMSGap;
|
||||
int myCurrentGap;
|
||||
|
||||
int myTimerID;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,14 @@
|
|||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QMdiArea" name="mdiArea"/>
|
||||
<widget class="QMdiArea" name="mdiArea">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -46,7 +53,6 @@
|
|||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="action4_3"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionX1"/>
|
||||
<addaction name="actionX2"/>
|
||||
</widget>
|
||||
|
@ -57,6 +63,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionPause">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
|
|
|
@ -73,6 +73,22 @@ void SetCurrentCLK6502(void)
|
|||
g_fCurrentCLK6502 = CLK_6502 * g_fMHz;
|
||||
}
|
||||
|
||||
void SetWindowTitle()
|
||||
{
|
||||
switch (g_Apple2Type)
|
||||
{
|
||||
default:
|
||||
case A2TYPE_APPLE2: g_pAppTitle = TITLE_APPLE_2; break;
|
||||
case A2TYPE_APPLE2PLUS: g_pAppTitle = TITLE_APPLE_2_PLUS; break;
|
||||
case A2TYPE_APPLE2E: g_pAppTitle = TITLE_APPLE_2E; break;
|
||||
case A2TYPE_APPLE2EENHANCED: g_pAppTitle = TITLE_APPLE_2E_ENHANCED; break;
|
||||
case A2TYPE_PRAVETS82: g_pAppTitle = TITLE_PRAVETS_82; break;
|
||||
case A2TYPE_PRAVETS8M: g_pAppTitle = TITLE_PRAVETS_8M; break;
|
||||
case A2TYPE_PRAVETS8A: g_pAppTitle = TITLE_PRAVETS_8A; break;
|
||||
case A2TYPE_TK30002E: g_pAppTitle = TITLE_TK3000_2E; break;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadConfiguration(void)
|
||||
{
|
||||
DWORD dwComputerType;
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
void LoadConfiguration(void);
|
||||
void CheckCpu();
|
||||
void SetWindowTitle();
|
||||
|
|
Loading…
Add table
Reference in a new issue