From 51c57c9cf9772a0ca5af26468048ea10b41193a1 Mon Sep 17 00:00:00 2001 From: Frodo45127 Date: Wed, 9 Oct 2024 13:46:39 +0200 Subject: [PATCH] Implemented "Are you sure?" dialog when closing a tool. --- 3rdparty/builds/qt_rpfm_extensions.lib | Bin 1133348 -> 1150470 bytes .../include/q_dialog_custom.h | 26 +++++++++++++++ .../qt_rpfm_extensions/qt_rpfm_extensions.pro | 6 ++-- .../src/q_dialog_custom.cpp | 25 ++++++++++++++ locale/English_en.ftl | 1 + rpfm_ui/src/ffi/mod.rs | 31 ++++++++++++++++-- rpfm_ui/src/tools/mod.rs | 15 ++++++--- .../unit_editor/variant_unit_editor/mod.rs | 2 +- .../ui_templates/tool_faction_color_editor.ui | 2 +- .../ui_templates/tool_translator_editor.ui | 2 +- rpfm_ui/ui_templates/tool_unit_editor.ui | 2 +- .../tool_unit_editor_variant_editor.ui | 2 +- 12 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 3rdparty/src/qt_rpfm_extensions/include/q_dialog_custom.h create mode 100644 3rdparty/src/qt_rpfm_extensions/src/q_dialog_custom.cpp diff --git a/3rdparty/builds/qt_rpfm_extensions.lib b/3rdparty/builds/qt_rpfm_extensions.lib index f604dbe0502e9e69d82afed0732653ea2dac583f..8898c421fd4573de98582ef35974e92adb05a543 100644 GIT binary patch delta 14812 zcmeHNd3+Q_zOSmDdnPlJ$u&8c+zF5gOzwm;;S7h6fC@xdf?VQq1PFrY+OW!zjXsXi z{6IOv!YT`kf*hlO9J&G`Xz*sAyTlvi$+A!Ip`v-es-7N_441CxKim2IYQFWW-&tK< z)m7;Yb-fp^>a(z!>@;Dm$rVFbYic`?u-26Q4q=>R74YA# zDZ$itE@7>y;t*l2X`+F!)->ZhVOOI+BoT%r^CCcX7-?&&KT6omBl+saPwXJ zi;IgZiYrL>?xPD-y8};KVpPfcfwYaGx4*?(BF6^2AJ}CH_uBd!p*ELBSemB+p^J@i z@P|C=g1_&PY~Im_O>n9cjrG8aMw;OVs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WYs)y|>w2^yy`mL6|$< znuci;tS(&tZ$}3H>0@@Q+*L{p=&P|>H4(*I@4)4mrhIjCh!jy}_`E44`oI#%trhv>9R zZ~`}OT23Y?Q*vBd1Ft_%t$1M}9mgfyc;op#EsN4pG)Ws*=dK_Z>=+Eu5?t^TlA*S} zPc}L5SKC>0(MIwnHI%Yjy>_X0#Qte7MWqP(T1Z4)+d_V4z}p`QR{YHwYFArY$zG${ z)C~@x?793m04`i}755zKZEXXqI}@LyJvR zs<rtnAh3zYaNVz_yrfn5Y&JoJO5nY6JvpX^k+Zu&3My``I8ltjL9*Opl zG#Wgrbj7gdRV^?k^4=|>qFhp^)tWxKBt*j!64_d!27=~elZB{mJD?6*Y@Yp&P#KZ% z+wa&*)ZPCyuRTD+RaoE^vQS)X_NepsSl&Nk2v=29s*K<-&j=wY%7ud;8jf0jA%v +#include +#include +#include +#include +#include +#include + +extern "C" QDialog* new_q_dialog_custom(QWidget *parent = nullptr, bool (*are_you_sure)(QDialog* dialog) = nullptr); + +class QDialogCustom : public QDialog +{ + Q_OBJECT +public: + explicit QDialogCustom(QWidget *parent = nullptr, bool (*are_you_sure)(QDialog* dialog) = nullptr); + void closeEvent(QCloseEvent *event) override; + +private: + bool (*are_you_sure)(QDialog* dialog); + +}; + +#endif // QDIALOGCUSTOM_H diff --git a/3rdparty/src/qt_rpfm_extensions/qt_rpfm_extensions.pro b/3rdparty/src/qt_rpfm_extensions/qt_rpfm_extensions.pro index 2336b90c5..ce7609211 100644 --- a/3rdparty/src/qt_rpfm_extensions/qt_rpfm_extensions.pro +++ b/3rdparty/src/qt_rpfm_extensions/qt_rpfm_extensions.pro @@ -54,7 +54,8 @@ SOURCES += \ src/tree_item_delegate.cpp \ src/treeview_draggable.cpp \ src/unit_variant_item_delegate.cpp \ - src/treeview_filter.cpp + src/treeview_filter.cpp \ + src/q_dialog_custom.cpp INCLUDEPATH += include @@ -83,7 +84,8 @@ HEADERS += \ include/q_main_window_custom.h \ include/spoiler.h \ include/kcolor_combo.h \ - include/unit_variant_item_delegate.h + include/unit_variant_item_delegate.h \ + include/q_dialog_custom.h release:DESTDIR = release release:OBJECTS_DIR = release/.obj diff --git a/3rdparty/src/qt_rpfm_extensions/src/q_dialog_custom.cpp b/3rdparty/src/qt_rpfm_extensions/src/q_dialog_custom.cpp new file mode 100644 index 000000000..b32cd46ed --- /dev/null +++ b/3rdparty/src/qt_rpfm_extensions/src/q_dialog_custom.cpp @@ -0,0 +1,25 @@ +#include "q_dialog_custom.h" +#include +#include +#include +#include +#include +#include + +// Fuction to be able to create a custom QMainWindow. +extern "C" QDialog* new_q_dialog_custom(QWidget *parent, bool (*are_you_sure) (QDialog* dialog)) { + return dynamic_cast(new QDialogCustom(parent, are_you_sure)); +} + +QDialogCustom::QDialogCustom(QWidget *parent, bool (*are_you_sure_fn) (QDialog* dialog)) : QDialog(parent) { + are_you_sure = are_you_sure_fn; +} + +// Overload of the close event so we can put a dialog there. +void QDialogCustom::closeEvent(QCloseEvent *event) { + event->ignore(); + + if (are_you_sure(this)) { + event->accept(); + } +} diff --git a/locale/English_en.ftl b/locale/English_en.ftl index 966bf1aad..5a9d598e2 100644 --- a/locale/English_en.ftl +++ b/locale/English_en.ftl @@ -558,6 +558,7 @@ game_selected_changed_on_opening = Game Selected changed to {"{"}{"}"}, as the P rpfm_title = Rusted PackFile Manager delete_mymod_0 =

Are you sure you want to delete this 'MyMod' from your disk?

There is no way to recover it after that.

delete_mymod_1 =

There are some changes yet to be saved.

Are you sure you want to exit?

+close_tool =

Are you sure you want to close the tool?

Changes will be lost.

api_response_success_new_stable_update =

New major stable update found: {"{"}{"}"}

Please, make sure to save your work in progress before hitting 'Update', or you may lose it.

api_response_success_new_beta_update =

New beta update found: {"{"}{"}"}

Please, make sure to save your work in progress before hitting 'Update', or you may lose it.

diff --git a/rpfm_ui/src/ffi/mod.rs b/rpfm_ui/src/ffi/mod.rs index ba91eac1d..a0389ffcd 100644 --- a/rpfm_ui/src/ffi/mod.rs +++ b/rpfm_ui/src/ffi/mod.rs @@ -14,6 +14,7 @@ Module containing the ffi functions used for custom widgets. use qt_widgets::QAbstractSpinBox; use qt_widgets::QAction; +use qt_widgets::QDialog; use qt_widgets::QLabel; use qt_widgets::QLayout; use qt_widgets::QLineEdit; @@ -235,6 +236,12 @@ pub fn main_window_drop_pack_signal(widget: QPtr) -> Signal<(*const ::q } } +// This function allow us to create a custom dialog. +extern "C" { fn new_q_dialog_custom(parent: *mut QWidget, are_you_sure_dialog: extern fn(*mut QDialog) -> bool) -> *mut QDialog; } +pub fn new_q_dialog_custom_safe(parent: Ptr, are_you_sure_dialog: extern fn(*mut QDialog) -> bool) -> QBox { + unsafe { QBox::from_raw(new_q_dialog_custom(parent.as_mut_raw_ptr(), are_you_sure_dialog)) } +} + //---------------------------------------------------------------------------// // i64 Spinbox stuff. //---------------------------------------------------------------------------// @@ -689,8 +696,11 @@ pub extern fn anim_paths_by_skeleton_callback(skeleton_name: *mut QString, out: /// This function allow us to create a dialog when trying to close the main window. pub extern fn are_you_sure(main_window: *mut QMainWindow, is_delete_my_mod: bool) -> bool { let title = qtr("rpfm_title"); - let message = if is_delete_my_mod { qtr("delete_mymod_0") } - else if UI_STATE.get_is_modified() { qtr("delete_mymod_1") } + let message = if is_delete_my_mod { + qtr("delete_mymod_0") + } else if UI_STATE.get_is_modified() { + qtr("delete_mymod_1") + } // In any other situation... just return true and forget about the dialog. else { return true }; @@ -707,6 +717,23 @@ pub extern fn are_you_sure(main_window: *mut QMainWindow, is_delete_my_mod: bool ).exec() == 3 } } +/// This function allow us to create a dialog when trying to close another dialog. +pub extern fn are_you_sure_dialog(dialog: *mut QDialog) -> bool { + let title = qtr("rpfm_title"); + let message = qtr("close_tool"); + + // Create the dialog and run it (Yes => 3, No => 4). + unsafe { QMessageBox::from_2_q_string_icon3_int_q_widget( + &title, + &message, + q_message_box::Icon::Warning, + 65536, // No + 16384, // Yes + 1, // By default, select yes. + dialog, + ).exec() == 3 } +} + pub extern fn generate_tooltip_message(view: *mut QTableView, global_pos_x: i32, global_pos_y: i32) { unsafe { let view = view.as_ref().unwrap(); diff --git a/rpfm_ui/src/tools/mod.rs b/rpfm_ui/src/tools/mod.rs index 5a85335e2..bab284c29 100644 --- a/rpfm_ui/src/tools/mod.rs +++ b/rpfm_ui/src/tools/mod.rs @@ -132,7 +132,10 @@ pub mod unit_editor; #[getset(get = "pub", get_mut = "pub")] pub struct Tool { - /// Main widget of the tool, built from a Template. Usually, the dialog. + /// The dialog of the tool. + dialog: QBox, + + /// Main widget of the tool, built from a Template. main_widget: QBox, /// Paths which the tool requires data from. @@ -180,8 +183,9 @@ impl Tool { _ => panic!("{THREADS_COMMUNICATION_ERROR}{response:?}"), } - // Load the UI Template. - let main_widget = crate::utils::load_template(parent, template_path)?; + // Load the UI Template. All templates must be simple widgets. + let dialog = new_q_dialog_custom_safe(parent.cast_into(), are_you_sure_dialog); + let main_widget = crate::utils::load_template(&dialog, template_path)?; // Get the common widgets for all tools. let message_widget: QPtr = Self::find_widget_no_tool(&main_widget.static_upcast(), "message_widget")?; @@ -195,6 +199,7 @@ impl Tool { // Then, build the tool. Ok(Self{ + dialog, main_widget, used_paths, packed_files: Rc::new(RefCell::new(HashMap::new())), @@ -204,8 +209,8 @@ impl Tool { } /// This function returns the main widget casted as a QDialog, which should be the type of the widget defined in the UI Template. - pub unsafe fn get_ref_dialog(&self) -> qt_core::QPtr { - self.main_widget.static_downcast::() + pub unsafe fn get_ref_dialog(&self) -> &QBox { + &self.dialog } /// This function sets the title of the Tool's window. diff --git a/rpfm_ui/src/tools/unit_editor/variant_unit_editor/mod.rs b/rpfm_ui/src/tools/unit_editor/variant_unit_editor/mod.rs index f791ab416..35c724deb 100644 --- a/rpfm_ui/src/tools/unit_editor/variant_unit_editor/mod.rs +++ b/rpfm_ui/src/tools/unit_editor/variant_unit_editor/mod.rs @@ -306,7 +306,7 @@ impl SubToolVariantUnitEditor { view.load_data(data)?; // If we hit ok, save the data back to the parent tool. - if view.tool.main_widget().static_downcast::().exec() == 1 { + if view.tool.dialog().exec() == 1 { Ok(Some(view.save_data()?)) } diff --git a/rpfm_ui/ui_templates/tool_faction_color_editor.ui b/rpfm_ui/ui_templates/tool_faction_color_editor.ui index 74c4044d0..ab703d26c 100644 --- a/rpfm_ui/ui_templates/tool_faction_color_editor.ui +++ b/rpfm_ui/ui_templates/tool_faction_color_editor.ui @@ -1,7 +1,7 @@ Dialog - + 0 diff --git a/rpfm_ui/ui_templates/tool_translator_editor.ui b/rpfm_ui/ui_templates/tool_translator_editor.ui index 59f246171..65a3085aa 100644 --- a/rpfm_ui/ui_templates/tool_translator_editor.ui +++ b/rpfm_ui/ui_templates/tool_translator_editor.ui @@ -1,7 +1,7 @@ Dialog - + 0 diff --git a/rpfm_ui/ui_templates/tool_unit_editor.ui b/rpfm_ui/ui_templates/tool_unit_editor.ui index 59a86f21a..624d4ca09 100644 --- a/rpfm_ui/ui_templates/tool_unit_editor.ui +++ b/rpfm_ui/ui_templates/tool_unit_editor.ui @@ -1,7 +1,7 @@ Dialog - + 0 diff --git a/rpfm_ui/ui_templates/tool_unit_editor_variant_editor.ui b/rpfm_ui/ui_templates/tool_unit_editor_variant_editor.ui index 2f619dea8..da797f8c5 100644 --- a/rpfm_ui/ui_templates/tool_unit_editor_variant_editor.ui +++ b/rpfm_ui/ui_templates/tool_unit_editor_variant_editor.ui @@ -1,7 +1,7 @@ variant_editor_dialog - + 0