feat(modulo): improve wizard welcome screen

This commit is contained in:
Federico Terzi 2021-06-13 17:17:51 +02:00
parent 2cba576084
commit e544e59580
8 changed files with 84 additions and 6 deletions

View File

@ -102,6 +102,7 @@ typedef struct WizardMetadata {
const int is_accessibility_page_enabled; const int is_accessibility_page_enabled;
const char *window_icon_path; const char *window_icon_path;
const char *welcome_image_path;
const char *accessibility_image_1_path; const char *accessibility_image_1_path;
const char *accessibility_image_2_path; const char *accessibility_image_2_path;

View File

@ -120,6 +120,7 @@ pub struct WizardMetadata {
pub is_accessibility_page_enabled: c_int, pub is_accessibility_page_enabled: c_int,
pub window_icon_path: *const c_char, 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_1_path: *const c_char,
pub accessibility_image_2_path: *const c_char, pub accessibility_image_2_path: *const c_char,

View File

@ -34,6 +34,8 @@ pub fn show(options: WizardOptions) {
let (_c_window_icon_path, c_window_icon_path_ptr) = let (_c_window_icon_path, c_window_icon_path_ptr) =
convert_to_cstring_or_null(options.window_icon_path); 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) = let (_c_accessibility_image_1_path, c_accessibility_image_1_path_ptr) =
convert_to_cstring_or_null(options.accessibility_image_1_path); convert_to_cstring_or_null(options.accessibility_image_1_path);
let (_c_accessibility_image_2_path, c_accessibility_image_2_path_ptr) = 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, 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_1_path: c_accessibility_image_1_path_ptr,
accessibility_image_2_path: c_accessibility_image_2_path_ptr, accessibility_image_2_path: c_accessibility_image_2_path_ptr,

View File

@ -87,6 +87,7 @@ protected:
void check_timer_tick( wxTimerEvent& event ); void check_timer_tick( wxTimerEvent& event );
void on_page_changed( wxBookCtrlEvent& event ); void on_page_changed( wxBookCtrlEvent& event );
void welcome_start_clicked(wxCommandEvent &event); void welcome_start_clicked(wxCommandEvent &event);
void migrate_compatibility_mode_clicked( wxCommandEvent& event );
void navigate_to_next_page_or_close(); void navigate_to_next_page_or_close();
void change_default_button(int target_page); void change_default_button(int target_page);
@ -99,6 +100,11 @@ DerivedFrame::DerivedFrame(wxWindow *parent)
{ {
// TODO: load images for accessibility page if on macOS // 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)); this->welcome_version_text->SetLabel(wxString::Format("( version %s )", metadata->version));
// Load the first page // Load the first page
@ -126,6 +132,10 @@ void DerivedFrame::welcome_start_clicked(wxCommandEvent &event)
this->navigate_to_next_page_or_close(); 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 ) { void DerivedFrame::check_timer_tick( wxTimerEvent& event ) {
if (this->m_simplebook->GetSelection() == LEGACY_VERSION_PAGE_INDEX) { if (this->m_simplebook->GetSelection() == LEGACY_VERSION_PAGE_INDEX) {
if (metadata->is_legacy_version_running) { if (metadata->is_legacy_version_running) {

View File

@ -183,6 +183,64 @@
<property name="name">bSizer2</property> <property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">welcome_image</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">256,256</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">20</property> <property name="border">20</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxTOP</property> <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxTOP</property>

View File

@ -29,6 +29,9 @@ WizardFrame::WizardFrame( wxWindow* parent, wxWindowID id, const wxString& title
wxBoxSizer* bSizer2; wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL ); 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 = new wxStaticText( welcome_panel, wxID_ANY, wxT("Welcome to Espanso!"), wxDefaultPosition, wxDefaultSize, 0 );
welcome_title_text->Wrap( -1 ); welcome_title_text->Wrap( -1 );
welcome_title_text->SetFont( wxFont( 18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); welcome_title_text->SetFont( wxFont( 18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );

View File

@ -10,21 +10,21 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/timer.h> #include <wx/timer.h>
#include <wx/string.h> #include <wx/bitmap.h>
#include <wx/stattext.h> #include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/bitmap.h> #include <wx/string.h>
#include <wx/image.h> #include <wx/stattext.h>
#include <wx/icon.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/hyperlink.h> #include <wx/hyperlink.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/statbmp.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/simplebook.h> #include <wx/simplebook.h>
#include <wx/frame.h> #include <wx/frame.h>
@ -43,6 +43,7 @@ class WizardFrame : public wxFrame
wxTimer check_timer; wxTimer check_timer;
wxSimplebook* m_simplebook; wxSimplebook* m_simplebook;
wxPanel* welcome_panel; wxPanel* welcome_panel;
wxStaticBitmap* welcome_image;
wxStaticText* welcome_title_text; wxStaticText* welcome_title_text;
wxStaticText* welcome_version_text; wxStaticText* welcome_version_text;
wxStaticText* welcome_description_text; wxStaticText* welcome_description_text;

View File

@ -30,6 +30,7 @@ pub struct WizardOptions {
pub is_accessibility_page_enabled: bool, pub is_accessibility_page_enabled: bool,
pub window_icon_path: Option<String>, pub window_icon_path: Option<String>,
pub welcome_image_path: Option<String>,
pub accessibility_image_1_path: Option<String>, pub accessibility_image_1_path: Option<String>,
pub accessibility_image_2_path: Option<String>, pub accessibility_image_2_path: Option<String>,