Use mouse keys for CW modulation in SSB modulator. Fixes #1948

pull/2019/head
f4exb 2024-03-13 01:30:10 +01:00
rodzic af8d63e94e
commit b0b4fa521f
19 zmienionych plików z 313 dodań i 77 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.9 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 4.4 KiB

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -72,11 +72,11 @@ Enter the text to be keyed when Morse input is active and in text mode
Clears the CW (Morse) text
<h3>12: Morse keyer controls</h3>
<h3>12a: Morse keyer controls (line 1)</h3>
![Morse keyer control GUI1](../../../doc/img/ModCWControls1.png)
<h4>12.1: CW keying speed</h4>
<h4>12a.1: CW keying speed</h4>
Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" sent 5 times. For 5 WPM the dot length is 240 ms. In other terms the dot length is calculated as 1.2 / WPM seconds. The dot length is used as the base to compute other timings:
@ -85,43 +85,49 @@ Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" s
- Character silence separator: 3 dot lengths
- Word silence separator: 7 dot lengths
<h4>12.2: Dots keying</h4>
<h4>12a.2: Dots keying</h4>
Switch this button to send dots continuously
<h4>12.3: Dashes keying</h4>
<h4>12a.3: Dashes keying</h4>
Switch this button to send dashes continuously
<h4>12.4: Text keying</h4>
<h4>12a.4: Text keying</h4>
Switch this button to send the text typed into the text box (10)
<h4>12.5: Text auto repeat</h4>
<h4>12a.5: Text auto repeat</h4>
Switch this button to auto repeat the text keying
<h4>12.6: Text play/stop</h4>
<h4>12a.6: Text play/stop</h4>
Use this button to stop sending text. When resuming keying restarts at the start of text
<h3>12a: Morse keyer controls (line 2)</h3>
![Morse keyer control GUI2](../../../doc/img/ModCWControls2.png)
&#9888; WARNING: what follows is not really useful if you do not use a proper Morse keyer with direct audio feedback. There is a significant audio delay either with the direct monitoring or by monitoring the transmitted signal so keying with this audio as feedback is not practical
12.7: Activate morse keys keyboard control
12b.1: Activate morse keys keyboard and mouse control
This disables text or continuous dots or dashes. Toggle input from keyboard. Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
This disables text or continuous dots or dashes. Toggle input from keyboard or mouse (see 16b.3). Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
12.8: Iambic or straight
12b.2: Iambic or straight
Choose iambic or straight keying style. When straight is selected the dot or dash key may be used.
12.9: Register dot key
12b.3: Mouse control pad
When keyboard and mouse control is activated move the pointer to this area to use the left button as the dot paddle and the right button as the dash paddle. In straight mode both buttons have the same effect (key down).
12a.4: Register dot key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dots. The key or key sequence appears next (here dot `.`)
12.10: Register dash key
12a.5: Register dash key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dashes. The key or key sequence appears next (here dot `.`)

Wyświetl plik

