mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
begin adding input dialog
This commit is contained in:
parent
c9a76edf21
commit
19566178ba
@ -3,6 +3,7 @@ project(qt_sdl)
|
||||
SET(SOURCES_QT_SDL
|
||||
main.cpp
|
||||
EmuSettingsDialog.cpp
|
||||
InputConfigDialog.cpp
|
||||
Platform.cpp
|
||||
PlatformConfig.cpp
|
||||
|
||||
|
@ -33,16 +33,17 @@ public:
|
||||
~EmuSettingsDialog();
|
||||
|
||||
static EmuSettingsDialog* currentDlg;
|
||||
static void openDlg(QWidget* parent)
|
||||
static EmuSettingsDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
if (currentDlg)
|
||||
{
|
||||
currentDlg->activateWindow();
|
||||
return;
|
||||
return currentDlg;
|
||||
}
|
||||
|
||||
currentDlg = new EmuSettingsDialog(parent);
|
||||
currentDlg->show();
|
||||
return currentDlg;
|
||||
}
|
||||
static void closeDlg()
|
||||
{
|
||||
|
53
src/frontend/qt_sdl/InputConfigDialog.cpp
Normal file
53
src/frontend/qt_sdl/InputConfigDialog.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2016-2020 Arisotura
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
//
|
||||
|
||||
#include "types.h"
|
||||
#include "Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "InputConfigDialog.h"
|
||||
#include "ui_InputConfigDialog.h"
|
||||
|
||||
|
||||
InputConfigDialog* InputConfigDialog::currentDlg = nullptr;
|
||||
|
||||
|
||||
InputConfigDialog::InputConfigDialog(QWidget* parent) : QDialog(parent), ui(new Ui::InputConfigDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
InputConfigDialog::~InputConfigDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InputConfigDialog::on_InputConfigDialog_accepted()
|
||||
{
|
||||
closeDlg();
|
||||
}
|
||||
|
||||
void InputConfigDialog::on_InputConfigDialog_rejected()
|
||||
{
|
||||
closeDlg();
|
||||
}
|
63
src/frontend/qt_sdl/InputConfigDialog.h
Normal file
63
src/frontend/qt_sdl/InputConfigDialog.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2016-2020 Arisotura
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#ifndef INPUTCONFIGDIALOG_H
|
||||
#define INPUTCONFIGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui { class InputConfigDialog; }
|
||||
class InputConfigDialog;
|
||||
|
||||
class InputConfigDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InputConfigDialog(QWidget* parent);
|
||||
~InputConfigDialog();
|
||||
|
||||
static InputConfigDialog* currentDlg;
|
||||
static InputConfigDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
if (currentDlg)
|
||||
{
|
||||
currentDlg->activateWindow();
|
||||
return currentDlg;
|
||||
}
|
||||
|
||||
currentDlg = new InputConfigDialog(parent);
|
||||
currentDlg->open();
|
||||
return currentDlg;
|
||||
}
|
||||
static void closeDlg()
|
||||
{
|
||||
currentDlg = nullptr;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void on_InputConfigDialog_accepted();
|
||||
void on_InputConfigDialog_rejected();
|
||||
|
||||
//
|
||||
|
||||
private:
|
||||
Ui::InputConfigDialog* ui;
|
||||
};
|
||||
|
||||
#endif // INPUTCONFIGDIALOG_H
|
126
src/frontend/qt_sdl/InputConfigDialog.ui
Normal file
126
src/frontend/qt_sdl/InputConfigDialog.ui
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InputConfigDialog</class>
|
||||
<widget class="QDialog" name="InputConfigDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>488</width>
|
||||
<height>365</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>TDAH</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabInput">
|
||||
<attribute name="title">
|
||||
<string>DS input</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabHotkeysGeneral">
|
||||
<attribute name="title">
|
||||
<string>General hotkeys</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Joystick:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxJoystick">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Selects which joystick will be used for joystick input, if any is present.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>InputConfigDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>InputConfigDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "EmuSettingsDialog.h"
|
||||
#include "InputConfigDialog.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "version.h"
|
||||
@ -551,6 +552,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
|
||||
actEmuSettings = menu->addAction("Emu settings");
|
||||
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
|
||||
|
||||
actInputConfig = menu->addAction("Input and hotkeys");
|
||||
connect(actInputConfig, &QAction::triggered, this, &MainWindow::onOpenInputConfig);
|
||||
}
|
||||
setMenuBar(menubar);
|
||||
|
||||
@ -850,6 +854,19 @@ void MainWindow::onOpenEmuSettings()
|
||||
EmuSettingsDialog::openDlg(this);
|
||||
}
|
||||
|
||||
void MainWindow::onOpenInputConfig()
|
||||
{
|
||||
emuThread->emuPause(true);
|
||||
|
||||
InputConfigDialog* dlg = InputConfigDialog::openDlg(this);
|
||||
connect(dlg, &InputConfigDialog::finished, this, &MainWindow::onInputConfigFinished);
|
||||
}
|
||||
|
||||
void MainWindow::onInputConfigFinished()
|
||||
{printf("FARTO\n");
|
||||
emuThread->emuUnpause();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@ -915,8 +932,8 @@ int main(int argc, char** argv)
|
||||
|
||||
Config::Load();
|
||||
|
||||
//if (Config::AudioVolume < 0) Config::AudioVolume = 0;
|
||||
//else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
|
||||
if (Config::AudioVolume < 0) Config::AudioVolume = 0;
|
||||
else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
|
||||
|
||||
// TODO: this should be checked before running anything
|
||||
#if 0
|
||||
|
@ -108,6 +108,8 @@ private slots:
|
||||
void onEmuUnpause();
|
||||
|
||||
void onOpenEmuSettings();
|
||||
void onOpenInputConfig();
|
||||
void onInputConfigFinished();
|
||||
|
||||
private:
|
||||
QString loadErrorStr(int error);
|
||||
@ -126,6 +128,7 @@ private:
|
||||
QAction* actStop;
|
||||
|
||||
QAction* actEmuSettings;
|
||||
QAction* actInputConfig;
|
||||
};
|
||||
|
||||
#endif // MAIN_H
|
||||
|
Loading…
Reference in New Issue
Block a user