Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release date column #3096

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions GUI/Controls/ManageMods.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions GUI/Controls/ManageMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,9 @@ private IEnumerable<DataGridViewRow> _SortRowsByColumn(IEnumerable<DataGridViewR
case 0: case 1:
case 2: case 3: return Sort(rows, CheckboxSorter);
case 9: return Sort(rows, DownloadSizeSorter);
case 10: return Sort(rows, InstallDateSorter);
case 11: return Sort(rows, r => (r.Tag as GUIMod)?.DownloadCount ?? 0);
case 10: return Sort(rows, ReleaseDateSorter);
case 11: return Sort(rows, InstallDateSorter);
case 12: return Sort(rows, r => (r.Tag as GUIMod)?.DownloadCount ?? 0);
}
return Sort(rows, DefaultSorter);
}
Expand Down Expand Up @@ -1225,6 +1226,11 @@ private long DownloadSizeSorter(DataGridViewRow row)
return (row.Tag as GUIMod)?.ToCkanModule()?.download_size ?? 0;
}

private long ReleaseDateSorter(DataGridViewRow row)
{
return -(row.Tag as GUIMod)?.ToModule().release_date?.Ticks ?? 0;
}

/// <summary>
/// Transforms a DataGridViewRow into a long representing the install date,
/// suitable for sorting.
Expand Down
1 change: 1 addition & 0 deletions GUI/Controls/ManageMods.resx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
<data name="LatestVersion.HeaderText" xml:space="preserve"><value>Latest version</value></data>
<data name="KSPCompatibility.HeaderText" xml:space="preserve"><value>Max KSP version</value></data>
<data name="SizeCol.HeaderText" xml:space="preserve"><value>Download</value></data>
<data name="ReleaseDate.HeaderText" xml:space="preserve"><value>Release date</value></data>
<data name="InstallDate.HeaderText" xml:space="preserve"><value>Install date</value></data>
<data name="DownloadCount.HeaderText" xml:space="preserve"><value>Downloads</value></data>
<data name="Description.HeaderText" xml:space="preserve"><value>Description</value></data>
Expand Down
1 change: 1 addition & 0 deletions GUI/Localization/de-DE/ManageMods.de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<data name="LatestVersion.HeaderText" xml:space="preserve"><value>Neueste Version</value></data>
<data name="KSPCompatibility.HeaderText" xml:space="preserve"><value>Max. KSP Version</value></data>
<data name="SizeCol.HeaderText" xml:space="preserve"><value>Downloadgröße</value></data>
<data name="ReleaseDate.HeaderText" xml:space="preserve"><value>Veröffentlichungsdatum</value></data>
<data name="InstallDate.HeaderText" xml:space="preserve"><value>Installationsdatum</value></data>
<data name="DownloadCount.HeaderText" xml:space="preserve"><value>Downloadanzahl</value></data>
<data name="Description.HeaderText" xml:space="preserve"><value>Kurzbeschreibung</value></data>
Expand Down
3 changes: 2 additions & 1 deletion GUI/Model/ModList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ private DataGridViewRow MakeRow(GUIMod mod, List<ModChange> changes, string inst
var downloadCount = new DataGridViewTextBoxCell() { Value = String.Format("{0:N0}", mod.DownloadCount) };
var compat = new DataGridViewTextBoxCell() { Value = mod.KSPCompatibility };
var size = new DataGridViewTextBoxCell() { Value = mod.DownloadSize };
var releaseDate = new DataGridViewTextBoxCell() { Value = mod.ToModule().release_date };
var installDate = new DataGridViewTextBoxCell() { Value = mod.InstallDate };
var desc = new DataGridViewTextBoxCell() { Value = mod.Abstract };

item.Cells.AddRange(selecting, autoInstalled, updating, replacing, name, author, installVersion, latestVersion, compat, size, installDate, downloadCount, desc);
item.Cells.AddRange(selecting, autoInstalled, updating, replacing, name, author, installVersion, latestVersion, compat, size, releaseDate, installDate, downloadCount, desc);

selecting.ReadOnly = selecting is DataGridViewTextBoxCell;
autoInstalled.ReadOnly = autoInstalled is DataGridViewTextBoxCell;
Expand Down
2 changes: 1 addition & 1 deletion Tests/GUI/GH1866.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Up()
_listGui.Columns.Add(new DataGridViewCheckBoxColumn());
_listGui.Columns.Add(new DataGridViewCheckBoxColumn());
_listGui.Columns.Add(new DataGridViewCheckBoxColumn());
for (int i = 0; i < 9; i++)
for (int i = 0; i < 10; i++)
{
_listGui.Columns.Add(i.ToString(), "Column" + i);
}
Expand Down