Skip to content

Commit

Permalink
Redesign About dialog and update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed May 20, 2020
1 parent beafa44 commit ceb7914
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 194 deletions.
1 change: 1 addition & 0 deletions installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ end;
procedure DeleteUserData;
begin
DelTree(ExpandConstant('{app}\scripts'), true, true, true);
DelTree(ExpandConstant('{app}\themes'), true, true, true);
DeleteFile(ExpandConstant('{app}\settings.conf'));
DeleteFile(ExpandConstant('{app}\{#MyAppExeName}.log'));
Expand Down
143 changes: 26 additions & 117 deletions src/AboutDialog.Designer.cs

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

98 changes: 34 additions & 64 deletions src/AboutDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,94 +18,64 @@ namespace WinDynamicDesktop
public partial class AboutDialog : Form
{
private static readonly Func<string, string> _ = Localization.GetTranslation;
private static readonly string websiteLink = "https://github.com/t1m0thyj/WinDynamicDesktop";
private static readonly string donateLink = "https://paypal.me/t1m0thyj";
private readonly string websiteLink = "https://github.com/t1m0thyj/WinDynamicDesktop";
private readonly string donateLink = "https://paypal.me/t1m0thyj";
private readonly string rateLink = "ms-windows-store://review/?ProductId=9NM8N7DQ3Z5F";

public AboutDialog()
{
InitializeComponent();
Localization.TranslateForm(this);

this.Font = SystemFonts.MessageBoxFont;
this.nameLabel.Font = new Font(this.Font.Name, this.Font.Size * 1.2F, FontStyle.Bold);

int minWidth = TextRenderer.MeasureText(descriptionLabel.Text, this.Font).Width;

if (this.descriptionLabel.Width < minWidth)
{
minWidth += descriptionLabel.Location.X * 2;
nameLabel.Width = minWidth;
copyrightLabel.Width = minWidth;
descriptionLabel.Width = minWidth;
websiteLabel.Width = minWidth;
}

minWidth = minWidth + (descriptionLabel.Width - minWidth) / 2 + descriptionLabel.Location.X * 2;

if (this.Size.Width < minWidth)
{
this.Size = new Size(minWidth, this.Size.Height);
this.CenterToScreen();
}

minWidth = TextRenderer.MeasureText(creditsButton.Text, this.Font).Width + 10;

if (this.creditsButton.Width < minWidth)
{
int oldWidth = creditsButton.Width;
creditsButton.Width = minWidth;
donateButton.Location = new Point(donateButton.Location.X + minWidth - oldWidth,
donateButton.Location.Y);
}
}

private void AboutDialog_Load(object sender, EventArgs e)
{
iconBox.Image = (new Icon(Properties.Resources.AppIcon, 64, 64)).ToBitmap();

string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
nameLabel.Text += " " + version.Remove(version.Length - 2);

if (UwpDesktop.IsRunningAsUwp())
{
nameLabel.Text += " (UWP)";
}

creditsBox.Text = GetCreditsText();
richTextBox1.Rtf = GetRtfText();
}

private string GetCreditsText()
private string GetRtfLink(string href, string linkText = null)
{
List<string> lines = new List<string>() {
_("Thanks to:"),
"",
_("Apple for the Mojave wallpapers"),
_("Contributors and translators on GitHub"),
_("LocationIQ for their free geocoding API"),
_("Roundicons from flaticon.com for the icon (licensed by CC 3.0 BY)")
};

return string.Join(Environment.NewLine + " ", lines);
}

private void websiteLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(websiteLink);
return @"{\field{\*\fldinst HYPERLINK " + '"' + href + '"' + @"}{\fldrslt " + (linkText ?? href) + "}}";
}

