Skip to content

Commit

Permalink
Merge pull request #172 from martinfekete10/dev
Browse files Browse the repository at this point in the history
Attributions in settings
  • Loading branch information
martinfekete10 authored Jan 22, 2025
2 parents 09d2dff + 52b843a commit 71dd7ff
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Tuneful.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
FE6BFD082A73AE5E00D3321F /* Track.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE6BFD072A73AE5E00D3321F /* Track.swift */; };
FE6BFD0A2A73B23700D3321F /* UserDefaults+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE6BFD092A73B23700D3321F /* UserDefaults+Extension.swift */; };
FE6BFD0C2A73B2D400D3321F /* NSImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE6BFD0B2A73B2D400D3321F /* NSImage+Extension.swift */; };
FE6DDC042D419DDC0047851D /* AcknowledgementsSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE6DDC032D419DDC0047851D /* AcknowledgementsSettingsView.swift */; };
FE7955472CA2C7A3002026AA /* AudioSpectrumView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE7955462CA2C7A2002026AA /* AudioSpectrumView.swift */; };
FE7955492CA2C9E8002026AA /* NSBezierPath+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE7955482CA2C9E2002026AA /* NSBezierPath+Extension.swift */; };
FE79554E2CA34BF0002026AA /* Logger+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE79554D2CA34BE6002026AA /* Logger+Extension.swift */; };
Expand Down Expand Up @@ -209,6 +210,7 @@
FE6BFD072A73AE5E00D3321F /* Track.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Track.swift; sourceTree = "<group>"; };
FE6BFD092A73B23700D3321F /* UserDefaults+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extension.swift"; sourceTree = "<group>"; };
FE6BFD0B2A73B2D400D3321F /* NSImage+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSImage+Extension.swift"; sourceTree = "<group>"; };
FE6DDC032D419DDC0047851D /* AcknowledgementsSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementsSettingsView.swift; sourceTree = "<group>"; };
FE7955462CA2C7A2002026AA /* AudioSpectrumView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSpectrumView.swift; sourceTree = "<group>"; };
FE7955482CA2C9E2002026AA /* NSBezierPath+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSBezierPath+Extension.swift"; sourceTree = "<group>"; };
FE79554D2CA34BE6002026AA /* Logger+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Logger+Extension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -574,6 +576,7 @@
FEF0660A2B51905200A514F2 /* Settings */ = {
isa = PBXGroup;
children = (
FE6DDC032D419DDC0047851D /* AcknowledgementsSettingsView.swift */,
FE08CE182CFCC76700F047CB /* MiniPlayerSettingsView.swift */,
FEB21FB72D1AC71400849679 /* PopoverSettingsView.swift */,
FE08CE162CFCC51900F047CB /* NotchSettingsView.swift */,
Expand Down Expand Up @@ -758,6 +761,7 @@
FE31AEDC2CFBCB76002818ED /* SettingsView.swift in Sources */,
FE3189FD2A7C3D01006B2D59 /* OnboardingWindow.swift in Sources */,
FE79554E2CA34BF0002026AA /* Logger+Extension.swift in Sources */,
FE6DDC042D419DDC0047851D /* AcknowledgementsSettingsView.swift in Sources */,
FEDD311A2CBE4DAD00653956 /* PlayerAppProvider.swift in Sources */,
FEFFE5592B4FE00D000887B5 /* NSError+Extension.swift in Sources */,
FE4414B82AB4999600A73246 /* Notification.Name.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Tuneful/Extensions/Settings+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension Settings.PaneIdentifier {
static let notch = Self("notch")
static let keyboard = Self("keyboard")
static let about = Self("about")
static let acknowledgements = Self("acknowledgements")
}

public extension SettingsWindowController {
Expand Down
1 change: 1 addition & 0 deletions Tuneful/Helpers/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum Constants {
static let popoverWidth = 210.0
static let fullPopoverHeight = 345.0
static let compactPopoverHeight = 265.0
static let settingsWindowWidth: CGFloat = 500

enum Opacity {
static let primaryOpacity = 0.8
Expand Down
13 changes: 13 additions & 0 deletions Tuneful/Tuneful.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
return Settings.PaneHostingController(pane: paneView)
}

let AcknowledgementsSettingsViewController: () -> SettingsPane = {
let paneView = Settings.Pane(
identifier: .acknowledgements,
title: "Attributions",
toolbarIcon: NSImage(systemSymbolName: "heart", accessibilityDescription: "Acknowledgements settings")!
) {
AcknowledgementsSettingsView()
}

return Settings.PaneHostingController(pane: paneView)
}

let AboutSettingsViewController: () -> SettingsPane = {
let paneView = Settings.Pane(
identifier: .about,
Expand Down Expand Up @@ -439,6 +451,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
MenuBarSettingsViewController(),
NotchSettingsViewController(),
KeyboardShortcutsSettingsViewController(),
AcknowledgementsSettingsViewController(),
AboutSettingsViewController()
],
style: .toolbarItems,
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/AboutSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Settings

struct AboutSettingsView: View {
var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection {
VStack(alignment: .center) {
Expand Down
94 changes: 94 additions & 0 deletions Tuneful/Views/Settings/AcknowledgementsSettingsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//
// AboutSettingsView.swift
// Tuneful
//
// Created by Martin Fekete on 12/01/2024.
//

import SwiftUI
import Settings

struct AcknowledgementsSettingsView: View {
var body: some View {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
VStack {
Text("Tuneful uses the following open source libraries or their modifications")
.font(.footnote)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.padding(.bottom, 5)
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity, alignment: .center)

LuminareSection {
AcknowledgmentsView(
libraryName: "Luminare",
libraryUrl: "https://github.com/MrKai77/Luminare",
licenseName: "BSD 3-Clause License",
licenseUrl: "https://github.com/MrKai77/Luminare/blob/main/LICENSE.md"
)

AcknowledgmentsView(
libraryName: "LaunchAtLogin",
libraryUrl: "https://github.com/sindresorhus/LaunchAtLogin-Legacy",
licenseName: "MIT license",
licenseUrl: "https://github.com/sindresorhus/LaunchAtLogin-Legacy/blob/main/license"
)

AcknowledgmentsView(
libraryName: "Settings",
libraryUrl: "https://github.com/sindresorhus/Settings",
licenseName: "MIT license",
licenseUrl: "https://github.com/sindresorhus/Settings/blob/main/license"
)

AcknowledgmentsView(
libraryName: "DynamicNotchKit",
libraryUrl: "https://github.com/MrKai77/DynamicNotchKit",
licenseName: "MIT license",
licenseUrl: "https://github.com/MrKai77/DynamicNotchKit/blob/main/LICENSE"
)
}
}
}
}
}

struct AcknowledgmentsView: View {
var libraryName: String
var libraryUrl: String
var licenseName: String
var licenseUrl: String

var body: some View {
HStack {
Image(systemName: "book.pages.fill")
.resizable()
.scaledToFit()
.frame(width: 32, height: 32)

VStack(alignment: .leading, spacing: 2) {
Link(destination: URL(string: libraryUrl)!) {
Text(libraryName)
.font(.headline)
}
.buttonStyle(PressButtonStyle())

Link(destination: URL(string: licenseUrl)!) {
Text(licenseName)
.font(.footnote)
}
.buttonStyle(PressButtonStyle())
}

Spacer()
}
.padding(2.5)
}
}

#Preview {
AboutSettingsView()
}
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct GeneralSettingsView: View {
@State private var showingAlert = false

var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection {
LuminareToggle(
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/KeyboardShortcutSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import KeyboardShortcuts

struct KeyboardShortcutsSettingsView: View {
var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection {
Form {
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/MenuBarSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct MenuBarSettingsView: View {
@Default(.showEqWhenPlayingMusic) private var showEqWhenPlayingMusic

var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection("General") {
HStack {
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/MiniPlayerSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct MiniPlayerSettingsView: View {
@Default(.miniPlayerScaleFactor) private var miniPlayerScaleFactor

var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection {
HStack {
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/NotchSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct NotchSettingsView: View {
@Default(.notchEnabled) var notchEnabled

var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection("") {
LuminareToggle("Enable notch integration", isOn: $notchEnabled)
Expand Down
2 changes: 1 addition & 1 deletion Tuneful/Views/Settings/PopoverSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct PopoverSettingsView: View {
@Default(.popoverBackground) private var popoverBackground

var body: some View {
Settings.Container(contentWidth: 400) {
Settings.Container(contentWidth: Constants.settingsWindowWidth) {
Settings.Section(title: "") {
LuminareSection {
LuminareToggle(
Expand Down

0 comments on commit 71dd7ff

Please sign in to comment.