Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
afe0a0c2
Commit
afe0a0c2
authored
May 21, 2009
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: finally completed the progress-panel's implementation
parent
b91b6e06
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
62 deletions
+64
-62
modules/gui/macosx/coredialogs.h
modules/gui/macosx/coredialogs.h
+7
-2
modules/gui/macosx/coredialogs.m
modules/gui/macosx/coredialogs.m
+11
-55
modules/gui/macosx/intf.h
modules/gui/macosx/intf.h
+0
-2
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+46
-3
No files found.
modules/gui/macosx/coredialogs.h
View file @
afe0a0c2
...
...
@@ -69,23 +69,28 @@
IBOutlet
id
o_auth_win
;
/* progress dialogue */
IBOutlet
id
o_prog_bar
;
IBOutlet
NSProgressIndicator
*
o_prog_bar
;
IBOutlet
id
o_prog_cancel_btn
;
IBOutlet
id
o_prog_description_txt
;
IBOutlet
id
o_prog_title_txt
;
IBOutlet
id
o_prog_win
;
BOOL
b_progress_cancelled
;
}
+
(
VLCCoreDialogProvider
*
)
sharedInstance
;
-
(
void
)
performDialogEvent
:
(
NSNotification
*
)
o_notification
;
-
(
void
)
performProgressBarEvent
:
(
NSNotification
*
)
o_notification
;
-
(
void
)
showFatalDialog
:
(
NSValue
*
)
o_value
;
-
(
void
)
showQuestionDialog
:
(
NSValue
*
)
o_value
;
-
(
void
)
showLoginDialog
:
(
NSValue
*
)
o_value
;
-
(
IBAction
)
loginDialogAction
:(
id
)
sender
;
-
(
void
)
showProgressDialog
:
(
NSValue
*
)
o_value
;
-
(
IBAction
)
progDialogAction
:(
id
)
sender
;
-
(
BOOL
)
progressCancelled
;
-
(
void
)
updateProgressPanelWithText
:
(
NSString
*
)
string
andNumber
:
(
double
)
d_number
;
-
(
void
)
destroyProgressPanel
;
-
(
id
)
errorPanel
;
...
...
modules/gui/macosx/coredialogs.m
View file @
afe0a0c2
...
...
@@ -29,16 +29,6 @@
/* for the icon in our custom error panel */
#import <ApplicationServices/ApplicationServices.h>
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
bool
b_progress_cancelled
;
static
void
updateProgressPanel
(
void
*
,
const
char
*
,
float
);
static
bool
checkProgressPanel
(
void
*
);
static
void
destroyProgressPanel
(
void
*
);
/*****************************************************************************
* VLCCoreDialogProvider implementation
*****************************************************************************/
...
...
@@ -62,14 +52,6 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
selector:
@selector
(
performDialogEvent
:)
name:
@"VLCNewCoreDialogEventNotification"
object:
self
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
performProgressBarEvent
:)
name:
@"VLCCoreDialogProgressBarUpdateNotification"
object:
self
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector:
@selector
(
performProgressBarEvent
:)
name:
@"VLCCoreDialogProgressBarDestroyNotification"
object:
self
];
o_error_panel
=
[[
VLCErrorPanel
alloc
]
init
];
b_progress_cancelled
=
NO
;
}
...
...
@@ -205,59 +187,33 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
else
[
o_prog_description_txt
setStringValue
:
@""
];
[
o_prog_bar
setDoubleValue
:
0
];
[
o_prog_bar
startAnimation
:
self
];
p_dialog
->
pf_update
=
updateProgressPanel
;
p_dialog
->
pf_check
=
checkProgressPanel
;
p_dialog
->
pf_destroy
=
destroyProgressPanel
;
p_dialog
->
p_sys
=
self
;
[
NSApp
runModalForWindow
:
o_prog_win
];
[
o_prog_win
makeKeyAndOrderFront
:
self
];
}
-
(
void
)
performProgressBarEvent
:
(
NSNotification
*
)
o_notification
-
(
void
)
updateProgressPanelWithText
:
(
NSString
*
)
string
andNumber
:
(
double
)
d_number
{
NSLog
(
@"%@ received"
,
[
o_notification
name
]
);
if
(
[[
o_notification
name
]
isEqualToString
:
@"VLCCoreDialogProgressBarUpdateNotification"
]
)
{
NSNumber
*
o_number
=
[[
o_notification
userInfo
]
objectForKey
:
@"IntValue"
];
NSString
*
o_text
=
[[
o_notification
userInfo
]
objectForKey
:
@"Text"
];
[
o_prog_description_txt
setStringValue
:
o_text
];
[
o_prog_bar
setDoubleValue
:
[
o_number
doubleValue
]];
}
if
(
[[
o_notification
name
]
isEqualToString
:
@"VLCCoreDialogProgressBarDestroyNotification"
]
)
{
[
NSApp
stopModalWithCode
:
0
];
[
o_prog_win
close
];
}
[
o_prog_description_txt
setStringValue
:
string
];
[
o_prog_bar
setDoubleValue
:
d_number
];
}
void
updateProgressPanel
(
void
*
priv
,
const
char
*
text
,
float
value
)
-
(
void
)
destroyProgressPanel
{
NSLog
(
@"we were updated with %s (%f)"
,
text
,
value
);
NSString
*
o_txt
;
if
(
text
!=
NULL
)
o_txt
=
[
NSString
stringWithUTF8String
:
text
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCCoreDialogProgressBarUpdateNotification"
object
:[[
VLCMain
sharedInstance
]
coreDialogProvider
]
userInfo
:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
o_txt
,
@"Text"
,
[
NSNumber
numberWithInt
:
((
int
)(
value
*
1000
.))],
@"IntValue"
,
nil
]];
[
o_prog_bar
stopAnimation
:
self
];
[
o_prog_win
close
];
}
void
destroyProgressPanel
(
void
*
priv
)
-
(
IBAction
)
progDialogAction
:(
id
)
sender
{
NSLog
(
@"we should destroy"
);
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCCoreDialogProgressBarDestroyNotification"
object
:[[
VLCMain
sharedInstance
]
coreDialogProvider
]
userInfo
:
nil
];
b_progress_cancelled
=
YES
;
}
bool
checkProgressPanel
(
void
*
priv
)
-
(
BOOL
)
progressCancelled
{
NSLog
(
@"we were checked"
);
return
b_progress_cancelled
;
}
-
(
IBAction
)
progDialogAction
:(
id
)
sender
{
NSLog
(
@"buttonAction!"
);
b_progress_cancelled
=
YES
;
}
-
(
id
)
errorPanel
{
return
o_error_panel
;
...
...
modules/gui/macosx/intf.h
View file @
afe0a0c2
...
...
@@ -83,8 +83,6 @@ struct intf_sys_t
msg_subscription_t
*
p_sub
;
};
static
void
MsgCallback
(
msg_cb_data_t
*
,
msg_item_t
*
,
unsigned
);
/*****************************************************************************
* VLCMain interface
*****************************************************************************/
...
...
modules/gui/macosx/intf.m
View file @
afe0a0c2
...
...
@@ -69,6 +69,12 @@ static void * ManageThread( void *user_data );
static
unichar
VLCKeyToCocoa
(
unsigned
int
i_key
);
static
unsigned
int
VLCModifiersToCocoa
(
unsigned
int
i_key
);
static
void
updateProgressPanel
(
void
*
,
const
char
*
,
float
);
static
bool
checkProgressPanel
(
void
*
);
static
void
destroyProgressPanel
(
void
*
);
static
void
MsgCallback
(
msg_cb_data_t
*
,
msg_item_t
*
,
unsigned
);
#pragma mark -
#pragma mark VLC Interface Object Callbacks
...
...
@@ -176,7 +182,6 @@ static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned int i )
vlc_restorecancel
(
canc
);
}
/*****************************************************************************
* playlistChanged: Callback triggered by the intf-change playlist
* variable, to let the intf update the playlist.
...
...
@@ -231,15 +236,53 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
VLCMain
*
interface
=
(
VLCMain
*
)
data
;
const
dialog_fatal_t
*
p_dialog
=
(
const
dialog_fatal_t
*
)
value
.
p_address
;
if
(
[[
NSString
stringWithUTF8String
:
type
]
isEqualToString
:
@"dialog-progress-bar"
]
)
{
/* the progress panel needs to update itself and therefore wants special treatment within this context */
dialog_progress_bar_t
*
p_dialog
=
(
dialog_progress_bar_t
*
)
value
.
p_address
;
NSValue
*
o_value
=
[
NSValue
valueWithPointer
:
p_dialog
];
p_dialog
->
pf_update
=
updateProgressPanel
;
p_dialog
->
pf_check
=
checkProgressPanel
;
p_dialog
->
pf_destroy
=
destroyProgressPanel
;
p_dialog
->
p_sys
=
VLCIntf
->
p_libvlc
;
}
NSValue
*
o_value
=
[
NSValue
valueWithPointer
:
value
.
p_address
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCNewCoreDialogEventNotification"
object
:[
interface
coreDialogProvider
]
userInfo
:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
o_value
,
@"VLCDialogPointer"
,
[
NSString
stringWithUTF8String
:
type
],
@"VLCDialogType"
,
nil
]];
[
o_pool
release
];
return
VLC_SUCCESS
;
}
void
updateProgressPanel
(
void
*
priv
,
const
char
*
text
,
float
value
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
o_txt
;
if
(
text
!=
NULL
)
o_txt
=
[
NSString
stringWithUTF8String
:
text
];
else
o_txt
=
@""
;
[[[
VLCMain
sharedInstance
]
coreDialogProvider
]
updateProgressPanelWithText
:
o_txt
andNumber
:
(
double
)(
value
*
1000
.)];
[
o_pool
release
];
}
void
destroyProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[[[
VLCMain
sharedInstance
]
coreDialogProvider
]
destroyProgressPanel
];
[
o_pool
release
];
}
bool
checkProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
return
[[[
VLCMain
sharedInstance
]
coreDialogProvider
]
progressCancelled
];
[
o_pool
release
];
}
#pragma mark -
#pragma mark Private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment