diff --git a/espanso-modulo/src/sys/interop/interop.h b/espanso-modulo/src/sys/interop/interop.h index 7c6c5ed..1dd63db 100644 --- a/espanso-modulo/src/sys/interop/interop.h +++ b/espanso-modulo/src/sys/interop/interop.h @@ -102,6 +102,7 @@ typedef struct WizardMetadata { const int is_accessibility_page_enabled; const char *window_icon_path; + const char *welcome_image_path; const char *accessibility_image_1_path; const char *accessibility_image_2_path; diff --git a/espanso-modulo/src/sys/interop/mod.rs b/espanso-modulo/src/sys/interop/mod.rs index 9f99451..5d9d85c 100644 --- a/espanso-modulo/src/sys/interop/mod.rs +++ b/espanso-modulo/src/sys/interop/mod.rs @@ -120,6 +120,7 @@ pub struct WizardMetadata { pub is_accessibility_page_enabled: c_int, pub window_icon_path: *const c_char, + pub welcome_image_path: *const c_char, pub accessibility_image_1_path: *const c_char, pub accessibility_image_2_path: *const c_char, diff --git a/espanso-modulo/src/sys/wizard/mod.rs b/espanso-modulo/src/sys/wizard/mod.rs index 3aa6bba..55c25de 100644 --- a/espanso-modulo/src/sys/wizard/mod.rs +++ b/espanso-modulo/src/sys/wizard/mod.rs @@ -34,6 +34,8 @@ pub fn show(options: WizardOptions) { let (_c_window_icon_path, c_window_icon_path_ptr) = convert_to_cstring_or_null(options.window_icon_path); + let (_c_welcome_image, c_welcome_image_path_ptr) = + convert_to_cstring_or_null(options.welcome_image_path); let (_c_accessibility_image_1_path, c_accessibility_image_1_path_ptr) = convert_to_cstring_or_null(options.accessibility_image_1_path); let (_c_accessibility_image_2_path, c_accessibility_image_2_path_ptr) = @@ -167,6 +169,7 @@ pub fn show(options: WizardOptions) { }, window_icon_path: c_window_icon_path_ptr, + welcome_image_path: c_welcome_image_path_ptr, accessibility_image_1_path: c_accessibility_image_1_path_ptr, accessibility_image_2_path: c_accessibility_image_2_path_ptr, diff --git a/espanso-modulo/src/sys/wizard/wizard.cpp b/espanso-modulo/src/sys/wizard/wizard.cpp index 5b298a1..fb9bf3e 100644 --- a/espanso-modulo/src/sys/wizard/wizard.cpp +++ b/espanso-modulo/src/sys/wizard/wizard.cpp @@ -87,6 +87,7 @@ protected: void check_timer_tick( wxTimerEvent& event ); void on_page_changed( wxBookCtrlEvent& event ); void welcome_start_clicked(wxCommandEvent &event); + void migrate_compatibility_mode_clicked( wxCommandEvent& event ); void navigate_to_next_page_or_close(); void change_default_button(int target_page); @@ -99,6 +100,11 @@ DerivedFrame::DerivedFrame(wxWindow *parent) { // TODO: load images for accessibility page if on macOS + if (metadata->welcome_image_path) { + wxBitmap welcomeBitmap = wxBitmap(metadata->welcome_image_path, wxBITMAP_TYPE_PNG); + this->welcome_image->SetBitmap(welcomeBitmap); + } + this->welcome_version_text->SetLabel(wxString::Format("( version %s )", metadata->version)); // Load the first page @@ -126,6 +132,10 @@ void DerivedFrame::welcome_start_clicked(wxCommandEvent &event) this->navigate_to_next_page_or_close(); } +void DerivedFrame::migrate_compatibility_mode_clicked( wxCommandEvent& event ) { + this->navigate_to_next_page_or_close(); +} + void DerivedFrame::check_timer_tick( wxTimerEvent& event ) { if (this->m_simplebook->GetSelection() == LEGACY_VERSION_PAGE_INDEX) { if (metadata->is_legacy_version_running) { diff --git a/espanso-modulo/src/sys/wizard/wizard.fbp b/espanso-modulo/src/sys/wizard/wizard.fbp index 85d65be..d473370 100644 --- a/espanso-modulo/src/sys/wizard/wizard.fbp +++ b/espanso-modulo/src/sys/wizard/wizard.fbp @@ -183,6 +183,64 @@ bSizer2 wxVERTICAL none + + 0 + wxALIGN_CENTER|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + welcome_image + 1 + + + protected + 1 + + Resizable + 1 + 256,256 + ; ; forward_declare + 0 + + + + + + 20 wxALIGN_CENTER_HORIZONTAL|wxTOP diff --git a/espanso-modulo/src/sys/wizard/wizard_gui.cpp b/espanso-modulo/src/sys/wizard/wizard_gui.cpp index de40940..0aabb15 100644 --- a/espanso-modulo/src/sys/wizard/wizard_gui.cpp +++ b/espanso-modulo/src/sys/wizard/wizard_gui.cpp @@ -29,6 +29,9 @@ WizardFrame::WizardFrame( wxWindow* parent, wxWindowID id, const wxString& title wxBoxSizer* bSizer2; bSizer2 = new wxBoxSizer( wxVERTICAL ); + welcome_image = new wxStaticBitmap( welcome_panel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 256,256 ), 0 ); + bSizer2->Add( welcome_image, 0, wxALIGN_CENTER|wxALL, 0 ); + welcome_title_text = new wxStaticText( welcome_panel, wxID_ANY, wxT("Welcome to Espanso!"), wxDefaultPosition, wxDefaultSize, 0 ); welcome_title_text->Wrap( -1 ); welcome_title_text->SetFont( wxFont( 18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); diff --git a/espanso-modulo/src/sys/wizard/wizard_gui.h b/espanso-modulo/src/sys/wizard/wizard_gui.h index c05f850..930b818 100644 --- a/espanso-modulo/src/sys/wizard/wizard_gui.h +++ b/espanso-modulo/src/sys/wizard/wizard_gui.h @@ -10,21 +10,21 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include +#include +#include #include #include #include #include #include -#include #include #include #include @@ -43,6 +43,7 @@ class WizardFrame : public wxFrame wxTimer check_timer; wxSimplebook* m_simplebook; wxPanel* welcome_panel; + wxStaticBitmap* welcome_image; wxStaticText* welcome_title_text; wxStaticText* welcome_version_text; wxStaticText* welcome_description_text; diff --git a/espanso-modulo/src/wizard/mod.rs b/espanso-modulo/src/wizard/mod.rs index 07fcc20..719637f 100644 --- a/espanso-modulo/src/wizard/mod.rs +++ b/espanso-modulo/src/wizard/mod.rs @@ -30,6 +30,7 @@ pub struct WizardOptions { pub is_accessibility_page_enabled: bool, pub window_icon_path: Option, + pub welcome_image_path: Option, pub accessibility_image_1_path: Option, pub accessibility_image_2_path: Option,