Skip to content

Commit

Permalink
medialib: enable building with medialib feature, without any compile-…
Browse files Browse the repository at this point in the history
…time flags
  • Loading branch information
Oleksiy-Yakovenko committed Nov 18, 2023
1 parent cedd134 commit ff90b4a
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 635 deletions.
10 changes: 0 additions & 10 deletions osx/deadbeef.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@
2D11D3CD1B9DC6B500C7C731 /* vtx.dylib in Copy Plugins */ = {isa = PBXBuildFile; fileRef = 2D11D3B91B9DC67100C7C731 /* vtx.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2D11E8B21AA0E3DD00A67A20 /* MainWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D11E8AF1AA0E3DD00A67A20 /* MainWindowController.h */; };
2D11E8B31AA0E3DD00A67A20 /* MainWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D11E8B01AA0E3DD00A67A20 /* MainWindowController.m */; };
2D11E8B41AA0E3DD00A67A20 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2D11E8B11AA0E3DD00A67A20 /* MainWindow.xib */; };
2D135EF0226E47AA00BAAE84 /* scriptable.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D135EE8226E38AF00BAAE84 /* scriptable.c */; };
2D135EF1226E47AA00BAAE84 /* scriptable_dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D135EEB226E428C00BAAE84 /* scriptable_dsp.h */; };
2D135EF2226E47AA00BAAE84 /* scriptable_dsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D135EEC226E428C00BAAE84 /* scriptable_dsp.c */; };
Expand Down Expand Up @@ -5344,7 +5343,6 @@
2D11D3C31B9DC69C00C7C731 /* vtxfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vtxfile.c; sourceTree = "<group>"; };
2D11E8AF1AA0E3DD00A67A20 /* MainWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainWindowController.h; sourceTree = "<group>"; };
2D11E8B01AA0E3DD00A67A20 /* MainWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainWindowController.m; sourceTree = "<group>"; };
2D11E8B11AA0E3DD00A67A20 /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
2D135EE7226E38AF00BAAE84 /* scriptable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scriptable.h; sourceTree = "<group>"; };
2D135EE8226E38AF00BAAE84 /* scriptable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scriptable.c; sourceTree = "<group>"; };
2D135EEB226E428C00BAAE84 /* scriptable_dsp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scriptable_dsp.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9787,7 +9785,6 @@
2D49856E1D5CF0E900E4D985 /* Log.xib */,
2DBF3D3F270868D400023138 /* MainContentViewController.xib */,
2D17F8451AB3391A00AF2853 /* MainMenu.xib */,
2D11E8B11AA0E3DD00A67A20 /* MainWindow.xib */,
2D3EBD9C1A9379BD00E5E255 /* Preferences.xib */,
2D1A56391D9FF9A4005E5CDD /* ReplayGain.xib */,
2D651D19227227FA00375AE2 /* ScriptableNodeEditorViewController.xib */,
Expand Down Expand Up @@ -16569,7 +16566,6 @@
2DC657C32746F67600583E14 /* RenameTabViewController.xib in Resources */,
2DB05EB8252E47A00090635E /* iconNetworkTemplate.pdf in Resources */,
2D17F8461AB3391A00AF2853 /* MainMenu.xib in Resources */,
2D11E8B41AA0E3DD00A67A20 /* MainWindow.xib in Resources */,
2D9C0C15238DC0E700CE8C10 /* GroupByCustomWindow.xib in Resources */,
2DBCA69D27944BB600D7432F /* ChangeLog in Resources */,
2DC657FC274A7C4600583E14 /* RenamePlaylistViewController.xib in Resources */,
Expand Down Expand Up @@ -22764,7 +22760,6 @@
GLIB_DISABLE_DEPRECATION_WARNINGS,
GTK_DISABLE_DEPRECATION_WARNINGS,
"DDB_WARN_DEPRECATED=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -22829,7 +22824,6 @@
GLIB_DISABLE_DEPRECATION_WARNINGS,
GTK_DISABLE_DEPRECATION_WARNINGS,
"DDB_WARN_DEPRECATED=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -23091,7 +23085,6 @@
GLIB_DISABLE_DEPRECATION_WARNINGS,
GTK_DISABLE_DEPRECATION_WARNINGS,
"DDB_WARN_DEPRECATED=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -23156,7 +23149,6 @@
GLIB_DISABLE_DEPRECATION_WARNINGS,
GTK_DISABLE_DEPRECATION_WARNINGS,
"DDB_WARN_DEPRECATED=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -23824,7 +23816,6 @@
"DISABLE_MM_KEY_GRABBER=1",
"_DEBUG=1",
"DDB_ENABLE_SCRIPTABLE=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -23884,7 +23875,6 @@
"HAVE_LOG2=1",
"OSX_APPBUNDLE=1",
"DDB_ENABLE_SCRIPTABLE=1",
"ENABLE_MEDIALIB=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
Expand Down
4 changes: 0 additions & 4 deletions plugins/cocoaui/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,8 @@ - (void)awakeFromNib {
}

