mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-17 23:47:40 +00:00
Minor code cleanup
This commit is contained in:
parent
2c01b36585
commit
603a6d93f4
@ -38,18 +38,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
gamePadDlg = new GamePadDialog(&input_state, this);
|
||||
#endif
|
||||
|
||||
SetPlaying(0);
|
||||
|
||||
host = new QtHost(this);
|
||||
w = ui->widget;
|
||||
w->init(&input_state);
|
||||
w->resize(pixel_xres, pixel_yres);
|
||||
w->setMinimumSize(pixel_xres, pixel_yres);
|
||||
w->setMaximumSize(pixel_xres, pixel_yres);
|
||||
QObject::connect( w, SIGNAL(doubleClick()), this, SLOT(on_action_OptionsFullScreen_triggered()) );
|
||||
emugl = ui->widget;
|
||||
emugl->init(&input_state);
|
||||
emugl->resize(pixel_xres, pixel_yres);
|
||||
emugl->setMinimumSize(pixel_xres, pixel_yres);
|
||||
emugl->setMaximumSize(pixel_xres, pixel_yres);
|
||||
QObject::connect( emugl, SIGNAL(doubleClick()), this, SLOT(on_action_OptionsFullScreen_triggered()) );
|
||||
|
||||
createLanguageMenu();
|
||||
|
||||
UpdateMenus();
|
||||
|
||||
int zoom = g_Config.iWindowZoom;
|
||||
@ -57,19 +54,20 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
if (zoom > 4) zoom = 4;
|
||||
SetZoom(zoom);
|
||||
|
||||
EmuThread_Start(w);
|
||||
EmuThread_Start(emugl);
|
||||
|
||||
if (!fileToStart.isNull())
|
||||
{
|
||||
SetPlaying(fileToStart);
|
||||
//Update();
|
||||
SetGameTitle(fileToStart);
|
||||
UpdateMenus();
|
||||
|
||||
EmuThread_StartGame(fileToStart);
|
||||
}
|
||||
|
||||
if (!fileToStart.isNull() && stateToLoad != NULL)
|
||||
SaveState::Load(stateToLoad);
|
||||
if (stateToLoad != NULL)
|
||||
SaveState::Load(stateToLoad);
|
||||
}
|
||||
else
|
||||
SetGameTitle("");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -164,26 +162,11 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
g_Config.memCardDirectory = std::string(getenv("HOME"))+"/.ppsspp/";
|
||||
g_Config.flashDirectory = g_Config.memCardDirectory+"/flash/";
|
||||
|
||||
|
||||
LogManager::Init();
|
||||
if (fileToLog != NULL)
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
//LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console");
|
||||
LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
}
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
|
||||
void MainWindow::SetPlaying(QString text)
|
||||
{
|
||||
if (text == 0)
|
||||
{
|
||||
QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR);
|
||||
setWindowTitle(title);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR) + "-" + text;
|
||||
setWindowTitle(title);
|
||||
}
|
||||
LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
}
|
||||
|
||||
void MainWindow::SetNextState(CoreState state)
|
||||
@ -191,6 +174,15 @@ void MainWindow::SetNextState(CoreState state)
|
||||
nextState = state;
|
||||
}
|
||||
|
||||
void MainWindow::SetGameTitle(QString text)
|
||||
{
|
||||
QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR);
|
||||
if (text != "")
|
||||
title += QString(" - %1").arg(text);
|
||||
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
void MainWindow::BrowseAndBoot(void)
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)");
|
||||
@ -261,6 +253,9 @@ void MainWindow::UpdateMenus()
|
||||
ui->action_CPUInterpreter->setEnabled(enable);
|
||||
ui->action_CPUFastInterpreter->setEnabled(enable);
|
||||
ui->action_EmulationStop->setEnabled(!enable);
|
||||
ui->action_DebugDumpFrame->setEnabled(!enable);
|
||||
ui->action_DebugDisassembly->setEnabled(!enable);
|
||||
ui->action_DebugMemoryView->setEnabled(!enable);
|
||||
|
||||
ui->action_OptionsScreen1x->setChecked(0 == (g_Config.iWindowZoom - 1));
|
||||
ui->action_OptionsScreen2x->setChecked(1 == (g_Config.iWindowZoom - 1));
|
||||
@ -292,9 +287,9 @@ void MainWindow::SetZoom(float zoom) {
|
||||
dp_xres = pixel_xres;
|
||||
dp_yres = pixel_yres;
|
||||
|
||||
w->resize(pixel_xres, pixel_yres);
|
||||
w->setMinimumSize(pixel_xres, pixel_yres);
|
||||
w->setMaximumSize(pixel_xres, pixel_yres);
|
||||
emugl->resize(pixel_xres, pixel_yres);
|
||||
emugl->setMinimumSize(pixel_xres, pixel_yres);
|
||||
emugl->setMaximumSize(pixel_xres, pixel_yres);
|
||||
|
||||
ui->centralwidget->setFixedSize(pixel_xres, pixel_yres);
|
||||
ui->centralwidget->resize(pixel_xres, pixel_yres);
|
||||
@ -339,8 +334,7 @@ void MainWindow::on_action_EmulationStop_triggered()
|
||||
memoryWindow->close();
|
||||
|
||||
EmuThread_StopGame();
|
||||
SetPlaying(0);
|
||||
Update();
|
||||
SetGameTitle("");
|
||||
UpdateMenus();
|
||||
}
|
||||
|
||||
@ -596,8 +590,8 @@ void MainWindow::on_action_OptionsFullScreen_triggered()
|
||||
ui->statusbar->setVisible(false);
|
||||
|
||||
// Remove constraint
|
||||
w->setMinimumSize(0, 0);
|
||||
w->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
emugl->setMinimumSize(0, 0);
|
||||
emugl->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
ui->centralwidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
|
||||
@ -853,7 +847,6 @@ void MainWindow::createLanguageMenu()
|
||||
locale.truncate(locale.lastIndexOf('.'));
|
||||
locale.remove(0, locale.indexOf('_') + 1);
|
||||
|
||||
//QString language = QLocale::languageToString(QLocale(locale).language());
|
||||
QString language = QLocale(locale).nativeLanguageName();
|
||||
QAction *action = new QAction(language, this);
|
||||
action->setCheckable(true);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
void Create(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID);
|
||||
void BrowseAndBoot();
|
||||
void SetNextState(CoreState state);
|
||||
void SetPlaying(QString text);
|
||||
void SetGameTitle(QString text);
|
||||
|
||||
Debugger_Disasm* GetDialogDisasm() { return dialogDisasm; }
|
||||
Debugger_Memory* GetDialogMemory() { return memoryWindow; }
|
||||
@ -163,9 +163,9 @@ private:
|
||||
QString currentLanguage;
|
||||
QString languagePath;
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
QtEmuGL* w;
|
||||
QtEmuGL* emugl;
|
||||
CoreState nextState;
|
||||
|
||||
InputState input_state;
|
||||
|
Loading…
x
Reference in New Issue
Block a user