diff --git a/README.md b/README.md
index 12e9f82..5f198cc 100644
--- a/README.md
+++ b/README.md
@@ -27,9 +27,23 @@ cd build
ninja
```
-To install, use `ninja install`, then execute with `io.github.elementary-community.app-generator`
+To install, use `ninja install`, then execute with `io.github.ecommunity.app-generator`
```bash
ninja install
-io.github.elementary-community.app-generator
+io.github.ecommunity.app-generator
+```
+
+## Flatpak
+
+Run `flatpak-builder` to configure the build environment, download dependencies, build, and install
+
+```bash
+ flatpak-builder build io.github.ecommunity.app-generator.yml --user --install --force-clean --install-deps-from=appcenter
+```
+
+Then execute with
+
+```bash
+ flatpak run io.github.ecommunity.app-generator
```
\ No newline at end of file
diff --git a/data/app-generator.appdata.xml.in b/data/app-generator.appdata.xml.in
index 9b857fc..a03b8a6 100644
--- a/data/app-generator.appdata.xml.in
+++ b/data/app-generator.appdata.xml.in
@@ -16,6 +16,15 @@
elementary Community
+
+
+
+
+ First Release!!!
+
+
+
+
https://github.com/elementary-community/app-generator
https://github.com/elementary-community/app-generator/issues
io.github.ecommunity.app-generator.desktop
diff --git a/data/icons/16.svg b/data/icons/16.svg
new file mode 100644
index 0000000..311a41a
--- /dev/null
+++ b/data/icons/16.svg
@@ -0,0 +1,229 @@
+
+
diff --git a/data/icons/24.svg b/data/icons/24.svg
new file mode 100644
index 0000000..c1f673a
--- /dev/null
+++ b/data/icons/24.svg
@@ -0,0 +1,229 @@
+
+
diff --git a/data/meson.build b/data/meson.build
index 65ec576..83921ab 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,4 +1,4 @@
-icon_sizes = ['32', '48', '64', '128']
+icon_sizes = ['16', '24', '32', '48', '64', '128']
foreach i : icon_sizes
install_data(
diff --git a/meson.build b/meson.build
index 89bc18c..16ddf04 100644
--- a/meson.build
+++ b/meson.build
@@ -43,6 +43,7 @@ executable(
gresource,
'src/Application.vala',
'src/MainWindow.vala',
+ 'src/Views/Developer.vala',
'src/Views/Form.vala',
'src/Views/Success.vala',
'src/Widgets/Stepper.vala',
diff --git a/src/Application.vala b/src/Application.vala
index 08cea2c..236ba57 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
-* SPDX-FileCopyrightText: 2021 Your Name
+* SPDX-FileCopyrightText: 2024 Alain
*/
public class AppGenerator : Gtk.Application {
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 1f0878f..d07afa1 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
-* SPDX-FileCopyrightText: 2024 Alain
+* SPDX-FileCopyrightText: 2024 Alain
*/
public class MainWindow : Gtk.ApplicationWindow {
@@ -42,55 +42,48 @@ public class MainWindow : Gtk.ApplicationWindow {
var left_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
valign = CENTER,
- hexpand = true,
- margin_start = 24,
- margin_end = 24,
- margin_bottom = 24
+ margin_start = 64,
+ margin_end = 64,
+ margin_bottom = 32
};
left_box.append (project_icon);
left_box.append (title_label);
left_box.append (description_label);
var stepper = new Widgets.Stepper () {
- margin_start = 24
+ margin_start = 24,
+ margin_end = 24,
+ margin_bottom = 24
};
- stepper.add_step ("1", _("App Type"));
- stepper.add_step ("2", _("Developer Data"));
- stepper.add_step ("3", _("Application Data"));
-
- stepper.activeStepChange.connect (() => {
- print ("Index %d\n".printf (stepper.active_index));
- });
+ stepper.add_step (_("Developer"));
+ stepper.add_step (_("Application"));
+ stepper.add_step (_("Finalized"));
+ var developer_view = new Views.Developer ();
var form_view = new Views.Form ();
var success_view = new Views.Success ();
main_stack = new Gtk.Stack () {
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
};
+ main_stack.add_named (developer_view, "developer");
main_stack.add_named (form_view, "form");
main_stack.add_named (success_view, "success");
- var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6);
+ var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
form_box.append (stepper);
- form_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
- margin_start = 24,
- margin_end = 24,
- margin_top = 12,
- margin_bottom = 12
- });
form_box.append (main_stack);
- var main_box = new Gtk.CenterBox () {
+ var main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
hexpand = true,
vexpand = true
};
- main_box.start_widget = left_box;
- main_box.center_widget = new Gtk.Separator (Gtk.Orientation.VERTICAL) {
+ main_box.append (left_box);
+ main_box.append (new Gtk.Separator (Gtk.Orientation.VERTICAL) {
margin_bottom = 32
- };
- main_box.end_widget = form_box;
+ });
+ main_box.append (form_box);
var toolbar_view = new Adw.ToolbarView ();
toolbar_view.add_top_bar (headerbar);
@@ -114,17 +107,33 @@ public class MainWindow : Gtk.ApplicationWindow {
form_view.created.connect ((project_naame, location) => {
success_view.project_location = location + "/" + project_naame;
+ stepper.active_index = 2;
main_stack.visible_child_name = "success";
success_view.animation = true;
Timeout.add_once (1000, () => {
success_view.animation = false;
- form_view.reset_form ();
});
});
- success_view.back.connect (() => {
+ form_view.back.connect (() => {
+ main_stack.visible_child_name = "developer";
+ });
+
+ developer_view.next.connect ((name, email) => {
+ stepper.active_index = 1;
main_stack.visible_child_name = "form";
+
+ form_view.developer_name = name;
+ form_view.developer_email = email;
+ });
+
+ success_view.back.connect (() => {
+ stepper.active_index = 0;
+ main_stack.visible_child_name = "developer";
+
+ developer_view.reset_form ();
+ form_view.reset_form ();
});
}
}
diff --git a/src/Views/Developer.vala b/src/Views/Developer.vala
new file mode 100644
index 0000000..8ba5833
--- /dev/null
+++ b/src/Views/Developer.vala
@@ -0,0 +1,74 @@
+/*
+* SPDX-License-Identifier: GPL-3.0-or-later
+* SPDX-FileCopyrightText: 2024 Alain
+*/
+
+public class Views.Developer : Adw.Bin {
+ private Granite.ValidatedEntry name_entry;
+ private Granite.ValidatedEntry email_entry;
+ private Gtk.Button next_button;
+
+ public signal void next (string name, string email);
+
+ construct {
+ Regex? email_regex = null;
+ try {
+ email_regex = new Regex ("^\\S+@\\S+\\.\\S+$");
+ } catch (Error e) {
+ critical (e.message);
+ }
+
+ name_entry = new Granite.ValidatedEntry () {
+ margin_top = 6
+ };
+
+ email_entry = new Granite.ValidatedEntry () {
+ regex = email_regex,
+ margin_top = 6
+ };
+
+ next_button = new Gtk.Button.with_label (_("Next")) {
+ margin_bottom = 32,
+ sensitive = false,
+ vexpand = true,
+ valign = END
+ };
+ next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
+
+ var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
+ form_box.append (new Gtk.Label (_("Developer")) {
+ halign = START,
+ css_classes = { Granite.STYLE_CLASS_H1_LABEL }
+ });
+ form_box.append (new Granite.HeaderLabel (_("Name:")));
+ form_box.append (name_entry);
+ form_box.append (new Granite.HeaderLabel (_("Email:")));
+ form_box.append (email_entry);
+ form_box.append (next_button);
+
+ var content_box = new Adw.Bin () {
+ margin_start = 24,
+ margin_end = 24,
+ hexpand = true,
+ child = form_box
+ };
+
+ child = content_box;
+
+ name_entry.changed.connect (check_valid);
+ email_entry.changed.connect (check_valid);
+
+ next_button.clicked.connect (() => {
+ next (name_entry.text, email_entry.text);
+ });
+ }
+
+ private void check_valid () {
+ next_button.sensitive = name_entry.is_valid && email_entry.is_valid;
+ }
+
+ public void reset_form () {
+ name_entry.text = "";
+ email_entry.text = "";
+ }
+}
\ No newline at end of file
diff --git a/src/Views/Form.vala b/src/Views/Form.vala
index cc33f6c..2bf7f08 100644
--- a/src/Views/Form.vala
+++ b/src/Views/Form.vala
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
-* SPDX-FileCopyrightText: 2021 Your Name
+* SPDX-FileCopyrightText: 2024 Alain
*/
public class Views.Form : Adw.Bin {
@@ -10,8 +10,12 @@ public class Views.Form : Adw.Bin {
private Gtk.Entry location_entry;
private Granite.Toast toast;
+ public signal void back ();
public signal void created (string project_name, string location);
+ public string developer_name { get; set; }
+ public string developer_email { get; set; }
+
construct {
Regex? project_name_regex = null;
Regex? identifier_regex = null;
@@ -73,35 +77,41 @@ public class Views.Form : Adw.Bin {
button_stack.add_named (new Gtk.Label (_("Create Project")), "button");
button_stack.add_named (spinner, "spinner");
+ var back_button = new Gtk.Button () {
+ child = new Gtk.Image.from_icon_name ("go-previous-symbolic")
+ };
+
var create_button = new Gtk.Button () {
child = button_stack,
- margin_bottom = 32,
- sensitive = false,
- vexpand = true,
- valign = END
+ hexpand = true,
+ sensitive = false
};
create_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
+ var buttons_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) {
+ vexpand = true,
+ valign = END,
+ margin_bottom = 32,
+ };
+ buttons_box.append (back_button);
+ buttons_box.append (create_button);
+
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
- form_box.append (new Gtk.Label (_("Step 1/3")) {
- halign = START,
- css_classes = { Granite.STYLE_CLASS_DIM_LABEL }
- });
- form_box.append (new Gtk.Label (_("Sign Up")) {
+ form_box.append (new Gtk.Label (_("Aplication")) {
halign = START,
css_classes = { Granite.STYLE_CLASS_H1_LABEL }
});
form_box.append (new Granite.HeaderLabel (_("Project Name:")));
form_box.append (project_name_entry);
- form_box.append (project_name_description);
+ // form_box.append (project_name_description);
form_box.append (new Granite.HeaderLabel (_("Organization Identifier:")));
form_box.append (identifier_entry);
- form_box.append (identifier_description);
+ // form_box.append (identifier_description);
form_box.append (new Granite.HeaderLabel (_("Aplication ID:")));
form_box.append (aplication_id_entry);
form_box.append (new Granite.HeaderLabel (_("Location:")));
form_box.append (location_entry);
- form_box.append (create_button);
+ form_box.append (buttons_box);
var content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
margin_start = 24,
@@ -153,6 +163,10 @@ public class Views.Form : Adw.Bin {
}
});
+ back_button.clicked.connect (() => {
+ back ();
+ });
+
create_button.clicked.connect (() => {
clone_repo_async (location_entry.text, project_name_entry.text, aplication_id_entry.text, button_stack);
});
@@ -204,6 +218,8 @@ public class Views.Form : Adw.Bin {
rename_file (appdata_file, new_appdata_file);
set_file_content (new_appdata_file, "{{APPLICATION_ID}}", aplication_id);
set_file_content (new_appdata_file, "{{PROJECT_NAME}}", project_name);
+ set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
+ set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
// Desltop Files
string desktop_file = GLib.Path.build_filename (project_folder, "data", "{{PROJECT_NAME}}.desktop.in");
@@ -233,11 +249,15 @@ public class Views.Form : Adw.Bin {
string src_application_file = GLib.Path.build_filename (project_folder, "src", "Application.vala");
set_file_content (src_application_file, "{{APPLICATION_ID_GSCHEMA}}", aplication_id_schema);
set_file_content (src_application_file, "{{APPLICATION_ID}}", aplication_id);
+ set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
+ set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
// src window
string src_window_file = GLib.Path.build_filename (project_folder, "src", "MainWindow.vala");
set_file_content (src_window_file, "{{APPLICATION_ID_GSCHEMA}}", aplication_id_schema);
set_file_content (src_window_file, "{{APPLICATION_ID}}", aplication_id);
+ set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
+ set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
created (project_name_entry.text, location_entry.text);
}
@@ -246,7 +266,6 @@ public class Views.Form : Adw.Bin {
project_name_entry.text = "";
identifier_entry.text = "";
aplication_id_entry.text = "";
- location_entry.text = "";
}
private void set_file_content (string filename, string key, string value) {
diff --git a/src/Views/Success.vala b/src/Views/Success.vala
index a83de52..99dd548 100644
--- a/src/Views/Success.vala
+++ b/src/Views/Success.vala
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
-* SPDX-FileCopyrightText: 2021 Your Name
+* SPDX-FileCopyrightText: 2024 Alain
*/
public class Views.Success : Adw.Bin {
@@ -28,10 +28,11 @@ public class Views.Success : Adw.Bin {
};
var success_label = new Gtk.Label (_("The project was created successfully")) {
- wrap = true
+ wrap = true,
+ justify = CENTER
};
- success_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);
+ success_label.add_css_class (Granite.STYLE_CLASS_H1_LABEL);
var option_listbox = new Gtk.ListBox () {
margin_top = 24
@@ -41,13 +42,15 @@ public class Views.Success : Adw.Bin {
option_listbox.add_css_class ("separators");
option_listbox.append (create_row (_("Open in the File Browser"), "folder"));
- option_listbox.append (create_row (_("Open in Terminal"), "utilities-terminal"));
+ // option_listbox.append (create_row (_("Open in Terminal"), "utilities-terminal"));
option_listbox.append (create_row (_("Create New Project"), "window-new"));
var success_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 12) {
vexpand = true,
valign = CENTER,
- halign = CENTER
+ halign = CENTER,
+ margin_start = 24,
+ margin_end = 24
};
success_box.append (success_icon);
@@ -59,8 +62,6 @@ public class Views.Success : Adw.Bin {
option_listbox.row_activated.connect ((row) => {
if (row.get_index () == 0) {
open_file_browser ();
- } else if (row.get_index () == 1) {
- open_terminal ();
} else {
back ();
}
diff --git a/src/Widgets/Stepper.vala b/src/Widgets/Stepper.vala
index b9db056..1c3ae6a 100644
--- a/src/Widgets/Stepper.vala
+++ b/src/Widgets/Stepper.vala
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
-* SPDX-FileCopyrightText: 2024 Alain
+* SPDX-FileCopyrightText: 2024 Alain
*/
public class Widgets.Stepper : Gtk.Grid {
@@ -33,12 +33,12 @@ public class Widgets.Stepper : Gtk.Grid {
private Gee.HashMap stepper_map = new Gee.HashMap ();
construct {
- main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 24);
+ main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
attach (main_box, 0, 0);
}
- public void add_step (string number, string name) {
- var number_button = new Gtk.Button.with_label (number) {
+ public void add_step (string name) {
+ var number_button = new Gtk.Button.with_label ((index + 1).to_string ()) {
width_request = 24
};
number_button.set_data ("index", index);
@@ -47,9 +47,9 @@ public class Widgets.Stepper : Gtk.Grid {
number_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
}
- number_button.clicked.connect (() => {
- active_index = number_button.get_data ("index");
- });
+ // number_button.clicked.connect (() => {
+ // active_index = number_button.get_data ("index");
+ // });
var name_label = new Gtk.Label (name);
name_label.add_css_class ("fw-500");
@@ -58,6 +58,15 @@ public class Widgets.Stepper : Gtk.Grid {
button_box.append (number_button);
button_box.append (name_label);
+ if (index > 0) {
+ main_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
+ width_request = 24,
+ valign = CENTER,
+ margin_start = 12,
+ margin_end = 12
+ });
+ }
+
main_box.append (button_box);
stepper_map[index] = number_button;