diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-05 13:02:52 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-01-05 13:02:52 +0100 |
commit | 449625118b3d28baabcdb001595a7dec2f8e3593 (patch) | |
tree | 293d5131120072ca5cf74565d5a900f98a8139c7 | |
parent | bbe8552db3fb0d7ab2c3a26b058c059e5df21eeb (diff) |
remove settings dialog copypasted all over, losing functionality
18 files changed, 36 insertions, 423 deletions
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index 06f7b2c6..c103b78c 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -225,29 +225,8 @@ void TrackerDialog::doApply() void TrackerDialog::doCancel()
{
- if (s.b->modifiedp()) {
- int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?",
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard );
- switch (ret) {
- case QMessageBox::Save:
- save();
- close();
- break;
- case QMessageBox::Discard:
- s.b->revert();
- close();
- break;
- case QMessageBox::Cancel:
- // Cancel was clicked
- break;
- default:
- // should never be reached
- break;
- }
- }
- else {
- close();
- }
+ s.b->revert();
+ close();
}
void TrackerDialog::widget_destroyed(QObject* obj)
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index b01c2013..f5ed6aa7 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -49,32 +49,8 @@ void CurveConfigurationDialog::doOK() { } void CurveConfigurationDialog::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty || mainApp->s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - mainApp->s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + mainApp->b->revert(); + close(); } // diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 2f117ea4..a905be57 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -42,31 +42,8 @@ void KeyboardShortcutDialog::doOK() { } void KeyboardShortcutDialog::doCancel() { - // - // Ask if changed Settings should be saved - // - if (mainApp->b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - mainApp->b->save(); - this->close(); - break; - case QMessageBox::Discard: - mainApp->b->revert(); - close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + mainApp->b->revert(); + close(); } #if defined(_WIN32) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 6d1ad384..56b76a55 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -36,33 +36,10 @@ void FilterControls::doOK() { } void FilterControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = - QMessageBox::question( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->discard(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } + discard(); + close(); } - void FilterControls::discard() { s.b->revert(); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index 7ab2b09c..395d1058 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -57,31 +57,8 @@ void FilterControls::doOK() { } void FilterControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } void FilterControls::save() { diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 887020c5..1c3e5ef8 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -59,27 +59,8 @@ void FGControls::doOK() { } void FGControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - if (theProtocol) - theProtocol->reloadSettings(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index bae3d5df..d97cff99 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -42,28 +42,8 @@ void FSUIPCControls::doOK() { } void FSUIPCControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } void FSUIPCControls::getLocationOfDLL() diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index b414561d..7f070857 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -69,34 +69,8 @@ void FTControls::doOK() { } void FTControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } void FTControls::selectDLL() { diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index ce4b3cb0..37db314f 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -52,25 +52,8 @@ void FTNControls::doOK() { // Cancel clicked on server-dialog // void FTNControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index cc62b004..22b7024c 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -59,30 +59,8 @@ void MOUSEControls::doOK() { } void MOUSEControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - if (_proto) - _proto->reload(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index 6af87285..c7428d77 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -44,26 +44,8 @@ void SCControls::doOK() { } void SCControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 50496ed7..2edac4a2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -472,28 +472,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - if (tracker) - tracker->reload(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index 2ef75b89..83548966 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -238,31 +238,8 @@ void TrackerControls::doOK() { // Cancel clicked on server-dialog // void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settings.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - settings.b->save(); - close(); - break; - case QMessageBox::Discard: - settings.b->revert(); - close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - close(); - } + settings.b->revert(); + close(); } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 5fced44e..4ce56acc 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -286,27 +286,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = QMessageBox::question ( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - default: - case QMessageBox::Cancel: - break; - } + s.b->revert(); + this->close(); } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 4a2deb9f..14be2c37 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -24,30 +24,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = QMessageBox::question (this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - default: - case QMessageBox::Cancel: - // Cancel was clicked - break; - } + s.b->revert(); + close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index a089385f..b0766634 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -56,31 +56,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - if (tracker) - tracker->reload(); - this->close(); - break; - case QMessageBox::Discard: - s.b->reload(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 763ddd11..ad532100 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -26,28 +26,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 59026288..8d1b99f2 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -48,28 +48,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) |