@ -81,11 +81,11 @@ Enter the text to be keyed when Morse input is active and in text mode.
Clears the CW (Morse) text
<h3>10: Morse keyer controls</h3>
<h3>10a: Morse keyer controls (line 1)</h3>
![Morse keyer control GUI1](../../../doc/img/ModCWControls1.png)
<h4>10.1: CW keying speed</h4>
<h4>10a.1: CW keying speed</h4>
Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" sent 5 times. For 5 WPM the dot length is 240 ms. In other terms the dot length is calculated as 1.2 / WPM seconds. The dot length is used as the base to compute other timings:
@ -94,43 +94,49 @@ Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" s
- Character silence separator: 3 dot lengths
- Word silence separator: 7 dot lengths
<h4>10.2: Dots keying</h4>
<h4>10a.2: Dots keying</h4>
Switch this button to send dots continuously
<h4>10.3: Dashes keying</h4>
<h4>10a.3: Dashes keying</h4>
Switch this button to send dashes continuously
<h4>10.4: Text keying</h4>
<h4>10a.4: Text keying</h4>
Switch this button to send the text typed into the text box (13)
<h4>10.5: Text auto repeat</h4>
<h4>10a.5: Text auto repeat</h4>
Switch this button to auto repeat the text keying
<h4>10.6: Text play/stop</h4>
<h4>10a.6: Text play/stop</h4>
Use this button to stop sending text. When resuming keying restarts at the start of text
<h4>10b.1: CW keying speed</h4>
![Morse keyer control GUI2](../../../doc/img/ModCWControls2.png)
&#9888; WARNING: what follows is not really useful if you do not use a proper Morse keyer with direct audio feedback. There is a significant audio delay either with the direct monitoring or by monitoring the transmitted signal so keying with this audio as feedback is not practical
10.7: Activate morse keys keyboard control
10b.1: Activate morse keys keyboard and mouse control
This disables text or continuous dots or dashes. Toggle input from keyboard. Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
This disables text or continuous dots or dashes. Toggle input from keyboard or mouse (see 16b.3). Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
10.8: Iambic or straight
10b.2: Iambic or straight
Choose iambic or straight keying style. When straight is selected the dot or dash key may be used.
10.9: Register dot key
10b.3: Mouse control pad
When keyboard and mouse control is activated move the pointer to this area to use the left button as the dot paddle and the right button as the dash paddle. In straight mode both buttons have the same effect (key down).
10a.4: Register dot key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dots. The key or key sequence appears next (here dot `.`)
10.10: Register dash key
10a.5: Register dash key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dashes. The key or key sequence appears next (here dot `.`)

Wyświetl plik

@ -170,11 +170,11 @@ Enter the text to be keyed when Morse input is active and in text mode
Clears the CW (Morse) text
<h3>17: Morse keyer controls</h3>
<h3>17a: Morse keyer controls (line 1)</h3>
![Morse keyer control GUI1](../../../doc/img/ModCWControls1.png)
<h4>17.1: CW keying speed</h4>
<h4>17a.1: CW keying speed</h4>
Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" sent 5 times. For 5 WPM the dot length is 240 ms. In other terms the dot length is calculated as 1.2 / WPM seconds. The dot length is used as the base to compute other timings:
@ -183,45 +183,49 @@ Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" s
- Character silence separator: 3 dot lengths
- Word silence separator: 7 dot lengths
<h4>17.2: Dots keying</h4>
<h4>17a.2: Dots keying</h4>
Switch this button to send dots continuously
<h4>17.3: Dashes keying</h4>
<h4>17a.3: Dashes keying</h4>
Switch this button to send dashes continuously
<h4>17.4: Text keying</h4>
<h4>17a.4: Text keying</h4>
Switch this button to send the text typed into the text box (14)
<h4>17.5: Text auto repeat</h4>
<h4>17a.5: Text auto repeat</h4>
Switch this button to auto repeat the text keying
<h4>17.6: Text play/stop</h4>
<h4>17a.6: Text play/stop</h4>
Use this button to stop sending text. When resuming keying restarts at the start of text
<h3>18: Use keyboard for morse keying</h3>
<h3>17b: Morse keyer controls (line 2)</h3>
![Morse keyer control GUI2](../../../doc/img/ModCWControls2.png)
&#9888; WARNING: this is not really useful if you do not use a proper Morse keyer with direct audio feedback. There is a significant audio delay either with the direct monitoring or by monitoring the transmitted signal so keying with this audio as feedback is not practical
18.7: Activate morse keys keyboard control
17b.1: Activate morse keys keyboard and mouse control
This disables text or continuous dots or dashes. Toggle input from keyboard. Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
This disables text or continuous dots or dashes. Toggle input from keyboard or mouse (see 16b.3). Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
18.8: Iambic or straight
17b.2: Iambic or straight
Choose iambic or straight keying style. When straight is selected the dot or dash key may be used.
18.9: Register dot key
17b.3: Mouse control pad
When keyboard and mouse control is activated move the pointer to this area to use the left button as the dot paddle and the right button as the dash paddle. In straight mode both buttons have the same effect (key down).
17a.4: Register dot key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dots. The key or key sequence appears next (here dot `.`)
18.10: Register dash key
17a.5: Register dash key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dashes. The key or key sequence appears next (here dot `.`)

