From 350f7fa46810fa49a03967005f4df5781c1feb31 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Thu, 18 Feb 2021 23:28:31 -0500 Subject: [PATCH] More QFileDialog show()/exec() fixes. #332 --- src/drivers/Qt/CodeDataLogger.cpp | 3 -- src/drivers/Qt/ConsoleDebugger.cpp | 46 ++++++++++++++---------------- src/drivers/Qt/GamePadConf.cpp | 1 - src/drivers/Qt/InputConf.cpp | 14 ++++----- src/drivers/Qt/NameTableViewer.cpp | 1 - src/drivers/Qt/ppuViewer.cpp | 1 - 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/src/drivers/Qt/CodeDataLogger.cpp b/src/drivers/Qt/CodeDataLogger.cpp index 72b34bfe..4b2b09be 100644 --- a/src/drivers/Qt/CodeDataLogger.cpp +++ b/src/drivers/Qt/CodeDataLogger.cpp @@ -367,7 +367,6 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void) dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal); - dialog.show(); ret = dialog.exec(); if ( ret ) @@ -423,7 +422,6 @@ void CodeDataLoggerDialog_t::loadCdlFile(void) dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal); - dialog.show(); ret = dialog.exec(); if ( ret ) @@ -508,7 +506,6 @@ void CodeDataLoggerDialog_t::SaveStrippedROM(int invert) dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal); - dialog.show(); ret = dialog.exec(); if ( ret ) diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index 45130e49..49fde29c 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -1221,22 +1221,21 @@ void ConsoleDebugger::edit_BM_name( int addr ) sprintf( stmp, "Specify Bookmark Name for %04X", addr ); dialog.setWindowTitle( tr("Edit Bookmark") ); - dialog.setLabelText( tr(stmp) ); - dialog.setOkButtonText( tr("Edit") ); + dialog.setLabelText( tr(stmp) ); + dialog.setOkButtonText( tr("Edit") ); if ( bm != NULL ) { dialog.setTextValue( tr(bm->name.c_str()) ); } - dialog.show(); - ret = dialog.exec(); + ret = dialog.exec(); if ( QDialog::Accepted == ret ) - { - bm->name = dialog.textValue().toStdString(); - bmListUpdate(false); - } + { + bm->name = dialog.textValue().toStdString(); + bmListUpdate(false); + } } //---------------------------------------------------------------------------- void ConsoleDebugger::bmListUpdate( bool reset ) @@ -1548,22 +1547,21 @@ void ConsoleDebugger::pcSetPlaceCustom(void) g_config->getOption("SDL.DebuggerPCLineOffset" , &ofs ); - dialog.setWindowTitle( tr("PC Line Offset") ); - dialog.setLabelText( tr("Enter a line offset from 0 to 100.") ); - dialog.setOkButtonText( tr("Ok") ); - dialog.setInputMode( QInputDialog::IntInput ); - dialog.setIntRange( 0, 100 ); - dialog.setIntValue( ofs ); - - dialog.show(); - ret = dialog.exec(); - - if ( QDialog::Accepted == ret ) - { - ofs = dialog.intValue(); - - asmView->setPC_placement( 5, ofs ); - } + dialog.setWindowTitle( tr("PC Line Offset") ); + dialog.setLabelText( tr("Enter a line offset from 0 to 100.") ); + dialog.setOkButtonText( tr("Ok") ); + dialog.setInputMode( QInputDialog::IntInput ); + dialog.setIntRange( 0, 100 ); + dialog.setIntValue( ofs ); + + ret = dialog.exec(); + + if ( QDialog::Accepted == ret ) + { + ofs = dialog.intValue(); + + asmView->setPC_placement( 5, ofs ); + } } //---------------------------------------------------------------------------- diff --git a/src/drivers/Qt/GamePadConf.cpp b/src/drivers/Qt/GamePadConf.cpp index df23aa5d..cd5a497f 100644 --- a/src/drivers/Qt/GamePadConf.cpp +++ b/src/drivers/Qt/GamePadConf.cpp @@ -818,7 +818,6 @@ void GamePadConfDialog_t::newProfileCallback(void) dialog.setLabelText( tr("Specify New Profile Name") ); dialog.setOkButtonText( tr("Create") ); - dialog.show(); ret = dialog.exec(); if ( QDialog::Accepted == ret ) diff --git a/src/drivers/Qt/InputConf.cpp b/src/drivers/Qt/InputConf.cpp index ac99c546..6c05fd40 100644 --- a/src/drivers/Qt/InputConf.cpp +++ b/src/drivers/Qt/InputConf.cpp @@ -449,7 +449,6 @@ void InputConfDialog_t::openLoadPresetFile(void) dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal); - dialog.show(); ret = dialog.exec(); if ( ret ) @@ -464,9 +463,9 @@ void InputConfDialog_t::openLoadPresetFile(void) } if ( filename.isNull() ) - { - return; - } + { + return; + } qDebug() << "selected file path : " << filename.toUtf8(); fceuWrapperLock(); @@ -522,7 +521,6 @@ void InputConfDialog_t::openSavePresetFile(void) dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal); - dialog.show(); ret = dialog.exec(); if ( ret ) @@ -537,9 +535,9 @@ void InputConfDialog_t::openSavePresetFile(void) } if ( filename.isNull() ) - { - return; - } + { + return; + } qDebug() << "selected file path : " << filename.toUtf8(); saveInputSettingsToFile( filename.toStdString().c_str() ); diff --git a/src/drivers/Qt/NameTableViewer.cpp b/src/drivers/Qt/NameTableViewer.cpp index ab4dc558..c059c4a2 100644 --- a/src/drivers/Qt/NameTableViewer.cpp +++ b/src/drivers/Qt/NameTableViewer.cpp @@ -790,7 +790,6 @@ void ppuNameTableViewerDialog_t::openColorPicker( QColor *c ) dialog.setCurrentColor( *c ); dialog.setOption( QColorDialog::DontUseNativeDialog, true ); - dialog.show(); ret = dialog.exec(); if ( ret == QDialog::Accepted ) diff --git a/src/drivers/Qt/ppuViewer.cpp b/src/drivers/Qt/ppuViewer.cpp index 649f85be..07a76afe 100644 --- a/src/drivers/Qt/ppuViewer.cpp +++ b/src/drivers/Qt/ppuViewer.cpp @@ -463,7 +463,6 @@ void ppuPatternView_t::openColorPicker( QColor *c ) dialog.setCurrentColor( *c ); dialog.setOption( QColorDialog::DontUseNativeDialog, true ); - dialog.show(); ret = dialog.exec(); if ( ret == QDialog::Accepted )