Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
e41e1a7d
Commit
e41e1a7d
authored
Dec 07, 2012
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: better unsetting of keys in preferences
Close #6640
parent
14793f5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.cpp
+20
-9
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/preferences_widgets.hpp
+4
-1
No files found.
modules/gui/qt4/components/preferences_widgets.cpp
View file @
e41e1a7d
...
@@ -1202,8 +1202,8 @@ void KeySelectorControl::finish()
...
@@ -1202,8 +1202,8 @@ void KeySelectorControl::finish()
QString
keys
=
qfu
(
p_config_item
->
value
.
psz
);
QString
keys
=
qfu
(
p_config_item
->
value
.
psz
);
treeItem
->
setText
(
1
,
keys
);
treeItem
->
setText
(
1
,
keys
);
treeItem
->
setToolTip
(
1
,
qtr
(
"Double click to change"
)
);
treeItem
->
setToolTip
(
1
,
qtr
(
"Double click to change
.
\n
Delete key to remove.
"
)
);
treeItem
->
setToolTip
(
2
,
qtr
(
"Double click to change"
)
);
treeItem
->
setToolTip
(
2
,
qtr
(
"Double click to change
.
\n
Delete key to remove.
"
)
);
treeItem
->
setData
(
1
,
Qt
::
UserRole
,
QVariant
(
keys
)
);
treeItem
->
setData
(
1
,
Qt
::
UserRole
,
QVariant
(
keys
)
);
table
->
addTopLevelItem
(
treeItem
);
table
->
addTopLevelItem
(
treeItem
);
continue
;
continue
;
...
@@ -1285,9 +1285,8 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column )
...
@@ -1285,9 +1285,8 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column )
if
(
(
keyItem
!=
it
)
&&
if
(
(
keyItem
!=
it
)
&&
(
it
->
data
(
1
+
b_global
,
Qt
::
UserRole
).
toString
()
==
newKey
)
)
(
it
->
data
(
1
+
b_global
,
Qt
::
UserRole
).
toString
()
==
newKey
)
)
{
{
it
->
setData
(
1
+
b_global
,
Qt
::
UserRole
,
it
->
setText
(
1
+
b_global
,
NULL
);
QVariant
(
qfu
(
"Unset"
)
)
);
it
->
setData
(
1
+
b_global
,
Qt
::
UserRole
,
QVariant
()
);
it
->
setText
(
1
+
b_global
,
qtr
(
"Unset"
)
);
}
}
}
}
}
}
...
@@ -1295,6 +1294,12 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column )
...
@@ -1295,6 +1294,12 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem, int column )
keyItem
->
setText
(
column
,
newKey
);
keyItem
->
setText
(
column
,
newKey
);
keyItem
->
setData
(
column
,
Qt
::
UserRole
,
newKey
);
keyItem
->
setData
(
column
,
Qt
::
UserRole
,
newKey
);
}
}
else
if
(
d
->
result
()
==
2
)
{
keyItem
->
setText
(
1
+
b_global
,
NULL
);
keyItem
->
setData
(
1
+
b_global
,
Qt
::
UserRole
,
QVariant
()
);
}
delete
d
;
delete
d
;
}
}
...
@@ -1376,18 +1381,21 @@ KeyInputDialog::KeyInputDialog( QTreeWidget *_table,
...
@@ -1376,18 +1381,21 @@ KeyInputDialog::KeyInputDialog( QTreeWidget *_table,
warning
->
hide
();
warning
->
hide
();
vLayout
->
insertWidget
(
1
,
warning
);
vLayout
->
insertWidget
(
1
,
warning
);
buttonBox
=
new
QDialogButtonBox
;
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
;
QPushButton
*
ok
=
new
QPushButton
(
qtr
(
"Assign"
)
);
ok
=
new
QPushButton
(
qtr
(
"Assign"
)
);
QPushButton
*
cancel
=
new
QPushButton
(
qtr
(
"Cancel"
)
);
QPushButton
*
cancel
=
new
QPushButton
(
qtr
(
"Cancel"
)
);
unset
=
new
QPushButton
(
qtr
(
"Unset"
)
);
buttonBox
->
addButton
(
ok
,
QDialogButtonBox
::
AcceptRole
);
buttonBox
->
addButton
(
ok
,
QDialogButtonBox
::
AcceptRole
);
buttonBox
->
addButton
(
unset
,
QDialogButtonBox
::
ActionRole
);
buttonBox
->
addButton
(
cancel
,
QDialogButtonBox
::
RejectRole
);
buttonBox
->
addButton
(
cancel
,
QDialogButtonBox
::
RejectRole
);
ok
->
setDefault
(
true
);
ok
->
setDefault
(
true
);
vLayout
->
addWidget
(
buttonBox
);
vLayout
->
addWidget
(
buttonBox
);
buttonBox
->
hide
();
ok
->
hide
();
CONNECT
(
buttonBox
,
accepted
(),
this
,
accept
()
);
CONNECT
(
buttonBox
,
accepted
(),
this
,
accept
()
);
CONNECT
(
buttonBox
,
rejected
(),
this
,
reject
()
);
CONNECT
(
buttonBox
,
rejected
(),
this
,
reject
()
);
BUTTONACT
(
unset
,
unsetAction
()
);
}
}
void
KeyInputDialog
::
checkForConflicts
(
int
i_vlckey
)
void
KeyInputDialog
::
checkForConflicts
(
int
i_vlckey
)
...
@@ -1403,7 +1411,8 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
...
@@ -1403,7 +1411,8 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
warning
->
setText
(
qtr
(
"Warning: this key or combination is already assigned to "
)
+
warning
->
setText
(
qtr
(
"Warning: this key or combination is already assigned to "
)
+
QString
(
"
\"
<b>%1</b>
\"
"
).
arg
(
conflictList
[
0
]
->
text
(
0
)
)
);
QString
(
"
\"
<b>%1</b>
\"
"
).
arg
(
conflictList
[
0
]
->
text
(
0
)
)
);
warning
->
show
();
warning
->
show
();
buttonBox
->
show
();
ok
->
show
();
unset
->
hide
();
conflicts
=
true
;
conflicts
=
true
;
}
}
...
@@ -1433,3 +1442,5 @@ void KeyInputDialog::wheelEvent( QWheelEvent *e )
...
@@ -1433,3 +1442,5 @@ void KeyInputDialog::wheelEvent( QWheelEvent *e )
checkForConflicts
(
i_vlck
);
checkForConflicts
(
i_vlck
);
keyValue
=
i_vlck
;
keyValue
=
i_vlck
;
}
}
void
KeyInputDialog
::
unsetAction
()
{
done
(
2
);
};
modules/gui/qt4/components/preferences_widgets.hpp
View file @
e41e1a7d
...
@@ -512,6 +512,7 @@ private slots:
...
@@ -512,6 +512,7 @@ private slots:
class
KeyInputDialog
:
public
QDialog
class
KeyInputDialog
:
public
QDialog
{
{
Q_OBJECT
public:
public:
KeyInputDialog
(
QTreeWidget
*
,
const
QString
&
,
QWidget
*
,
bool
b_global
=
false
);
KeyInputDialog
(
QTreeWidget
*
,
const
QString
&
,
QWidget
*
,
bool
b_global
=
false
);
int
keyValue
;
int
keyValue
;
...
@@ -520,11 +521,13 @@ public:
...
@@ -520,11 +521,13 @@ public:
private:
private:
QTreeWidget
*
table
;
QTreeWidget
*
table
;
QLabel
*
selected
,
*
warning
;
QLabel
*
selected
,
*
warning
;
Q
DialogButtonBox
*
buttonBox
;
Q
PushButton
*
ok
,
*
unset
;
void
checkForConflicts
(
int
i_vlckey
);
void
checkForConflicts
(
int
i_vlckey
);
void
keyPressEvent
(
QKeyEvent
*
);
void
keyPressEvent
(
QKeyEvent
*
);
void
wheelEvent
(
QWheelEvent
*
);
void
wheelEvent
(
QWheelEvent
*
);
bool
b_global
;
bool
b_global
;
private
slots
:
void
unsetAction
();
};
};
#endif
#endif
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