Skip to content

Commit 69801aa

Browse files
cocoaui: impl album art display modes -- Selected, Playing, Playing Or Selected.
1 parent ddc3b0f commit 69801aa

File tree

6 files changed

+432
-197
lines changed

6 files changed

+432
-197
lines changed

osx/deadbeef.xcodeproj/project.pbxproj

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,10 @@
24892489
2DD0628D2EC08647006F3223 /* fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DD0619B2EC08209006F3223 /* fixed.c */; };
24902490
2DD0628E2EC08647006F3223 /* fixed_intrin_avx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DD0619C2EC08209006F3223 /* fixed_intrin_avx2.c */; };
24912491
2DD0628F2EC08647006F3223 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DD061AD2EC08209006F3223 /* memory.c */; };
2492+
2DD062B02EC0B94F006F3223 /* AlbumArtWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD062AE2EC0B94F006F3223 /* AlbumArtWidget.h */; };
2493+
2DD062B12EC0B94F006F3223 /* AlbumArtWidget.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DD062AF2EC0B94F006F3223 /* AlbumArtWidget.m */; };
2494+
2DD062B52EC0B995006F3223 /* AlbumArtWidgetViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD062B32EC0B995006F3223 /* AlbumArtWidgetViewController.h */; };
2495+
2DD062B62EC0B995006F3223 /* AlbumArtWidgetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DD062B42EC0B995006F3223 /* AlbumArtWidgetViewController.m */; };
24922496
2DD376F92739B5FF007AD315 /* libavcodec.58.134.100.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD376F12739B5B7007AD315 /* libavcodec.58.134.100.dylib */; };
24932497
2DD376FA2739B601007AD315 /* libavformat.58.76.100.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD376F02739B5B7007AD315 /* libavformat.58.76.100.dylib */; };
24942498
2DD376FB2739B603007AD315 /* libavutil.56.70.100.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD376F22739B5B8007AD315 /* libavutil.56.70.100.dylib */; };
@@ -2657,9 +2661,6 @@
26572661
2DE3B8902269F6BA00AFF9AE /* pltbrowser.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE3B87E2269F6B900AFF9AE /* pltbrowser.c */; };
26582662
2DE3B8932269F6BA00AFF9AE /* support.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE3B88C2269F6B900AFF9AE /* support.h */; };
26592663
2DE3B8962269F6D900AFF9AE /* pltbrowser_gtk3.dylib in Copy Plugins */ = {isa = PBXBuildFile; fileRef = 2DE3B8742269F68B00AFF9AE /* pltbrowser_gtk3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2660-
2DE5562726075B8400285BF9 /* AlbumArtWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE5562526075B8400285BF9 /* AlbumArtWidget.h */; };
2661-
2DE5562826075B8400285BF9 /* AlbumArtWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE5562526075B8400285BF9 /* AlbumArtWidget.h */; };
2662-
2DE5562926075B8400285BF9 /* AlbumArtWidget.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5562626075B8400285BF9 /* AlbumArtWidget.m */; };
26632664
2DE55ACE26C5A47F008F33FF /* medialibmanager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE55ACC26C5A47F008F33FF /* medialibmanager.h */; };
26642665
2DE55ADF26C5A580008F33FF /* medialibmanager.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE55ACD26C5A47F008F33FF /* medialibmanager.c */; };
26652666
2DE77484275E89DF00890350 /* support.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE7747C275E89DD00890350 /* support.h */; };
@@ -7122,6 +7123,10 @@
71227123
2DD062022EC083ED006F3223 /* ordinals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ordinals.h; sourceTree = "<group>"; };
71237124
2DD062032EC083ED006F3223 /* stream_decoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_decoder.h; sourceTree = "<group>"; };
71247125
2DD062042EC083ED006F3223 /* stream_encoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_encoder.h; sourceTree = "<group>"; };
7126+
2DD062AE2EC0B94F006F3223 /* AlbumArtWidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlbumArtWidget.h; sourceTree = "<group>"; };
7127+
2DD062AF2EC0B94F006F3223 /* AlbumArtWidget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AlbumArtWidget.m; sourceTree = "<group>"; };
7128+
2DD062B32EC0B995006F3223 /* AlbumArtWidgetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlbumArtWidgetViewController.h; sourceTree = "<group>"; };
7129+
2DD062B42EC0B995006F3223 /* AlbumArtWidgetViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AlbumArtWidgetViewController.m; sourceTree = "<group>"; };
71257130
2DD376F02739B5B7007AD315 /* libavformat.58.76.100.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.58.76.100.dylib; path = deps/ffmpeg/lib/libavformat.58.76.100.dylib; sourceTree = "<group>"; };
71267131
2DD376F12739B5B7007AD315 /* libavcodec.58.134.100.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.58.134.100.dylib; path = deps/ffmpeg/lib/libavcodec.58.134.100.dylib; sourceTree = "<group>"; };
71277132
2DD376F22739B5B8007AD315 /* libavutil.56.70.100.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.56.70.100.dylib; path = deps/ffmpeg/lib/libavutil.56.70.100.dylib; sourceTree = "<group>"; };
@@ -7276,8 +7281,6 @@
72767281
2DE3B87D2269F6B900AFF9AE /* support.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = support.c; sourceTree = "<group>"; };
72777282
2DE3B87E2269F6B900AFF9AE /* pltbrowser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pltbrowser.c; sourceTree = "<group>"; };
72787283
2DE3B88C2269F6B900AFF9AE /* support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = support.h; sourceTree = "<group>"; };
7279-
2DE5562526075B8400285BF9 /* AlbumArtWidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlbumArtWidget.h; sourceTree = "<group>"; };
7280-
2DE5562626075B8400285BF9 /* AlbumArtWidget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AlbumArtWidget.m; sourceTree = "<group>"; };
72817284
2DE55ACC26C5A47F008F33FF /* medialibmanager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = medialibmanager.h; sourceTree = "<group>"; };
72827285
2DE55ACD26C5A47F008F33FF /* medialibmanager.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = medialibmanager.c; sourceTree = "<group>"; };
72837286
2DE77467275E893400890350 /* converter_gtk3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = converter_gtk3.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -12578,6 +12581,17 @@
1257812581
path = "osx/deps/flac-1.5.0/include";
1257912582
sourceTree = "<group>";
1258012583
};
12584+
2DD062AD2EC0B926006F3223 /* AlbumArt */ = {
12585+
isa = PBXGroup;
12586+
children = (
12587+
2DD062AE2EC0B94F006F3223 /* AlbumArtWidget.h */,
12588+
2DD062AF2EC0B94F006F3223 /* AlbumArtWidget.m */,
12589+
2DD062B32EC0B995006F3223 /* AlbumArtWidgetViewController.h */,
12590+
2DD062B42EC0B995006F3223 /* AlbumArtWidgetViewController.m */,
12591+
);
12592+
path = AlbumArt;
12593+
sourceTree = "<group>";
12594+
};
1258112595
2DD3774C27412C53007AD315 /* Preferences */ = {
1258212596
isa = PBXGroup;
1258312597
children = (
@@ -12786,12 +12800,11 @@
1278612800
2DE5562426075B4200285BF9 /* Widgets */ = {
1278712801
isa = PBXGroup;
1278812802
children = (
12803+
2DD062AD2EC0B926006F3223 /* AlbumArt */,
1278912804
2DC6C5F4294CE11B00A63CEB /* ChiptuneVoices */,
1279012805
2DC65820274AB03700583E14 /* Lyrics */,
1279112806
2DC657E6274A603A00583E14 /* PlaylistBrowser */,
1279212807
2DC657D0274957FE00583E14 /* Tabs */,
12793-
2DE5562526075B8400285BF9 /* AlbumArtWidget.h */,
12794-
2DE5562626075B8400285BF9 /* AlbumArtWidget.m */,
1279512808
2DC6583B274C361C00583E14 /* HolderWidget.h */,
1279612809
2DC6583C274C361C00583E14 /* HolderWidget.m */,
1279712810
2DE1D3E419B11539009B5BC6 /* PlaceholderWidget.h */,
@@ -13863,7 +13876,6 @@
1386313876
2D25569D2E47680D00DA3757 /* scriptable_encoder.h in Headers */,
1386413877
2DC65808274A876300583E14 /* DeletePlaylistConfirmationController.h in Headers */,
1386513878
2D98B68C272D573700E655AE /* ScopeSettings.h in Headers */,
13866-
2DE5562826075B8400285BF9 /* AlbumArtWidget.h in Headers */,
1386713879
2D0212FC2DA0793600BAEA12 /* actionhandlers.h in Headers */,
1386813880
2D9EBAAC25E44A0700255592 /* WidgetSerializer.h in Headers */,
1386913881
2DC657F9274A7C4600583E14 /* RenamePlaylistViewController.h in Headers */,
@@ -15209,6 +15221,7 @@
1520915221
2DF55C3F2270FCB9002C44DC /* ScriptableNodeEditorViewController.h in Headers */,
1521015222
2DDBA26423E5F14A00051320 /* PlaylistHeaderView.h in Headers */,
1521115223
2DC657CC2749544000583E14 /* PlaylistWithTabsWidget.h in Headers */,
15224+
2DD062B52EC0B995006F3223 /* AlbumArtWidgetViewController.h in Headers */,
1521215225
2DDBA26023E5EA3800051320 /* PlaylistLocalDragDropHolder.h in Headers */,
1521315226
2D8E9C1B19ED5F7400EE1408 /* deadbeef.h in Headers */,
1521415227
2DA273782406ED4100FB9BE1 /* GuiPreferencesWindowController.h in Headers */,
@@ -15222,7 +15235,6 @@
1522215235
4D62C0C81E4C9ACA005F9482 /* streamreader.h in Headers */,
1522315236
2DD3774A27404E11007AD315 /* VisualizationSettingsUtil.h in Headers */,
1522415237
2D9EBAAB25E44A0700255592 /* WidgetSerializer.h in Headers */,
15225-
2DE5562726075B8400285BF9 /* AlbumArtWidget.h in Headers */,
1522615238
2DBC62D624CCDEFC00AA20BF /* SpectrumAnalyzerVisualizationViewController.h in Headers */,
1522715239
0D568528271DC35E0026F700 /* ScopeWidget.h in Headers */,
1522815240
2DC657F1274A7A6900583E14 /* PlaylistContextMenu.h in Headers */,
@@ -15250,6 +15262,7 @@
1525015262
2DD6D0A519AE609F009308A5 /* DdbSeekBar.h in Headers */,
1525115263
2D208EB02CE8D5FA002E4892 /* MetalBufferLoop.h in Headers */,
1525215264
2DB1641A24FAB13400034E11 /* MediaLibraryManager.h in Headers */,
15265+
2DD062B02EC0B94F006F3223 /* AlbumArtWidget.h in Headers */,
1525315266
2D30D0B425E2A5DD0023A299 /* DesignModeState.h in Headers */,
1525415267
2DA2A0EE1BE7FE4700601670 /* u8_uc_map.h in Headers */,
1525515268
2D651D17227227C300375AE2 /* ScriptableNodeEditorWindowController.h in Headers */,
@@ -19022,7 +19035,6 @@
1902219035
2D7C1FAE2946001B00163538 /* ShaderRenderer.m in Sources */,
1902319036
2D61723219B7A1BE008D4A26 /* DdbTabStrip.m in Sources */,
1902419037
2DC657A92746D9E400583E14 /* TabsWidget.m in Sources */,
19025-
2DE5562926075B8400285BF9 /* AlbumArtWidget.m in Sources */,
1902619038
2DB52F7D24CF7CF20046D516 /* TrackContextMenu.m in Sources */,
1902719039
2DDD7ABD25E1831000FA6FE5 /* PlaylistDataModel.m in Sources */,
1902819040
2DDD796525E15ED200FA6FE5 /* PlaylistWidget.m in Sources */,
@@ -19088,6 +19100,7 @@
1908819100
2DA30B8023F1C9A3003D22E3 /* PropertySheetContentView.m in Sources */,
1908919101
2D98613F226C814100BAACB1 /* PropertySheetViewController.m in Sources */,
1909019102
2DC65829274AB03800583E14 /* LyricsWidget.m in Sources */,
19103+
2DD062B12EC0B94F006F3223 /* AlbumArtWidget.m in Sources */,
1909119104
2DC657F3274A7A6900583E14 /* PlaylistContextMenu.m in Sources */,
1909219105
2DD3775227412EDA007AD315 /* SpectrumAnalyzerPreferencesViewController.m in Sources */,
1909319106
2DA30E7A2403292D001BAB8A /* PlaybackPreferencesViewController.m in Sources */,
@@ -19151,6 +19164,7 @@
1915119164
2D9EF3142B6FB0800042F6D8 /* KeyboardShortcutManager.m in Sources */,
1915219165
2D9EBAAD25E44A0700255592 /* WidgetSerializer.m in Sources */,
1915319166
2D92F37D2B6D226F00BD07E8 /* UndoIntegration.m in Sources */,
19167+
2DD062B62EC0B995006F3223 /* AlbumArtWidgetViewController.m in Sources */,
1915419168
2D92D32129B92F9100218F1D /* pluginsettings.c in Sources */,
1915519169
);
1915619170
runOnlyForDeploymentPostprocessing = 0;

plugins/cocoaui/DesignMode/Widgets/AlbumArtWidget.h renamed to plugins/cocoaui/DesignMode/Widgets/AlbumArt/AlbumArtWidget.h

File renamed without changes.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// AlbumArtWidget.m
3+
// deadbeef
4+
//
5+
// Created by Oleksiy Yakovenko on 21/03/2021.
6+
// Copyright © 2021 Oleksiy Yakovenko. All rights reserved.
7+
//
8+
9+
#import "AlbumArtWidget.h"
10+
#import "AlbumArtWidgetViewController.h"
11+
#include <deadbeef/deadbeef.h>
12+
13+
@interface AlbumArtWidget() <AlbumArtWidgetViewControllerDelegate>
14+
15+
@property (nonatomic,weak) id<DesignModeDepsProtocol> deps;
16+
@property (nonatomic) AlbumArtWidgetViewController *viewController;
17+
18+
@end
19+
20+
@implementation AlbumArtWidget
21+
22+
+ (NSString *)widgetType {
23+
return @"AlbumArt";
24+
}
25+
26+
- (instancetype)initWithDeps:(id<DesignModeDepsProtocol>)deps {
27+
self = [super initWithDeps:deps];
28+
if (self == nil) {
29+
return nil;
30+
}
31+
32+
self.deps = deps;
33+
34+
self.viewController = [AlbumArtWidgetViewController new];
35+
[self.topLevelView addSubview:self.viewController.view];
36+
37+
self.viewController.view.translatesAutoresizingMaskIntoConstraints = NO;
38+
[self.viewController.view.leadingAnchor constraintEqualToAnchor:self.topLevelView.leadingAnchor].active = YES;
39+
[self.viewController.view.trailingAnchor constraintEqualToAnchor:self.topLevelView.trailingAnchor].active = YES;
40+
[self.viewController.view.topAnchor constraintEqualToAnchor:self.topLevelView.topAnchor].active = YES;
41+
[self.viewController.view.bottomAnchor constraintEqualToAnchor:self.topLevelView.bottomAnchor].active = YES;
42+
43+
self.viewController.delegate = self;
44+
45+
return self;
46+
}
47+
48+
- (void)message:(uint32_t)_id ctx:(uintptr_t)ctx p1:(uint32_t)p1 p2:(uint32_t)p2 {
49+
switch (_id) {
50+
case DB_EV_PLAYLISTSWITCHED:
51+
case DB_EV_CURSOR_MOVED:
52+
[self.viewController refresh];
53+
break;
54+
}
55+
}
56+
- (nullable NSDictionary *)serializedSettingsDictionary {
57+
NSMutableDictionary *settings = [NSMutableDictionary new];
58+
59+
switch (self.viewController.displayMode) {
60+
case albumArtDisplayModeSelected:
61+
settings[@"displayMode"] = @"selected";
62+
break;
63+
case albumArtDisplayModePlaying:
64+
settings[@"displayMode"] = @"playing";
65+
break;
66+
case albumArtDisplayModePlayingOrSelected:
67+
settings[@"displayMode"] = @"playingOrSelected";
68+
break;
69+
}
70+
71+
return settings;
72+
}
73+
74+
- (BOOL)deserializeFromSettingsDictionary:(nullable NSDictionary *)dictionary {
75+
id displayModeObject = dictionary[@"displayMode"];
76+
77+
if ([displayModeObject isKindOfClass:NSString.class]) {
78+
NSString *displayMode = displayModeObject;
79+
if ([displayMode isEqualToString:@"selected"]) {
80+
self.viewController.displayMode = albumArtDisplayModeSelected;
81+
}
82+
else if ([displayMode isEqualToString:@"playing"]) {
83+
self.viewController.displayMode = albumArtDisplayModePlaying;
84+
}
85+
else if ([displayMode isEqualToString:@"playingOrSelected"]) {
86+
self.viewController.displayMode = albumArtDisplayModePlayingOrSelected;
87+
}
88+
}
89+
90+
return YES;
91+
}
92+
93+
#pragma mark - AlbumArtWidgetViewControllerDelegate
94+
95+
- (void)configurationDidChange {
96+
[self.deps.state layoutDidChange];
97+
}
98+
99+
@end
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
DeaDBeeF -- the music player
3+
Copyright (C) 2009-2025 Oleksiy Yakovenko and other contributors
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
14+
claim that you wrote the original software. If you use this software
15+
in a product, an acknowledgment in the product documentation would be
16+
appreciated but is not required.
17+
18+
2. Altered source versions must be plainly marked as such, and must not be
19+
misrepresented as being the original software.
20+
21+
3. This notice may not be removed or altered from any source distribution.
22+
*/
23+
24+
25+
26+
#import <Cocoa/Cocoa.h>
27+
28+
typedef NS_ENUM(NSInteger,AlbumArtDisplayMode) {
29+
albumArtDisplayModeSelected,
30+
albumArtDisplayModePlaying,
31+
albumArtDisplayModePlayingOrSelected
32+
};
33+
34+
@protocol AlbumArtWidgetViewControllerDelegate
35+
- (void)configurationDidChange;
36+
@end
37+
38+
@interface AlbumArtWidgetViewController : NSViewController
39+
40+
@property (nonatomic, weak) id<AlbumArtWidgetViewControllerDelegate> delegate;
41+
@property (nonatomic) AlbumArtDisplayMode displayMode;
42+
- (void)refresh;
43+
44+
@end

0 commit comments

Comments
 (0)