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>
11 changes: 8 additions & 3 deletions data/inscriptions.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,18 @@
</recommends>

<releases>
<release version="1.0.1" date="2026-03-16" urgency="medium">
<release version="1.1.0" date="2026-03-16" urgency="medium">
<description>
<p>Touchups and enhancements</p>
<ul>
<li>Minor design changes. Lets do refined shit.</li>
<li>A cleaner, better thought out UI</li>
<li>Updated and extended screenshots</li>
<li>Some work into cleaner code</li>
<li>Show/hide highlighting moved to target pane</li>
<li>Enable/Disable auto translation moved to gear menu</li>
<li>Display in the language list the currently selected one</li>
<li>Switch source and language moved between both languages</li>
<li>Static pane sizes - makes more sense</li>
<li>Synchronized text zoom for both source and target</li>
</ul>
</description>
</release>
Expand Down
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: 0 additions & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ src/Widgets/Buttons/OrientationBox.vala
src/Widgets/Buttons/ToggleHighlight.vala
src/Widgets/Popovers/SettingsPopover.vala
src/Widgets/Popovers/OptionsPopover.vala
src/Widgets/LanguageSelectionBox.vala
src/Widgets/Panes/Pane.vala
src/Widgets/Panes/SourcePane.vala
src/Widgets/Panes/TargetPane.vala
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
34 changes: 21 additions & 13 deletions src/Views/TranslationView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class Inscriptions.TranslationView : Gtk.Box {
Gtk.CenterBox paned {get; set;}
public Inscriptions.SourcePane source_pane;
public Inscriptions.TargetPane target_pane;
private Inscriptions.LanguageSelectionBox language_selection;

// Add a debounce so we aren't requesting the API constantly
public uint debounce_timer_id = 0;
Expand Down Expand Up @@ -65,20 +64,29 @@ public class Inscriptions.TranslationView : Gtk.Box {
vexpand = true
};
paned.start_widget = source_pane;
paned.center_widget = new Gtk.Separator (VERTICAL);

//TRANSLATORS: This is for a button that switches source and target language
var switchlang_button = new Gtk.Button.from_icon_name ("media-playlist-repeat-symbolic") {
tooltip_markup = Granite.markup_accel_tooltip ({"<Ctrl>I"}, _("Switch languages"))
};
switchlang_button.action_name = TranslationView.ACTION_PREFIX + TranslationView.ACTION_SWITCH_LANG;


paned.center_widget = switchlang_button; //new Gtk.Separator (VERTICAL);
paned.end_widget = target_pane;

// paned.start_ (source_pane);
// paned.append (source_pane);
// paned.append (target_pane);

language_selection = new Inscriptions.LanguageSelectionBox ();
append (language_selection);
//language_selection = new Inscriptions.LanguageSelectionBox ();
//append (language_selection);
append (paned);



/* ---------------- CONNECTS AND BINDS ---------------- */

// Logic for toggling the panes/layout
on_orientation_toggled ();
Application.settings.changed["vertical-layout"].connect (on_orientation_toggled);
Expand All @@ -101,16 +109,16 @@ public class Inscriptions.TranslationView : Gtk.Box {
if (if_connect) {
// translate when text is entered or user changes any language or option
source_pane.textview.buffer.changed.connect (on_text_to_translate);
language_selection.source_changed.connect (on_text_to_translate);
language_selection.target_changed.connect (on_text_to_translate);
source_pane.language_changed.connect (on_text_to_translate);
target_pane.language_changed.connect (on_text_to_translate);
Application.settings.changed["context"].connect (on_text_to_translate);
Application.settings.changed["formality"].connect (on_text_to_translate);

} else {
// no
source_pane.textview.buffer.changed.disconnect (on_text_to_translate);
language_selection.source_changed.disconnect (on_text_to_translate);
language_selection.target_changed.disconnect (on_text_to_translate);
source_pane.language_changed.disconnect (on_text_to_translate);
target_pane.language_changed.disconnect (on_text_to_translate);
Application.settings.changed["context"].disconnect (on_text_to_translate);
Application.settings.changed["formality"].disconnect (on_text_to_translate);
}
Expand All @@ -125,17 +133,17 @@ public class Inscriptions.TranslationView : Gtk.Box {
connect_all (false);

// Temp variables
var newtarget = language_selection.selected_source;
var newtarget = source_pane.selected_language;
var newtarget_text = source_pane.text;

var newsource = language_selection.selected_target;
var newsource = target_pane.selected_language;
var newsource_text = target_pane.text;

// Letsgo
language_selection.selected_source = newsource;
source_pane.selected_language = newsource;
source_pane.text = newsource_text;

language_selection.selected_target = newtarget;
target_pane.selected_language = newtarget;
target_pane.text = newtarget_text;

source_pane.textview.refresh ();
Expand Down Expand Up @@ -167,7 +175,7 @@ public class Inscriptions.TranslationView : Gtk.Box {
* Filter not-requests, set or reset debounce_timer
*/
public void on_text_to_translate () {
if (language_selection.selected_source == language_selection.selected_target) {
if (source_pane.selected_language == target_pane.selected_language) {
source_pane.message (_("Target language is the same as source"));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Buttons/TranslateButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Inscriptions.TranslateButton : Granite.Bin {
var translate_button = new Gtk.Button () {
label = _("Translate"),
tooltip_markup = Granite.markup_accel_tooltip (
{"<Control>Return", "<Ctrl>T"},
{"<Control>Return", "<Ctrl>T"},
_("Start translating the entered text")
)
};
Expand Down
6 changes: 2 additions & 4 deletions src/Widgets/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class Inscriptions.HeaderBar : Granite.Bin {
Gtk.StackSwitcher title_switcher;

Gtk.Revealer back_revealer;
Gtk.Button switchlang_button;
Gtk.Revealer toolbar_revealer;
Gtk.MenuButton popover_button;

Expand Down Expand Up @@ -83,7 +82,6 @@ public class Inscriptions.HeaderBar : Granite.Bin {
title_stack.add_child (title_switcher);
title_stack.visible_child = title_label;

//TRANSLATORS: Do not translate the name itself. You can write it in your writing system if that is usually done for your language
headerbar = new Gtk.HeaderBar () {
title_widget = title_stack
};
Expand Down Expand Up @@ -159,11 +157,11 @@ public class Inscriptions.HeaderBar : Granite.Bin {
};

var toolbar_right = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
//toolbar_right.append (translate_revealer);

toolbar_right.append (new TranslateButton ());
toolbar_right.append (popover_button);

headerbar.pack_end (toolbar_right);
headerbar.pack_end (new TranslateButton ());

child = headerbar;

Expand Down
18 changes: 10 additions & 8 deletions src/Widgets/LanguageDropDown.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ public class Inscriptions.LanguageDropDown : Granite.Bin {
Gtk.DropDown dropdown;

public string selected {
owned get { return get_selected_language ();}
set { set_selected_language (value);}
owned get { return get_selected_language ();}
set { set_selected_language (value);}
}

public signal void language_changed (string code = "");

public LanguageDropDown (Lang[] languages) {
construct {
hexpand = true;
model = new Inscriptions.DDModel ();

foreach (var language in languages) {
model.model_append (language);
}

var expression = new Gtk.PropertyExpression (typeof (Inscriptions.Lang), null, "both");
dropdown = new Gtk.DropDown (model.model, expression) {
factory = model.factory_header,
Expand All @@ -44,7 +40,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 All @@ -58,4 +54,10 @@ public class Inscriptions.LanguageDropDown : Granite.Bin {
var selected_lang = dropdown.get_selected_item () as Lang;
return selected_lang.code;
}

public void add_languages (Lang[] languages) {
foreach (var language in languages) {
model.model_append (language);
}
}
}
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
Loading
Loading