Merge pull request #506 from alladinian/feature/Settings-window-layout

Improvements in the layout of the Settings window
This commit is contained in:
Matt Kiazyk 2024-03-08 14:21:56 -06:00 committed by GitHub
commit 21e2a10eec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 30 additions and 21 deletions

View file

@ -10,7 +10,7 @@ struct AcknowledgmentsView: View {
)! )!
.addingAttribute(.foregroundColor, value: NSColor.labelColor) .addingAttribute(.foregroundColor, value: NSColor.labelColor)
) )
.frame(minWidth: 500, minHeight: 500) .frame(minWidth: 600, minHeight: 500)
} }
} }

View file

@ -38,6 +38,7 @@ struct AdvancedPreferencePane: View {
} }
Text("InstallPathDescription") Text("InstallPathDescription")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
} }
} }
@ -73,6 +74,7 @@ struct AdvancedPreferencePane: View {
} }
Text("LocalCachePathDescription") Text("LocalCachePathDescription")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
} }
} }
@ -94,6 +96,7 @@ struct AdvancedPreferencePane: View {
Text(appState.onSelectActionType.detailedDescription) Text(appState.onSelectActionType.detailedDescription)
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
Spacer() Spacer()
.frame(height: 20) .frame(height: 20)
@ -102,6 +105,7 @@ struct AdvancedPreferencePane: View {
.disabled(appState.createSymLinkOnSelectDisabled) .disabled(appState.createSymLinkOnSelectDisabled)
Text("AutomaticallyCreateSymbolicLinkDescription") Text("AutomaticallyCreateSymbolicLinkDescription")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
@ -114,6 +118,7 @@ struct AdvancedPreferencePane: View {
.disabled(appState.createSymLinkOnSelectDisabled) .disabled(appState.createSymLinkOnSelectDisabled)
Text("ShowOpenInRosettaDescription") Text("ShowOpenInRosettaDescription")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
} }
.groupBoxStyle(PreferencesGroupBoxStyle()) .groupBoxStyle(PreferencesGroupBoxStyle())
@ -128,16 +133,18 @@ struct AdvancedPreferencePane: View {
case .installed: case .installed:
Text("HelperInstalled") Text("HelperInstalled")
case .notInstalled: case .notInstalled:
HStack { VStack(alignment: .leading) {
Text("HelperNotInstalled")
Button("InstallHelper") { Button("InstallHelper") {
appState.installHelperIfNecessary() appState.installHelperIfNecessary()
} }
Text("HelperNotInstalled")
.font(.footnote)
} }
} }
Text("PrivilegedHelperDescription") Text("PrivilegedHelperDescription")
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
Spacer() Spacer()
@ -153,9 +160,9 @@ struct AdvancedPreferencePane_Previews: PreviewProvider {
Group { Group {
AdvancedPreferencePane() AdvancedPreferencePane()
.environmentObject(AppState()) .environmentObject(AppState())
.frame(maxWidth: 500) .frame(maxWidth: 600)
} }
.frame(width: 500, height: 700, alignment: .center) .frame(width: 600, height: 700, alignment: .center)
} }
} }
@ -163,11 +170,8 @@ struct AdvancedPreferencePane_Previews: PreviewProvider {
struct PreferencesGroupBoxStyle: GroupBoxStyle { struct PreferencesGroupBoxStyle: GroupBoxStyle {
func makeBody(configuration: Configuration) -> some View { func makeBody(configuration: Configuration) -> some View {
HStack(alignment: .top, spacing: 20) { HStack(alignment: .top, spacing: 20) {
HStack { configuration.label
Spacer() .frame(width: 180, alignment: .trailing)
configuration.label
}
.frame(width: 120)
VStack(alignment: .leading) { VStack(alignment: .leading) {
configuration.content configuration.content

View file

@ -18,6 +18,7 @@ struct DownloadPreferencePane: View {
} }
} }
.labelsHidden() .labelsHidden()
.fixedSize()
AttributedText(dataSourceFootnote) AttributedText(dataSourceFootnote)
} }
@ -34,6 +35,7 @@ struct DownloadPreferencePane: View {
} }
} }
.labelsHidden() .labelsHidden()
.fixedSize()
AttributedText(downloaderFootnote) AttributedText(downloaderFootnote)
} }
@ -50,7 +52,7 @@ struct DownloadPreferencePane: View {
string: string, string: string,
attributes: [ attributes: [
.font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]), .font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]),
.foregroundColor: NSColor.labelColor .foregroundColor: NSColor.secondaryLabelColor
] ]
) )
attributedString.addAttribute(.link, value: URL(string: "https://xcodereleases.com")!, range: NSRange(string.range(of: "Xcode Releases")!, in: string)) attributedString.addAttribute(.link, value: URL(string: "https://xcodereleases.com")!, range: NSRange(string.range(of: "Xcode Releases")!, in: string))
@ -63,7 +65,7 @@ struct DownloadPreferencePane: View {
string: string, string: string,
attributes: [ attributes: [
.font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]), .font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]),
.foregroundColor: NSColor.labelColor .foregroundColor: NSColor.secondaryLabelColor
] ]
) )
attributedString.addAttribute(.link, value: URL(string: "https://github.com/aria2/aria2")!, range: NSRange(string.range(of: "aria2")!, in: string)) attributedString.addAttribute(.link, value: URL(string: "https://github.com/aria2/aria2")!, range: NSRange(string.range(of: "aria2")!, in: string))
@ -74,9 +76,10 @@ struct DownloadPreferencePane: View {
struct DownloadPreferencePane_Previews: PreviewProvider { struct DownloadPreferencePane_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
Group { Group {
GeneralPreferencePane() DownloadPreferencePane()
.environmentObject(AppState()) .environmentObject(AppState())
.frame(maxWidth: 500) .frame(maxWidth: 600)
.frame(minHeight: 300)
} }
} }
} }

