mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[Bug report] - Auto fill bug report parameters. (#37991)
This commit is contained in:
29
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
29
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,6 +1,5 @@
|
|||||||
name: "🕷️ Bug report"
|
name: "🕷️ Bug report"
|
||||||
description: Report errors or unexpected behavior
|
description: Report errors or unexpected behavior
|
||||||
type: Bug
|
|
||||||
labels:
|
labels:
|
||||||
- Issue-Bug
|
- Issue-Bug
|
||||||
- Needs-Triage
|
- Needs-Triage
|
||||||
@@ -8,7 +7,8 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: Please make sure to [search for existing issues](https://github.com/microsoft/PowerToys/issues) before filing a new one!
|
value: Please make sure to [search for existing issues](https://github.com/microsoft/PowerToys/issues) before filing a new one!
|
||||||
- type: input
|
- id: version
|
||||||
|
type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Microsoft PowerToys version
|
label: Microsoft PowerToys version
|
||||||
placeholder: X.XX.X
|
placeholder: X.XX.X
|
||||||
@@ -16,7 +16,8 @@ body:
|
|||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
- id: installed
|
||||||
|
type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Installation method
|
label: Installation method
|
||||||
description: How / Where was PowerToys installed from?
|
description: How / Where was PowerToys installed from?
|
||||||
@@ -33,14 +34,6 @@ body:
|
|||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Running as admin
|
|
||||||
description: Are you running PowerToys as Admin?
|
|
||||||
options:
|
|
||||||
- "Yes"
|
|
||||||
- "No"
|
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Area(s) with issue?
|
label: Area(s) with issue?
|
||||||
@@ -106,6 +99,19 @@ body:
|
|||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
- id: additionalInfo
|
||||||
|
type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional Information
|
||||||
|
placeholder: |
|
||||||
|
OS version
|
||||||
|
.Net version
|
||||||
|
System Language
|
||||||
|
User or System Installation
|
||||||
|
Running as admin
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Other Software
|
label: Other Software
|
||||||
@@ -116,3 +122,4 @@ body:
|
|||||||
My Cool Application v0.3 (include a code snippet if it would help!)
|
My Cool Application v0.3 (include a code snippet if it would help!)
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
|||||||
@@ -458,7 +458,7 @@
|
|||||||
<controls:SettingsPageControl.PrimaryLinks>
|
<controls:SettingsPageControl.PrimaryLinks>
|
||||||
<controls:PageLink x:Uid="GeneralPage_Documentation" Link="https://aka.ms/PowerToysOverview" />
|
<controls:PageLink x:Uid="GeneralPage_Documentation" Link="https://aka.ms/PowerToysOverview" />
|
||||||
<controls:PageLink x:Uid="General_Repository" Link="https://aka.ms/powertoys" />
|
<controls:PageLink x:Uid="General_Repository" Link="https://aka.ms/powertoys" />
|
||||||
<controls:PageLink x:Uid="GeneralPage_ReportAbug" Link="https://aka.ms/powerToysReportBug" />
|
<controls:PageLink x:Uid="GeneralPage_ReportAbug" Link="{x:Bind ViewModel.ReportBugLink, Mode=OneWay}" />
|
||||||
<controls:PageLink x:Uid="GeneralPage_RequestAFeature_URL" Link="https://aka.ms/powerToysRequestFeature" />
|
<controls:PageLink x:Uid="GeneralPage_RequestAFeature_URL" Link="https://aka.ms/powerToysRequestFeature" />
|
||||||
</controls:SettingsPageControl.PrimaryLinks>
|
</controls:SettingsPageControl.PrimaryLinks>
|
||||||
<controls:SettingsPageControl.SecondaryLinks>
|
<controls:SettingsPageControl.SecondaryLinks>
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
DataContext = ViewModel;
|
DataContext = ViewModel;
|
||||||
|
|
||||||
|
ViewModel.InitializeReportBugLink();
|
||||||
|
|
||||||
doRefreshBackupRestoreStatus(100);
|
doRefreshBackupRestoreStatus(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Diagnostics;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@@ -25,11 +26,19 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
|||||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||||
using Microsoft.PowerToys.Telemetry;
|
using Microsoft.PowerToys.Telemetry;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using Windows.System.Profile;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
{
|
{
|
||||||
public partial class GeneralViewModel : Observable
|
public partial class GeneralViewModel : Observable
|
||||||
{
|
{
|
||||||
|
public enum InstallScope
|
||||||
|
{
|
||||||
|
PerMachine = 0,
|
||||||
|
PerUser,
|
||||||
|
}
|
||||||
|
|
||||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||||
|
|
||||||
private UpdatingSettings UpdatingSettingsConfig { get; set; }
|
private UpdatingSettings UpdatingSettingsConfig { get; set; }
|
||||||
@@ -72,6 +81,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
private SettingsBackupAndRestoreUtils settingsBackupAndRestoreUtils = SettingsBackupAndRestoreUtils.Instance;
|
private SettingsBackupAndRestoreUtils settingsBackupAndRestoreUtils = SettingsBackupAndRestoreUtils.Instance;
|
||||||
|
|
||||||
|
private const string InstallScopeRegKey = @"Software\Classes\powertoys\";
|
||||||
|
|
||||||
public GeneralViewModel(ISettingsRepository<GeneralSettings> settingsRepository, string runAsAdminText, string runAsUserText, bool isElevated, bool isAdmin, Func<string, int> ipcMSGCallBackFunc, Func<string, int> ipcMSGRestartAsAdminMSGCallBackFunc, Func<string, int> ipcMSGCheckForUpdatesCallBackFunc, string configFileSubfolder = "", Action dispatcherAction = null, Action hideBackupAndRestoreMessageAreaAction = null, Action<int> doBackupAndRestoreDryRun = null, Func<Task<string>> pickSingleFolderDialog = null, Windows.ApplicationModel.Resources.ResourceLoader resourceLoader = null)
|
public GeneralViewModel(ISettingsRepository<GeneralSettings> settingsRepository, string runAsAdminText, string runAsUserText, bool isElevated, bool isAdmin, Func<string, int> ipcMSGCallBackFunc, Func<string, int> ipcMSGRestartAsAdminMSGCallBackFunc, Func<string, int> ipcMSGCheckForUpdatesCallBackFunc, string configFileSubfolder = "", Action dispatcherAction = null, Action hideBackupAndRestoreMessageAreaAction = null, Action<int> doBackupAndRestoreDryRun = null, Func<Task<string>> pickSingleFolderDialog = null, Windows.ApplicationModel.Resources.ResourceLoader resourceLoader = null)
|
||||||
{
|
{
|
||||||
CheckForUpdatesEventHandler = new ButtonClickCommand(CheckForUpdatesClick);
|
CheckForUpdatesEventHandler = new ButtonClickCommand(CheckForUpdatesClick);
|
||||||
@@ -256,6 +267,73 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
private int _initLanguagesIndex;
|
private int _initLanguagesIndex;
|
||||||
private bool _languageChanged;
|
private bool _languageChanged;
|
||||||
|
|
||||||
|
private string reportBugLink;
|
||||||
|
|
||||||
|
// Gets or sets a value indicating whether run powertoys on start-up.
|
||||||
|
public string ReportBugLink
|
||||||
|
{
|
||||||
|
get => reportBugLink;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
reportBugLink = value;
|
||||||
|
OnPropertyChanged(nameof(ReportBugLink));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeReportBugLink()
|
||||||
|
{
|
||||||
|
var version = GetPowerToysVersion();
|
||||||
|
|
||||||
|
string isElevatedString = "PowerToys is running " + (IsElevated ? "as admin (elevated)" : "as user (non-elevated)");
|
||||||
|
|
||||||
|
string installScope = GetCurrentInstallScope() == InstallScope.PerMachine ? "per machine (system)" : "per user";
|
||||||
|
|
||||||
|
var info = $"OS Version: {GetOSVersion()} \n.NET Version: {GetDotNetVersion()}\n{isElevatedString}\nInstall scope: {installScope}\nOperating System Language: {CultureInfo.InstalledUICulture.DisplayName}\nSystem locale: {CultureInfo.InstalledUICulture.Name}";
|
||||||
|
|
||||||
|
var gitHubURL = "https://github.com/microsoft/PowerToys/issues/new?template=bug_report.yml&labels=Issue-Bug%2CTriage-Needed" +
|
||||||
|
"&version=" + version + "&additionalInfo=" + System.Web.HttpUtility.UrlEncode(info);
|
||||||
|
|
||||||
|
ReportBugLink = gitHubURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetPowerToysVersion()
|
||||||
|
{
|
||||||
|
return Helper.GetProductVersion().TrimStart('v');
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetOSVersion()
|
||||||
|
{
|
||||||
|
return Environment.OSVersion.VersionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetDotNetVersion()
|
||||||
|
{
|
||||||
|
return $".NET {Environment.Version}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InstallScope GetCurrentInstallScope()
|
||||||
|
{
|
||||||
|
// Check HKLM first
|
||||||
|
if (Registry.LocalMachine.OpenSubKey(InstallScopeRegKey) != null)
|
||||||
|
{
|
||||||
|
return InstallScope.PerMachine;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not found, check HKCU
|
||||||
|
var userKey = Registry.CurrentUser.OpenSubKey(InstallScopeRegKey);
|
||||||
|
if (userKey != null)
|
||||||
|
{
|
||||||
|
var installScope = userKey.GetValue("InstallScope") as string;
|
||||||
|
userKey.Close();
|
||||||
|
if (!string.IsNullOrEmpty(installScope) && installScope.Contains("perUser"))
|
||||||
|
{
|
||||||
|
return InstallScope.PerUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return InstallScope.PerMachine; // Default if no specific registry key found
|
||||||
|
}
|
||||||
|
|
||||||
// Gets or sets a value indicating whether run powertoys on start-up.
|
// Gets or sets a value indicating whether run powertoys on start-up.
|
||||||
public bool Startup
|
public bool Startup
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user