Skip to content

Commit

Permalink
dev: Add onMappingFinished callback for macos.
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmin42 committed Jan 17, 2025
1 parent fcebcaf commit 624d27c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions osx/PhotoBook/PhotoBook/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,9 @@ struct DashboardView: View, PhotobookUIListener {
navigationPath.append("Table")
}
}

func onMappingFinished(root: String)
{

}
}
6 changes: 6 additions & 0 deletions osx/PhotoBook/PhotoBook/PhotoBookApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ private var photobookUIListener: [PhotobookUIListener] = [];
{
photobookUIListener.last?.onMetadataUpdated(focusedName:focusedName)
}

func onMappingFinished(_ root: String)
{
photobookUIListener.last?.onMappingFinished(root: root)
}
}

@objc extension NoirListenerWrapperCLevel
Expand Down Expand Up @@ -84,6 +89,7 @@ struct PhotoBookApp: App, PhotobookUIListener, NoirUIListener {
// TODO: We don't need PhotobookUIListener here
func onProjectRead() {}
func onMetadataUpdated(focusedName: String) {}
func onMappingFinished(root: String) {}
func onNoirLutAdded() {}
func onNoirError() {}

Expand Down
1 change: 1 addition & 0 deletions osx/PhotoBook/PhotoBook/Photobook.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@interface PhotobookListenerWrapperCLevel: NSObject
- (void)onProjectRead;
- (void)onMetadataUpdated:(NSString*)focusedName;
- (void)onMappingFinished:(NSString*)root;
@end

@interface NoirListenerWrapperCLevel: NSObject
Expand Down
10 changes: 8 additions & 2 deletions osx/PhotoBook/PhotoBook/Photobook.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ void onExportFinished() override {}
void onError(PBDev::Error) override {}
void onStagedImageRemoved(std::vector<unsigned> removedIndexes) override {}
void onMappingStarted(Path path) override {}
void onMappingFinished(Path path) override {}
void onMappingFinished(Path path) override {
NSString* managedRoot = [NSString stringWithUTF8String:path.string().c_str()];
[&mManagedListener onMappingFinished:managedRoot];
}
void onMappingAborted(Path path) override {}
void onCollageThumbnailsCreated() override {}
void onImageUpdated(Path root, int row, int index) override {}
Expand Down Expand Up @@ -174,7 +177,10 @@ - (ProjectManagementServiceWrapper*) projectManagementService

- (void) addImportFolder:(NSString*)root
{
std::string nativeRoot = [root UTF8String];
NSURL *url = [NSURL URLWithString:root];
NSString *filePath = [url path];

std::string nativeRoot = [filePath UTF8String];
mPhotobook->addImportFolder(nativeRoot);
}

Expand Down
1 change: 1 addition & 0 deletions osx/PhotoBook/PhotoBook/PhotobookUIListener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ protocol PhotobookUIListener
{
func onProjectRead()
func onMetadataUpdated(focusedName: String)
func onMappingFinished(root: String)
}
4 changes: 4 additions & 0 deletions osx/PhotoBook/PhotoBook/TableContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,5 +268,9 @@ struct TableContentView: View, PhotobookUIListener {

func onProjectRead(){}
func onMetadataUpdated(focusedName: String){}

func onMappingFinished(root: String){

}
}

0 comments on commit 624d27c

Please sign in to comment.