From 1d31995aca41f72aeb6d629667b3f246102adcbf Mon Sep 17 00:00:00 2001 From: marcoschmickler Date: Sun, 14 Jun 2026 00:53:14 +0200 Subject: [PATCH] modernize scene --- kplayer/master/MasterSplitView.swift | 131 ++++++++++++++------------- 1 file changed, 70 insertions(+), 61 deletions(-) diff --git a/kplayer/master/MasterSplitView.swift b/kplayer/master/MasterSplitView.swift index 0c9c120..aff490e 100644 --- a/kplayer/master/MasterSplitView.swift +++ b/kplayer/master/MasterSplitView.swift @@ -13,80 +13,89 @@ struct MasterSplitView: View { var body: some View { ZStack { NavigationSplitView { - ZStack { - if model.isTagging { - ScrollView { - LazyVGrid(columns: [GridItem(.adaptive(minimum: 80))]) { - ForEach(model.items) { item in - Text(item.name).font(.system(size: 16)).bold().padding(EdgeInsets(top: 10, leading: 6, bottom: 10, trailing: 6)) - .background( - RoundedRectangle(cornerRadius: 8) - .fill(Color.gray.opacity(0.2)) - ).draggable(item.name) - } - } + Group { + if model.isTagging { + ScrollView { + LazyVGrid(columns: [GridItem(.adaptive(minimum: 80))]) { + ForEach(model.items) { + item in + Text(item.name).font(.system(size: 16)).bold().padding(EdgeInsets(top: 10, leading: 6, bottom: 10, trailing: 6)).background( + RoundedRectangle(cornerRadius: 8).fill(Color.gray.opacity(0.2)) + ).draggable(item.name) } } - else { - List(model.items, selection: $model.selectedItemId) { item in - Text(item.name).font(.title3).bold() - }.id(UUID()) - } - }.toolbar { - ToolbarItem(placement: .navigationBarLeading) { - Button(action: model.back, label: { - Image(systemName: "arrowshape.backward") - }) - } - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: model.tagIt, label: { - Image(systemName: "tag") - }) - } - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: { model.showSettings = true }, label: { - Image(systemName: "slider.horizontal.3") - }) - } - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: completionHandler, label: { - Image(systemName: "xmark.square") - }) - } - } + } + } else { + List(model.items, selection: $model.selectedItemId) { + item in + Text(item.name).font(.title3).bold() + }.id(UUID()) } - detail: { - HStack { - Text(model.selectedItem?.longName() ?? "").font(.title3) - Spacer() - if model.selectedItem != nil { - Button(action: model.overview, label: { - Text("Overview") - }) - } - }.background(Color(UIColor.systemGray6)) - DetailView(model: model) + }.toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button(action: model.back, label: { + Image(systemName: "arrowshape.backward") + }) + } + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: model.tagIt, label: { + Image(systemName: "tag") + }) + } + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: { + model.showSettings = true + }, label: { + Image(systemName: "slider.horizontal.3") + }) + } + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: completionHandler, label: { + Image(systemName: "xmark.square") + }) } + } + } + detail: { + HStack { + Text(model.selectedItem?.longName() ?? "").font(.title3) + Spacer() + if model.selectedItem != nil { + Button(action: model.overview, label: { + Text("Overview") + }) + } + }.background(Color(UIColor.systemGray6)) + DetailView(model: model) + } - if model.showWeb { - KBrowserView(item: model.selectedDetail!.name, completionHandler: { model.showWeb = false }).background(.black) + if model.showWeb, let selectedDetail = model.selectedDetail { + KBrowserView(item: selectedDetail.name, completionHandler: { + model.showWeb = false + }).background(.black) } if model.showVideo { SVideoPlayer(completionHandler: model.saveVideo, model: model.videoModel).background(.black) } if model.showPhoto { - SPhotoAlbumView(completionHandler: { saved in + SPhotoAlbumView(completionHandler: { + saved in model.showPhoto = false }, model: model.photoModel).background(.black) } - }.sheet(isPresented: $model.showFilePicker, onDismiss: { model.showFilePicker = false}) { - DocPickerViewController(callback: model.pickURL, onDismiss: { model.showFilePicker = false }) - } - .sheet(isPresented: $model.showSettings, onDismiss: { model.showSettings = false}) { - KSettingsView(kSettings: LocalManager.sharedInstance.settings, completionHandler: { + }.sheet(isPresented: $model.showFilePicker, onDismiss: { + model.showFilePicker = false + }) { + DocPickerViewController(callback: model.pickURL, onDismiss: { + model.showFilePicker = false + }) + }.sheet(isPresented: $model.showSettings, onDismiss: { model.showSettings = false - } ) - } + }) { + KSettingsView(kSettings: LocalManager.sharedInstance.settings, completionHandler: { + model.showSettings = false + }) + } } -} \ No newline at end of file +}