View file

@ -18,8 +18,6 @@ struct ExperimentsPreferencePane: View {
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
} }
.groupBoxStyle(PreferencesGroupBoxStyle()) .groupBoxStyle(PreferencesGroupBoxStyle())
Divider()
} }
} }
@ -29,7 +27,7 @@ struct ExperimentsPreferencePane: View {
string: string, string: string,
attributes: [ attributes: [
.font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]), .font: NSFont.preferredFont(forTextStyle: .footnote, options: [:]),
.foregroundColor: NSColor.labelColor .foregroundColor: NSColor.secondaryLabelColor
] ]
) )
attributedString.addAttribute(.link, value: URL(string: "https://twitter.com/_saagarjha")!, range: NSRange(string.range(of: "@_saagarjha")!, in: string)) attributedString.addAttribute(.link, value: URL(string: "https://twitter.com/_saagarjha")!, range: NSRange(string.range(of: "@_saagarjha")!, in: string))
@ -43,7 +41,7 @@ struct ExperimentsPreferencePane_Previews: PreviewProvider {
Group { Group {
ExperimentsPreferencePane() ExperimentsPreferencePane()
.environmentObject(AppState()) .environmentObject(AppState())
.frame(maxWidth: 500) .frame(maxWidth: 600)
} }
} }
} }

View file

@ -29,7 +29,7 @@ struct GeneralPreferencePane_Previews: PreviewProvider {
Group { Group {
GeneralPreferencePane() GeneralPreferencePane()
.environmentObject(AppState()) .environmentObject(AppState())
.frame(maxWidth: 500) .frame(maxWidth: 600)
} }
} }
} }

View file

@ -39,6 +39,6 @@ struct PreferencesView: View {
.tag(Tabs.experiment) .tag(Tabs.experiment)
} }
.padding(20) .padding(20)
.frame(width: 500) .frame(width: 600)
} }
} }

View file

@ -43,9 +43,11 @@ struct UpdatesPreferencePane: View {
Button("CheckNow") { Button("CheckNow") {
updater.checkForUpdates() updater.checkForUpdates()
} }
.padding(.top)
Text(String(format: localizeString("LastChecked"), lastUpdatedString)) Text(String(format: localizeString("LastChecked"), lastUpdatedString))
.font(.footnote) .font(.footnote)
.foregroundStyle(.secondary)
} }
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
} }
@ -140,7 +142,9 @@ struct UpdatesPreferencePane_Previews: PreviewProvider {
Group { Group {
UpdatesPreferencePane() UpdatesPreferencePane()
.environmentObject(AppState()) .environmentObject(AppState())
.frame(maxWidth: 500) .environmentObject(ObservableUpdater())
.frame(maxWidth: 600)
.frame(minHeight: 300)
} }
} }
} }