fix #46: option to show colorful icons

This commit is contained in:
Antelle 2015-12-03 00:12:14 +03:00
parent e6f7429213
commit 99baca4b45
7 changed files with 25 additions and 6 deletions

View File

@ -17,7 +17,8 @@ var AppSettingsModel = Backbone.Model.extend({
autoSave: true,
idleMinutes: 15,
minimizeOnClose: false,
tableView: false
tableView: false,
colorfulIcons: false
},
initialize: function() {

View File

@ -2,9 +2,10 @@
var Format = require('../util/format');
var EntryPresenter = function(descField) {
var EntryPresenter = function(descField, noColor) {
this.entry = null;
this.descField = descField;
this.noColor = noColor || '';
};
EntryPresenter.prototype = {
@ -19,7 +20,7 @@ EntryPresenter.prototype = {
get id() { return this.entry ? this.entry.id : this.group.get('id'); },
get icon() { return this.entry ? this.entry.icon : (this.group.get('icon') || 'folder'); },
get customIcon() { return this.entry ? this.entry.customIcon : undefined; },
get color() { return this.entry ? this.entry.color : undefined; },
get color() { return this.entry ? (this.entry.color || (this.entry.customIcon ? this.noColor : undefined)) : undefined; },
get title() { return this.entry ? this.entry.title : this.group.get('title'); },
get notes() { return this.entry ? this.entry.notes : undefined; },
get url() { return this.entry ? this.entry.url : undefined; },

View File

@ -66,7 +66,8 @@ var ListView = Backbone.View.extend({
if (this.items.length) {
var itemTemplate = this.getItemTemplate();
var itemsTemplate = this.getItemsTemplate();
var presenter = new EntryPresenter(this.getDescField());
var noColor = AppSettingsModel.instance.get('colorfulIcons') ? '' : 'grayscale';
var presenter = new EntryPresenter(this.getDescField(), noColor);
var itemsHtml = '';
this.items.forEach(function (item) {
presenter.present(item);

View File

@ -22,6 +22,7 @@ var SettingsGeneralView = Backbone.View.extend({
'change .settings__general-auto-save': 'changeAutoSave',
'change .settings__general-minimize': 'changeMinimize',
'change .settings__general-table-view': 'changeTableView',
'change .settings__general-colorful-icons': 'changeColorfulIcons',
'click .settings__general-update-btn': 'checkUpdate',
'click .settings__general-restart-btn': 'restartApp',
'click .settings__general-download-update-btn': 'downloadUpdate',
@ -61,7 +62,8 @@ var SettingsGeneralView = Backbone.View.extend({
updateReady: UpdateModel.instance.get('updateStatus') === 'ready',
updateFound: UpdateModel.instance.get('updateStatus') === 'found',
updateManual: UpdateModel.instance.get('updateManual'),
releaseNotesLink: Links.ReleaseNotes
releaseNotesLink: Links.ReleaseNotes,
colorfulIcons: AppSettingsModel.instance.get('colorfulIcons')
});
},
@ -144,6 +146,12 @@ var SettingsGeneralView = Backbone.View.extend({
Backbone.trigger('refresh');
},
changeColorfulIcons: function(e) {
var colorfulIcons = e.target.checked || false;
AppSettingsModel.instance.set('colorfulIcons', colorfulIcons);
Backbone.trigger('refresh');
},
restartApp: function() {
if (Launcher) {
Launcher.requestRestart();

View File

@ -104,7 +104,6 @@
height: 14px;
&--custom {
vertical-align: text-bottom;
@include filter(grayscale(1));
&.yellow { @include filter(grayscale(1) sepia(1) hue-rotate(20deg) brightness(1.17) saturate(5.7)); }
&.green { @include filter(grayscale(1) sepia(1) hue-rotate(55deg) brightness(1.01) saturate(4.9)); }
&.red { @include filter(grayscale(1) sepia(1) hue-rotate(316deg) brightness(1.1) saturate(6)); }

View File

@ -56,6 +56,10 @@
<label for="settings__general-table-view">Entries list table view</label>
</div>
<% } %>
<div>
<input type="checkbox" class="settings__input input-base settings__general-colorful-icons" id="settings__general-colorful-icons" <%- colorfulIcons ? 'checked' : '' %> />
<label for="settings__general-colorful-icons">Colorful custom icons in list</label>
</div>
<h2>Function</h2>
<div>

View File

@ -1,5 +1,10 @@
Release notes
-------------
##### v0.5 (not released yet)
2-way sync
`*` disallow opening same files twice
`+` #46: option to show colorful icons
##### v0.4.6 (2015-11-25)
`-` #32: visual glitches on Windows 10