mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-20 14:11:16 +00:00
sob it's not going well
This commit is contained in:
parent
e5656bace1
commit
0c9d8d3228
@ -639,7 +639,7 @@ void CMainDialog::AddCustomAssetPath()
|
|||||||
QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path));
|
QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path));
|
||||||
QStringList new_files = QFileDialog::getOpenFileNames(
|
QStringList new_files = QFileDialog::getOpenFileNames(
|
||||||
this,
|
this,
|
||||||
"Select one or more files to open",
|
"Open File(s)",
|
||||||
data_path.absolutePath(),
|
data_path.absolutePath(),
|
||||||
"Interleaf files (*.si)"
|
"Interleaf files (*.si)"
|
||||||
);
|
);
|
||||||
@ -721,7 +721,10 @@ void CMainDialog::YResChanged(int i)
|
|||||||
|
|
||||||
void CMainDialog::EnsureAspectRatio()
|
void CMainDialog::EnsureAspectRatio()
|
||||||
{
|
{
|
||||||
if (currentConfigApp->m_aspect_ratio != 3) {
|
if (currentConfigApp->m_aspect_ratio == 3) {
|
||||||
|
m_ui->xResSpinBox->setReadOnly(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
m_ui->xResSpinBox->setReadOnly(true);
|
m_ui->xResSpinBox->setReadOnly(true);
|
||||||
switch (currentConfigApp->m_aspect_ratio) {
|
switch (currentConfigApp->m_aspect_ratio) {
|
||||||
case 0: {
|
case 0: {
|
||||||
@ -740,9 +743,6 @@ void CMainDialog::EnsureAspectRatio()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
m_ui->xResSpinBox->setReadOnly(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainDialog::FramerateChanged(int i)
|
void CMainDialog::FramerateChanged(int i)
|
||||||
@ -753,10 +753,43 @@ void CMainDialog::FramerateChanged(int i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMainDialog::ForwardKeyChanged() {
|
void CMainDialog::ForwardKeyChanged() {
|
||||||
RebindInput(m_ui->keyForward_1);
|
RebindInput(m_ui->keyForward_1, g_keyMaps.k_forward[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainDialog::RebindInput(QPushButton* &button)
|
void CMainDialog::RebindInput(QPushButton* &button, SDL_Scancode &key)
|
||||||
{
|
{
|
||||||
button->setText(QString("Press a key..."));
|
button->setText(QString("Press a key..."));
|
||||||
|
currentKeyBind = &key;
|
||||||
|
inputTimeout.setSingleShot(true);
|
||||||
|
inputTimeout.setInterval(3 * 1000);
|
||||||
|
sdlPoller.setSingleShot(false);
|
||||||
|
sdlPoller.setInterval(10);
|
||||||
|
connect(&inputTimeout, &QTimer::timeout, this, &CMainDialog::RebindTimeout);
|
||||||
|
connect(&sdlPoller, &QTimer::timeout, this, &CMainDialog::PollInputs);
|
||||||
|
SDL_InitSubSystem(SDL_INIT_EVENTS);
|
||||||
|
sdlPoller.start();
|
||||||
|
inputTimeout.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainDialog::PollInputs()
|
||||||
|
{
|
||||||
|
SDL_Event event;
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
|
SDL_Log("Key down!");
|
||||||
|
SDL_Scancode sc = event.key.scancode;
|
||||||
|
*currentKeyBind = sc;
|
||||||
|
sdlPoller.disconnect();
|
||||||
|
inputTimeout.disconnect();
|
||||||
|
UpdateInterface();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainDialog::RebindTimeout()
|
||||||
|
{
|
||||||
|
SDL_Log("Timeout");
|
||||||
|
sdlPoller.disconnect();
|
||||||
|
inputTimeout.disconnect();
|
||||||
|
UpdateInterface();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QTimer>
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
@ -32,6 +33,9 @@ class CMainDialog : public QDialog {
|
|||||||
QStringList assetPaths = QStringList();
|
QStringList assetPaths = QStringList();
|
||||||
Ui::MainDialog* m_ui = nullptr;
|
Ui::MainDialog* m_ui = nullptr;
|
||||||
SDL_DisplayMode** displayModes;
|
SDL_DisplayMode** displayModes;
|
||||||
|
QTimer sdlPoller;
|
||||||
|
QTimer inputTimeout;
|
||||||
|
SDL_Scancode* currentKeyBind = nullptr;
|
||||||
|
|
||||||
void keyReleaseEvent(QKeyEvent* event) override;
|
void keyReleaseEvent(QKeyEvent* event) override;
|
||||||
bool OnInitDialog();
|
bool OnInitDialog();
|
||||||
@ -77,7 +81,9 @@ private slots:
|
|||||||
void EnsureAspectRatio();
|
void EnsureAspectRatio();
|
||||||
void FramerateChanged(int i);
|
void FramerateChanged(int i);
|
||||||
void ForwardKeyChanged();
|
void ForwardKeyChanged();
|
||||||
void RebindInput(QPushButton* &button);
|
void RebindInput(QPushButton* &button, SDL_Scancode &key);
|
||||||
|
void PollInputs();
|
||||||
|
void RebindTimeout();
|
||||||
};
|
};
|
||||||
|
|
||||||
// SYNTHETIC: CONFIG 0x00403de0
|
// SYNTHETIC: CONFIG 0x00403de0
|
||||||
|
|||||||
@ -505,6 +505,11 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
qInfo() << "INI path =" << QString::fromStdString(g_theApp.GetIniPath());
|
qInfo() << "INI path =" << QString::fromStdString(g_theApp.GetIniPath());
|
||||||
|
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_EVENTS) != true) {
|
||||||
|
qDebug() << "SDL_Init Error:" << SDL_GetError();
|
||||||
|
//return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int result = 1;
|
int result = 1;
|
||||||
if (g_theApp.InitInstance()) {
|
if (g_theApp.InitInstance()) {
|
||||||
CMainDialog main_dialog;
|
CMainDialog main_dialog;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user