Wyświetl plik

@ -161,11 +161,11 @@ Enter the text to be keyed when Morse input is active and in text mode
Clears the CW (Morse) text
<h3>16: Morse keyer controls</h3>
<h3>16a: Morse keyer controls (line1)</h3>
![Morse keyer control GUI1](../../../doc/img/ModCWControls1.png)
<h4>16.1: CW keying speed</h4>
<h4>16a.1: CW keying speed</h4>
Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" sent 5 times. For 5 WPM the dot length is 240 ms. In other terms the dot length is calculated as 1.2 / WPM seconds. The dot length is used as the base to compute other timings:
@ -174,43 +174,49 @@ Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" s
- Character silence separator: 3 dot lengths
- Word silence separator: 7 dot lengths
<h4>16.2: Dots keying</h4>
<h4>16a.2: Dots keying</h4>
Switch this button to send dots continuously
<h4>16.3: Dashes keying</h4>
<h4>16a.3: Dashes keying</h4>
Switch this button to send dashes continuously
<h4>16.4: Text keying</h4>
<h4>16a.4: Text keying</h4>
Switch this button to send the text typed into the text box (13)
<h4>16.5: Text auto repeat</h4>
<h4>16a.5: Text auto repeat</h4>
Switch this button to auto repeat the text keying
<h4>16.6: Text play/stop</h4>
<h4>16a.6: Text play/stop</h4>
Use this button to stop sending text. When resuming keying restarts at the start of text
<h3>16b: Morse keyer controls (line2)</h3>
![Morse keyer control GUI2](../../../doc/img/ModCWControls2.png)
&#9888; WARNING: what follows is not really useful if you do not use a proper Morse keyer with direct audio feedback. There is a significant audio delay either with the direct monitoring or by monitoring the transmitted signal so keying with this audio as feedback is not practical
16.7: Activate morse keys keyboard control
16b.1: Activate morse keys keyboard and mouse control
This disables text or continuous dots or dashes. Toggle input from keyboard. Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
This disables text or continuous dots or dashes. Toggle input from keyboard or mouse (see 16b.3). Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
16.8: Iambic or straight
16b.2: Iambic or straight
Choose iambic or straight keying style. When straight is selected the dot or dash key may be used.
16.9: Register dot key
16b.3: Mouse control pad
When keyboard and mouse control is activated move the pointer to this area to use the left button as the dot paddle and the right button as the dash paddle. In straight mode both buttons have the same effect (key down).
16b.4: Register dot key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dots. The key or key sequence appears next (here dot `.`)
16.10: Register dash key
16b.5: Register dash key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dashes. The key or key sequence appears next (here dot `.`)

Wyświetl plik

@ -790,7 +790,7 @@ void SSBModGUI::audioSelect(const QPoint& p)
void SSBModGUI::audioFeedbackSelect(const QPoint& p)
{
qDebug("SSBModGUI::audioFeedbackSelect");
AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_audioDeviceName, false); // false for output
AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_feedbackAudioDeviceName, false); // false for output
audioSelect.move(p);
new DialogPositioner(&audioSelect, false);
audioSelect.exec();

Wyświetl plik