private void closeButton_Click(object sender, EventArgs e)
private string GetRtfText()
{
this.Close();
string versionStr = Assembly.GetExecutingAssembly().GetName().Version.ToString();
versionStr = versionStr.Remove(versionStr.Length - 2);
versionStr += UwpDesktop.IsRunningAsUwp() ? " (UWP)" : string.Empty;

string copyrightLine = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(
Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;

string donateRateLine = string.Format(_("If you like the app, please consider {0} or {1} :)"),
GetRtfLink(donateLink, _("donating")), GetRtfLink(rateLink, _("rating it")));

return @"{\rtf1\pc\fs5\par" +
@"\sb72\qc\fs30\b WinDynamicDesktop " + versionStr + @"\b0\par" +
@"\fs20 " + _("Port of macOS Dynamic Desktop feature to Windows 10") + @"\par " +
copyrightLine + @"\par " +
GetRtfLink(websiteLink) + @"\par " +
donateRateLine + @"\par" +
@"\par" +
@"\b " + _("Thanks to:") + @"\b0\par " +
_("Apple for the Mojave wallpapers") + @"\par " +
_("Contributors and translators on GitHub") + @"\par " +
_("LocationIQ for their free geocoding API") + @"\par " +
_("Roundicons from flaticon.com for the icon (licensed by CC 3.0 BY)") + @"\par" +
@"\par }";
}

private void creditsButton_CheckedChanged(object sender, EventArgs e)
private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
{
creditsBox.Visible ^= true;
System.Diagnostics.Process.Start(e.LinkText);
}

private void donateButton_Click(object sender, EventArgs e)
private void closeButton_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(donateLink);
this.Close();
}
}
}
4 changes: 3 additions & 1 deletion src/LanguageDialog.Designer.cs

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

2 changes: 1 addition & 1 deletion src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyVersion("4.1.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
5 changes: 0 additions & 5 deletions src/ThemeListViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,5 @@ public override void DrawItem(Graphics g, ImageListViewItem item, ItemState stat

g.Clip = oldClip;
}

public override void OnLayout(LayoutEventArgs e)
{
e.ItemAreaBounds = Rectangle.Inflate(e.ItemAreaBounds, -5, -5);
}
}
}
8 changes: 4 additions & 4 deletions src/WinDynamicDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
<Reference Include="PropertyChanged, Version=3.2.8.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>packages\PropertyChanged.Fody.3.2.8\lib\net40\PropertyChanged.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>packages\RestSharp.106.10.1\lib\net452\RestSharp.dll</HintPath>
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="SunCalcNet, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SunCalcNet.1.1.1\lib\netstandard2.0\SunCalcNet.dll</HintPath>
<Reference Include="SunCalcNet, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SunCalcNet.1.1.3\lib\netstandard2.0\SunCalcNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Binary file modified src/locale/bn.mo
Binary file not shown.
Binary file modified src/locale/cs.mo
Binary file not shown.
Binary file modified src/locale/de.mo
Binary file not shown.
Binary file modified src/locale/el.mo
Binary file not shown.
Binary file modified src/locale/es.mo
Binary file not shown.
Binary file modified src/locale/fr.mo
Binary file not shown.
Binary file modified src/locale/hi.mo
Binary file not shown.
Binary file modified src/locale/id.mo
Binary file not shown.
Binary file modified src/locale/it.mo
Binary file not shown.
Binary file modified src/locale/mk.mo
Binary file not shown.
Binary file modified src/locale/pl.mo
Binary file not shown.
Binary file modified src/locale/pt-br.mo
Binary file not shown.
Binary file modified src/locale/ro.mo
Binary file not shown.
Binary file modified src/locale/ru.mo
Binary file not shown.
Binary file modified src/locale/tr.mo
Binary file not shown.
Binary file modified src/locale/zh-Hans.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions src/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="NGettext" version="0.6.5" targetFramework="net472" />
<package id="PropertyChanged.Fody" version="3.2.8" targetFramework="net472" />
<package id="RestSharp" version="106.10.1" targetFramework="net472" />
<package id="SunCalcNet" version="1.1.1" targetFramework="net472" />
<package id="RestSharp" version="106.11.4" targetFramework="net472" />
<package id="SunCalcNet" version="1.1.3" targetFramework="net472" />
</packages>

0 comments on commit ceb7914

Please sign in to comment.