Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
6d1ad866
Commit
6d1ad866
authored
Dec 26, 2009
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
osx dialog provider: implemented the progress bar dialog
parent
e6f3057f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
274 additions
and
11 deletions
+274
-11
modules/gui/macosx_dialog_provider/Modules.am
modules/gui/macosx_dialog_provider/Modules.am
+3
-1
modules/gui/macosx_dialog_provider/VLCProgressPanel.h
modules/gui/macosx_dialog_provider/VLCProgressPanel.h
+46
-0
modules/gui/macosx_dialog_provider/VLCProgressPanel.m
modules/gui/macosx_dialog_provider/VLCProgressPanel.m
+139
-0
modules/gui/macosx_dialog_provider/dialogProvider.m
modules/gui/macosx_dialog_provider/dialogProvider.m
+86
-10
No files found.
modules/gui/macosx_dialog_provider/Modules.am
View file @
6d1ad866
...
@@ -5,8 +5,10 @@ LIBTOOL=@LIBTOOL@ --tag=CC
...
@@ -5,8 +5,10 @@ LIBTOOL=@LIBTOOL@ --tag=CC
SOURCES_macosx_dialog_provider = \
SOURCES_macosx_dialog_provider = \
VLCLoginPanel.m \
VLCLoginPanel.m \
VLCProgressPanel.m \
dialogProvider.m \
dialogProvider.m \
$(NULL)
$(NULL)
noinst_HEADERS = \
noinst_HEADERS = \
VLCLoginPanel.h
VLCLoginPanel.h \
VLCProgressPanel.h
modules/gui/macosx_dialog_provider/VLCProgressPanel.h
0 → 100644
View file @
6d1ad866
/*****************************************************************************
* VLCProgressPanel.h: A Generic Progress Indicator Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 the VideoLAN team
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface
VLCProgressPanel
:
NSPanel
{
BOOL
_isCancelled
;
IBOutlet
NSProgressIndicator
*
_progressBar
;
IBOutlet
NSTextField
*
_titleField
;
IBOutlet
NSTextField
*
_messageField
;
IBOutlet
NSButton
*
_cancelButton
;
IBOutlet
NSImageView
*
_iconView
;
}
-
(
void
)
createContentView
;
-
setDialogTitle
:(
NSString
*
)
title
;
-
setDialogMessage
:(
NSString
*
)
message
;
-
setCancelButtonLabel
:(
NSString
*
)
cancelLabel
;
-
setProgressAsDouble
:(
double
)
value
;
-
(
BOOL
)
isCancelled
;
-
(
IBAction
)
cancelDialog
:(
id
)
sender
;
@end
modules/gui/macosx_dialog_provider/VLCProgressPanel.m
0 → 100644
View file @
6d1ad866
/*****************************************************************************
* VLCProgressPanel.m: A Generic Progress Indicator Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 the VideoLAN team
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCProgressPanel.h"
@implementation
VLCProgressPanel
-
(
id
)
init
{
NSRect
windowRect
;
windowRect
.
size
.
height
=
182
;
windowRect
.
size
.
width
=
520
;
windowRect
.
origin
.
x
=
windowRect
.
origin
.
y
=
0
;
return
[
super
initWithContentRect
:
windowRect
styleMask:
NSTitledWindowMask
backing:
NSBackingStoreBuffered
defer:
YES
];
}
-
(
void
)
createContentView
{
NSRect
s_rc
=
[
self
frame
];
id
ourContentView
=
[
self
contentView
];
s_rc
.
origin
.
x
=
398
;
s_rc
.
origin
.
y
=
28
;
s_rc
.
size
.
height
=
32
;
s_rc
.
size
.
width
=
108
;
_cancelButton
=
[[
NSButton
alloc
]
initWithFrame
:
s_rc
];
[
_cancelButton
setButtonType
:
NSMomentaryLightButton
];
[
_cancelButton
setTitle
:
@"Cancel"
];
[
_cancelButton
setBezelStyle
:
NSRoundedBezelStyle
];
[
_cancelButton
setBordered
:
YES
];
[
_cancelButton
setTarget
:
self
];
[
_cancelButton
setAction
:
@selector
(
cancelDialog
:)];
[
ourContentView
addSubview
:
_cancelButton
];
s_rc
.
origin
.
x
=
89
;
s_rc
.
origin
.
y
=
153
;
s_rc
.
size
.
height
=
17
;
s_rc
.
size
.
width
=
414
;
_titleField
=
[[
NSTextField
alloc
]
initWithFrame
:
s_rc
];
[
_titleField
setFont
:[
NSFont
boldSystemFontOfSize
:
0
]];
[
_titleField
setBezeled
:
NO
];
[
_titleField
setEditable
:
NO
];
[
_titleField
setSelectable
:
YES
];
[
_titleField
setDrawsBackground
:
NO
];
[
ourContentView
addSubview
:
_titleField
];
s_rc
.
origin
.
x
=
89
;
s_rc
.
origin
.
y
=
116
;
s_rc
.
size
.
height
=
42
;
s_rc
.
size
.
width
=
414
;
_messageField
=
[[
NSTextField
alloc
]
initWithFrame
:
s_rc
];
[
_messageField
setFont
:[
NSFont
systemFontOfSize
:[
NSFont
smallSystemFontSize
]]];
[
_messageField
setBezeled
:
NO
];
[
_messageField
setEditable
:
NO
];
[
_messageField
setSelectable
:
YES
];
[
_messageField
setDrawsBackground
:
NO
];
[
ourContentView
addSubview
:
_messageField
];
s_rc
.
origin
.
x
=
90
;
s_rc
.
origin
.
y
=
66
;
s_rc
.
size
.
height
=
20
;
s_rc
.
size
.
width
=
412
;
_progressBar
=
[[
NSProgressIndicator
alloc
]
initWithFrame
:
s_rc
];
[
_progressBar
setMaxValue
:
1000
.
0
];
[
_progressBar
setUsesThreadedAnimation
:
YES
];
[
_progressBar
setStyle
:
NSProgressIndicatorBarStyle
];
[
_progressBar
setDisplayedWhenStopped
:
YES
];
[
_progressBar
setControlSize
:
NSRegularControlSize
];
[
_progressBar
setIndeterminate
:
NO
];
[
ourContentView
addSubview
:
_progressBar
];
[
_progressBar
startAnimation
:
nil
];
s_rc
.
origin
.
x
=
20
;
s_rc
.
origin
.
y
=
110
;
s_rc
.
size
.
height
=
s_rc
.
size
.
width
=
64
;
_iconView
=
[[
NSImageView
alloc
]
initWithFrame
:
s_rc
];
[
_iconView
setImage
:[
NSImage
imageNamed
:
@"NSApplicationIcon"
]];
[
_iconView
setEditable
:
NO
];
[
_iconView
setAllowsCutCopyPaste
:
NO
];
[
ourContentView
addSubview
:
_iconView
];
}
-
setDialogTitle
:(
NSString
*
)
title
{
[
_titleField
setStringValue
:
title
];
[
self
setTitle
:
title
];
}
-
setDialogMessage
:(
NSString
*
)
message
{
[
_messageField
setStringValue
:
message
];
}
-
setCancelButtonLabel
:(
NSString
*
)
cancelLabel
{
[
_cancelButton
setTitle
:
cancelLabel
];
}
-
setProgressAsDouble
:(
double
)
value
{
[
_progressBar
setDoubleValue
:
value
];
}
-
(
BOOL
)
isCancelled
{
return
_isCancelled
;
}
-
(
IBAction
)
cancelDialog
:(
id
)
sender
{
_isCancelled
=
YES
;
}
@end
modules/gui/macosx_dialog_provider/dialogProvider.m
View file @
6d1ad866
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#import <Cocoa/Cocoa.h>
#import <Cocoa/Cocoa.h>
#import "VLCLoginPanel.h"
#import "VLCLoginPanel.h"
#import "VLCProgressPanel.h"
/*****************************************************************************
/*****************************************************************************
* Prototypes
* Prototypes
...
@@ -50,9 +51,16 @@ static int DisplayError(vlc_object_t *,const char *,vlc_value_t,vlc_value_t,void
...
@@ -50,9 +51,16 @@ static int DisplayError(vlc_object_t *,const char *,vlc_value_t,vlc_value_t,void
static
int
DisplayCritical
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayCritical
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayQuestion
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayQuestion
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayLogin
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayLogin
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
DisplayProgressPanelAction
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
void
updateProgressPanel
(
void
*
,
const
char
*
,
float
);
static
bool
checkProgressPanel
(
void
*
);
static
void
destroyProgressPanel
(
void
*
);
struct
intf_sys_t
struct
intf_sys_t
{
{
VLCProgressPanel
*
currentProgressBarPanel
;
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
vlc_cond_t
wait
;
vlc_cond_t
wait
;
};
};
...
@@ -106,8 +114,8 @@ static void Run( intf_thread_t *p_intf )
...
@@ -106,8 +114,8 @@ static void Run( intf_thread_t *p_intf )
var_AddCallback
(
p_intf
,
"dialog-login"
,
DisplayLogin
,
p_intf
);
var_AddCallback
(
p_intf
,
"dialog-login"
,
DisplayLogin
,
p_intf
);
var_Create
(
p_intf
,
"dialog-question"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_intf
,
"dialog-question"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-question"
,
DisplayQuestion
,
p_intf
);
var_AddCallback
(
p_intf
,
"dialog-question"
,
DisplayQuestion
,
p_intf
);
//
var_Create(p_intf,"dialog-progress-bar",VLC_VAR_ADDRESS);
var_Create
(
p_intf
,
"dialog-progress-bar"
,
VLC_VAR_ADDRESS
);
//
var_AddCallback(p_intf,"dialog-progress-bar",DisplayProgressPanelAction,p_intf);
var_AddCallback
(
p_intf
,
"dialog-progress-bar"
,
DisplayProgressPanelAction
,
p_intf
);
dialog_Register
(
p_intf
);
dialog_Register
(
p_intf
);
msg_Dbg
(
p_intf
,
"Mac OS X dialog provider initialised"
);
msg_Dbg
(
p_intf
,
"Mac OS X dialog provider initialised"
);
...
@@ -124,7 +132,7 @@ static void Run( intf_thread_t *p_intf )
...
@@ -124,7 +132,7 @@ static void Run( intf_thread_t *p_intf )
var_DelCallback
(
p_intf
,
"dialog-critical"
,
DisplayCritical
,
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-critical"
,
DisplayCritical
,
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-login"
,
DisplayLogin
,
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-login"
,
DisplayLogin
,
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-question"
,
DisplayQuestion
,
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-question"
,
DisplayQuestion
,
p_intf
);
//
var_DelCallback(p_intf,"dialog-progress-bar",DisplayProgressPanelAction,p_intf);
var_DelCallback
(
p_intf
,
"dialog-progress-bar"
,
DisplayProgressPanelAction
,
p_intf
);
}
}
/*****************************************************************************
/*****************************************************************************
* CloseIntf: destroy interface
* CloseIntf: destroy interface
...
@@ -149,6 +157,7 @@ static int DisplayError(vlc_object_t *p_this, const char *type, vlc_value_t prev
...
@@ -149,6 +157,7 @@ static int DisplayError(vlc_object_t *p_this, const char *type, vlc_value_t prev
[
NSString
stringWithUTF8String
:
p_dialog
->
message
],
[
NSString
stringWithUTF8String
:
p_dialog
->
message
],
@"OK"
,
nil
,
nil
);
@"OK"
,
nil
,
nil
);
[
o_pool
release
];
[
o_pool
release
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayCritical
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
static
int
DisplayCritical
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
...
@@ -159,6 +168,7 @@ static int DisplayCritical(vlc_object_t *p_this, const char *type, vlc_value_t p
...
@@ -159,6 +168,7 @@ static int DisplayCritical(vlc_object_t *p_this, const char *type, vlc_value_t p
[
NSString
stringWithUTF8String
:
p_dialog
->
message
],
[
NSString
stringWithUTF8String
:
p_dialog
->
message
],
@"OK"
,
nil
,
nil
);
@"OK"
,
nil
,
nil
);
[
o_pool
release
];
[
o_pool
release
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayQuestion
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
static
int
DisplayQuestion
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
...
@@ -191,6 +201,7 @@ static int DisplayQuestion(vlc_object_t *p_this, const char *type, vlc_value_t p
...
@@ -191,6 +201,7 @@ static int DisplayQuestion(vlc_object_t *p_this, const char *type, vlc_value_t p
if
(
i_returnValue
==
NSAlertOtherReturn
)
if
(
i_returnValue
==
NSAlertOtherReturn
)
p_dialog
->
answer
=
3
;
p_dialog
->
answer
=
3
;
[
o_pool
release
];
[
o_pool
release
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayLogin
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
static
int
DisplayLogin
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
...
@@ -203,16 +214,81 @@ static int DisplayLogin(vlc_object_t *p_this, const char *type, vlc_value_t prev
...
@@ -203,16 +214,81 @@ static int DisplayLogin(vlc_object_t *p_this, const char *type, vlc_value_t prev
[
thePanel
setDialogTitle
:[
NSString
stringWithUTF8String
:
p_dialog
->
title
]];
[
thePanel
setDialogTitle
:[
NSString
stringWithUTF8String
:
p_dialog
->
title
]];
[
thePanel
setDialogMessage
:[
NSString
stringWithUTF8String
:
p_dialog
->
message
]];
[
thePanel
setDialogMessage
:[
NSString
stringWithUTF8String
:
p_dialog
->
message
]];
[
thePanel
center
];
[
thePanel
center
];
i_returnValue
=
[
NSApp
runModalForWindow
:
thePanel
];
i_returnValue
=
[
NSApp
runModalForWindow
:
thePanel
];
[
thePanel
close
];
[
thePanel
close
];
if
(
i_returnValue
)
if
(
i_returnValue
)
{
{
*
p_dialog
->
username
=
strdup
(
[[
thePanel
userName
]
UTF8String
]
);
*
p_dialog
->
username
=
strdup
(
[[
thePanel
userName
]
UTF8String
]
);
*
p_dialog
->
password
=
strdup
(
[[
thePanel
password
]
UTF8String
]
);
*
p_dialog
->
password
=
strdup
(
[[
thePanel
password
]
UTF8String
]
);
}
}
else
else
{
*
p_dialog
->
username
=
*
p_dialog
->
password
=
NULL
;
*
p_dialog
->
username
=
*
p_dialog
->
password
=
NULL
;
}
[
o_pool
release
];
[
o_pool
release
];
return
VLC_SUCCESS
;
}
static
int
DisplayProgressPanelAction
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_progress_bar_t
*
p_dialog
=
(
dialog_progress_bar_t
*
)
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
if
(
p_sys
->
currentProgressBarPanel
)
[
p_sys
->
currentProgressBarPanel
release
];
p_sys
->
currentProgressBarPanel
=
[[
VLCProgressPanel
alloc
]
init
];
[
p_sys
->
currentProgressBarPanel
createContentView
];
if
(
p_dialog
->
title
)
[
p_sys
->
currentProgressBarPanel
setDialogTitle
:[
NSString
stringWithUTF8String
:
p_dialog
->
title
]];
if
(
p_dialog
->
message
)
[
p_sys
->
currentProgressBarPanel
setDialogMessage
:[
NSString
stringWithUTF8String
:
p_dialog
->
message
]];
if
(
p_dialog
->
cancel
)
[
p_sys
->
currentProgressBarPanel
setCancelButtonLabel
:[
NSString
stringWithUTF8String
:
p_dialog
->
cancel
]];
[
p_sys
->
currentProgressBarPanel
center
];
[
p_sys
->
currentProgressBarPanel
makeKeyAndOrderFront
:
nil
];
p_dialog
->
pf_update
=
updateProgressPanel
;
p_dialog
->
pf_check
=
checkProgressPanel
;
p_dialog
->
pf_destroy
=
destroyProgressPanel
;
p_dialog
->
p_sys
=
p_intf
->
p_sys
;
[
o_pool
release
];
return
VLC_SUCCESS
;
}
}
void
updateProgressPanel
(
void
*
priv
,
const
char
*
text
,
float
value
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
p_sys
=
(
intf_sys_t
*
)
priv
;
if
(
text
)
[
p_sys
->
currentProgressBarPanel
setDialogMessage
:[
NSString
stringWithUTF8String
:
text
]];
else
[
p_sys
->
currentProgressBarPanel
setDialogMessage
:
@""
];
[
p_sys
->
currentProgressBarPanel
setProgressAsDouble
:(
double
)(
value
*
1000
.)];
[
o_pool
release
];
}
void
destroyProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
p_sys
=
(
intf_sys_t
*
)
priv
;
[
p_sys
->
currentProgressBarPanel
close
];
[
p_sys
->
currentProgressBarPanel
release
];
[
o_pool
release
];
}
bool
checkProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
p_sys
=
(
intf_sys_t
*
)
priv
;
BOOL
b_returned
;
b_returned
=
[
p_sys
->
currentProgressBarPanel
isCancelled
];
[
o_pool
release
];
return
b_returned
;
}
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