Skip to content

Commit

Permalink
prep for 1.0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAiiR committed Nov 23, 2024
1 parent 14c75f9 commit ea9f128
Show file tree
Hide file tree
Showing 21 changed files with 572 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using QopenAPI;
using System.IO;
using QobuzDownloaderX.Properties;
using QobuzDownloaderX.Download;
using System.Text.RegularExpressions;

namespace QobuzDownloaderX
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Diagnostics;

namespace QobuzDownloaderX.Download
namespace QobuzDownloaderX
{
class FixMD5
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Drawing;
using System.Threading.Tasks;

namespace QobuzDownloaderX.Download
namespace QobuzDownloaderX
{
class SearchPanelHelper
{
Expand Down Expand Up @@ -34,6 +34,9 @@ public async Task PopulateTableAlbums(qbdlxForm mainForm, SearchAlbumResult QoAl
// Access the "items" array from the response
var albums = QoAlbumSearch.Albums.Items;

// Load the font name from the translation file
string fontName = qbdlxForm._qbdlxForm.languageManager.GetTranslation("TranslationFont");

mainForm.Invoke((MethodInvoker)delegate ()
{
TableLayoutPanel searchResultsTablePanel = mainForm.searchResultsTablePanel;
Expand Down Expand Up @@ -71,7 +74,7 @@ public async Task PopulateTableAlbums(qbdlxForm mainForm, SearchAlbumResult QoAl
artistName.TextAlign = ContentAlignment.MiddleCenter; // Center text horizontally and vertically
artistName.Anchor = AnchorStyles.None; // Center within the cell
artistName.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText); // Set text color
artistName.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
artistName.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(artistName, 1, rowIndex);

// Add Label for album title
Expand All @@ -84,7 +87,7 @@ public async Task PopulateTableAlbums(qbdlxForm mainForm, SearchAlbumResult QoAl
albumTitle.TextAlign = ContentAlignment.MiddleCenter; // Center text horizontally and vertically
albumTitle.Anchor = AnchorStyles.None; // Center within the cell
albumTitle.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText); // Set text color
albumTitle.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
albumTitle.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(albumTitle, 2, rowIndex);

// Add Label for quality
Expand All @@ -105,15 +108,15 @@ public async Task PopulateTableAlbums(qbdlxForm mainForm, SearchAlbumResult QoAl
qualityLabel.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText); ;
}

qualityLabel.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
qualityLabel.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(qualityLabel, 3, rowIndex);

// Add Button for selecting album ID
Button selectButton = new Button();
selectButton.Text = qbdlxForm._qbdlxForm.languageManager.GetTranslation("downloadButton");
selectButton.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.ButtonText); // Set button text color
selectButton.BackColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.ButtonBackground); // Set button background color
selectButton.Font = new Font("Nirmala UI", 8F, FontStyle.Regular); // Set font size and style
selectButton.Font = new Font(fontName, 8F, FontStyle.Regular); // Set font size and style
selectButton.FlatStyle = FlatStyle.Flat; // Set FlatStyle to Flat
selectButton.FlatAppearance.BorderSize = 0; // Set border size
selectButton.FlatAppearance.MouseOverBackColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.HighlightedButtonBackground); // Set background color when hovering
Expand All @@ -133,6 +136,9 @@ public async Task PopulateTableTracks(qbdlxForm mainForm, SearchTrackResult QoTr
// Access the "items" array from the response
var tracks = QoTrackSearch.Tracks.Items;

// Load the font name from the translation file
string fontName = qbdlxForm._qbdlxForm.languageManager.GetTranslation("TranslationFont");

mainForm.Invoke((MethodInvoker)delegate ()
{
TableLayoutPanel searchResultsTablePanel = mainForm.searchResultsTablePanel;
Expand Down Expand Up @@ -170,7 +176,7 @@ public async Task PopulateTableTracks(qbdlxForm mainForm, SearchTrackResult QoTr
artistName.TextAlign = ContentAlignment.MiddleCenter; // Center text horizontally and vertically
artistName.Anchor = AnchorStyles.None; // Center within the cell
artistName.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText); // Set text color
artistName.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
artistName.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(artistName, 1, rowIndex);

// Add Label for track title
Expand All @@ -183,7 +189,7 @@ public async Task PopulateTableTracks(qbdlxForm mainForm, SearchTrackResult QoTr
trackTitle.TextAlign = ContentAlignment.MiddleCenter; // Center text horizontally and vertically
trackTitle.Anchor = AnchorStyles.None; // Center within the cell
trackTitle.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText); // Set text color
trackTitle.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
trackTitle.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(trackTitle, 2, rowIndex);

// Add Label for quality
Expand All @@ -204,15 +210,15 @@ public async Task PopulateTableTracks(qbdlxForm mainForm, SearchTrackResult QoTr
qualityLabel.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.LabelText);
}

qualityLabel.Font = new Font("Nirmala UI", 10F, FontStyle.Regular); // Set font size and style
qualityLabel.Font = new Font(fontName, 10F, FontStyle.Regular); // Set font size and style
searchResultsTablePanel.Controls.Add(qualityLabel, 3, rowIndex);

// Add Button for selecting album ID
Button selectButton = new Button();
selectButton.Text = qbdlxForm._qbdlxForm.languageManager.GetTranslation("downloadButton");
selectButton.ForeColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.ButtonText); // Set button text color
selectButton.BackColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.ButtonBackground); // Set button background color
selectButton.Font = new Font("Nirmala UI", 8F, FontStyle.Regular); // Set font size and style
selectButton.Font = new Font(fontName, 8F, FontStyle.Regular); // Set font size and style
selectButton.FlatStyle = FlatStyle.Flat; // Set FlatStyle to Flat
selectButton.FlatAppearance.BorderSize = 0; // Set border size
selectButton.FlatAppearance.MouseOverBackColor = ColorTranslator.FromHtml(qbdlxForm._qbdlxForm._themeManager._currentTheme.HighlightedButtonBackground); // Set background color when hovering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ private static void SetAlbumArtists(TagLib.File file, Album QoAlbum)
if (!Settings.Default.albumArtistTag) return;

var mainArtists = QoAlbum.Artists.Where(a => a.Roles.Contains("main-artist")).ToList();
string albumArtist = mainArtists.Count > 1
? string.Join(", ", mainArtists.Select(a => a.Name))
: QoAlbum.Artist.Name;
if (mainArtists.Count > 1)
{
var allButLastArtist = string.Join(", ", mainArtists.Take(mainArtists.Count - 1).Select(a => a.Name));
var lastArtist = mainArtists.Last().Name;
file.Tag.AlbumArtists = new[] { $"{allButLastArtist} & {lastArtist}" };
return;
}

file.Tag.AlbumArtists = new[] { albumArtist };
file.Tag.AlbumArtists = new[] { QoAlbum.Artist.Name };
}

private static void EmbedArtwork(TagLib.File file, string artworkPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public class LanguageManager
public string defaultLanguage = @"{
""TranslationCredit"": ""AiiR"",
""TranslationUpdatedOn"": ""November 17, 2024, 12:38PM EST"",
""TranslationFont"": ""Nirmala UI"",
""_SECTION1_"": ""=================== MAIN FORM BUTTONS ==================="",
""additionalSettingsButton"": ""Additional Settings"",
""aboutButton"": ""ABOUT"",
Expand All @@ -299,10 +300,12 @@ public class LanguageManager
""extraSettingsLabel"": ""ADDITIONAL SETTINGS"",
""languageLabel"": ""Current Language"",
""playlistTemplateLabel"": ""PLAYLIST TEMPLATE"",
""favoritesTemplateLabel"": ""FAVORITES TEMPLATE"",
""savedArtLabel"": ""Saved Artwork Size"",
""searchingLabel"": ""Searching..."",
""taggingOptionsLabel"": ""TAGGING OPTIONS"",
""templatesLabel"": ""TEMPLATES"",
""templatesListLabel"": ""TEMPLATES LIST"",
""themeLabel"": ""Current Theme"",
""themeSectionLabel"": ""THEMING OPTIONS"",
""trackTemplateLabel"": ""TRACK TEMPLATE"",
Expand Down Expand Up @@ -367,7 +370,7 @@ public class LanguageManager
""customLabel"": ""USE CUSTOM APP ID + SECRET"",
""_SECTION7_"": ""=================== LOGIN FORM TEXTBOXES ==================="",
""customInfoTextbox"": ""Leave values blank if you would like to automatically grab the values!"",
""aboutTextbox"": ""Version - {version}\r\nCreated by AiiR\r\n\r\nInspired By Qo-DL\r\n(Created by Sorrow and DashLt)\r\n\r\nThanks to the users on Github and Telegram for offering bug reports and ideas! And huge shoutout to DJDoubleD for keeping the original running since I've been busy!"",
""aboutTextbox"": ""Version - {version}\r\nCreated by AiiR\r\n\r\nInspired By Qo-DL\r\n(Created by Sorrow and DashLt)\r\n\r\nThanks to the users on Github and Telegram for offering bug reports and ideas! And huge shoutout to DJDoubleD for keeping the original running since I've been busy!"",
""_SECTION8_"": ""=================== LOGIN FORM PLACEHOLDERS ==================="",
""emailPlaceholder"": ""e-mail"",
""passwordPlaceholder"": ""password"",
Expand All @@ -376,11 +379,11 @@ public class LanguageManager
""altLoginLabelEmail"": ""LOGIN WITH E-MAIL AND PASSWORD"",
""loginTextWaiting"": ""waiting for login..."",
""loginTextStart"": ""logging in..."",
""loginTextError"": ""login failed, error log saved"",
""loginTextError"": ""login failed, error log saved"",
""loginTextNoEmail"": ""no e-mail in input"",
""loginTextNoPassword"": ""no password/token in input"",
""updateNotification"": ""New version of QBDLX is available!\r\n\r\nInstalled version - {currentVersion}\r\nLatest version - {newVersion}\r\n\r\nChangelog Below\r\n==============\r\n{changelog}\r\n==============\r\n\r\nWould you like to update?"",
""updateNotificationTitle"": ""QBDLX | Update Available""
""updateNotification"": ""New version of QBDLX is available!\r\n\r\nInstalled version - {currentVersion}\r\nLatest version - {newVersion}\r\n\r\nChangelog Below\r\n==============\r\n{changelog}\r\n==============\r\n\r\nWould you like to update?"",
""updateNotificationTitle"": ""QBDLX | Update Available""
}
";

Expand Down Expand Up @@ -425,5 +428,26 @@ public string GetTranslation(string key)
{
return languageDictionary.ContainsKey(key) ? languageDictionary[key] : key;
}

public void UpdateControlFont(Control.ControlCollection controls, string fontName)
{
foreach (Control control in controls)
{
if (control is Label || control is Button || control is TextBox)
{
// Keep the original font size
float originalSize = control.Font.Size;
FontStyle originalStyle = control.Font.Style;

control.Font = new Font(fontName, originalSize, originalStyle);
}

// Recursively update child controls
if (control.HasChildren)
{
UpdateControlFont(control.Controls, fontName);
}
}
}
}
}
12 changes: 12 additions & 0 deletions QobuzDownloaderX/Helpers/Updating.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QobuzDownloaderX.Helpers
{
internal class Updating
{
}
}
7 changes: 4 additions & 3 deletions QobuzDownloaderX/LoginForm/LoginForm.Designer.cs

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

9 changes: 9 additions & 0 deletions QobuzDownloaderX/LoginForm/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public LoginForm()

private void UpdateUILanguage()
{
// Load the font name from the translation file
string fontName = languageManager.GetTranslation("TranslationFont");

if (!string.IsNullOrEmpty(fontName))
{
// Call method to update fonts
languageManager.UpdateControlFont(this.Controls, fontName);
}

/* Update labels, buttons, textboxes, etc., based on the loaded language */

// Buttons
Expand Down
Loading

0 comments on commit ea9f128

Please sign in to comment.