mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 15:52:19 +00:00
Search bar is now animated
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSCustomView" id="997686550">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSCustomView" id="163272962">
|
||||
@@ -57,8 +57,6 @@
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{7, 5}, {32, 19}}</string>
|
||||
<reference key="NSSuperview" ref="163272962"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="160641004">
|
||||
@@ -88,7 +86,6 @@
|
||||
</array>
|
||||
<string key="NSFrameSize">{694, 30}</string>
|
||||
<reference key="NSSuperview" ref="997686550"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="276578969"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<string key="NSClassName">HNHGradientView</string>
|
||||
@@ -107,8 +104,7 @@
|
||||
<array class="NSMutableArray" key="NSSubviews"/>
|
||||
<string key="NSFrameSize">{694, 548}</string>
|
||||
<reference key="NSSuperview" ref="262664416"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="788738248"/>
|
||||
<reference key="NSNextKeyView" ref="736877784"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:13</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
@@ -118,7 +114,6 @@
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrameSize">{694, 17}</string>
|
||||
<reference key="NSSuperview" ref="736877784"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="262664416"/>
|
||||
<reference key="NSTableView" ref="528076956"/>
|
||||
</object>
|
||||
@@ -331,7 +326,6 @@
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 17}, {694, 548}}</string>
|
||||
<reference key="NSSuperview" ref="613995671"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="528076956"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:11</string>
|
||||
<reference key="NSDocView" ref="528076956"/>
|
||||
@@ -343,7 +337,6 @@
|
||||
<int key="NSvFlags">-2147483392</int>
|
||||
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
|
||||
<reference key="NSSuperview" ref="613995671"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="802411427"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:58</string>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
@@ -356,7 +349,6 @@
|
||||
<int key="NSvFlags">-2147483392</int>
|
||||
<string key="NSFrame">{{0, 310}, {480, 16}}</string>
|
||||
<reference key="NSSuperview" ref="613995671"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="163272962"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:60</string>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
@@ -373,7 +365,6 @@
|
||||
</array>
|
||||
<string key="NSFrameSize">{694, 17}</string>
|
||||
<reference key="NSSuperview" ref="613995671"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="253618752"/>
|
||||
<reference key="NSDocView" ref="253618752"/>
|
||||
<reference key="NSBGColor" ref="136901388"/>
|
||||
@@ -382,8 +373,7 @@
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 30}, {694, 565}}</string>
|
||||
<reference key="NSSuperview" ref="997686550"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="736877784"/>
|
||||
<reference key="NSNextKeyView" ref="262664416"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<int key="NSsFlags">133680</int>
|
||||
<reference key="NSVScroller" ref="1037276411"/>
|
||||
@@ -397,8 +387,6 @@
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{694, 594}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="613995671"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<string key="NSClassName">NSView</string>
|
||||
@@ -424,7 +412,23 @@
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">tableToTop</string>
|
||||
<string key="label">bottomBar</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="163272962"/>
|
||||
</object>
|
||||
<int key="connectionID">744</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">addEntryButton</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="276578969"/>
|
||||
</object>
|
||||
<int key="connectionID">745</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">tableToTopConstraint</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<object class="IBNSLayoutConstraint" key="destination" id="858505477">
|
||||
<reference key="firstItem" ref="613995671"/>
|
||||
@@ -443,23 +447,7 @@
|
||||
<int key="contentType">3</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">686</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">bottomBar</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="163272962"/>
|
||||
</object>
|
||||
<int key="connectionID">744</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">addEntryButton</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="276578969"/>
|
||||
</object>
|
||||
<int key="connectionID">745</int>
|
||||
<int key="connectionID">844</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
@@ -471,7 +459,7 @@
|
||||
<object class="NSTextField" id="306813103">
|
||||
<reference key="NSNextResponder" ref="788738248"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrameSize">{104.5, 17}</string>
|
||||
<string key="NSFrameSize">{105, 17}</string>
|
||||
<reference key="NSSuperview" ref="788738248"/>
|
||||
<reference key="NSNextKeyView" ref="804102913"/>
|
||||
<string key="NSAntiCompressionPriority">{250, 750}</string>
|
||||
@@ -493,7 +481,7 @@
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{1, 1}, {104.5, 17}}</string>
|
||||
<string key="NSFrame">{{1, 1}, {105, 17}}</string>
|
||||
<reference key="NSNextKeyView" ref="306813103"/>
|
||||
</object>
|
||||
<reference key="destination" ref="306813103"/>
|
||||
@@ -562,7 +550,7 @@
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{108.5, 1}, {144, 17}}</string>
|
||||
<string key="NSFrame">{{109, 1}, {144, 17}}</string>
|
||||
<reference key="NSNextKeyView" ref="591921532"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
</object>
|
||||
@@ -605,7 +593,7 @@
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{377, 1}, {113, 17}}</string>
|
||||
<string key="NSFrame">{{378, 1}, {113, 17}}</string>
|
||||
<reference key="NSNextKeyView" ref="441850286"/>
|
||||
</object>
|
||||
<reference key="destination" ref="441850286"/>
|
||||
@@ -622,7 +610,7 @@
|
||||
<object class="NSTextField" id="1042596093">
|
||||
<reference key="NSNextResponder" ref="878614701"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrameSize">{118.5, 17}</string>
|
||||
<string key="NSFrameSize">{119, 17}</string>
|
||||
<reference key="NSSuperview" ref="878614701"/>
|
||||
<reference key="NSNextKeyView" ref="542633869"/>
|
||||
<string key="NSAntiCompressionPriority">{250, 750}</string>
|
||||
@@ -639,7 +627,7 @@
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{255.5, 1}, {118.5, 17}}</string>
|
||||
<string key="NSFrame">{{256, 1}, {119, 17}}</string>
|
||||
<reference key="NSNextKeyView" ref="1042596093"/>
|
||||
</object>
|
||||
<reference key="destination" ref="1042596093"/>
|
||||
@@ -673,7 +661,7 @@
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{493, 1}, {198, 17}}</string>
|
||||
<string key="NSFrame">{{494, 1}, {198, 17}}</string>
|
||||
<reference key="NSNextKeyView" ref="488604658"/>
|
||||
</object>
|
||||
<reference key="destination" ref="488604658"/>
|
||||
@@ -1741,7 +1729,7 @@
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">843</int>
|
||||
<int key="maxID">844</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
||||
@@ -18,7 +18,7 @@ typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
|
||||
};
|
||||
|
||||
@class MPDocument;
|
||||
@class HNHRoundendTextField;
|
||||
@class HNHRoundedTextField;
|
||||
@class HNHRoundedSecureTextField;
|
||||
|
||||
@interface MPDatabaseSettingsWindowController : NSWindowController <NSTextFieldDelegate, NSTabViewDelegate>
|
||||
@@ -58,7 +58,7 @@ typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
|
||||
|
||||
|
||||
/* Templates Tab */
|
||||
@property (weak) IBOutlet HNHRoundendTextField *defaultUsernameTextField;
|
||||
@property (weak) IBOutlet HNHRoundedTextField *defaultUsernameTextField;
|
||||
@property (weak) IBOutlet NSPopUpButton *templateGroupPopUpButton;
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
_document = document;
|
||||
_showPassword = NO;
|
||||
_hasValidPasswordOrKey = NO;
|
||||
_missingFeature = NSLocalizedString(@"KDBX_ONLX_FEATURE", "Feature only available in kdbx databases");
|
||||
_missingFeature = NSLocalizedString(@"KDBX_ONLY_FEATURE", "Feature only available in kdbx databases");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -156,7 +156,7 @@
|
||||
- (void)showSettingsTab:(MPDatabaseSettingsTab)tab {
|
||||
/*
|
||||
We need to make sure the window is loaded
|
||||
so we just call the the getter and led teh loading commence
|
||||
so we just call the the getter and led the loading commence
|
||||
*/
|
||||
if(![self window]) {
|
||||
return;
|
||||
@@ -315,7 +315,14 @@
|
||||
}
|
||||
|
||||
- (void)_setupTemplatesTab:(Kdb4Tree *)tree {
|
||||
|
||||
if(tree) {
|
||||
[self.defaultUsernameTextField setStringValue:tree.defaultUserName];
|
||||
[self.defaultUsernameTextField setEditable:YES];
|
||||
}
|
||||
else {
|
||||
[self.defaultUsernameTextField setStringValue:_missingFeature];
|
||||
[self.defaultUsernameTextField setEditable:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_updateFirstResponder {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#import "MPNotifications.h"
|
||||
|
||||
#define STATUS_BAR_ANIMATION_TIME 0.2
|
||||
#define STATUS_BAR_ANIMATION_TIME 0.15
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, MPFilterModeType) {
|
||||
MPFilterNone = 0,
|
||||
@@ -71,7 +71,8 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
@property (strong) IBOutlet NSView *filterBar;
|
||||
@property (strong) IBOutlet HNHGradientView *trashBar;
|
||||
@property (weak) IBOutlet NSTableView *entryTable;
|
||||
@property (strong) IBOutlet NSLayoutConstraint *tableToTop;
|
||||
@property (strong) IBOutlet NSLayoutConstraint *tableToTopConstraint;
|
||||
@property (strong) NSLayoutConstraint *filterbarTopConstraint;
|
||||
@property (weak) IBOutlet NSButton *filterDoneButton;
|
||||
|
||||
@property (weak) IBOutlet NSButton *filterTitleButton;
|
||||
@@ -126,7 +127,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
|
||||
- (void)didLoadView {
|
||||
[self.view setWantsLayer:YES];
|
||||
[self _hideFilterBarAnimated:NO];
|
||||
[self _hideFilterBarAnimated];
|
||||
|
||||
[_bottomBar setBorderType:HNHBorderTop];
|
||||
[self.addEntryButton setAction:[MPActionHelper actionOfType:MPActionAddEntry]];
|
||||
@@ -254,7 +255,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
}
|
||||
/*
|
||||
If a grup is the current item, see if we already show that group
|
||||
*/
|
||||
*/
|
||||
if(document.selectedItem == document.selectedGroup) {
|
||||
/*
|
||||
If we reselct the group, or just another group
|
||||
@@ -284,7 +285,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
#pragma mark Filtering
|
||||
|
||||
- (void)showFilter:(id)sender {
|
||||
[self _showFilterBarAnimated:NO];
|
||||
[self _showFilterBarAnimated];
|
||||
}
|
||||
|
||||
- (BOOL)hasFilter {
|
||||
@@ -302,13 +303,13 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
self.filter = nil;
|
||||
[self.filterSearchField setStringValue:@""];
|
||||
[[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier] setHidden:YES];
|
||||
[self _hideFilterBarAnimated:YES];
|
||||
[self _hideFilterBarAnimated];
|
||||
MPDocument *document = [[self windowController] document];
|
||||
document.selectedGroup = document.selectedGroup;
|
||||
}
|
||||
|
||||
- (void)updateFilter {
|
||||
[self _showFilterBarAnimated:YES];
|
||||
[self _showFilterBarAnimated];
|
||||
if(![self hasFilter]) {
|
||||
return;
|
||||
}
|
||||
@@ -365,9 +366,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
|
||||
#pragma mark UI Feedback
|
||||
|
||||
- (void)_showFilterBarAnimated:(BOOL)animate {
|
||||
|
||||
animate = NO;
|
||||
- (void)_showFilterBarAnimated {
|
||||
|
||||
if(!self.filterBar) {
|
||||
[self setupFilterBar];
|
||||
@@ -386,48 +385,49 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
NSView *scrollView = [_entryTable enclosingScrollView];
|
||||
NSDictionary *views = NSDictionaryOfVariableBindings(scrollView, _filterBar);
|
||||
[self.view layout];
|
||||
[self.view removeConstraint:self.tableToTop];
|
||||
|
||||
[self.view addSubview:self.filterBar];
|
||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_filterBar]|" options:0 metrics:nil views:views]];
|
||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_filterBar(==30)]-0-[scrollView]" options:0 metrics:nil views:views]];
|
||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_filterBar(==30)]-0-[scrollView]" options:0 metrics:nil views:views]];
|
||||
[[self view] layoutSubtreeIfNeeded];
|
||||
|
||||
[self.view removeConstraint:self.tableToTopConstraint];
|
||||
self.filterbarTopConstraint = [NSLayoutConstraint constraintWithItem:self.filterBar
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:[self view]
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1
|
||||
constant:0];
|
||||
[[self view] addConstraint:self.filterbarTopConstraint];
|
||||
|
||||
if(animate) {
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) {
|
||||
context.duration = STATUS_BAR_ANIMATION_TIME;
|
||||
context.allowsImplicitAnimation = YES;
|
||||
[self.view layoutSubtreeIfNeeded];
|
||||
} completionHandler:nil] ;
|
||||
}
|
||||
else {
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) {
|
||||
context.duration = STATUS_BAR_ANIMATION_TIME;
|
||||
context.allowsImplicitAnimation = YES;
|
||||
[self.view layoutSubtreeIfNeeded];
|
||||
}
|
||||
} completionHandler:nil] ;
|
||||
[[[self windowController] window] makeFirstResponder:self.filterSearchField];
|
||||
}
|
||||
|
||||
- (void)_hideFilterBarAnimated:(BOOL)animate {
|
||||
|
||||
animate = NO;
|
||||
- (void)_hideFilterBarAnimated {
|
||||
|
||||
if(![self _showsFilterBar]) {
|
||||
return; // nothing to do;
|
||||
}
|
||||
|
||||
[self.filterBar removeFromSuperview];
|
||||
[self.view addConstraint:self.tableToTop];
|
||||
[[self view] removeConstraint:self.filterbarTopConstraint];
|
||||
[self.view addConstraint:self.tableToTopConstraint];
|
||||
|
||||
if(animate) {
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) {
|
||||
context.duration = STATUS_BAR_ANIMATION_TIME;
|
||||
context.allowsImplicitAnimation = YES;
|
||||
[self.view layoutSubtreeIfNeeded];
|
||||
} completionHandler:nil] ;
|
||||
}
|
||||
else {
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext* context) {
|
||||
context.duration = STATUS_BAR_ANIMATION_TIME;
|
||||
context.allowsImplicitAnimation = YES;
|
||||
[self.view layoutSubtreeIfNeeded];
|
||||
}
|
||||
} completionHandler:^{
|
||||
[self.filterBar removeFromSuperview];
|
||||
}] ;
|
||||
}
|
||||
|
||||
|
||||
- (void)_copyToPasteboard:(NSString *)data overlayInfo:(MPOVerlayInfoType)overlayInfoType name:(NSString *)name{
|
||||
if(data) {
|
||||
[[MPPasteBoardController defaultController] copyObjects:@[ data ]];
|
||||
@@ -468,7 +468,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
NSView *scrollView = [_entryTable enclosingScrollView];
|
||||
NSDictionary *views = NSDictionaryOfVariableBindings(scrollView, _trashBar);
|
||||
[[self view] layout];
|
||||
[[self view] removeConstraint:self.tableToTop];
|
||||
[[self view] removeConstraint:self.tableToTopConstraint];
|
||||
[[self view] addSubview:self.trashBar];
|
||||
[[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_trashBar]|" options:0 metrics:nil views:views]];
|
||||
[[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_trashBar(==30)]-0-[scrollView]" options:0 metrics:nil views:views]];
|
||||
@@ -490,7 +490,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
}
|
||||
|
||||
[self.trashBar removeFromSuperview];
|
||||
[[self view] addConstraint:self.tableToTop];
|
||||
[[self view] addConstraint:self.tableToTopConstraint];
|
||||
[[self view] layoutSubtreeIfNeeded];
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user