Removed external variable from vfodisplay widget

1.2.0
PianetaRadio 2022-04-12 19:27:46 +02:00 zatwierdzone przez GitHub
rodzic 3bacb30eaa
commit 150c6bf586
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 23 dodań i 7 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
typedef struct {
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit up or down
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit Up or Down
} guiConfig;

Wyświetl plik

@ -234,6 +234,10 @@ void MainWindow::guiInit()
if (rig_has_set_func(my_rig, RIG_FUNC_TSQL)) ui->comboBox_toneType->addItem("TSQL"); //CTCSS Tx + Rx squelch
if (rig_has_set_func(my_rig, RIG_FUNC_CSQL)) ui->comboBox_toneType->addItem("DCS"); //DCS
//* VFO
ui->lineEdit_vfoMain->setMode(guiConf.vfoDisplayMode);
ui->lineEdit_vfoSub->setMode(guiConf.vfoDisplayMode);
//check for targetable sub VFO
if (my_rig->caps->rig_model != 2) //Hamlib 4.4 has bug for rigctld and targetable_vfo, skip check
{
@ -1111,6 +1115,9 @@ void MainWindow::on_action_Setup_triggered()
DialogSetup setup;
setup.setModal(true);
setup.exec();
ui->lineEdit_vfoMain->setMode(guiConf.vfoDisplayMode);
ui->lineEdit_vfoSub->setMode(guiConf.vfoDisplayMode);
}
void MainWindow::on_action_AboutCatRadio_triggered()

Wyświetl plik

@ -346,6 +346,9 @@
<height>35</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_Band">

Wyświetl plik

@ -18,7 +18,6 @@
#include "vfodisplay.h"
#include "guidata.h"
#include <QPainter>
#include <QInputEvent>
@ -27,14 +26,13 @@
#include <math.h>
extern guiConfig guiConf;
vfoDisplay::vfoDisplay(QWidget *parent) : QWidget(parent)
{
lineColor = QColor(Qt::black);
bgColor = QColor(Qt::white);
textColor = QColor(Qt::black);
vfoDisplayMode = 0;
}
void vfoDisplay::paintEvent(QPaintEvent *)
@ -103,6 +101,11 @@ void vfoDisplay::setValue(unsigned long value)
update();
}
void vfoDisplay::setMode(int mode)
{
vfoDisplayMode = mode;
}
//* Tuning using mouse buttons
void vfoDisplay::mousePressEvent(QMouseEvent *event)
{
@ -114,12 +117,12 @@ void vfoDisplay::mousePressEvent(QMouseEvent *event)
{
if (pointerPos.x() > (width()-3-(textWidth+2)*i+1) && pointerPos.x() < (width()-3-(textWidth+2)*(i-1)-1))
{
if (guiConf.vfoDisplayMode && event->button() == Qt::LeftButton) //Up/Down mode
if (vfoDisplayMode && event->button() == Qt::LeftButton) //Up/Down mode
{
if (pointerPos.y() < height()/2) currentValue = currentValue + pow(10,i); //Up
else if (currentValue - pow(10,i) > 0) currentValue = currentValue - pow(10,i); //Down
}
else if (!guiConf.vfoDisplayMode) //Left/Right mode
else if (!vfoDisplayMode) //Left/Right mode
{
if (event->button() == Qt::LeftButton) currentValue = currentValue + pow(10,i); //LeftButton
else if (currentValue - pow(10,i) > 0) currentValue = currentValue - pow(10,i); //RightButton

Wyświetl plik

@ -12,6 +12,7 @@ public:
public slots:
void setValue(unsigned long value);
void setMode(int mode);
signals:
void on_valueChanged(int value);
@ -31,6 +32,8 @@ private:
unsigned long currentValue; //current frequency value (Hz)
unsigned long value; //target value
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit Up or Down
int textWidth; //number width
};