Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
c35da63e
Commit
c35da63e
authored
Oct 30, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: implement the color selector button
parent
b2202ed4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
8 deletions
+99
-8
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.cpp
+74
-3
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/preferences_widgets.hpp
+25
-5
No files found.
modules/gui/qt4/components/preferences_widgets.cpp
View file @
c35da63e
/*****************************************************************************
/*****************************************************************************
* preferences_widgets.cpp : Widgets for preferences displays
* preferences_widgets.cpp : Widgets for preferences displays
****************************************************************************
****************************************************************************
* Copyright (C) 2006-20
07
the VideoLAN team
* Copyright (C) 2006-20
11
the VideoLAN team
* $Id$
* $Id$
*
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Clément Stenac <zorglub@videolan.org>
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
#include <QSignalMapper>
#include <QSignalMapper>
#include <QDialogButtonBox>
#include <QDialogButtonBox>
#include <QKeyEvent>
#include <QKeyEvent>
#include <QColorDialog>
#define MINWIDTH_BOX 90
#define MINWIDTH_BOX 90
#define LAST_COLUMN 10
#define LAST_COLUMN 10
...
@@ -113,6 +114,9 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
...
@@ -113,6 +114,9 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
p_control
=
new
StringListConfigControl
(
p_this
,
p_item
,
p_control
=
new
StringListConfigControl
(
p_this
,
p_item
,
parent
,
l
,
line
);
parent
,
l
,
line
);
break
;
break
;
case
CONFIG_ITEM_RGB
:
p_control
=
new
ColorConfigControl
(
p_this
,
p_item
,
parent
,
l
,
line
);
break
;
case
CONFIG_ITEM_INTEGER
:
case
CONFIG_ITEM_INTEGER
:
if
(
p_item
->
i_list
)
if
(
p_item
->
i_list
)
p_control
=
new
IntegerListConfigControl
(
p_this
,
p_item
,
p_control
=
new
IntegerListConfigControl
(
p_this
,
p_item
,
...
@@ -167,7 +171,7 @@ InterfacePreviewWidget::InterfacePreviewWidget ( QWidget *parent ) : QLabel( par
...
@@ -167,7 +171,7 @@ InterfacePreviewWidget::InterfacePreviewWidget ( QWidget *parent ) : QLabel( par
void
InterfacePreviewWidget
::
setNormalPreview
(
bool
b_minimal
)
void
InterfacePreviewWidget
::
setNormalPreview
(
bool
b_minimal
)
{
{
setPreview
(
(
b_minimal
)
?
MINIMAL
:
COMPLETE
);
setPreview
(
(
b_minimal
)
?
MINIMAL
:
COMPLETE
);
}
}
void
InterfacePreviewWidget
::
setPreview
(
enum_style
e_style
)
void
InterfacePreviewWidget
::
setPreview
(
enum_style
e_style
)
...
@@ -193,7 +197,6 @@ void InterfacePreviewWidget::setPreview( enum_style e_style )
...
@@ -193,7 +197,6 @@ void InterfacePreviewWidget::setPreview( enum_style e_style )
}
}
/**************************************************************************
/**************************************************************************
* String-based controls
* String-based controls
*************************************************************************/
*************************************************************************/
...
@@ -1113,6 +1116,74 @@ int BoolConfigControl::getValue() const
...
@@ -1113,6 +1116,74 @@ int BoolConfigControl::getValue() const
return
checkbox
->
isChecked
();
return
checkbox
->
isChecked
();
}
}
/************* Color *************/
ColorConfigControl
::
ColorConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QWidget
*
_parent
,
QGridLayout
*
l
,
int
line
)
:
VIntConfigControl
(
_p_this
,
_p_item
,
_parent
)
{
label
=
new
QLabel
;
color_but
=
new
QToolButton
;
finish
();
if
(
!
l
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
label
,
0
);
layout
->
addWidget
(
color_but
,
LAST_COLUMN
);
widget
->
setLayout
(
layout
);
}
else
{
l
->
addWidget
(
label
,
line
,
0
);
l
->
addWidget
(
color_but
,
line
,
LAST_COLUMN
,
Qt
::
AlignRight
);
}
}
ColorConfigControl
::
ColorConfigControl
(
vlc_object_t
*
_p_this
,
module_config_t
*
_p_item
,
QLabel
*
_label
,
QAbstractButton
*
_color
)
:
VIntConfigControl
(
_p_this
,
_p_item
)
{
label
=
_label
;
color_but
=
_color
;
finish
();
}
void
ColorConfigControl
::
finish
()
{
i_color
=
p_item
->
value
.
i
;
color_px
=
new
QPixmap
(
34
,
20
);
color_px
->
fill
(
QColor
(
i_color
)
);
color_but
->
setIcon
(
QIcon
(
*
color_px
)
);
color_but
->
setMinimumWidth
(
40
);
label
->
setText
(
qtr
(
p_item
->
psz_text
)
);
if
(
p_item
->
psz_longtext
)
{
label
->
setToolTip
(
formatTooltip
(
qtr
(
p_item
->
psz_longtext
))
);
color_but
->
setToolTip
(
formatTooltip
(
qtr
(
p_item
->
psz_longtext
))
);
}
BUTTONACT
(
color_but
,
selectColor
()
);
}
int
ColorConfigControl
::
getValue
()
const
{
return
i_color
;
}
void
ColorConfigControl
::
selectColor
()
{
QColor
color
=
QColorDialog
::
getColor
(
QColor
(
i_color
)
);
i_color
=
(
color
.
red
()
<<
16
)
+
(
color
.
green
()
<<
8
)
+
color
.
blue
();
color_px
->
fill
(
QColor
(
i_color
)
);
color_but
->
setIcon
(
QIcon
(
*
color_px
)
);
}
/**************************************************************************
/**************************************************************************
* Float-based controls
* Float-based controls
*************************************************************************/
*************************************************************************/
...
...
modules/gui/qt4/components/preferences_widgets.hpp
View file @
c35da63e
/*****************************************************************************
/*****************************************************************************
* preferences_widgets.hpp : Widgets for preferences panels
* preferences_widgets.hpp : Widgets for preferences panels
****************************************************************************
****************************************************************************
* Copyright (C) 2006-20
07
the VideoLAN team
* Copyright (C) 2006-20
11
the VideoLAN team
* $Id$
* $Id$
*
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Clément Stenac <zorglub@videolan.org>
...
@@ -75,7 +75,7 @@ public slots:
...
@@ -75,7 +75,7 @@ public slots:
* Variable controls
* Variable controls
*******************************************************/
*******************************************************/
class
ConfigControl
:
public
QObject
class
ConfigControl
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
public:
...
@@ -167,10 +167,10 @@ public:
...
@@ -167,10 +167,10 @@ public:
QLabel
*
,
QSlider
*
);
QLabel
*
,
QSlider
*
);
virtual
int
getValue
()
const
;
virtual
int
getValue
()
const
;
protected:
protected:
QSlider
*
slider
;
QSlider
*
slider
;
private:
private:
QLabel
*
label
;
QLabel
*
label
;
void
finish
();
void
finish
();
};
};
class
IntegerListConfigControl
:
public
VIntConfigControl
class
IntegerListConfigControl
:
public
VIntConfigControl
...
@@ -209,6 +209,26 @@ private:
...
@@ -209,6 +209,26 @@ private:
void
finish
();
void
finish
();
};
};
class
ColorConfigControl
:
public
VIntConfigControl
{
Q_OBJECT
public:
ColorConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QWidget
*
,
QGridLayout
*
,
int
);
ColorConfigControl
(
vlc_object_t
*
,
module_config_t
*
,
QLabel
*
,
QAbstractButton
*
);
virtual
~
ColorConfigControl
()
{
delete
color_px
;
}
virtual
int
getValue
()
const
;
private:
QLabel
*
label
;
QAbstractButton
*
color_but
;
QPixmap
*
color_px
;
int
i_color
;
void
finish
();
private
slots
:
void
selectColor
();
};
/*******************************************************
/*******************************************************
* Float-based controls
* Float-based controls
*******************************************************/
*******************************************************/
...
...
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