Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
caf9c00b
Commit
caf9c00b
authored
Jul 26, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Settings: Allow Int and Double widget to have editable boundaries.
parent
6477c350
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
8 deletions
+62
-8
src/Gui/settings/DoubleWidget.cpp
src/Gui/settings/DoubleWidget.cpp
+7
-0
src/Gui/settings/IntWidget.cpp
src/Gui/settings/IntWidget.cpp
+7
-0
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp
+8
-4
src/Settings/SettingValue.cpp
src/Settings/SettingValue.cpp
+21
-0
src/Settings/SettingValue.h
src/Settings/SettingValue.h
+7
-0
src/Settings/SettingsManager.cpp
src/Settings/SettingsManager.cpp
+11
-3
src/Settings/SettingsManager.h
src/Settings/SettingsManager.h
+1
-1
No files found.
src/Gui/settings/DoubleWidget.cpp
View file @
caf9c00b
...
...
@@ -32,6 +32,13 @@ DoubleWidget::DoubleWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
changed
(
s
->
get
()
);
connect
(
s
,
SIGNAL
(
changed
(
const
QVariant
&
)
),
this
,
SLOT
(
changed
(
const
QVariant
&
)
)
);
if
(
(
s
->
flags
()
&
SettingValue
::
Clamped
)
!=
0
)
{
if
(
s
->
min
().
isValid
()
)
m_spinbox
->
setMinimum
(
s
->
min
().
toDouble
()
);
if
(
s
->
max
().
isValid
()
)
m_spinbox
->
setMaximum
(
s
->
max
().
toDouble
()
);
}
}
QWidget
*
...
...
src/Gui/settings/IntWidget.cpp
View file @
caf9c00b
...
...
@@ -31,6 +31,13 @@ IntWidget::IntWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
m_spinbox
=
new
QSpinBox
(
parent
);
connect
(
s
,
SIGNAL
(
changed
(
const
QVariant
&
)
),
this
,
SLOT
(
changed
(
const
QVariant
&
)
)
);
if
(
(
s
->
flags
()
&
SettingValue
::
Clamped
)
!=
0
)
{
if
(
s
->
min
().
isValid
()
)
m_spinbox
->
setMinimum
(
s
->
min
().
toInt
()
);
if
(
s
->
max
().
isValid
()
)
m_spinbox
->
setMaximum
(
s
->
max
().
toInt
()
);
}
changed
(
s
->
get
()
);
}
...
...
src/Project/ProjectManager.cpp
View file @
caf9c00b
...
...
@@ -49,12 +49,16 @@ ProjectManager::ProjectManager() : m_projectFile( NULL ), m_needSave( false )
VLMC_CREATE_PROJECT_DOUBLE
(
"video/VLMCOutputFPS"
,
29.97
,
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Output video FPS"
),
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Frame Per Second used when previewing and rendering the project"
)
);
VLMC_CREATE_PROJECT_INT
(
"video/VideoProjectWidth"
,
480
,
SettingValue
*
width
=
VLMC_CREATE_PROJECT_VAR
(
SettingValue
::
Int
,
"video/VideoProjectWidth"
,
480
,
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Video width"
),
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Width resolution of the output video"
)
);
VLMC_CREATE_PROJECT_INT
(
"video/VideoProjectHeight"
,
300
,
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Width resolution of the output video"
),
SettingValue
::
Clamped
);
width
->
setLimits
(
0
,
2048
);
SettingValue
*
height
=
VLMC_CREATE_PROJECT_VAR
(
SettingValue
::
Int
,
"video/VideoProjectHeight"
,
300
,
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Video height"
),
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Height resolution of the output video"
)
);
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Height resolution of the output video"
),
SettingValue
::
Clamped
);
height
->
setLimits
(
0
,
2048
);
VLMC_CREATE_PROJECT_INT
(
"audio/AudioSampleRate"
,
0
,
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Audio samplerate"
),
QT_TRANSLATE_NOOP
(
"PreferenceWidget"
,
"Output project audio samplerate"
)
);
...
...
src/Settings/SettingValue.cpp
View file @
caf9c00b
...
...
@@ -79,3 +79,24 @@ SettingValue::flags() const
{
return
m_flags
;
}
void
SettingValue
::
setLimits
(
const
QVariant
&
min
,
const
QVariant
&
max
)
{
if
(
min
.
isValid
()
==
true
)
m_min
=
min
;
if
(
max
.
isValid
()
==
true
)
m_max
=
max
;
}
const
QVariant
&
SettingValue
::
min
()
const
{
return
m_min
;
}
const
QVariant
&
SettingValue
::
max
()
const
{
return
m_max
;
}
src/Settings/SettingValue.h
View file @
caf9c00b
...
...
@@ -53,6 +53,7 @@ class SettingValue : public QObject
/// If this flag is used, then the variable should not be shown in the config widgets.
Private
=
1
<<
0
,
Password
=
1
<<
1
,
Clamped
=
1
<<
2
,
///< When used, the m_min and m_max will be used
};
/**
...
...
@@ -88,6 +89,10 @@ class SettingValue : public QObject
Type
type
()
const
;
Flags
flags
()
const
;
void
setLimits
(
const
QVariant
&
min
,
const
QVariant
&
max
);
const
QVariant
&
min
()
const
;
const
QVariant
&
max
()
const
;
private:
/**
* \brief the QVariant containingthe value of the settings
...
...
@@ -98,6 +103,8 @@ class SettingValue : public QObject
const
char
*
m_desc
;
Type
m_type
;
Flags
m_flags
;
QVariant
m_min
;
QVariant
m_max
;
signals:
/**
* \brief This signal is emmited while the m_val
...
...
src/Settings/SettingsManager.cpp
View file @
caf9c00b
...
...
@@ -227,7 +227,7 @@ SettingsManager::load( const QDomElement &root )
return
true
;
}
void
SettingValue
*
SettingsManager
::
createVar
(
SettingValue
::
Type
type
,
const
QString
&
key
,
const
QVariant
&
defaultValue
,
const
char
*
name
,
const
char
*
desc
,
SettingsManager
::
Type
varType
/*= Vlmc*/
,
...
...
@@ -235,12 +235,20 @@ SettingsManager::createVar( SettingValue::Type type, const QString &key,
{
QWriteLocker
wlock
(
&
m_rwLock
);
SettingValue
*
val
=
NULL
;
if
(
varType
==
Vlmc
&&
getPair
(
m_classicSettings
,
key
)
==
m_classicSettings
.
end
()
)
m_classicSettings
.
push_back
(
Pair
(
key
,
new
SettingValue
(
type
,
defaultValue
,
name
,
desc
,
flags
)
)
);
{
val
=
new
SettingValue
(
type
,
defaultValue
,
name
,
desc
,
flags
);
m_classicSettings
.
push_back
(
Pair
(
key
,
val
)
);
}
else
if
(
varType
==
Project
&&
getPair
(
m_xmlSettings
,
key
)
==
m_xmlSettings
.
end
()
)
m_xmlSettings
.
push_back
(
Pair
(
key
,
new
SettingValue
(
type
,
defaultValue
,
name
,
desc
,
flags
)
)
);
{
val
=
new
SettingValue
(
type
,
defaultValue
,
name
,
desc
,
flags
);
m_xmlSettings
.
push_back
(
Pair
(
key
,
val
)
);
}
else
Q_ASSERT_X
(
false
,
__FILE__
,
"creating an already created variable"
);
return
val
;
}
SettingsManager
::
Pair
::
Pair
(
const
QString
&
_key
,
SettingValue
*
_value
)
:
...
...
src/Settings/SettingsManager.h
View file @
caf9c00b
...
...
@@ -125,7 +125,7 @@ class SettingsManager : public QObject, public Singleton<SettingsManager>
SettingList
group
(
const
QString
&
groupName
,
SettingsManager
::
Type
type
=
Vlmc
);
void
createVar
(
SettingValue
::
Type
type
,
const
QString
&
key
,
SettingValue
*
createVar
(
SettingValue
::
Type
type
,
const
QString
&
key
,
const
QVariant
&
defaultValue
,
const
char
*
name
,
const
char
*
desc
,
Type
varType
=
Vlmc
,
...
...
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