@ -35,7 +35,7 @@ SSBModSource::SSBModSource() :
m_spectrumSink(nullptr),
m_audioSampleRate(48000),
m_audioFifo(12000),
m_feedbackAudioFifo(48000),
m_feedbackAudioFifo(12000),
m_levelCalcCount(0),
m_peakLevel(0.0f),
m_levelSum(0.0f),
@ -55,7 +55,7 @@ SSBModSource::SSBModSource() :
m_audioReadBuffer.resize(24000);
m_audioReadBufferFill = 0;
m_feedbackAudioBuffer.resize(1<<14);
m_feedbackAudioBuffer.resize(4800);
m_feedbackAudioBufferFill = 0;
m_demodBuffer.resize(1<<12);
@ -538,22 +538,31 @@ void SSBModSource::pushFeedback(Complex c)
void SSBModSource::processOneSample(Complex& ci)
{
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real();
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag();
++m_feedbackAudioBufferFill;
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
if (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone) // minimize latency for CW
{
uint res = m_feedbackAudioFifo.write((const quint8*)&m_feedbackAudioBuffer[0], m_feedbackAudioBufferFill);
m_feedbackAudioBuffer[0].l = ci.real();
m_feedbackAudioBuffer[0].r = ci.imag();
m_feedbackAudioFifo.writeOne((const quint8*) &m_feedbackAudioBuffer[0]);
}
else
{
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real();
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag();
++m_feedbackAudioBufferFill;
if (res != m_feedbackAudioBufferFill)
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
{
qDebug("SSBModSource::pushFeedback: %u/%u audio samples written m_feedbackInterpolatorDistance: %f",
res, m_feedbackAudioBufferFill, m_feedbackInterpolatorDistance);
m_feedbackAudioFifo.clear();
}
uint res = m_feedbackAudioFifo.write((const quint8*)&m_feedbackAudioBuffer[0], m_feedbackAudioBufferFill);
m_feedbackAudioBufferFill = 0;
if (res != m_feedbackAudioBufferFill)
{
qDebug("SSBModSource::pushFeedback: %u/%u audio samples written m_feedbackInterpolatorDistance: %f",
res, m_feedbackAudioBufferFill, m_feedbackInterpolatorDistance);
m_feedbackAudioFifo.clear();
}
m_feedbackAudioBufferFill = 0;
}
}
}

Wyświetl plik

@ -76,11 +76,11 @@ Enter the text to be keyed when Morse input is active and in text mode
Clears the CW (Morse) text
<h3>13: Morse keyer controls</h3>
<h3>13a: Morse keyer controls (line 1)</h3>
![Morse keyer control GUI1](../../../doc/img/ModCWControls1.png)
<h4>13.1: CW keying speed</h4>
<h4>13a.1: CW keying speed</h4>
Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" sent 5 times. For 5 WPM the dot length is 240 ms. In other terms the dot length is calculated as 1.2 / WPM seconds. The dot length is used as the base to compute other timings:
@ -89,43 +89,49 @@ Sets the CW speed in Words Per Minute (WPM). This is based on the word "PARIS" s
- Character silence separator: 3 dot lengths
- Word silence separator: 7 dot lengths
<h4>13.2: Dots keying</h4>
<h4>13a.2: Dots keying</h4>
Switch this button to send dots continuously
<h4>13.3: Dashes keying</h4>
<h4>13a.3: Dashes keying</h4>
Switch this button to send dashes continuously
<h4>13.4: Text keying</h4>
<h4>13a.4: Text keying</h4>
Switch this button to send the text typed into the text box (11)
<h4>13.5: Text auto repeat</h4>
<h4>13a.5: Text auto repeat</h4>
Switch this button to auto repeat the text keying
<h4>13.6: Text play/stop</h4>
<h4>13a.6: Text play/stop</h4>
Use this button to stop sending text. When resuming keying restarts at the start of text
<h3>13b: Morse keyer controls (line 2)</h3>
![Morse keyer control GUI2](../../../doc/img/ModCWControls2.png)
&#9888; WARNING: what follows is not really useful if you do not use a proper Morse keyer with direct audio feedback. There is a significant audio delay either with the direct monitoring or by monitoring the transmitted signal so keying with this audio as feedback is not practical
13.7: Activate morse keys keyboard control
13b.1: Activate morse keys keyboard and mouse control
This disables text or continuous dots or dashes. Toggle input from keyboard. Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
This disables text or continuous dots or dashes. Toggle input from keyboard or mouse (see 16b.3). Occasionally the focus may get lost and you will have to deactivate and reactivate it to recover the key bindings.
13.8: Iambic or straight
13b.2: Iambic or straight
Choose iambic or straight keying style. When straight is selected the dot or dash key may be used.
13.9: Register dot key
13b.3: Mouse control pad
When keyboard and mouse control is activated move the pointer to this area to use the left button as the dot paddle and the right button as the dash paddle. In straight mode both buttons have the same effect (key down).
13b.4: Register dot key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dots. The key or key sequence appears next (here dot `.`)
13.10: Register dash key
13b.5: Register dash key
Click on the button and while selected type a character or character and modifier (Shift + key for example) to select which key is used for dashes. The key or key sequence appears next (here dot `.`)

