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
423d20a0
Commit
423d20a0
authored
Aug 26, 2012
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: simplify preferences handling
parent
ddf2c24d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+21
-18
No files found.
modules/gui/macosx/intf.m
View file @
423d20a0
...
...
@@ -1656,10 +1656,11 @@ static VLCMain *_o_sharedMainInstance = nil;
NSDirectoryEnumerator
*
direnum
=
[[
NSFileManager
defaultManager
]
enumeratorAtPath
:
crashReporter
];
NSString
*
fname
;
NSString
*
latestLog
=
nil
;
int
year
=
!
previouslySeen
?
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"LatestCrashReportYear"
]
:
0
;
int
month
=
!
previouslySeen
?
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"LatestCrashReportMonth"
]:
0
;
int
day
=
!
previouslySeen
?
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"LatestCrashReportDay"
]
:
0
;
int
hours
=
!
previouslySeen
?
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"LatestCrashReportHours"
]:
0
;
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
int
year
=
!
previouslySeen
?
[
defaults
integerForKey
:
@"LatestCrashReportYear"
]
:
0
;
int
month
=
!
previouslySeen
?
[
defaults
integerForKey
:
@"LatestCrashReportMonth"
]:
0
;
int
day
=
!
previouslySeen
?
[
defaults
integerForKey
:
@"LatestCrashReportDay"
]
:
0
;
int
hours
=
!
previouslySeen
?
[
defaults
integerForKey
:
@"LatestCrashReportHours"
]:
0
;
while
(
fname
=
[
direnum
nextObject
])
{
...
...
@@ -1694,10 +1695,10 @@ static VLCMain *_o_sharedMainInstance = nil;
if
(
!
previouslySeen
)
{
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
year
forKey
:
@"LatestCrashReportYear"
];
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
month
forKey
:
@"LatestCrashReportMonth"
];
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
day
forKey
:
@"LatestCrashReportDay"
];
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
hours
forKey
:
@"LatestCrashReportHours"
];
[
defaults
setInteger
:
year
forKey
:
@"LatestCrashReportYear"
];
[
defaults
setInteger
:
month
forKey
:
@"LatestCrashReportMonth"
];
[
defaults
setInteger
:
day
forKey
:
@"LatestCrashReportDay"
];
[
defaults
setInteger
:
hours
forKey
:
@"LatestCrashReportHours"
];
}
return
latestLog
;
}
...
...
@@ -1711,13 +1712,14 @@ static VLCMain *_o_sharedMainInstance = nil;
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
// This pref key doesn't exists? this VLC is an upgrade, and this crash log come from previous version
BOOL
areCrashLogsTooOld
=
!
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"LatestCrashReportYear"
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
BOOL
areCrashLogsTooOld
=
!
[
defaults
integerForKey
:
@"LatestCrashReportYear"
];
NSString
*
latestLog
=
[
self
latestCrashLogPathPreviouslySeen
:
NO
];
if
(
latestLog
&&
!
areCrashLogsTooOld
)
{
if
([
[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"AlwaysSendCrashReports"
]
>
0
)
if
([
defaults
integerForKey
:
@"AlwaysSendCrashReports"
]
>
0
)
[
self
sendCrashLog
:[
NSString
stringWithContentsOfFile
:
[
self
latestCrashLogPath
]
encoding
:
NSUTF8StringEncoding
error
:
NULL
]
withUserComment
:
[
o_crashrep_fld
string
]];
else
if
([
[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
@"AlwaysSendCrashReports"
]
==
0
)
else
if
([
defaults
integerForKey
:
@"AlwaysSendCrashReports"
]
==
0
)
[
NSApp
runModalForWindow
:
o_crashrep_win
];
// bail out, the user doesn't want us to send reports
}
...
...
@@ -1760,13 +1762,14 @@ static VLCMain *_o_sharedMainInstance = nil;
{
static
NSString
*
kVLCPreferencesVersion
=
@"VLCPreferencesVersion"
;
static
const
int
kCurrentPreferencesVersion
=
2
;
int
version
=
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
kVLCPreferencesVersion
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
int
version
=
[
defaults
integerForKey
:
kVLCPreferencesVersion
];
if
(
version
>=
kCurrentPreferencesVersion
)
return
;
if
(
version
==
1
)
{
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
[
NSUserDefaults
standardUserDefaults
]
synchronize
];
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
defaults
synchronize
];
if
(
!
[[
VLCCoreInteraction
sharedInstance
]
fixPreferences
])
return
;
...
...
@@ -1784,7 +1787,7 @@ static VLCMain *_o_sharedMainInstance = nil;
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
preferences
stringByAppendingPathComponent
:
@"org.videolan.vlc"
]]
&&
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
preferences
stringByAppendingPathComponent
:
@"org.videolan.vlc.plist"
]]
)
{
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
return
;
}
...
...
@@ -1793,7 +1796,7 @@ static VLCMain *_o_sharedMainInstance = nil;
_NS
(
"Move To Trash and Relaunch VLC"
),
_NS
(
"Ignore"
),
nil
,
nil
);
if
(
res
!=
NSOKButton
)
{
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
return
;
}
...
...
@@ -1805,8 +1808,8 @@ static VLCMain *_o_sharedMainInstance = nil;
/* really reset the defaults from now on */
[
NSUserDefaults
resetStandardUserDefaults
];
[
[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
[
NSUserDefaults
standardUserDefaults
]
synchronize
];
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
defaults
synchronize
];
}
/* Relaunch now */
...
...
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