Skip to content

Commit

Permalink
Fix view sizes (#916)
Browse files Browse the repository at this point in the history
* Fix view sizes

* Flatten the nested enum

* Remove unused function

* Remove extension
  • Loading branch information
zorikon committed Apr 12, 2024
1 parent fc7dda9 commit b00c437
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Whisky.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
6365C4C12B1AA69D00AAE1FD /* Animation+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6365C4C02B1AA69D00AAE1FD /* Animation+Extensions.swift */; };
6365C4C32B1AA8CD00AAE1FD /* BottleListEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6365C4C22B1AA8CD00AAE1FD /* BottleListEntry.swift */; };
63FFDE862ADF0C7700178665 /* BottomBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63FFDE852ADF0C7700178665 /* BottomBar.swift */; };
6763D8F62BC6314100651D27 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6763D8F52BC6314100651D27 /* Constants.swift */; };
67D278512BC5907E006F9A1E /* ActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D278502BC5907E006F9A1E /* ActionView.swift */; };
6E064B1229DD32A200D9A2D2 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 6E064B1129DD32A200D9A2D2 /* Sparkle */; };
6E064B1429DD331F00D9A2D2 /* SparkleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E064B1329DD331F00D9A2D2 /* SparkleView.swift */; };
Expand Down Expand Up @@ -113,6 +114,7 @@
6365C4C02B1AA69D00AAE1FD /* Animation+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Animation+Extensions.swift"; sourceTree = "<group>"; };
6365C4C22B1AA8CD00AAE1FD /* BottleListEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottleListEntry.swift; sourceTree = "<group>"; };
63FFDE852ADF0C7700178665 /* BottomBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomBar.swift; sourceTree = "<group>"; };
6763D8F52BC6314100651D27 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
67D278502BC5907E006F9A1E /* ActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionView.swift; sourceTree = "<group>"; };
6E064B1329DD331F00D9A2D2 /* SparkleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SparkleView.swift; sourceTree = "<group>"; };
6E17B6452AF3FDC100831173 /* PinView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -347,6 +349,7 @@
6E621CEE2A5F631200C9AAB3 /* Winetricks.swift */,
6E70A4A02A9A280C007799E9 /* WhiskyCmd.swift */,
6E7C07BD2AAE7B0100F6E66B /* ProgramShortcut.swift */,
6763D8F52BC6314100651D27 /* Constants.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -583,6 +586,7 @@
buildActionMask = 2147483647;
files = (
EEA5A2462A31DD65008274AE /* AppDelegate.swift in Sources */,
6763D8F62BC6314100651D27 /* Constants.swift in Sources */,
6E70A4A12A9A280C007799E9 /* WhiskyCmd.swift in Sources */,
6E40495829CCA19C006E3F1B /* ContentView.swift in Sources */,
67D278512BC5907E006F9A1E /* ActionView.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions Whisky/Utils/Constants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Constants.swift
// Whisky
//
// This file is part of Whisky.
//
// Whisky is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Whisky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with Whisky.
// If not, see https://www.gnu.org/licenses/.
//

import Foundation

enum ViewWidth {
static let small: Double = 400
static let medium: Double = 500
static let large: Double = 600
}
3 changes: 2 additions & 1 deletion Whisky/Views/Bottle/BottleCreationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ struct BottleCreationView: View {
submit()
}
}
.frame(minWidth: 400, minHeight: 210)
.fixedSize(horizontal: false, vertical: true)
.frame(width: ViewWidth.small)
}

func submit() {
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/ConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ struct DPIConfigSheetView: View {
}
}
.padding()
.frame(width: 500, height: 240)
.frame(width: ViewWidth.medium, height: 240)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/Pins/PinCreationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct PinCreationView: View {
}
}
.fixedSize(horizontal: false, vertical: true)
.frame(minWidth: 400)
.frame(minWidth: ViewWidth.small)
}

func submit() {
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/WinetricksView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ struct WinetricksView: View {
winetricks = await Winetricks.parseVerbs()
}
}
.frame(minWidth: 600, minHeight: 400)
.frame(minWidth: ViewWidth.large, minHeight: 400)
}
}
3 changes: 2 additions & 1 deletion Whisky/Views/Common/RenameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ struct RenameView: View {
submit()
}
}
.frame(minWidth: 350, minHeight: 115)
.fixedSize(horizontal: false, vertical: true)
.frame(minWidth: ViewWidth.small)
}

var isNameValid: Bool {
Expand Down
3 changes: 2 additions & 1 deletion Whisky/Views/FileOpenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ struct FileOpenView: View {
}
}
}
.frame(minWidth: 400, minHeight: 115)
.fixedSize(horizontal: false, vertical: true)
.frame(width: ViewWidth.small)
.onAppear {
// Makes sure there are more than 0 bottles.
// Otherwise, it will crash on the nil cascade
Expand Down
3 changes: 2 additions & 1 deletion Whisky/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ struct SettingsView: View {
}
}
.formStyle(.grouped)
.frame(width: 500, height: 250)
.fixedSize(horizontal: false, vertical: true)
.frame(width: ViewWidth.medium)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/WhiskyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct WhiskyApp: App {
var body: some Scene {
WindowGroup {
ContentView(showSetup: $showSetup)
.frame(minWidth: 550, minHeight: 250)
.frame(minWidth: ViewWidth.large, minHeight: 316)
.environmentObject(BottleVM.shared)
.onAppear {
NSWindow.allowsAutomaticWindowTabbing = false
Expand Down

0 comments on commit b00c437

Please sign in to comment.