Wyświetl plik

@ -174,6 +174,31 @@ bool AudioFifo::readOne(quint8* data)
return true;
}
uint32_t AudioFifo::writeOne(const quint8* data)
{
if (!m_fifo) {
return 0;
}
if (isFull())
{
emit overflow(1);
return 0;
}
m_mutex.lock();
memcpy(m_fifo + (m_tail * m_sampleSize), data, m_sampleSize);
m_tail += 1;
m_tail %= m_size;
m_fill += 1;
m_mutex.unlock();
emit dataReady();
return 1;
}
uint AudioFifo::drain(uint32_t numSamples)
{
QMutexLocker mutexLocker(&m_mutex);

Wyświetl plik

@ -41,6 +41,7 @@ public:
uint32_t write(const quint8* data, uint32_t numSamples);
uint32_t read(quint8* data, uint32_t numSamples);
bool readOne(quint8* data);
uint32_t writeOne(const quint8* data);
uint32_t drain(uint32_t numSamples);
void clear();

Wyświetl plik

@ -26,6 +26,7 @@ set(sdrgui_SOURCES
gui/crightclickenabler.cpp
gui/customtextedit.cpp
gui/cwkeyergui.cpp
gui/cwmousekeyerenabler.cpp
gui/datetimedelegate.cpp
gui/decimaldelegate.cpp
gui/devicesetselectiondialog.cpp
@ -150,6 +151,7 @@ set(sdrgui_HEADERS
gui/crightclickenabler.h
gui/customtextedit.h
gui/cwkeyergui.h
gui/cwmousekeyerenabler.h
gui/datetimedelegate.h
gui/decimaldelegate.h
gui/devicesetselectiondialog.h

Wyświetl plik

@ -21,6 +21,7 @@
#include "gui/cwkeyergui.h"
#include "gui/dialpopup.h"
#include "gui/cwmousekeyerenabler.h"
#include "ui_cwkeyergui.h"
#include "dsp/cwkeyer.h"
#include "util/simpleserializer.h"
@ -40,6 +41,11 @@ CWKeyerGUI::CWKeyerGUI(QWidget* parent) :
m_commandKeyReceiver->setRelease(true);
this->installEventFilter(m_commandKeyReceiver);
DialPopup::addPopupsToChildDials(this);
CWMouseKeyerEnabler *cwMouseKeyerEnabler = new CWMouseKeyerEnabler(ui->cwMouseKeyerPad);
QObject::connect(cwMouseKeyerEnabler, &CWMouseKeyerEnabler::leftButtonPress, this, &CWKeyerGUI::cwKeyerMouseLeftPressed);
QObject::connect(cwMouseKeyerEnabler, &CWMouseKeyerEnabler::leftButtonRelease, this, &CWKeyerGUI::cwKeyerMouseLeftReleased);
QObject::connect(cwMouseKeyerEnabler, &CWMouseKeyerEnabler::rightButtonPress, this, &CWKeyerGUI::cwKeyerMouseRightPressed);
QObject::connect(cwMouseKeyerEnabler, &CWMouseKeyerEnabler::rightButtonRelease, this, &CWKeyerGUI::cwKeyerMouseRightReleased);
}
CWKeyerGUI::~CWKeyerGUI()
@ -359,3 +365,23 @@ void CWKeyerGUI::blockApplySettings(bool block)
{
m_doApplySettings = !block;
}
void CWKeyerGUI::cwKeyerMouseLeftPressed()
{
m_cwKeyer->setKeyboardDots();
}
void CWKeyerGUI::cwKeyerMouseLeftReleased()
{
m_cwKeyer->setKeyboardSilence();
}
void CWKeyerGUI::cwKeyerMouseRightPressed()
{
m_cwKeyer->setKeyboardDashes();
}
void CWKeyerGUI::cwKeyerMouseRightReleased()
{
m_cwKeyer->setKeyboardSilence();
}

Wyświetl plik

@ -90,6 +90,10 @@ private slots:
void on_keyboardKeyer_toggled(bool checked);
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
void keyboardKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
void cwKeyerMouseLeftPressed();
void cwKeyerMouseLeftReleased();
void cwKeyerMouseRightPressed();
void cwKeyerMouseRightReleased();
};

Wyświetl plik

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>375</width>
<height>91</height>
<height>92</height>
</rect>
</property>
<property name="font">
@ -82,6 +82,7 @@
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
</font>
</property>
@ -149,6 +150,7 @@
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
@ -215,6 +217,7 @@
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
@ -487,6 +490,28 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="cwMouseKeyerPad">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Put the mouse pointer here to activate the CW mouse keyer</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources/res.qrc">:/mouse.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="keyDotCapture">
<property name="sizePolicy">
@ -546,6 +571,7 @@
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
@ -634,6 +660,7 @@
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>

Wyświetl plik

@ -0,0 +1,70 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QEvent>
#include <QMouseEvent>
#include "cwmousekeyerenabler.h"
CWMouseKeyerEnabler::CWMouseKeyerEnabler(QWidget *widget) :
QObject(widget),
m_widget(widget)
{
m_widget->installEventFilter(this);
}
bool CWMouseKeyerEnabler::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::MouseButtonPress)
{
auto mouseEvent = (QMouseEvent*) event;
if (mouseEvent->button() == Qt::RightButton)
{
emit rightButtonPress(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
if (mouseEvent->button() == Qt::LeftButton)
{
emit leftButtonPress(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
}
else if (event->type() == QEvent::MouseButtonRelease)
{
auto mouseEvent = (QMouseEvent*) event;
if (mouseEvent->button() == Qt::RightButton)
{
emit rightButtonRelease(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
if (mouseEvent->button() == Qt::LeftButton)
{
emit leftButtonRelease(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
}
return QObject::eventFilter(obj, event);
}

Wyświetl plik

@ -0,0 +1,43 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRGUI_GUI_CWMOUSEKEYERENABLER_H_
#define SDRGUI_GUI_CWMOUSEKEYERENABLER_H_
#include <QWidget>
#include "export.h"
class SDRGUI_API CWMouseKeyerEnabler : public QObject {
Q_OBJECT
public:
CWMouseKeyerEnabler(QWidget *widget);
signals:
void leftButtonPress(const QPoint&); // Emitted for left mouse press
void leftButtonRelease(const QPoint&); // Emitted for left mouse release
void rightButtonPress(const QPoint&); // Emitted for right mouse press
void rightButtonRelease(const QPoint&); // Emitted for right mouse release
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
QWidget* m_widget;
};
#endif /* SDRGUI_GUI_CRIGHTCLICKENABLER_H_ */

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 5.1 KiB

Wyświetl plik

@ -156,6 +156,7 @@
<file>tab.png</file>
<file>clockfile.png</file>
<file>clockcurrent.png</file>
<file>mouse.png</file>
<file>LiberationMono-Regular.ttf</file>
<file>LiberationSans-Regular.ttf</file>
</qresource>