]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/coredialogs.m
macosx: add custom numberformatter to goto time field to only allow digits and :
[vlc] / modules / gui / macosx / coredialogs.m
index 04a2c5794457517b78d77385e47d48ccc62ad648..7d24fc63dcb7fd9b3500ecfff67b48017dc52cca 100644 (file)
@@ -67,7 +67,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
 
 -(void)performEventWithObject: (NSValue *)o_value ofType: (const char*)type
 {
-    NSString *o_type = [NSString stringWithUTF8String:type];
+    NSString *o_type = @(type);
 
     if ([o_type isEqualToString: @"dialog-error"])
         [self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES];
@@ -87,7 +87,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
 {
     dialog_fatal_t *p_dialog = [o_value pointerValue];
 
-    [o_error_panel addError: [NSString stringWithUTF8String: p_dialog->title] withMsg: [NSString stringWithUTF8String: p_dialog->message]];
+    [o_error_panel addError: @(p_dialog->title) withMsg: @(p_dialog->message)];
     [o_error_panel showPanel];
 }
 
@@ -96,7 +96,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
     dialog_fatal_t *p_dialog = [o_value pointerValue];
     NSAlert *o_alert;
 
-    o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: @"%s", p_dialog->message];
+    o_alert = [NSAlert alertWithMessageText: @(p_dialog->title) defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: @"%s", p_dialog->message];
     [o_alert setAlertStyle: NSCriticalAlertStyle];
     [o_alert runModal];
 }
@@ -109,13 +109,13 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
     NSInteger i_returnValue = 0;
 
     if (p_dialog->yes != NULL)
-        o_yes = [NSString stringWithUTF8String: p_dialog->yes];
+        o_yes = @(p_dialog->yes);
     if (p_dialog->no != NULL)
-        o_no = [NSString stringWithUTF8String: p_dialog->no];
+        o_no = @(p_dialog->no);
     if (p_dialog->cancel != NULL)
-        o_cancel = [NSString stringWithUTF8String: p_dialog->cancel];
+        o_cancel = @(p_dialog->cancel);
 
-    o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message];
+    o_alert = [NSAlert alertWithMessageText: @(p_dialog->title) defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message];
     [o_alert setAlertStyle: NSInformationalAlertStyle];
     i_returnValue = [o_alert runModal];
 
@@ -132,9 +132,9 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
     dialog_login_t *p_dialog = [o_value pointerValue];
     NSInteger i_returnValue = 0;
 
-    [o_auth_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
-    [o_auth_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
-    [o_auth_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
+    [o_auth_title_txt setStringValue: @(p_dialog->title)];
+    [o_auth_win setTitle: @(p_dialog->title)];
+    [o_auth_description_txt setStringValue: @(p_dialog->message)];
     [o_auth_login_fld setStringValue: @""];
     [o_auth_pw_fld setStringValue: @""];
 
@@ -170,18 +170,18 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
 
     if (p_dialog->title != NULL)
     {
-        [o_prog_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
-        [o_prog_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
+        [o_prog_win setTitle: @(p_dialog->title)];
+        [o_prog_title_txt setStringValue: @(p_dialog->title)];
     } else {
         [o_prog_win setTitle: @""];
         [o_prog_title_txt setStringValue: @""];
     }
     if (p_dialog->cancel != NULL)
-        [o_prog_cancel_btn setTitle: [NSString stringWithUTF8String: p_dialog->cancel]];
+        [o_prog_cancel_btn setTitle: @(p_dialog->cancel)];
     else
         [o_prog_cancel_btn setTitle: _NS("Cancel")];
     if (p_dialog->message != NULL)
-        [o_prog_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
+        [o_prog_description_txt setStringValue: @(p_dialog->message)];
     else
         [o_prog_description_txt setStringValue: @""];
 
@@ -317,10 +317,10 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
     (NSTableColumn *)theTableColumn row: (NSInteger)row
 {
     if ([[theTableColumn identifier] isEqualToString: @"error_msg"])
-        return [o_errors objectAtIndex: row];
+        return o_errors[row];
 
     if ([[theTableColumn identifier] isEqualToString: @"icon"])
-        return [o_icons objectAtIndex: row];
+        return o_icons[row];
 
     return @"unknown identifier";
 }