Skip to content

Commit abfc13f

Browse files
committed
first release
1 parent df97bb9 commit abfc13f

File tree

12 files changed

+653
-59
lines changed

12 files changed

+653
-59
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,23 @@ cd build
2727
ninja
2828
```
2929

30-
To install, use `ninja install`, then execute with `io.github.elementary-community.app-generator`
30+
To install, use `ninja install`, then execute with `io.github.ecommunity.app-generator`
3131

3232
```bash
3333
ninja install
34-
io.github.elementary-community.app-generator
34+
io.github.ecommunity.app-generator
35+
```
36+
37+
## Flatpak
38+
39+
Run `flatpak-builder` to configure the build environment, download dependencies, build, and install
40+
41+
```bash
42+
flatpak-builder build io.github.ecommunity.app-generator.yml --user --install --force-clean --install-deps-from=appcenter
43+
```
44+
45+
Then execute with
46+
47+
```bash
48+
flatpak run io.github.ecommunity.app-generator
3549
```

data/app-generator.appdata.xml.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
</screenshot>
1717
</screenshots>
1818
<developer_name translate="no">elementary Community</developer_name>
19+
20+
<releases>
21+
<release version="1.0.0" date="2024-10-08">
22+
<description>
23+
<p>First Release!!!</p>
24+
</description>
25+
</release>
26+
</releases>
27+
1928
<url type="homepage">https://github.com/elementary-community/app-generator</url>
2029
<url type="bugtracker">https://github.com/elementary-community/app-generator/issues</url>
2130
<launchable type="desktop-id">io.github.ecommunity.app-generator.desktop</launchable>

data/icons/16.svg

Lines changed: 229 additions & 0 deletions
Loading

data/icons/24.svg

Lines changed: 229 additions & 0 deletions
Loading

data/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
icon_sizes = ['32', '48', '64', '128']
1+
icon_sizes = ['16', '24', '32', '48', '64', '128']
22

33
foreach i : icon_sizes
44
install_data(

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ executable(
4343
gresource,
4444
'src/Application.vala',
4545
'src/MainWindow.vala',
46+
'src/Views/Developer.vala',
4647
'src/Views/Form.vala',
4748
'src/Views/Success.vala',
4849
'src/Widgets/Stepper.vala',

src/Application.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* SPDX-License-Identifier: GPL-3.0-or-later
3-
* SPDX-FileCopyrightText: 2021 Your Name <you@email.com>
3+
* SPDX-FileCopyrightText: 2024 Alain <alainmh23@gmail.com>
44
*/
55

66
public class AppGenerator : Gtk.Application {

src/MainWindow.vala

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* SPDX-License-Identifier: GPL-3.0-or-later
3-
* SPDX-FileCopyrightText: 2024 Alain <Alainmh23@gmail.com>
3+
* SPDX-FileCopyrightText: 2024 Alain <alainmh23@gmail.com>
44
*/
55

66
public class MainWindow : Gtk.ApplicationWindow {
@@ -42,55 +42,48 @@ public class MainWindow : Gtk.ApplicationWindow {
4242

4343
var left_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
4444
valign = CENTER,
45-
hexpand = true,
46-
margin_start = 24,
47-
margin_end = 24,
48-
margin_bottom = 24
45+
margin_start = 64,
46+
margin_end = 64,
47+
margin_bottom = 32
4948
};
5049
left_box.append (project_icon);
5150
left_box.append (title_label);
5251
left_box.append (description_label);
5352

5453
var stepper = new Widgets.Stepper () {
55-
margin_start = 24
54+
margin_start = 24,
55+
margin_end = 24,
56+
margin_bottom = 24
5657
};
57-
stepper.add_step ("1", _("App Type"));
58-
stepper.add_step ("2", _("Developer Data"));
59-
stepper.add_step ("3", _("Application Data"));
60-
61-
stepper.activeStepChange.connect (() => {
62-
print ("Index %d\n".printf (stepper.active_index));
63-
});
58+
stepper.add_step (_("Developer"));
59+
stepper.add_step (_("Application"));
60+
stepper.add_step (_("Finalized"));
6461

62+
var developer_view = new Views.Developer ();
6563
var form_view = new Views.Form ();
6664
var success_view = new Views.Success ();
6765

6866
main_stack = new Gtk.Stack () {
6967
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
7068
};
69+
main_stack.add_named (developer_view, "developer");
7170
main_stack.add_named (form_view, "form");
7271
main_stack.add_named (success_view, "success");
7372

74-
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6);
73+
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
7574
form_box.append (stepper);
76-
form_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
77-
margin_start = 24,
78-
margin_end = 24,
79-
margin_top = 12,
80-
margin_bottom = 12
81-
});
8275
form_box.append (main_stack);
8376

84-
var main_box = new Gtk.CenterBox () {
77+
var main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
8578
hexpand = true,
8679
vexpand = true
8780
};
8881

89-
main_box.start_widget = left_box;
90-
main_box.center_widget = new Gtk.Separator (Gtk.Orientation.VERTICAL) {
82+
main_box.append (left_box);
83+
main_box.append (new Gtk.Separator (Gtk.Orientation.VERTICAL) {
9184
margin_bottom = 32
92-
};
93-
main_box.end_widget = form_box;
85+
});
86+
main_box.append (form_box);
9487

9588
var toolbar_view = new Adw.ToolbarView ();
9689
toolbar_view.add_top_bar (headerbar);
@@ -114,17 +107,33 @@ public class MainWindow : Gtk.ApplicationWindow {
114107
form_view.created.connect ((project_naame, location) => {
115108
success_view.project_location = location + "/" + project_naame;
116109

110+
stepper.active_index = 2;
117111
main_stack.visible_child_name = "success";
118112
success_view.animation = true;
119113

120114
Timeout.add_once (1000, () => {
121115
success_view.animation = false;
122-
form_view.reset_form ();
123116
});
124117
});
125118

126-
success_view.back.connect (() => {
119+
form_view.back.connect (() => {
120+
main_stack.visible_child_name = "developer";
121+
});
122+
123+
developer_view.next.connect ((name, email) => {
124+
stepper.active_index = 1;
127125
main_stack.visible_child_name = "form";
126+
127+
form_view.developer_name = name;
128+
form_view.developer_email = email;
129+
});
130+
131+
success_view.back.connect (() => {
132+
stepper.active_index = 0;
133+
main_stack.visible_child_name = "developer";
134+
135+
developer_view.reset_form ();
136+
form_view.reset_form ();
128137
});
129138
}
130139
}

src/Views/Developer.vala

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-or-later
3+
* SPDX-FileCopyrightText: 2024 Alain <[email protected]>
4+
*/
5+
6+
public class Views.Developer : Adw.Bin {
7+
private Granite.ValidatedEntry name_entry;
8+
private Granite.ValidatedEntry email_entry;
9+
private Gtk.Button next_button;
10+
11+
public signal void next (string name, string email);
12+
13+
construct {
14+
Regex? email_regex = null;
15+
try {
16+
email_regex = new Regex ("^\\S+@\\S+\\.\\S+$");
17+
} catch (Error e) {
18+
critical (e.message);
19+
}
20+
21+
name_entry = new Granite.ValidatedEntry () {
22+
margin_top = 6
23+
};
24+
25+
email_entry = new Granite.ValidatedEntry () {
26+
regex = email_regex,
27+
margin_top = 6
28+
};
29+
30+
next_button = new Gtk.Button.with_label (_("Next")) {
31+
margin_bottom = 32,
32+
sensitive = false,
33+
vexpand = true,
34+
valign = END
35+
};
36+
next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
37+
38+
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
39+
form_box.append (new Gtk.Label (_("Developer")) {
40+
halign = START,
41+
css_classes = { Granite.STYLE_CLASS_H1_LABEL }
42+
});
43+
form_box.append (new Granite.HeaderLabel (_("Name:")));
44+
form_box.append (name_entry);
45+
form_box.append (new Granite.HeaderLabel (_("Email:")));
46+
form_box.append (email_entry);
47+
form_box.append (next_button);
48+
49+
var content_box = new Adw.Bin () {
50+
margin_start = 24,
51+
margin_end = 24,
52+
hexpand = true,
53+
child = form_box
54+
};
55+
56+
child = content_box;
57+
58+
name_entry.changed.connect (check_valid);
59+
email_entry.changed.connect (check_valid);
60+
61+
next_button.clicked.connect (() => {
62+
next (name_entry.text, email_entry.text);
63+
});
64+
}
65+
66+
private void check_valid () {
67+
next_button.sensitive = name_entry.is_valid && email_entry.is_valid;
68+
}
69+
70+
public void reset_form () {
71+
name_entry.text = "";
72+
email_entry.text = "";
73+
}
74+
}

src/Views/Form.vala

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* SPDX-License-Identifier: GPL-3.0-or-later
3-
* SPDX-FileCopyrightText: 2021 Your Name <you@email.com>
3+
* SPDX-FileCopyrightText: 2024 Alain <alainmh23@gmail.com>
44
*/
55

66
public class Views.Form : Adw.Bin {
@@ -10,8 +10,12 @@ public class Views.Form : Adw.Bin {
1010
private Gtk.Entry location_entry;
1111
private Granite.Toast toast;
1212

13+
public signal void back ();
1314
public signal void created (string project_name, string location);
1415

16+
public string developer_name { get; set; }
17+
public string developer_email { get; set; }
18+
1519
construct {
1620
Regex? project_name_regex = null;
1721
Regex? identifier_regex = null;
@@ -73,35 +77,41 @@ public class Views.Form : Adw.Bin {
7377
button_stack.add_named (new Gtk.Label (_("Create Project")), "button");
7478
button_stack.add_named (spinner, "spinner");
7579

80+
var back_button = new Gtk.Button () {
81+
child = new Gtk.Image.from_icon_name ("go-previous-symbolic")
82+
};
83+
7684
var create_button = new Gtk.Button () {
7785
child = button_stack,
78-
margin_bottom = 32,
79-
sensitive = false,
80-
vexpand = true,
81-
valign = END
86+
hexpand = true,
87+
sensitive = false
8288
};
8389
create_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
8490

91+
var buttons_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) {
92+
vexpand = true,
93+
valign = END,
94+
margin_bottom = 32,
95+
};
96+
buttons_box.append (back_button);
97+
buttons_box.append (create_button);
98+
8599
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
86-
form_box.append (new Gtk.Label (_("Step 1/3")) {
87-
halign = START,
88-
css_classes = { Granite.STYLE_CLASS_DIM_LABEL }
89-
});
90-
form_box.append (new Gtk.Label (_("Sign Up")) {
100+
form_box.append (new Gtk.Label (_("Aplication")) {
91101
halign = START,
92102
css_classes = { Granite.STYLE_CLASS_H1_LABEL }
93103
});
94104
form_box.append (new Granite.HeaderLabel (_("Project Name:")));
95105
form_box.append (project_name_entry);
96-
form_box.append (project_name_description);
106+
// form_box.append (project_name_description);
97107
form_box.append (new Granite.HeaderLabel (_("Organization Identifier:")));
98108
form_box.append (identifier_entry);
99-
form_box.append (identifier_description);
109+
// form_box.append (identifier_description);
100110
form_box.append (new Granite.HeaderLabel (_("Aplication ID:")));
101111
form_box.append (aplication_id_entry);
102112
form_box.append (new Granite.HeaderLabel (_("Location:")));
103113
form_box.append (location_entry);
104-
form_box.append (create_button);
114+
form_box.append (buttons_box);
105115

106116
var content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
107117
margin_start = 24,
@@ -153,6 +163,10 @@ public class Views.Form : Adw.Bin {
153163
}
154164
});
155165

166+
back_button.clicked.connect (() => {
167+
back ();
168+
});
169+
156170
create_button.clicked.connect (() => {
157171
clone_repo_async (location_entry.text, project_name_entry.text, aplication_id_entry.text, button_stack);
158172
});
@@ -204,6 +218,8 @@ public class Views.Form : Adw.Bin {
204218
rename_file (appdata_file, new_appdata_file);
205219
set_file_content (new_appdata_file, "{{APPLICATION_ID}}", aplication_id);
206220
set_file_content (new_appdata_file, "{{PROJECT_NAME}}", project_name);
221+
set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
222+
set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
207223

208224
// Desltop Files
209225
string desktop_file = GLib.Path.build_filename (project_folder, "data", "{{PROJECT_NAME}}.desktop.in");
@@ -233,11 +249,15 @@ public class Views.Form : Adw.Bin {
233249
string src_application_file = GLib.Path.build_filename (project_folder, "src", "Application.vala");
234250
set_file_content (src_application_file, "{{APPLICATION_ID_GSCHEMA}}", aplication_id_schema);
235251
set_file_content (src_application_file, "{{APPLICATION_ID}}", aplication_id);
252+
set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
253+
set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
236254

237255
// src window
238256
string src_window_file = GLib.Path.build_filename (project_folder, "src", "MainWindow.vala");
239257
set_file_content (src_window_file, "{{APPLICATION_ID_GSCHEMA}}", aplication_id_schema);
240258
set_file_content (src_window_file, "{{APPLICATION_ID}}", aplication_id);
259+
set_file_content (new_appdata_file, "{{DEVELOPER_NAME}}", developer_name);
260+
set_file_content (new_appdata_file, "{{DEVELOPER_EMAIL}}", developer_email);
241261

242262
created (project_name_entry.text, location_entry.text);
243263
}
@@ -246,7 +266,6 @@ public class Views.Form : Adw.Bin {
246266
project_name_entry.text = "";
247267
identifier_entry.text = "";
248268
aplication_id_entry.text = "";
249-
location_entry.text = "";
250269
}
251270

252271
private void set_file_content (string filename, string key, string value) {

0 commit comments

Comments
 (0)