User pref: "Highlight Changes Assigned To Me In Change Table"

Defaults to true.

Change-Id: I724fc70b67cb4de20d31777e2ec878dd515b953f
This commit is contained in:
Gustaf Lundh 2016-09-20 10:47:50 +02:00
parent 661d30a8c3
commit 37c95f3126
7 changed files with 28 additions and 4 deletions

View File

@ -89,6 +89,7 @@ public class GeneralPreferencesIT extends AbstractDaemonTest {
i.timeFormat = TimeFormat.HHMM_24;
i.emailStrategy = EmailStrategy.DISABLED;
i.defaultBaseForMerges = DefaultBase.AUTO_MERGE;
i.highlightAssigneeInChangeTable ^= true;
i.relativeDateInChangeTable ^= true;
i.sizeBarInChangeTable ^= true;
i.legacycidInChangeTable ^= true;

View File

@ -132,6 +132,7 @@ public class GeneralPreferencesInfo {
public DownloadCommand downloadCommand;
public DateFormat dateFormat;
public TimeFormat timeFormat;
public Boolean highlightAssigneeInChangeTable;
public Boolean relativeDateInChangeTable;
public DiffView diffView;
public Boolean sizeBarInChangeTable;
@ -194,6 +195,7 @@ public class GeneralPreferencesInfo {
p.downloadCommand = DownloadCommand.CHECKOUT;
p.dateFormat = DateFormat.STD;
p.timeFormat = TimeFormat.HHMM_12;
p.highlightAssigneeInChangeTable = true;
p.relativeDateInChangeTable = false;
p.diffView = DiffView.SIDE_BY_SIDE;
p.sizeBarInChangeTable = true;

View File

@ -48,6 +48,7 @@ public class GeneralPreferences extends JavaScriptObject {
p.downloadCommand(d.downloadCommand);
p.dateFormat(d.getDateFormat());
p.timeFormat(d.getTimeFormat());
p.highlightAssigneeInChangeTable(d.highlightAssigneeInChangeTable);
p.relativeDateInChangeTable(d.relativeDateInChangeTable);
p.sizeBarInChangeTable(d.sizeBarInChangeTable);
p.legacycidInChangeTable(d.legacycidInChangeTable);
@ -100,6 +101,9 @@ public class GeneralPreferences extends JavaScriptObject {
private native String timeFormatRaw()
/*-{ return this.time_format }-*/;
public final native boolean highlightAssigneeInChangeTable()
/*-{ return this.highlight_assignee_in_change_table || false }-*/;
public final native boolean relativeDateInChangeTable()
/*-{ return this.relative_date_in_change_table || false }-*/;
@ -178,6 +182,9 @@ public class GeneralPreferences extends JavaScriptObject {
private native void timeFormatRaw(String f)
/*-{ this.time_format = f }-*/;
public final native void highlightAssigneeInChangeTable(boolean d)
/*-{ this.highlight_assignee_in_change_table = d }-*/;
public final native void relativeDateInChangeTable(boolean d)
/*-{ this.relative_date_in_change_table = d }-*/;

View File

@ -38,6 +38,7 @@ public interface AccountConstants extends Constants {
String messageShowInReviewCategoryUsername();
String messageShowInReviewCategoryAbbrev();
String buttonSaveChanges();
String highlightAssigneeInChangeTable();
String showRelativeDateInChangeTable();
String showSizeBarInChangeTable();
String showLegacycidInChangeTable();

View File

@ -28,6 +28,7 @@ diffViewLabel = Diff View:
dateFormatLabel = Date/Time Format:
contextWholeFile = Whole File
buttonSaveChanges = Save Changes
highlightAssigneeInChangeTable = Highlight Changes Assigned To Me In Changes Table
showRelativeDateInChangeTable = Show Relative Dates In Changes Table
showSizeBarInChangeTable = Show Change Sizes As Colored Bars
showLegacycidInChangeTable = Show Change Number In Changes Table

View File

@ -50,6 +50,7 @@ import java.util.List;
public class MyPreferencesScreen extends SettingsScreen {
private CheckBox showSiteHeader;
private CheckBox useFlashClipboard;
private CheckBox highlightAssigneeInChangeTable;
private CheckBox relativeDateInChangeTable;
private CheckBox sizeBarInChangeTable;
private CheckBox legacycidInChangeTable;
@ -155,7 +156,8 @@ public class MyPreferencesScreen extends SettingsScreen {
dateTimePanel.add(dateFormat);
dateTimePanel.add(timeFormat);
}
highlightAssigneeInChangeTable = new CheckBox(Util.C.highlightAssigneeInChangeTable());
highlightAssigneeInChangeTable.setEnabled(Gerrit.info().change().showAssignee());
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
@ -195,6 +197,10 @@ public class MyPreferencesScreen extends SettingsScreen {
formGrid.setWidget(row, fieldIdx, showSiteHeader);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, highlightAssigneeInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable);
row++;
@ -242,6 +248,7 @@ public class MyPreferencesScreen extends SettingsScreen {
e.listenTo(maximumPageSize);
e.listenTo(dateFormat);
e.listenTo(timeFormat);
e.listenTo(highlightAssigneeInChangeTable);
e.listenTo(relativeDateInChangeTable);
e.listenTo(sizeBarInChangeTable);
e.listenTo(legacycidInChangeTable);
@ -276,6 +283,7 @@ public class MyPreferencesScreen extends SettingsScreen {
maximumPageSize.setEnabled(on);
dateFormat.setEnabled(on);
timeFormat.setEnabled(on);
highlightAssigneeInChangeTable.setEnabled(Gerrit.info().change().showAssignee());
relativeDateInChangeTable.setEnabled(on);
sizeBarInChangeTable.setEnabled(on);
legacycidInChangeTable.setEnabled(on);
@ -295,6 +303,7 @@ public class MyPreferencesScreen extends SettingsScreen {
p.dateFormat());
setListBox(timeFormat, GeneralPreferencesInfo.TimeFormat.HHMM_12, //
p.timeFormat());
highlightAssigneeInChangeTable.setValue(p.highlightAssigneeInChangeTable());
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
@ -385,6 +394,7 @@ public class MyPreferencesScreen extends SettingsScreen {
p.timeFormat(getListBox(timeFormat,
GeneralPreferencesInfo.TimeFormat.HHMM_12,
GeneralPreferencesInfo.TimeFormat.values()));
p.highlightAssigneeInChangeTable(highlightAssigneeInChangeTable.getValue());
p.relativeDateInChangeTable(relativeDateInChangeTable.getValue());
p.sizeBarInChangeTable(sizeBarInChangeTable.getValue());
p.legacycidInChangeTable(legacycidInChangeTable.getValue());

View File

@ -253,8 +253,9 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
if (c.assignee() != null) {
table.setWidget(row, C_ASSIGNEE,
AccountLinkPanel.forAssignee(c.assignee()));
if (Objects.equals(c.assignee().getId(),
Gerrit.getUserAccount().getId())) {
if (Gerrit.getUserPreferences().highlightAssigneeInChangeTable()
&& Objects.equals(c.assignee().getId(),
Gerrit.getUserAccount().getId())) {
table.getRowFormatter().addStyleName(row,
Gerrit.RESOURCES.css().cASSIGNEDTOME());
}
@ -264,7 +265,8 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
}
table.setWidget(row, C_PROJECT, new ProjectLink(c.projectNameKey()));
table.setWidget(row, C_BRANCH, new BranchLink(c.projectNameKey(), c
table.setWidget(row, C_BRANCH,
new BranchLink(c.projectNameKey(), c
.status(), c.branch(), c.topic()));
if (Gerrit.getUserPreferences().relativeDateInChangeTable()) {
table.setText(row, C_LAST_UPDATE, relativeFormat(c.updated()));