diff --git a/Source/AppScaffolding/LibationScaffolding.cs b/Source/AppScaffolding/LibationScaffolding.cs index a2fb3c80..4a83cd38 100644 --- a/Source/AppScaffolding/LibationScaffolding.cs +++ b/Source/AppScaffolding/LibationScaffolding.cs @@ -66,6 +66,9 @@ namespace AppScaffolding { config.InProgress ??= Configuration.WinTemp; + if (!config.Exists(nameof(config.BetaOptIn))) + config.BetaOptIn = false; + if (!config.Exists(nameof(config.AllowLibationFixup))) config.AllowLibationFixup = true; diff --git a/Source/LibationFileManager/Configuration.cs b/Source/LibationFileManager/Configuration.cs index f7000e07..cf4d0a3b 100644 --- a/Source/LibationFileManager/Configuration.cs +++ b/Source/LibationFileManager/Configuration.cs @@ -74,6 +74,13 @@ namespace LibationFileManager public bool Exists(string propertyName) => persistentDictionary.Exists(propertyName); + [Description("Use the beta version of Libation\r\nNew and experimental features, but probably buggy.\r\n(requires restart to take effect)")] + public bool BetaOptIn + { + get => persistentDictionary.GetNonString(nameof(BetaOptIn)); + set => persistentDictionary.SetNonString(nameof(BetaOptIn), value); + } + [Description("Location for book storage. Includes destination of newly liberated books")] public string Books { diff --git a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml index 0693b3b7..478bd120 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml +++ b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml @@ -172,6 +172,7 @@ diff --git a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs index 05ad6ef4..5c560395 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs +++ b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs @@ -57,6 +57,12 @@ namespace LibationWinForms.AvaloniaUI.Views Closing += (_,_) => this.SaveSizeAndLocation(Configuration.Instance); } Opened += MainWindow_Opened; + Closing += MainWindow_Closing; + } + + private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + productsDisplay?.CloseImageDisplay(); } private async void MainWindow_Opened(object sender, EventArgs e) @@ -86,6 +92,7 @@ namespace LibationWinForms.AvaloniaUI.Views private void FindAllControls() { quickFiltersToolStripMenuItem = this.FindControl(nameof(quickFiltersToolStripMenuItem)); + productsDisplay = this.FindControl(nameof(productsDisplay)); } protected override void OnDataContextChanged(EventArgs e) diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay2.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay2.axaml.cs index bdd96e90..39cc0b06 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay2.axaml.cs +++ b/Source/LibationWinForms/AvaloniaUI/Views/ProductsDisplay2.axaml.cs @@ -206,6 +206,12 @@ namespace LibationWinForms.AvaloniaUI.Views } } + public void CloseImageDisplay() + { + if (imageDisplayDialog is not null && imageDisplayDialog.IsVisible) + imageDisplayDialog.Close(); + } + public void Cover_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) { if (sender is not Image tblock || tblock.DataContext is not GridEntry2 gEntry) diff --git a/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index 5932dcd7..1778994a 100644 --- a/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/Source/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -51,6 +51,7 @@ this.loggingLevelCb = new System.Windows.Forms.ComboBox(); this.tabControl = new System.Windows.Forms.TabControl(); this.tab1ImportantSettings = new System.Windows.Forms.TabPage(); + this.betaOptInCbox = new System.Windows.Forms.CheckBox(); this.booksGb = new System.Windows.Forms.GroupBox(); this.saveEpisodesToSeriesFolderCbox = new System.Windows.Forms.CheckBox(); this.tab2ImportLibrary = new System.Windows.Forms.TabPage(); @@ -71,6 +72,8 @@ this.folderTemplateTb = new System.Windows.Forms.TextBox(); this.folderTemplateLbl = new System.Windows.Forms.Label(); this.tab4AudioFileOptions = new System.Windows.Forms.TabPage(); + this.audiobookFixupsGb = new System.Windows.Forms.GroupBox(); + this.stripUnabridgedCbox = new System.Windows.Forms.CheckBox(); this.chapterTitleTemplateGb = new System.Windows.Forms.GroupBox(); this.chapterTitleTemplateBtn = new System.Windows.Forms.Button(); this.chapterTitleTemplateTb = new System.Windows.Forms.TextBox(); @@ -104,12 +107,10 @@ this.groupBox2 = new System.Windows.Forms.GroupBox(); this.lameTargetQualityRb = new System.Windows.Forms.RadioButton(); this.lameTargetBitrateRb = new System.Windows.Forms.RadioButton(); - this.stripUnabridgedCbox = new System.Windows.Forms.CheckBox(); this.mergeOpeningEndCreditsCbox = new System.Windows.Forms.CheckBox(); this.retainAaxFileCbox = new System.Windows.Forms.CheckBox(); this.downloadCoverArtCbox = new System.Windows.Forms.CheckBox(); this.createCueSheetCbox = new System.Windows.Forms.CheckBox(); - this.audiobookFixupsGb = new System.Windows.Forms.GroupBox(); this.badBookGb.SuspendLayout(); this.tabControl.SuspendLayout(); this.tab1ImportantSettings.SuspendLayout(); @@ -119,6 +120,7 @@ this.inProgressFilesGb.SuspendLayout(); this.customFileNamingGb.SuspendLayout(); this.tab4AudioFileOptions.SuspendLayout(); + this.audiobookFixupsGb.SuspendLayout(); this.chapterTitleTemplateGb.SuspendLayout(); this.lameOptionsGb.SuspendLayout(); this.lameBitrateGb.SuspendLayout(); @@ -126,7 +128,6 @@ this.lameQualityGb.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.lameVBRQualityTb)).BeginInit(); this.groupBox2.SuspendLayout(); - this.audiobookFixupsGb.SuspendLayout(); this.SuspendLayout(); // // booksLocationDescLbl @@ -374,6 +375,7 @@ // // tab1ImportantSettings // + this.tab1ImportantSettings.Controls.Add(this.betaOptInCbox); this.tab1ImportantSettings.Controls.Add(this.booksGb); this.tab1ImportantSettings.Controls.Add(this.logsBtn); this.tab1ImportantSettings.Controls.Add(this.loggingLevelCb); @@ -386,6 +388,16 @@ this.tab1ImportantSettings.Text = "Important settings"; this.tab1ImportantSettings.UseVisualStyleBackColor = true; // + // betaOptInCbox + // + this.betaOptInCbox.AutoSize = true; + this.betaOptInCbox.Location = new System.Drawing.Point(13, 358); + this.betaOptInCbox.Name = "betaOptInCbox"; + this.betaOptInCbox.Size = new System.Drawing.Size(107, 19); + this.betaOptInCbox.TabIndex = 6; + this.betaOptInCbox.Text = "[Opt in to Beta]"; + this.betaOptInCbox.UseVisualStyleBackColor = true; + // // booksGb // this.booksGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -621,6 +633,30 @@ this.tab4AudioFileOptions.Text = "Audio File Options"; this.tab4AudioFileOptions.UseVisualStyleBackColor = true; // + // audiobookFixupsGb + // + this.audiobookFixupsGb.Controls.Add(this.splitFilesByChapterCbox); + this.audiobookFixupsGb.Controls.Add(this.stripUnabridgedCbox); + this.audiobookFixupsGb.Controls.Add(this.convertLosslessRb); + this.audiobookFixupsGb.Controls.Add(this.convertLossyRb); + this.audiobookFixupsGb.Controls.Add(this.stripAudibleBrandingCbox); + this.audiobookFixupsGb.Location = new System.Drawing.Point(6, 143); + this.audiobookFixupsGb.Name = "audiobookFixupsGb"; + this.audiobookFixupsGb.Size = new System.Drawing.Size(403, 160); + this.audiobookFixupsGb.TabIndex = 19; + this.audiobookFixupsGb.TabStop = false; + this.audiobookFixupsGb.Text = "Audiobook Fix-ups"; + // + // stripUnabridgedCbox + // + this.stripUnabridgedCbox.AutoSize = true; + this.stripUnabridgedCbox.Location = new System.Drawing.Point(13, 47); + this.stripUnabridgedCbox.Name = "stripUnabridgedCbox"; + this.stripUnabridgedCbox.Size = new System.Drawing.Size(147, 19); + this.stripUnabridgedCbox.TabIndex = 13; + this.stripUnabridgedCbox.Text = "[StripUnabridged desc]"; + this.stripUnabridgedCbox.UseVisualStyleBackColor = true; + // // chapterTitleTemplateGb // this.chapterTitleTemplateGb.Controls.Add(this.chapterTitleTemplateBtn); @@ -977,16 +1013,6 @@ this.lameTargetBitrateRb.UseVisualStyleBackColor = true; this.lameTargetBitrateRb.CheckedChanged += new System.EventHandler(this.lameTargetRb_CheckedChanged); // - // stripUnabridgedCbox - // - this.stripUnabridgedCbox.AutoSize = true; - this.stripUnabridgedCbox.Location = new System.Drawing.Point(13, 47); - this.stripUnabridgedCbox.Name = "stripUnabridgedCbox"; - this.stripUnabridgedCbox.Size = new System.Drawing.Size(147, 19); - this.stripUnabridgedCbox.TabIndex = 13; - this.stripUnabridgedCbox.Text = "[StripUnabridged desc]"; - this.stripUnabridgedCbox.UseVisualStyleBackColor = true; - // // mergeOpeningEndCreditsCbox // this.mergeOpeningEndCreditsCbox.AutoSize = true; @@ -1034,20 +1060,6 @@ this.createCueSheetCbox.UseVisualStyleBackColor = true; this.createCueSheetCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); // - // audiobookFixupsGb - // - this.audiobookFixupsGb.Controls.Add(this.splitFilesByChapterCbox); - this.audiobookFixupsGb.Controls.Add(this.stripUnabridgedCbox); - this.audiobookFixupsGb.Controls.Add(this.convertLosslessRb); - this.audiobookFixupsGb.Controls.Add(this.convertLossyRb); - this.audiobookFixupsGb.Controls.Add(this.stripAudibleBrandingCbox); - this.audiobookFixupsGb.Location = new System.Drawing.Point(6, 143); - this.audiobookFixupsGb.Name = "audiobookFixupsGb"; - this.audiobookFixupsGb.Size = new System.Drawing.Size(403, 160); - this.audiobookFixupsGb.TabIndex = 19; - this.audiobookFixupsGb.TabStop = false; - this.audiobookFixupsGb.Text = "Audiobook Fix-ups"; - // // SettingsDialog // this.AcceptButton = this.saveBtn; @@ -1082,6 +1094,8 @@ this.customFileNamingGb.PerformLayout(); this.tab4AudioFileOptions.ResumeLayout(false); this.tab4AudioFileOptions.PerformLayout(); + this.audiobookFixupsGb.ResumeLayout(false); + this.audiobookFixupsGb.PerformLayout(); this.chapterTitleTemplateGb.ResumeLayout(false); this.chapterTitleTemplateGb.PerformLayout(); this.lameOptionsGb.ResumeLayout(false); @@ -1094,8 +1108,6 @@ ((System.ComponentModel.ISupportInitialize)(this.lameVBRQualityTb)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); - this.audiobookFixupsGb.ResumeLayout(false); - this.audiobookFixupsGb.PerformLayout(); this.ResumeLayout(false); } @@ -1183,5 +1195,6 @@ private System.Windows.Forms.Button editCharreplacementBtn; private System.Windows.Forms.CheckBox mergeOpeningEndCreditsCbox; private System.Windows.Forms.GroupBox audiobookFixupsGb; + private System.Windows.Forms.CheckBox betaOptInCbox; } } \ No newline at end of file diff --git a/Source/LibationWinForms/Dialogs/SettingsDialog.Important.cs b/Source/LibationWinForms/Dialogs/SettingsDialog.Important.cs index 505edb43..a2379c70 100644 --- a/Source/LibationWinForms/Dialogs/SettingsDialog.Important.cs +++ b/Source/LibationWinForms/Dialogs/SettingsDialog.Important.cs @@ -22,6 +22,7 @@ namespace LibationWinForms.Dialogs } booksLocationDescLbl.Text = desc(nameof(config.Books)); + betaOptInCbox.Text = desc(nameof(config.BetaOptIn)); this.saveEpisodesToSeriesFolderCbox.Text = desc(nameof(config.SavePodcastsToParentFolder)); booksSelectControl.SetSearchTitle("books location"); @@ -37,6 +38,10 @@ namespace LibationWinForms.Dialogs booksSelectControl.SelectDirectory(config.Books); saveEpisodesToSeriesFolderCbox.Checked = config.SavePodcastsToParentFolder; + betaOptInCbox.Checked = config.BetaOptIn; + + if (!betaOptInCbox.Checked) + betaOptInCbox.CheckedChanged += betaOptInCbox_CheckedChanged; } private void Save_Important(Configuration config) @@ -88,6 +93,35 @@ namespace LibationWinForms.Dialogs } config.SavePodcastsToParentFolder = saveEpisodesToSeriesFolderCbox.Checked; + + config.BetaOptIn = betaOptInCbox.Checked; + } + + + private void betaOptInCbox_CheckedChanged(object sender, EventArgs e) + { + if (!betaOptInCbox.Checked) + return; + + var result = MessageBox.Show(this, @" + + +You've chosen to opt-in to Libation's beta releases. Thank you! We need all the testers we can get. + +These features are works in progress and potentially very buggy. Libation may crash unexpectedly, and your library database may even be corruted. We suggest you back up your LibationContext.db file before proceding. + +If bad/weird things happen, please report them at getlibation.com. + +".Trim(), "A word of warning...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); + + if (result == DialogResult.Yes) + { + betaOptInCbox.CheckedChanged -= betaOptInCbox_CheckedChanged; + } + else + { + betaOptInCbox.Checked = false; + } } } }