зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1282662 - Part 1: Redesign the detail description of Download item in normal or hover cases.; r=Paolo
MozReview-Commit-ID: ITkv5XdQxEI --HG-- extra : rebase_source : 0fd18d71be9af24fa05db0072fc9d6b58e6035b2
This commit is contained in:
Родитель
97b5e78aac
Коммит
a9096e9882
|
@ -169,41 +169,36 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
this._progressElement.dispatchEvent(event);
|
||||
}
|
||||
|
||||
let status = this.statusTextAndTip;
|
||||
this.element.setAttribute("status", status.text);
|
||||
this.element.setAttribute("statusTip", status.tip);
|
||||
let labels = this.statusLabels;
|
||||
this.element.setAttribute("status", labels.status);
|
||||
this.element.setAttribute("hoverStatus", labels.hoverStatus);
|
||||
this.element.setAttribute("fullStatus", labels.fullStatus);
|
||||
},
|
||||
|
||||
lastEstimatedSecondsLeft: Infinity,
|
||||
|
||||
/**
|
||||
* Returns the text for the status line and the associated tooltip. These are
|
||||
* returned by a single property because they are computed together. The
|
||||
* result may be overridden by derived objects.
|
||||
* Returns the labels for the status of normal, full, and hovering cases. These
|
||||
* are returned by a single property because they are computed together.
|
||||
*/
|
||||
get statusTextAndTip() {
|
||||
return this.rawStatusTextAndTip;
|
||||
},
|
||||
|
||||
/**
|
||||
* Derived objects may call this to get the status text.
|
||||
*/
|
||||
get rawStatusTextAndTip() {
|
||||
get statusLabels() {
|
||||
let s = DownloadsCommon.strings;
|
||||
|
||||
let text = "";
|
||||
let tip = "";
|
||||
let status = "";
|
||||
let hoverStatus = "";
|
||||
let fullStatus = "";
|
||||
|
||||
if (!this.download.stopped) {
|
||||
let totalBytes = this.download.hasProgress ? this.download.totalBytes
|
||||
: -1;
|
||||
let newEstimatedSecondsLeft;
|
||||
[text, newEstimatedSecondsLeft] = DownloadUtils.getDownloadStatus(
|
||||
[status, newEstimatedSecondsLeft] = DownloadUtils.getDownloadStatus(
|
||||
this.download.currentBytes,
|
||||
totalBytes,
|
||||
this.download.speed,
|
||||
this.lastEstimatedSecondsLeft);
|
||||
this.lastEstimatedSecondsLeft = newEstimatedSecondsLeft;
|
||||
hoverStatus = status;
|
||||
} else if (this.download.canceled && this.download.hasPartialData) {
|
||||
let totalBytes = this.download.hasProgress ? this.download.totalBytes
|
||||
: -1;
|
||||
|
@ -212,14 +207,19 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
|
||||
// We use the same XUL label to display both the state and the amount
|
||||
// transferred, for example "Paused - 1.1 MB".
|
||||
text = s.statusSeparatorBeforeNumber(s.statePaused, transfer);
|
||||
status = s.statusSeparatorBeforeNumber(s.statePaused, transfer);
|
||||
hoverStatus = status;
|
||||
} else if (!this.download.succeeded && !this.download.canceled &&
|
||||
!this.download.error) {
|
||||
text = s.stateStarting;
|
||||
status = s.stateStarting;
|
||||
hoverStatus = status;
|
||||
} else {
|
||||
let stateLabel;
|
||||
|
||||
if (this.download.succeeded) {
|
||||
if (this.download.succeeded && !this.download.target.exists) {
|
||||
stateLabel = s.fileMovedOrMissing;
|
||||
hoverStatus = stateLabel;
|
||||
} else if (this.download.succeeded) {
|
||||
// For completed downloads, show the file size (e.g. "1.5 MB").
|
||||
if (this.download.target.size !== undefined) {
|
||||
let [size, unit] =
|
||||
|
@ -229,6 +229,8 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
// History downloads may not have a size defined.
|
||||
stateLabel = s.sizeUnknown;
|
||||
}
|
||||
status = s.stateCompleted;
|
||||
hoverStatus = status;
|
||||
} else if (this.download.canceled) {
|
||||
stateLabel = s.stateCanceled;
|
||||
} else if (this.download.error.becauseBlockedByParentalControls) {
|
||||
|
@ -246,11 +248,15 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
let [displayDate, fullDate] = DownloadUtils.getReadableDates(date);
|
||||
|
||||
let firstPart = s.statusSeparator(stateLabel, displayHost);
|
||||
text = s.statusSeparator(firstPart, displayDate);
|
||||
tip = s.statusSeparator(fullHost, fullDate);
|
||||
fullStatus = s.statusSeparator(firstPart, displayDate);
|
||||
status = status || stateLabel;
|
||||
}
|
||||
|
||||
return { text, tip: tip || text };
|
||||
return {
|
||||
status,
|
||||
hoverStatus: hoverStatus || fullStatus,
|
||||
fullStatus: fullStatus || status,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -284,19 +284,6 @@ HistoryDownloadElementShell.prototype = {
|
|||
this._updateState();
|
||||
},
|
||||
|
||||
get statusTextAndTip() {
|
||||
let status = this.rawStatusTextAndTip;
|
||||
|
||||
// The base object would show extended progress information in the tooltip,
|
||||
// but we move this to the main view and never display a tooltip.
|
||||
if (!this.download.stopped) {
|
||||
status.text = status.tip;
|
||||
}
|
||||
status.tip = "";
|
||||
|
||||
return status;
|
||||
},
|
||||
|
||||
onStateChanged() {
|
||||
this._updateState();
|
||||
|
||||
|
|
|
@ -46,9 +46,15 @@
|
|||
min="0"
|
||||
max="100"
|
||||
xbl:inherits="mode=progressmode,value=progress,paused=progresspaused"/>
|
||||
<xul:description class="downloadDetails"
|
||||
<xul:description class="downloadDetails downloadDetailsNormal"
|
||||
crop="end"
|
||||
xbl:inherits="value=status,tooltiptext=statusTip"/>
|
||||
xbl:inherits="value=status"/>
|
||||
<xul:description class="downloadDetails downloadDetailsHover"
|
||||
crop="end"
|
||||
xbl:inherits="value=hoverStatus"/>
|
||||
<xul:description class="downloadDetails downloadDetailsFull"
|
||||
crop="end"
|
||||
xbl:inherits="value=fullStatus,tooltiptext=fullStatus"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
<xul:toolbarseparator />
|
||||
|
|
|
@ -17,6 +17,9 @@ statePaused=Paused
|
|||
# LOCALIZATION NOTE (stateCanceled):
|
||||
# Indicates that the download was canceled by the user.
|
||||
stateCanceled=Canceled
|
||||
# LOCALIZATION NOTE (stateCompleted):
|
||||
# Indicates that the download was completed.
|
||||
stateCompleted=Completed
|
||||
# LOCALIZATION NOTE (stateBlockedParentalControls):
|
||||
# Indicates that the download was blocked by the Parental Controls feature of
|
||||
# Windows. "Parental Controls" should be consistently named and capitalized
|
||||
|
@ -49,6 +52,10 @@ blockedMalware=This file contains a virus or malware.
|
|||
blockedPotentiallyUnwanted=This file may harm your computer.
|
||||
blockedUncommon2=This file is not commonly downloaded.
|
||||
|
||||
# LOCALIZATION NOTE (fileMovedOrMissing):
|
||||
# Displayed when a complete download which is not at the original folder.
|
||||
fileMovedOrMissing=File moved or missing
|
||||
|
||||
# LOCALIZATION NOTE (unblockHeaderUnblock, unblockHeaderOpen,
|
||||
# unblockTypeMalware, unblockTypePotentiallyUnwanted2,
|
||||
# unblockTypeUncommon2, unblockTip2, unblockButtonOpen,
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
margin: 4px 0 calc(1em / 0.95 - 1em);
|
||||
}
|
||||
|
||||
.downloadDetailsNormal,
|
||||
.downloadDetailsHover {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.downloadButton {
|
||||
-moz-appearance: none;
|
||||
-moz-box-align: center;
|
||||
|
|
|
@ -232,6 +232,12 @@ richlistitem[type="download"]:last-child {
|
|||
margin: 4px 0 calc(1em / var(--downloads-item-font-size-factor) - 1em);
|
||||
}
|
||||
|
||||
@item@:hover > .downloadMainArea > .downloadContainer > .downloadDetailsNormal,
|
||||
@item@:not(:hover) > .downloadMainArea > .downloadContainer > .downloadDetailsHover,
|
||||
.downloadDetailsFull {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@item@[verdict] > toolbarseparator {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче