Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
  • abdsaber000/vlc
  • falbrechtskirchinger/vlc
  • b.sullender/vlc
  • hulxv/vlc
  • zyad-ayad/vlc
  • shocknovaa/vlc
  • gremlinflat/vlc
  • Pratham24D/vlc
411 results
Show changes
Commits on Source (7)
Showing
with 467 additions and 313 deletions
......@@ -326,6 +326,7 @@ libqt_plugin_la_SOURCES = \
util/varcommon_p.hpp \
util/varchoicemodel.cpp util/varchoicemodel.hpp \
util/variables.cpp util/variables.hpp \
util/vlchotkeyconverter.cpp util/vlchotkeyconverter.hpp \
util/vlctick.cpp \
util/vlctick.hpp \
util/shared_input_item.hpp \
......@@ -497,6 +498,7 @@ nodist_libqt_plugin_la_SOURCES = \
util/vlctick.moc.cpp \
util/dismiss_popup_event_filter.moc.cpp \
util/list_selection_model.moc.cpp \
util/vlchotkeyconverter.moc.cpp \
widgets/native/animators.moc.cpp \
widgets/native/csdthemeimage.moc.cpp \
widgets/native/customwidgets.moc.cpp \
......
......@@ -36,7 +36,7 @@
#include "playlist/playlist_controller.hpp"
#include "menus/menus.hpp"
#include "util/qt_dirs.hpp"
#include "widgets/native/customwidgets.hpp" /* VLCKeyToString() */
#include "util/vlchotkeyconverter.hpp"
#include "maininterface/mainctx.hpp"
/* The dialogs */
......
......@@ -31,8 +31,8 @@
#endif
#include "dialogs/preferences/preferences_widgets.hpp"
#include "widgets/native/customwidgets.hpp"
#include "widgets/native/searchlineedit.hpp"
#include "util/vlchotkeyconverter.hpp"
#include "util/qt_dirs.hpp"
#include <vlc_intf_strings.h>
#include <vlc_modules.h>
......@@ -64,6 +64,7 @@
#include <QGuiApplication>
#include <QClipboard>
#include <QFont>
#include <QToolButton>
#define MINWIDTH_BOX 90
#define LAST_COLUMN 10
......@@ -1765,6 +1766,14 @@ KeyInputDialog::KeyInputDialog( QTreeWidget *table_,
conflicts = false;
existingkeys = NULL;
wheelConverter = new WheelToVLCConverter(this);
connect(wheelConverter, &WheelToVLCConverter::vlcWheelKey, this, [this](int i_vlck){
vlckey = VLCKeyToString( i_vlck, false );
vlckey_tr = VLCKeyToString( i_vlck, true );
selected->setText( qtr( "Key: <b>%1</b>" ).arg( vlckey_tr ) );
checkForConflicts( QString() );
});
bool global = ( column == KeySelectorControl::GLOBAL_HOTKEY_COL );
setWindowTitle( global ? qtr( "Global Hotkey change" )
......@@ -1864,11 +1873,7 @@ void KeyInputDialog::keyPressEvent( QKeyEvent *e )
void KeyInputDialog::wheelEvent( QWheelEvent *e )
{
int i_vlck = qtWheelEventToVLCKey( *e );
vlckey = VLCKeyToString( i_vlck, false );
vlckey_tr = VLCKeyToString( i_vlck, true );
selected->setText( qtr( "Key: <b>%1</b>" ).arg( vlckey_tr ) );
checkForConflicts( QString() );
wheelConverter->wheelEvent(e);
}
void KeyInputDialog::unsetAction() { done( 2 ); }
......
......@@ -53,6 +53,7 @@ class QPushButton;
class QFontComboBox;
class QSlider;
class QAbstractButton;
class WheelToVLCConverter;
/*******************************************************
* Simple widgets
......@@ -505,6 +506,7 @@ private:
QPushButton *ok, *unset;
KeyTableItem *keyItem;
enum KeySelectorControl::ColumnIndex column;
WheelToVLCConverter* wheelConverter;
void checkForConflicts( const QString &sequence );
void keyPressEvent( QKeyEvent *);
......
......@@ -36,7 +36,7 @@
#include "util/renderer_manager.hpp"
#include "util/csdbuttonmodel.hpp"
#include "widgets/native/customwidgets.hpp" // qtEventToVLCKey, QVLCStackedWidget
#include "util/vlchotkeyconverter.hpp"
#include "util/qt_dirs.hpp" // toNativeSeparators
#include "util/color_scheme_model.hpp"
......@@ -510,6 +510,11 @@ void MainCtx::sendHotkey(Qt::Key key , Qt::KeyboardModifiers modifiers)
var_SetInteger(vlc_object_instance(p_intf), "key-pressed", vlckey);
}
void MainCtx::sendVLCHotkey(int vlcHotkey)
{
var_SetInteger(vlc_object_instance(p_intf), "key-pressed", vlcHotkey);
}
void MainCtx::updateIntfScaleFactor()
{
m_intfScaleFactor = m_intfUserScaleFactor;
......
......@@ -431,6 +431,7 @@ public slots:
void setMinimalView(bool);
void sendHotkey(Qt::Key key, Qt::KeyboardModifiers modifiers );
void sendVLCHotkey(int vlcHotkey);
void emitBoss();
void emitRaise();
......
......@@ -50,6 +50,7 @@
#include "dialogs/help/aboutmodel.hpp"
#include "dialogs/dialogs_provider.hpp"
#include "dialogs/dialogs/dialogmodel.hpp"
#include "util/vlchotkeyconverter.hpp"
#include "network/networkmediamodel.hpp"
#include "network/networkdevicemodel.hpp"
......@@ -328,6 +329,7 @@ void MainUI::registerQMLTypes()
qmlRegisterSingletonInstance<SVGColorImage>(uri, versionMajor, versionMinor, "SVGColorImage", new SVGColorImage(this));
qmlRegisterSingletonInstance<VLCAccessImage>(uri, versionMajor, versionMinor, "VLCAccessImage", new VLCAccessImage(this));
qmlRegisterType<DelayEstimator>( uri, versionMajor, versionMinor, "DelayEstimator" );
qmlRegisterTypesAndRevisions<WheelToVLCConverter>( uri, versionMajor );
qmlRegisterType<ImageLuminanceExtractor>( uri, versionMajor, versionMinor, "ImageLuminanceExtractor");
......
......@@ -17,7 +17,7 @@
*****************************************************************************/
#include "videosurface.hpp"
#include "maininterface/mainctx.hpp"
#include "widgets/native/customwidgets.hpp" //for qtEventToVLCKey
#include "util/vlchotkeyconverter.hpp"
#include <QSGRectangleNode>
#include <QThreadPool>
#include <vlc_window.h>
......@@ -174,12 +174,11 @@ void VideoSurfaceProvider::onMouseMoved(float x, float y)
vlc_window_ReportMouseMoved(m_voutWindow, x, y);
}
void VideoSurfaceProvider::onMouseWheeled(const QWheelEvent& event)
void VideoSurfaceProvider::onMouseWheeled(int vlcButton)
{
int vlckey = qtWheelEventToVLCKey(event);
QMutexLocker lock(&m_voutlock);
if (m_voutWindow)
vlc_window_ReportKeyPress(m_voutWindow, vlckey);
vlc_window_ReportKeyPress(m_voutWindow, vlcButton);
}
void VideoSurfaceProvider::onKeyPressed(int key, Qt::KeyboardModifiers modifiers)
......@@ -210,6 +209,8 @@ VideoSurface::VideoSurface(QQuickItem* parent)
setAcceptedMouseButtons(Qt::AllButtons);
setFlag(ItemAcceptsInputMethod, true);
m_wheelEventConverter = new WheelToVLCConverter(this);
{
connect(this, &QQuickItem::widthChanged, this, &VideoSurface::updateSurfaceSize);
connect(this, &QQuickItem::heightChanged, this, &VideoSurface::updateSurfaceSize);
......@@ -307,7 +308,7 @@ void VideoSurface::keyPressEvent(QKeyEvent* event)
#if QT_CONFIG(wheelevent)
void VideoSurface::wheelEvent(QWheelEvent *event)
{
emit mouseWheeled(*event);
m_wheelEventConverter->wheelEvent(event);
event->accept();
}
#endif
......@@ -377,11 +378,11 @@ void VideoSurface::setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurface
connect(this, &VideoSurface::mousePressed, m_provider, &VideoSurfaceProvider::onMousePressed);
connect(this, &VideoSurface::mouseDblClicked, m_provider, &VideoSurfaceProvider::onMouseDoubleClick);
connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::onMouseReleased);
connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::onMouseWheeled);
connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::onKeyPressed);
connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged);
connect(this, &VideoSurface::surfacePositionChanged, m_provider, &VideoSurfaceProvider::surfacePositionChanged);
connect(m_wheelEventConverter, &WheelToVLCConverter::vlcWheelKey, m_provider, &VideoSurfaceProvider::onMouseWheeled);
connect(m_provider, &VideoSurfaceProvider::videoEnabledChanged, this, &VideoSurface::updateSurfacePositionAndSize);
setFlag(ItemHasContents, true);
......
......@@ -33,6 +33,7 @@ extern "C" {
Q_MOC_INCLUDE( "maininterface/mainctx.hpp")
class MainCtx;
class WheelToVLCConverter;
class WindowResizer :
public QRunnable
......@@ -83,7 +84,7 @@ public slots:
void onMouseReleased( int vlcButton );
void onMouseDoubleClick( int vlcButton );
void onMouseMoved( float x, float y );
void onMouseWheeled(const QWheelEvent& event);
void onMouseWheeled(int vlcButton);
void onKeyPressed(int key, Qt::KeyboardModifiers modifiers);
void onSurfaceSizeChanged(QSizeF size);
......@@ -134,7 +135,6 @@ signals:
void mouseDblClicked( int vlcButton );
void mouseMoved( float x, float y );
void keyPressed(int key, Qt::KeyboardModifiers modifier);
void mouseWheeled(const QWheelEvent& event);
void videoSurfaceProviderChanged();
......@@ -148,6 +148,8 @@ protected slots:
private:
QPointF m_oldHoverPos;
WheelToVLCConverter* m_wheelEventConverter = nullptr;
QPointer<VideoSurfaceProvider> m_provider;
std::vector<QPointer<QQuickItem>> m_parentList;
......
......@@ -140,6 +140,7 @@ moc_headers = files(
'util/validators.hpp',
'util/varchoicemodel.hpp',
'util/variables.hpp',
'util/vlchotkeyconverter.hpp',
'util/vlctick.hpp',
'util/dismiss_popup_event_filter.hpp',
'util/list_selection_model.hpp',
......@@ -462,6 +463,8 @@ some_sources = files(
'util/variables.hpp',
'util/vlctick.cpp',
'util/vlctick.hpp',
'util/vlchotkeyconverter.cpp',
'util/vlchotkeyconverter.hpp',
'util/shared_input_item.hpp',
'util/fast_gaussian_blur_template.h',
'util/effects_image_provider.cpp',
......
......@@ -307,13 +307,13 @@ FocusScope {
onWheel: (wheel) => {
wheel.accepted = true
wheelToVlc.qmlWheelEvent(wheel)
}
var delta = wheel.angleDelta.y
if (delta === 0)
return
WheelToVLCConverter {
id: wheelToVlc
Helpers.applyVolume(Player, delta)
onVlcWheelKey: (key) => MainCtx.sendVLCHotkey(key)
}
ColumnLayout {
......
......@@ -286,30 +286,20 @@ T.Pane {
}
onWheel: (wheel) => {
let delta = 0, fineControl = false
if ((Math.abs(wheel.pixelDelta.x) % 120 > 0) || (Math.abs(wheel.pixelDelta.y) % 120 > 0)) {
let delta = 0
if (Math.abs(wheel.pixelDelta.x) > Math.abs(wheel.pixelDelta.y))
delta = wheel.pixelDelta.x
else
delta = wheel.pixelDelta.y
fineControl = true
}
else if (wheel.angleDelta.x)
delta = wheel.angleDelta.x
else if (wheel.angleDelta.y)
delta = wheel.angleDelta.y
if (delta === 0)
return
if (wheel.inverted)
delta = -delta
if (fineControl)
if (wheel.inverted)
delta = -delta
volControl.value += 0.001 * delta
}
else
Helpers.applyVolume(Player, delta)
wheelToVLC.qmlWheelEvent(wheel)
wheel.accepted = true
}
......@@ -328,6 +318,17 @@ T.Pane {
else
volControl.value = 1.25
}
WheelToVLCConverter {
id: wheelToVLC
onWheelUpDown: (steps, modifiers) => {
if (steps > 0)
Player.setVolumeUp(steps)
else
Player.setVolumeDown(-steps)
}
}
}
}
}
......
......@@ -40,20 +40,6 @@ QtObject {
item.forceActiveFocus(reason);
}
function applyVolume(player, delta) {
// Degrees to steps for standard mouse
delta = delta / 8 / 15
const steps = Math.ceil(Math.abs(delta))
player.muted = false
if (delta > 0)
player.setVolumeUp(steps)
else
player.setVolumeDown(steps)
}
function pointInRadius(x, y, radius) {
return (x * x + y * y < radius * radius)
}
......
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "vlchotkeyconverter.hpp"
#include "qt.hpp"
#include <QKeyEvent>
#include <QWheelEvent>
#include <QApplication>
#include <vlc_actions.h>
/***************************************************************************
* Hotkeys converters
***************************************************************************/
int qtKeyModifiersToVLC( const QInputEvent& e )
{
int i_keyModifiers = 0;
if( e.modifiers() & Qt::ShiftModifier ) i_keyModifiers |= KEY_MODIFIER_SHIFT;
if( e.modifiers() & Qt::AltModifier ) i_keyModifiers |= KEY_MODIFIER_ALT;
if( e.modifiers() & Qt::ControlModifier ) i_keyModifiers |= KEY_MODIFIER_CTRL;
if( e.modifiers() & Qt::MetaModifier ) i_keyModifiers |= KEY_MODIFIER_META;
return i_keyModifiers;
}
typedef struct
{
int qt;
uint32_t vlc;
} vlc_qt_key_t;
static const vlc_qt_key_t keys[] =
{
{ Qt::Key_Escape, KEY_ESC },
{ Qt::Key_Tab, '\t', },
// Qt::Key_Backtab
{ Qt::Key_Backspace, '\b' },
{ Qt::Key_Return, '\r' },
{ Qt::Key_Enter, '\r' }, // numeric pad
{ Qt::Key_Insert, KEY_INSERT },
{ Qt::Key_Delete, KEY_DELETE },
{ Qt::Key_Pause, KEY_PAUSE },
{ Qt::Key_Print, KEY_PRINT },
// Qt::Key_SysReq
// Qt::Key_Clear
{ Qt::Key_Home, KEY_HOME },
{ Qt::Key_End, KEY_END },
{ Qt::Key_Left, KEY_LEFT },
{ Qt::Key_Up, KEY_UP },
{ Qt::Key_Right, KEY_RIGHT },
{ Qt::Key_Down, KEY_DOWN },
{ Qt::Key_PageUp, KEY_PAGEUP },
{ Qt::Key_PageDown, KEY_PAGEDOWN },
// Qt::Key_Shift
// Qt::Key_Control
// Qt::Key_Meta
// Qt::Key_Alt
// Qt::Key_CapsLock
// Qt::Key_NumLock
// Qt::Key_ScrollLock
/* F1 - F35 - Qt goes to F35, VLC stops at F12 */
{ Qt::Key_F1, KEY_F1 },
{ Qt::Key_F2, KEY_F2 },
{ Qt::Key_F3, KEY_F3 },
{ Qt::Key_F4, KEY_F4 },
{ Qt::Key_F5, KEY_F5 },
{ Qt::Key_F6, KEY_F6 },
{ Qt::Key_F7, KEY_F7 },
{ Qt::Key_F8, KEY_F8 },
{ Qt::Key_F9, KEY_F9 },
{ Qt::Key_F10, KEY_F10 },
{ Qt::Key_F11, KEY_F11 },
{ Qt::Key_F12, KEY_F12 },
{ Qt::Key_F13, KEY_F(13) },
{ Qt::Key_F14, KEY_F(14) },
{ Qt::Key_F15, KEY_F(15) },
{ Qt::Key_F16, KEY_F(16) },
{ Qt::Key_F17, KEY_F(17) },
{ Qt::Key_F18, KEY_F(18) },
{ Qt::Key_F19, KEY_F(19) },
{ Qt::Key_F20, KEY_F(20) },
{ Qt::Key_F21, KEY_F(21) },
{ Qt::Key_F22, KEY_F(22) },
{ Qt::Key_F23, KEY_F(23) },
{ Qt::Key_F24, KEY_F(24) },
{ Qt::Key_F25, KEY_F(25) },
{ Qt::Key_F26, KEY_F(26) },
{ Qt::Key_F27, KEY_F(27) },
{ Qt::Key_F28, KEY_F(28) },
{ Qt::Key_F29, KEY_F(29) },
{ Qt::Key_F30, KEY_F(30) },
{ Qt::Key_F31, KEY_F(31) },
{ Qt::Key_F32, KEY_F(32) },
{ Qt::Key_F33, KEY_F(33) },
{ Qt::Key_F34, KEY_F(34) },
{ Qt::Key_F35, KEY_F(35) },
// Qt::Key_Super_L
// Qt::Key_Super_R
{ Qt::Key_Menu, KEY_MENU },
// Qt::Key_Hyper_L
// Qt::Key_Hyper_R
// Qt::Key_Help
// Qt::Key_Direction_L
// 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_Reload, KEY_BROWSER_REFRESH },
};
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;
}
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, this
* method should be equal to towlower in case of latin1 */
if( qtk >= 'A' && qtk <= 'Z' ) i_vlck = qtk+32;
else if( qtk >= 0xC0 && qtk <= 0xDE && qtk != 0xD7) i_vlck = qtk+32;
else i_vlck = qtk;
}
else
{
const vlc_qt_key_t *map;
map = (const vlc_qt_key_t *)
bsearch( &qtk, (const void *)keys, sizeof(keys)/sizeof(keys[0]),
sizeof(*keys), keycmp );
if( map != NULL )
i_vlck = map->vlc;
}
/* Handle modifiers */
i_vlck |= qtKeyModifiersToVLC( *e );
return i_vlck;
}
Qt::Orientations WheelToVLCConverter::getWheelOrientation(int x, int y)
{
const qreal v_cos_deadzone = 0.45; // ~63 degrees
const qreal h_cos_deadzone = 0.95; // ~15 degrees
if (x == 0 && y == 0)
return Qt::Orientations{};
qreal cos = qFabs(x)/qSqrt(x*x + y*y);
if (cos < v_cos_deadzone)
return Qt::Vertical;
else if (cos > h_cos_deadzone)
return Qt::Horizontal;
return Qt::Orientations{};
}
void WheelToVLCConverter::wheelEvent( const QWheelEvent* e )
{
if (!e)
return;
const int deltaPerStep = QWheelEvent::DefaultDeltasPerStep;
if (e->modifiers() != m_modifiers)
{
m_scrollAmount = {};
m_modifiers = e->modifiers();
}
if (e->buttons() != m_buttons)
{
m_scrollAmount = {};
m_buttons = e->buttons();
}
QPoint p = e->angleDelta();
p += m_scrollAmount;
if (p.isNull())
return;
int i_vlck = qtKeyModifiersToVLC(*e); // Handle modifiers
Qt::Orientations orientation = getWheelOrientation(p.x(), p.y());
if (orientation == Qt::Vertical && qAbs(p.y()) >= deltaPerStep)
{
if (p.y() > 0)
i_vlck |= KEY_MOUSEWHEELUP;
else
i_vlck |= KEY_MOUSEWHEELDOWN;
const int steps = p.y() / deltaPerStep;
emit wheelUpDown(steps, e->modifiers());
//in practice this will emit once
for (int i = 0; i < qAbs(steps); i++)
emit vlcWheelKey(i_vlck);
m_scrollAmount.setX(0);
m_scrollAmount.setY(p.y() % deltaPerStep);
}
else if (orientation == Qt::Horizontal && qAbs(p.x()) >= deltaPerStep)
{
if (p.x() > 0)
i_vlck |= KEY_MOUSEWHEELLEFT;
else
i_vlck |= KEY_MOUSEWHEELRIGHT;
const int steps = p.x() / deltaPerStep;
emit wheelLeftRight(steps, e->modifiers());
//in practice this will emit once
for (int i = 0; i < qAbs(steps); i++)
emit vlcWheelKey(i_vlck);
m_scrollAmount.setY(0);
m_scrollAmount.setX(p.x() % deltaPerStep);
}
else
{
m_scrollAmount = p;
}
}
void WheelToVLCConverter::qmlWheelEvent( const QObject* e )
{
assert(e);
assert(e->inherits("QQuickWheelEvent"));
QPoint pixelDelta = e->property("pixelDelta").toPoint();
QPoint angleDelta = e->property("angleDelta").toPoint();
auto buttons = Qt::MouseButtons::fromInt(e->property("buttons").toInt());
auto modifiers = Qt::KeyboardModifiers::fromInt(e->property("modifiers").toInt());
bool inverted = e->property("inverted").toBool();
QWheelEvent event({}, {}, pixelDelta, angleDelta, buttons, modifiers, Qt::ScrollPhase::NoScrollPhase, inverted);
wheelEvent(&event);
}
QString VLCKeyToString( unsigned val, bool locale )
{
char *base = vlc_keycode2str (val, locale);
if (base == NULL)
return qfu( "" );
QString r = qfu( base );
free( base );
return r;
}
#ifndef VLC_HOTKEY_CONVERTER_HPP
#define VLC_HOTKEY_CONVERTER_HPP
#include <QObject>
#include <QPoint>
#include <QQmlEngine>
/* VLC Key/Wheel hotkeys interactions */
Q_MOC_INCLUDE("QKeyEvent")
Q_MOC_INCLUDE("QWheelEvent")
class QKeyEvent;
class QWheelEvent;
class QInputEvent;
int qtKeyModifiersToVLC( const QInputEvent& e );
int qtEventToVLCKey( QKeyEvent *e );
int qtWheelEventToVLCKey( const QWheelEvent& e );
QString VLCKeyToString( unsigned val, bool );
/**
* @brief The WheelToVLCConverter class aggregates wheel events and
* emit a signal once it gathers a full scroll step, as VLC doesn't handle
* fractionnal scroll events
*/
class WheelToVLCConverter : public QObject
{
Q_OBJECT
QML_ELEMENT
public:
using QObject::QObject;
public:
Q_INVOKABLE Qt::Orientations getWheelOrientation(int x, int y);
signals:
/**
* @param vlcKey the VLC hotkey representation
*/
void vlcWheelKey(int vlcKey);
/**
* @param steps: positive value indicated UP wheel events, negative DOWN wheel event
* @param modifiers are keyboard pressed modifiers
*/
void wheelUpDown(int steps, Qt::KeyboardModifiers modifiers);
/**
* @param steps: positive value indicated UP wheel events, negative DOWN wheel event
* @param modifiers are keyboard pressed modifiers
*/
void wheelLeftRight(int steps, Qt::KeyboardModifiers modifiers);
public slots:
/**
* @brief qmlWheelEvent handles wheel events as emitted by QWidget
* @param e the wheel event
*/
void wheelEvent(const QWheelEvent* e);
/**
* @brief qmlWheelEvent handles wheel events as emitted by QML
* @param wheelEvent qml wheel event
*/
void qmlWheelEvent(const QObject* wheelEvent);
private:
QPoint m_scrollAmount = {};
Qt::KeyboardModifiers m_modifiers = {};
Qt::MouseButtons m_buttons = {};
};
#endif // VLC_HOTKEY_CONVERTER_HPP
......@@ -32,7 +32,6 @@
#include <QKeyEvent>
#include <QWheelEvent>
#include <QApplication>
#include <vlc_actions.h>
#define SPINNER_SIZE 32
......@@ -84,257 +83,6 @@ void VLCQDial::paintEvent( QPaintEvent *event )
painter.end();
}
/***************************************************************************
* Hotkeys converters
***************************************************************************/
int qtKeyModifiersToVLC( const QInputEvent& e )
{
int i_keyModifiers = 0;
if( e.modifiers() & Qt::ShiftModifier ) i_keyModifiers |= KEY_MODIFIER_SHIFT;
if( e.modifiers() & Qt::AltModifier ) i_keyModifiers |= KEY_MODIFIER_ALT;
if( e.modifiers() & Qt::ControlModifier ) i_keyModifiers |= KEY_MODIFIER_CTRL;
if( e.modifiers() & Qt::MetaModifier ) i_keyModifiers |= KEY_MODIFIER_META;
return i_keyModifiers;
}
typedef struct
{
int qt;
uint32_t vlc;
} vlc_qt_key_t;
static const vlc_qt_key_t keys[] =
{
{ Qt::Key_Escape, KEY_ESC },
{ Qt::Key_Tab, '\t', },
// Qt::Key_Backtab
{ Qt::Key_Backspace, '\b' },
{ Qt::Key_Return, '\r' },
{ Qt::Key_Enter, '\r' }, // numeric pad
{ Qt::Key_Insert, KEY_INSERT },
{ Qt::Key_Delete, KEY_DELETE },
{ Qt::Key_Pause, KEY_PAUSE },
{ Qt::Key_Print, KEY_PRINT },
// Qt::Key_SysReq
// Qt::Key_Clear
{ Qt::Key_Home, KEY_HOME },
{ Qt::Key_End, KEY_END },
{ Qt::Key_Left, KEY_LEFT },
{ Qt::Key_Up, KEY_UP },
{ Qt::Key_Right, KEY_RIGHT },
{ Qt::Key_Down, KEY_DOWN },
{ Qt::Key_PageUp, KEY_PAGEUP },
{ Qt::Key_PageDown, KEY_PAGEDOWN },
// Qt::Key_Shift
// Qt::Key_Control
// Qt::Key_Meta
// Qt::Key_Alt
// Qt::Key_CapsLock
// Qt::Key_NumLock
// Qt::Key_ScrollLock
/* F1 - F35 - Qt goes to F35, VLC stops at F12 */
{ Qt::Key_F1, KEY_F1 },
{ Qt::Key_F2, KEY_F2 },
{ Qt::Key_F3, KEY_F3 },
{ Qt::Key_F4, KEY_F4 },
{ Qt::Key_F5, KEY_F5 },
{ Qt::Key_F6, KEY_F6 },
{ Qt::Key_F7, KEY_F7 },
{ Qt::Key_F8, KEY_F8 },
{ Qt::Key_F9, KEY_F9 },
{ Qt::Key_F10, KEY_F10 },
{ Qt::Key_F11, KEY_F11 },
{ Qt::Key_F12, KEY_F12 },
{ Qt::Key_F13, KEY_F(13) },
{ Qt::Key_F14, KEY_F(14) },
{ Qt::Key_F15, KEY_F(15) },
{ Qt::Key_F16, KEY_F(16) },
{ Qt::Key_F17, KEY_F(17) },
{ Qt::Key_F18, KEY_F(18) },
{ Qt::Key_F19, KEY_F(19) },
{ Qt::Key_F20, KEY_F(20) },
{ Qt::Key_F21, KEY_F(21) },
{ Qt::Key_F22, KEY_F(22) },
{ Qt::Key_F23, KEY_F(23) },
{ Qt::Key_F24, KEY_F(24) },
{ Qt::Key_F25, KEY_F(25) },
{ Qt::Key_F26, KEY_F(26) },
{ Qt::Key_F27, KEY_F(27) },
{ Qt::Key_F28, KEY_F(28) },
{ Qt::Key_F29, KEY_F(29) },
{ Qt::Key_F30, KEY_F(30) },
{ Qt::Key_F31, KEY_F(31) },
{ Qt::Key_F32, KEY_F(32) },
{ Qt::Key_F33, KEY_F(33) },
{ Qt::Key_F34, KEY_F(34) },
{ Qt::Key_F35, KEY_F(35) },
// Qt::Key_Super_L
// Qt::Key_Super_R
{ Qt::Key_Menu, KEY_MENU },
// Qt::Key_Hyper_L
// Qt::Key_Hyper_R
// Qt::Key_Help
// Qt::Key_Direction_L
// 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_Reload, KEY_BROWSER_REFRESH },
};
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;
}
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, this
* method should be equal to towlower in case of latin1 */
if( qtk >= 'A' && qtk <= 'Z' ) i_vlck = qtk+32;
else if( qtk >= 0xC0 && qtk <= 0xDE && qtk != 0xD7) i_vlck = qtk+32;
else i_vlck = qtk;
}
else
{
const vlc_qt_key_t *map;
map = (const vlc_qt_key_t *)
bsearch( &qtk, (const void *)keys, sizeof(keys)/sizeof(keys[0]),
sizeof(*keys), keycmp );
if( map != NULL )
i_vlck = map->vlc;
}
/* Handle modifiers */
i_vlck |= qtKeyModifiersToVLC( *e );
return i_vlck;
}
int qtWheelEventToVLCKey( const QWheelEvent& e )
{
const qreal v_cos_deadzone = 0.45; // ~63 degrees
const qreal h_cos_deadzone = 0.95; // ~15 degrees
int i_vlck = qtKeyModifiersToVLC(e); // Handle modifiers
QPoint p = e.angleDelta();
if (!p.isNull())
{
qreal cos = qFabs(p.x())/qSqrt(qPow(p.x(), 2) + qPow(p.y(), 2));
if (cos < v_cos_deadzone)
{
if (p.y() > 0) i_vlck |= KEY_MOUSEWHEELUP;
else i_vlck |= KEY_MOUSEWHEELDOWN;
}
else if (cos > h_cos_deadzone)
{
if (p.x() > 0) i_vlck |= KEY_MOUSEWHEELLEFT;
else i_vlck |= KEY_MOUSEWHEELRIGHT;
}
}
return i_vlck;
}
QString VLCKeyToString( unsigned val, bool locale )
{
char *base = vlc_keycode2str (val, locale);
if (base == NULL)
return qfu( "" );
QString r = qfu( base );
free( base );
return r;
}
/* Animated Icon implementation */
SpinningIcon::SpinningIcon( QWidget *parent ) : QLabel( parent )
{
......
......@@ -109,15 +109,4 @@ public:
YesNoCheckBox( QWidget *parent );
};
/* VLC Key/Wheel hotkeys interactions */
class QKeyEvent;
class QWheelEvent;
class QInputEvent;
int qtKeyModifiersToVLC( const QInputEvent& e );
int qtEventToVLCKey( QKeyEvent *e );
int qtWheelEventToVLCKey( const QWheelEvent& e );
QString VLCKeyToString( unsigned val, bool );
#endif