Skip to content
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
2 changes: 2 additions & 0 deletions ArkServer/App/Models/NavigationSelection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ enum NavigationSelection: Hashable {
case sceneExtraction
/// 曲に合わせてライブラリの動画を自動で編集する画面。
case musicVideo
/// 詳細設定のページ。設定中は左のサイドバーが項目の一覧に切り替わる。
case settings(SettingsPane)
/// 動画・画像のアルバムを表紙つきで一覧するページ。
case albums
case album(UUID)
Expand Down
19 changes: 18 additions & 1 deletion ArkServer/App/ViewModels/AppViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Foundation
@MainActor
final class AppViewModel: ObservableObject {
@Published var selection: NavigationSelection? = .home
@Published var isShowingPreferences = false
@Published var isShowingStorageManager = false
@Published var isShowingAccessLog = false
@Published var sceneExtractionNavigationError: String?
Expand All @@ -35,6 +34,7 @@ final class AppViewModel: ObservableObject {

private var cancellables = Set<AnyCancellable>()
private var sceneExtractionReturnSelection: NavigationSelection = .home
private var settingsRouting = SettingsRouting()

convenience init() {
self.init(
Expand Down Expand Up @@ -76,6 +76,23 @@ final class AppViewModel: ObservableObject {
bridgeFavorites()
}

// MARK: - 詳細設定ページ

/// 詳細設定のページを開きます.元の画面は覚えておき,`closeSettings()` で戻します.
func openSettings(_ pane: SettingsPane = .connection) {
selection = settingsRouting.opening(from: selection, pane: pane)
}

/// 詳細設定を閉じて,開く前の画面へ戻します.
func closeSettings() {
selection = settingsRouting.closing()
}

/// レールの歯車用.設定中なら戻り,そうでなければ開きます.
func toggleSettings() {
if SettingsRouting.isSettings(selection) { closeSettings() } else { openSettings() }
}

/// ライブラリ内の動画を解析画面へ渡します.
func openSceneExtraction(for item: VideoItem) {
guard item.mediaType == .video else {
Expand Down
87 changes: 52 additions & 35 deletions ArkServer/App/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct ContentView: View {
// ライブラリ画面を出しっぱなしにすることではない。
if shouldShowLibraryView {
// デスクトップが透けるガラス地はやめ、単色の下地にする(色の濁りと環境による見た目の差をなくす)。
NeomorphicTheme.canvas
NeomorphicTheme.rail
.id(appSettings.neomorphicDarkBase)
.ignoresSafeArea()
} else {
Expand Down Expand Up @@ -72,12 +72,10 @@ struct ContentView: View {
// ウィンドウのクロム設定はライブラリ画面の有無に関わらず効かせる必要があるため、
// ライブラリ画面ではなくこの常駐の階層に付ける。
.toolbar(isToolbarHidden ? .hidden : .automatic, for: .windowToolbar)
// タイトルバーの帯はサイドバーと同じ色にし、窓の上端でサイドバーと一続きに見せる。
.toolbarBackground(NeomorphicTheme.sidebar, for: .windowToolbar)
.toolbarBackground(
isToolbarHidden ? .hidden : .visible,
for: .windowToolbar
)
// タイトルバーの帯は、左のレールと同じ「窓の枠」の色にして内側のパネルをくぼませて見せる。
// 帯の色は、ツールバーの背景として描かず、窓の背景色(WindowChromeConfigurator で枠の色にしてある)に任せる。
// ツールバーの背景を出すと、検索欄などのあるライブラリ画面で、帯がパネルの中(見出しの背後)まで広がってしまう。
.toolbarBackground(.hidden, for: .windowToolbar)
.background(
WindowChromeConfigurator(isToolbarHidden: isToolbarHidden)
)
Expand All @@ -92,13 +90,6 @@ struct ContentView: View {
\.appMenuContext,
dataManager.isStorageReady ? appMenuContext : nil
)
.sheet(isPresented: $viewModel.isShowingPreferences) {
PreferencesView(
dataManager: dataManager,
webServerManager: viewModel.webServerManager,
appSettings: appSettings
)
}
.sheet(isPresented: $viewModel.isShowingStorageManager) {
StorageManagerView(dataManager: dataManager)
}
Expand Down Expand Up @@ -133,6 +124,24 @@ struct ContentView: View {
}
}

/// 左のサイドバー。設定のページでは、アルバムの一覧の代わりに設定の項目の一覧を出す。
@ViewBuilder
private var sidebarColumn: some View {
if case .settings(let pane) = viewModel.selection {
SettingsSidebarView(
selected: pane,
onSelect: { viewModel.openSettings($0) },
onBack: { viewModel.closeSettings() }
)
} else {
MainSidebarView(
dataManager: dataManager,
webServerManager: viewModel.webServerManager,
selection: $viewModel.selection
)
}
}

/// ミニプレイヤー表示中は通常再生の裏でライブラリも操作できるようにする。
private var shouldShowLibraryView: Bool {
guard let mode = playbackCoordinator.mode else { return true }
Expand Down Expand Up @@ -234,8 +243,8 @@ struct ContentView: View {

private var libraryView: some View {
ZStack {
// ツールバーの背後まで同じ背景を広げ,フルスクリーン時の色の段差をなくす。
CommandDeckBackground()
// ツールバーの背後まで同じ背景(窓の枠の色)を広げ,フルスクリーン時の色の段差をなくす。
NeomorphicTheme.rail.ignoresSafeArea()

// 標準の NavigationSplitView は macOS 26 でサイドバーが「浮いた角丸のガラス」になり、
// 窓の端や上下に余白ができて平らにできない。そこで左カラムを自前で組み、窓の端から端まで
Expand All @@ -249,29 +258,21 @@ struct ContentView: View {
allVideosAlbumID: dataManager.albums.first { $0.name == LibraryViewModel.allVideosAlbumName }?.id,
allPhotosAlbumID: dataManager.albums.first { $0.name == LibraryViewModel.allPhotosAlbumName }?.id,
onShowStorage: { viewModel.isShowingStorageManager = true },
onShowPreferences: { viewModel.isShowingPreferences = true }
onShowPreferences: { viewModel.toggleSettings() }
)
.background(NeomorphicTheme.rail.ignoresSafeArea())
.overlay(alignment: .trailing) {
Rectangle()
.fill(NeomorphicTheme.separator)
.frame(width: 0.5)
.ignoresSafeArea()
}

// サイドバーと内容は、窓の枠の内側にはめ込んだ1枚の角丸パネルにする。
HStack(spacing: 0) {
if isSidebarVisible {
MainSidebarView(
dataManager: dataManager,
webServerManager: viewModel.webServerManager,
selection: $viewModel.selection
)
sidebarColumn
.frame(width: sidebarWidth)
.frame(maxHeight: .infinity)
.background(NeomorphicTheme.sidebar.ignoresSafeArea())
.overlay(alignment: .trailing) {
Rectangle()
.fill(NeomorphicTheme.separator)
.frame(width: 0.5)
.frame(width: 1)
.ignoresSafeArea()
}
.transition(.move(edge: .leading))
Expand Down Expand Up @@ -351,6 +352,14 @@ struct ContentView: View {
onAnalyzeScenes: viewModel.openSceneExtraction
)
.navigationTitle(path.components(separatedBy: "/").last ?? path)
case .settings(let pane):
SettingsPageView(
pane: pane,
dataManager: dataManager,
webServerManager: viewModel.webServerManager,
appSettings: appSettings
)
.navigationTitle("設定")
case .none:
ContentUnavailableView("サイドバーから項目を選択してください", systemImage: "sidebar.left")
}
Expand All @@ -363,10 +372,18 @@ struct ContentView: View {
.toolbar(removing: .title)
// タイトルを外すと、右寄せだった各画面のボタンが左へ詰まるので、中央に伸びる空きを置いて右側に戻す。
.toolbar { principalSpacer }
// 標準の分割表示が確保していたツールバーの下の余白を、自前の構成でも同じだけ空ける。
.safeAreaInset(edge: .top, spacing: 0) {
Color.clear.frame(height: 44)
}
// パネルの上端は、ツールバー(タイトルバーの帯)の下から始める。右と下には枠の色を少し残す。
// 下地を持たない画面(ライブラリの一覧など)でも、窓の枠の色が透けないよう、内容の下地はパネルが持つ。
.background(NeomorphicTheme.canvas)
.clipShape(RoundedRectangle(cornerRadius: DS.cardCornerRadius, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: DS.cardCornerRadius, style: .continuous)
.strokeBorder(NeomorphicTheme.cardBorder, lineWidth: 1)
)
.padding(.top, 44)
.padding(.trailing, 8)
.padding(.bottom, 8)
}
.toolbar {
ToolbarItem(placement: .primaryAction) {
Expand Down Expand Up @@ -417,7 +434,7 @@ struct ContentView: View {
isPresentingPlayer: playbackCoordinator.isPresenting,
canToggleMiniPlayer: isSingleVideoPlayback,
isMiniPlayerActive: playbackCoordinator.isMiniPlayerActive,
showPreferences: { viewModel.isShowingPreferences = true },
showPreferences: { viewModel.openSettings() },
showStorageManager: { viewModel.isShowingStorageManager = true },
showAccessLog: { viewModel.isShowingAccessLog = true },
showHome: { viewModel.selection = .home },
Expand Down Expand Up @@ -490,7 +507,7 @@ private struct LibraryStorageInitializationErrorView: View {

VStack(spacing: 8) {
Text("ライブラリ保存先を準備できませんでした")
.font(.appTitle.bold())
.font(.appTitle)
Text("データを保護するため,ライブラリの読み込みとサーバー起動を停止しています.")
.foregroundStyle(.secondary)
.multilineTextAlignment(.center)
Expand Down Expand Up @@ -530,7 +547,7 @@ private struct LibraryStorageInitializationErrorView: View {
private func errorRow(title: String, value: String) -> some View {
VStack(alignment: .leading, spacing: 4) {
Text(title)
.font(.appCaption.weight(.semibold))
.font(.appCaptionStrong)
.foregroundStyle(.secondary)
Text(value)
.textSelection(.enabled)
Expand Down
2 changes: 1 addition & 1 deletion ArkServer/App/Views/WindowChromeConfigurator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class WindowChromeView: NSView {
)
// 下地は単色なので、透過ウィンドウにはしない(角の表示も安定する)。
window.isOpaque = true
window.backgroundColor = NSColor(NeomorphicTheme.canvas)
window.backgroundColor = NSColor(NeomorphicTheme.rail)
window.toolbarStyle = .unifiedCompact
window.toolbar?.isVisible = !isToolbarHidden
}
Expand Down
Loading
Loading