Skip to content

Commit

Permalink
Config of multimedia shorcut key
Browse files Browse the repository at this point in the history
  • Loading branch information
surfzoid committed Jul 29, 2023
1 parent 042b63b commit c86350b
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 7 deletions.
7 changes: 5 additions & 2 deletions QtVsPlayermga8wally.spec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: QtVsPlayer
Summary: QtVsPlayer for Hikvision
Version: 1.0.50
Version: 1.0.51

%global Rel 8
%global Rel 0
%if 0%{?mageia}
Release: %mkrel %{Rel}
%elif 0%{?fedora} > 36 || 0%{?rhel} > 6
Expand Down Expand Up @@ -136,6 +136,9 @@ chmod -R ug+rw %{_srcrpmdir}
%{_libdir}/QtVsPlayer/*

%changelog
* Sat Jul 29 2023 [email protected]
+ Config of multimedia shorcut key.

* Sat Jul 22 2023 [email protected]
- Mageia 9 use openssl3, use openssl 1.1 libs from mga8 in /usr/lib64/QtVsPlayer.
+ Use release number for about box and packages built at Github.
Expand Down
8 changes: 8 additions & 0 deletions multimedia_shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void Multimedia_shortcuts::showEvent(QShowEvent *event)
this->ui->LEnext->setText(settings.value("next", "0X1000083").value<QString>());
this->ui->LESeekLess->setText(settings.value("SeekLess", "0x01000062").value<QString>());
this->ui->LESeekMore->setText(settings.value("SeekMore", "0x01000061").value<QString>());
this->ui->LEForward->setText(settings.value("Forward", "0x01000063").value<QString>());
this->ui->LEBackward->setText(settings.value("Backward", "0x01000064").value<QString>());
settings.endGroup();

IsShown = true;
Expand All @@ -47,6 +49,8 @@ void Multimedia_shortcuts::on_buttonBox_accepted()
settings.setValue("next", ui->LEnext->text());
settings.setValue("SeekLess", ui->LESeekLess->text());
settings.setValue("SeekMore", ui->LESeekMore->text());
settings.setValue("Forward", ui->LEForward->text());
settings.setValue("Backward", ui->LEBackward->text());

settings.endGroup();
settings.sync();
Expand Down Expand Up @@ -78,6 +82,10 @@ bool Multimedia_shortcuts::eventFilter(QObject *obj, QEvent *event)
this->ui->LESeekLess->setText(TheKey);
if (this->ui->LESeekMore->hasFocus())
this->ui->LESeekMore->setText(TheKey);
if (this->ui->LEForward->hasFocus())
this->ui->LEForward->setText(TheKey);
if (this->ui->LEBackward->hasFocus())
this->ui->LEBackward->setText(TheKey);
}
return QObject::eventFilter(obj, event);
}
48 changes: 44 additions & 4 deletions multimedia_shortcuts.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>403</width>
<height>397</height>
<height>527</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -19,8 +19,8 @@
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>330</y>
<x>20</x>
<y>410</y>
<width>341</width>
<height>32</height>
</rect>
Expand All @@ -41,7 +41,7 @@
<x>20</x>
<y>20</y>
<width>331</width>
<height>281</height>
<height>371</height>
</rect>
</property>
<property name="tabletTracking">
Expand Down Expand Up @@ -188,6 +188,46 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<property name="tabletTracking">
<bool>true</bool>
</property>
<property name="text">
<string>Forward</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="LEForward">
<property name="tabletTracking">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_9">
<property name="tabletTracking">
<bool>true</bool>
</property>
<property name="text">
<string>Backward</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="LEBackward">
<property name="tabletTracking">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down
33 changes: 32 additions & 1 deletion qtvsplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,38 @@ bool QtVsPlayer::eventFilter(QObject *obj, QEvent *event)
}

/*printf("---Event type %i :%s\r\n", event->type(), QEvent::staticMetaObject
.enumerator(eventEnumIndex).valueToKey(event->type()));*/
.enumerator(eventEnumIndex).valueToKey(event->type()));*/ if (event->type() == QEvent::KeyRelease || event->type() == QEvent::KeyPress)
{
QKeyEvent *key = static_cast<QKeyEvent *>(event);
// qDebug() << "pressed"<< key->key();
// qDebug() << "pressed"<< key->text();
// qDebug() << "pressed"<< key->nativeScanCode();
QSettings settings;
settings.beginGroup("Multimedia_shortcuts");
QString TheKey = QString::number(key->key());
if (key->key() == settings.value("play", "0X1000080").value<int>())
playm4interface::Play();
if (key->key() == settings.value("pause", "0X1000085").value<int>())
VideoCtrls::pause();
if (key->key() == settings.value("stop", "0X1000081").value<int>())
playm4interface::Stop();
if (key->key() == settings.value("previous", "0X1000082").value<int>())
{
QtVsPlayer::LastPlayIdx -= 2;
QtVsPlayer::PlayNextFile(false, 0);
}
if (key->key() == settings.value("next", "0X1000083").value<int>())
QtVsPlayer::PlayNextFile(false,0);
if (key->key() == settings.value("SeekLess", "0x01000062").value<int>())
playm4interface::Slow();
if (key->key() == settings.value("SeekMore", "0x01000061").value<int>())
playm4interface::Fast();
if (key->key() == settings.value("Forward", "0x010000631").value<int>())
WVideoCtrls->Forward();
if (key->key() == settings.value("Backward", "0x010000631").value<int>())
WVideoCtrls->Backward();
settings.endGroup();
}

return QObject::eventFilter(obj, event);
}
Expand Down
15 changes: 15 additions & 0 deletions videoctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,18 @@ void VideoCtrls::on_Audio_released()
{
playm4interface::PlaySound();
}


void VideoCtrls::Forward()
{
int value = ui->TimeSlider->value();
ui->TimeSlider->setValue(value + 1);
VideoCtrls::on_TimeSlider_actionTriggered(0);
}

void VideoCtrls::Backward()
{
int value = ui->TimeSlider->value();
ui->TimeSlider->setValue(value - 1);
VideoCtrls::on_TimeSlider_actionTriggered(0);
}
2 changes: 2 additions & 0 deletions videoctrls.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class VideoCtrls : public QWidget
static void pause();
static int Duration;
static bool AutoHide;
void Forward();
void Backward();

private:
Ui::VideoCtrls *ui;
Expand Down

0 comments on commit c86350b

Please sign in to comment.