diff --git a/espanso-modulo/build.rs b/espanso-modulo/build.rs
index 3f5b2f2..cdf0dd3 100644
--- a/espanso-modulo/build.rs
+++ b/espanso-modulo/build.rs
@@ -115,6 +115,8 @@ fn build_native() {
.file("src/sys/common/common.cpp")
.file("src/sys/wizard/wizard.cpp")
.file("src/sys/wizard/wizard_gui.cpp")
+ .file("src/sys/welcome/welcome.cpp")
+ .file("src/sys/welcome/welcome_gui.cpp")
.flag("/EHsc")
.include(wx_include_dir)
.include(wx_include_msvc_dir)
diff --git a/espanso-modulo/src/lib.rs b/espanso-modulo/src/lib.rs
index fe69ad7..2eb870a 100644
--- a/espanso-modulo/src/lib.rs
+++ b/espanso-modulo/src/lib.rs
@@ -22,5 +22,6 @@ extern crate lazy_static;
pub mod form;
pub mod search;
+pub mod welcome;
pub mod wizard;
mod sys;
\ No newline at end of file
diff --git a/espanso-modulo/src/sys/interop/interop.h b/espanso-modulo/src/sys/interop/interop.h
index 2a571e4..351646a 100644
--- a/espanso-modulo/src/sys/interop/interop.h
+++ b/espanso-modulo/src/sys/interop/interop.h
@@ -118,4 +118,13 @@ typedef struct WizardMetadata {
int (*enable_accessibility)();
int (*is_accessibility_enabled)();
void (*on_completed)();
-} WizardMetadata;
\ No newline at end of file
+} WizardMetadata;
+
+typedef struct WelcomeMetadata {
+ const char *window_icon_path;
+ const char *tray_image_path;
+
+ // METHODS
+ int (*dont_show_again_changed)(int);
+} WelcomeMetadata;
+
diff --git a/espanso-modulo/src/sys/interop/mod.rs b/espanso-modulo/src/sys/interop/mod.rs
index cbddb98..d583e6e 100644
--- a/espanso-modulo/src/sys/interop/mod.rs
+++ b/espanso-modulo/src/sys/interop/mod.rs
@@ -137,6 +137,15 @@ pub struct WizardMetadata {
pub on_completed: extern fn(),
}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct WelcomeMetadata {
+ pub window_icon_path: *const c_char,
+ pub tray_image_path: *const c_char,
+
+ pub dont_show_again_changed: extern fn(c_int),
+}
+
// Native bindings
#[allow(improper_ctypes)]
@@ -162,4 +171,7 @@ extern "C" {
// WIZARD
pub(crate) fn interop_show_wizard(metadata: *const WizardMetadata);
+
+ // WELCOME
+ pub(crate) fn interop_show_welcome(metadata: *const WelcomeMetadata);
}
diff --git a/espanso-modulo/src/sys/mod.rs b/espanso-modulo/src/sys/mod.rs
index b07c15a..dc479ff 100644
--- a/espanso-modulo/src/sys/mod.rs
+++ b/espanso-modulo/src/sys/mod.rs
@@ -20,8 +20,11 @@
pub mod form;
pub mod search;
pub mod wizard;
+pub mod welcome;
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
#[allow(non_snake_case)]
-pub mod interop;
\ No newline at end of file
+pub mod interop;
+
+mod util;
\ No newline at end of file
diff --git a/espanso-modulo/src/sys/util.rs b/espanso-modulo/src/sys/util.rs
new file mode 100644
index 0000000..6ca1d78
--- /dev/null
+++ b/espanso-modulo/src/sys/util.rs
@@ -0,0 +1,31 @@
+/*
+ * This file is part of espanso.
+ *
+ * Copyright (C) 2019-2021 Federico Terzi
+ *
+ * espanso is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * espanso is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with espanso. If not, see .
+ */
+
+use std::os::raw::{c_char};
+use std::ffi::CString;
+
+pub fn convert_to_cstring_or_null(str: Option) -> (Option, *const c_char) {
+ let c_string =
+ str.map(|str| CString::new(str).expect("unable to convert Option to CString"));
+ let c_ptr = c_string
+ .as_ref()
+ .map_or(std::ptr::null(), |path| path.as_ptr());
+
+ (c_string, c_ptr)
+}
\ No newline at end of file
diff --git a/espanso-modulo/src/sys/welcome/mod.rs b/espanso-modulo/src/sys/welcome/mod.rs
new file mode 100644
index 0000000..afdf951
--- /dev/null
+++ b/espanso-modulo/src/sys/welcome/mod.rs
@@ -0,0 +1,61 @@
+/*
+ * This file is part of modulo.
+ *
+ * Copyright (C) 2020-2021 Federico Terzi
+ *
+ * modulo is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * modulo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with modulo. If not, see .
+ */
+
+use std::os::raw::{c_int};
+use std::{ sync::Mutex};
+
+use crate::sys::util::convert_to_cstring_or_null;
+use crate::{sys::interop::{WelcomeMetadata}, welcome::{WelcomeHandlers, WelcomeOptions}};
+
+lazy_static! {
+ static ref HANDLERS: Mutex> = Mutex::new(None);
+}
+
+pub fn show(options: WelcomeOptions) {
+ let (_c_window_icon_path, c_window_icon_path_ptr) =
+ convert_to_cstring_or_null(options.window_icon_path);
+ let (_c_tray_image_path, c_tray_image_path_ptr) =
+ convert_to_cstring_or_null(options.tray_image_path);
+
+ extern "C" fn dont_show_again_changed(dont_show: c_int) {
+ let lock = HANDLERS
+ .lock()
+ .expect("unable to acquire lock in dont_show_again_changed method");
+ let handlers_ref = (*lock).as_ref().expect("unable to unwrap handlers");
+ if let Some(handler_ref) = handlers_ref.dont_show_again_changed.as_ref() {
+ let value = if dont_show == 1 { true } else { false };
+ (*handler_ref)(value);
+ }
+ }
+
+ {
+ let mut lock = HANDLERS.lock().expect("unable to acquire handlers lock");
+ *lock = Some(options.handlers)
+ }
+
+ let welcome_metadata = WelcomeMetadata {
+ window_icon_path: c_window_icon_path_ptr,
+ tray_image_path: c_tray_image_path_ptr,
+ dont_show_again_changed,
+ };
+
+ unsafe {
+ super::interop::interop_show_welcome(&welcome_metadata);
+ }
+}
diff --git a/espanso-modulo/src/sys/welcome/welcome.cpp b/espanso-modulo/src/sys/welcome/welcome.cpp
new file mode 100644
index 0000000..5b4f862
--- /dev/null
+++ b/espanso-modulo/src/sys/welcome/welcome.cpp
@@ -0,0 +1,107 @@
+/*
+ * This file is part of modulo.
+ *
+ * Copyright (C) 2020-2021 Federico Terzi
+ *
+ * modulo is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * modulo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with modulo. If not, see .
+ */
+
+#define _UNICODE
+
+#include "../common/common.h"
+#include "../interop/interop.h"
+#include "./welcome_gui.h"
+
+#include
+#include
+#include
+
+WelcomeMetadata *metadata = nullptr;
+
+// App Code
+
+class WelcomeApp : public wxApp
+{
+public:
+ virtual bool OnInit();
+};
+
+class DerivedWelcomeFrame : public WelcomeFrame
+{
+protected:
+ void on_dont_show_change( wxCommandEvent& event );
+ void on_complete( wxCommandEvent& event );
+
+public:
+ DerivedWelcomeFrame(wxWindow *parent);
+};
+
+DerivedWelcomeFrame::DerivedWelcomeFrame(wxWindow *parent)
+ : WelcomeFrame(parent)
+{
+ // Welcome images
+
+ if (metadata->tray_image_path)
+ {
+ wxBitmap trayBitmap = wxBitmap(metadata->tray_image_path, wxBITMAP_TYPE_PNG);
+ this->tray_bitmap->SetBitmap(trayBitmap);
+ }
+ else
+ {
+ this->tray_info_label->Hide();
+ }
+}
+
+void DerivedWelcomeFrame::on_dont_show_change( wxCommandEvent& event ) {
+ if (metadata->dont_show_again_changed) {
+ int value = this->dont_show_checkbox->IsChecked() ? 1 : 0;
+ metadata->dont_show_again_changed(value);
+ }
+}
+
+void DerivedWelcomeFrame::on_complete( wxCommandEvent& event ) {
+ Close(true);
+}
+
+
+bool WelcomeApp::OnInit()
+{
+ wxInitAllImageHandlers();
+ DerivedWelcomeFrame *frame = new DerivedWelcomeFrame(NULL);
+
+ if (metadata->window_icon_path)
+ {
+ setFrameIcon(metadata->window_icon_path, frame);
+ }
+
+ frame->Show(true);
+
+ Activate(frame);
+
+ return true;
+}
+
+extern "C" void interop_show_welcome(WelcomeMetadata *_metadata)
+{
+// Setup high DPI support on Windows
+#ifdef __WXMSW__
+ SetProcessDPIAware();
+#endif
+
+ metadata = _metadata;
+
+ wxApp::SetInstance(new WelcomeApp());
+ int argc = 0;
+ wxEntry(argc, (char **)nullptr);
+}
\ No newline at end of file
diff --git a/espanso-modulo/src/sys/welcome/welcome.fbp b/espanso-modulo/src/sys/welcome/welcome.fbp
new file mode 100644
index 0000000..36f35e4
--- /dev/null
+++ b/espanso-modulo/src/sys/welcome/welcome.fbp
@@ -0,0 +1,683 @@
+
+
+
+
+ ;
+ C++
+ 1
+ source_name
+ 0
+ 0
+ res
+ UTF-8
+ connect
+ welcome_gui
+ 1000
+ none
+
+ 0
+ Welcome
+
+ .
+ #define _UNICODE
+ 1
+ 1
+ 1
+ 1
+ UI
+ 0
+ 0
+
+ 0
+ wxAUI_MGR_DEFAULT
+ wxSYS_COLOUR_WINDOW
+ wxBOTH
+
+ 1
+ 1
+ impl_virtual
+
+
+
+ 0
+ wxID_ANY
+
+
+ WelcomeFrame
+
+ 521,544
+ wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU
+ ; ; forward_declare
+ Espanso is running!
+
+
+
+ wxTAB_TRAVERSAL
+ 1
+
+
+ bSizer1
+ wxVERTICAL
+ none
+
+ 5
+ wxEXPAND
+ 0
+
+ 10
+ protected
+ 0
+
+
+
+ 10
+ wxALIGN_CENTER|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+ ,90,92,20,70,0
+ 0
+ 0
+ wxID_ANY
+ Yey, Espanso is running!
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ title_label
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+
+
+ -1
+
+
+
+ 10
+ wxALIGN_CENTER|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ You should now see its icon on the tray bar:
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ tray_info_label
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+
+
+ -1
+
+
+
+ 5
+ 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
+ tray_bitmap
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+ ; ; forward_declare
+ 0
+
+
+
+
+
+
+
+ 10
+
+ 0
+
+ 10
+ protected
+ 0
+
+
+
+ 10
+ wxALIGN_CENTER|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Try typing ":espanso" below (without quotes)
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ test_label
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+
+
+ -1
+
+
+
+ 10
+ wxALL|wxEXPAND
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+ ,90,90,16,70,0
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+
+ 0
+
+ 1
+ test_text_ctrl
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+ 10
+ wxALIGN_CENTER|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Do you want to know more? Visit the documentation:
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ doc_label
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+
+
+ -1
+
+
+
+ 10
+ wxALIGN_CENTER|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+
+ wxID_ANY
+ https://espanso.org/docs/get-started/
+
+ 0
+
+
+ 0
+
+ 1
+ m_hyperlink1
+
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+ wxHL_DEFAULT_STYLE
+ ; ; forward_declare
+ 0
+
+ https://espanso.org/docs/get-started/
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 0
+ protected
+ 0
+
+
+
+ 10
+ wxEXPAND
+ 0
+
+
+ bSizer2
+ wxHORIZONTAL
+ none
+
+ 10
+ wxALIGN_CENTER_VERTICAL|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Don't show this again
+
+ 0
+
+
+ 0
+
+ 1
+ dont_show_checkbox
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ on_dont_show_change
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 0
+ protected
+ 0
+
+
+
+ 10
+ wxALIGN_CENTER_VERTICAL|wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+
+ 1
+ 0
+
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+
+ 0
+ 0
+ wxID_ANY
+ Got it!
+
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ got_it_btn
+ 1
+
+
+ protected
+ 1
+
+
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ on_complete
+
+
+
+
+
+
+
+
diff --git a/espanso-modulo/src/sys/welcome/welcome_gui.cpp b/espanso-modulo/src/sys/welcome/welcome_gui.cpp
new file mode 100644
index 0000000..6b06dfc
--- /dev/null
+++ b/espanso-modulo/src/sys/welcome/welcome_gui.cpp
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#define _UNICODE
+
+#include "welcome_gui.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+WelcomeFrame::WelcomeFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
+{
+ this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+ this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
+
+ wxBoxSizer* bSizer1;
+ bSizer1 = new wxBoxSizer( wxVERTICAL );
+
+
+ bSizer1->Add( 0, 10, 0, wxEXPAND, 5 );
+
+ title_label = new wxStaticText( this, wxID_ANY, wxT("Yey, Espanso is running!"), wxDefaultPosition, wxDefaultSize, 0 );
+ title_label->Wrap( -1 );
+ title_label->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
+
+ bSizer1->Add( title_label, 0, wxALIGN_CENTER|wxALL, 10 );
+
+ tray_info_label = new wxStaticText( this, wxID_ANY, wxT("You should now see its icon on the tray bar:"), wxDefaultPosition, wxDefaultSize, 0 );
+ tray_info_label->Wrap( -1 );
+ bSizer1->Add( tray_info_label, 0, wxALIGN_CENTER|wxALL, 10 );
+
+ tray_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
+ bSizer1->Add( tray_bitmap, 0, wxALIGN_CENTER|wxALL, 5 );
+
+
+ bSizer1->Add( 0, 10, 0, 0, 10 );
+
+ test_label = new wxStaticText( this, wxID_ANY, wxT("Try typing \":espanso\" below (without quotes)"), wxDefaultPosition, wxDefaultSize, 0 );
+ test_label->Wrap( -1 );
+ bSizer1->Add( test_label, 0, wxALIGN_CENTER|wxALL, 10 );
+
+ test_text_ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ test_text_ctrl->SetFont( wxFont( 16, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
+
+ bSizer1->Add( test_text_ctrl, 0, wxALL|wxEXPAND, 10 );
+
+ doc_label = new wxStaticText( this, wxID_ANY, wxT("Do you want to know more? Visit the documentation:"), wxDefaultPosition, wxDefaultSize, 0 );
+ doc_label->Wrap( -1 );
+ bSizer1->Add( doc_label, 0, wxALIGN_CENTER|wxALL, 10 );
+
+ m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, wxT("https://espanso.org/docs/get-started/"), wxT("https://espanso.org/docs/get-started/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ bSizer1->Add( m_hyperlink1, 0, wxALIGN_CENTER|wxALL, 10 );
+
+
+ bSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ wxBoxSizer* bSizer2;
+ bSizer2 = new wxBoxSizer( wxHORIZONTAL );
+
+ dont_show_checkbox = new wxCheckBox( this, wxID_ANY, wxT("Don't show this again"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizer2->Add( dont_show_checkbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
+
+
+ bSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ got_it_btn = new wxButton( this, wxID_ANY, wxT("Got it!"), wxDefaultPosition, wxDefaultSize, 0 );
+
+ got_it_btn->SetDefault();
+ bSizer2->Add( got_it_btn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
+
+
+ bSizer1->Add( bSizer2, 0, wxEXPAND, 10 );
+
+
+ this->SetSizer( bSizer1 );
+ this->Layout();
+
+ this->Centre( wxBOTH );
+
+ // Connect Events
+ dont_show_checkbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WelcomeFrame::on_dont_show_change ), NULL, this );
+ got_it_btn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WelcomeFrame::on_complete ), NULL, this );
+}
+
+WelcomeFrame::~WelcomeFrame()
+{
+ // Disconnect Events
+ dont_show_checkbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WelcomeFrame::on_dont_show_change ), NULL, this );
+ got_it_btn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WelcomeFrame::on_complete ), NULL, this );
+
+}
diff --git a/espanso-modulo/src/sys/welcome/welcome_gui.h b/espanso-modulo/src/sys/welcome/welcome_gui.h
new file mode 100644
index 0000000..44e21fe
--- /dev/null
+++ b/espanso-modulo/src/sys/welcome/welcome_gui.h
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+///////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Class WelcomeFrame
+///////////////////////////////////////////////////////////////////////////////
+class WelcomeFrame : public wxFrame
+{
+ private:
+
+ protected:
+ wxStaticText* title_label;
+ wxStaticText* tray_info_label;
+ wxStaticBitmap* tray_bitmap;
+ wxStaticText* test_label;
+ wxTextCtrl* test_text_ctrl;
+ wxStaticText* doc_label;
+ wxHyperlinkCtrl* m_hyperlink1;
+ wxCheckBox* dont_show_checkbox;
+ wxButton* got_it_btn;
+
+ // Virtual event handlers, overide them in your derived class
+ virtual void on_dont_show_change( wxCommandEvent& event ) { event.Skip(); }
+ virtual void on_complete( wxCommandEvent& event ) { event.Skip(); }
+
+
+ public:
+
+ WelcomeFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Espanso is running!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 521,544 ), long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL );
+
+ ~WelcomeFrame();
+
+};
+
diff --git a/espanso-modulo/src/sys/wizard/mod.rs b/espanso-modulo/src/sys/wizard/mod.rs
index 542512e..9178106 100644
--- a/espanso-modulo/src/sys/wizard/mod.rs
+++ b/espanso-modulo/src/sys/wizard/mod.rs
@@ -20,6 +20,7 @@
use std::os::raw::{c_char, c_int};
use std::{ffi::CString, sync::Mutex};
+use crate::sys::util::convert_to_cstring_or_null;
use crate::{sys::interop::{WIZARD_MIGRATE_RESULT_CLEAN_FAILURE, WIZARD_MIGRATE_RESULT_DIRTY_FAILURE, WIZARD_MIGRATE_RESULT_SUCCESS, WIZARD_MIGRATE_RESULT_UNKNOWN_FAILURE, WizardMetadata}, wizard::{WizardHandlers, WizardOptions}};
lazy_static! {
@@ -181,14 +182,4 @@ pub fn show(options: WizardOptions) {
unsafe {
super::interop::interop_show_wizard(&wizard_metadata);
}
-}
-
-fn convert_to_cstring_or_null(str: Option) -> (Option, *const c_char) {
- let c_string =
- str.map(|str| CString::new(str).expect("unable to convert Option to CString"));
- let c_ptr = c_string
- .as_ref()
- .map_or(std::ptr::null(), |path| path.as_ptr());
-
- (c_string, c_ptr)
-}
+}
\ No newline at end of file
diff --git a/espanso-modulo/src/welcome/mod.rs b/espanso-modulo/src/welcome/mod.rs
new file mode 100644
index 0000000..0fbae5f
--- /dev/null
+++ b/espanso-modulo/src/welcome/mod.rs
@@ -0,0 +1,31 @@
+/*
+ * This file is part of modulo.
+ *
+ * Copyright (C) 2020-2021 Federico Terzi
+ *
+ * modulo is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * modulo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with modulo. If not, see .
+ */
+
+pub use crate::sys::welcome::show;
+
+pub struct WelcomeOptions {
+ pub window_icon_path: Option,
+ pub tray_image_path: Option,
+
+ pub handlers: WelcomeHandlers,
+}
+
+pub struct WelcomeHandlers {
+ pub dont_show_again_changed: Option>,
+}