Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/inscriptions.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@
<summary>Whether to highlight both source and target</summary>
<description>Highlights alternating colours on both source and target in the TextView</description>
</key>
<key name="language-heatmap" type="as">
<default>["", "", "", "", ""]</default>
<summary>Five last selected language code</summary>
<description>A list of recent selected language codes to make obvious in the UI</description>
</key>
</schema>
</schemalist>
1 change: 1 addition & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if not windows_build
# Inject some variables into the metainfo file before merging in the translations
appstream_conf = configuration_data()
appstream_conf.set('APP_ID', app_id)
appstream_conf.set('APP_NAME', app_name)
appstream_conf.set('GETTEXT_PACKAGE', meson.project_name())
appstream_file_in = configure_file(
input: 'inscriptions.metainfo.xml.in.in',
Expand Down
1 change: 1 addition & 0 deletions src/Constants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace Inscriptions {
public const string KEY_VERTICAL_LAYOUT = "vertical-layout";
public const string KEY_AUTO_TRANSLATE = "auto-translate";
public const string KEY_HIGHLIGHT = "highlight";
public const string KEY_HEATMAP = "language-heatmap";

// Backend
public const string KEY_SOURCE_LANGUAGE = "source-language";
Expand Down
26 changes: 25 additions & 1 deletion src/Objects/DDModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public class Inscriptions.DDModel : Object {

static string[] heatmap {get; set;}
static string[] heatmap = Application.settings.get_strv (KEY_HEATMAP);

public GLib.ListStore model {get; set;}
public Gtk.SignalListItemFactory factory_header {get; set;}
Expand All @@ -20,6 +20,8 @@ public class Inscriptions.DDModel : Object {
public signal void selection_changed (string language_code_selected);

public DDModel () {
//heatmap = Application.settings.get_strv (KEY_HEATMAP);

// The Langs will populate this thing
model = new GLib.ListStore(typeof(Lang));

Expand Down Expand Up @@ -49,7 +51,29 @@ public class Inscriptions.DDModel : Object {
var item = list_item.get_child () as Gtk.Label;
item.label = item_language.name;

// We save up a heatmap. It is rebuilt from scratch to avoid redundant language codes
// We could check beforehand and gate this but it would affect lisibility
string[] temp_heatmap = {item_language.code};
foreach (var recent_language_code in heatmap) {
if (recent_language_code != item_language.code) {
temp_heatmap += recent_language_code;
}

if (temp_heatmap.length == 5) {
break;
}
}
heatmap = temp_heatmap;
Application.settings.set_strv (KEY_HEATMAP, heatmap);

//Application.settings.set_strv (KEY_HEATMAP, heatmap);
print ("\n");
foreach (var element in heatmap) {
print (element + " ");
}

// Tell everyone language changed
// Items are connected to this and get their shit together out of it
selection_changed (item_language.code);
//print ("switched to: %s %s\n".printf (item_language.name, item_language.code));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/LanguageDropDown.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Inscriptions.LanguageDropDown : Granite.Bin {

private void on_selected_language () {
var selected_lang = dropdown.get_selected_item () as Lang;
print ("\nSELECTED %s\n".printf (selected_lang.code));
//print ("\nSELECTED %s\n".printf (selected_lang.code));
language_changed (selected_lang.code);

}
Expand Down
4 changes: 3 additions & 1 deletion src/Widgets/LanguageItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class Inscriptions.LanguageItem : Gtk.Box {
construct {
selected_emblem = new Gtk.Image.from_icon_name ("emblem-default-symbolic") {
visible = false,
halign = Gtk.Align.END
halign = Gtk.Align.END,
margin_end = 15
};
selected_emblem.add_css_class (Granite.STYLE_CLASS_FLAT);

Expand All @@ -51,6 +52,7 @@ public class Inscriptions.LanguageItem : Gtk.Box {
}

public void on_position_changed (string language_code_selected) {
//print ("ADJUST! ");

if (language_code_selected == language_code) {
label_widget.add_css_class ("bold");
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/LanguageSelectionBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class Inscriptions.LanguageSelectionBox : Gtk.Box {
dropdown_target.selected = code;
}

print ("Set " + code + " Source?" + is_source.to_string () + "\n");
//print ("Set " + code + " Source?" + is_source.to_string () + "\n");
}

private string get_selected_language (bool is_source) {
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Panes/TargetPane.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Inscriptions.TargetPane : Inscriptions.Pane {
margin_end = MARGIN_MENU_HALF
};

var placeholder = new Gtk.Label (_("Ready!")) {
var placeholder = new Gtk.Label (_("Ready to translate")) {
wrap = true
};
placeholder.add_css_class (Granite.STYLE_CLASS_H2_LABEL);
Expand Down
Loading