- (void)initMainWindow {
#if ENABLE_MEDIALIB
_mainWindow = [[MainWindowController alloc] initWithWindowNibName:@"SplitViewMainWindow"];
_mainWindow.mediaLibraryManager = self.mediaLibraryManager;
#else
_mainWindow = [[MainWindowController alloc] initWithWindowNibName:@"MainWindow"];
#endif
_mainWindow.shouldCascadeWindows = NO;
_mainWindow.window.releasedWhenClosed = NO;
_mainWindow.window.excludedFromWindowsMenu = YES;
Expand Down
4 changes: 0 additions & 4 deletions plugins/cocoaui/MainWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@

@protocol WidgetProtocol;

#ifdef ENABLE_MEDIALIB
@class MediaLibraryManager;
#endif

@interface MainWindowController : NSWindowController

Expand All @@ -41,9 +39,7 @@
@property (strong) IBOutlet MainWindowSidebarViewController *sidebarOutlineViewController;
@property (unsafe_unretained) IBOutlet NSSegmentedControl *buttonBar;

#ifdef ENABLE_MEDIALIB
@property (nonatomic) MediaLibraryManager *mediaLibraryManager;
#endif

- (IBAction)seekBarAction:(id)sender;
- (IBAction)volumeBarAction:(id)sender;
Expand Down
20 changes: 0 additions & 20 deletions plugins/cocoaui/MainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
#import "DesignModeState.h"
#import "GuiPreferencesWindowController.h"
#import "MainWindowController.h"
#ifdef ENABLE_MEDIALIB
#import "MediaLibraryManager.h"
#endif
#import "PlaylistWidget.h"
#import "PlaylistWithTabsWidget.h"
#import "PreferencesWindowController.h"
Expand Down Expand Up @@ -121,7 +119,6 @@ - (void)windowDidLoad {
}
#endif

#if ENABLE_MEDIALIB
self.playlistWithTabsView = self.splitViewController.bodyViewController.wrapperView;
self.designableContainerView = self.splitViewController.bodyViewController.designableView;

Expand All @@ -148,19 +145,6 @@ - (void)windowDidLoad {
}
}

#else
self.mainContentViewController = [MainContentViewController new];
[self.designableContainerView addSubview:self.mainContentViewController.view];
[NSLayoutConstraint activateConstraints:@[
[self.designableContainerView.topAnchor constraintEqualToAnchor:self.mainContentViewController.view.topAnchor],
[self.designableContainerView.bottomAnchor constraintEqualToAnchor:self.mainContentViewController.view.bottomAnchor],
[self.designableContainerView.leadingAnchor constraintEqualToAnchor:self.mainContentViewController.view.leadingAnchor],
[self.designableContainerView.trailingAnchor constraintEqualToAnchor:self.mainContentViewController.view.trailingAnchor],
]];

self.designableContainerView = self.mainContentViewController.designableView;
#endif

id<WidgetProtocol> rootWidget = DesignModeState.sharedInstance.rootWidget;
NSView *view = rootWidget.view;
view.translatesAutoresizingMaskIntoConstraints = NO;
Expand Down Expand Up @@ -560,16 +544,13 @@ - (void)deletePlaylistDone:(DeletePlaylistConfirmationController *)controller {
#pragma mark - ScriptableSelectDelegate

- (void)scriptableSelectItemSelected:(scriptableItem_t *)item {
#if ENABLE_MEDIALIB
const char *name = scriptableItemPropertyValueForKey(item, "name");
self.mediaLibraryManager.preset = @(name);
#endif
}

#pragma mark - ScriptableItemDelegate

- (void)scriptableItemDidChange:(scriptableItem_t *)scriptable change:(ScriptableItemChange)change {
#if ENABLE_MEDIALIB
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.tfQuerySelectViewController reloadData];

Expand All @@ -586,7 +567,6 @@ - (void)scriptableItemDidChange:(scriptableItem_t *)scriptable change:(Scriptabl
[self scriptableSelectItemSelected:item];
}
});
#endif
}

@end
2 changes: 0 additions & 2 deletions plugins/cocoaui/Preferences/PreferencesWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ - (void)windowDidLoad {

BOOL enableMedialib = NO;

#if ENABLE_MEDIALIB
enableMedialib = self.mediaLibraryPreferencesViewController.isAvailable;
#endif

if (!enableMedialib) {
[self.toolbar removeItemAtIndex:4];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ - (void)close {
- (void)viewDidLoad {
[super viewDidLoad];

#if ENABLE_MEDIALIB
self.mediaLibraryOutlineViewController = [[MediaLibraryOutlineViewController alloc] initWithOutlineView:self.outlineView searchField:self.searchField];
#endif
}


Expand Down
Loading

0 comments on commit ff90b4a

Please sign in to comment.