mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
some more UI work
This commit is contained in:
@ -63,6 +63,10 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
|
|||||||
RunningSomething = false;
|
RunningSomething = false;
|
||||||
|
|
||||||
connect(this, SIGNAL(windowTitleChange(QString)), mainWindow, SLOT(onTitleUpdate(QString)));
|
connect(this, SIGNAL(windowTitleChange(QString)), mainWindow, SLOT(onTitleUpdate(QString)));
|
||||||
|
connect(this, SIGNAL(windowEmuStart()), mainWindow, SLOT(onEmuStart()));
|
||||||
|
connect(this, SIGNAL(windowEmuStop()), mainWindow, SLOT(onEmuStop()));
|
||||||
|
|
||||||
|
emit windowEmuStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::run()
|
void EmuThread::run()
|
||||||
@ -331,6 +335,9 @@ void EmuThread::emuRun()
|
|||||||
{
|
{
|
||||||
EmuRunning = 1;
|
EmuRunning = 1;
|
||||||
RunningSomething = true;
|
RunningSomething = true;
|
||||||
|
|
||||||
|
// checkme
|
||||||
|
emit windowEmuStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::emuPause(bool refresh)
|
void EmuThread::emuPause(bool refresh)
|
||||||
@ -339,11 +346,15 @@ void EmuThread::emuPause(bool refresh)
|
|||||||
PrevEmuStatus = EmuRunning;
|
PrevEmuStatus = EmuRunning;
|
||||||
EmuRunning = status;
|
EmuRunning = status;
|
||||||
while (EmuStatus != status);
|
while (EmuStatus != status);
|
||||||
|
|
||||||
|
//emit windowEmuPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::emuUnpause()
|
void EmuThread::emuUnpause()
|
||||||
{
|
{
|
||||||
EmuRunning = PrevEmuStatus;
|
EmuRunning = PrevEmuStatus;
|
||||||
|
|
||||||
|
//emit windowEmuUnpause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::emuStop()
|
void EmuThread::emuStop()
|
||||||
@ -351,6 +362,11 @@ void EmuThread::emuStop()
|
|||||||
EmuRunning = 0;
|
EmuRunning = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EmuThread::emuIsRunning()
|
||||||
|
{
|
||||||
|
return (EmuRunning == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindowPanel::MainWindowPanel(QWidget* parent) : QWidget(parent)
|
MainWindowPanel::MainWindowPanel(QWidget* parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
@ -450,6 +466,19 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||||||
actQuit = menu->addAction("Quit");
|
actQuit = menu->addAction("Quit");
|
||||||
connect(actQuit, &QAction::triggered, this, &MainWindow::onQuit);
|
connect(actQuit, &QAction::triggered, this, &MainWindow::onQuit);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
QMenu* menu = menubar->addMenu("System");
|
||||||
|
|
||||||
|
actPause = menu->addAction("Pause");
|
||||||
|
actPause->setCheckable(true);
|
||||||
|
connect(actPause, &QAction::triggered, this, &MainWindow::onPause);
|
||||||
|
|
||||||
|
actReset = menu->addAction("Reset");
|
||||||
|
connect(actReset, &QAction::triggered, this, &MainWindow::onReset);
|
||||||
|
|
||||||
|
actStop = menu->addAction("Stop");
|
||||||
|
connect(actStop, &QAction::triggered, this, &MainWindow::onStop);
|
||||||
|
}
|
||||||
setMenuBar(menubar);
|
setMenuBar(menubar);
|
||||||
|
|
||||||
panel = new MainWindowPanel(this);
|
panel = new MainWindowPanel(this);
|
||||||
@ -644,11 +673,75 @@ void MainWindow::onQuit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::onPause(bool checked)
|
||||||
|
{
|
||||||
|
if (emuThread->emuIsRunning())
|
||||||
|
{
|
||||||
|
emuThread->emuPause(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emuThread->emuUnpause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onReset()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onStop()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::onTitleUpdate(QString title)
|
void MainWindow::onTitleUpdate(QString title)
|
||||||
{
|
{
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onEmuStart()
|
||||||
|
{
|
||||||
|
for (int i = 1; i < 9; i++)
|
||||||
|
{
|
||||||
|
actSaveState[i]->setEnabled(true);
|
||||||
|
actLoadState[i]->setEnabled(Frontend::SavestateExists(i));
|
||||||
|
}
|
||||||
|
actSaveState[0]->setEnabled(true);
|
||||||
|
actLoadState[0]->setEnabled(true);
|
||||||
|
actUndoStateLoad->setEnabled(true);
|
||||||
|
|
||||||
|
actPause->setEnabled(true);
|
||||||
|
actPause->setChecked(false);
|
||||||
|
actReset->setEnabled(true);
|
||||||
|
actStop->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onEmuStop()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
actSaveState[i]->setEnabled(false);
|
||||||
|
actLoadState[i]->setEnabled(false);
|
||||||
|
}
|
||||||
|
actUndoStateLoad->setEnabled(false);
|
||||||
|
|
||||||
|
actPause->setEnabled(false);
|
||||||
|
actReset->setEnabled(false);
|
||||||
|
actStop->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onEmuPause()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onEmuUnpause()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -41,9 +41,15 @@ public:
|
|||||||
void emuUnpause();
|
void emuUnpause();
|
||||||
void emuStop();
|
void emuStop();
|
||||||
|
|
||||||
|
bool emuIsRunning();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowTitleChange(QString title);
|
void windowTitleChange(QString title);
|
||||||
|
|
||||||
|
void windowEmuStart();
|
||||||
|
void windowEmuStop();
|
||||||
|
void windowPauseToggle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
volatile int EmuStatus;
|
volatile int EmuStatus;
|
||||||
int PrevEmuStatus;
|
int PrevEmuStatus;
|
||||||
@ -86,8 +92,17 @@ private slots:
|
|||||||
void onUndoStateLoad();
|
void onUndoStateLoad();
|
||||||
void onQuit();
|
void onQuit();
|
||||||
|
|
||||||
|
void onPause(bool checked);
|
||||||
|
void onReset();
|
||||||
|
void onStop();
|
||||||
|
|
||||||
void onTitleUpdate(QString title);
|
void onTitleUpdate(QString title);
|
||||||
|
|
||||||
|
void onEmuStart();
|
||||||
|
void onEmuStop();
|
||||||
|
void onEmuPause();
|
||||||
|
void onEmuUnpause();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindowPanel* panel;
|
MainWindowPanel* panel;
|
||||||
|
|
||||||
@ -97,6 +112,10 @@ private:
|
|||||||
QAction* actLoadState[9];
|
QAction* actLoadState[9];
|
||||||
QAction* actUndoStateLoad;
|
QAction* actUndoStateLoad;
|
||||||
QAction* actQuit;
|
QAction* actQuit;
|
||||||
|
|
||||||
|
QAction* actPause;
|
||||||
|
QAction* actReset;
|
||||||
|
QAction* actStop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAIN_H
|
#endif // MAIN_H
|
||||||
|
Reference in New Issue
Block a user