Commit 6424a7eb authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: remove duplicate code by using the same IBAction for both Prefs Reset buttons

parent df97baf7
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
</object> </object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2311"/> <integer value="2410"/>
<integer value="1531"/>
<integer value="2562"/> <integer value="2562"/>
<integer value="2311"/>
</object> </object>
<object class="NSArray" key="IBDocument.PluginDependencies"> <object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
...@@ -48,7 +50,7 @@ ...@@ -48,7 +50,7 @@
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string> <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{775, 485}</string> <string key="NSWindowContentMinSize">{775, 485}</string>
<object class="NSView" key="NSWindowView" id="669190984"> <object class="NSView" key="NSWindowView" id="669190984">
<nil key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews"> <object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
...@@ -341,6 +343,7 @@ ...@@ -341,6 +343,7 @@
</object> </object>
</object> </object>
<string key="NSFrameSize">{775, 485}</string> <string key="NSFrameSize">{775, 485}</string>
<reference key="NSSuperview"/>
</object> </object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{775, 507}</string> <string key="NSMinSize">{775, 507}</string>
...@@ -364,7 +367,7 @@ ...@@ -364,7 +367,7 @@
<nil key="NSUserInterfaceItemIdentifier"/> <nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string> <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<object class="NSView" key="NSWindowView" id="323943617"> <object class="NSView" key="NSWindowView" id="323943617">
<nil key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews"> <object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
...@@ -502,6 +505,7 @@ ...@@ -502,6 +505,7 @@
</object> </object>
</object> </object>
<string key="NSFrameSize">{570, 38}</string> <string key="NSFrameSize">{570, 38}</string>
<reference key="NSSuperview"/>
</object> </object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string> <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
...@@ -5482,14 +5486,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -5482,14 +5486,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object> </object>
<int key="connectionID">1551</int> <int key="connectionID">1551</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">resetAll:</string>
<reference key="source" ref="990163127"/>
<reference key="destination" ref="703971607"/>
</object>
<int key="connectionID">1552</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">closePrefs:</string> <string key="label">closePrefs:</string>
...@@ -5746,14 +5742,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -5746,14 +5742,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object> </object>
<int key="connectionID">2409</int> <int key="connectionID">2409</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">buttonAction:</string>
<reference key="source" ref="150917409"/>
<reference key="destination" ref="910206764"/>
</object>
<int key="connectionID">2415</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">buttonAction:</string> <string key="label">buttonAction:</string>
...@@ -7410,6 +7398,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -7410,6 +7398,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object> </object>
<int key="connectionID">3871</int> <int key="connectionID">3871</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">resetPreferences:</string>
<reference key="source" ref="150917409"/>
<reference key="destination" ref="910206764"/>
</object>
<int key="connectionID">3872</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">resetPreferences:</string>
<reference key="source" ref="150917409"/>
<reference key="destination" ref="703971607"/>
</object>
<int key="connectionID">3873</int>
</object>
</object> </object>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
...@@ -12234,7 +12238,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -12234,7 +12238,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object> </object>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">3871</int> <int key="maxID">3873</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">
...@@ -13456,6 +13460,127 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -13456,6 +13460,127 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="minorKey">../../../../../modules/gui/macosx/simple_prefs.h</string> <string key="minorKey">../../../../../modules/gui/macosx/simple_prefs.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">VLCPrefs</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>buttonAction:</string>
<string>closePrefs:</string>
<string>savePrefs:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>buttonAction:</string>
<string>closePrefs:</string>
<string>savePrefs:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">buttonAction:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">closePrefs:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">savePrefs:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>o_cancel_btn</string>
<string>o_prefs_view</string>
<string>o_prefs_window</string>
<string>o_reset_btn</string>
<string>o_save_btn</string>
<string>o_showBasic_btn</string>
<string>o_title</string>
<string>o_tree</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>o_cancel_btn</string>
<string>o_prefs_view</string>
<string>o_prefs_window</string>
<string>o_reset_btn</string>
<string>o_save_btn</string>
<string>o_showBasic_btn</string>
<string>o_title</string>
<string>o_tree</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">o_cancel_btn</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_prefs_view</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_prefs_window</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_reset_btn</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_save_btn</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_showBasic_btn</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_title</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">o_tree</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBDocumentRelativeSource</string>
<string key="minorKey">../../../../../modules/gui/macosx/prefs.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">VLCSimplePrefs</string> <string key="className">VLCSimplePrefs</string>
<string key="superclassName">NSObject</string> <string key="superclassName">NSObject</string>
...@@ -13470,6 +13595,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -13470,6 +13595,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>inputSettingChanged:</string> <string>inputSettingChanged:</string>
<string>interfaceSettingChanged:</string> <string>interfaceSettingChanged:</string>
<string>osdSettingChanged:</string> <string>osdSettingChanged:</string>
<string>resetPreferences:</string>
<string>showFontPicker:</string> <string>showFontPicker:</string>
<string>urlHandlerAction:</string> <string>urlHandlerAction:</string>
<string>videoSettingChanged:</string> <string>videoSettingChanged:</string>
...@@ -13486,6 +13612,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -13486,6 +13612,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>id</string>
</object> </object>
</object> </object>
<object class="NSMutableDictionary" key="actionInfosByName"> <object class="NSMutableDictionary" key="actionInfosByName">
...@@ -13499,6 +13626,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -13499,6 +13626,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>inputSettingChanged:</string> <string>inputSettingChanged:</string>
<string>interfaceSettingChanged:</string> <string>interfaceSettingChanged:</string>
<string>osdSettingChanged:</string> <string>osdSettingChanged:</string>
<string>resetPreferences:</string>
<string>showFontPicker:</string> <string>showFontPicker:</string>
<string>urlHandlerAction:</string> <string>urlHandlerAction:</string>
<string>videoSettingChanged:</string> <string>videoSettingChanged:</string>
...@@ -13533,6 +13661,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> ...@@ -13533,6 +13661,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="name">osdSettingChanged:</string> <string key="name">osdSettingChanged:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo">
<string key="name">resetPreferences:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo"> <object class="IBActionInfo">
<string key="name">showFontPicker:</string> <string key="name">showFontPicker:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
- (void)showPrefsWithLevel:(NSInteger)i_window_level; - (void)showPrefsWithLevel:(NSInteger)i_window_level;
- (IBAction)savePrefs: (id)sender; - (IBAction)savePrefs: (id)sender;
- (IBAction)closePrefs: (id)sender; - (IBAction)closePrefs: (id)sender;
- (IBAction)resetAll: (id)sender;
- (IBAction)buttonAction: (id)sender; - (IBAction)buttonAction: (id)sender;
@end @end
......
...@@ -224,30 +224,6 @@ static VLCPrefs *_o_sharedMainInstance = nil; ...@@ -224,30 +224,6 @@ static VLCPrefs *_o_sharedMainInstance = nil;
[o_prefs_window orderOut:self]; [o_prefs_window orderOut:self];
} }
- (IBAction)resetAll: (id)sender
{
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_prefs_window, self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("Beware this will reset the VLC media player preferences.\n"
"Are you sure you want to continue?"));
}
- (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return
contextInfo:(void *)o_context
{
if (i_return == NSAlertAlternateReturn) {
/* reset VLC's config */
config_ResetAll(p_intf);
[_rootTreeItem resetView];
config_SaveConfigFile(p_intf);
/* reset OS X defaults */
[NSUserDefaults resetStandardUserDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
- (IBAction)buttonAction: (id)sender - (IBAction)buttonAction: (id)sender
{ {
[o_prefs_window orderOut: self]; [o_prefs_window orderOut: self];
......
...@@ -208,6 +208,7 @@ ...@@ -208,6 +208,7 @@
- (void)showSimplePrefsWithLevel:(NSInteger)i_window_level; - (void)showSimplePrefsWithLevel:(NSInteger)i_window_level;
- (IBAction)buttonAction:(id)sender; - (IBAction)buttonAction:(id)sender;
- (IBAction)resetPreferences:(id)sender;
- (void)sheetDidEnd:(NSWindow *)o_sheet - (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return returnCode:(int)i_return
contextInfo:(void *)o_context; contextInfo:(void *)o_context;
......
...@@ -682,9 +682,17 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam ...@@ -682,9 +682,17 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
[self saveChangedSettings]; [self saveChangedSettings];
[[NSFontPanel sharedFontPanel] close]; [[NSFontPanel sharedFontPanel] close];
[o_sprefs_win orderOut: sender]; [o_sprefs_win orderOut: sender];
} else if (sender == o_sprefs_reset_btn) } else if (sender == o_sprefs_showAll_btn) {
[o_sprefs_win orderOut: self];
[[[VLCMain sharedInstance] preferences] showPrefsWithLevel:[o_sprefs_win level]];
} else
msg_Warn(p_intf, "unknown buttonAction sender");
}
- (IBAction)resetPreferences:(NSControl *)sender
{
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"), NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_sprefs_win, self, _NS("Continue"), nil, [sender window], self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@", @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("This will reset VLC media player's preferences.\n\n" _NS("This will reset VLC media player's preferences.\n\n"
"Note that VLC will restart during the process, so your current " "Note that VLC will restart during the process, so your current "
...@@ -692,11 +700,6 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam ...@@ -692,11 +700,6 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
"transcoding activities will stop immediately.\n\n" "transcoding activities will stop immediately.\n\n"
"The Media Library will not be affected.\n\n" "The Media Library will not be affected.\n\n"
"Are you sure you want to continue?")); "Are you sure you want to continue?"));
else if (sender == o_sprefs_showAll_btn) {
[o_sprefs_win orderOut: self];
[[[VLCMain sharedInstance] preferences] showPrefsWithLevel:[o_sprefs_win level]];
} else
msg_Warn(p_intf, "unknown buttonAction sender");
} }
- (void)sheetDidEnd:(NSWindow *)o_sheet - (void)sheetDidEnd:(NSWindow *)o_sheet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment