From c58963793bd4107c408ede58e8ecba1fa0711c74 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 26 Dec 2014 19:13:04 +0000 Subject: [PATCH 1/9] Quick 'n' dirty concept for sidebar priority display. --- resources/report/html/loot-plugin-item.html | 31 +++++++++++++++++++-- resources/report/report.html | 3 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 7cf67521..6f3f7b95 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -18,10 +18,37 @@ core-tooltip { margin-left: 16px; } + + /* paper-item (two-line) */ + paper-item.two-line { + height: 48px; + } + paper-item.two-line::shadow .button-content { + padding: 7.5px 16px; + } + paper-item.two-line .text { + /* Padding is disabled as otherwise text won't fit in correctly. */ + /*padding: 4px 0;*/ + line-height: normal; + } + paper-item.two-line .primary { + /* MD spec says 16sp, but that doesn't fit, so use 14sp. */ + /*font-size: 1.143rem;*/ + font-size: 1rem; + } + paper-item.two-line .secondary { + /* MD spec says 14sp, but that doesn't fit, so use 12sp. */ + /*font-size: 1rem; */ + font-size: 0.857rem; + color: rgba(0, 0, 0, 0.54); + } - -
+ +
+
+
+
diff --git a/resources/report/report.html b/resources/report/report.html index 733a7a16..2adce966 100644 --- a/resources/report/report.html +++ b/resources/report/report.html @@ -54,7 +54,8 @@ From 964be3e4b392793e1f1fd4bccbd624d960389391 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 26 Dec 2014 19:30:48 +0000 Subject: [PATCH 2/9] Added example of icon for global priorities. --- resources/report/html/loot-plugin-item.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 6f3f7b95..63e5f78f 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -42,12 +42,19 @@ font-size: 0.857rem; color: rgba(0, 0, 0, 0.54); } + paper-item.two-line .secondary core-icon { + height: 13px; + margin-right: 0; + }
-
+
+ + +
From 149b84d81d3b9320fe4510ee62a9f84e6f59a547 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 10:12:34 +0000 Subject: [PATCH 3/9] Hide priorities in sidebar when not in edit mode. --- resources/report/html/loot-plugin-item.html | 26 ++++++++++++++------- resources/report/js/script.js | 4 +++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 63e5f78f..7aaa2621 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -21,37 +21,45 @@ /* paper-item (two-line) */ paper-item.two-line { - height: 48px; + /* Two-line items should be 72px high according to Material Design. + Squeeze the height to fit more items in. */ + /*height: 72px;*/ } - paper-item.two-line::shadow .button-content { + :host-context(body[data-editors]) paper-item.two-line::shadow .button-content { padding: 7.5px 16px; } - paper-item.two-line .text { + :host-context(body[data-editors]) paper-item.two-line #text { /* Padding is disabled as otherwise text won't fit in correctly. */ /*padding: 4px 0;*/ line-height: normal; } - paper-item.two-line .primary { + :host-context(body[data-editors]) paper-item.two-line #primary { /* MD spec says 16sp, but that doesn't fit, so use 14sp. */ /*font-size: 1.143rem;*/ font-size: 1rem; } - paper-item.two-line .secondary { + :host-context(body[data-editors]) paper-item.two-line #secondary { /* MD spec says 14sp, but that doesn't fit, so use 12sp. */ /*font-size: 1rem; */ font-size: 0.857rem; color: rgba(0, 0, 0, 0.54); + display: flex; } - paper-item.two-line .secondary core-icon { + :host-context(body[data-editors]) paper-item.two-line #secondary core-icon { height: 13px; margin-right: 0; } + + /* When not in edit mode, hide secondary text. */ + :host-context(body:not([data-editors])) paper-item.two-line #secondary { + display: none; + } -
-
-
+
+
+
diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 774777ee..65003f89 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -904,6 +904,7 @@ function handleEditorClose(evt) { --numEditors; if (numEditors == 0) { + document.body.removeAttribute('data-editors'); /* Re-enable toolbar elements. */ document.getElementById('wipeUserlistButton').removeAttribute('disabled'); document.getElementById('copyContentButton').removeAttribute('disabled'); @@ -912,8 +913,9 @@ function handleEditorClose(evt) { document.getElementById('gameMenu').removeAttribute('disabled'); document.getElementById('updateMasterlistButton').removeAttribute('disabled'); document.getElementById('sortButton').removeAttribute('disabled'); + } else { + document.body.setAttribute('data-editors', numEditors); } - document.body.setAttribute('data-editors', numEditors); } function handleConflictsFilter(evt) { /* evt.detail is true if the filter has been activated. */ From c8eea703d0a8c2e1f6fa4857bb7e620babc6b91a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 10:27:04 +0000 Subject: [PATCH 4/9] Added transition for sidebar item mode switching. --- resources/report/html/loot-plugin-item.html | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 7aaa2621..569aa878 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -25,34 +25,43 @@ Squeeze the height to fit more items in. */ /*height: 72px;*/ } + #text, + #primary, + #secondary, + paper-item.two-line::shadow .button-content { + transition: 0.6s; + } + paper-item.two-line::shadow .button-content { + padding: 14px 16px; + } :host-context(body[data-editors]) paper-item.two-line::shadow .button-content { padding: 7.5px 16px; } - :host-context(body[data-editors]) paper-item.two-line #text { + #text { /* Padding is disabled as otherwise text won't fit in correctly. */ /*padding: 4px 0;*/ line-height: normal; } - :host-context(body[data-editors]) paper-item.two-line #primary { + :host-context(body[data-editors]) #primary { /* MD spec says 16sp, but that doesn't fit, so use 14sp. */ /*font-size: 1.143rem;*/ font-size: 1rem; } - :host-context(body[data-editors]) paper-item.two-line #secondary { + #secondary { /* MD spec says 14sp, but that doesn't fit, so use 12sp. */ /*font-size: 1rem; */ font-size: 0.857rem; color: rgba(0, 0, 0, 0.54); - display: flex; - } - :host-context(body[data-editors]) paper-item.two-line #secondary core-icon { height: 13px; + } + #secondary core-icon { margin-right: 0; + height: 13px; } /* When not in edit mode, hide secondary text. */ - :host-context(body:not([data-editors])) paper-item.two-line #secondary { - display: none; + :host-context(body:not([data-editors])) #secondary { + height: 0; } From 18190d9019bdf684af471d02ca4be7090dc68b31 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 11:10:46 +0000 Subject: [PATCH 5/9] Added tooltip for global priority star. --- resources/report/html/loot-plugin-item.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 569aa878..4208beb4 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -15,7 +15,7 @@ display: block; margin-right: 0; } - core-tooltip { + paper-item > core-tooltip { margin-left: 16px; } @@ -25,9 +25,9 @@ Squeeze the height to fit more items in. */ /*height: 72px;*/ } - #text, #primary, #secondary, + #secondary core-icon, paper-item.two-line::shadow .button-content { transition: 0.6s; } @@ -41,6 +41,7 @@ /* Padding is disabled as otherwise text won't fit in correctly. */ /*padding: 4px 0;*/ line-height: normal; + overflow: visible; } :host-context(body[data-editors]) #primary { /* MD spec says 16sp, but that doesn't fit, so use 14sp. */ @@ -53,6 +54,7 @@ font-size: 0.857rem; color: rgba(0, 0, 0, 0.54); height: 13px; + overflow: visible; } #secondary core-icon { margin-right: 0; @@ -60,8 +62,16 @@ } /* When not in edit mode, hide secondary text. */ + #secondary.hidden, :host-context(body:not([data-editors])) #secondary { height: 0; + overflow: hidden; + } + + core-tooltip.hidden { + opacity: 0; + pointer-events: none; + overflow: hidden; } @@ -69,7 +79,9 @@
- + + +
From eefed2237457551a571737d695a39aa9a03899da Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 11:12:23 +0000 Subject: [PATCH 6/9] Sidebar priorities display made conditional. Stars only show for global priorities, and values only show for non-zero priorities. --- resources/report/html/loot-plugin-item.html | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 4208beb4..2f333422 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -98,11 +98,14 @@ data: undefined, observe: { - 'data.userlist': 'onUserlistChange' + 'data.userlist': 'onUserlistChange', + 'data.modPriority': 'onPriorityChange', + 'data.isGlobalPriority': 'onPriorityChange' }, dataChanged: function(oldValue, newValue) { this.onUserlistChange(); + this.onPriorityChange(); }, onUserlistChange: function(oldValue, newValue) { @@ -115,6 +118,24 @@ } }, + onPriorityChange: function(oldValue, newValue) { + if (this.data) { + if (this.data.modPriority != 0) { + this.shadowRoot.getElementById('secondary').classList.remove('hidden'); + } else { + this.shadowRoot.getElementById('secondary').classList.add('hidden'); + } + if (this.data.isGlobalPriority) { + this.shadowRoot.getElementById('secondary').firstElementChild.classList.remove('hidden'); + } else { + this.shadowRoot.getElementById('secondary').firstElementChild.classList.add('hidden'); + } + } else { + this.shadowRoot.getElementById('secondary').classList.add('hidden'); + this.shadowRoot.getElementById('secondary').firstElementChild.classList.add('hidden'); + } + }, + getName: function() { return this.textContent.trim(); }, From 5a5e68a0b96bcd9429ea65947182c52b7138676a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 11:12:49 +0000 Subject: [PATCH 7/9] Fixed sidebar item drag 'n' drop value. --- resources/report/html/loot-plugin-item.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/report/html/loot-plugin-item.html b/resources/report/html/loot-plugin-item.html index 2f333422..c954a4f0 100644 --- a/resources/report/html/loot-plugin-item.html +++ b/resources/report/html/loot-plugin-item.html @@ -137,7 +137,7 @@ }, getName: function() { - return this.textContent.trim(); + return this.querySelector('.name').textContent.trim(); }, handleDragStart: function(evt) { From c0ae5e2fabba6dd2ee0f0eb949e7db8375489ae3 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 11:13:15 +0000 Subject: [PATCH 8/9] Don't use ink effect in plugin menus, it gets stuck. --- resources/report/html/loot-plugin-card.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/report/html/loot-plugin-card.html b/resources/report/html/loot-plugin-card.html index b8f6c593..4938bc6d 100644 --- a/resources/report/html/loot-plugin-card.html +++ b/resources/report/html/loot-plugin-card.html @@ -161,15 +161,15 @@ loot-clear-metadata - + Edit Metadata - + Copy Metadata - + Clear User Metadata From 04ef486c55e19a2332816765d06b017a182e9d03 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Dec 2014 11:25:07 +0000 Subject: [PATCH 9/9] Fixed user-set priorities always made global. --- src/gui/handler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index df2841c2..8455def7 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -429,11 +429,13 @@ namespace loot { // Priority value was changed, so add it to the userlist data. int priority = pluginMetadata["modPriority"].as(); - if (priority >= 0) { - priority += max_priority; - } - else { - priority -= max_priority; + if (pluginMetadata["isGlobalPriority"].as()) { + if (priority >= 0) { + priority += max_priority; + } + else { + priority -= max_priority; + } } newUserlistEntry.Priority(priority); newUserlistEntry.SetPriorityExplicit(true);