Skip to content

Commit

Permalink
1.1.0 - New focus mode and simplified Preferences dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Jun 19, 2017
1 parent 6c44507 commit 6fa8958
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 51 deletions.
4 changes: 4 additions & 0 deletions data/com.github.lainsce.quilter.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<caption>Dark Mode</caption>
<image>https://raw.githubusercontent.com/lainsce/quilter/master/data/shot-dark.png</image>
</screenshot>
<screenshot>
<caption>Focus Mode</caption>
<image>https://raw.githubusercontent.com/lainsce/quilter/master/data/shot-focused.png</image>
</screenshot>
</screenshots>
<custom>
<value key="x-appcenter-color-primary">#b8d2e2</value>
Expand Down
15 changes: 5 additions & 10 deletions data/com.github.lainsce.quilter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<summary>Window position</summary>
<description>The y axis of window position</description>
</key>
<key name="window-height" type="i">
<key name="window-height" type="i">
<default>800</default>
<summary>Window position</summary>
<description>The height of the window</description>
Expand All @@ -20,32 +20,27 @@
<summary>Window position</summary>
<description>The width of the window</description>
</key>
<key name="window-maximized" type="b">
<key name="window-maximized" type="b">
<default>false</default>
<summary>Window state is maximized or not</summary>
<description>Whether Quilter should be maximized or not</description>
</key>
<key name="focus-mode" type="b">
<key name="focus-mode" type="b">
<default>false</default>
<summary>Focus Mode</summary>
<description>Whether Quilter should be in Focus Mode</description>
</key>
<key name="dark-mode" type="b">
<key name="dark-mode" type="b">
<default>false</default>
<summary>Dark Mode</summary>
<description>Whether Quilter should be in Dark Mode</description>
</key>
<key name="use-system-font" type="b">
<default>true</default>
<summary>Use system font</summary>
<description>Whether Quilter should use the default system font</description>
</key>
<key name="font" type="s">
<default>'Cousine 12'</default>
<summary>Preferred Font</summary>
<description>Set the preferred font</description>
</key>
<key name="last-file" type="s">
<key name="last-file" type="s">
<default>''</default>
<summary>Last opened file</summary>
<description>The last opened file in Quilter</description>
Expand Down
Binary file added data/shot-focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
com.github.lainsce.quilter (1.1.0) xenial; urgency=low

* New Focus mode, makes text bigger and the toolbar more light.
* Simplified the settings dialog.

-- Lains <[email protected]> Thu, 19 June 2017 08:55:00 -0300

com.github.lainsce.quilter (1.0.9) xenial; urgency=low

* Fixed the saving of files before opening new ones.
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Name our project
project('com.github.lainsce.quilter', ['vala', 'c'],
version: '1.0.9'
version: '1.1.0'
)

