diff --git a/.gitignore b/.gitignore index ca497ed6..ff478d85 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ # Visual Studio 2015/2017 cache/options directory .vs/ +.vscode/ # Build results [Dd]ebug/ diff --git a/Changelog.md b/Changelog.md index 5f02a7a1..39163435 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,68 +1,92 @@ -# CHANGELOG - -## COMPASS v0.4.0 (29 June 2022) - -### Fixes - -- Fixed Adding tags not working -- Fix some inconsistent UI elements - -### Enhancements - -- various UI improvements - -### New Features - -- Added new Home layout -- Added option to favourite a book -- Track when and how often books are opened - -## COMPASS v0.3.1 (16 June 2022) - -### Fixes - -- Fixed crash on startup when update is found - -## COMPASS v0.3.0 (16 June 2022) - -### Fixes - -- Fixed crash when trying to open release notes in settings -- COMPASS now installs to "/Program Files/" by default instead of "/Program Files (x86)/" -- Fixed crash when launching COMPASS for the very first time -- User preferences are now retained across updates - -### Enhancements - -- Added option to delete user data on uninstall -- The icon of the used view (list, cards, tiles) is now highlighted -- Clicking "browse" in the sources section of files now opens in the location of the file -- Search now tolerates typos and accepts abbreviations - -### New Features - -- Logging has been added to facilitate reporting issues -- Added "Show in Explorer" option to file context menu -- Added a way to update the file path references in all files in a collection when you rename a folder - -### Other Changes - -- renamed "Changelog" tab in settings to "What's New" - -## COMPASS v0.2.0 (14 June 2022) - -### Fixes - -- Importing a homebrewery file would sometimes fail -- Metadata fields of homebrewery were cut short if they contained a comma - -### New Features - -- Google drive import has been added, supported metadate is: - - Cover - - Title -- Automatic update checking and installing - -## COMPASS v0.1.0 (10 June 2022) - -- Release of 0.1.0 +# CHANGELOG + ## COMPASS v0.5.0 (16 July 2022) + +### Fixes + +- Fix Import button disappearing when importing from URL +- Fix cover download failing sometimes +- Fix COMPASS sometimes crashing when downloading cover +- Restored sorting in Tile Layout +- Fixed "Move to Collection" not working in certain layouts + +### Enhancements + +- Downloading covers from homebrewery and gmbinder no longer requires COMPASS to be run as administrator +- All Layout options (cover size and title visibility) now persist in Home Layout +- Cover size now persists in Tile Layout + +### New Features + +- Added support for multiple authors +- Added separate sorting titles + +### Other Changes + +- Removed redundant sorting options in Home Layout + +## COMPASS v0.4.0 (29 June 2022) + +### Fixes + +- Fixed Adding tags not working +- Fix some inconsistent UI elements + +### Enhancements + +- various UI improvements + +### New Features + +- Added new Home layout +- Added option to favorite a book +- Track when and how often books are opened + +## COMPASS v0.3.1 (16 June 2022) + +### Fixes + +- Fixed crash on startup when update is found + +## COMPASS v0.3.0 (16 June 2022) + +### Fixes + +- Fixed crash when trying to open release notes in settings +- COMPASS now installs to "/Program Files/" by default instead of "/Program Files (x86)/" +- Fixed crash when launching COMPASS for the very first time +- User preferences are now retained across updates + +### Enhancements + +- Added option to delete user data on uninstall +- The icon of the used view (list, cards, tiles) is now highlighted +- Clicking "browse" in the sources section of files now opens in the location of the file +- Search now tolerates typos and accepts abbreviations + +### New Features + +- Logging has been added to facilitate reporting issues +- Added "Show in Explorer" option to file context menu +- Added a way to update the file path references in all files in a collection when you rename a folder + +### Other Changes + +- renamed "Changelog" tab in settings to "What's New" + +## COMPASS v0.2.0 (14 June 2022) + +### Fixes + +- Importing a homebrewery file would sometimes fail +- Metadata fields of homebrewery were cut short if they contained a comma + +### New Features + +- Google drive import has been added, supported metadata is: + - Cover + - Title +- Automatic update checking and installing + +## COMPASS v0.1.0 (10 June 2022) + +- Release of 0.1.0 diff --git a/src/App.config b/src/App.config index 5f220604..a44eef60 100644 --- a/src/App.config +++ b/src/App.config @@ -77,6 +77,15 @@ True + + False + + + 156 + + + 156 + diff --git a/src/COMPASS.csproj b/src/COMPASS.csproj index 4af74ee6..3c289c1b 100644 --- a/src/COMPASS.csproj +++ b/src/COMPASS.csproj @@ -25,7 +25,8 @@ - + + @@ -56,7 +57,7 @@ 6.0.0 - + diff --git a/src/Models/Codex.cs b/src/Models/Codex.cs index e873fba8..b9fad25f 100644 --- a/src/Models/Codex.cs +++ b/src/Models/Codex.cs @@ -4,27 +4,33 @@ using System.Collections.ObjectModel; using System.IO; using System.Xml.Serialization; +using System.Linq; namespace COMPASS.Models { public class Codex : ObservableObject, IHasID { //empty constructor for serialization - public Codex() { } + public Codex() + { + Authors.CollectionChanged += (e, v) => RaisePropertyChanged(nameof(AuthorsAsString)); + } - public Codex(CodexCollection cc) + public Codex(CodexCollection cc):this() { Tags = new(); ID = Utils.GetAvailableID(cc.AllCodices); CoverArt = CodexCollection.CollectionsPath + cc.DirectoryName + @"\CoverArt\" + ID.ToString() + ".png"; Thumbnail = CodexCollection.CollectionsPath + cc.DirectoryName + @"\Thumbnails\" + ID.ToString() + ".png"; + } public void Copy(Codex c) { Title = c.Title; + _sortingTitle = c._sortingTitle; //copy field instead of property, or it will copy _title Path = c.Path; - Author = c.Author; + Authors = new(c.Authors); Publisher = c.Publisher; Version = c.Version; SourceURL = c.SourceURL; @@ -66,14 +72,54 @@ public string Path public string Title { get { return _title; } - set { SetProperty(ref _title, value); } + set + { + SetProperty(ref _title, value); + RaisePropertyChanged(nameof(SortingTitle)); + } } - private string _author; - public string Author - { - get { return _author; } - set { SetProperty(ref _author, value); } + private string _sortingTitle = ""; + [XmlIgnoreAttribute] + public string SortingTitle + { + get + { + if (String.IsNullOrEmpty(_sortingTitle)) return _title; + else return _sortingTitle; + } + set { SetProperty(ref _sortingTitle, value); } + } + //seperate property needed for serialization or it will get _title and save that + //instead of saving an empty and mirroring _title during runtime + public string SerializableSortingTitle + { + get { return _sortingTitle; } + set { SetProperty(ref _sortingTitle, value); } + } + + private ObservableCollection _authors = new(); + public ObservableCollection Authors + { + get { return _authors; } + set + { + SetProperty(ref _authors, value); + RaisePropertyChanged(nameof(AuthorsAsString)); + } + } + + public string AuthorsAsString { + get + { + string str = Authors.Count switch + { + 1 => Authors[0], + > 1 => String.Join(", ", Authors.OrderBy(a=>a)), + _ => "" + }; + return str; + } } private string _publisher; diff --git a/src/Models/CodexCollection.cs b/src/Models/CodexCollection.cs index 79a0619b..dd02e92c 100644 --- a/src/Models/CodexCollection.cs +++ b/src/Models/CodexCollection.cs @@ -91,10 +91,11 @@ private void LoadCodices() AllCodices = serializer.Deserialize(Reader) as List; } + foreach (Codex f in AllCodices) { //Populate Author and Publisher List - if (!String.IsNullOrEmpty(f.Author) && !AuthorList.Contains(f.Author)) AuthorList.Add(f.Author); + AddAuthors(f); if (!String.IsNullOrEmpty(f.Publisher) && !PublisherList.Contains(f.Publisher)) PublisherList.Add(f.Publisher); //reconstruct tags from ID's @@ -102,6 +103,9 @@ private void LoadCodices() { f.Tags.Add(AllTags.First(t => t.ID == id)); } + + //apply sorting titles + f.SortingTitle = f.SerializableSortingTitle; } //Sort them AuthorList = new(AuthorList.OrderBy(n => n)); @@ -173,5 +177,14 @@ public void RenameCollection(string NewCollectionName) Directory.Move(CollectionsPath + DirectoryName, CollectionsPath + NewCollectionName); DirectoryName = NewCollectionName; } + + public void AddAuthors(Codex codex) + { + foreach (var author in codex.Authors) + { + if (!String.IsNullOrEmpty(author) && !AuthorList.Contains(author)) + AuthorList.Add(author); + } + } } } diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index 7748de52..68c73bef 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.4.0")] +[assembly: AssemblyVersion("0.5.0")] //[assembly: AssemblyFileVersion("1.0.0")] diff --git a/src/Properties/Settings.Designer.cs b/src/Properties/Settings.Designer.cs index 2fe6d0f5..81efcc12 100644 --- a/src/Properties/Settings.Designer.cs +++ b/src/Properties/Settings.Designer.cs @@ -298,5 +298,41 @@ public bool justUpdated { this["justUpdated"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool HomeShowTitle { + get { + return ((bool)(this["HomeShowTitle"])); + } + set { + this["HomeShowTitle"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("156")] + public double HomeCoverSize { + get { + return ((double)(this["HomeCoverSize"])); + } + set { + this["HomeCoverSize"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("156")] + public double TileCoverSize { + get { + return ((double)(this["TileCoverSize"])); + } + set { + this["TileCoverSize"] = value; + } + } } } diff --git a/src/Properties/Settings.settings b/src/Properties/Settings.settings index 092702d5..b0e93a0c 100644 --- a/src/Properties/Settings.settings +++ b/src/Properties/Settings.settings @@ -71,5 +71,14 @@ True + + False + + + 156 + + + 156 + \ No newline at end of file diff --git a/src/Resources/CommonResources.xaml b/src/Resources/CommonResources.xaml index 23ed1d2d..0a10793c 100644 --- a/src/Resources/CommonResources.xaml +++ b/src/Resources/CommonResources.xaml @@ -2,7 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:Converters ="clr-namespace:COMPASS.Tools.Converters" - xmlns:Tools="clr-namespace:COMPASS.Tools"> + xmlns:Tools="clr-namespace:COMPASS.Tools" + xmlns:BlackPearl="clr-namespace:BlackPearl.Controls.CoreLibrary;assembly=BlackPearl.Controls.CoreLibrary" + xmlns:docs="clr-namespace:System.Windows.Documents;assembly=PresentationFramework"> @@ -511,6 +513,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - + - - - - @@ -160,11 +160,11 @@ - - + diff --git a/src/Views/TileLayout.xaml b/src/Views/TileLayout.xaml index 074cee80..d62c48a5 100644 --- a/src/Views/TileLayout.xaml +++ b/src/Views/TileLayout.xaml @@ -19,7 +19,7 @@ Command="{Binding Path=Data.OpenSelectedCodicesCommand, Source={StaticResource CodexProxy}}"/> -