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

Add option to toggle Quick Setup QR code #534

Merged
merged 1 commit into from
May 22, 2024
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
27 changes: 27 additions & 0 deletions MacroDeck/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SuchByte.MacroDeck.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<SuchByte.MacroDeck.Properties.Settings>
<setting name="IconSelectorLastIconPack" serializeAs="String">
<value />
</setting>
<setting name="DebugConsoleFilters" serializeAs="String">
<value />
</setting>
<setting name="SelectedProfile" serializeAs="String">
<value />
</setting>
<setting name="VariableViewSelectedFilter" serializeAs="String">
<value />
</setting>
<setting name="ShowQrCodeAndNetwork" serializeAs="String">
<value>True</value>
</setting>
</SuchByte.MacroDeck.Properties.Settings>
</userSettings>
</configuration>
4 changes: 2 additions & 2 deletions MacroDeck/DataTypes/QrCode/QuickConnectQrCodeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ public class QuickConnectQrCodeData
{
public string InstanceName { get; set; }

public List<string> NetworkInterfaces { get; set; }
public string[] NetworkInterfaces { get; set; }

public int Port { get; set; }

public bool Ssl { get; set; }

public string Token { get; set; }

public QuickConnectQrCodeData(string instanceName, List<string> networkInterfaces, int port, bool ssl, string token)
public QuickConnectQrCodeData(string instanceName, string[] networkInterfaces, int port, bool ssl, string token)
{
InstanceName = instanceName;
NetworkInterfaces = networkInterfaces;
Expand Down
2 changes: 1 addition & 1 deletion MacroDeck/GUI/CustomControls/Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected override void WndProc(ref Message m)
base.WndProc(ref m);
if (this.WindowState == originalState)
{

return;
}

FormWindowStateChanged?.Invoke(this, EventArgs.Empty);
Expand Down
116 changes: 65 additions & 51 deletions MacroDeck/GUI/MainWindowViews/DeckView.Designer.cs

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

24 changes: 24 additions & 0 deletions MacroDeck/GUI/MainWindowViews/DeckView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,26 @@ public DeckView(MainWindow mainWindow)
UpdateTranslation();
_currentFolder = ProfileManager.CurrentProfile.Folders.FirstOrDefault();
qrCodeBox.BackgroundImage = QrCodeService.Instance.GetQuickSetupQrCode();
checkQrAndNetwork.Checked = Settings.Default.ShowQrCodeAndNetwork;
lblNetworkInterfaces.Text = GetNetworkInterfacesString();
lblPort.Text = $"Port: {MacroDeck.Configuration.HostPort}";
checkQrAndNetwork_CheckedChanged(null, EventArgs.Empty);
_mainWindow = mainWindow;
HandleCreated += DeckView_HandleCreated;
HandleDestroyed += DeckView_HandleDestroyed;
}

private string GetNetworkInterfacesString()
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Network interfaces:");
foreach (var networkInterface in NetworkUtils.GetNetworkInterfaces())
{
stringBuilder.AppendLine($"- {networkInterface}");
}
return stringBuilder.ToString();
}

private void DeckView_HandleDestroyed(object? sender, EventArgs e)
{
_mainWindow.ResizeEnd -= MainWindow_ResizeEnd;
Expand Down Expand Up @@ -803,4 +818,13 @@ private void btnDiscord_Click(object sender, EventArgs e)
};
p.Start();
}

private void checkQrAndNetwork_CheckedChanged(object sender, EventArgs e)
{
qrCodeBox.Visible = checkQrAndNetwork.Checked;
lblNetworkInterfaces.Visible = checkQrAndNetwork.Checked;
lblPort.Visible = checkQrAndNetwork.Checked;
Settings.Default.ShowQrCodeAndNetwork = checkQrAndNetwork.Checked;
Settings.Default.Save();
}
}
49 changes: 28 additions & 21 deletions MacroDeck/Properties/Settings.Designer.cs

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

Loading
Loading