Added UI setting to control toolbar style

This commit is contained in:
Michael Starke
2021-06-02 10:44:45 +02:00
parent adcf77f1d7
commit 48fc70018e
3 changed files with 17 additions and 3 deletions

View File

@@ -100,9 +100,17 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[super windowDidLoad];
self.window.delegate = self.documentWindowDelegate;
//self.window.styleMask |= NSWindowStyleMaskFullSizeContentView;
if (@available(macOS 11.0, *)) {
self.window.toolbarStyle = NSWindowToolbarStyleExpanded;
/* let the user decide how to dipsplay the toolbar */
BOOL useUnifiedToolbar = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyUseUnifiedToolbar];
if(useUnifiedToolbar) {
self.window.toolbarStyle = NSWindowToolbarStyleAutomatic;
// Do not use full size since the sidebar takes too much room!
// self.window.styleMask |= NSWindowStyleMaskFullSizeContentView;
}
else {
self.window.toolbarStyle = NSWindowToolbarStyleExpanded;
}
}
[self.window registerForDraggedTypes:@[NSURLPboardType]];

View File

@@ -94,6 +94,9 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository;
/* Network */
APPKIT_EXTERN NSString *const kMPSettingsKeyFaviconDownloadMethod;
/* UI */
APPKIT_EXTERN NSString *const kMPSettingsKeyUseUnifiedToolbar;
typedef NS_ENUM(NSUInteger, MPFileChangeStrategy) {
MPFileChangeStrategyAsk,
MPFileChangeStrategyKeepMine,

View File

@@ -90,6 +90,8 @@ NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository = @"Al
NSString *const kMPSettingsKeyFaviconDownloadMethod = @"FaviconDownloadMethod";
NSString *const kMPSettingsKeyUseUnifiedToolbar =@"UseUnifiedToolbar";
/* Deprecated */
NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases";
NSString *const kMPDeprecatedSettingsKeyLastDatabasePath = @"MPLastDatabasePath";
@@ -170,7 +172,8 @@ NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"Au
kMPSettingsKeyEnableAutosave: @YES,
kMPSettingsKeyHideAfterCopyToClipboard: @NO,
kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect), // Download directly from host
kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO
kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO,
kMPSettingsKeyUseUnifiedToolbar: @NO // Do not use unified toolbar under Big Sur and above
};
});
return standardDefaults;