Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
562dfa38
Commit
562dfa38
authored
Apr 14, 2010
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Settings: Comply with the HACKING rules.
parent
5e6dc330
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
23 deletions
+28
-23
src/Gui/settings/Settings.cpp
src/Gui/settings/Settings.cpp
+20
-15
src/Gui/settings/Settings.h
src/Gui/settings/Settings.h
+8
-8
No files found.
src/Gui/settings/Settings.cpp
View file @
562dfa38
...
...
@@ -38,7 +38,7 @@
#include <QtDebug>
Settings
::
Settings
(
SettingsManager
::
Type
type
,
QWidget
*
parent
,
Qt
::
WindowFlags
f
)
:
Settings
::
Settings
(
SettingsManager
::
Type
type
,
QWidget
*
parent
,
Qt
::
WindowFlags
f
)
:
QDialog
(
parent
,
f
),
m_type
(
type
)
{
...
...
@@ -60,10 +60,11 @@ Settings::Settings( SettingsManager::Type type, QWidget* parent, Qt::WindowFlags
this
,
SLOT
(
switchWidget
(
int
)
)
);
}
void
Settings
::
addCategory
(
const
char
*
name
,
SettingsManager
::
Type
type
,
const
QIcon
&
icon
,
const
QString
&
label
)
void
Settings
::
addCategory
(
const
char
*
name
,
SettingsManager
::
Type
type
,
const
QIcon
&
icon
,
const
QString
&
label
)
{
PreferenceWidget
*
pWidget
=
new
PreferenceWidget
(
name
,
type
,
this
);
...
...
@@ -83,7 +84,7 @@ Settings::buildLayout()
m_panel
->
setMaximumWidth
(
130
);
// Create the master layout
QGridLayout
*
mLayout
=
new
QGridLayout
(
this
);
QGridLayout
*
mLayout
=
new
QGridLayout
(
this
);
mLayout
->
addWidget
(
m_panel
,
0
,
0
,
2
,
1
);
m_title
=
new
QLabel
(
this
);
...
...
@@ -100,21 +101,22 @@ Settings::buildLayout()
mLayout
->
addWidget
(
m_buttons
,
2
,
2
);
}
void
Settings
::
buttonClicked
(
QAbstractButton
*
button
)
void
Settings
::
buttonClicked
(
QAbstractButton
*
button
)
{
bool
save
=
false
;
bool
hide
=
false
;
switch
(
m_buttons
->
standardButton
(
button
)
)
{
case
QDialogButtonBox
::
Ok
:
case
QDialogButtonBox
::
Ok
:
save
=
true
;
hide
=
true
;
break
;
case
QDialogButtonBox
::
Cancel
:
case
QDialogButtonBox
::
Cancel
:
hide
=
true
;
break
;
case
QDialogButtonBox
::
Apply
:
case
QDialogButtonBox
::
Apply
:
save
=
true
;
break
;
default
:
...
...
@@ -133,7 +135,8 @@ void Settings::buttonClicked( QAbstractButton* button )
setVisible
(
false
);
}
void
Settings
::
switchWidget
(
int
index
)
void
Settings
::
switchWidget
(
int
index
)
{
m_stackedLayout
->
setCurrentIndex
(
index
);
...
...
@@ -141,7 +144,8 @@ void Settings::switchWidget( int index )
retranslateUi
();
}
void
Settings
::
changeEvent
(
QEvent
*
e
)
void
Settings
::
changeEvent
(
QEvent
*
e
)
{
switch
(
e
->
type
()
)
{
...
...
@@ -153,10 +157,11 @@ void Settings::changeEvent( QEvent *e )
}
}
void
Settings
::
retranslateUi
()
void
Settings
::
retranslateUi
()
{
PreferenceWidget
*
pWidget
=
qobject_cast
<
PreferenceWidget
*>
(
m_stackedLayout
->
widget
(
m_stackedLayout
->
currentIndex
()
)
);
PreferenceWidget
*
pWidget
=
qobject_cast
<
PreferenceWidget
*>
(
m_stackedLayout
->
widget
(
m_stackedLayout
->
currentIndex
()
)
);
Q_ASSERT
(
pWidget
!=
NULL
);
// Translate the category name using the current locale
...
...
src/Gui/settings/Settings.h
View file @
562dfa38
...
...
@@ -45,12 +45,12 @@ class Settings : public QDialog
Q_DISABLE_COPY
(
Settings
)
public:
Settings
(
SettingsManager
::
Type
type
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
f
=
0
);
Settings
(
SettingsManager
::
Type
type
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
f
=
0
);
void
addCategory
(
const
char
*
name
,
void
addCategory
(
const
char
*
name
,
SettingsManager
::
Type
type
,
const
QIcon
&
icon
,
const
QString
&
label
);
const
QIcon
&
icon
,
const
QString
&
label
);
protected:
void
changeEvent
(
QEvent
*
e
);
...
...
@@ -59,9 +59,9 @@ class Settings : public QDialog
void
retranslateUi
();
private:
QDialogButtonBox
*
m_buttons
;
Panel
*
m_panel
;
QLabel
*
m_title
;
QDialogButtonBox
*
m_buttons
;
Panel
*
m_panel
;
QLabel
*
m_title
;
QStackedLayout
*
m_stackedLayout
;
SettingsManager
::
Type
m_type
;
...
...
@@ -69,7 +69,7 @@ class Settings : public QDialog
void
switchWidget
(
int
index
);
private
slots
:
void
buttonClicked
(
QAbstractButton
*
button
);
void
buttonClicked
(
QAbstractButton
*
button
);
signals:
void
loadSettings
();
...
...
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