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
0d86a46b
Commit
0d86a46b
authored
Aug 24, 2012
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/MainWindow: move getCurrentTimeAsString to StringUtility
parent
f90f3bc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindow.m
+2
-25
modules/gui/macosx/StringUtility.h
modules/gui/macosx/StringUtility.h
+1
-0
modules/gui/macosx/StringUtility.m
modules/gui/macosx/StringUtility.m
+23
-1
No files found.
modules/gui/macosx/MainWindow.m
View file @
0d86a46b
...
...
@@ -57,8 +57,6 @@
-
(
void
)
makeSplitViewHidden
;
-
(
NSRect
)
customConstrainFrameRect
:
(
NSRect
)
frameRect
toScreen
:
(
NSScreen
*
)
screen
;
-
(
NSString
*
)
getCurrentTimeAsString
:(
input_thread_t
*
)
p_input
;
@end
@implementation
VLCMainWindow
...
...
@@ -1194,7 +1192,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
var_Set
(
p_input
,
"position"
,
pos
);
[
o_time_sld
setFloatValue
:
f_updated
];
o_time
=
[
self
getCurrentTimeAsString
:
p_input
];
o_time
=
[
[
VLCStringUtility
sharedInstance
]
getCurrentTimeAsString
:
p_input
negative
:[
o_time_fld
timeRemaining
]
];
[
o_time_fld
setStringValue
:
o_time
];
[
o_fspanel
setStreamPos
:
f_updated
andTime
:
o_time
];
vlc_object_release
(
p_input
);
...
...
@@ -1516,27 +1514,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_splitview_removed
=
NO
;
}
-
(
NSString
*
)
getCurrentTimeAsString
:(
input_thread_t
*
)
p_input
{
assert
(
p_input
!=
nil
);
vlc_value_t
time
;
char
psz_time
[
MSTRTIME_MAX_SIZE
];
var_Get
(
p_input
,
"time"
,
&
time
);
mtime_t
dur
=
input_item_GetDuration
(
input_GetItem
(
p_input
)
);
if
(
[
o_time_fld
timeRemaining
]
&&
dur
>
0
)
{
mtime_t
remaining
=
0
;
if
(
dur
>
time
.
i_time
)
remaining
=
dur
-
time
.
i_time
;
return
[
NSString
stringWithFormat
:
@"-%s"
,
secstotimestr
(
psz_time
,
(
remaining
/
1000000
)
)];
}
else
return
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
(
time
.
i_time
/
1000000
)
)];
}
-
(
void
)
updateTimeSlider
{
input_thread_t
*
p_input
;
...
...
@@ -1551,7 +1528,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
f_updated
=
10000
.
*
pos
.
f_float
;
[
o_time_sld
setFloatValue
:
f_updated
];
o_time
=
[
self
getCurrentTimeAsString
:
p_input
];
o_time
=
[
[
VLCStringUtility
sharedInstance
]
getCurrentTimeAsString
:
p_input
negative
:[
o_time_fld
timeRemaining
]
];
mtime_t
dur
=
input_item_GetDuration
(
input_GetItem
(
p_input
)
);
if
(
dur
==
-
1
)
{
...
...
modules/gui/macosx/StringUtility.h
View file @
0d86a46b
...
...
@@ -40,6 +40,7 @@
-
(
char
*
)
delocalizeString
:(
NSString
*
)
psz
;
-
(
NSString
*
)
wrapString
:
(
NSString
*
)
o_in_string
toWidth
:
(
int
)
i_width
;
-
(
NSString
*
)
OSXStringKeyToString
:(
NSString
*
)
theString
;
-
(
NSString
*
)
getCurrentTimeAsString
:(
input_thread_t
*
)
p_input
negative
:(
BOOL
)
b_negative
;
-
(
NSString
*
)
VLCKeyToString
:(
NSString
*
)
theString
;
-
(
unsigned
int
)
VLCModifiersToCocoa
:(
NSString
*
)
theString
;
...
...
modules/gui/macosx/StringUtility.m
View file @
0d86a46b
...
...
@@ -24,9 +24,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <vlc_input.h>
#import <vlc_keys.h>
#import "StringUtility.h"
#import "intf.h"
#import <vlc_keys.h>
@implementation
VLCStringUtility
...
...
@@ -183,6 +184,27 @@ static VLCStringUtility *_o_sharedInstance = nil;
return
theString
;
}
-
(
NSString
*
)
getCurrentTimeAsString
:(
input_thread_t
*
)
p_input
negative
:(
BOOL
)
b_negative
{
assert
(
p_input
!=
nil
);
vlc_value_t
time
;
char
psz_time
[
MSTRTIME_MAX_SIZE
];
var_Get
(
p_input
,
"time"
,
&
time
);
mtime_t
dur
=
input_item_GetDuration
(
input_GetItem
(
p_input
)
);
if
(
b_negative
&&
dur
>
0
)
{
mtime_t
remaining
=
0
;
if
(
dur
>
time
.
i_time
)
remaining
=
dur
-
time
.
i_time
;
return
[
NSString
stringWithFormat
:
@"-%s"
,
secstotimestr
(
psz_time
,
(
remaining
/
1000000
)
)];
}
else
return
[
NSString
stringWithUTF8String
:
secstotimestr
(
psz_time
,
(
time
.
i_time
/
1000000
)
)];
}
#pragma mark -
#pragma mark Key Shortcuts
...
...
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