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
9de1b1e3
Commit
9de1b1e3
authored
Feb 13, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: add extended Latin-1 and a few multimedia keys, binary search
parent
74ec041d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
52 deletions
+157
-52
modules/gui/qt4/util/customwidgets.cpp
modules/gui/qt4/util/customwidgets.cpp
+157
-52
No files found.
modules/gui/qt4/util/customwidgets.cpp
View file @
9de1b1e3
...
@@ -40,9 +40,8 @@
...
@@ -40,9 +40,8 @@
#include <QStyle>
#include <QStyle>
#include <QStyleOption>
#include <QStyleOption>
#include <vlc_intf_strings.h>
#include <vlc_intf_strings.h>
#include <vlc_keys.h>
#include <vlc_keys.h>
#include <wctype.h>
/* twolower() */
ClickLineEdit
::
ClickLineEdit
(
const
QString
&
msg
,
QWidget
*
parent
)
:
QLineEdit
(
parent
)
ClickLineEdit
::
ClickLineEdit
(
const
QString
&
msg
,
QWidget
*
parent
)
:
QLineEdit
(
parent
)
{
{
...
@@ -222,61 +221,167 @@ int qtKeyModifiersToVLC( QInputEvent* e )
...
@@ -222,61 +221,167 @@ int qtKeyModifiersToVLC( QInputEvent* e )
return
i_keyModifiers
;
return
i_keyModifiers
;
}
}
int
qtEventToVLCKey
(
QKeyEvent
*
e
)
typedef
struct
{
{
int
i_vlck
=
0
;
int
qt
;
/* Handle modifiers */
uint32_t
vlc
;
i_vlck
|=
qtKeyModifiersToVLC
(
e
)
;
}
vlc_qt_key_t
;
bool
found
=
false
;
static
const
vlc_qt_key_t
keys
[]
=
/* Look for some special keys */
{
#define HANDLE( qt, vk ) case Qt::qt : i_vlck |= vk; found = true;break
{
Qt
::
Key_Escape
,
KEY_ESC
},
switch
(
e
->
key
()
)
{
Qt
::
Key_Tab
,
'\t'
,
},
{
// Qt::Key_Backtab
HANDLE
(
Key_Left
,
KEY_LEFT
);
{
Qt
::
Key_Backspace
,
'\b'
},
HANDLE
(
Key_Right
,
KEY_RIGHT
);
{
Qt
::
Key_Return
,
'\r'
},
HANDLE
(
Key_Up
,
KEY_UP
);
{
Qt
::
Key_Enter
,
'\r'
},
// numeric pad
HANDLE
(
Key_Down
,
KEY_DOWN
);
{
Qt
::
Key_Insert
,
KEY_INSERT
},
HANDLE
(
Key_Space
,
' '
);
{
Qt
::
Key_Delete
,
KEY_DELETE
},
HANDLE
(
Key_Escape
,
KEY_ESC
);
// Qt::Key_Pause
HANDLE
(
Key_Return
,
KEY_ENTER
);
// Qt::Key_Print
HANDLE
(
Key_Enter
,
KEY_ENTER
);
// Qt::Key_SysReq
HANDLE
(
Key_F1
,
KEY_F1
);
// Qt::Key_Clear
HANDLE
(
Key_F2
,
KEY_F2
);
{
Qt
::
Key_Home
,
KEY_HOME
},
HANDLE
(
Key_F3
,
KEY_F3
);
{
Qt
::
Key_End
,
KEY_END
},
HANDLE
(
Key_F4
,
KEY_F4
);
{
Qt
::
Key_Left
,
KEY_LEFT
},
HANDLE
(
Key_F5
,
KEY_F5
);
{
Qt
::
Key_Up
,
KEY_UP
},
HANDLE
(
Key_F6
,
KEY_F6
);
{
Qt
::
Key_Right
,
KEY_RIGHT
},
HANDLE
(
Key_F7
,
KEY_F7
);
{
Qt
::
Key_Down
,
KEY_DOWN
},
HANDLE
(
Key_F8
,
KEY_F8
);
{
Qt
::
Key_PageUp
,
KEY_PAGEUP
},
HANDLE
(
Key_F9
,
KEY_F9
);
{
Qt
::
Key_PageDown
,
KEY_PAGEDOWN
},
HANDLE
(
Key_F10
,
KEY_F10
);
// Qt::Key_Shift
HANDLE
(
Key_F11
,
KEY_F11
);
// Qt::Key_Control
HANDLE
(
Key_F12
,
KEY_F12
);
// Qt::Key_Meta
HANDLE
(
Key_PageUp
,
KEY_PAGEUP
);
// Qt::Key_Alt
HANDLE
(
Key_PageDown
,
KEY_PAGEDOWN
);
// Qt::Key_CapsLock
HANDLE
(
Key_Home
,
KEY_HOME
);
// Qt::Key_NumLock
HANDLE
(
Key_End
,
KEY_END
);
// Qt::Key_ScrollLock
HANDLE
(
Key_Insert
,
KEY_INSERT
);
/* F1 - F35 */
HANDLE
(
Key_Delete
,
KEY_DELETE
);
// Qt::Key_Super_L
HANDLE
(
Key_VolumeDown
,
KEY_VOLUME_DOWN
);
// Qt::Key_Super_R
HANDLE
(
Key_VolumeUp
,
KEY_VOLUME_UP
);
{
Qt
::
Key_Menu
,
KEY_MENU
},
HANDLE
(
Key_VolumeMute
,
KEY_VOLUME_MUTE
);
// Qt::Key_Hyper_L
HANDLE
(
Key_MediaPlay
,
KEY_MEDIA_PLAY_PAUSE
);
// Qt::Key_Hyper_R
HANDLE
(
Key_MediaStop
,
KEY_MEDIA_STOP
);
// Qt::Key_Help
HANDLE
(
Key_MediaPrevious
,
KEY_MEDIA_PREV_TRACK
);
// Qt::Key_Direction_L
HANDLE
(
Key_MediaNext
,
KEY_MEDIA_NEXT_TRACK
);
// Qt::Key_Direction_R
// Qt::Key_Multi_key
// Qt::Key_Codeinput
// Qt::Key_SingleCandidate
// Qt::Key_MultipleCandidate
// Qt::Key_PreviousCandidate
// Qt::Key_Mode_switch
// Qt::Key_Kanji
// Qt::Key_Muhenkan
// Qt::Key_Henkan
// Qt::Key_Romaji
// Qt::Key_Hiragana
// Qt::Key_Katakana
// Qt::Key_Hiragana_Katakana
// Qt::Key_Zenkaku
// Qt::Key_Hankaku
// Qt::Key_Zenkaku_Hankaku
// Qt::Key_Touroku
// Qt::Key_Massyo
// Qt::Key_Kana_Lock
// Qt::Key_Kana_Shift
// Qt::Key_Eisu_Shift
// Qt::Key_Eisu_toggle
// Qt::Key_Hangul
// Qt::Key_Hangul_Start
// Qt::Key_Hangul_End
// Qt::Key_Hangul_Hanja
// Qt::Key_Hangul_Jamo
// Qt::Key_Hangul_Romaja
// Qt::Key_Hangul_Jeonja
// Qt::Key_Hangul_Banja
// Qt::Key_Hangul_PreHanja
// Qt::Key_Hangul_PostHanja
// Qt::Key_Hangul_Special
// Qt::Key_Dead_Grave
// Qt::Key_Dead_Acute
// Qt::Key_Dead_Circumflex
// Qt::Key_Dead_Tilde
// Qt::Key_Dead_Macron
// Qt::Key_Dead_Breve
// Qt::Key_Dead_Abovedot
// Qt::Key_Dead_Diaeresis
// Qt::Key_Dead_Abovering
// Qt::Key_Dead_Doubleacute
// Qt::Key_Dead_Caron
// Qt::Key_Dead_Cedilla
// Qt::Key_Dead_Ogonek
// Qt::Key_Dead_Iota
// Qt::Key_Dead_Voiced_Sound
// Qt::Key_Dead_Semivoiced_Sound
// Qt::Key_Dead_Belowdot
// Qt::Key_Dead_Hook
// Qt::Key_Dead_Horn
{
Qt
::
Key_Back
,
KEY_BROWSER_BACK
},
{
Qt
::
Key_Forward
,
KEY_BROWSER_FORWARD
},
{
Qt
::
Key_Stop
,
KEY_BROWSER_STOP
},
{
Qt
::
Key_Refresh
,
KEY_BROWSER_REFRESH
},
{
Qt
::
Key_VolumeDown
,
KEY_VOLUME_DOWN
},
{
Qt
::
Key_VolumeMute
,
KEY_VOLUME_MUTE
},
{
Qt
::
Key_VolumeUp
,
KEY_VOLUME_UP
},
// Qt::Key_BassBoost
// Qt::Key_BassUp
// Qt::Key_BassDown
// Qt::Key_TrebleUp
// Qt::Key_TrebleDown
{
Qt
::
Key_MediaPlay
,
KEY_MEDIA_PLAY_PAUSE
},
{
Qt
::
Key_MediaStop
,
KEY_MEDIA_STOP
},
{
Qt
::
Key_MediaPrevious
,
KEY_MEDIA_PREV_TRACK
},
{
Qt
::
Key_MediaNext
,
KEY_MEDIA_NEXT_TRACK
},
// Qt::Key_MediaRecord
{
Qt
::
Key_HomePage
,
KEY_BROWSER_HOME
},
{
Qt
::
Key_Favorites
,
KEY_BROWSER_FAVORITES
},
{
Qt
::
Key_Search
,
KEY_BROWSER_SEARCH
},
// Qt::Key_Standby
// Qt::Key_OpenUrl
// Qt::Key_LaunchMail
// Qt::Key_LaunchMedia
/* Qt::Key_Launch0 through Qt::Key_LaunchF */
// Qt::Key_MediaLast
};
static
int
keycmp
(
const
void
*
a
,
const
void
*
b
)
{
const
int
*
q
=
(
const
int
*
)
a
;
const
vlc_qt_key_t
*
m
=
(
const
vlc_qt_key_t
*
)
b
;
}
return
*
q
-
m
->
qt
;
if
(
!
found
)
}
int
qtEventToVLCKey
(
QKeyEvent
*
e
)
{
int
qtk
=
e
->
key
();
uint32_t
i_vlck
=
0
;
if
(
qtk
<=
0xff
)
/* VLC and X11 use lowercase whereas Qt uses uppercase */
#ifdef __STDC_ISO_10646__
i_vlck
=
towlower
(
qtk
);
#else
# error FIXME
#endif
else
/* Qt and X11 go to F35, but VLC stops at F12 */
if
(
qtk
>=
Qt
::
Key_F1
&&
qtk
<=
Qt
::
Key_F12
)
i_vlck
=
qtk
-
Qt
::
Key_F1
+
KEY_F1
;
else
{
{
/* Force lowercase */
const
vlc_qt_key_t
*
map
;
if
(
e
->
key
()
>=
Qt
::
Key_A
&&
e
->
key
()
<=
Qt
::
Key_Z
)
i_vlck
+=
e
->
key
()
+
32
;
map
=
(
const
vlc_qt_key_t
*
)
/* Rest of the ascii range */
bsearch
(
&
qtk
,
(
const
void
*
)
keys
,
sizeof
(
keys
)
/
sizeof
(
keys
[
0
]),
else
if
(
e
->
key
()
>=
Qt
::
Key_Space
&&
e
->
key
()
<=
Qt
::
Key_AsciiTilde
)
sizeof
(
*
keys
),
keycmp
);
i_vlck
+=
e
->
key
();
if
(
map
!=
NULL
)
i_vlck
=
map
->
vlc
;
}
}
/* Handle modifiers */
i_vlck
|=
qtKeyModifiersToVLC
(
e
);
return
i_vlck
;
return
i_vlck
;
}
}
...
...
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