Skip to content

Commit

Permalink
Update screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Jan 10, 2024
1 parent 14377e2 commit b0d21d7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 90 deletions.
8 changes: 4 additions & 4 deletions core/Objects/Filters/Labels.vala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Objects.Filters.Labels : Objects.BaseObject {
public int count {
get {
if (_count == null) {
_count = Services.Database.get_default ().get_labels_collection().size;
_count = Services.Database.get_default ().get_labels_collection ().size;
}

return _count;
Expand All @@ -59,17 +59,17 @@ public class Objects.Filters.Labels : Objects.BaseObject {
keywords = "%s".printf (_("labels"));

Services.Database.get_default ().label_added.connect (() => {
_count = Services.Database.get_default ().get_labels_collection().size;
_count = Services.Database.get_default ().get_labels_collection ().size;
count_updated ();
});

Services.Database.get_default ().label_deleted.connect (() => {
_count = Services.Database.get_default ().get_labels_collection().size;
_count = Services.Database.get_default ().get_labels_collection ().size;
count_updated ();
});

Services.Database.get_default ().label_updated.connect (() => {
_count = Services.Database.get_default ().get_labels_collection().size;
_count = Services.Database.get_default ().get_labels_collection ().size;
count_updated ();
});
}
Expand Down
2 changes: 1 addition & 1 deletion core/Services/Database.vala
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ public class Services.Database : GLib.Object {
public Gee.ArrayList<Objects.Label> get_labels_by_item_labels (string labels) {
Gee.ArrayList<Objects.Label> return_value = new Gee.ArrayList<Objects.Label> ();

foreach (string id in labels.split(";")) {
foreach (string id in labels.split (";")) {
Objects.Label? label = get_label (id);
if (label != null) {
return_value.add (label);
Expand Down
117 changes: 32 additions & 85 deletions core/Util.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,38 @@ We hope you’ll enjoy using Planify!""");

section_01.add_item_if_not_exists (item_02_01);
section_01.add_item_if_not_exists (item_02_02);

var section_02 = new Objects.Section ();
section_02.id = Util.get_default ().generate_id (section_01);
section_02.project_id = project.id;
section_02.name = _("Boost your productivity");

project.add_section_if_not_exists (section_02);

var item_03_01 = new Objects.Item ();
item_03_01.id = Util.get_default ().generate_id (item_03_01);
item_03_01.project_id = project.id;
item_03_01.section_id = section_02.id;
item_03_01.content = _("Drag the plus button!");
item_03_01.description = _("That blue button you see at the bottom of each screen is more powerful than it looks: it's made to move! Drag it up to create a task wherever you want.");

var item_03_02 = new Objects.Item ();
item_03_02.id = Util.get_default ().generate_id (item_03_02);
item_03_02.project_id = project.id;
item_03_02.section_id = section_02.id;
item_03_02.content = _("Tag your to-dos!");
item_03_02.description = _("Tags allow you to improve your workflow in Planify. To add a Tag click on the tag button at the bottom.");

var item_03_03 = new Objects.Item ();
item_03_03.id = Util.get_default ().generate_id (item_03_03);
item_03_03.project_id = project.id;
item_03_03.section_id = section_02.id;
item_03_03.content = _("Set timely reminders!");
item_03_03.description = _("You want Planify to send you a notification to remind you of an important event or something special. Tap the bell button below to add a reminder.");

section_02.add_item_if_not_exists (item_03_01);
section_02.add_item_if_not_exists (item_03_02);
section_02.add_item_if_not_exists (item_03_03);
}
}

Expand Down Expand Up @@ -1125,80 +1157,6 @@ We hope you’ll enjoy using Planify!""");
Services.Database.get_default ().insert_label (label_05);
}

public string get_markup_format (string _text) {
var text = get_dialog_text (_text);

Regex mailto_regex = /(?P<mailto>[a-zA-Z0-9\._\%\+\-]+@[a-zA-Z0-9\-\.]+\.[a-zA-Z]+(\S*))/;
Regex url_regex = /(?P<url>(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]+(\/\S*))/;

Regex italic_bold_regex = /\*\*\*(.*?)\*\*\*/;
Regex bold_regex = /\*\*(.*?)\*\*/;
Regex italic_regex = /\*(.*?)\*/;

MatchInfo info;
try {
List<string> urls = new List<string> ();
if (url_regex.match (text, 0, out info)) {
do {
var url = info.fetch_named ("url");
urls.append (url);
} while (info.next ());
}
List<string> emails = new List<string> ();
if (mailto_regex.match (text, 0, out info)) {
do {
var email = info.fetch_named ("mailto");
emails.append (email);
} while (info.next ());
}
Gee.ArrayList<RegexMarkdown> bolds_01 = new Gee.ArrayList<RegexMarkdown>();
if (bold_regex.match (text, 0, out info)) {
do {
bolds_01.add (new RegexMarkdown (info.fetch (0), info.fetch (1)));
} while (info.next ());
}
Gee.ArrayList<RegexMarkdown> italics_01 = new Gee.ArrayList<RegexMarkdown> ();
if (italic_regex.match (text, 0, out info)) {
do {
italics_01.add (new RegexMarkdown (info.fetch (0), info.fetch (1)));
} while (info.next ());
}
Gee.ArrayList<RegexMarkdown> italic_bold = new Gee.ArrayList<RegexMarkdown>();
if (italic_bold_regex.match (text, 0, out info)) {
do {
italic_bold.add (new RegexMarkdown (info.fetch (0), info.fetch (1)));
} while (info.next ());
}

var converted = text;
urls.foreach ((url) => {
var url_encoded = url.replace ("&", "&amp;");
var url_as_link = @"<a href=\"$url_encoded\">$url_encoded</a>";
converted = converted.replace (url, url_as_link);
});
emails.foreach ((email) => {
var email_as_link = @"<a href=\"mailto:$email\">$email</a>";
converted = converted.replace (email, email_as_link);
});
foreach (RegexMarkdown m in italic_bold) {
string format = "<i><b>" + m.text + "</b></i>";
converted = converted.replace (m.match, format);
}
foreach (RegexMarkdown m in bolds_01) {
string format = "<b>" + m.text + "</b>";
converted = converted.replace (m.match, format);
}
foreach (RegexMarkdown m in italics_01) {
string format = "<i>" + m.text + "</i>";
converted = converted.replace (m.match, format);
}

return converted;
} catch (GLib.RegexError ex) {
return text;
}
}

public BackendType get_backend_type_by_text (string backend_type) {
if (backend_type == "local") {
return BackendType.LOCAL;
Expand All @@ -1213,14 +1171,3 @@ We hope you’ll enjoy using Planify!""");
}
}
}

public class RegexMarkdown {
public string match { get; set; }
public string text { get; set; }
public string extra { get; set; }
public RegexMarkdown (string match, string text, string extra="") {
this.match = match;
this.text = text;
this.extra = extra;
}
}
Binary file modified data/resources/screenshot/screenshot-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b0d21d7

Please sign in to comment.