# Import main lib files
Expand Down
1 change: 0 additions & 1 deletion src/Constants/AppSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace Quilter {
public bool window_maximized { get; set; }
public bool dark_mode { get; set; }
public bool focus_mode { get; set; }
public bool use_system_font { get; set; }
public string font { get; set; }
public string last_file { get; set; }

Expand Down
19 changes: 1 addition & 18 deletions src/Widgets/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ namespace Quilter.Widgets {
public class Preferences : Gtk.Dialog {
Gtk.Switch focus_mode;
Gtk.Switch dark_mode;
Gtk.Switch use_custom_font;
Gtk.FontButton select_font;

public Preferences () {
create_layout ();
Expand All @@ -35,7 +33,6 @@ namespace Quilter.Widgets {
}

private void create_layout () {
var main_settings = AppSettings.get_default ();
var main_grid = new Gtk.Grid ();
main_grid.row_spacing = 6;
main_grid.column_spacing = 12;
Expand All @@ -49,16 +46,6 @@ namespace Quilter.Widgets {
var dark_mode_label = new SettingsLabel (_("Enable Dark Mode:"));
dark_mode = new SettingsSwitch ("dark-mode");

var font_header = new SettingsHeader (_("Font"));
var use_custom_font_label = new SettingsLabel (_("Custom font:"));
use_custom_font = new Gtk.Switch ();
use_custom_font.halign = Gtk.Align.START;
main_settings.schema.bind ("use-system-font", use_custom_font, "active", SettingsBindFlags.INVERT_BOOLEAN);
select_font = new Gtk.FontButton ();
select_font.hexpand = true;
main_settings.schema.bind ("font", select_font, "font-name", SettingsBindFlags.DEFAULT);
main_settings.schema.bind ("use-system-font", select_font, "sensitive", SettingsBindFlags.INVERT_BOOLEAN);

var close_button = new Gtk.Button.with_label (_("Close"));
close_button.clicked.connect (() => {this.destroy ();});

Expand All @@ -74,10 +61,6 @@ namespace Quilter.Widgets {
main_grid.attach (focus_mode, 1, 2, 1, 1);
main_grid.attach (dark_mode_label, 0, 3, 1, 1);
main_grid.attach (dark_mode, 1, 3, 1, 1);
main_grid.attach (font_header, 0, 4, 3, 1);
main_grid.attach (use_custom_font_label , 0, 5, 1, 1);
main_grid.attach (use_custom_font, 1, 5, 1, 1);
main_grid.attach (select_font, 2, 5, 1, 1);
main_grid.attach (button_box, 0, 6, 4, 1);

((Gtk.Container) get_content_area ()).add (main_grid);
Expand All @@ -87,7 +70,7 @@ namespace Quilter.Widgets {
public TitleHeader (string text) {
label = text;
this.margin_bottom = 6;
get_style_context ().add_class ("h3");
get_style_context ().add_class ("h2");
halign = Gtk.Align.START;
}
}
Expand Down
22 changes: 9 additions & 13 deletions src/Widgets/SourceView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,19 @@ namespace Quilter.Widgets {
}
}

public void use_default_font (bool value) {
if (!value)
return;

var default_font = new GLib.Settings ("org.gnome.desktop.interface").get_string ("monospace-font-name");

this.font = default_font;
}

private void update_settings () {
var settings = AppSettings.get_default ();
this.highlight_current_line = settings.focus_mode;
if (!settings.focus_mode) {
this.highlight_current_line = false;
this.font = settings.font;
this.override_font (Pango.FontDescription.from_string (this.font));
} else {
this.highlight_current_line = true;
this.font = "Cousine 18";
this.override_font (Pango.FontDescription.from_string (this.font));
}

this.font = settings.font;
use_default_font (settings.use_system_font);
set_scheme (get_default_scheme ());
this.override_font (Pango.FontDescription.from_string (this.font));
}

public void set_scheme (string id) {
Expand Down
30 changes: 22 additions & 8 deletions src/Widgets/Toolbar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,40 @@ namespace Quilter.Widgets {
public Toolbar () {
var settings = AppSettings.get_default ();
this.subtitle = settings.last_file;
var header_context = this.get_style_context ();
var header_context = this.get_style_context ();
header_context.add_class ("quilter-toolbar");

new_button = new Gtk.Button ();
new_button.set_image (new Gtk.Image.from_icon_name ("document-new", Gtk.IconSize.LARGE_TOOLBAR));
new_button.has_tooltip = true;
new_button.has_tooltip = true;
new_button.tooltip_text = (_("New file"));

new_button.clicked.connect (() => {
new_button_pressed ();
});

save_button = new Gtk.Button ();
save_button.set_image (new Gtk.Image.from_icon_name ("document-save-as", Gtk.IconSize.LARGE_TOOLBAR));
save_button.has_tooltip = true;
save_button.has_tooltip = true;
save_button.tooltip_text = (_("Save as…"));

save_button.clicked.connect (() => {
save_button_pressed ();
});

open_button = new Gtk.Button ();
open_button.set_image (new Gtk.Image.from_icon_name ("document-open", Gtk.IconSize.LARGE_TOOLBAR));
open_button.has_tooltip = true;
open_button.has_tooltip = true;
open_button.tooltip_text = (_("Open…"));

open_button.clicked.connect (() => {
open_button_pressed ();
});

menu_button = new Gtk.MenuButton ();
menu_button.set_image (new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR));
menu_button.has_tooltip = true;
menu_button.tooltip_text = (_("Settings"));

focused_toolbar ();
settings.changed.connect (focused_toolbar);

menu = new Gtk.Menu ();

var cheatsheet = new Gtk.MenuItem.with_label (_("Markdown Cheatsheet"));
Expand Down Expand Up @@ -104,6 +103,21 @@ namespace Quilter.Widgets {
this.show_all ();
}

public void focused_toolbar () {
var settings = AppSettings.get_default ();
if (!settings.focus_mode) {
new_button.set_image (new Gtk.Image.from_icon_name ("document-new", Gtk.IconSize.LARGE_TOOLBAR));
save_button.set_image (new Gtk.Image.from_icon_name ("document-save-as", Gtk.IconSize.LARGE_TOOLBAR));
open_button.set_image (new Gtk.Image.from_icon_name ("document-open", Gtk.IconSize.LARGE_TOOLBAR));
menu_button.set_image (new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR));
} else {
new_button.set_image (new Gtk.Image.from_icon_name ("document-new-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
save_button.set_image (new Gtk.Image.from_icon_name ("document-save-as-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
open_button.set_image (new Gtk.Image.from_icon_name ("document-open-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
menu_button.set_image (new Gtk.Image.from_icon_name ("open-menu-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
}
}

public void new_button_pressed () {


Expand Down

0 comments on commit 6fa8958

Please sign in to comment.