Uploaded MSHV v2.69 Non-Gendered
104
src/CpuWidget/HvProgBarSlowH/hvprogbarslowh.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
/* MSHV HvProgBarSlowV
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvprogbarslowh.h"
|
||||
|
||||
/////////////////////////V PROGRES BAR///////////////////////////////////////
|
||||
HvProgBarSlowV::HvProgBarSlowV(int pos_x, int pos_y, QPixmap on_pix,QPixmap back_pix, QWidget * parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
move(pos_x, pos_y);
|
||||
on = on_pix;
|
||||
back = back_pix;
|
||||
setFixedSize(back.width(), back.height());
|
||||
on_height = on.height();//on.width();
|
||||
|
||||
x_upd_pos_l = 0;
|
||||
|
||||
//factor = 1;// zavisi ot prez kolko piksela se dwizi indicatora hv // vazno ne factor*factor gore HV!!!!
|
||||
|
||||
on_width = on.width();
|
||||
|
||||
//left_pos_y = back.height() - on.height();
|
||||
}
|
||||
HvProgBarSlowV::~HvProgBarSlowV()
|
||||
{}
|
||||
void HvProgBarSlowV::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0, 0, back);
|
||||
//painter.drawPixmap(0, 0, x_upd_pos_l, on_height, on, 0, 0, x_upd_pos_l, on_height);
|
||||
//painter.drawPixmap(0, 0, on_height, x_upd_pos_l, on ,0, 0, on_height, x_upd_pos_l);
|
||||
painter.drawPixmap(0, x_upd_pos_l, on_width, on_height, on,0, x_upd_pos_l, on_width, on_height);
|
||||
//0, pix_width_koef - x_upd_pos_l, on_width, pix_width_koef - x_upd_pos_l);
|
||||
|
||||
//( int x, int y, int width, int height, const QPixmap & pixmap )
|
||||
}
|
||||
void HvProgBarSlowV::setValue(int val_l, int max)
|
||||
{ // qDebug()<<val_l;
|
||||
if (val_l < 0)
|
||||
val_l = 0;
|
||||
|
||||
double coef = (double)max/on_height;
|
||||
val_l = (int)((double)val_l/coef);
|
||||
|
||||
if (val_l>on_height)
|
||||
val_l=on_height;
|
||||
|
||||
//int scale_l = (val_l/factor)*factor; // vazno ne factor*factor gore
|
||||
//x_upd_pos_l = on_height-scale_l;
|
||||
|
||||
x_upd_pos_l = on_height-val_l;
|
||||
update();
|
||||
|
||||
}
|
||||
/////////////////////////END V PROGRES BAR///////////////////////////////////////
|
||||
|
||||
/////////////////////////H PROGRES BAR///////////////////////////////////////////
|
||||
HvProgBarSlowH::HvProgBarSlowH(int pos_x, int pos_y, QPixmap on_pix,QPixmap back_pix, QWidget * parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
move(pos_x, pos_y);
|
||||
on = on_pix;
|
||||
back = back_pix;
|
||||
setFixedSize(back.width(), back.height());
|
||||
pix_width_koef = on.width();
|
||||
x_upd_pos_l = 0;
|
||||
|
||||
//factor = 1;// zavisi ot prez kolko piksela se dwizi indicatora hv // vazno ne factor*factor gore HV!!!!
|
||||
|
||||
on_height = on.height();
|
||||
|
||||
//left_pos_y = back.height() - on.height();
|
||||
}
|
||||
HvProgBarSlowH::~HvProgBarSlowH()
|
||||
{}
|
||||
void HvProgBarSlowH::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0, 0, back);
|
||||
painter.drawPixmap(0, 0, x_upd_pos_l, on_height, on, 0, 0, x_upd_pos_l, on_height);
|
||||
}
|
||||
void HvProgBarSlowH::setValue(int val_l, int max)
|
||||
{ // qDebug()<<val_l;
|
||||
if (val_l < 0)
|
||||
val_l = 0;
|
||||
|
||||
double coef = (double)max/pix_width_koef;
|
||||
val_l = (int)((double)val_l/coef);
|
||||
|
||||
if (val_l>pix_width_koef)
|
||||
val_l=pix_width_koef;
|
||||
|
||||
//int scale_l = (val_l/factor)*factor; // vazno ne factor*factor gore
|
||||
//x_upd_pos_l = scale_l;
|
||||
|
||||
x_upd_pos_l = val_l;
|
||||
update();
|
||||
|
||||
}
|
||||
/////////////////////////END H PROGRES BAR///////////////////////////////////////
|
||||
|
||||
|
||||
|
67
src/CpuWidget/HvProgBarSlowH/hvprogbarslowh.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVPROGBARSLOWH_H
|
||||
#define HVPROGBARSLOWH_H
|
||||
|
||||
#include <QWidget>
|
||||
//#include <QTimer>
|
||||
#include <qpainter.h>
|
||||
//#include <QDebug>
|
||||
|
||||
class HvProgBarSlowV : public QWidget
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
HvProgBarSlowV(int pos_x, int pos_y, QPixmap on_pix, QPixmap back_pix, QWidget * parent = 0);
|
||||
virtual ~HvProgBarSlowV();
|
||||
|
||||
void setValue(int value, int maxValue);
|
||||
|
||||
private:
|
||||
QPixmap on, back;
|
||||
int x_upd_pos_l, on_width, on_height;
|
||||
//int factor;
|
||||
|
||||
|
||||
//public slots:
|
||||
//void setValue(int value, int maxValue);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
class HvProgBarSlowH : public QWidget
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
HvProgBarSlowH(int pos_x, int pos_y, QPixmap on_pix, QPixmap back_pix, QWidget * parent = 0);
|
||||
virtual ~HvProgBarSlowH();
|
||||
|
||||
void setValue(int value, int maxValue);
|
||||
|
||||
private:
|
||||
QPixmap on, back;
|
||||
int x_upd_pos_l, on_height;
|
||||
int pix_width_koef;
|
||||
//int factor
|
||||
|
||||
|
||||
//public slots:
|
||||
//void setValue(int value, int maxValue);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
8
src/CpuWidget/HvProgBarSlowH/hvprogbarslowh.qrc
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>pic/progress_on39.png</file>
|
||||
<file>pic/progress_off39.png</file>
|
||||
<file>pic/progress_on_v12.png</file>
|
||||
<file>pic/progress_off_v12.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_off39.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_off50.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_off_v12.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_on39.png
Normal file
After Width: | Height: | Size: 662 B |
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_on50.png
Normal file
After Width: | Height: | Size: 838 B |
BIN
src/CpuWidget/HvProgBarSlowH/pic/progress_on_v12.png
Normal file
After Width: | Height: | Size: 154 B |
153
src/CpuWidget/cpusensorhv.cpp
Normal file
@ -0,0 +1,153 @@
|
||||
/* MSHV CpuSensor
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "cpusensorhv.h"
|
||||
//#include <QtGui>
|
||||
|
||||
#if defined _WIN32_
|
||||
int GetProc_Info_(SYSTEM_INFO &sy,LPFN_NtQuerySystemInformation &nt,SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *xspi_old,SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *xspi)
|
||||
{
|
||||
memset(xspi_old,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*MAX_PROC);
|
||||
memset(xspi,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*MAX_PROC);
|
||||
nt=(LPFN_NtQuerySystemInformation) GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")),"NtQuerySystemInformation");
|
||||
if (!nt)
|
||||
{
|
||||
//printf("\n*** no ntquerysysteminformation api?.. bugger");
|
||||
return 0;
|
||||
}
|
||||
GetSystemInfo(&sy);
|
||||
if (sy.dwNumberOfProcessors > MAX_PROC) sy.dwNumberOfProcessors = MAX_PROC; //2.58 max=32 protection
|
||||
return sy.dwNumberOfProcessors;
|
||||
}
|
||||
#endif
|
||||
|
||||
CpuSensorHv::CpuSensorHv(QString cpuN, int cpu_number)
|
||||
{
|
||||
cpu_num = cpu_number; //qDebug()<<cpu_num<<cpuN;
|
||||
#if defined _WIN32_
|
||||
bytesreturned=0;//2.12
|
||||
cpu_usage = 0;
|
||||
f_function = false;
|
||||
/*memset(spi_old,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*32);
|
||||
memset(spi,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*32);
|
||||
ntquerysysteminformation=(LPFN_NtQuerySystemInformation) GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "NtQuerySystemInformation");
|
||||
if (!ntquerysysteminformation)
|
||||
{
|
||||
printf("\n*** no ntquerysysteminformation api?.. bugger");
|
||||
return;
|
||||
}
|
||||
GetSystemInfo(&systeminfo); //return systeminfo.dwNumberOfProcessors;*/
|
||||
GetProc_Info_(systeminfo,ntquerysysteminformation,spi_old,spi);//2.58
|
||||
|
||||
#endif
|
||||
#if defined _LINUX_
|
||||
userTicks=0;//2.12
|
||||
sysTicks=0;
|
||||
niceTicks=0;
|
||||
idleTicks=0;
|
||||
user=0;
|
||||
system=0;
|
||||
nice=0;
|
||||
idle=0;//2.12
|
||||
#endif
|
||||
cpuNbr = cpuN;
|
||||
}
|
||||
|
||||
CpuSensorHv::~CpuSensorHv()
|
||||
{}
|
||||
#if defined _LINUX_
|
||||
void CpuSensorHv::getTicks (long &u,long &s,long &n,long &i)//
|
||||
{
|
||||
|
||||
QFile file("/proc/stat");
|
||||
QString line;
|
||||
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream t( &file ); // use a text stream
|
||||
QRegExp rx( cpuNbr+"\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)");
|
||||
line = t.readLine();
|
||||
//line = rx.cap(1);
|
||||
|
||||
while ( (line = t.readLine()) !=0 && rx.cap(0) == "" )
|
||||
{
|
||||
rx.indexIn(line);
|
||||
}
|
||||
//user
|
||||
u = rx.cap(1).toLong();
|
||||
//nice
|
||||
n = rx.cap(2).toLong();
|
||||
//system
|
||||
s = rx.cap(3).toLong();
|
||||
//idle
|
||||
i = rx.cap(4).toLong();
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
u = 0;
|
||||
s = 0;
|
||||
n = 0;
|
||||
i = 0;
|
||||
}
|
||||
//qDebug()<<"u"<<u;
|
||||
//qDebug()<<"s"<<s;
|
||||
//qDebug()<<"n"<<n;
|
||||
//qDebug()<<"i"<<i;
|
||||
}
|
||||
#endif
|
||||
int CpuSensorHv::getCPULoad()
|
||||
{
|
||||
#if defined _LINUX_
|
||||
//QString str;
|
||||
long uTicks, sTicks, nTicks, iTicks;
|
||||
//cpuNbr = cpu;
|
||||
|
||||
|
||||
getTicks(uTicks, sTicks, nTicks, iTicks);
|
||||
|
||||
const long totalTicks = ((uTicks - userTicks) +
|
||||
(sTicks - sysTicks) +
|
||||
(nTicks - niceTicks) +
|
||||
(iTicks - idleTicks));
|
||||
|
||||
int load = (totalTicks == 0) ? 0 : (int) ( 100.0 * ( (uTicks+sTicks+nTicks) - (userTicks+sysTicks+niceTicks))/( totalTicks+0.001) + 0.5 );
|
||||
user = (totalTicks == 0) ? 0 : (int) ( 100.0 * ( uTicks - userTicks)/( totalTicks+0.001) + 0.5 );
|
||||
idle = (totalTicks == 0) ? 0 : (int) ( 100.0 * ( iTicks - idleTicks)/( totalTicks+0.001) + 0.5 );
|
||||
system = (totalTicks == 0) ? 0 : (int) ( 100.0 * ( sTicks - sysTicks)/( totalTicks+0.001) + 0.5 );
|
||||
nice = (totalTicks == 0) ? 0 : (int) ( 100.0 * ( nTicks - niceTicks)/( totalTicks+0.001) + 0.5 );
|
||||
|
||||
userTicks = uTicks;
|
||||
sysTicks = sTicks;
|
||||
niceTicks = nTicks;
|
||||
idleTicks = iTicks;
|
||||
//qDebug()<<"SSSSSSSSSSSSs"<<load;
|
||||
return load;
|
||||
#endif
|
||||
#if defined _WIN32_
|
||||
//qDebug()<<"------------------";
|
||||
if (!f_function)
|
||||
{
|
||||
ntquerysysteminformation(SystemProcessorPerformanceInformation,spi_old,(sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*systeminfo.dwNumberOfProcessors),&bytesreturned);
|
||||
f_function = true;
|
||||
//qDebug()<<"11count_function";
|
||||
}
|
||||
else
|
||||
{
|
||||
ntquerysysteminformation(SystemProcessorPerformanceInformation,spi,(sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*systeminfo.dwNumberOfProcessors),&bytesreturned);
|
||||
BYTE cpuusage = (BYTE) (100 - (((spi[cpu_num].IdleTime.QuadPart - spi_old[cpu_num].IdleTime.QuadPart) * 100) / \
|
||||
((spi[cpu_num].KernelTime.QuadPart + spi[cpu_num].UserTime.QuadPart) - (spi_old[cpu_num].KernelTime.QuadPart + spi_old[cpu_num].UserTime.QuadPart))));
|
||||
cpu_usage = cpuusage;
|
||||
f_function = false;
|
||||
//qDebug()<<"22count_function";
|
||||
}
|
||||
return cpu_usage;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
78
src/CpuWidget/cpusensorhv.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef CPUSENSORHV_H
|
||||
#define CPUSENSORHV_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
//#include <QObject>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QRegExp>
|
||||
|
||||
#if defined _WIN32_
|
||||
#include "windows.h"
|
||||
#define MAX_PROC 32
|
||||
typedef DWORD (__stdcall *LPFN_NtQuerySystemInformation)(DWORD, PVOID, DWORD, PDWORD);
|
||||
#define SystemProcessorPerformanceInformation 0x8
|
||||
#pragma pack(push,8)
|
||||
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER IdleTime;
|
||||
LARGE_INTEGER KernelTime;
|
||||
LARGE_INTEGER UserTime;
|
||||
LARGE_INTEGER DpcTime;
|
||||
LARGE_INTEGER InterruptTime;
|
||||
ULONG InterruptCount;
|
||||
}
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION,
|
||||
*PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
||||
#pragma pack(pop)
|
||||
extern int GetProc_Info_(SYSTEM_INFO &,LPFN_NtQuerySystemInformation &,SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *,SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *);
|
||||
#endif
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
class CpuSensorHv //: public QObject
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
CpuSensorHv(QString,int);
|
||||
virtual ~CpuSensorHv();
|
||||
|
||||
int getCPULoad();
|
||||
|
||||
private:
|
||||
#if defined _LINUX_
|
||||
long userTicks;
|
||||
long sysTicks;
|
||||
long niceTicks;
|
||||
long idleTicks;
|
||||
int user;
|
||||
int system;
|
||||
int nice;
|
||||
int idle;
|
||||
void getTicks(long &u,long &s,long &n,long &i);
|
||||
#endif
|
||||
QString cpuNbr;
|
||||
int cpu_num;// for windows
|
||||
#if defined _WIN32_
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi_old[MAX_PROC];
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi[MAX_PROC];
|
||||
SYSTEM_INFO systeminfo;
|
||||
unsigned long bytesreturned;
|
||||
LPFN_NtQuerySystemInformation ntquerysysteminformation;
|
||||
int cpu_usage;
|
||||
bool f_function;
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
242
src/CpuWidget/cpuwudget.cpp
Normal file
@ -0,0 +1,242 @@
|
||||
/* MSHV CpuWudgetW
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "cpuwudget.h"
|
||||
#define MAX_H_DISPLY_CPU 2
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CpuWudget_W::CpuWudget_W(int CpuN, int cpu_count, bool all_in_one, QWidget *parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
s_cpu_count = cpu_count;
|
||||
|
||||
QHBoxLayout *H_mcpu = new QHBoxLayout(this);
|
||||
H_mcpu->setContentsMargins ( 0, 0, 0, 0);
|
||||
|
||||
QHBoxLayout *H_mcpuv = new QHBoxLayout();
|
||||
H_mcpuv->setContentsMargins ( 0, 0, 0, 0);
|
||||
H_mcpuv->setSpacing(1);
|
||||
|
||||
QLabel *l_cpu;
|
||||
l_cpu = new QLabel();
|
||||
int h_150 = 13;//1.56=150% disp res
|
||||
|
||||
if (!all_in_one)
|
||||
{
|
||||
//l_cpu->setFixedSize(38, 12);//38
|
||||
l_cpu->setFixedHeight(h_150);
|
||||
l_cpu->setText("CPU"+QString("%1").arg(CpuN+1)+":");//THD CPU THRD
|
||||
//l_cpu->setText("THD"+QString("%1").arg(CpuN+1)+":");//THD CPU THRD
|
||||
H_mcpu->addWidget(l_cpu);
|
||||
TCpuSensorHv = new CpuSensorHv("cpu"+QString("%1").arg(CpuN), CpuN);
|
||||
THvProgBarSlowH = new HvProgBarSlowH(0,0,QPixmap(":pic/progress_on39.png"), QPixmap(":pic/progress_off39.png"), this);
|
||||
H_mcpu->addWidget(THvProgBarSlowH);
|
||||
H_mcpu->setAlignment(THvProgBarSlowH,Qt::AlignBottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
//l_cpu->setFixedSize(60, 12);//60
|
||||
l_cpu->setFixedHeight(h_150);
|
||||
l_cpu->setText("CPU "+QString("%1").arg(CpuN+1)+"-"+QString("%1").arg(cpu_count)+":");//THD CPU THRD
|
||||
//l_cpu->setText("THD "+QString("%1").arg(CpuN+1)+"-"+QString("%1").arg(cpu_count)+":");//THD CPU THRD
|
||||
H_mcpu->addWidget(l_cpu);
|
||||
for (int i = 0; i < s_cpu_count; i++)
|
||||
{
|
||||
CpuSensorHv *TTCpuSensorHv = new CpuSensorHv("cpu"+QString("%1").arg(i), i);
|
||||
ListCpuSensor.append(TTCpuSensorHv);
|
||||
HvProgBarSlowV *TTHvProgBarSlowV = new HvProgBarSlowV(0,0,QPixmap(":pic/progress_on_v12.png"), QPixmap(":pic/progress_off_v12.png"), this);
|
||||
ListProgBarV.append(TTHvProgBarSlowV);
|
||||
H_mcpuv->addWidget(TTHvProgBarSlowV);
|
||||
H_mcpuv->setAlignment(TTHvProgBarSlowV,Qt::AlignBottom);
|
||||
}
|
||||
H_mcpu->addLayout(H_mcpuv);
|
||||
}
|
||||
|
||||
l_cpu0 = new QLabel();
|
||||
l_cpu0->setFixedSize(38, h_150);//38 h_150=for->150% font size
|
||||
l_cpu0->setText("0%");
|
||||
|
||||
H_mcpu->addWidget(l_cpu0);
|
||||
H_mcpu->setAlignment(Qt::AlignRight);
|
||||
H_mcpu->setSpacing(2);
|
||||
setLayout(H_mcpu);
|
||||
|
||||
}
|
||||
CpuWudget_W::~CpuWudget_W()
|
||||
{}
|
||||
void CpuWudget_W::SetValue()
|
||||
{
|
||||
int cpu0 = TCpuSensorHv->getCPULoad();
|
||||
l_cpu0->setText(QString("%1%").arg(cpu0));//.arg(cpu0));
|
||||
THvProgBarSlowH->setValue(cpu0, 100);
|
||||
}
|
||||
void CpuWudget_W::SetValueAllInOne()
|
||||
{
|
||||
int cpus_losd = 0;
|
||||
for (int i = 0; i < s_cpu_count; i++)
|
||||
{
|
||||
int load = ListCpuSensor.at(i)->getCPULoad();
|
||||
cpus_losd += load;
|
||||
ListProgBarV.at(i)->setValue(load, 100);
|
||||
}
|
||||
cpus_losd = cpus_losd/s_cpu_count;
|
||||
l_cpu0->setText(QString("%1%").arg(cpus_losd));//.arg(cpu0));
|
||||
//THvProgBarSlowH->setValue(cpus_losd, 100);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
#if defined _WIN32_
|
||||
SYSTEM_INFO systeminfo;
|
||||
LPFN_NtQuerySystemInformation ntquerysysteminformation;
|
||||
#pragma pack(push,8)
|
||||
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi_old[32];
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi[32];
|
||||
#pragma pack(pop)
|
||||
int GetProc_Info_()
|
||||
{
|
||||
memset(spi_old,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*32);
|
||||
memset(spi,0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)*32);
|
||||
ntquerysysteminformation=(LPFN_NtQuerySystemInformation) GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "NtQuerySystemInformation");
|
||||
|
||||
if (!ntquerysysteminformation)
|
||||
{
|
||||
printf("\n*** no ntquerysysteminformation api?.. bugger");
|
||||
return -1;
|
||||
}
|
||||
GetSystemInfo(&systeminfo);
|
||||
return systeminfo.dwNumberOfProcessors;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
CpuWudget::CpuWudget( QWidget *parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
s_cpu_c = 1;
|
||||
H_B = new QHBoxLayout(this);
|
||||
H_B->setContentsMargins ( 0, 0, 0, 0);
|
||||
//H_B->setAlignment(Qt::AlignRight);
|
||||
H_B->setSpacing(0);
|
||||
this->setLayout(H_B);
|
||||
|
||||
ScanForCpus();
|
||||
|
||||
timer_refreshcpu = new QTimer();
|
||||
connect(timer_refreshcpu, SIGNAL(timeout()), this, SIGNAL(Refresh()));
|
||||
#if defined _WIN32_
|
||||
timer_refreshcpu->start(500);
|
||||
#endif
|
||||
#if defined _LINUX_
|
||||
#if defined _FREEBSDHV_
|
||||
//no timer needed
|
||||
#else
|
||||
timer_refreshcpu->start(1000);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
CpuWudget::~CpuWudget()
|
||||
{}
|
||||
void CpuWudget::AddWidgets(int number)
|
||||
{
|
||||
CpuWudget_W *TCpuWudget_W = new CpuWudget_W(number,0,false);
|
||||
H_B->addWidget(TCpuWudget_W);
|
||||
connect(this, SIGNAL(Refresh()), TCpuWudget_W, SLOT(SetValue()));
|
||||
}
|
||||
#if defined _FREEBSDHV_
|
||||
#include <QProcess>
|
||||
#endif
|
||||
void CpuWudget::ScanForCpus()
|
||||
{
|
||||
#if defined _LINUX_
|
||||
#if defined _FREEBSDHV_
|
||||
QProcess cmd;
|
||||
cmd.setProcessChannelMode(QProcess::MergedChannels);
|
||||
cmd.start("sysctl",QStringList() << "hw.ncpu");
|
||||
if (!cmd.waitForFinished()) return;
|
||||
QByteArray ba = cmd.readAll(); //hw.ncpu: 4
|
||||
QString res = QString(ba.data());
|
||||
res.remove("hw.ncpu:");
|
||||
//printf("----%d----\n",res.toInt());
|
||||
s_cpu_c = res.toInt();
|
||||
#else
|
||||
QDir tempdir = QDir("/sys/devices/system/cpu/");
|
||||
if (!tempdir.exists())
|
||||
{
|
||||
QMessageBox::warning(this, "MSHV",
|
||||
"No cpu info from /sys/devices/system/cpu/",
|
||||
QMessageBox::Close);
|
||||
return;
|
||||
}
|
||||
|
||||
tempdir.setSorting(QDir::Name);
|
||||
QStringList filetype;
|
||||
filetype <<"cpu*";
|
||||
QStringList Files = tempdir.entryList(filetype, QDir::Dirs); /// | QDir::NoSymLinks
|
||||
|
||||
if (Files.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, "MSHV",
|
||||
"No cpu info from /sys/devices/system/cpu/cpu??",
|
||||
QMessageBox::Close);
|
||||
return;
|
||||
}
|
||||
int cpu_count = 0;
|
||||
for (QStringList::iterator it = Files.begin(); it != Files.end(); it++)
|
||||
{
|
||||
QRegExp rx;
|
||||
rx.setPattern("cpu(\\d+)");
|
||||
if (rx.indexIn(*it) != -1)
|
||||
cpu_count++; //AddWidgets(rx.cap(1).toInt());
|
||||
}
|
||||
if (cpu_count <= MAX_H_DISPLY_CPU)
|
||||
{
|
||||
for (int i = 0; i < cpu_count; i++)
|
||||
AddWidgets(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
CpuWudget_W *TCpuWudget_W = new CpuWudget_W(0,cpu_count,true);
|
||||
H_B->addWidget(TCpuWudget_W);
|
||||
connect(this, SIGNAL(Refresh()), TCpuWudget_W, SLOT(SetValueAllInOne()));
|
||||
}
|
||||
s_cpu_c = cpu_count;
|
||||
#endif
|
||||
#endif
|
||||
#if defined _WIN32_
|
||||
SYSTEM_INFO systeminfo;
|
||||
LPFN_NtQuerySystemInformation ntquerysysteminformation;
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi_old[MAX_PROC];
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spi[MAX_PROC];
|
||||
int cpu_count = GetProc_Info_(systeminfo,ntquerysysteminformation,spi_old,spi);//2.58 GetProc_Info_();
|
||||
if (cpu_count<=0)
|
||||
{
|
||||
QMessageBox::warning(this, "MSHV",
|
||||
"No cpu info from ntdll.dll",
|
||||
QMessageBox::Close);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cpu_count <= MAX_H_DISPLY_CPU)
|
||||
{
|
||||
for (int i = 0; i < cpu_count; i++)
|
||||
{
|
||||
AddWidgets(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CpuWudget_W *TCpuWudget_W = new CpuWudget_W(0,cpu_count,true);
|
||||
H_B->addWidget(TCpuWudget_W);
|
||||
connect(this, SIGNAL(Refresh()), TCpuWudget_W, SLOT(SetValueAllInOne()));
|
||||
}
|
||||
}
|
||||
s_cpu_c = cpu_count;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
71
src/CpuWidget/cpuwudget.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef CPUWUDGET_H
|
||||
#define CPUWUDGET_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
#include "HvProgBarSlowH/hvprogbarslowh.h"
|
||||
#include "cpusensorhv.h"
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
class CpuWudget_W : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CpuWudget_W(int CpuN, int cpu_count, bool all_in_one, QWidget *parent = 0);
|
||||
virtual ~CpuWudget_W();
|
||||
|
||||
public slots:
|
||||
void SetValue();
|
||||
void SetValueAllInOne();
|
||||
|
||||
private:
|
||||
HvProgBarSlowH *THvProgBarSlowH;
|
||||
QLabel *l_cpu0;
|
||||
CpuSensorHv *TCpuSensorHv;
|
||||
int s_cpu_count;
|
||||
QList<CpuSensorHv *> ListCpuSensor;
|
||||
QList<HvProgBarSlowV *> ListProgBarV;
|
||||
};
|
||||
|
||||
class CpuWudget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CpuWudget(QWidget *parent = 0);
|
||||
virtual ~CpuWudget();
|
||||
int GetThrCount()
|
||||
{
|
||||
if (s_cpu_c>0)//protection
|
||||
return s_cpu_c;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
signals:
|
||||
void Refresh();
|
||||
//void EmitCpuCount(int);
|
||||
|
||||
private:
|
||||
int s_cpu_c;
|
||||
void ScanForCpus();
|
||||
void AddWidgets(int number);
|
||||
//void AddWidgetForAll(int cpu_count);
|
||||
QHBoxLayout *H_B;
|
||||
QTimer *timer_refreshcpu;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
572
src/DisplayMs/HvCustomPalW/custompalw.cpp
Normal file
@ -0,0 +1,572 @@
|
||||
/* MSHV CustomPalW
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#include "custompalw.h"
|
||||
|
||||
//#include <QDesktopWidget>
|
||||
//#include <QApplication>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPainter>
|
||||
#include <math.h> /* fabs */
|
||||
//#include <QtGui>
|
||||
|
||||
ImgW::ImgW( QWidget * parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
img_pal = QImage(20, 501, QImage::Format_RGB32);
|
||||
img_pal.fill(Qt::white);
|
||||
setFixedSize(100,501);
|
||||
//setStyleSheet("background-color:black;");
|
||||
//setStyleSheet("QWidget{background-color:black;}");
|
||||
|
||||
/*
|
||||
posYtxt[0] = 220;//180;//220;//+20
|
||||
dBtext[0] = " +20 dB";
|
||||
posYtxt[1] = 262;//220;//+10
|
||||
dBtext[1] = " +10 dB";
|
||||
posYtxt[2] = 306;//265; //0
|
||||
dBtext[2] = " 0 dB";
|
||||
posYtxt[3] = 350;//310;//282;//-10
|
||||
dBtext[3] = " -10 dB";
|
||||
posYtxt[4] = 400;//361;//300;//-20
|
||||
dBtext[4] = " -20 dB";
|
||||
posYtxt[5] = 450;//390;//340;//-30
|
||||
dBtext[5] = "";//" -30 dB";
|
||||
*/
|
||||
|
||||
posYtxt[0] = 150+4;
|
||||
dBtext[0] = " 150 pix";
|
||||
posYtxt[1] = 200+4;//180;//220;//+20
|
||||
dBtext[1] = " 200 pix";
|
||||
posYtxt[2] = 250+4;//220;//+10
|
||||
dBtext[2] = " 250 pix";
|
||||
posYtxt[3] = 300+4;//265; //0
|
||||
dBtext[3] = " 300 pix";
|
||||
posYtxt[4] = 350+4;//310;//282;//-10
|
||||
dBtext[4] = " 350 pix";
|
||||
posYtxt[5] = 400+4;//361;//300;//-20
|
||||
dBtext[5] = " 400 pix";
|
||||
// posYtxt[5] = 450+4;//390;//340;//-30
|
||||
// dBtext[5] = " 450 pix";//" -30 dB";
|
||||
|
||||
//2.46
|
||||
posYlin[0] = 63;
|
||||
posYlin[1] = 126;
|
||||
posYlin[2] = 189;
|
||||
posYlin[3] = 252;
|
||||
posYlin[4] = 315;
|
||||
posYlin[5] = 378;
|
||||
posYlin[6] = 441;
|
||||
|
||||
update();
|
||||
}
|
||||
ImgW::~ImgW()
|
||||
{}
|
||||
void ImgW::SetPosLin(int l[7])//2.46
|
||||
{
|
||||
posYlin[0] = l[0];
|
||||
posYlin[1] = l[1];
|
||||
posYlin[2] = l[2];
|
||||
posYlin[3] = l[3];
|
||||
posYlin[4] = l[4];
|
||||
posYlin[5] = l[5];
|
||||
posYlin[6] = l[6];
|
||||
}
|
||||
void ImgW::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.save();
|
||||
//painter.fillRect(0, 0, width(), height(), QColor(0,0,0,255));
|
||||
painter.fillRect(0,0,width(),height(),QColor(255,255,255));
|
||||
painter.drawImage(7,0,img_pal);
|
||||
|
||||
painter.setPen(QPen(QColor(0,0,0),3));//2.54
|
||||
|
||||
for (int i=0; i < 6; i++)
|
||||
painter.drawText(20+20, posYtxt[i],dBtext[i]);
|
||||
|
||||
//painter.setPen(QPen(QColor(0,0,0),3));
|
||||
for (int i=0; i < 7; i++)
|
||||
{
|
||||
/*painter.drawLine(28, posYlin[i], 31, posYlin[i]);
|
||||
painter.drawLine(2, posYlin[i], 5, posYlin[i]);*/
|
||||
painter.drawLine(29, posYlin[i], 30, posYlin[i]);
|
||||
painter.drawLine(3, posYlin[i], 4, posYlin[i]);
|
||||
}
|
||||
|
||||
//stop if make print screan for new palette //
|
||||
painter.setPen(QPen(QColor(0,0,255),0));
|
||||
painter.drawRect(0, 0, 100-1, 501-1);
|
||||
painter.setPen(QPen(QColor(255,255,255),4));
|
||||
//painter.drawRect(3, 3, 100-6, 501-6);
|
||||
painter.drawLine(8, 3, 26, 3);
|
||||
painter.drawLine(8, 501-3, 26, 501-3);
|
||||
//end stop if make print screan for new palette //
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
CustomPalW::CustomPalW(int x,int y,QWidget * parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
//App_Name = "Empty Project v.001";
|
||||
setWindowTitle(tr("Custom Palette Editor"));
|
||||
setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint &~ Qt::WindowContextHelpButtonHint);
|
||||
setWindowIcon(QPixmap(":pic/ms_ico.png"));
|
||||
//setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||
//setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
|
||||
//QPixmap image;
|
||||
//setFixedSize(200,650);
|
||||
//this->setMinimumWidth(270);
|
||||
|
||||
TImgW = new ImgW();
|
||||
//TImgW->setStyleSheet("background-color:black;");
|
||||
//TImgW->setContentsMargins(0,0,30,0);
|
||||
|
||||
g_block_z = false;
|
||||
//f_inc_z_range = 0;
|
||||
z_all[0] = 63;
|
||||
z_all[1] = 126;
|
||||
z_all[2] = 189;
|
||||
z_all[3] = 252;
|
||||
z_all[4] = 315;
|
||||
z_all[5] = 378;
|
||||
z_all[6] = 441;
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
SB_z[i] = new QSpinBox();
|
||||
SB_z[i]->setSingleStep(1);
|
||||
SB_z[i]->setSuffix(" pix");
|
||||
SB_z[i]->setRange(0,500);
|
||||
SB_z[i]->setValue(z_all[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; ++i) connect(SB_z[i], SIGNAL(valueChanged(int)), this, SLOT(ZChanged(int)));
|
||||
|
||||
b_ident = -1;
|
||||
int but_height = 20;
|
||||
/*b_c[0]= new QPushButton(" "+tr("COLOR")+" 1 ");
|
||||
b_c[0]->setFixedHeight(but_height);
|
||||
b_c[1]= new QPushButton(" "+tr("COLOR")+" 2 ");
|
||||
b_c[1]->setFixedHeight(but_height);
|
||||
b_c[2]= new QPushButton(" "+tr("COLOR")+" 3 ");
|
||||
b_c[2]->setFixedHeight(but_height);
|
||||
b_c[3]= new QPushButton(" "+tr("COLOR")+" 4 ");
|
||||
b_c[3]->setFixedHeight(but_height);
|
||||
b_c[4]= new QPushButton(" "+tr("COLOR")+" 5 ");
|
||||
b_c[4]->setFixedHeight(but_height);
|
||||
b_c[5]= new QPushButton(" "+tr("COLOR")+" 6 ");
|
||||
b_c[5]->setFixedHeight(but_height);
|
||||
b_c[6]= new QPushButton(" "+tr("COLOR")+" 7 ");
|
||||
b_c[6]->setFixedHeight(but_height);
|
||||
b_c[7]= new QPushButton(" "+tr("COLOR")+" 8 ");
|
||||
b_c[7]->setFixedHeight(but_height);
|
||||
b_c[8]= new QPushButton(" "+tr("COLOR")+" 9 ");
|
||||
b_c[8]->setFixedHeight(but_height);*/
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
b_c[i]= new QPushButton(" "+tr("COLOR")+" "+QString("%1").arg(i+1)+" ");
|
||||
b_c[i]->setFixedHeight(but_height);
|
||||
}
|
||||
b_c_wave= new QPushButton(tr("WAVE COLOR"));
|
||||
b_c_wave->setFixedHeight(but_height);
|
||||
b_c_wavel= new QPushButton(tr("WAVE LINE"));
|
||||
b_c_wavel->setFixedHeight(but_height);
|
||||
cb_no_wave = new QCheckBox(tr("OFF"));
|
||||
cb_no_wave->setFixedWidth(50);
|
||||
connect(b_c[0], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox1()));
|
||||
connect(b_c[1], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox2()));
|
||||
connect(b_c[2], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox3()));
|
||||
connect(b_c[3], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox4()));
|
||||
connect(b_c[4], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox5()));
|
||||
connect(b_c[5], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox6()));
|
||||
connect(b_c[6], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox7()));
|
||||
connect(b_c[7], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox8()));
|
||||
connect(b_c[8], SIGNAL(clicked(bool)), this, SLOT(OpenCDBox9()));
|
||||
connect(b_c_wave, SIGNAL(clicked(bool)), this, SLOT(OpenCDBoxW()));
|
||||
connect(b_c_wavel, SIGNAL(clicked(bool)), this, SLOT(OpenCDBoxWL()));
|
||||
connect(cb_no_wave, SIGNAL(toggled(bool)), this, SLOT(CbNoWave()));
|
||||
|
||||
QHBoxLayout *H_wave = new QHBoxLayout();
|
||||
H_wave->addWidget(cb_no_wave);
|
||||
H_wave->addWidget(b_c_wave);
|
||||
//H_wave->addWidget(cb_no_wave);
|
||||
H_wave->addWidget(b_c_wavel);
|
||||
|
||||
CD_box = new QColorDialog(this);
|
||||
CD_box->setOption(QColorDialog::NoButtons);
|
||||
connect(CD_box, SIGNAL(currentColorChanged(QColor)), this, SLOT(ColorChanged(QColor)));
|
||||
//void colorSelected ( const QColor & color )
|
||||
//void currentColorChanged ( const QColor & color )
|
||||
|
||||
//b_set_default = new QPushButton("SET DEFAULT PALETTE");
|
||||
b_set_default = new QPushButton(tr("SET DEFAULT"));
|
||||
b_set_default->setFixedHeight(but_height);
|
||||
connect(b_set_default, SIGNAL(clicked(bool)), this, SLOT(setDefColorsAndPos()));
|
||||
|
||||
QVBoxLayout *v_ls = new QVBoxLayout();
|
||||
v_ls->setContentsMargins(25,0,0,0);
|
||||
v_ls->addWidget(b_set_default);
|
||||
/*v_ls->addWidget(b_c[0]);
|
||||
v_ls->addWidget(SB_z[0]);
|
||||
v_ls->addWidget(b_c[1]);
|
||||
v_ls->addWidget(SB_z[1]);
|
||||
v_ls->addWidget(b_c[2]);
|
||||
v_ls->addWidget(SB_z[2]);
|
||||
v_ls->addWidget(b_c[3]);
|
||||
v_ls->addWidget(SB_z[3]);
|
||||
v_ls->addWidget(b_c[4]);
|
||||
v_ls->addWidget(SB_z[4]);
|
||||
v_ls->addWidget(b_c[5]);
|
||||
v_ls->addWidget(SB_z[5]);
|
||||
v_ls->addWidget(b_c[6]);
|
||||
v_ls->addWidget(SB_z[6]);*/
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
if (i<7)
|
||||
{
|
||||
v_ls->addWidget(b_c[i]);
|
||||
v_ls->addWidget(SB_z[i]);
|
||||
}
|
||||
else v_ls->addWidget(b_c[i]);
|
||||
}
|
||||
/*v_ls->addWidget(b_c[7]);
|
||||
v_ls->addWidget(b_c[8]);*/
|
||||
|
||||
QHBoxLayout *H_l = new QHBoxLayout();
|
||||
//H_l->setContentsMargins(30,0,5,0);
|
||||
//H_l->setSpacing(30);
|
||||
H_l->addWidget(TImgW);
|
||||
H_l->addLayout(v_ls);
|
||||
|
||||
//TImgW->setStyleSheet("QWidget{background-color:black;}");
|
||||
|
||||
|
||||
//b_set = new QPushButton(" SET PALETTE TO DISPLAYS ");
|
||||
//connect(b_set, SIGNAL(clicked(bool)), this, SLOT(SetPaletteToDisplay()));
|
||||
|
||||
QVBoxLayout *V_l = new QVBoxLayout(this);
|
||||
V_l->setContentsMargins(10,5,10,5);
|
||||
// V_l->addWidget(b_set_default);
|
||||
V_l->addLayout(H_l);
|
||||
V_l->addLayout(H_wave);
|
||||
//V_l->addWidget(b_c_wave);
|
||||
//V_l->addWidget(b_set);
|
||||
|
||||
this->setLayout(V_l);
|
||||
|
||||
move(x,y);
|
||||
|
||||
setDefColorsAndPos();
|
||||
/*for (int i=0; i < 11; i++)
|
||||
{
|
||||
b_ident = i;
|
||||
ColorChanged(collors[i]);
|
||||
}*/
|
||||
|
||||
//setPalette();
|
||||
}
|
||||
CustomPalW::~CustomPalW()
|
||||
{}
|
||||
void CustomPalW::OpenCDBox_p()
|
||||
{
|
||||
CD_box->move(pos().x()+width(),pos().y()+80);
|
||||
CD_box->open();
|
||||
CD_box->setCurrentColor(collors[b_ident].rgb());
|
||||
}
|
||||
void CustomPalW::OpenCDBox1()
|
||||
{
|
||||
b_ident = 0;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox2()
|
||||
{
|
||||
b_ident = 1;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox3()
|
||||
{
|
||||
b_ident = 2;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox4()
|
||||
{
|
||||
b_ident = 3;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox5()
|
||||
{
|
||||
b_ident = 4;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox6()
|
||||
{
|
||||
b_ident = 5;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox7()
|
||||
{
|
||||
b_ident = 6;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox8()
|
||||
{
|
||||
b_ident = 7;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBox9()
|
||||
{
|
||||
b_ident = 8;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBoxW()
|
||||
{
|
||||
b_ident = 9;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::OpenCDBoxWL()
|
||||
{
|
||||
b_ident = 10;
|
||||
OpenCDBox_p();
|
||||
}
|
||||
void CustomPalW::CbNoWave()
|
||||
{
|
||||
if (cb_no_wave->isChecked()) collors[9].setAlpha(0);
|
||||
else collors[9].setAlpha(255);
|
||||
RefreshAll();
|
||||
}
|
||||
void CustomPalW::ColorChanged(QColor c)
|
||||
{
|
||||
//"QLabel{background-color :rgb(145, 220, 255);}"
|
||||
//QString s ="QPushButton{background-color :rgb("+QString("%1").arg(c.red())+","+QString("%1").arg(c.green())+","+QString("%1").arg(c.blue())+");}";
|
||||
QString s ="QPushButton{border-color :rgb("+QString("%1").arg(c.red())+","+QString("%1").arg(c.green())+","+QString("%1").arg(c.blue())+");border-width: 4px;border-style: outset;border-radius: 5px;}";
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
if (b_ident==i)
|
||||
{
|
||||
b_c[i]->setStyleSheet(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (b_ident)
|
||||
{
|
||||
/*case 0:
|
||||
b_c1->setStyleSheet(s);
|
||||
break;
|
||||
case 1:
|
||||
b_c2->setStyleSheet(s);
|
||||
break;
|
||||
case 2:
|
||||
b_c3->setStyleSheet(s);
|
||||
break;
|
||||
case 3:
|
||||
b_c4->setStyleSheet(s);
|
||||
break;
|
||||
case 4:
|
||||
b_c5->setStyleSheet(s);
|
||||
break;
|
||||
case 5:
|
||||
b_c6->setStyleSheet(s);
|
||||
break;
|
||||
case 6:
|
||||
b_c7->setStyleSheet(s);
|
||||
break;
|
||||
case 7:
|
||||
b_c8->setStyleSheet(s);
|
||||
break;
|
||||
case 8:
|
||||
b_c9->setStyleSheet(s);
|
||||
break;*/
|
||||
case 9:
|
||||
b_c_wave->setStyleSheet(s);
|
||||
break;
|
||||
case 10:
|
||||
b_c_wavel->setStyleSheet(s);
|
||||
break;
|
||||
}
|
||||
|
||||
collors[b_ident]=c;
|
||||
if (b_ident==9)
|
||||
{
|
||||
if (cb_no_wave->isChecked())
|
||||
collors[b_ident].setAlpha(0);
|
||||
else
|
||||
collors[b_ident].setAlpha(255);
|
||||
}
|
||||
|
||||
if (!g_block_z)
|
||||
{
|
||||
setPalette();
|
||||
SetPaletteToDisplay();
|
||||
}
|
||||
//qDebug()<<c.red()<<c.green()<<c.blue();
|
||||
}
|
||||
void CustomPalW::ZChanged(int)
|
||||
{
|
||||
if (!g_block_z)
|
||||
{
|
||||
//qDebug()<<"ppppppp";
|
||||
for (int i = 0; i < 7; ++i) z_all[i] = SB_z[i]->value();
|
||||
|
||||
//z_all[3] = SB_z3->value(); // for test dB
|
||||
|
||||
setPalette();
|
||||
SetPaletteToDisplay();
|
||||
}
|
||||
}
|
||||
void CustomPalW::RefreshAll()
|
||||
{
|
||||
g_block_z = true;
|
||||
|
||||
for (int i = 0; i < 7; ++i) SB_z[i]->setValue(z_all[i]);
|
||||
|
||||
for (int i=0; i < 11; i++)
|
||||
{
|
||||
b_ident = i;
|
||||
ColorChanged(collors[i]);
|
||||
}
|
||||
|
||||
/*if (collors[9].alpha()==0)
|
||||
cb_no_wave->setChecked(true);
|
||||
else
|
||||
cb_no_wave->setChecked(false);*/
|
||||
|
||||
g_block_z = false;
|
||||
ZChanged(0);
|
||||
}
|
||||
void CustomPalW::SetPalSettings(QString s)
|
||||
{
|
||||
QStringList ls=s.split("#");
|
||||
//qDebug()<<ls.count()<<ls;
|
||||
if (ls.count()==41)//???
|
||||
{
|
||||
for (int i =0; i<7; i++)
|
||||
z_all[i] = ls[i].toInt();
|
||||
int k = 7;
|
||||
for (int i =0; i<11; i++)
|
||||
{
|
||||
collors[i].setRed(ls[k].toInt());
|
||||
k++;
|
||||
collors[i].setGreen(ls[k].toInt());
|
||||
k++;
|
||||
collors[i].setBlue(ls[k].toInt());
|
||||
k++;
|
||||
if (i==9)
|
||||
{
|
||||
collors[i].setAlpha(ls[k].toInt());
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
RefreshAll();
|
||||
}
|
||||
void CustomPalW::setDefColorsAndPos()
|
||||
{
|
||||
z_all[0] = 200;
|
||||
z_all[1] = 240;
|
||||
z_all[2] = 255;
|
||||
z_all[3] = 283; //0
|
||||
z_all[4] = 300;
|
||||
z_all[5] = 370;
|
||||
z_all[6] = 415;
|
||||
|
||||
collors[0] = QColor(240,240,240); // 0
|
||||
collors[1] = QColor(255,0,0);
|
||||
collors[2] = QColor(255,240,0);
|
||||
collors[3] = QColor(235,235,235);
|
||||
collors[4] = QColor(0,55,206);
|
||||
collors[5] = QColor(0,53,138);
|
||||
collors[6] = QColor(0,20,39);
|
||||
collors[7] = QColor(20,20,20);
|
||||
collors[8] = QColor(0,0,0); // 500
|
||||
|
||||
collors[9] = QColor(0,40,134,255);
|
||||
cb_no_wave->setChecked(false);
|
||||
|
||||
collors[10] = QColor(255,255,255);
|
||||
|
||||
RefreshAll();
|
||||
}
|
||||
void CustomPalW::setRegion(int z1,int z2,int r0,int g0,int b0,int r1,int g1,int b1)
|
||||
{
|
||||
//double inc = 31.0/(double)(z2-z1);
|
||||
//qDebug()<<inc;
|
||||
//double i = 31.7;
|
||||
bool f_r = false;
|
||||
bool f_g = false;
|
||||
bool f_b = false;
|
||||
|
||||
if (r0-r1<0)
|
||||
f_r = true;
|
||||
if (g0-g1<0)
|
||||
f_g = true;
|
||||
if (b0-b1<0)
|
||||
f_b = true;
|
||||
|
||||
double inc_r = (double)fabs(r0-r1)/(double)(z2-z1);// qDebug()<<inc_r;
|
||||
double inc_g = (double)fabs(g0-g1)/(double)(z2-z1);// qDebug()<<inc_g;
|
||||
double inc_b = (double)fabs(b0-b1)/(double)(z2-z1);// qDebug()<<inc_b;
|
||||
double r = r0;
|
||||
double g = g0;
|
||||
double b = b0;
|
||||
|
||||
for (int k=z1; k < z2; k++)
|
||||
{
|
||||
for (int j=0; j < 20; j++)
|
||||
TImgW->img_pal.setPixel(j,k,QColor((int)r,(int)g,(int)b).rgb()); //378
|
||||
|
||||
if (f_r)
|
||||
r = r + inc_r;
|
||||
else
|
||||
r = r - inc_r;
|
||||
|
||||
if (f_g)
|
||||
g = g + inc_g;
|
||||
else
|
||||
g = g - inc_g;
|
||||
|
||||
if (f_b)
|
||||
b = b + inc_b;
|
||||
else
|
||||
b = b - inc_b;
|
||||
//i = i - inc;
|
||||
//qDebug()<<(int)r<<(int)g<<(int)b;
|
||||
}
|
||||
}
|
||||
void CustomPalW::setPalette()
|
||||
{
|
||||
/* for test dB
|
||||
for (int k=0; k < 500; k++)
|
||||
{
|
||||
for (int j=0; j < 20; j++)
|
||||
TImgW->img_pal.setPixel(j,k,QColor(255,255,255).rgb());
|
||||
}
|
||||
setRegion(z_all[3], z_all[3]+20,collors[3].red(),collors[3].green(),collors[3].blue(),collors[4].red(),collors[4].green(),collors[4].blue());
|
||||
*/
|
||||
|
||||
//qDebug()<<"tttttt"<<collors[1].red()<<collors[1].green()<<collors[1].blue();
|
||||
//qDebug()<<"uuuuuu"<<collors[2].red()<<collors[2].green()<<collors[2].blue();
|
||||
setRegion(0,z_all[0],collors[0].red(),collors[0].green(),collors[0].blue(),collors[1].red(),collors[1].green(),collors[1].blue());
|
||||
setRegion(z_all[0], z_all[1],collors[1].red(),collors[1].green(),collors[1].blue(),collors[2].red(),collors[2].green(),collors[2].blue());
|
||||
setRegion(z_all[1], z_all[2],collors[2].red(),collors[2].green(),collors[2].blue(),collors[3].red(),collors[3].green(),collors[3].blue());
|
||||
setRegion(z_all[2], z_all[3],collors[3].red(),collors[3].green(),collors[3].blue(),collors[4].red(),collors[4].green(),collors[4].blue());
|
||||
setRegion(z_all[3], z_all[4],collors[4].red(),collors[4].green(),collors[4].blue(),collors[5].red(),collors[5].green(),collors[5].blue());
|
||||
setRegion(z_all[4], z_all[5],collors[5].red(),collors[5].green(),collors[5].blue(),collors[6].red(),collors[6].green(),collors[6].blue());
|
||||
setRegion(z_all[5], z_all[6],collors[6].red(),collors[6].green(),collors[6].blue(),collors[7].red(),collors[7].green(),collors[7].blue());
|
||||
setRegion(z_all[6],501,collors[7].red(),collors[7].green(),collors[7].blue(),collors[8].red(),collors[8].green(),collors[8].blue());
|
||||
TImgW->SetPosLin(z_all);//2.46
|
||||
|
||||
update();
|
||||
}
|
||||
void CustomPalW::SetPaletteToDisplay()
|
||||
{
|
||||
QPixmap pic = QPixmap::fromImage(TImgW->img_pal);
|
||||
emit EmitCustomPalette(pic,collors[9],collors[10]);
|
||||
}
|
||||
|
||||
|
144
src/DisplayMs/HvCustomPalW/custompalw.h
Normal file
@ -0,0 +1,144 @@
|
||||
#ifndef CUSTOMPLAW_H
|
||||
#define CUSTOMPLAW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QImage>
|
||||
#include <QColorDialog>
|
||||
#include <QCheckBox>
|
||||
|
||||
class ImgW : public QWidget
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
ImgW( QWidget * parent = 0 );
|
||||
virtual ~ImgW();
|
||||
|
||||
QImage img_pal;
|
||||
void SetPosLin(int l[7]);
|
||||
//private slots:
|
||||
|
||||
private:
|
||||
int posYtxt[10];
|
||||
QString dBtext[10];
|
||||
int posYlin[7]; //2.46
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
};
|
||||
|
||||
class CustomPalW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CustomPalW(int,int,QWidget * parent = 0);
|
||||
~CustomPalW();
|
||||
|
||||
void SetPaletteToDisplay();
|
||||
void SetPalSettings(QString);
|
||||
QString GetPalSettings()
|
||||
{
|
||||
QString s;
|
||||
for (int i =0; i<7; i++)
|
||||
{
|
||||
s.append(QString("%1").arg(z_all[i]));
|
||||
s.append("#");
|
||||
}
|
||||
for (int i =0; i<11; i++)
|
||||
{
|
||||
s.append(QString("%1").arg(collors[i].red()));
|
||||
s.append("#");
|
||||
s.append(QString("%1").arg(collors[i].green()));
|
||||
s.append("#");
|
||||
s.append(QString("%1").arg(collors[i].blue()));
|
||||
|
||||
if (i==9)
|
||||
{
|
||||
s.append("#");
|
||||
s.append(QString("%1").arg(collors[i].alpha()));
|
||||
}
|
||||
|
||||
if (i<11-1)
|
||||
s.append("#");
|
||||
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
signals:
|
||||
void EmitCustomPalette(QPixmap,QColor,QColor);
|
||||
|
||||
public slots:
|
||||
//void SetPaletteToDisplay();
|
||||
|
||||
private slots:
|
||||
void ZChanged(int);
|
||||
void OpenCDBox1();
|
||||
void OpenCDBox2();
|
||||
void OpenCDBox3();
|
||||
void OpenCDBox4();
|
||||
void OpenCDBox5();
|
||||
void OpenCDBox6();
|
||||
void OpenCDBox7();
|
||||
void OpenCDBox8();
|
||||
void OpenCDBox9();
|
||||
void OpenCDBoxW();
|
||||
void OpenCDBoxWL();
|
||||
void CbNoWave();
|
||||
void ColorChanged(QColor);
|
||||
void setDefColorsAndPos();
|
||||
//void SetPaletteToDisplay();
|
||||
|
||||
private:
|
||||
bool g_block_z;
|
||||
//int f_inc_z_range;
|
||||
int b_ident;
|
||||
QColor collors[11];
|
||||
int z_all[7];
|
||||
//QColor wave_collor;
|
||||
/*int z1;
|
||||
int z2;
|
||||
int z3;
|
||||
int z4;
|
||||
int z5;
|
||||
int z6;
|
||||
int z7;*/
|
||||
QPushButton *b_c[9];
|
||||
QPushButton *b_c_wave;
|
||||
QPushButton *b_c_wavel;
|
||||
QCheckBox *cb_no_wave;
|
||||
|
||||
QSpinBox *SB_z[7];
|
||||
|
||||
QColorDialog *CD_box;
|
||||
|
||||
//QImage img_pal;
|
||||
//QPixmap s_pic;
|
||||
ImgW *TImgW;
|
||||
//QPushButton *b_set;
|
||||
QPushButton *b_set_default;
|
||||
void OpenCDBox_p();
|
||||
void setPalette();
|
||||
void setRegion(int,int,int,int,int,int,int,int);
|
||||
void RefreshAll();
|
||||
//void MoveDialog();
|
||||
|
||||
|
||||
|
||||
//QPushButton *b_c7;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
2938
src/DisplayMs/display_ms.cpp
Normal file
360
src/DisplayMs/display_ms.h
Normal file
@ -0,0 +1,360 @@
|
||||
/* MSHV DisplayMs
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef DISPLAY_MS_H
|
||||
#define DISPLAY_MS_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
#define RAW_BUFFER_SIZE (12000*130) //2.53=120 old=90 60s=normal -> for any case 90s samplerate*time in seconds 1min=60s
|
||||
#define RAW_BUF_PREV_PI4 (36000) //2.16 3s from prew perod 1s from prew perod 12000*3 3sec
|
||||
|
||||
/*
|
||||
#if defined _WIN32_
|
||||
//#include "../../../DirectX90c/include/dsound.h"// zaradi DWORD in pathred create
|
||||
#include "../Hv_Lib_DirectX90c/dsound.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define COUNT_MOUSE_LINES 2
|
||||
#define MAX_LINES_SCALE_X 320 //for=5min old=216 //1.35 60s=normal -> for any case 90s // jt65 5000hz/50hz=100 lines
|
||||
#define MAX_DEC_LABELS_COUNT 40 //max 40 labels for 30s and decoderms.h
|
||||
#define MAX_DEC_LINES_COUNT 140 //max 140 lines for 30s and decoderms.h
|
||||
//#include <QMouseEvent>
|
||||
//#include <math.h>
|
||||
#include <unistd.h> // zaradi usleep pthread.h
|
||||
|
||||
//#include <QGLWidget>
|
||||
|
||||
|
||||
class DisplayMs : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DisplayMs(int dispident,bool,QWidget * parent = 0);
|
||||
~DisplayMs();
|
||||
|
||||
void SetPalette(int identif);
|
||||
void SetDisplayRefr(int val);
|
||||
//void SetSampleRate(int val);
|
||||
QString default_color()
|
||||
{
|
||||
return QString("%1").arg(saved_color);
|
||||
};
|
||||
|
||||
void ResetToBegin();//QString,QString
|
||||
void SetSyncPosition(int,QString,QString,bool decodet);
|
||||
void setHDispPeriodTime(int,int);//setPeriodTime(int);
|
||||
|
||||
void setVDispFreqScale(int,int);
|
||||
|
||||
void setDisplayTime(QString,QString);
|
||||
QString getFullFileName()
|
||||
{
|
||||
return full_file_name;
|
||||
}
|
||||
void setArrayInPxel(int);
|
||||
void DecodeAllData(bool decode,bool external);
|
||||
void SetMode(int);
|
||||
void SetVDisplayHight(int);
|
||||
void SetButtonDecodeAll65(int ident);//1.49
|
||||
void setTune(int,int);//1.55=
|
||||
void SetFont(QFont);
|
||||
void SetFreqRxTxVD(QString rxtx);
|
||||
QString GetFreqRxTxVD();
|
||||
void SetAdleDisplay_VD(bool);//2.45
|
||||
void SetFlatDisplay_VD(bool);//1.51
|
||||
|
||||
signals:
|
||||
void SentData(QList<int*>,QPoint*,int,short*,QString t_min,QString ymd,bool,QLine *mous_lines,
|
||||
int*,QString*,int*,int,int*,int,bool,QLine *linesrtd,int posrtd,int updposrtd,bool endrtd); //1.27 psk rep fopen bool true false no file open
|
||||
//void EmitDecodetText(QStringList);
|
||||
void EmitDataToDecode(short*,int,QString t_min,int t_istart,int mousebutton,bool f_rtd,bool end_rtd,bool fopen);//1.27 psk rep fopen bool true false no file open
|
||||
void EmitDataToSaveInFile(short*,int,QString);
|
||||
void EmitFileNameChenged();
|
||||
void EmitZapData(short*,int);
|
||||
|
||||
void EmitDecLinesPosToSecondDisp(int count,double pos,double pos_ping,QString p_time);//1.28 p_time is not from this period sent to second display
|
||||
|
||||
void EmitRriorityDisp(bool);
|
||||
void EmitResetToBegin();
|
||||
void EmitVDMouseDecodeSecondDisp(int mousebutton);
|
||||
void EmitVDRxFreqF0F1(double,double,double);
|
||||
void EmitVDRxDf(int);
|
||||
void EmitVDTxFreq(double);
|
||||
//void EmitButtonVDDecodeAllToSecondDsp65();//1.49
|
||||
void EmitIsDispHaveDataForDec65(int,bool);//1.49
|
||||
|
||||
public slots:
|
||||
void SetFtDf1500(bool);
|
||||
void Decode3intFt(bool);//2.39 remm
|
||||
void SetDecLinesPosToDisplay(int count,double pos,double pos_ping,QString p_time);//1.28 p_time for identif perood
|
||||
void SetValue(double*, int);
|
||||
void SetRaw(short*,int,bool); //1.27 psk rep fopen bool true false no file open
|
||||
void ReciveData(QList<int*>,QPoint*,int,short*,QString t_min,QString ymd,bool,QLine *mous_lines,
|
||||
int*,QString*,int*,int,int*,int,bool,QLine *linesrtd,int posrtd,int updposrtd,bool endrtd);//1.27 psk rep fopen bool true false no file open
|
||||
void ReciveClarDisplay();
|
||||
//void setTune(int,int);
|
||||
//void setTuneCont(int,int);
|
||||
void SaveFile(QString);
|
||||
void SetAutoDecodeAll(bool);
|
||||
void SetZap(bool);
|
||||
///rtd//
|
||||
void SetDecBusy(bool,int);
|
||||
void SetStartStopRtd(bool);
|
||||
void SetRriorityDisp(bool);
|
||||
void SetVDMouseDecodeSecondDisp(int mousebutton);
|
||||
//void SetButtonVDDecodeAllIfHaveInafDataOrSetToSecondDsp65();//1.49
|
||||
//void SetButtonVDDecodeAllToSecondDsp65();//1.49
|
||||
void SetVDMouseDrawLines(bool);//1.49
|
||||
//void SetVDMouseDecodeSecondDisp2(int mousebutton);
|
||||
void SetVDdf(int,int);
|
||||
void SetZeroDfVScale(bool);
|
||||
void SetCustomPalette(QPixmap,QColor,QColor);
|
||||
void SetTxToRx(bool);
|
||||
void SetRxToTx(bool);//2.63
|
||||
void SetLockTxrx(bool);
|
||||
void SetFreqExternal(double);
|
||||
///rtd//
|
||||
private slots:
|
||||
///rtd//
|
||||
void RtdDecode();
|
||||
///rtd//
|
||||
//ft8 3 dec
|
||||
void Ft8Decode();
|
||||
|
||||
private:
|
||||
bool dsty;
|
||||
bool allq65;
|
||||
bool ft_df1500;
|
||||
bool f_is_decodet3int;
|
||||
bool s_3intFt_d_;//2.39 remm
|
||||
int dflimit;
|
||||
void SetVDRxFreqF0F1();
|
||||
void SetVDTxFreq();
|
||||
void CorrDfW(int i);
|
||||
int count_disp_data_dec65;//1.49
|
||||
bool one_emit_disp_data_dec65;//1.49
|
||||
bool vd_mouse_lines_draw;//1.49
|
||||
bool s_vd_mouse_lines_draw65;//1.49
|
||||
int s_mode;
|
||||
bool s_fopen; //1.27 psk rep fopen bool true false no file open
|
||||
QFontMetrics *fm_X;
|
||||
int dec_labels_posx[MAX_DEC_LABELS_COUNT+10];
|
||||
QString dec_labels_text[MAX_DEC_LABELS_COUNT+10];
|
||||
bool f_dec_pings_draw;
|
||||
int dec_labels_posx_count;
|
||||
double ping_pos_end_draw;
|
||||
int fm_dec_labels_txt[MAX_DEC_LABELS_COUNT+10];
|
||||
int dec_lines_posx[MAX_DEC_LINES_COUNT+10];
|
||||
int dec_lines_posx_count;
|
||||
|
||||
double DISP_SAMPLE_RATE;
|
||||
bool s_zap;
|
||||
void SeavPrevRaw();
|
||||
void GetRawAll(int &cou_t);
|
||||
short raw[RAW_BUFFER_SIZE];
|
||||
short raw_t[RAW_BUFFER_SIZE];
|
||||
short raw_prev_pi4[RAW_BUF_PREV_PI4];
|
||||
int raw_count;
|
||||
//int sampe_rate;
|
||||
|
||||
int period_time_sec;
|
||||
//int time_pos;
|
||||
|
||||
void PaintImageWaterfall(int j, int i);
|
||||
//QPoint draw_point[DATA_WIDTH_DRAW];
|
||||
int data_graph_all[DATA_WIDTH+100][DATA_DSP_HEIGHT+100]; //1.35 +100 moze da izleze ako pc frizne
|
||||
int data_graph_smiter[DATA_WIDTH+100]; //1.35 +100 moze da izleze ako pc frizne
|
||||
|
||||
int x_pos;
|
||||
QImage img_tmp;
|
||||
|
||||
int s_start,s_stop;
|
||||
int x_pos_freq_line;
|
||||
QString freq_scale_x[MAX_LINES_SCALE_X];
|
||||
bool f_disp_v_h;
|
||||
int var_vdisp_height;
|
||||
int data_graph_all_v[DATA_HEIGHT*2+100][DATA_WIDTH+100];//1.39 rem DATA_WIDTH/2
|
||||
|
||||
bool f_adle_vd;
|
||||
bool f_flat_vd;
|
||||
|
||||
void FlatDisplay_VD(int *k_segm, int row);//1.51
|
||||
void PaintData_VD(bool);
|
||||
int pos_y_v0;
|
||||
int pos_y_v1;
|
||||
int pos_y_draw_vimgs;
|
||||
bool f_img_v0_v1;
|
||||
QImage img_tmp_v0;
|
||||
QImage img_tmp_v1;
|
||||
int lines_vd_t_count;
|
||||
bool lines_vd_t_new;
|
||||
int posy_vd_lines_t[50]; //1.55=40 for new count speads max 40 lines old=20
|
||||
QString lines_vd_t_text[50];//1.55=40 for new count speads max 40 lines old=20
|
||||
|
||||
int vd_mouse_reset0;
|
||||
int vd_mouse_reset1;
|
||||
int posx_vd_mouse_df[4];
|
||||
int lines_vd_df[2];
|
||||
int posy_vd_mouse0[2];
|
||||
int posy_vd_mouse1[2];
|
||||
//int posy_vd_mouse2[COUNT_MOUSE_LINES];
|
||||
//int posy_vd_mouse3[COUNT_MOUSE_LINES];
|
||||
|
||||
double frq00;
|
||||
double frq01;
|
||||
double frq00_limit;
|
||||
double frq01_limit;
|
||||
double bwQ65;
|
||||
void RefreshLimits();
|
||||
bool f_mouse_pres;
|
||||
bool f_r00;
|
||||
bool f_r01;
|
||||
|
||||
double vd_rx_freq;
|
||||
double vd_tx_freq;//// only for ft8 for the moment 1.43
|
||||
QString vd_rx_freq_txt;
|
||||
QString vd_rx_df_txt;
|
||||
double s_ft8_vd_rxtx_freq[2];
|
||||
void SaveFT8RxTxFreq();
|
||||
int lines_vd_rx_freq[6];
|
||||
int s_vd_df;
|
||||
int s_prev_vd_rx_df;
|
||||
void DecodeVD(int pos, int mouse);
|
||||
void ResetVDFreqDf();
|
||||
//bool df_vd_50;
|
||||
//QRect visual_rect_vd0;
|
||||
//QRect visual_rect_vd1;
|
||||
|
||||
//int img_tmp_format;
|
||||
int count_refr_disp;
|
||||
QPoint wave_points[DATA_WIDTH+1+3+100];
|
||||
void SetWavePoints(int);
|
||||
//int count_wave_points;
|
||||
|
||||
void PaintData_HD(bool paint_all);
|
||||
void ClarDisplay();
|
||||
void ClarHDisplay();
|
||||
|
||||
int s_upd_pos;
|
||||
void SetPaletteParm(QPixmap pic);
|
||||
QColor getColor(int val);
|
||||
QImage palette_tmp;
|
||||
typedef struct
|
||||
{
|
||||
int rgb_max;
|
||||
int rgb_img_width_center;
|
||||
}
|
||||
coef_rgb;
|
||||
coef_rgb rgb_c;
|
||||
QPixmap temp_pal0;
|
||||
QPixmap temp_pal1;
|
||||
QPixmap temp_pal2;
|
||||
QPixmap temp_pal3;
|
||||
QPixmap temp_pal4;
|
||||
QPixmap temp_pal5;
|
||||
QPixmap temp_pal6;
|
||||
QPixmap temp_pal7;
|
||||
QPixmap temp_pal_custom;
|
||||
QColor s_custom_wave;
|
||||
QColor s_custom_pen_wave;
|
||||
QPen s_pen_wave;
|
||||
QColor s_brush_wave;
|
||||
|
||||
int saved_color;
|
||||
int refresh_time;
|
||||
|
||||
int x_pos_timeline;
|
||||
QLine lines_scale_x[MAX_LINES_SCALE_X];
|
||||
int pos_text_hor_X[MAX_LINES_SCALE_X];
|
||||
int count_lines_scale_x;
|
||||
int pos_text_hor_Y;
|
||||
bool f_zero_freq_scale;
|
||||
//int x_pos_timeline;
|
||||
|
||||
QLine lines_mouse[COUNT_MOUSE_LINES];
|
||||
int dec_array_pixel_begin;
|
||||
int dec_array_pixel_end;
|
||||
QString full_file_name;
|
||||
//int offset_wat_sm;
|
||||
int offset_down_sm;
|
||||
//bool f_s_decode;
|
||||
bool f_is_decodet;
|
||||
bool f_auto_decode_all;
|
||||
bool f_lock_txrx;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
void mouseDoubleClickEvent(QMouseEvent * event );
|
||||
void mouseMoveEvent(QMouseEvent *);
|
||||
|
||||
int last_offset_dsp;
|
||||
int last_contr_dsp;
|
||||
int s_offset_dsp;
|
||||
int s_contr_dsp;
|
||||
int diplay_ofset;
|
||||
double diplay_contr;
|
||||
|
||||
bool tune_display_thred_busy;
|
||||
void DrawAll();
|
||||
|
||||
pthread_t th_t0;
|
||||
static void *ThreadDrawAll0(void *);
|
||||
pthread_t th_t1;
|
||||
static void *ThreadDrawAll1(void *);
|
||||
|
||||
bool f_disp_time;
|
||||
QString s_time;
|
||||
QString s_ymd;
|
||||
QString p_s_time;
|
||||
QString p_s_ymd;
|
||||
//bool tune_display_thred_busy;
|
||||
void resizeEvent(QResizeEvent *);
|
||||
double trans_fac;
|
||||
|
||||
///rtd//
|
||||
QTimer *timer_rtd_;
|
||||
bool s_start_stop_rtd_timer;
|
||||
bool s_rtd_timer_is_active;
|
||||
bool f_dec_busy;
|
||||
bool f_priority_disp1;
|
||||
int pos_rtd;
|
||||
QLine lines_rtd[COUNT_MOUSE_LINES];
|
||||
double koef_pos_lines_rtd;
|
||||
int s_upd_pos_lines_rtd;
|
||||
int s_raw_count;
|
||||
//int s_pos_rtd_end;
|
||||
bool f_once_sw_timer_rtd_speed;
|
||||
bool end_rtd;
|
||||
|
||||
int disp_ident;
|
||||
|
||||
//ft8 3 dec
|
||||
bool f_timerft8;
|
||||
//bool isa_timerft8;
|
||||
QTimer *timer_ft8_;
|
||||
|
||||
|
||||
//int full_raw_count;
|
||||
//int f_end_pos_rtd;
|
||||
///rtd//
|
||||
|
||||
//double trans_fac_time;
|
||||
//int s_old_graph_width;
|
||||
//double fac_mouse_l;
|
||||
//void UpdateLineMouse();
|
||||
//bool s_is_decodet;
|
||||
|
||||
//void wheelEvent(QWheelEvent *);
|
||||
};
|
||||
#endif
|
13
src/DisplayMs/display_ms.qrc
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>pic/palette_default_bw.png</file>
|
||||
<file>pic/palette_default_c.png</file>
|
||||
<file>pic/palette_1.png</file>
|
||||
<file>pic/palette_2.png</file>
|
||||
<file>pic/palette_3.png</file>
|
||||
<file>pic/palette_4.png</file>
|
||||
<file>pic/palette_5.png</file>
|
||||
<file>pic/palette_6.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
src/DisplayMs/pic/palette_1.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
src/DisplayMs/pic/palette_2.png
Normal file
After Width: | Height: | Size: 407 B |
BIN
src/DisplayMs/pic/palette_3.png
Normal file
After Width: | Height: | Size: 404 B |
BIN
src/DisplayMs/pic/palette_4.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
src/DisplayMs/pic/palette_5.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
src/DisplayMs/pic/palette_6.png
Normal file
After Width: | Height: | Size: 361 B |
BIN
src/DisplayMs/pic/palette_default_bw.png
Normal file
After Width: | Height: | Size: 179 B |
BIN
src/DisplayMs/pic/palette_default_c.png
Normal file
After Width: | Height: | Size: 525 B |
77
src/HvAboutMsHv/hvaboutmshv.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/* MSHV AboutMsHv
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvaboutmshv.h"
|
||||
//#include <QApplication>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QTextBrowser>
|
||||
|
||||
HvAboutMsHv::HvAboutMsHv(QString title,QString app_name,QString path,int lid,QWidget * parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
//setMinimumSize(510,330);
|
||||
//setFixedSize(605,600);
|
||||
//this->setFixedWidth(700);
|
||||
setMinimumSize(710,600);
|
||||
setWindowTitle(title+" "+app_name);
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||
|
||||
QVBoxLayout *layout_v = new QVBoxLayout(this);
|
||||
layout_v->setContentsMargins (4,4,4,4);
|
||||
//QString app_name = (QString)APP_NAME;
|
||||
|
||||
QLabel *lab_title;
|
||||
lab_title = new QLabel();
|
||||
lab_title->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||
lab_title->setOpenExternalLinks(true);
|
||||
//<program> Copyright (C) <year> <name of author>
|
||||
|
||||
//QString c = "©";0xA9
|
||||
lab_title->setText(app_name+" Copyright "+QChar(0xA9)+" 2015-2022 Hrisimir Hristov - LZ2HV<br><a href=\"mailto:lz2hv@abv.bg\">lz2hv@abv.bg</a>"+" & "+"<a href=\"http://lz2hv.org/mshv\">MSHV Web Site</a>");
|
||||
lab_title->setAlignment(Qt::AlignHCenter);
|
||||
layout_v->addWidget(lab_title);
|
||||
|
||||
QTextBrowser *text_browser = new QTextBrowser();
|
||||
text_browser->setReadOnly(true);
|
||||
text_browser->setOpenExternalLinks(true);// otvaria linkove ako ima
|
||||
|
||||
//QPixmap gpl3_icon = QPixmap(":pic/gplv3-88x31.png");
|
||||
|
||||
layout_v->addWidget(text_browser);
|
||||
|
||||
//QString path = (QCoreApplication::applicationDirPath());
|
||||
//if (lid==0 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));
|
||||
if (lid==1 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_bg.html"));
|
||||
else if (lid==2 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_ru.html"));
|
||||
/*else if (lid==3 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//ZH
|
||||
else if (lid==4 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//ZHHK
|
||||
else if (lid==5 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//ESES
|
||||
else if (lid==6 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//CAES
|
||||
else if (lid==7 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//PTPT
|
||||
else if (lid==8 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//RORO
|
||||
else if (lid==9 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//DADK
|
||||
else if (lid==10) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//PLPL
|
||||
else if (lid==11) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//FRFR
|
||||
else if (lid==12) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//PTBR
|
||||
else if (lid==13) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//NBNO
|
||||
else if (lid==14) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//ITIT
|
||||
*/
|
||||
else text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_about/about_en.html"));//any other
|
||||
|
||||
this->setLayout(layout_v);
|
||||
}
|
||||
HvAboutMsHv::~HvAboutMsHv()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
62
src/HvAboutMsHv/hvaboutmshv.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVABOUTMSHV_H
|
||||
#define HVABOUTMSHV_H
|
||||
|
||||
//#include "../config.h"
|
||||
|
||||
//#include <QWidget>
|
||||
//#include <QPainter>
|
||||
//#include <QMouseEvent>
|
||||
//#include <QBitmap>
|
||||
//#include <QVBoxLayout>
|
||||
//#include <QTextEdit>
|
||||
#include <QDialog>
|
||||
//#include <QLabel>
|
||||
//#include <QTextBrowser>
|
||||
//#include <QIcon>
|
||||
//#include <QPixmap>
|
||||
|
||||
//#include <QApplication>
|
||||
|
||||
class HvAboutMsHv : public QDialog
|
||||
{
|
||||
//Q_OBJECT //2.65 <- for tr() Q_OBJECT
|
||||
public:
|
||||
HvAboutMsHv(QString title,QString app_name,QString path,int lid,QWidget * parent = 0);
|
||||
virtual ~HvAboutMsHv();
|
||||
|
||||
/*QString GetName()
|
||||
{
|
||||
return NAM_s;
|
||||
};
|
||||
QString GetVer()
|
||||
{
|
||||
return VER_s;
|
||||
};*/
|
||||
|
||||
//public slots:
|
||||
//void ShowBox();
|
||||
|
||||
//private:
|
||||
/*QPixmap p_about_over;
|
||||
QPixmap p_about;
|
||||
QPixmap pupdate_hv;
|
||||
void setPixmap_hv(QPixmap);
|
||||
QString TextInfo();
|
||||
QRegion in_region;
|
||||
QString VER_s;
|
||||
QString NAM_s;
|
||||
QString YEAR_s;*/
|
||||
|
||||
//protected:
|
||||
//void mousePressEvent ( QMouseEvent * event);
|
||||
//void mouseReleaseEvent(QMouseEvent * event);
|
||||
//void mouseMoveEvent(QMouseEvent * event);
|
||||
//void paintEvent( QPaintEvent * event);
|
||||
};
|
||||
#endif
|
168
src/HvAggressiveW/aggressiv_d.cpp
Normal file
@ -0,0 +1,168 @@
|
||||
/* MSHV AggressiveDialog
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#include "aggressiv_d.h"
|
||||
//#include <QtGui>
|
||||
|
||||
AggressiveDialog::AggressiveDialog(bool indsty,QWidget * parent )
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle (tr("Aggressive Levels")+" JT65");
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);// maha help butona
|
||||
this->setMinimumWidth(250);
|
||||
|
||||
QVBoxLayout *VL = new QVBoxLayout(this);
|
||||
VL->setContentsMargins (10, 10, 10, 10);
|
||||
VL->setSpacing(5);
|
||||
|
||||
l_ftd = new QLabel(tr("Default")+"=5 "+tr("Level")+": 5");
|
||||
l_deeps = new QLabel(tr("Default")+"=95 "+tr("Level")+": 95");
|
||||
|
||||
QPixmap p0,p1,p2,p3,p4,p5,p6;
|
||||
|
||||
if (indsty)
|
||||
{
|
||||
p0 = QPixmap(":pic/sld_h_left_b.png");
|
||||
p1 = QPixmap(":pic/sld_h_track_b.png");
|
||||
p2 = QPixmap(":pic/sld_h_right_b.png");
|
||||
p3 = QPixmap(":pic/tumb_h_play_b.png");
|
||||
p4 = QPixmap(":pic/tumb_h_over_play_b.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
p0 = QPixmap(":pic/sld_h_left.png");
|
||||
p1 = QPixmap(":pic/sld_h_track.png");
|
||||
p2 = QPixmap(":pic/sld_h_right.png");
|
||||
p3 = QPixmap(":pic/tumb_h_play.png");
|
||||
p4 = QPixmap(":pic/tumb_h_over_play.png");
|
||||
}
|
||||
|
||||
sl_aggres_ftd = new HvSlider_H(10,0,0,p0,p1,p2,p3,p4);
|
||||
connect(sl_aggres_ftd, SIGNAL(SendValue(int)), this, SLOT(SetLevelAggres(int)));
|
||||
sl_aggres_ftd->SetValue(5);
|
||||
|
||||
if (indsty)
|
||||
{
|
||||
p5 = QPixmap(":pic/tumb_h_rec_b.png");
|
||||
p6 = QPixmap(":pic/tumb_h_over_rec_b.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
p5 = QPixmap(":pic/tumb_h_rec.png");
|
||||
p6 = QPixmap(":pic/tumb_h_over_rec.png");
|
||||
}
|
||||
|
||||
sl_aggres_deeps = new HvSlider_H(100,0,0,p0,p1,p2,p5,p6);
|
||||
|
||||
connect(sl_aggres_deeps, SIGNAL(SendValue(int)), this, SLOT(SetLevelDeepS(int)));
|
||||
sl_aggres_deeps->SetValue(95);
|
||||
|
||||
l_min = new QLabel("MIN");
|
||||
l_max = new QLabel("MAX");
|
||||
l_mind = new QLabel("MIN");
|
||||
l_maxd = new QLabel("MAX");
|
||||
|
||||
if (indsty)
|
||||
{
|
||||
l_ftd->setStyleSheet("QLabel {color :rgb(0, 220, 0);font-weight: bold;}");
|
||||
l_deeps->setStyleSheet("QLabel {color :rgb(0, 220, 0);font-weight: bold;}");
|
||||
l_min->setStyleSheet("QLabel {color :rgb(170, 170, 250);}");
|
||||
l_max->setStyleSheet("QLabel {color :rgb(250, 100, 100);}");
|
||||
l_mind->setStyleSheet("QLabel {color :rgb(170, 170, 250);}");
|
||||
l_maxd->setStyleSheet("QLabel {color :rgb(250, 100, 100);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
l_ftd->setStyleSheet("QLabel {color :rgb(0, 150, 0);font-weight: bold;}");
|
||||
l_deeps->setStyleSheet("QLabel {color :rgb(0, 150, 0);font-weight: bold;}");
|
||||
l_min->setStyleSheet("QLabel {color :rgb(0, 0, 200);}");
|
||||
l_max->setStyleSheet("QLabel {color :rgb(150, 0, 0);}");
|
||||
l_mind->setStyleSheet("QLabel {color :rgb(0, 0, 200);}");
|
||||
l_maxd->setStyleSheet("QLabel {color :rgb(150, 0, 0);}");
|
||||
}
|
||||
|
||||
QHBoxLayout *HL_aggftd = new QHBoxLayout();
|
||||
HL_aggftd->setContentsMargins (0, 0, 0, 0);
|
||||
HL_aggftd->setSpacing(5);
|
||||
HL_aggftd->addWidget(l_min);
|
||||
HL_aggftd->addWidget(sl_aggres_ftd);
|
||||
HL_aggftd->addWidget(l_max);
|
||||
HL_aggftd->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QHBoxLayout *HL_deeps = new QHBoxLayout();
|
||||
HL_deeps->setContentsMargins (0, 0, 0, 0);
|
||||
HL_deeps->setSpacing(5);
|
||||
HL_deeps->addWidget(l_mind);
|
||||
HL_deeps->addWidget(sl_aggres_deeps);
|
||||
HL_deeps->addWidget(l_maxd);
|
||||
HL_deeps->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QVBoxLayout *VL_aggftd = new QVBoxLayout();
|
||||
VL_aggftd->setContentsMargins (0, 5, 0, 5);
|
||||
VL_aggftd->setSpacing(5);
|
||||
VL_aggftd->addWidget(l_ftd);
|
||||
VL_aggftd->setAlignment(l_ftd,Qt::AlignCenter);
|
||||
VL_aggftd->addLayout(HL_aggftd);
|
||||
//VL_aggftd->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
QVBoxLayout *VL_deeps = new QVBoxLayout();
|
||||
VL_deeps->setContentsMargins (0, 5, 0, 5);
|
||||
VL_deeps->setSpacing(5);
|
||||
VL_deeps->addWidget(l_deeps);
|
||||
VL_deeps->setAlignment(l_deeps,Qt::AlignCenter);
|
||||
VL_deeps->addLayout(HL_deeps);
|
||||
//VL_deeps->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
QGroupBox *GB_aggftd = new QGroupBox(tr("Decoder Aggressive Level")+":");
|
||||
QGroupBox *GB_aggdeeps = new QGroupBox(tr("Deep Search Aggressive Level")+":");
|
||||
GB_aggftd->setLayout(VL_aggftd);
|
||||
GB_aggdeeps->setLayout(VL_deeps);
|
||||
VL->addWidget(GB_aggftd);
|
||||
VL->addWidget(GB_aggdeeps);
|
||||
|
||||
//QLabel *l_devo;
|
||||
//l_devo = new QLabel();
|
||||
|
||||
//connect(OutBuf, SIGNAL(currentIndexChanged(QString)), this, SLOT(OutDeviceChanged(QString)));*/
|
||||
//VL->addWidget(sl_aggres_ftd);
|
||||
//VL->addWidget(sl_aggres_deeps);
|
||||
this->setLayout(VL);
|
||||
}
|
||||
AggressiveDialog::~AggressiveDialog()
|
||||
{}
|
||||
void AggressiveDialog::SetFont(QFont f)
|
||||
{
|
||||
l_min->setFont(f);
|
||||
l_max->setFont(f);
|
||||
l_mind->setFont(f);
|
||||
l_maxd->setFont(f);
|
||||
l_ftd->setFont(f);
|
||||
l_deeps->setFont(f);
|
||||
}
|
||||
void AggressiveDialog::SetAggresLevels(QString str)
|
||||
{
|
||||
QStringList lstr = str.split("#");
|
||||
if (lstr.count()==2)
|
||||
{
|
||||
sl_aggres_ftd->SetValue(lstr.at(0).toInt());
|
||||
sl_aggres_deeps->SetValue(lstr.at(1).toInt());
|
||||
}
|
||||
}
|
||||
QString AggressiveDialog::GetAggresLevels()
|
||||
{
|
||||
QString str = QString("%1").arg(sl_aggres_ftd->get_value())+"#"+QString("%1").arg(sl_aggres_deeps->get_value());
|
||||
return str;
|
||||
}
|
||||
void AggressiveDialog::SetLevelAggres(int val)
|
||||
{
|
||||
l_ftd->setText(tr("Default")+"=5 "+tr("Level")+": "+QString("%1").arg(val));
|
||||
emit EmitLevelAggres(val);
|
||||
}
|
||||
void AggressiveDialog::SetLevelDeepS(int val)
|
||||
{
|
||||
l_deeps->setText(tr("Default")+"=95 "+tr("Level")+": "+QString("%1").arg(val));
|
||||
emit EmitLevelDeepS(val);
|
||||
}
|
||||
|
48
src/HvAggressiveW/aggressiv_d.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* MSHV AggressiveDialog
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef AGGRESSIVE_DIALOG_H
|
||||
#define AGGRESSIVE_DIALOG_H
|
||||
|
||||
//#include "../config.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
#include "../HvSlider_H/hvslider_h.h"
|
||||
|
||||
class AggressiveDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AggressiveDialog(bool,QWidget * parent = 0);
|
||||
virtual ~AggressiveDialog();
|
||||
|
||||
void SetAggresLevels(QString);
|
||||
QString GetAggresLevels();
|
||||
void SetFont(QFont);
|
||||
|
||||
signals:
|
||||
void EmitLevelAggres(int val);
|
||||
void EmitLevelDeepS(int val);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void SetLevelAggres(int val);
|
||||
void SetLevelDeepS(int val);
|
||||
|
||||
private:
|
||||
QLabel *l_ftd;
|
||||
QLabel *l_deeps;
|
||||
HvSlider_H *sl_aggres_ftd;
|
||||
HvSlider_H *sl_aggres_deeps;
|
||||
QLabel *l_min;
|
||||
QLabel *l_max;
|
||||
QLabel *l_mind;
|
||||
QLabel *l_maxd;
|
||||
|
||||
};
|
||||
#endif
|
135
src/HvAllTxt/hvalltxt.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/* MSHV AllTxt
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvalltxt.h"
|
||||
//#include <QtGui>
|
||||
|
||||
AllTxt::AllTxt(QString path, QObject * parent )
|
||||
: QObject(parent)
|
||||
{
|
||||
App_Path = path;
|
||||
s_yyyy_mm = "NONE";
|
||||
s_yyyy_mm_dd= "NONE";
|
||||
beg_append = 0;
|
||||
alltxt_save_timer = new QTimer();
|
||||
connect(alltxt_save_timer, SIGNAL(timeout()), this, SLOT(RefreshSaveTimer()));
|
||||
//q_Sort(db_data.begin().at(0), db_data.end().at(0));
|
||||
//qDebug()<<db_data.count();
|
||||
//qDebug()<<db_data.at(db_data.count()-1).at(0);
|
||||
}
|
||||
AllTxt::~AllTxt()
|
||||
{
|
||||
//SaveDb();
|
||||
//qDebug()<<"save";
|
||||
}
|
||||
void AllTxt::ReadAllTxt(QString yyyy_mm)
|
||||
{
|
||||
s_yyyy_mm = yyyy_mm;//vazno pri parvo otvariane
|
||||
|
||||
//AllTxtPerMonth
|
||||
QFile file(App_Path+"/AllTxtMonthly/ALL_"+yyyy_mm+".TXT");
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
return;
|
||||
|
||||
//qDebug()<<file_identif;
|
||||
QStringList list;
|
||||
//QString line;
|
||||
|
||||
QTextStream in(&file);
|
||||
while (!in.atEnd())
|
||||
{
|
||||
alltxt_data.append(in.readLine());
|
||||
}
|
||||
beg_append = alltxt_data.count();
|
||||
file.close();
|
||||
}
|
||||
void AllTxt::SetTxt(QString yyyy_mm_dd,QString str)
|
||||
{
|
||||
if (!yyyy_mm_dd.isEmpty() && !str.isEmpty())
|
||||
{
|
||||
s_yyyy_mm_dd = yyyy_mm_dd;
|
||||
str.remove("\n");//zaradi JT6M
|
||||
|
||||
//alltxt_data_buf.append(str);
|
||||
/*QString yyyymmdd = yyyy_mm_dd;
|
||||
yyyymmdd.replace("_","");
|
||||
alltxt_data_buf.append(yyyymmdd+"|"+str);*/
|
||||
alltxt_data_buf.append(yyyy_mm_dd.mid(8,2)+"|"+str);
|
||||
|
||||
//qDebug()<<"Start";
|
||||
alltxt_save_timer->start(3600);//2.48 from=2000 to 3600
|
||||
}
|
||||
}
|
||||
void AllTxt::RefreshSaveTimer()
|
||||
{
|
||||
alltxt_save_timer->stop();
|
||||
//qDebug()<<"Start save============";
|
||||
SetTxt_p(s_yyyy_mm_dd);
|
||||
//qDebug()<<"STOP save=============";
|
||||
}
|
||||
void AllTxt::SetTxt_p(QString yyyy_mm_dd)
|
||||
{
|
||||
if (!yyyy_mm_dd.isEmpty() && alltxt_data_buf.count()>0)
|
||||
{
|
||||
QString yyyy_mm = yyyy_mm_dd.mid(0,7);
|
||||
|
||||
if (s_yyyy_mm != yyyy_mm)
|
||||
{
|
||||
SaveAllTxt(s_yyyy_mm);
|
||||
alltxt_data.clear();
|
||||
s_yyyy_mm = yyyy_mm;
|
||||
}
|
||||
yyyy_mm_dd.replace("_"," ");
|
||||
bool f_ymd = false;
|
||||
for (int i = 0; i<alltxt_data.count(); i++)
|
||||
{
|
||||
if (alltxt_data.at(i)=="UTC Date: "+yyyy_mm_dd)
|
||||
{
|
||||
f_ymd = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
beg_append = alltxt_data.count();
|
||||
if (!f_ymd)
|
||||
{
|
||||
alltxt_data.append("--------------------");
|
||||
alltxt_data.append("UTC Date: "+yyyy_mm_dd);
|
||||
alltxt_data.append("--------------------");
|
||||
}
|
||||
for (int j = 0; j<alltxt_data_buf.count(); ++j)
|
||||
alltxt_data.append(alltxt_data_buf.at(j));
|
||||
|
||||
//qDebug()<<"1save"<<alltxt_data_buf.count()<<alltxt_data.count()-beg_append;
|
||||
alltxt_data_buf.clear();
|
||||
//qDebug()<<"2save"<<s_yyyy_mm;
|
||||
SaveAllTxt(s_yyyy_mm);
|
||||
}
|
||||
}
|
||||
void AllTxt::SaveAllTxt(QString yyyy_mm)
|
||||
{
|
||||
if (alltxt_data.count()>0)//no save empty file
|
||||
{
|
||||
QString t_yyyy_mm = yyyy_mm;
|
||||
|
||||
if (s_yyyy_mm != t_yyyy_mm)
|
||||
t_yyyy_mm = s_yyyy_mm;
|
||||
|
||||
//AllTxtPerMonth
|
||||
QFile file(App_Path+"/AllTxtMonthly/ALL_"+t_yyyy_mm+".TXT");//if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
if (!file.open(QIODevice::Append | QIODevice::Text))
|
||||
return;
|
||||
|
||||
QTextStream out(&file);
|
||||
|
||||
for (int j=beg_append; j < alltxt_data.count(); j++)
|
||||
{
|
||||
out << alltxt_data.at(j);
|
||||
//if (j<alltxt_data.count()-1)//1.71 no need if append no emoty last row
|
||||
out<<"\n";
|
||||
}
|
||||
file.close();
|
||||
//beg_append = alltxt_data.count();
|
||||
}
|
||||
}
|
47
src/HvAllTxt/hvalltxt.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVALLTXT_H
|
||||
#define HVALLTXT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
|
||||
class AllTxt : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AllTxt(QString path,QObject * parent = 0);
|
||||
virtual ~AllTxt();
|
||||
|
||||
void SaveAllTxt(QString yyyy_mm);
|
||||
void ReadAllTxt(QString yyyy_mm);
|
||||
void SetTxt(QString yyyy_mm_dd,QString str);
|
||||
|
||||
//public slots:
|
||||
|
||||
//signals:
|
||||
|
||||
private slots:
|
||||
void RefreshSaveTimer();
|
||||
|
||||
private:
|
||||
int beg_append;
|
||||
QList<QString>alltxt_data_buf;
|
||||
QList<QString>alltxt_data;
|
||||
QString App_Path;
|
||||
QString s_yyyy_mm;
|
||||
QString s_yyyy_mm_dd;
|
||||
QTimer *alltxt_save_timer;
|
||||
void SetTxt_p(QString yyyy_mm_dd);
|
||||
|
||||
//protected:
|
||||
|
||||
};
|
||||
#endif
|
620
src/HvAlsaMixer/hvalsamixer.cpp
Normal file
@ -0,0 +1,620 @@
|
||||
#include "hvalsamixer.h"
|
||||
#if defined _LINUX_
|
||||
HvAlsaMixer::HvAlsaMixer(QString dev_name, QWidget * parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
blosk_write = true;
|
||||
setFixedSize(50, 50);
|
||||
|
||||
p0 = QPixmap(":pic/big/sld_track_v_si.png");
|
||||
p1 = QPixmap(":pic/big/sld_up_v_si.png");
|
||||
p2 = QPixmap(":pic/big/sld_down_v_si.png");
|
||||
p3 = QPixmap(":pic/big/tumb_v_si_p.png");
|
||||
p4 = QPixmap(":pic/big/tumb_over_v_si_p.png");
|
||||
p5 = QPixmap(":pic/big/tumb_v_si_c.png");
|
||||
p6 = QPixmap(":pic/big/tumb_over_v_si_c.png");
|
||||
p7 = QPixmap(":pic/big/tumb_v_si_pc.png");
|
||||
p8 = QPixmap(":pic/big/tumb_over_v_si_pc.png");
|
||||
|
||||
QFont font_tfi = font();
|
||||
font_tfi.setPointSize(9);
|
||||
setFont(font_tfi);
|
||||
|
||||
m_isOpen = false;
|
||||
devName = dev_name;
|
||||
AddWidgets(dev_name);
|
||||
|
||||
/////////////////////// setup na refresha ako niakoi drug butne mixera //////////////////////
|
||||
if ((m_count = snd_mixer_poll_descriptors_count(handle_mixer)) < 0)
|
||||
{
|
||||
fprintf(stderr, "Error snd_mixer_poll_descriptors_count()...\n");
|
||||
}
|
||||
m_fds = (struct pollfd*)calloc(m_count, sizeof(struct pollfd));
|
||||
if (m_fds == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error m_fds == NULL...\n");
|
||||
}
|
||||
m_fds->events = POLLIN;
|
||||
int err;
|
||||
if ((err = snd_mixer_poll_descriptors(handle_mixer, m_fds, m_count)) < 0)
|
||||
{
|
||||
fprintf(stderr, "Error snd_mixer_poll_descriptors()...\n");
|
||||
}
|
||||
if (err != m_count)
|
||||
{
|
||||
fprintf(stderr, "Error err != m_count...\n");
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
timer_refresh = new QTimer();
|
||||
connect(timer_refresh, SIGNAL(timeout()), this, SLOT(handles_refresh()));
|
||||
timer_refresh->start(200);
|
||||
}
|
||||
|
||||
HvAlsaMixer::~HvAlsaMixer()
|
||||
{}
|
||||
|
||||
void HvAlsaMixer::handles_refresh()
|
||||
{
|
||||
if (!isVisible() || !m_isOpen)
|
||||
return;
|
||||
blosk_write = true;
|
||||
|
||||
// Poll on fds with 10ms timeout
|
||||
// Hint: alsamixer has an infinite timeout, but we cannot do this because we would block
|
||||
// the X11 event handling (Qt event loop) with this.
|
||||
int finished = poll(m_fds, m_count, 10);
|
||||
if (finished > 0)
|
||||
{
|
||||
unsigned short revents;
|
||||
if (snd_mixer_poll_descriptors_revents(handle_mixer, m_fds, m_count, &revents) >= 0)
|
||||
{
|
||||
if (revents & POLLNVAL)
|
||||
{
|
||||
fprintf(stderr, "Error handles_refresh() -> POLLNVAL\n");
|
||||
}
|
||||
if (revents & POLLERR)
|
||||
{
|
||||
fprintf(stderr, "Error handles_refresh() -> POLLERR\n");
|
||||
}
|
||||
if (revents & POLLIN )
|
||||
{
|
||||
snd_mixer_handle_events(handle_mixer);
|
||||
RefreshAllHW();
|
||||
//qDebug()<<"REFRESH"<<devName;
|
||||
}
|
||||
}
|
||||
}
|
||||
blosk_write = false;
|
||||
}
|
||||
|
||||
void HvAlsaMixer::RefreshAllHW()
|
||||
{ //qDebug()<<"gggg";
|
||||
for (int i = 0; i < mixer_elem_list.count(); i++)
|
||||
{
|
||||
snd_mixer_elem_t *elem = mixer_elem_list[i];
|
||||
if ( snd_mixer_selem_is_enumerated(elem))
|
||||
enum_cb[i]->SetValue(get_enumIdHW(elem));
|
||||
else
|
||||
readVolumeFromHW(elem, i);
|
||||
}
|
||||
}
|
||||
|
||||
void HvAlsaMixer::AddWidgets(QString dev_name)
|
||||
{
|
||||
blosk_write = true;
|
||||
|
||||
if ( OpenMixHandle(dev_name) != 0 )
|
||||
{
|
||||
fprintf(stderr, "Error open hamdle...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
QHBoxLayout *HLayout = new QHBoxLayout();
|
||||
HLayout->setContentsMargins ( 0, 5, 10, 25);//za opraviane
|
||||
HLayout->setSpacing(1);
|
||||
|
||||
snd_mixer_elem_t *elem;
|
||||
unsigned int idx = 0;
|
||||
snd_mixer_selem_id_t *sid;
|
||||
snd_mixer_selem_id_alloca( &sid );
|
||||
|
||||
QVBoxLayout *V_CB = new QVBoxLayout();
|
||||
V_CB->setContentsMargins ( 1, 0, 0, 3);
|
||||
V_CB->setSpacing(1);
|
||||
|
||||
for ( elem = snd_mixer_first_elem( handle_mixer ); elem; elem = snd_mixer_elem_next( elem ) )
|
||||
{
|
||||
// If element is not active, just skip
|
||||
if ( ! snd_mixer_selem_is_active ( elem ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* --- Create basic control structures: snd_mixer_selem_id_t*, ID, ... --------- */
|
||||
// snd_mixer_selem_id_t*
|
||||
// I believe we must malloc it ourself (just guessing due to missing ALSA documentation)
|
||||
snd_mixer_selem_id_malloc ( &sid ); // !! Return code should be checked. Ressoure must be freed when unplugging card
|
||||
snd_mixer_selem_get_id( elem, sid );
|
||||
|
||||
mixer_sid_list.append(sid);
|
||||
mixer_elem_list.append(elem);
|
||||
|
||||
QVBoxLayout *V_l = new QVBoxLayout();
|
||||
V_l->setContentsMargins ( 0, 0, 2, 0);
|
||||
V_l->setSpacing(2);
|
||||
V_l->setAlignment(Qt::AlignTop);
|
||||
|
||||
if ( snd_mixer_selem_is_enumerated(elem) )
|
||||
{
|
||||
QList<QString*>enumList;
|
||||
addEnumerated(elem, enumList);
|
||||
QList<QString>_enumValues;
|
||||
for (int i = 0; i < enumList.count(); i++)
|
||||
{
|
||||
_enumValues.append( *(enumList.at(i)) );
|
||||
}
|
||||
HvCBox *temp_c = new HvCBox(idx);
|
||||
temp_c->addItems(_enumValues);
|
||||
qDeleteAll(enumList);
|
||||
_enumValues.clear();
|
||||
temp_c->SetValue(get_enumIdHW(elem));
|
||||
QString str = QString("%1").arg(snd_mixer_selem_id_get_name(sid));
|
||||
QLabel *CB_l = new QLabel(str);
|
||||
V_CB->addWidget(CB_l);
|
||||
V_CB->setAlignment(CB_l,Qt::AlignCenter);
|
||||
V_CB->addWidget(temp_c);
|
||||
V_CB->setAlignment(temp_c,Qt::AlignCenter);
|
||||
enum_cb.insert(idx, temp_c);
|
||||
connect(temp_c, SIGNAL(SendVals(int,int)), this, SLOT(setEnumIdHW(int,int)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (snd_mixer_selem_has_playback_switch(elem))
|
||||
{
|
||||
HvRbutton *Rb_t = new HvRbutton(idx);
|
||||
//Rb_t->SetRbCaptureColor(false);
|
||||
V_l->addWidget(Rb_t);
|
||||
V_l->setAlignment(Rb_t, Qt::AlignHCenter);
|
||||
|
||||
rbtp.insert(idx, Rb_t);
|
||||
|
||||
connect(Rb_t, SIGNAL(SendVals(int,int)), this, SLOT(writeVolumeToHW(int,int)));
|
||||
if (!(snd_mixer_selem_has_playback_volume(elem)) && !(snd_mixer_selem_has_capture_volume(elem)))
|
||||
{ // ako ne e nito edno ot drugite da go nadpi6e
|
||||
QString str = QString("%1").arg(snd_mixer_selem_id_get_name(sid));
|
||||
HvVText *THvVText = new HvVText(str);
|
||||
// HLayout->addWidget(THvVText);
|
||||
V_l->addWidget(THvVText);
|
||||
}
|
||||
}
|
||||
if (snd_mixer_selem_has_playback_volume(elem)|| snd_mixer_selem_has_capture_volume(elem))
|
||||
{
|
||||
QString str = QString("%1").arg(snd_mixer_selem_id_get_name(sid));
|
||||
HvVText *THvVText = new HvVText(str);
|
||||
THvVText->setFixedHeight(THvVText->height()+14+2);//2->space 2 elementa po 1pix 14-> kolkoto sa radio butonite za da se izravniat textovete
|
||||
HLayout->addWidget(THvVText);
|
||||
HLayout->setAlignment(THvVText,Qt::AlignTop);
|
||||
|
||||
int max_v = 0;
|
||||
if (snd_mixer_selem_has_playback_volume(elem))
|
||||
max_v = getMaxVol(elem, false);
|
||||
if (snd_mixer_selem_has_capture_volume(elem))
|
||||
max_v = getMaxVol(elem, true);
|
||||
|
||||
QHBoxLayout *H_lpc = new QHBoxLayout();
|
||||
H_lpc->setContentsMargins ( 0, 0, 0, 0);
|
||||
H_lpc->setSpacing(2);
|
||||
|
||||
if (snd_mixer_selem_has_playback_volume(elem))
|
||||
{
|
||||
HvSlider_V_Identif *THvSlider_V_I = new HvSlider_V_Identif(idx,max_v,0,0,p1,p0,p2,p3,p4);
|
||||
if (snd_mixer_selem_has_playback_volume(elem))
|
||||
{
|
||||
sldp.insert(idx, THvSlider_V_I);
|
||||
}
|
||||
if (snd_mixer_selem_has_playback_volume(elem) && snd_mixer_selem_has_capture_volume(elem))
|
||||
THvSlider_V_I->SetThumbs(p7,p8);// oranzevo
|
||||
H_lpc->addWidget(THvSlider_V_I);
|
||||
connect(THvSlider_V_I, SIGNAL(SendValue(int,int)), this, SLOT(writeVolumeToHW(int,int)));
|
||||
}
|
||||
|
||||
if (snd_mixer_selem_has_capture_volume(elem) )
|
||||
{
|
||||
HvSlider_V_Identif *THvSlider_V_I = new HvSlider_V_Identif(idx,max_v,0,0,p1,p0,p2,p3,p4);
|
||||
if (snd_mixer_selem_has_capture_volume(elem))
|
||||
{
|
||||
THvSlider_V_I->SetThumbs(p5,p6);// 4erveni
|
||||
sldc.insert(idx, THvSlider_V_I);
|
||||
}
|
||||
if (snd_mixer_selem_has_playback_volume(elem) && snd_mixer_selem_has_capture_volume(elem))
|
||||
THvSlider_V_I->SetThumbs(p7,p8);// oranzevo
|
||||
H_lpc->addWidget(THvSlider_V_I);
|
||||
connect(THvSlider_V_I, SIGNAL(SendValue(int,int)), this, SLOT(writeVolumeToHW(int,int)));
|
||||
}
|
||||
// if ((snd_mixer_selem_has_playback_volume(elem)) && (snd_mixer_selem_has_capture_volume(elem)))
|
||||
//THvSlider_V_I->SetThumbs(p7,p8);// oranzevo
|
||||
//THvSlider_V_I->setFixedHeight(148);// ne e dobre za opraviane hv
|
||||
if (!snd_mixer_selem_has_playback_switch(elem))
|
||||
V_l->setContentsMargins ( 0, (14+2), 2, 0); //14-> kolkoto sa radio butonite za da se izravniat potencionetrite
|
||||
V_l->addLayout(H_lpc);
|
||||
//connect(THvSlider_V_I, SIGNAL(SendValue(int,int)), this, SLOT(writeVolumeToHW(int,int)));
|
||||
}
|
||||
if (snd_mixer_selem_has_capture_switch(elem))
|
||||
{
|
||||
HvRbutton *Rb_t = new HvRbutton(idx);
|
||||
//Rb_t->SetRbCaptureColor(true);
|
||||
V_l->addWidget(Rb_t);
|
||||
V_l->setAlignment(Rb_t, Qt::AlignCenter);
|
||||
|
||||
rbtc.insert(idx, Rb_t);
|
||||
|
||||
connect(Rb_t, SIGNAL(SendVals(int,int)), this, SLOT(writeVolumeToHW(int,int)));
|
||||
if (!(snd_mixer_selem_has_playback_volume(elem)) && !(snd_mixer_selem_has_capture_volume(elem)))
|
||||
{ // ako ne e nito edno ot drugite da go nadpi6e
|
||||
QString str = QString("%1").arg(snd_mixer_selem_id_get_name(sid));
|
||||
HvVText *THvVText = new HvVText(str);
|
||||
//HLayout->addWidget(THvVText);
|
||||
V_l->addWidget(THvVText);
|
||||
}
|
||||
}
|
||||
readVolumeFromHW(elem, idx);
|
||||
HLayout->addLayout(V_l);
|
||||
QFrame *lineV = new QFrame();
|
||||
// lineV->setGeometry(QRect(70,100,3,61));
|
||||
lineV->setFrameShape(QFrame::VLine);
|
||||
lineV->setFrameShadow(QFrame::Sunken);
|
||||
//lineV->setContentsMargins(0,0,0,0);
|
||||
//lineV->setFrameStyle(QFrame::Shadow_Mask);
|
||||
HLayout->addWidget(lineV);
|
||||
}
|
||||
idx++;
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
}
|
||||
HLayout->addLayout(V_CB);// enumerated combo box
|
||||
setLayout(HLayout);
|
||||
setFixedSize(QSize(HLayout->sizeHint().width(),HLayout->sizeHint().height()));
|
||||
|
||||
blosk_write = false;
|
||||
}
|
||||
|
||||
void HvAlsaMixer::addEnumerated(snd_mixer_elem_t *elem, QList<QString*>& enumList)
|
||||
{
|
||||
// --- get Enum names START ---
|
||||
int numEnumitems = snd_mixer_selem_get_enum_items(elem);
|
||||
if ( numEnumitems > 0 )
|
||||
{
|
||||
// OK. no error
|
||||
for (int iEnum = 0; iEnum<numEnumitems; iEnum++ )
|
||||
{
|
||||
char buffer[100];
|
||||
int ret = snd_mixer_selem_get_enum_item_name(elem, iEnum, 99, buffer);
|
||||
buffer[99] = 0; // protect from overflow
|
||||
if ( ret == 0 )
|
||||
{
|
||||
QString* enumName = new QString(buffer); // these QString* items are deleted above (search fo "clear temporary list")
|
||||
enumList.append( enumName);
|
||||
} // enumName could be read successfully
|
||||
} // for all enum items of this device
|
||||
} // no error in reading enum list
|
||||
else
|
||||
{
|
||||
// 0 items or Error code => ignore this entry
|
||||
}
|
||||
}
|
||||
|
||||
snd_mixer_elem_t* HvAlsaMixer::getMixerElem(int idx)
|
||||
{
|
||||
snd_mixer_elem_t* elem = 0;
|
||||
if ( ! m_isOpen )
|
||||
{
|
||||
fprintf(stderr, "Error -> getMixerElem -> ! m_isOpen \n");
|
||||
return elem; // unplugging guard
|
||||
}
|
||||
if ( idx == -1 )
|
||||
{
|
||||
fprintf(stderr, "Error finding mixer element -> getMixerElem -> idx == -1 \n");
|
||||
return elem;
|
||||
}
|
||||
if ( int( mixer_sid_list.count() ) > idx )
|
||||
{
|
||||
snd_mixer_selem_id_t * sid = mixer_sid_list[ idx ];
|
||||
// The next line (hopefully) only finds selem's, not elem's.
|
||||
elem = snd_mixer_find_selem(handle_mixer, sid);
|
||||
if ( elem == 0 )
|
||||
fprintf(stderr, "Error finding mixer element -> getMixerElem -> elem == 0 \n");
|
||||
}
|
||||
return elem;
|
||||
}
|
||||
|
||||
int HvAlsaMixer::writeVolumeToHW(int, int devnum)
|
||||
{
|
||||
if (blosk_write)
|
||||
return 0;
|
||||
|
||||
int left, right;
|
||||
|
||||
snd_mixer_elem_t *elem = getMixerElem( devnum );//qDebug()<<devnum ;
|
||||
if ( !elem )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// --- playback volume
|
||||
if (snd_mixer_selem_has_playback_volume( elem ))
|
||||
{
|
||||
left = sldp[devnum]->get_value();
|
||||
right = left;
|
||||
snd_mixer_selem_set_playback_volume ( elem, SND_MIXER_SCHN_FRONT_LEFT, left );
|
||||
if ( ! snd_mixer_selem_is_playback_mono ( elem ) )
|
||||
snd_mixer_selem_set_playback_volume ( elem, SND_MIXER_SCHN_FRONT_RIGHT, right );
|
||||
// fprintf(stderr, "playback_volume \n");
|
||||
}
|
||||
// --- playback switch
|
||||
if ( snd_mixer_selem_has_playback_switch( elem )
|
||||
|| snd_mixer_selem_has_common_switch ( elem ))//
|
||||
{
|
||||
int sw = 0;
|
||||
if ( !rbtp[devnum]->get_value() == 0 )
|
||||
sw = !sw; // invert all bits
|
||||
snd_mixer_selem_set_playback_switch_all(elem, sw);
|
||||
// qDebug()<<"P="<<(*rbp_from_hand[hand_iden])[devnum]->get_value();
|
||||
//fprintf(stderr, "playback_switch \n");
|
||||
}
|
||||
// --- capture volume
|
||||
if ( snd_mixer_selem_has_capture_volume( elem ))
|
||||
{
|
||||
left = sldc[devnum]->get_value();
|
||||
right = left;
|
||||
snd_mixer_selem_set_capture_volume ( elem, SND_MIXER_SCHN_FRONT_LEFT, left );
|
||||
if ( ! snd_mixer_selem_is_playback_mono ( elem ) )
|
||||
snd_mixer_selem_set_capture_volume ( elem, SND_MIXER_SCHN_FRONT_RIGHT, right );
|
||||
//fprintf(stderr, "capture_volume \n");
|
||||
}
|
||||
// --- capture switch
|
||||
if ( snd_mixer_selem_has_capture_switch( elem ) )
|
||||
{
|
||||
// Hint: snd_mixer_selem_has_common_switch() is already covered in the playback .
|
||||
// switch. This is probably enough. It would be helpful, if the ALSA project would
|
||||
// write documentation. Until then, I need to continue guessing semantics.
|
||||
int sw = 0;
|
||||
if ( rbtc[devnum]->get_value() == 1 )
|
||||
sw = !sw; // invert all bits
|
||||
snd_mixer_selem_set_capture_switch_all( elem, sw);
|
||||
// fprintf(stderr, "capture_switch \n");
|
||||
}
|
||||
//handles_refresh();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HvAlsaMixer::readVolumeFromHW(snd_mixer_elem_t *elem, int identif)
|
||||
{
|
||||
long left, right;
|
||||
int elem_sw;
|
||||
|
||||
if ( !elem )
|
||||
{
|
||||
//qDebug()<<elem<<hand_iden;
|
||||
fprintf(stderr, "ERROR finding mixer element -> readVolumeFromHW -> !elem\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --- playback volume
|
||||
if ( snd_mixer_selem_has_playback_volume( elem ) )
|
||||
{
|
||||
int ret = snd_mixer_selem_get_playback_volume( elem, SND_MIXER_SCHN_FRONT_LEFT, &left );
|
||||
if ( ret != 0 ) fprintf(stderr, "Error read voll...\n");
|
||||
if ( snd_mixer_selem_is_playback_mono ( elem ))
|
||||
{
|
||||
//return left;
|
||||
sldp[identif]->SetValue(left);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret = snd_mixer_selem_get_playback_volume( elem, SND_MIXER_SCHN_FRONT_RIGHT, &right );
|
||||
if ( ret != 0 ) fprintf(stderr, "Error read voll...\n");
|
||||
// qDebug()<<(*sp_from_hand[hand_iden])[identif]<<hand_iden<<identif;
|
||||
sldp[identif]->SetValue(right);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// --- playback switch
|
||||
if ( snd_mixer_selem_has_playback_switch( elem ))
|
||||
{
|
||||
snd_mixer_selem_get_playback_switch( elem, SND_MIXER_SCHN_FRONT_LEFT, &elem_sw );
|
||||
//return elem_sw;
|
||||
// md->setMuted( elem_sw == 0 );
|
||||
rbtp[identif]->SetValue(elem_sw);
|
||||
}
|
||||
|
||||
// --- capture volume
|
||||
if ( snd_mixer_selem_has_capture_volume ( elem ) )
|
||||
{
|
||||
int ret = snd_mixer_selem_get_capture_volume ( elem, SND_MIXER_SCHN_FRONT_LEFT, &left );
|
||||
if ( ret != 0 ) fprintf(stderr, "Error read voll...\n");
|
||||
if ( snd_mixer_selem_is_capture_mono ( elem ))
|
||||
{
|
||||
sldc[identif]->SetValue(left);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret = snd_mixer_selem_get_capture_volume( elem, SND_MIXER_SCHN_FRONT_RIGHT, &right );
|
||||
if ( ret != 0 ) fprintf(stderr, "Error read voll...\n");
|
||||
/* if (!(*sc_from_hand[hand_iden])[identif])
|
||||
(*sc_from_hand[hand_iden])[identif-1]->SetValue(left);
|
||||
else */
|
||||
//qDebug()<<(*sc_from_hand[hand_iden])[identif]<<hand_iden<<identif;
|
||||
sldc[identif]->SetValue(right);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// --- capture switch
|
||||
if ( snd_mixer_selem_has_capture_switch( elem ) )
|
||||
{
|
||||
snd_mixer_selem_get_capture_switch( elem, SND_MIXER_SCHN_FRONT_LEFT, &elem_sw );
|
||||
//return elem_sw;
|
||||
// md->setRecSource( elem_sw == 1 );
|
||||
/* if(!(*rbc_from_hand[hand_iden])[identif])
|
||||
(*rbc_from_hand[hand_iden])[identif-1]->SetValue(elem_sw);
|
||||
else */
|
||||
//if (identif == 3 )
|
||||
//qDebug()<<"right"<<elem_sw;
|
||||
rbtc[identif]->SetValue(elem_sw);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HvAlsaMixer::getMaxVol(snd_mixer_elem_t *elem, bool capture)
|
||||
{
|
||||
// Volume* vol = 0;
|
||||
long maxVolume = 0, minVolume = 0;
|
||||
//bool capture = true;
|
||||
//int vol = 0;
|
||||
// --- Regular control (not enumerated) ---
|
||||
// Volume::ChannelMask chn = Volume::MNONE;
|
||||
// Volume::ChannelMask chnTmp;
|
||||
// snd_mixer_elem_t *elem = getMixerElem(identif, hand_identif); //qDebug()<<elem;
|
||||
if ( !elem )
|
||||
{
|
||||
fprintf(stderr, "ERROR finding mixer element -> getMaxVol -> !elem\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool hasVolume = capture
|
||||
? snd_mixer_selem_has_capture_volume(elem)
|
||||
: snd_mixer_selem_has_playback_volume(elem);
|
||||
if ( hasVolume )
|
||||
{
|
||||
//kDebug(67100) << "has_xyz_volume()";
|
||||
// @todo looks like this supports only 2 channels here
|
||||
/* bool mono = capture
|
||||
? snd_mixer_selem_is_capture_mono(elem)
|
||||
: snd_mixer_selem_is_playback_mono(elem);
|
||||
chnTmp = mono
|
||||
? Volume::MLEFT
|
||||
: (Volume::ChannelMask)(Volume::MLEFT | Volume::MRIGHT);
|
||||
chn = (Volume::ChannelMask) (chn | chnTmp);*/
|
||||
if ( capture)
|
||||
{
|
||||
snd_mixer_selem_get_capture_volume_range( elem, &minVolume, &maxVolume );
|
||||
}
|
||||
else
|
||||
{
|
||||
snd_mixer_selem_get_playback_volume_range( elem, &minVolume, &maxVolume );
|
||||
}
|
||||
}
|
||||
|
||||
bool hasCommonSwitch = snd_mixer_selem_has_common_switch ( elem );
|
||||
|
||||
bool hasSwitch = hasCommonSwitch |
|
||||
capture
|
||||
? snd_mixer_selem_has_capture_switch ( elem )
|
||||
: snd_mixer_selem_has_playback_switch ( elem );
|
||||
|
||||
if ( hasVolume || hasSwitch )
|
||||
{//qDebug()<<"play";
|
||||
// vol = new Volume( chn, maxVolume, minVolume, hasSwitch, capture);
|
||||
}
|
||||
|
||||
//qDebug()<<ii<<minVolume<<maxVolume; ii++;
|
||||
return maxVolume;
|
||||
}
|
||||
|
||||
unsigned int HvAlsaMixer::get_enumIdHW(snd_mixer_elem_t * elem)
|
||||
{
|
||||
// int devnum = id2num(id);
|
||||
// snd_mixer_elem_t *elem = getMixerElem( devnum );
|
||||
unsigned int idx = 0;
|
||||
|
||||
if ( elem != 0 && snd_mixer_selem_is_enumerated(elem) )
|
||||
{
|
||||
int ret = snd_mixer_selem_get_enum_item(elem,SND_MIXER_SCHN_FRONT_LEFT,&idx);
|
||||
if (ret < 0)
|
||||
{
|
||||
idx = 0;
|
||||
fprintf(stderr, "ERROR get_enumIdHW(snd_mixer_elem_t * elem)\n");
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
void HvAlsaMixer::setEnumIdHW(int identif, int idx)
|
||||
{
|
||||
//kDebug(67100) << "Mixer_ALSA::setEnumIdHW() id=" << id << " , idx=" << idx << ") 1\n";
|
||||
//int devnum = id2num(id);
|
||||
snd_mixer_elem_t *elem = getMixerElem( identif );
|
||||
int ret = snd_mixer_selem_set_enum_item(elem,SND_MIXER_SCHN_FRONT_LEFT,idx);
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR setEnumIdHW(int devnum, unsigned int idx)\n");
|
||||
}
|
||||
snd_mixer_selem_set_enum_item(elem,SND_MIXER_SCHN_FRONT_RIGHT,idx);
|
||||
// we don't care about possible error codes on channel 1
|
||||
return;
|
||||
}
|
||||
|
||||
int HvAlsaMixer::OpenMixHandle(QString dev_name)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ( ( err = snd_mixer_open ( &handle_mixer, 0 ) ) < 0 )
|
||||
{
|
||||
handle_mixer = 0;
|
||||
return err; // if we cannot open the mixer, we have no devices
|
||||
}
|
||||
if ( ( err = snd_mixer_attach ( handle_mixer, dev_name.toLatin1().data() ) ) < 0 ) //qt5
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
if ( ( err = snd_mixer_selem_register ( handle_mixer, NULL, NULL ) ) < 0 )
|
||||
{
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
if ( ( err = snd_mixer_load ( handle_mixer ) ) < 0 )
|
||||
{
|
||||
CloseHandle();
|
||||
return err;
|
||||
}
|
||||
m_isOpen = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HvAlsaMixer::CloseHandle()
|
||||
{
|
||||
int ret=0;
|
||||
m_isOpen = false;
|
||||
if ( handle_mixer != 0 )
|
||||
{
|
||||
snd_mixer_free ( handle_mixer );
|
||||
|
||||
if ( ( ret = snd_mixer_detach ( handle_mixer, devName.toLatin1().data() ) ) < 0 ) //qt5
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
int ret2 = 0;
|
||||
if ( ( ret2 = snd_mixer_close ( handle_mixer ) ) < 0 )
|
||||
{
|
||||
if ( ret == 0 ) ret = ret2; // no error before => use current error code
|
||||
}
|
||||
handle_mixer = 0;
|
||||
}
|
||||
mixer_elem_list.clear();
|
||||
mixer_sid_list.clear();
|
||||
rbtc.clear();
|
||||
rbtp.clear();
|
||||
sldc.clear();
|
||||
sldp.clear();
|
||||
enum_cb.clear();
|
||||
//qDebug()<<"CLOSE_HANDLE";
|
||||
timer_refresh->stop();
|
||||
delete timer_refresh;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
88
src/HvAlsaMixer/hvalsamixer.h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef HVALSAMIXER_H
|
||||
#define HVALSAMIXER_H
|
||||
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if defined _LINUX_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "../HvSlider_V_Identif/hvslider_v_identif.h"
|
||||
#include "hvvtext.h"
|
||||
#include "hvrbutton.h"
|
||||
#include "hvcbox.h"
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
class HvAlsaMixer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvAlsaMixer(QString dev_name, QWidget * parent = 0);
|
||||
virtual ~HvAlsaMixer();
|
||||
|
||||
public slots:
|
||||
int CloseHandle();
|
||||
|
||||
private slots:
|
||||
int writeVolumeToHW(int val, int identif);
|
||||
void handles_refresh();
|
||||
void setEnumIdHW(int devnum, int idx);
|
||||
|
||||
private:
|
||||
snd_mixer_t *handle_mixer;
|
||||
QString devName;
|
||||
|
||||
QTimer *timer_refresh;
|
||||
struct pollfd *m_fds;
|
||||
int m_count;
|
||||
|
||||
void AddWidgets(QString);
|
||||
QPixmap p0;
|
||||
QPixmap p1;
|
||||
QPixmap p2;
|
||||
QPixmap p3;
|
||||
QPixmap p4;
|
||||
QPixmap p5;
|
||||
QPixmap p6;
|
||||
QPixmap p7;
|
||||
QPixmap p8;
|
||||
///////////////////////////////////////////////////////////
|
||||
typedef QList<snd_mixer_selem_id_t *>AlsaMixerSidList;
|
||||
AlsaMixerSidList mixer_sid_list;
|
||||
typedef QList<snd_mixer_elem_t *> AlsaMixerElemList;
|
||||
AlsaMixerElemList mixer_elem_list;
|
||||
|
||||
typedef QHash<int,HvRbutton *>rbc_f_h;
|
||||
rbc_f_h rbtc;
|
||||
typedef QHash<int,HvRbutton *>rbp_f_h;
|
||||
rbp_f_h rbtp;
|
||||
typedef QHash<int,HvSlider_V_Identif *>sc_f_h;
|
||||
sc_f_h sldc;
|
||||
typedef QHash<int,HvSlider_V_Identif *>sp_f_h;
|
||||
sp_f_h sldp;
|
||||
typedef QHash<int,HvCBox *>cb_f_h;
|
||||
cb_f_h enum_cb;
|
||||
///////////////////////////////////////////////////////////
|
||||
bool blosk_write;
|
||||
int OpenMixHandle(QString);
|
||||
|
||||
bool m_isOpen;
|
||||
|
||||
//int id2num(const QString& id);
|
||||
snd_mixer_elem_t* getMixerElem(int idx);
|
||||
void RefreshAllHW();
|
||||
int readVolumeFromHW(snd_mixer_elem_t *, int identif);
|
||||
int getMaxVol(snd_mixer_elem_t *, bool capt_or_vol);
|
||||
void addEnumerated(snd_mixer_elem_t *elem, QList<QString*>& enumList);
|
||||
unsigned int get_enumIdHW(snd_mixer_elem_t * elem);
|
||||
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif
|
5
src/HvAlsaMixer/hvalsamixer.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>pic/mix_icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
30
src/HvAlsaMixer/hvcbox.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "hvcbox.h"
|
||||
|
||||
HvCBox::HvCBox( int index_ident, QComboBox *parent )
|
||||
: QComboBox( parent )
|
||||
{
|
||||
s_index_ident = index_ident;
|
||||
setFixedHeight(18);
|
||||
/* QFont font_t(font());
|
||||
font_t.setPixelSize(10);
|
||||
setFont(font_t);*/
|
||||
connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(DeviceChanged(QString)));
|
||||
}
|
||||
|
||||
HvCBox::~HvCBox()
|
||||
{}
|
||||
|
||||
void HvCBox::SetValue(int idx)
|
||||
{
|
||||
setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
void HvCBox::DeviceChanged(QString)
|
||||
{
|
||||
SendVals(s_index_ident, currentIndex());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
32
src/HvAlsaMixer/hvcbox.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef HVCBOX_H
|
||||
#define HVCBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class HvCBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvCBox( int index_ident, QComboBox *parent = 0 );
|
||||
virtual ~HvCBox();
|
||||
|
||||
int get_value()
|
||||
{
|
||||
return currentIndex();
|
||||
}
|
||||
;
|
||||
void SetValue(int);
|
||||
|
||||
signals:
|
||||
void SendVals(int, int);
|
||||
|
||||
private slots:
|
||||
void DeviceChanged(QString);
|
||||
|
||||
private:
|
||||
int s_index_ident;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
129
src/HvAlsaMixer/hvmixermain.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
#include "hvmixermain.h"
|
||||
#if defined _LINUX_
|
||||
HvMixerMain::HvMixerMain( QWidget * parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
size_w = 50;
|
||||
size_h = 50;
|
||||
//setWindowFlags(Qt::FramelessWindowHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
setWindowIcon(QPixmap(":pic/ms_ico.png"));
|
||||
setWindowTitle("MSHV Mixer");
|
||||
//setWindowIcon(QPixmap(":pic/mix_icon.png"));
|
||||
//setWindowTitle("GeoRadar HV Mixer");
|
||||
TabCards = new QTabWidget(this);
|
||||
g_block_alsa = false;
|
||||
ScanForAlsaDev();
|
||||
}
|
||||
HvMixerMain::~HvMixerMain()
|
||||
{}
|
||||
void HvMixerMain::Start()
|
||||
{
|
||||
if (!isVisible())
|
||||
{
|
||||
AddTabs();
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int screenWidth, width;
|
||||
int screenHeight, height;
|
||||
int x, y;
|
||||
QSize windowSize;
|
||||
screenWidth = desktop->screenGeometry(this).width();//2.63 correction for two monitors
|
||||
screenHeight = desktop->screenGeometry(this).height();//2.63 correction for two monitors
|
||||
windowSize = size();
|
||||
width = windowSize.width();
|
||||
height = windowSize.height();
|
||||
x = (screenWidth - width) / 2;
|
||||
y = (screenHeight - height) / 2;
|
||||
y -= 50;
|
||||
move ( x, y );
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
void HvMixerMain::ScanForAlsaDev()
|
||||
{
|
||||
///////////////////////alsa/////////////////////////////////////////////
|
||||
snd_ctl_t *handle;
|
||||
int card, err;// idx;
|
||||
snd_ctl_card_info_t *info;
|
||||
snd_pcm_info_t *pcminfo;
|
||||
snd_ctl_card_info_alloca(&info);
|
||||
snd_pcm_info_alloca(&pcminfo);
|
||||
|
||||
/* static snd_pcm_t *hCapture;
|
||||
snd_pcm_hw_params_t *hware; */
|
||||
|
||||
card = -1;
|
||||
if (snd_card_next(&card) < 0 || card < 0)
|
||||
{
|
||||
card = -1;
|
||||
//2.65 stop fprintf(stderr, "No soundcards found...\n");
|
||||
}
|
||||
// fprintf(stderr, "**** List of %s Hardware Devices ****\n", snd_pcm_stream_name(stream));
|
||||
while (card >= 0)
|
||||
{
|
||||
char name[32];
|
||||
sprintf(name, "hw:%d", card);
|
||||
if ((err = snd_ctl_open(&handle, name, 0)) < 0)
|
||||
{
|
||||
fprintf(stderr, "control open (%i): %s", card, snd_strerror(err));
|
||||
goto next_card;
|
||||
}
|
||||
if ((err = snd_ctl_card_info(handle, info)) < 0)
|
||||
{
|
||||
fprintf(stderr, "control hardware info (%i): %s", card, snd_strerror(err));
|
||||
snd_ctl_close(handle);
|
||||
goto next_card;
|
||||
}
|
||||
//dev_names << QString("hw:80");
|
||||
//card_names << QString("888rtyrt");
|
||||
dev_names << QString("hw:%1").arg(card);
|
||||
card_names << QString("%1").arg(snd_ctl_card_info_get_name(info));
|
||||
//lst_f << QString("hwhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh:%1|#|%2").arg(100).arg(5005);
|
||||
// lst_f << QString("card %1: %3, device %2: %4").arg(card).arg(dev).arg(snd_ctl_card_info_get_name(info)).arg(snd_pcm_info_get_name(pcminfo));
|
||||
snd_ctl_close(handle);
|
||||
|
||||
next_card:
|
||||
if (snd_card_next(&card) < 0)
|
||||
{
|
||||
fprintf(stderr, "snd_card_next\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dev_names.isEmpty())
|
||||
g_block_alsa = true;
|
||||
}
|
||||
|
||||
void HvMixerMain::AddTabs()
|
||||
{
|
||||
if (!g_block_alsa)
|
||||
{
|
||||
int i = 0;
|
||||
for (QStringList::iterator it = dev_names.begin(); it != dev_names.end(); it++)
|
||||
{
|
||||
HvAlsaMixer *TempW = new HvAlsaMixer(*it);
|
||||
TabCards->addTab(TempW, card_names.at(i));
|
||||
|
||||
if (size_w < TempW->sizeHint().width())
|
||||
size_w = TempW->sizeHint().width();
|
||||
if (size_h < TempW->sizeHint().height())
|
||||
size_h = TempW->sizeHint().height();
|
||||
|
||||
setFixedSize(QSize(size_w,size_h));
|
||||
connect(this, SIGNAL(CloseHandles()), TempW, SLOT(CloseHandle()));
|
||||
i++;
|
||||
//it++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setDisabled(true);
|
||||
QMessageBox::critical(this, "MSHV",
|
||||
"No Alsa sound device detected\n"
|
||||
"Close application and install\nsoundcard driver please.",
|
||||
QMessageBox::Close);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
56
src/HvAlsaMixer/hvmixermain.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef HVMIXERMAIN_H
|
||||
#define HVMIXERMAIN_H
|
||||
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if defined _LINUX_
|
||||
#include "hvalsamixer.h"
|
||||
#include <QWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
class HvMixerMain : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvMixerMain(QWidget * parent = 0);
|
||||
virtual ~HvMixerMain();
|
||||
|
||||
signals:
|
||||
void CloseHandles();
|
||||
|
||||
public slots:
|
||||
void Start();
|
||||
|
||||
private:
|
||||
void ScanForAlsaDev();
|
||||
bool g_block_alsa;
|
||||
QStringList dev_names;
|
||||
QStringList card_names;
|
||||
void AddTabs();
|
||||
QTabWidget *TabCards;
|
||||
int size_w, size_h;
|
||||
|
||||
void closeEvent(QCloseEvent*)
|
||||
{
|
||||
//Spriano HV kogato e vgradeno v app i to pleyva sira zvuka i garmi res = system("alsactl store");
|
||||
//int res;
|
||||
//res = system("alsactl store");// zapomnia mixera pri sledva6t start
|
||||
//if ( res != 0 )
|
||||
//fprintf(stderr, "GCC 4.4.0 Error command -> system(alsactl store) in hvmixermain.h line 41...\n");
|
||||
TabCards->clear();
|
||||
emit CloseHandles();
|
||||
disconnect(this, SIGNAL(CloseHandles()), 0, 0);
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
45
src/HvAlsaMixer/hvrbutton.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "hvrbutton.h"
|
||||
|
||||
HvRbutton::HvRbutton(int index_ident, QRadioButton * parent )
|
||||
: QRadioButton(parent)
|
||||
{
|
||||
setFixedSize(14,14);
|
||||
setContentsMargins(0,0,0,0);
|
||||
setAutoExclusive(false);
|
||||
//s_handle_ident = handle_ident;
|
||||
s_index_ident = index_ident;
|
||||
//s_tipe = tipe;
|
||||
|
||||
connect(this, SIGNAL(toggled(bool)), this, SLOT(toggled_s(bool)));
|
||||
}
|
||||
|
||||
HvRbutton::~HvRbutton()
|
||||
{}
|
||||
/*
|
||||
void HvRbutton::SetRbCaptureColor(bool flag)
|
||||
{
|
||||
QPalette palette1 = palette();
|
||||
if (flag)
|
||||
palette1.setColor(QPalette::Text, QColor(255,0,0));
|
||||
else
|
||||
palette1.setColor(QPalette::Text, QColor(0,255,0));
|
||||
setPalette(palette1);
|
||||
}
|
||||
*/
|
||||
void HvRbutton::toggled_s(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
SendVals(1,s_index_ident);
|
||||
else
|
||||
SendVals(0,s_index_ident);
|
||||
}
|
||||
|
||||
void HvRbutton::SetValue(int val)
|
||||
{
|
||||
if (val == 0)
|
||||
setChecked(false);
|
||||
else
|
||||
setChecked(true);
|
||||
}
|
||||
|
||||
|
32
src/HvAlsaMixer/hvrbutton.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef HVRBUTTON_H
|
||||
#define HVRBUTTON_H
|
||||
|
||||
#include <QRadioButton>
|
||||
|
||||
class HvRbutton : public QRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvRbutton(int index_ident, QRadioButton * parent = 0 );
|
||||
virtual ~HvRbutton();
|
||||
|
||||
int get_value()
|
||||
{
|
||||
return isChecked();
|
||||
}
|
||||
;
|
||||
//void SetRbCaptureColor(bool flag);
|
||||
|
||||
|
||||
void SetValue(int);
|
||||
signals:
|
||||
void SendVals(int,int);
|
||||
private slots:
|
||||
void toggled_s(bool);
|
||||
private:
|
||||
//int s_handle_ident;
|
||||
int s_index_ident;
|
||||
//int s_tipe;
|
||||
|
||||
};
|
||||
#endif
|
27
src/HvAlsaMixer/hvvtext.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "hvvtext.h"
|
||||
|
||||
HvVText::HvVText( QString text, QWidget * parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
s_text = text;
|
||||
setFixedSize(11, 140);
|
||||
setContentsMargins(0,0,0,0);
|
||||
QFont font_tfi = font();
|
||||
font_tfi.setPointSize(9);
|
||||
setFont(font_tfi);
|
||||
}
|
||||
|
||||
HvVText::~HvVText()
|
||||
{}
|
||||
|
||||
void HvVText::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.save();
|
||||
painter.translate(width() / 2+4, height()-5);
|
||||
painter.rotate(270);
|
||||
painter.drawText(0, 0, s_text);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
|
20
src/HvAlsaMixer/hvvtext.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef HVVTEXT_H
|
||||
#define HVVTEXT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <qpainter.h>
|
||||
|
||||
class HvVText : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvVText( QString text, QWidget * parent = 0 );
|
||||
virtual ~HvVText();
|
||||
|
||||
private:
|
||||
QString s_text;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
};
|
||||
#endif
|
BIN
src/HvAlsaMixer/pic/mix_icon.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
112
src/HvButtons/hvbutton_left2.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
#include "hvbutton_left2.h"
|
||||
//
|
||||
HvButton_Left2::HvButton_Left2(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
//setCursor(Qt::PointingHandCursor);
|
||||
//connect( this, SIGNAL(Press_Lift_Button_hv()), this, SLOT( slot_Press_Button_2()));
|
||||
//connect( this, SIGNAL(Release_Lift_Button_hv()), this, SLOT( slot_Release_Button_2()));
|
||||
f_outin = false;//2.68
|
||||
Button_Release_Left = true;
|
||||
Mouse_Over_Button = true;
|
||||
}
|
||||
void HvButton_Left2::SetupButton_hv(QPixmap release_stop,QPixmap press_stop,int x_pos,int y_pos,bool sb)
|
||||
{
|
||||
f_outin = sb;//2.66
|
||||
release_butt_stop = release_stop;
|
||||
press_butt_stop = press_stop;
|
||||
|
||||
setFixedSize( release_butt_stop.width(), release_butt_stop.height() );
|
||||
move(x_pos, y_pos);
|
||||
|
||||
if (release_butt_stop.mask().isNull()) // vazno za mov evanta i release evanta mask().contains ima_niama_maska ???
|
||||
setMask(release_butt_stop.rect());
|
||||
else
|
||||
setMask(release_butt_stop.mask()); // raboti samo ako ima ++alpha chanel (butona ima nepravilna forma)!!!
|
||||
|
||||
setPixmap_hv(release_butt_stop);
|
||||
}
|
||||
HvButton_Left2::~HvButton_Left2()
|
||||
{}
|
||||
//////////////////////////Update///////////////////////////////////////////
|
||||
void HvButton_Left2::setPixmap_hv(QPixmap pixmap_hv)
|
||||
{
|
||||
pupdate_hv = pixmap_hv;
|
||||
update();
|
||||
}
|
||||
void HvButton_Left2::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter( this );
|
||||
painter.drawPixmap(0, 0, pupdate_hv);
|
||||
if (isEnabled() == false)
|
||||
painter.fillRect(0, 0, pupdate_hv.width(), pupdate_hv.height(), QColor(150,150,150,100));
|
||||
}
|
||||
//////////////////////////Update///////////////////////////////////////////
|
||||
void HvButton_Left2::mousePressEvent ( QMouseEvent * event)
|
||||
{
|
||||
if (mask().contains(event->pos())) // i tuk triabva left right izvan left left da ne se slu4va ni6to !!!!
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
setPixmap_hv(press_butt_stop);
|
||||
emit Press_Lift_Button_hv();
|
||||
Button_Release_Left = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
void HvButton_Left2::mouseReleaseEvent ( QMouseEvent * event)
|
||||
{
|
||||
if (mask().contains(event->pos()))
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && Button_Release_Left == false)
|
||||
{
|
||||
setPixmap_hv(release_butt_stop);
|
||||
emit Release_Lift_Button_hv();
|
||||
}
|
||||
}
|
||||
if (event->button() == Qt::LeftButton)
|
||||
Button_Release_Left = true;
|
||||
}
|
||||
void HvButton_Left2::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (Mouse_Over_Button == true) // za da se slu4va samo vednaz hv
|
||||
{
|
||||
if (Button_Release_Left == false)
|
||||
{
|
||||
if (!mask().contains(event->pos()))
|
||||
{ //qDebug()<< "Izleze1";
|
||||
//setPixmap_hv(release_butt_stop);
|
||||
Mouse_Over_Button = false;
|
||||
setPixmap_hv(release_butt_stop);
|
||||
if (f_outin) emit Release_Lift_Button_hv();//HV special if button use timer to stop, example spinbox
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
if (Mouse_Over_Button == false) // za da se slu4va samo vednaz hv
|
||||
{
|
||||
if (Button_Release_Left == false)
|
||||
{
|
||||
if (mask().contains(event->pos()))
|
||||
{ //qDebug()<< "Vleze1";
|
||||
//setPixmap_hv(press_butt_stop);
|
||||
Mouse_Over_Button = true;
|
||||
setPixmap_hv(press_butt_stop);
|
||||
if (f_outin) emit Press_Lift_Button_hv();//HV special if button use timer to stop, example spinbox
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/*void HvButton_Left2::slot_Press_Button_2()
|
||||
{
|
||||
setPixmap_hv(press_butt_stop);
|
||||
}
|
||||
|
||||
void HvButton_Left2::slot_Release_Button_2()
|
||||
{
|
||||
setPixmap_hv(release_butt_stop);
|
||||
}*/
|
||||
//
|
||||
|
||||
|
57
src/HvButtons/hvbutton_left2.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVBUTTON_LEFT2_H
|
||||
#define HVBUTTON_LEFT2_H
|
||||
//
|
||||
//#include <QWidget>
|
||||
//#include <QtGui> // slaga se zaradi qdebug
|
||||
#include <QWidget>
|
||||
#include <QBitmap>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
//#include <QtGui/qbitmap.h>
|
||||
//#include <QtGui/qpainter.h>
|
||||
//#include <QtGui/qevent.h>
|
||||
//
|
||||
class HvButton_Left2 : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvButton_Left2(QWidget *parent = 0);
|
||||
virtual ~HvButton_Left2();
|
||||
|
||||
void SetupButton_hv(QPixmap release, QPixmap press, int x_pos, int y_pos,bool);
|
||||
|
||||
signals:
|
||||
void Press_Lift_Button_hv();
|
||||
void Release_Lift_Button_hv();
|
||||
|
||||
//public slots:
|
||||
//void SetupButton_hv(QPixmap release, QPixmap press, int x_pos, int y_pos);
|
||||
|
||||
private:
|
||||
QPixmap release_butt_stop;
|
||||
QPixmap press_butt_stop;
|
||||
QPixmap pupdate_hv;
|
||||
bool Button_Release_Left;
|
||||
bool Mouse_Over_Button;
|
||||
bool f_outin;
|
||||
|
||||
protected:
|
||||
void mousePressEvent ( QMouseEvent * event);
|
||||
void mouseReleaseEvent(QMouseEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void paintEvent( QPaintEvent * event);
|
||||
void setPixmap_hv(QPixmap pixmap_hv);
|
||||
|
||||
//private: //private slots:
|
||||
//void slot_Press_Button_2();
|
||||
//void slot_Release_Button_2();
|
||||
|
||||
|
||||
};
|
||||
#endif
|
163
src/HvButtons/hvbutton_left4.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
#include "hvbutton_left4.h"
|
||||
//
|
||||
HvButton_Left4::HvButton_Left4( QWidget * parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
//setCursor(Qt::PointingHandCursor);
|
||||
//connect( this, SIGNAL(Press_Lift_Button_hv()), this, SLOT( slot_Press_Button_4()));
|
||||
//connect( this, SIGNAL(Release_Lift_Button_hv()), this, SLOT( slot_Release_Button_4()));
|
||||
Button_Release_Left = true;
|
||||
Button_Stop_b = true;
|
||||
Mouse_Over_Button = true;
|
||||
}
|
||||
void HvButton_Left4::SetupButton_hv(QPixmap release_stop, QPixmap press_start, QPixmap release_start, QPixmap press_stop, int x_pos, int y_pos)
|
||||
{
|
||||
release_butt_start = release_start;
|
||||
press_butt_start = press_start;
|
||||
release_butt_stop = release_stop;
|
||||
press_butt_stop = press_stop;
|
||||
|
||||
setFixedSize( release_butt_stop.width(), release_butt_stop.height() );
|
||||
move(x_pos, y_pos);
|
||||
|
||||
if (release_butt_stop.mask().isNull()) // vazno za mov evanta i release evanta mask().contains ima_niama_maska ???
|
||||
setMask(release_butt_stop.rect());
|
||||
else
|
||||
setMask(release_butt_stop.mask()); // raboti samo ako ima ++alpha chanel (butona ima nepravilna forma)!!!
|
||||
|
||||
setPixmap_hv(release_butt_stop);
|
||||
}
|
||||
HvButton_Left4::~HvButton_Left4()
|
||||
{}
|
||||
//////////////////////////Update///////////////////////////////////////////
|
||||
void HvButton_Left4::setPixmap_hv(QPixmap pixmap_hv)
|
||||
{
|
||||
pupdate_hv = pixmap_hv;
|
||||
update();
|
||||
}
|
||||
void HvButton_Left4::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter( this );
|
||||
painter.drawPixmap(0, 0, pupdate_hv);
|
||||
if (isEnabled() == false)
|
||||
painter.fillRect(0, 0, pupdate_hv.width(), pupdate_hv.height(), QColor(150,150,150,100));
|
||||
}
|
||||
//////////////////////////Update///////////////////////////////////////////
|
||||
void HvButton_Left4::mousePressEvent ( QMouseEvent * event)
|
||||
{
|
||||
if (mask().contains(event->pos())) // i tuk triabva left right izvan left left da ne se slu4va ni6to !!!!
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
p_Press_Button_4();
|
||||
emit Press_Lift_Button_hv();
|
||||
Button_Release_Left = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
void HvButton_Left4::ExtrnalRelease()
|
||||
{
|
||||
p_Release_Button_4();
|
||||
emit Release_Lift_Button_hv();
|
||||
Button_Release_Left = true;
|
||||
}
|
||||
void HvButton_Left4::mouseReleaseEvent ( QMouseEvent * event)
|
||||
{
|
||||
if (mask().contains(event->pos()))
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && Button_Release_Left == false)
|
||||
{
|
||||
p_Release_Button_4();
|
||||
emit Release_Lift_Button_hv();
|
||||
}
|
||||
}
|
||||
if (event->button() == Qt::LeftButton)
|
||||
Button_Release_Left = true;
|
||||
}
|
||||
void HvButton_Left4::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (Mouse_Over_Button == true) // za da se slu4va samo vednaz hv
|
||||
{
|
||||
if (Button_Release_Left == false)
|
||||
{
|
||||
if (!mask().contains(event->pos()))
|
||||
{ //qDebug()<< "Izleze1";
|
||||
if (Button_Stop_b == false)
|
||||
setPixmap_hv(release_butt_start);
|
||||
else
|
||||
setPixmap_hv(release_butt_stop);
|
||||
Mouse_Over_Button = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
if (Mouse_Over_Button == false) // za da se slu4va samo vednaz hv
|
||||
{
|
||||
if (Button_Release_Left == false)
|
||||
{
|
||||
if (mask().contains(event->pos()))
|
||||
{ //qDebug()<< "Vleze1";
|
||||
if (Button_Stop_b == true)
|
||||
setPixmap_hv(press_butt_start);
|
||||
else
|
||||
setPixmap_hv(press_butt_stop);
|
||||
Mouse_Over_Button = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
void HvButton_Left4::p_Press_Button_4()
|
||||
{
|
||||
if (Button_Stop_b == true)
|
||||
setPixmap_hv(press_butt_start);
|
||||
else
|
||||
setPixmap_hv(press_butt_stop);
|
||||
}
|
||||
void HvButton_Left4::p_Release_Button_4()
|
||||
{
|
||||
if (Button_Stop_b == true)
|
||||
{
|
||||
setPixmap_hv(release_butt_start);
|
||||
Button_Stop_b = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPixmap_hv(release_butt_stop);
|
||||
Button_Stop_b = true;
|
||||
}
|
||||
}
|
||||
/*void HvButton_Left4::slot_Press_Button_4()
|
||||
{
|
||||
if (Button_Stop_b == true)
|
||||
setPixmap_hv(press_butt_start);
|
||||
else
|
||||
setPixmap_hv(press_butt_stop);
|
||||
}
|
||||
void HvButton_Left4::slot_Release_Button_4()
|
||||
{
|
||||
if (Button_Stop_b == true)
|
||||
{
|
||||
setPixmap_hv(release_butt_start);
|
||||
Button_Stop_b = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPixmap_hv(release_butt_stop);
|
||||
Button_Stop_b = true;
|
||||
}
|
||||
}*/
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void HvButton_Left4::Release_Button_hv()
|
||||
{
|
||||
setPixmap_hv(release_butt_stop);
|
||||
Button_Stop_b = true;
|
||||
}
|
||||
void HvButton_Left4::Press_Button_hv()
|
||||
{
|
||||
setPixmap_hv(release_butt_start);
|
||||
Button_Stop_b = false;
|
||||
}
|
||||
//
|
||||
|
||||
|
65
src/HvButtons/hvbutton_left4.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVBUTTON_LEFT4_H
|
||||
#define HVBUTTON_LEFT4_H
|
||||
//
|
||||
//#include <QWidget>
|
||||
//#include <QtGui> // slaga se zaradi qdebug
|
||||
#include <QWidget>
|
||||
#include <QBitmap>
|
||||
#include <QPainter>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
//
|
||||
class HvButton_Left4 : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvButton_Left4(QWidget * parent = 0);
|
||||
virtual ~HvButton_Left4();
|
||||
|
||||
bool Button_Stop_b;
|
||||
void ExtrnalRelease();
|
||||
void SetupButton_hv(QPixmap release_stop, QPixmap press_start, QPixmap release_start, QPixmap press_stop,
|
||||
int x_pos, int y_pos);
|
||||
void Release_Button_hv();
|
||||
void Press_Button_hv();
|
||||
|
||||
signals:
|
||||
void Press_Lift_Button_hv();
|
||||
void Release_Lift_Button_hv();
|
||||
|
||||
//public slots:
|
||||
//void SetupButton_hv(QPixmap release_stop, QPixmap press_start, QPixmap release_start, QPixmap press_stop,
|
||||
//int x_pos, int y_pos);
|
||||
//void Release_Button_hv();
|
||||
//void Press_Button_hv();
|
||||
|
||||
private:
|
||||
QPixmap release_butt_start;
|
||||
QPixmap press_butt_start;
|
||||
QPixmap release_butt_stop;
|
||||
QPixmap press_butt_stop;
|
||||
QPixmap pupdate_hv;
|
||||
bool Button_Release_Left;
|
||||
bool Mouse_Over_Button;
|
||||
void p_Press_Button_4();
|
||||
void p_Release_Button_4();
|
||||
|
||||
protected:
|
||||
void mousePressEvent ( QMouseEvent * event);
|
||||
void mouseReleaseEvent(QMouseEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void paintEvent( QPaintEvent * event);
|
||||
void setPixmap_hv(QPixmap pixmap_hv);
|
||||
|
||||
/*protected slots:
|
||||
void slot_Press_Button_4();
|
||||
void slot_Release_Button_4();*/
|
||||
|
||||
};
|
||||
#endif
|
25
src/HvButtons/hvbuttons.qrc
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>pic/up_press.png</file>
|
||||
<file>pic/up_rep.png</file>
|
||||
<file>pic/down_press.png</file>
|
||||
<file>pic/down_rep.png</file>
|
||||
<file>pic/1d_release.png</file>
|
||||
<file>pic/1d_press.png</file>
|
||||
<file>pic/2d_release.png</file>
|
||||
<file>pic/2d_press.png</file>
|
||||
<file>pic/d1_release.png</file>
|
||||
<file>pic/d1_press.png</file>
|
||||
<file>pic/d2_release.png</file>
|
||||
<file>pic/d2_press.png</file>
|
||||
<file>pic/def_rep.png</file>
|
||||
<file>pic/def_press.png</file>
|
||||
<file>pic/clr_rep.png</file>
|
||||
<file>pic/clr_press.png</file>
|
||||
<file>pic/up_press_b.png</file>
|
||||
<file>pic/up_rep_b.png</file>
|
||||
<file>pic/down_press_b.png</file>
|
||||
<file>pic/down_rep_b.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
192
src/HvButtons/hvmodbtsw.cpp
Normal file
@ -0,0 +1,192 @@
|
||||
/* MSHV Mode Switcher Buttons
|
||||
* Copyright 2022 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvmodbtsw.h"
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
#include "../config_str_all.h"
|
||||
|
||||
CbModeSw::CbModeSw(int id,QString n,QWidget *parent)
|
||||
: QCheckBox(parent)
|
||||
{
|
||||
sid = id;
|
||||
setText(n);
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(sclicked(bool)));
|
||||
}
|
||||
CbModeSw::~CbModeSw()
|
||||
{}
|
||||
void CbModeSw::sclicked(bool f)
|
||||
{
|
||||
emit cbclicked(sid,f);
|
||||
}
|
||||
HvDialogModBtSw::HvDialogModBtSw(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Mode Switcher Buttons"));
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||
setMinimumSize(200,400);//235,400
|
||||
LV = new QVBoxLayout();
|
||||
LV->setContentsMargins(10,2,5,2);
|
||||
LV->setSpacing(0);
|
||||
QGroupBox *GB_M = new QGroupBox(tr("Choose Modes")+":");
|
||||
QVBoxLayout *LV_D = new QVBoxLayout(this);
|
||||
LV_D->setContentsMargins(10,10,10,10);
|
||||
LV_D->setSpacing(10);
|
||||
for (int i = 0; i < COUNT_MODE; ++i)
|
||||
{
|
||||
CbModeSw *cb = new CbModeSw(i,ModeStr(pos_mods[i]));
|
||||
LV->addWidget(cb);
|
||||
connect(cb, SIGNAL(cbclicked(int,bool)), this, SIGNAL(clicked(int,bool)));
|
||||
}
|
||||
//LV->setAlignment(Qt::AlignTop);
|
||||
cb220 = new CbModeSw(COUNT_MODE,tr("USE MODE SWITCHER"));//"USE MODE SWITCHER BUTTONS"
|
||||
connect(cb220, SIGNAL(cbclicked(int,bool)), this, SIGNAL(clicked(int,bool)));
|
||||
GB_M->setLayout(LV);
|
||||
LV_D->addWidget(GB_M);
|
||||
LV_D->addWidget(cb220);
|
||||
setLayout(LV_D);
|
||||
}
|
||||
HvDialogModBtSw::~HvDialogModBtSw()
|
||||
{}
|
||||
void HvDialogModBtSw::SetDsettings(int i,bool f)
|
||||
{
|
||||
if (i<COUNT_MODE)
|
||||
{
|
||||
CbModeSw *cb = (CbModeSw*)LV->itemAt(i)->widget();
|
||||
cb->setChecked(f);
|
||||
}
|
||||
if (i==COUNT_MODE) cb220->setChecked(f);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
HvButton_ID::HvButton_ID(int id, QString n, QWidget * parent)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
sid = id;
|
||||
setText(n);
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(sclicked()));
|
||||
}
|
||||
HvButton_ID::~HvButton_ID()
|
||||
{}
|
||||
void HvButton_ID::sclicked()
|
||||
{
|
||||
emit btclicked(sid);
|
||||
}
|
||||
HvWModBtSw::HvWModBtSw(QWidget *dp,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
H_bt_mode = new QHBoxLayout();
|
||||
H_bt_mode->setContentsMargins(0,0,0,0);
|
||||
H_bt_mode->setSpacing(0);
|
||||
for (int i = 0; i < COUNT_MODE; ++i)
|
||||
{
|
||||
HvButton_ID *bt = new HvButton_ID(pos_mods[i],ModeStr(pos_mods[i]));
|
||||
bt->setFixedHeight(19);
|
||||
bt->setHidden(true);//default
|
||||
H_bt_mode->addWidget(bt);
|
||||
connect(bt, SIGNAL(btclicked(int)), this, SIGNAL(clicked(int)));
|
||||
}
|
||||
setHidden(true);//default
|
||||
setLayout(H_bt_mode);
|
||||
D_mode_bt_sw = new HvDialogModBtSw(dp);
|
||||
connect(D_mode_bt_sw, SIGNAL(clicked(int,bool)), this, SLOT(SetHidden(int,bool)));
|
||||
SetSettings("0#2#13#11#14#15#7#8#222");//default
|
||||
}
|
||||
HvWModBtSw::~HvWModBtSw()
|
||||
{}
|
||||
/*void HvWModBtSw::SetDefault()
|
||||
{
|
||||
SetSettings("0#2#13#11#14#15#7#8#222");//default
|
||||
}*/
|
||||
void HvWModBtSw::dexec()
|
||||
{
|
||||
D_mode_bt_sw->exec();
|
||||
}
|
||||
void HvWModBtSw::SetFont(QFont f)
|
||||
{
|
||||
QFontMetrics fm(f);
|
||||
for (int i = 0; i < COUNT_MODE; ++i)
|
||||
{
|
||||
HvButton_ID *bt = (HvButton_ID*)H_bt_mode->itemAt(i)->widget();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)//2.56
|
||||
int fcor = fm.horizontalAdvance(ModeStr(pos_mods[i]))+10;
|
||||
#else
|
||||
int fcor = fm.width(ModeStr(pos_mods[i]))+10;
|
||||
#endif
|
||||
bt->setMinimumWidth(fcor);
|
||||
bt->setFixedHeight(fm.height()+2);
|
||||
}
|
||||
}
|
||||
void HvWModBtSw::SetHidden(int i,bool f)
|
||||
{
|
||||
bool f0 = true;
|
||||
if (f) f0 = false;
|
||||
if (i<COUNT_MODE)
|
||||
{
|
||||
if (H_bt_mode->isEmpty() && !isHidden()) emit clicked(220);
|
||||
HvButton_ID *bt = (HvButton_ID*)H_bt_mode->itemAt(i)->widget();
|
||||
bt->setHidden(f0);
|
||||
}
|
||||
if (i==COUNT_MODE)
|
||||
{
|
||||
if (!H_bt_mode->isEmpty() && isHidden()) emit clicked(220);
|
||||
setHidden(f0);
|
||||
}
|
||||
}
|
||||
void HvWModBtSw::SetSettings(QString s)
|
||||
{
|
||||
QStringList l = s.split("#");
|
||||
bool f = false;
|
||||
for (int i = 0; i < COUNT_MODE; ++i)
|
||||
{
|
||||
f = false;
|
||||
HvButton_ID *bt = (HvButton_ID*)H_bt_mode->itemAt(i)->widget();
|
||||
for (int j = 0; j < l.count(); ++j)
|
||||
{
|
||||
if (bt->sid == l.at(j).toInt())
|
||||
{
|
||||
bt->setHidden(false);
|
||||
D_mode_bt_sw->SetDsettings(i,true);
|
||||
f = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!f)
|
||||
{
|
||||
bt->setHidden(true);
|
||||
D_mode_bt_sw->SetDsettings(i,false);
|
||||
}
|
||||
}
|
||||
f = false;
|
||||
for (int j = 0; j < l.count(); ++j)
|
||||
{
|
||||
if (l.at(j) == "220")
|
||||
{
|
||||
setHidden(false);
|
||||
D_mode_bt_sw->SetDsettings(COUNT_MODE,true);
|
||||
f = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!f)
|
||||
{
|
||||
setHidden(true);
|
||||
D_mode_bt_sw->SetDsettings(COUNT_MODE,false);
|
||||
}
|
||||
}
|
||||
QString HvWModBtSw::GetSettings()
|
||||
{
|
||||
QString str;
|
||||
for (int i = 0; i < COUNT_MODE; ++i)
|
||||
{
|
||||
HvButton_ID *bt = (HvButton_ID*)H_bt_mode->itemAt(i)->widget();
|
||||
if (!bt->isHidden()) str.append(QString("%1").arg(bt->sid)+"#");
|
||||
}
|
||||
if (!isHidden()) str.append("220#");
|
||||
str.append("222");//id all is off
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
93
src/HvButtons/hvmodbtsw.h
Normal file
@ -0,0 +1,93 @@
|
||||
/* MSHV Mode Switcher Buttons
|
||||
* Copyright 2022 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef HVMODBTSW_H
|
||||
#define HVMODBTSW_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
|
||||
class CbModeSw : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CbModeSw(int id,QString s,QWidget * parent = 0);
|
||||
virtual ~CbModeSw();
|
||||
|
||||
signals:
|
||||
void cbclicked(int,bool);
|
||||
|
||||
private slots:
|
||||
void sclicked(bool);
|
||||
|
||||
private:
|
||||
int sid;
|
||||
|
||||
};
|
||||
class HvDialogModBtSw : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvDialogModBtSw(QWidget * parent);
|
||||
virtual ~HvDialogModBtSw();
|
||||
void SetDsettings(int,bool);
|
||||
|
||||
signals:
|
||||
void clicked(int,bool);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QVBoxLayout *LV;
|
||||
int sid;
|
||||
CbModeSw *cb220;
|
||||
|
||||
};
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QFont>
|
||||
class HvButton_ID : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvButton_ID(int id, QString,QWidget * parent = 0);
|
||||
virtual ~HvButton_ID();
|
||||
int sid;
|
||||
|
||||
private:
|
||||
|
||||
signals:
|
||||
void btclicked(int);
|
||||
|
||||
public slots:
|
||||
void sclicked();
|
||||
|
||||
};
|
||||
|
||||
class HvWModBtSw : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvWModBtSw(QWidget * dp,QWidget * parent = 0);
|
||||
virtual ~HvWModBtSw();
|
||||
void SetSettings(QString);
|
||||
QString GetSettings();
|
||||
void SetFont(QFont);
|
||||
//void SetDefault();
|
||||
|
||||
signals:
|
||||
void clicked(int);
|
||||
|
||||
public slots:
|
||||
void SetHidden(int,bool);
|
||||
void dexec();
|
||||
|
||||
private:
|
||||
QHBoxLayout *H_bt_mode;
|
||||
HvDialogModBtSw *D_mode_bt_sw;
|
||||
|
||||
};
|
||||
#endif
|
BIN
src/HvButtons/pic/1d_press.png
Normal file
After Width: | Height: | Size: 322 B |
BIN
src/HvButtons/pic/1d_release.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
src/HvButtons/pic/2d_press.png
Normal file
After Width: | Height: | Size: 382 B |
BIN
src/HvButtons/pic/2d_release.png
Normal file
After Width: | Height: | Size: 419 B |
BIN
src/HvButtons/pic/clr_press.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
src/HvButtons/pic/clr_rep.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
src/HvButtons/pic/d1_press.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
src/HvButtons/pic/d1_release.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
src/HvButtons/pic/d2_press.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
src/HvButtons/pic/d2_release.png
Normal file
After Width: | Height: | Size: 418 B |
BIN
src/HvButtons/pic/def_press.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
src/HvButtons/pic/def_rep.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
src/HvButtons/pic/down_press.png
Normal file
After Width: | Height: | Size: 314 B |
BIN
src/HvButtons/pic/down_press_b.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
src/HvButtons/pic/down_rep.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
src/HvButtons/pic/down_rep_b.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
src/HvButtons/pic/up_press.png
Normal file
After Width: | Height: | Size: 310 B |
BIN
src/HvButtons/pic/up_press_b.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
src/HvButtons/pic/up_rep.png
Normal file
After Width: | Height: | Size: 286 B |
BIN
src/HvButtons/pic/up_rep_b.png
Normal file
After Width: | Height: | Size: 160 B |
1955
src/HvDecodeList/decodelist.cpp
Normal file
205
src/HvDecodeList/decodelist.h
Normal file
@ -0,0 +1,205 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef DECODELIST_H
|
||||
#define DECODELIST_H
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <QTreeView>
|
||||
#include <QCoreApplication>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QLineEdit>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include <QFontDatabase>
|
||||
#include <QItemDelegate>
|
||||
#include <QMenu>
|
||||
//#include "../../../DirectX90c/include/dsound.h"// zaradi DWORD in pathred create
|
||||
//#include <unistd.h> // zaradi usleep
|
||||
//#include <QtGui>
|
||||
|
||||
//Delegate rools for QStandardItem in qtreeview like QLineEdit
|
||||
class MyDelegate: public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyDelegate (QObject* parent = 0):QItemDelegate(parent)
|
||||
{}
|
||||
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
signals:
|
||||
void EmitSelectedText(QString,int,int);
|
||||
private slots:
|
||||
void SelectionChanged();
|
||||
//void closeEvent(QCloseEvent*);
|
||||
//void commitAndCloseEditor();
|
||||
//bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
};
|
||||
|
||||
/*class HvHeader : public QHeaderView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvHeader(Qt::Orientation orientation, QWidget *parent = 0);
|
||||
virtual ~HvHeader();
|
||||
|
||||
};*/
|
||||
#include "hvtooltip.h"
|
||||
#include "hvcty.h"
|
||||
#include "../HvTxW/hvqthloc.h"
|
||||
|
||||
class DecodeList : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DecodeList(int ident,bool f,QWidget *parent = 0);
|
||||
virtual ~DecodeList();
|
||||
|
||||
//void SetFocus();
|
||||
QStandardItemModel model;
|
||||
//void Clear_List();
|
||||
//void SetItem_hv(QStringList,int,int,int);
|
||||
//void SetEditRow(int);
|
||||
void SetMode(int,bool);
|
||||
|
||||
int GetListCount()
|
||||
{
|
||||
return model.rowCount();
|
||||
};
|
||||
void StaticIgnoreResizeEvent(bool);//1.30 stop scroling
|
||||
QStringList GetCountries();
|
||||
void SetBackColorTxQsy(bool f);//2.46
|
||||
void HideShowWfTxRefreshList();//2.46
|
||||
|
||||
signals:
|
||||
//void SendRightClick();
|
||||
void ListSelectedTextAll(QString,QString,QString,QString,QString);
|
||||
void ListSelectedRpt(QString);
|
||||
void EmitRxAllTxt(QString);
|
||||
void EmitLstNexColor(bool);
|
||||
void EmitRxStationInfo(QStringList,int,bool);
|
||||
void EmitRxTextForAutoSeq(QStringList);
|
||||
void EmitFreqDecListClick(double);
|
||||
void EmitUdpDecClr();
|
||||
void EmitDetectTextInMsg(QString,QString &);
|
||||
void EmitHeaderDoubleClicked();//2.44
|
||||
|
||||
public slots:
|
||||
void InsertItem_hv(QStringList,bool,bool);
|
||||
void Clear_List();
|
||||
void SetBackColor(bool f);
|
||||
void SetDListMarkText(QStringList,int,int,int,int,int);
|
||||
void SetFontList(QFont);
|
||||
void SetFontHeader(QFont f);
|
||||
void SetTextMarkColors(QColor*,int,bool,bool);
|
||||
void SetStaticGBlockListExp(bool);
|
||||
void SetNewDecClrMsgListFlag(bool);
|
||||
void SetUdpCmdDl(QStringList l);
|
||||
void SetStaticClickOnCallShowCty(bool);
|
||||
void SetTimeElapsed(float);//2.33
|
||||
void SetFilter(QStringList,bool*,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList);//2.43
|
||||
|
||||
private slots:
|
||||
void RefreshListTimer();
|
||||
void ItemSelectedText(QString,int,int);
|
||||
void ac_spot();
|
||||
//void SetHeaderSingleClicked();
|
||||
void SetHeaderDoubleClicked();//2.44
|
||||
|
||||
private:
|
||||
bool dsty;
|
||||
bool is_filters_active;
|
||||
bool f_hide_c[9];
|
||||
bool hide_filter_list;
|
||||
QStringList list_filter;
|
||||
bool is_filter_dec;
|
||||
bool f_bgcolor_clr_lst;
|
||||
bool show_filter_list;
|
||||
bool show_customf_list;
|
||||
QStringList list_customf;
|
||||
bool show_cufspec_list;
|
||||
QStringList list_cufspec;
|
||||
bool show_cufend_list;
|
||||
QStringList list_cufend;
|
||||
bool show_cnyf_list;
|
||||
QStringList list_cnyf;
|
||||
bool show_pfxf_list;
|
||||
QStringList list_pfxf;
|
||||
bool hide_cnyf_list;
|
||||
QStringList list_hidcnyf;
|
||||
QStringList list_b4qso;
|
||||
//bool f_p_hide_b4qso;
|
||||
|
||||
void SetFilterParms(QStringList l,QStringList &lc,bool &f);
|
||||
void RefreshFiltHeadColor(bool,bool,bool,bool,bool,bool,bool,bool,bool);
|
||||
bool AllisDigitOrAllisLetter(QString);
|
||||
HvQthLoc THvQthLoc;
|
||||
QString FindTheirCall(QString);
|
||||
bool ShowDecode(QString);
|
||||
bool ShowCDecode(QString);
|
||||
bool ShowCSDecode(QString);
|
||||
bool ShowCENDDecode(QString);
|
||||
bool HideB4Qso(QString);
|
||||
|
||||
//bool f_click_on_call_show_cty;
|
||||
HvToolTip *THvToolTip;
|
||||
HvCty *THvCty;
|
||||
int s_list_ident;
|
||||
bool s_fast_dec_clr_msg_list;
|
||||
QString last_pt_dec_clr_msg_list;
|
||||
bool f_new_dec_clr_msg_list;
|
||||
void RefreshFastDcml();
|
||||
//bool g_block_list_exp;
|
||||
QTimer *list_rfresh_timer;
|
||||
QMenu *m_spot;
|
||||
//HvHeader *THvHeader;
|
||||
QHeaderView *THvHeader;
|
||||
//int ActiveIndex;
|
||||
//QColor ActiveRowText;
|
||||
//QColor ActiveRowBackg;
|
||||
bool allq65;
|
||||
bool coded_mods;
|
||||
int s_mode;
|
||||
QClipboard *clipboard;
|
||||
bool f_row_color;
|
||||
int msg_column;
|
||||
QStringList s_mark_txt;
|
||||
int s_mark_b4q_pos;
|
||||
int s_mark_loc_pos;
|
||||
int s_mark_myc_pos;
|
||||
int s_mark_hisc_pos;
|
||||
int s_mark_r12_pos;
|
||||
bool s_flag_two;
|
||||
bool f_mark_tx;
|
||||
bool f_mark_qsy;
|
||||
bool f_mark_txqsy;//2.46
|
||||
QColor c_mark_txt[11];
|
||||
int def_section_sizes[20];
|
||||
void SaveAndCorrSectionSize();//2.10 max 20 int def_section_sizes[20]; from model.columnCount()
|
||||
int count_dec;
|
||||
void CountMsgInPeriod(bool);
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent*);
|
||||
//bool isSingeWord(QString s,int b,int e) const;
|
||||
//bool DrawCode(QString,QString,int,int) const;
|
||||
void drawRow(QPainter *painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
|
||||
//void mouseMoveEvent (QMouseEvent*);
|
||||
//void drawMarks(QString find,QString alltxt,QPainter *painter, QRect rect_row);
|
||||
//void mouseDoubleClickEvent(QMouseEvent * event);
|
||||
//void mouseReleaseEvent(QMouseEvent * event);
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
void resizeEvent(QResizeEvent * event);
|
||||
//bool f_resize_event;
|
||||
//bool event ( QEvent * e );
|
||||
//QFont font_items;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
375
src/HvDecodeList/hvcty.cpp
Normal file
@ -0,0 +1,375 @@
|
||||
/* MSHV HVCTY
|
||||
* Copyright 2020 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvcty.h"
|
||||
#include <QTextStream>
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
//// statis for 2 lists /////
|
||||
typedef struct
|
||||
{
|
||||
QString pfx;
|
||||
QString country;
|
||||
QString continent;
|
||||
//int id_cname;
|
||||
}
|
||||
recordd;
|
||||
static QList<recordd>db_cty_p;
|
||||
static QList<recordd>db_cty_c;
|
||||
static QStringList _lcountries_;
|
||||
bool hv_sort_disorder_(const recordd &d1,const recordd &d2)
|
||||
{
|
||||
if (d1.pfx.count() == d2.pfx.count()) return d1.country.count() < d2.country.count(); //2.69 new equal calls, not /
|
||||
else return d1.pfx.count() > d2.pfx.count(); //2.69 old
|
||||
}
|
||||
/*bool hv_sort_00_(const recordd &d1,const recordd &d2)
|
||||
{
|
||||
if (d1.pfx == d2.pfx) return d1.country.count() < d2.country.count();
|
||||
else return d1.pfx < d2.pfx; //by names
|
||||
}*/
|
||||
//// end statis for 2 lists /////
|
||||
/*
|
||||
void debuglst()
|
||||
{
|
||||
//for (int i = 0; i < db_cty.count(); ++i)
|
||||
//qDebug()<<"e="<<db_cty.at(i).pfx<<db_cty.at(i).name;
|
||||
qDebug()<<"count_lines"<<db_cty.count();
|
||||
}
|
||||
*/
|
||||
HvCty::HvCty(int id_n)//QObject *parent
|
||||
//: QObject(parent)
|
||||
{
|
||||
if (id_n==1) ReadCtyDat();//only 1 list refresh cty.dat
|
||||
}
|
||||
HvCty::~HvCty()
|
||||
{/*qDebug()<<"DELETE";*/
|
||||
}
|
||||
QStringList HvCty::GetCountries()
|
||||
{
|
||||
return _lcountries_;
|
||||
}
|
||||
void HvCty::ReadCtyDat()
|
||||
{
|
||||
QString path = (QCoreApplication::applicationDirPath());
|
||||
path.append("/settings/database/cty.dat");
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) return;
|
||||
QTextStream in(&file);
|
||||
QString line = "";
|
||||
//int c_lines = 0;
|
||||
while (!in.atEnd())
|
||||
{
|
||||
line.append(in.readLine());
|
||||
if (!line.endsWith(';')) continue;
|
||||
line = line.mid(0,line.count()-1);//remove ;
|
||||
QStringList lst = line.split(":");
|
||||
line.clear();
|
||||
int iclst = lst.count();
|
||||
if (iclst<8) continue; //{c_lines++; continue;}
|
||||
recordd trec;
|
||||
//QList<recordd>tall_c;//2.69
|
||||
QString sppfx = lst.at(7).trimmed().toUpper();
|
||||
sppfx.remove("*");//*TA1 *4U1V ... ???
|
||||
QString scoun = lst.at(0).trimmed();
|
||||
QString scont = lst.at(3).trimmed().toUpper();
|
||||
if (!sppfx.contains('/'))//2.69 save scoun, scont and continue may-be have individual calls, exception "FO/AC4LN/A"
|
||||
//if (!sppfx.contains('/') && sppfx.at(0)!='*')
|
||||
{
|
||||
trec.pfx = sppfx;
|
||||
trec.country = scoun;
|
||||
trec.continent = scont;
|
||||
db_cty_p.append(trec);
|
||||
}
|
||||
_lcountries_.append(scoun);
|
||||
//c_lines++;
|
||||
if (iclst<9) continue;//{c_lines++; continue;}//3Y[73],=7S8AAA(38)[67],
|
||||
//c_lines = 1;
|
||||
QString stt = lst.at(8);
|
||||
QStringList ltt = stt.split(",");
|
||||
for (int j = 0; j < ltt.count(); ++j)
|
||||
{
|
||||
QString sttj = ltt.at(j).trimmed().toUpper();
|
||||
int ib1 = sttj.indexOf('(');
|
||||
if (ib1>-1)
|
||||
{
|
||||
int ib2 = sttj.indexOf(')',ib1+1);
|
||||
if (ib2>-1)
|
||||
{
|
||||
QString rmv = sttj.mid(ib1,ib2-ib1+1);
|
||||
sttj.remove(rmv);//cq zone
|
||||
}
|
||||
}
|
||||
ib1 = sttj.indexOf('[');
|
||||
if (ib1>-1)
|
||||
{
|
||||
int ib2 = sttj.indexOf(']',ib1+1);
|
||||
if (ib2>-1)
|
||||
{
|
||||
QString rmv = sttj.mid(ib1,ib2-ib1+1);
|
||||
sttj.remove(rmv);//itu zone
|
||||
}
|
||||
}
|
||||
if (sttj == sppfx) continue;//{if (sttj.contains('/')) c_lines++; continue;}// exsist in primary pfx
|
||||
if (sttj.at(0)=='=')
|
||||
{
|
||||
//if (sttj.contains('/')) continue; //2.69 stop individual cals with '/'
|
||||
sttj.remove('=');
|
||||
/*bool found = false;
|
||||
for (int x = 0; x < tall_c.count(); ++x)
|
||||
{ //if (sttj=="RL1O") qDebug()<<tall_c.at(x).pfx<<sttj<<tall_c.at(x).country<<scoun;
|
||||
if (tall_c.at(x).pfx==sttj)
|
||||
{
|
||||
if (tall_c.at(x).country==scoun)
|
||||
{
|
||||
found = true; //qDebug()<<tall_c.at(x).pfx<<tall_c.at(x).country<<tall_c.at(x).continent<<scont;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) continue;//{c_lines++; continue;}*/
|
||||
trec.pfx = sttj;
|
||||
trec.country = scoun;
|
||||
trec.continent = scont;
|
||||
db_cty_c.append(trec);
|
||||
//tall_c.append(trec);//2.69
|
||||
continue;
|
||||
}
|
||||
/*bool found = false;
|
||||
for (int x = 0; x < tallpfx.count(); ++x)
|
||||
{ //if (sttj=="RL1O") qDebug()<<tallpfx.at(x).pfx<<sttj<<tallpfx.at(x).country<<scoun;
|
||||
if (tallpfx.at(x).pfx==sttj)
|
||||
{
|
||||
if (tallpfx.at(x).country==scoun)
|
||||
{
|
||||
found = true; //qDebug()<<tallpfx.at(x).pfx<<tallpfx.at(x).country<<tallpfx.at(x).continent<<scont;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) continue;//{c_lines++; continue;}*/
|
||||
trec.pfx = sttj;
|
||||
trec.country = scoun;
|
||||
trec.continent = scont;
|
||||
db_cty_p.append(trec);
|
||||
//c_lines++;
|
||||
}
|
||||
//if (c_lines>1) qDebug()<<c_lines<<scoun;
|
||||
}
|
||||
file.close();
|
||||
|
||||
std::sort(db_cty_c.begin(),db_cty_c.end(),hv_sort_disorder_);
|
||||
std::sort(db_cty_p.begin(),db_cty_p.end(),hv_sort_disorder_);
|
||||
std::sort(_lcountries_.begin(),_lcountries_.end());
|
||||
|
||||
/*for (int i = 0; i < db_cty_c.count(); ++i)
|
||||
{
|
||||
if (i<50 || i>15800 ) qDebug()<<i<<db_cty_c.at(i).pfx<<db_cty_c.at(i).country<<db_cty_c.at(i).continent;
|
||||
}
|
||||
for (int i = 0; i < db_cty_p.count(); ++i)
|
||||
{
|
||||
if (i<50 || i>7690 ) qDebug()<<i<<db_cty_p.at(i).pfx<<db_cty_p.at(i).country<<db_cty_p.at(i).continent;
|
||||
//if (db_cty_p.at(i).pfx.isEmpty() || db_cty_p.at(i).country.isEmpty() || db_cty_p.at(i).continent.isEmpty())
|
||||
//qDebug()<<"Empty="<<i<<db_cty_p.at(i).pfx<<db_cty_p.at(i).country<<db_cty_p.at(i).continent;
|
||||
//if (db_cty_p.at(i).pfx.contains("RL1O")) qDebug()<<i<<db_cty_p.at(i).pfx<<db_cty_p.at(i).country<<db_cty_p.at(i).continent;
|
||||
//if (db_cty_p.at(i).pfx.startsWith("WP4OZK")) qDebug()<<i<<db_cty_p.at(i).pfx<<db_cty_p.at(i).country<<db_cty_p.at(i).continent;
|
||||
//if (db_cty_p.at(i).pfx.startsWith("4U1A")) qDebug()<<i<<db_cty_p.at(i).pfx<<db_cty_p.at(i).country<<db_cty_p.at(i).continent;
|
||||
}*/
|
||||
/*QList<recordd>db_00;
|
||||
for (int i = 0; i < db_cty_p.count(); ++i)
|
||||
{
|
||||
QString c = db_cty_p.at(i).pfx;
|
||||
for (int j = 0; j < db_cty_p.count(); ++j)
|
||||
{
|
||||
if (j==i) j++;
|
||||
if (j>=db_cty_p.count()) break;
|
||||
QString d = db_cty_p.at(j).pfx;
|
||||
if (c==d)
|
||||
{
|
||||
db_00.append(db_cty_p.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
std::sort(db_00.begin(),db_00.end(),hv_sort_00_);
|
||||
QString ddd=db_00.at(0).pfx;
|
||||
int ccc = 1;
|
||||
for (int i = 0; i < db_00.count(); ++i)
|
||||
{
|
||||
if (ddd!=db_00.at(i).pfx)
|
||||
{
|
||||
ccc++;
|
||||
qDebug()<<"---------------------------------------";
|
||||
}
|
||||
qDebug()<<ccc<<db_00.at(i).pfx<<db_00.at(i).country<<db_00.at(i).continent;
|
||||
ddd=db_00.at(i).pfx;
|
||||
}
|
||||
qDebug()<<"---PFX---";
|
||||
db_00.clear();
|
||||
for (int i = 0; i < db_cty_c.count(); ++i)
|
||||
{
|
||||
QString c = db_cty_c.at(i).pfx;
|
||||
for (int j = 0; j < db_cty_c.count(); ++j)
|
||||
{
|
||||
if (j==i) j++;
|
||||
if (j>=db_cty_c.count()) break;
|
||||
QString d = db_cty_c.at(j).pfx;
|
||||
if (c==d)
|
||||
{
|
||||
db_00.append(db_cty_c.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
std::sort(db_00.begin(),db_00.end(),hv_sort_00_);
|
||||
ddd=db_00.at(0).pfx;
|
||||
ccc = 1;
|
||||
for (int i = 0; i < db_00.count(); ++i)
|
||||
{
|
||||
if (ddd!=db_00.at(i).pfx)
|
||||
{
|
||||
ccc++;
|
||||
qDebug()<<"---------------------------------------";
|
||||
}
|
||||
qDebug()<<ccc<<db_00.at(i).pfx<<db_00.at(i).country<<db_00.at(i).continent;
|
||||
ddd=db_00.at(i).pfx;
|
||||
}
|
||||
qDebug()<<"--CALL--";*/
|
||||
//qDebug()<<"DbCall="<<db_cty_c.count()<<"DbPfx="<<db_cty_p.count()<<"DbCountries="<<_lcountries_.count();
|
||||
//2.69 calls=15867, pfx=7708, countries=346, qual calls=55
|
||||
}
|
||||
/*QString rrr(QString s)
|
||||
{
|
||||
s.replace ("Islands", "Is.");
|
||||
s.replace ("Island", "Is.");
|
||||
s.replace ("North ", "N. ");
|
||||
s.replace ("Northern ", "N. ");
|
||||
s.replace ("South ", "S. ");
|
||||
s.replace ("East ", "E. ");
|
||||
s.replace ("Eastern ", "E. ");
|
||||
s.replace ("West ", "W. ");
|
||||
s.replace ("Western ", "W. ");
|
||||
s.replace ("Central ", "C. ");
|
||||
s.replace (" and ", " & ");
|
||||
s.replace ("Republic", "Rep.");
|
||||
s.replace ("United States", "U.S.A.");
|
||||
s.replace ("Fed. Rep. of ", "");
|
||||
s.replace ("French ", "Fr.");
|
||||
s.replace ("Asiatic", "AS");
|
||||
s.replace ("European", "EU");
|
||||
s.replace ("African", "AF");
|
||||
return s;
|
||||
}*/
|
||||
bool HvCty::FilndDbPfx(QString call, QString &pfx, QString &coy, QString &cot)
|
||||
{
|
||||
bool res = false;
|
||||
pfx="";
|
||||
coy="Unknown";
|
||||
cot="";
|
||||
if (call.isEmpty()) return false; //{qDebug()<<"CallEmpty="<<pfx<<coy<<cot<<call; return false;}
|
||||
for (int i = 0; i < db_cty_c.count(); ++i)
|
||||
{
|
||||
QString pfxxdb = db_cty_c.at(i).pfx;
|
||||
if (call.count()<pfxxdb.count()) continue;
|
||||
if (call.count()>pfxxdb.count()) break; //{qDebug()<<"break"; break;}
|
||||
if (call==pfxxdb)
|
||||
{
|
||||
pfx=pfxxdb;
|
||||
coy=db_cty_c.at(i).country;
|
||||
cot=db_cty_c.at(i).continent;
|
||||
res = true; //qDebug()<<"CALL="<<i<<pfx<<call<<db_cty_p.at(i).country;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res) return true;
|
||||
for (int i = 0; i < db_cty_p.count(); ++i)
|
||||
{
|
||||
QString pfxxdb = db_cty_p.at(i).pfx;
|
||||
if (call.count()<pfxxdb.count()) continue;//exception call small then prefix {qDebug()<<pfxcall<<pfxxdb<<call.count()<<pfxxdb.count();
|
||||
QString pfxcall = call.mid(0,pfxxdb.count());
|
||||
if (pfxcall==pfxxdb)// && pfxxdb.count()>cpfx
|
||||
{
|
||||
pfx=pfxxdb;
|
||||
coy=db_cty_p.at(i).country;
|
||||
cot=db_cty_p.at(i).continent;
|
||||
res = true; //qDebug()<<"PFX="<<i<<pfx<<call<<db_cty_p.at(i).country;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//QElapsedTimer ttt;
|
||||
QString HvCty::FindCountry(QString call)
|
||||
{
|
||||
QString res = "Unknown"; //ttt.start();
|
||||
QString pfx, coy, cot;
|
||||
if (FilndDbPfx(call,pfx,coy,cot)) res = coy + "," + cot; //qDebug()<<"Time="<<ttt.elapsed();
|
||||
return res;
|
||||
}
|
||||
bool HvCty::HideContinent(QString call,bool fh[8],bool ispfx, QString cot)
|
||||
{
|
||||
if (call.isEmpty()) return true;//exception no std message
|
||||
bool res = true;
|
||||
if (ispfx)
|
||||
{
|
||||
if (fh[3] && cot=="EU") res = false;
|
||||
if (fh[0] && res && cot=="AF") res = false;
|
||||
if (fh[2] && res && cot=="AS") res = false;
|
||||
if (fh[5] && res && cot=="NA") res = false;
|
||||
if (fh[6] && res && cot=="SA") res = false;
|
||||
if (fh[4] && res && cot=="OC") res = false;
|
||||
if (fh[1] && res && cot=="AN") res = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
bool HvCty::HideCountry(QString call,QStringList ls,QString coy) //2.66 bool ispfx,
|
||||
{
|
||||
if (call.isEmpty()) return true;
|
||||
bool res = true;
|
||||
//if (ispfx)
|
||||
//{
|
||||
for (int i = 0; i<ls.count(); ++i)
|
||||
{
|
||||
if (coy==ls.at(i))
|
||||
{
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//}
|
||||
return res;
|
||||
}
|
||||
bool HvCty::ShowCNYDecode(QString call,QStringList ls,bool ispfx, QString coy)
|
||||
{
|
||||
if (call.isEmpty()) return false;
|
||||
bool res = false;
|
||||
if (ispfx)
|
||||
{
|
||||
for (int i = 0; i<ls.count(); ++i)
|
||||
{
|
||||
if (coy==ls.at(i))
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
bool HvCty::ShowPFXDecode(QString call,QStringList ls,bool ispfx, QString pfx)
|
||||
{
|
||||
if (call.isEmpty()) return false;
|
||||
bool res = false;
|
||||
if (ispfx)
|
||||
{
|
||||
for (int i = 0; i<ls.count(); ++i)
|
||||
{
|
||||
if (pfx==ls.at(i))
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
41
src/HvDecodeList/hvcty.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* MSHV HVCTY
|
||||
* Copyright 2020 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef HVCTY_H
|
||||
#define HVCTY_H
|
||||
|
||||
//#include <QObject>
|
||||
#include <QString>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
//#include <QList>
|
||||
|
||||
//#include "../config.h"
|
||||
//#include "../HvTxW/hvqthloc.h"
|
||||
|
||||
class HvCty //: public QObject
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
HvCty(int);
|
||||
~HvCty();
|
||||
QString FindCountry(QString);
|
||||
bool FilndDbPfx(QString,QString &,QString &,QString &);
|
||||
bool HideContinent(QString,bool fh[8],bool,QString);
|
||||
bool HideCountry(QString,QStringList,QString);//bool,
|
||||
bool ShowCNYDecode(QString,QStringList,bool,QString);
|
||||
bool ShowPFXDecode(QString,QStringList,bool,QString);
|
||||
QStringList GetCountries();
|
||||
|
||||
private:
|
||||
void ReadCtyDat();
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
736
src/HvDecodeList/hvfilterdialog.cpp
Normal file
@ -0,0 +1,736 @@
|
||||
/* MSHV FilterDialog
|
||||
* Copyright 2020 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvfilterdialog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
//#include <QtGui>
|
||||
|
||||
HvFilterDialog::HvFilterDialog(bool f,QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
dsty = f;
|
||||
setWindowTitle (tr("Decode List Filters")+" FT");//All For Me And +/-10 kHz From RX
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);// maha help butona
|
||||
QVBoxLayout *LV = new QVBoxLayout(this);
|
||||
LV->setContentsMargins(10, 10, 10, 8);
|
||||
LV->setSpacing(4);
|
||||
|
||||
//QLabel *ltext = new QLabel("No Hideable messages are: All for me and +/-10 kHz around RX frequency");
|
||||
ltext = new QLabel(tr("Filter does not work for: All for me and +/-10 kHz around RX frequency"));
|
||||
if(dsty) ltext->setStyleSheet("QLabel {font-weight: bold; color: rgb(255,150,150);}");
|
||||
else ltext->setStyleSheet("QLabel {font-weight: bold; color: rgb(180,0,0);}");
|
||||
//ltext->setStyleSheet("QLabel {font-weight: bold; color : red; }");
|
||||
|
||||
cb_hacontt[0] = new QCheckBox(tr("Africa"));
|
||||
cb_hacontt[1] = new QCheckBox(tr("Antarctica"));
|
||||
cb_hacontt[2] = new QCheckBox(tr("Asia"));
|
||||
cb_hacontt[3] = new QCheckBox(tr("Europe"));
|
||||
cb_hacontt[4] = new QCheckBox(tr("Oceania"));
|
||||
cb_hacontt[5] = new QCheckBox(tr("North America"));
|
||||
cb_hacontt[6] = new QCheckBox(tr("South America"));
|
||||
QGroupBox *GB_HIDE = new QGroupBox(tr("Hide Messages From Continents")+":");
|
||||
//GB_HIDE->setContentsMargins(0, 15, 0, 0);
|
||||
|
||||
cb_hide_b4qso = new QCheckBox(tr("Hide QSO B4 Messages"));
|
||||
//cb_hide_b4qso->setToolTip(tr("Filtered By: Call, Band, Mode")+"\n"
|
||||
//+tr("Activated in Menu Options, Text Highlight, Section 2"));
|
||||
|
||||
cb_cq = new QCheckBox(tr("Show CQ Messages Only"));
|
||||
cb_cq73 = new QCheckBox(tr("Show CQ,RR73,73 Messages Only"));
|
||||
QGroupBox *GB_CCQ73 = new QGroupBox(tr("Show Custom CQs,RRR,RR73,73 Messages Only: (Maximum 150 Characters)"));
|
||||
cb_ccq = new QCheckBox(tr("Enable"));
|
||||
le_ccq = new HvLeWithSpace();
|
||||
le_ccq->setMaxLength(150);
|
||||
|
||||
//Show And Unhide Only Messages At End That Contain
|
||||
int limit3 = 500;
|
||||
QGroupBox *GB_CTXT3 = new QGroupBox(tr("Show Only Messages With Grid Locator, That Contain: (Maximum 500 Characters)"));
|
||||
cb_contm3 = new QCheckBox(tr("Enable"));
|
||||
le_contm3 = new HvLeWithSpace();
|
||||
le_contm3->setMaxLength(limit3);
|
||||
|
||||
//"And Show Only All Messages Ho Contains With:"
|
||||
//"And Show Only All Messages That Contain With:"
|
||||
//"Show Only And Unhide All Messages That Contain With:"
|
||||
//Show And Unhide Only Messages That Contain DX Call
|
||||
//Show And Unhide Only Messages DX Call That Contain With Key:"
|
||||
int limit0 = 1000;
|
||||
QGroupBox *GB_CTXT0 = new QGroupBox(tr("Show Only Messages With DX Call, That Contain: (Maximum 1000 Characters)"));
|
||||
cb_contm0 = new QCheckBox(tr("Enable"));
|
||||
le_contm0 = new HvLeWithSpace();
|
||||
le_contm0->setMaxLength(limit0);
|
||||
|
||||
int limit1 = 3000; //Show And Unhide Only Messages With Specific Their Call Content
|
||||
QGroupBox *GB_CTXT1 = new QGroupBox(tr("Show Only Messages With DX Call: (Maximum 3000 Characters)"));
|
||||
cb_contm1 = new QCheckBox(tr("Enable"));
|
||||
le_contm1 = new HvLeWithSpace();
|
||||
le_contm1->setMaxLength(limit1);
|
||||
cb_contm2 = new QCheckBox(tr("Enable"));
|
||||
le_contm2 = new HvLeWithSpace();
|
||||
le_contm2->setMaxLength(limit1);
|
||||
|
||||
// Hide 2.62
|
||||
QGroupBox *GB_HIDCCNT = new QGroupBox(tr("Hide Messages From Country: (Please Use Maximum 10 Countrys)"));
|
||||
QLabel *l_hidcnt = new QLabel(tr("Add Country")+":");
|
||||
CbHidCountrys = new QComboBox();
|
||||
QLabel *l_hidremcnt = new QLabel(tr("REM Country")+":");
|
||||
CbHidRemCountrys = new QComboBox();
|
||||
QHBoxLayout *hidhbccnt = new QHBoxLayout();
|
||||
b_hidclr = new QPushButton(tr("CLEAR"));
|
||||
hidhbccnt->setContentsMargins(5,5,5,5);
|
||||
hidhbccnt->setSpacing(5);
|
||||
hidhbccnt->addWidget(l_hidcnt);
|
||||
//hidhbccnt->setAlignment(l_cnt,Qt::AlignRight);
|
||||
hidhbccnt->addWidget(CbHidCountrys);
|
||||
hidhbccnt->addWidget(l_hidremcnt);
|
||||
hidhbccnt->addWidget(CbHidRemCountrys);
|
||||
hidhbccnt->addWidget(b_hidclr);
|
||||
CbHidCountrys->setMinimumWidth(200);
|
||||
//CbHidRemCountrys->setMinimumWidth(200);
|
||||
hidhbccnt->setAlignment(Qt::AlignLeft);
|
||||
cb_contm6 = new QCheckBox(tr("Enable"));
|
||||
le_contm6 = new QLineEdit();
|
||||
le_contm6->setReadOnly(true);
|
||||
QHBoxLayout *hidhbcontm4 = new QHBoxLayout();
|
||||
hidhbcontm4->setContentsMargins(5,5,5,5);
|
||||
hidhbcontm4->setSpacing(5);
|
||||
hidhbcontm4->addWidget(cb_contm6);
|
||||
hidhbcontm4->addWidget(le_contm6);
|
||||
QVBoxLayout *hidvbccnt = new QVBoxLayout();
|
||||
hidvbccnt->setContentsMargins(0,0,0,0);
|
||||
hidvbccnt->setSpacing(0);
|
||||
hidvbccnt->addLayout(hidhbccnt);
|
||||
hidvbccnt->addLayout(hidhbcontm4);
|
||||
GB_HIDCCNT->setLayout(hidvbccnt);
|
||||
|
||||
// Unhide
|
||||
QGroupBox *GB_CCNT = new QGroupBox(tr("Show Only Messages From Country: (Please Use Maximum 10 Countrys)"));
|
||||
QLabel *l_cnt = new QLabel(tr("Add Country")+":");
|
||||
CbCountrys = new QComboBox();
|
||||
QLabel *l_remcnt = new QLabel(tr("REM Country")+":");
|
||||
CbRemCountrys = new QComboBox();
|
||||
QHBoxLayout *hbccnt = new QHBoxLayout();
|
||||
b_clr = new QPushButton(tr("CLEAR"));
|
||||
hbccnt->setContentsMargins(5,5,5,5);
|
||||
hbccnt->setSpacing(5);
|
||||
hbccnt->addWidget(l_cnt);
|
||||
//hbccnt->setAlignment(l_cnt,Qt::AlignRight);
|
||||
hbccnt->addWidget(CbCountrys);
|
||||
hbccnt->addWidget(l_remcnt);
|
||||
hbccnt->addWidget(CbRemCountrys);
|
||||
hbccnt->addWidget(b_clr);
|
||||
CbCountrys->setMinimumWidth(200);
|
||||
//CbRemCountrys->setMinimumWidth(200);
|
||||
hbccnt->setAlignment(Qt::AlignLeft);
|
||||
cb_contm4 = new QCheckBox(tr("Enable"));
|
||||
le_contm4 = new QLineEdit();
|
||||
le_contm4->setReadOnly(true);
|
||||
QHBoxLayout *hbcontm4 = new QHBoxLayout();
|
||||
hbcontm4->setContentsMargins(5,5,5,5);
|
||||
hbcontm4->setSpacing(5);
|
||||
hbcontm4->addWidget(cb_contm4);
|
||||
hbcontm4->addWidget(le_contm4);
|
||||
QVBoxLayout *vbccnt = new QVBoxLayout();
|
||||
vbccnt->setContentsMargins(0,0,0,0);
|
||||
vbccnt->setSpacing(0);
|
||||
vbccnt->addLayout(hbccnt);
|
||||
vbccnt->addLayout(hbcontm4);
|
||||
GB_CCNT->setLayout(vbccnt);
|
||||
|
||||
QGroupBox *GB_CPFX = new QGroupBox(tr("Show Only Messages With DX Prefix: (Standard Prefix Only!, Maximum 500 Characters)"));
|
||||
cb_pfx5 = new QCheckBox(tr("Enable"));
|
||||
le_pfx5 = new HvLeWithSpace();
|
||||
le_pfx5->setMaxLength(500);
|
||||
QHBoxLayout *hbpfx5 = new QHBoxLayout();
|
||||
hbpfx5->setContentsMargins(5, 5, 5, 5);
|
||||
hbpfx5->setSpacing(5);
|
||||
hbpfx5->addWidget(cb_pfx5);
|
||||
hbpfx5->addWidget(le_pfx5);
|
||||
GB_CPFX->setLayout(hbpfx5);
|
||||
|
||||
connect(b_clr, SIGNAL(clicked(bool)), this, SLOT(ClrCountrys()));
|
||||
connect(b_hidclr, SIGNAL(clicked(bool)), this, SLOT(ClrHidCountrys()));
|
||||
|
||||
cb_usefudpdectxt = new QCheckBox(tr("Apply Filters to UDP Decoded Text Messages Broadcast"));
|
||||
QHBoxLayout *hb10 = new QHBoxLayout();
|
||||
hb10->setContentsMargins(7, 1, 5, 1);
|
||||
hb10->setSpacing(5);
|
||||
hb10->addWidget(cb_usefudpdectxt);
|
||||
|
||||
cb_gonoff = new QCheckBox(tr("USE FILTERS"));//Global Stop/Start Filters "On/Off All Filters"
|
||||
QPushButton *b_set_default_filter = new QPushButton(tr("SET DEFAULT FILTER (NO FILTER)"));
|
||||
QPushButton *b_apply_filter = new QPushButton(tr("Apply Changes"));
|
||||
|
||||
pb_fltrOnOff = new QPushButton(tr("FILTERS OFF"));
|
||||
pb_fltrOnOff->setStyleSheet("QPushButton{background-color :palette(Button);}");
|
||||
pb_fltrOnOff->setHidden(true);
|
||||
cb_usebtflonoff = new QCheckBox(tr("USE Button FILTERS ON/OFF"));
|
||||
//SetDefaultFilter();
|
||||
|
||||
connect(b_set_default_filter, SIGNAL(clicked(bool)), this, SLOT(SetDefaultFilter()));
|
||||
connect(b_apply_filter, SIGNAL(clicked(bool)), this, SLOT(ApplyChFilter()));
|
||||
connect(cb_cq, SIGNAL(clicked(bool)), this, SLOT(CBCQChanged(bool)));
|
||||
connect(cb_cq73, SIGNAL(clicked(bool)), this, SLOT(CBCQ73Changed(bool)));
|
||||
connect(cb_ccq, SIGNAL(clicked(bool)), this, SLOT(CBCCQChanged(bool)));
|
||||
|
||||
//connect(cb_contm0, SIGNAL(clicked(bool)), this, SLOT(CBContmChanged0(bool)));
|
||||
connect(cb_contm1, SIGNAL(clicked(bool)), this, SLOT(CBContmChanged1(bool)));
|
||||
connect(cb_contm2, SIGNAL(clicked(bool)), this, SLOT(CBContmChanged2(bool)));
|
||||
connect(cb_gonoff, SIGNAL(clicked(bool)), this, SLOT(CBGOnOffChanged(bool)));
|
||||
connect(pb_fltrOnOff, SIGNAL(clicked(bool)), this, SLOT(PbSetOnOff()));
|
||||
connect(cb_usebtflonoff, SIGNAL(toggled(bool)), this, SLOT(CbHidFLBtOnOff(bool)));
|
||||
//qDebug()<<"Connecttttttttttt";
|
||||
|
||||
SetDefaultFilter();
|
||||
|
||||
QHBoxLayout *hbcq = new QHBoxLayout();
|
||||
hbcq->setContentsMargins(7, 5, 5, 5);
|
||||
hbcq->setSpacing(5);
|
||||
hbcq->addWidget(cb_hide_b4qso);
|
||||
hbcq->addWidget(cb_cq);
|
||||
hbcq->addWidget(cb_cq73);
|
||||
|
||||
QHBoxLayout *hb00 = new QHBoxLayout();
|
||||
hb00->setContentsMargins(5, 5, 5, 5);
|
||||
hb00->setSpacing(5);
|
||||
for (int i = 0; i < 7; ++i) hb00->addWidget(cb_hacontt[i]);
|
||||
GB_HIDE->setLayout(hb00);
|
||||
|
||||
QHBoxLayout *hb01 = new QHBoxLayout();
|
||||
hb01->setContentsMargins(5, 5, 5, 5);
|
||||
hb01->setSpacing(5);
|
||||
hb01->addWidget(cb_ccq);
|
||||
hb01->addWidget(le_ccq);
|
||||
GB_CCQ73->setLayout(hb01);
|
||||
|
||||
QHBoxLayout *hbcontm3 = new QHBoxLayout();
|
||||
hbcontm3->setContentsMargins(5, 5, 5, 5);
|
||||
hbcontm3->setSpacing(5);
|
||||
hbcontm3->addWidget(cb_contm3);
|
||||
hbcontm3->addWidget(le_contm3);
|
||||
GB_CTXT3->setLayout(hbcontm3);
|
||||
|
||||
QHBoxLayout *hbcontm0 = new QHBoxLayout();
|
||||
hbcontm0->setContentsMargins(5, 5, 5, 5);
|
||||
hbcontm0->setSpacing(5);
|
||||
hbcontm0->addWidget(cb_contm0);
|
||||
hbcontm0->addWidget(le_contm0);
|
||||
GB_CTXT0->setLayout(hbcontm0);
|
||||
|
||||
QHBoxLayout *hbcontm1 = new QHBoxLayout();
|
||||
hbcontm1->setContentsMargins(5, 5, 5, 5);
|
||||
hbcontm1->setSpacing(5);
|
||||
hbcontm1->addWidget(cb_contm1);
|
||||
hbcontm1->addWidget(le_contm1);
|
||||
QHBoxLayout *hbcontm2 = new QHBoxLayout();
|
||||
hbcontm2->setContentsMargins(5, 5, 5, 5);
|
||||
hbcontm2->setSpacing(5);
|
||||
hbcontm2->addWidget(cb_contm2);
|
||||
hbcontm2->addWidget(le_contm2);
|
||||
QVBoxLayout *vbcontm = new QVBoxLayout();
|
||||
vbcontm->setContentsMargins(0, 0, 0, 0);
|
||||
vbcontm->setSpacing(0);
|
||||
vbcontm->addLayout(hbcontm1);
|
||||
vbcontm->addLayout(hbcontm2);
|
||||
GB_CTXT1->setLayout(vbcontm);
|
||||
|
||||
QHBoxLayout *hb02 = new QHBoxLayout();
|
||||
hb02->setContentsMargins(7, 0, 0, 0);
|
||||
hb02->setSpacing(5);
|
||||
hb02->addWidget(cb_gonoff);
|
||||
hb02->addWidget(cb_usebtflonoff);
|
||||
//hb02->setAlignment(cb_gonoff,Qt::AlignLeft);
|
||||
hb02->addWidget(b_apply_filter);
|
||||
//hb02->setAlignment(b_apply_filter,Qt::AlignLeft);
|
||||
hb02->addWidget(b_set_default_filter);
|
||||
//hb02->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
ltext->setContentsMargins(0,0,0,2);
|
||||
LV->addWidget(ltext);
|
||||
LV->setAlignment(ltext,Qt::AlignCenter);
|
||||
LV->addWidget(GB_HIDE);
|
||||
LV->addWidget(GB_HIDCCNT);
|
||||
LV->addLayout(hbcq);
|
||||
LV->addWidget(GB_CCQ73);
|
||||
LV->addWidget(GB_CCNT);
|
||||
LV->addWidget(GB_CPFX);
|
||||
LV->addWidget(GB_CTXT3);
|
||||
LV->addWidget(GB_CTXT0);
|
||||
LV->addWidget(GB_CTXT1);
|
||||
LV->addLayout(hb10);
|
||||
|
||||
LV->addLayout(hb02);
|
||||
//LV->addWidget(b_set_default_filter);
|
||||
this->setLayout(LV);
|
||||
//this->setMinimumWidth(620);
|
||||
//this->setMinimumSize(200,100);
|
||||
}
|
||||
HvFilterDialog::~HvFilterDialog()
|
||||
{}
|
||||
void HvFilterDialog::SetTextMark(bool *f,QString)
|
||||
{
|
||||
QString s = tr("Filtered By")+": "+tr("Call");
|
||||
if (f[20]) s.append(", "+tr("Band"));// band
|
||||
if (f[21]) s.append(", "+tr("Mode"));// mode
|
||||
cb_hide_b4qso->setToolTip(s+"\n"+tr("Enabled in Menu Options, Text Highlight, Section 2"));
|
||||
}
|
||||
void HvFilterDialog::RefrCountrys()
|
||||
{
|
||||
QStringList l;
|
||||
if (le_contm4->text()!="") l = le_contm4->text().split(",");
|
||||
l.prepend(" - Remove Country - ");
|
||||
CbRemCountrys->clear();
|
||||
CbRemCountrys->addItems(l);
|
||||
CbCountrys->setCurrentIndex(0);
|
||||
CbRemCountrys->setCurrentIndex(0);
|
||||
}
|
||||
void HvFilterDialog::ClrCountrys()
|
||||
{
|
||||
le_contm4->setText("");
|
||||
RefrCountrys();
|
||||
}
|
||||
void HvFilterDialog::CbRemCountrysChanged(QString s)
|
||||
{
|
||||
if (s==" - Remove Country - " || s.isEmpty()) return;
|
||||
QString str;
|
||||
str = le_contm4->text();
|
||||
str.remove(s);
|
||||
le_contm4->setText(CorrectSyntax(str,false));
|
||||
RefrCountrys();
|
||||
}
|
||||
void HvFilterDialog::CbCountrysChanged(QString s)
|
||||
{
|
||||
if (s==" - Choice Country - ") return;
|
||||
int l_limit = 18;//for 20
|
||||
QString str = le_contm4->text();
|
||||
if (str.count(",")>l_limit) return;
|
||||
if (str!="") str.append(",");
|
||||
str.append(s);
|
||||
le_contm4->setText(str);
|
||||
RefrCountrys();
|
||||
}
|
||||
void HvFilterDialog::RefrHidCountrys()
|
||||
{
|
||||
QStringList l;
|
||||
if (le_contm6->text()!="") l = le_contm6->text().split(",");
|
||||
l.prepend(" - Remove Country - ");
|
||||
CbHidRemCountrys->clear();
|
||||
CbHidRemCountrys->addItems(l);
|
||||
CbHidCountrys->setCurrentIndex(0);
|
||||
CbHidRemCountrys->setCurrentIndex(0);
|
||||
}
|
||||
void HvFilterDialog::ClrHidCountrys()
|
||||
{
|
||||
le_contm6->setText("");
|
||||
RefrHidCountrys();
|
||||
}
|
||||
void HvFilterDialog::CbHidRemCountrysChanged(QString s)
|
||||
{
|
||||
if (s==" - Remove Country - " || s.isEmpty()) return;
|
||||
QString str;
|
||||
str = le_contm6->text();
|
||||
str.remove(s);
|
||||
le_contm6->setText(CorrectSyntax(str,false));
|
||||
RefrHidCountrys();
|
||||
}
|
||||
void HvFilterDialog::CbHidCountrysChanged(QString s)
|
||||
{
|
||||
if (s==" - Choice Country - ") return;
|
||||
int l_limit = 18;//for 20
|
||||
QString str = le_contm6->text();
|
||||
if (str.count(",")>l_limit) return;
|
||||
if (str!="") str.append(",");
|
||||
str.append(s);
|
||||
le_contm6->setText(str);
|
||||
RefrHidCountrys();
|
||||
}
|
||||
void HvFilterDialog::SetCountries(QStringList l)
|
||||
{
|
||||
l.prepend(" - Choice Country - ");
|
||||
CbCountrys->addItems(l);
|
||||
connect(CbCountrys, SIGNAL(currentIndexChanged(QString)), this, SLOT(CbCountrysChanged(QString)));
|
||||
connect(CbRemCountrys, SIGNAL(currentIndexChanged(QString)), this, SLOT(CbRemCountrysChanged(QString)));
|
||||
CbHidCountrys->addItems(l);
|
||||
CbHidCountrys->insertItem(1,"Unknown");//2.66
|
||||
connect(CbHidCountrys, SIGNAL(currentIndexChanged(QString)), this, SLOT(CbHidCountrysChanged(QString)));
|
||||
connect(CbHidRemCountrys, SIGNAL(currentIndexChanged(QString)), this, SLOT(CbHidRemCountrysChanged(QString)));
|
||||
}
|
||||
void HvFilterDialog::SetFont(QFont f)
|
||||
{
|
||||
le_ccq->setFont(f);
|
||||
if(dsty) ltext->setStyleSheet("QLabel {font-weight: bold; color: rgb(255,150,150);}");
|
||||
else ltext->setStyleSheet("QLabel {font-weight: bold; color: rgb(180,0,0);}");
|
||||
}
|
||||
void HvFilterDialog::CBCQChanged(bool)
|
||||
{
|
||||
if (cb_cq->isChecked())
|
||||
{
|
||||
cb_ccq->setChecked(false);
|
||||
cb_cq73->setChecked(false);
|
||||
}
|
||||
}
|
||||
void HvFilterDialog::CBCQ73Changed(bool)
|
||||
{
|
||||
if (cb_cq73->isChecked())
|
||||
{
|
||||
cb_ccq->setChecked(false);
|
||||
cb_cq->setChecked(false);
|
||||
}
|
||||
}
|
||||
void HvFilterDialog::CBCCQChanged(bool)
|
||||
{
|
||||
if (cb_ccq->isChecked())
|
||||
{
|
||||
cb_cq->setChecked(false);
|
||||
cb_cq73->setChecked(false);
|
||||
}
|
||||
}
|
||||
void HvFilterDialog::CBContmChanged1(bool)
|
||||
{
|
||||
if (cb_contm1->isChecked()) cb_contm2->setChecked(false);
|
||||
}
|
||||
void HvFilterDialog::CBContmChanged2(bool)
|
||||
{
|
||||
if (cb_contm2->isChecked()) cb_contm1->setChecked(false);
|
||||
}
|
||||
QString HvFilterDialog::CorrectSyntax(QString txt ,bool cordot)
|
||||
{
|
||||
QString res;
|
||||
txt = txt.trimmed();
|
||||
if (!txt.isEmpty())
|
||||
{
|
||||
if (cordot) txt.replace(".",",");
|
||||
QStringList ltxt = txt.split(",");
|
||||
ltxt.removeDuplicates();
|
||||
if (ltxt.count()>0)
|
||||
{
|
||||
for (int i = 0; i<ltxt.count(); ++i)
|
||||
{
|
||||
QString stxt = ltxt.at(i);
|
||||
stxt = stxt.trimmed();
|
||||
if (!stxt.isEmpty())
|
||||
{
|
||||
res.append(stxt);
|
||||
if (i<ltxt.count()-1)res.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.append(txt);
|
||||
}
|
||||
}
|
||||
if (res.endsWith(",")) res = res.mid(0,res.count()-1);
|
||||
return res.trimmed();
|
||||
}
|
||||
void HvFilterDialog::ApplyChFilter()
|
||||
{
|
||||
le_ccq->setText(CorrectSyntax(le_ccq->text(),true));
|
||||
le_contm0->setText(CorrectSyntax(le_contm0->text(),true));
|
||||
le_contm1->setText(CorrectSyntax(le_contm1->text(),true));
|
||||
le_contm2->setText(CorrectSyntax(le_contm2->text(),true));
|
||||
le_contm3->setText(CorrectSyntax(le_contm3->text(),true));
|
||||
le_contm4->setText(CorrectSyntax(le_contm4->text(),false));
|
||||
le_pfx5->setText(CorrectSyntax(le_pfx5->text(),true));
|
||||
le_contm6->setText(CorrectSyntax(le_contm6->text(),false));
|
||||
SetFilter();
|
||||
}
|
||||
void HvFilterDialog::PbSetOnOff()
|
||||
{
|
||||
if (cb_gonoff->isChecked()) cb_gonoff->setChecked(false);
|
||||
else cb_gonoff->setChecked(true);
|
||||
SetFilter(); //ApplyChFilter();
|
||||
}
|
||||
static bool g_ModeIsHiden = true;
|
||||
void HvFilterDialog::CbHidFLBtOnOff(bool f)
|
||||
{
|
||||
if (!f) pb_fltrOnOff->setHidden(true);
|
||||
else if (!g_ModeIsHiden) pb_fltrOnOff->setHidden(false);
|
||||
}
|
||||
void HvFilterDialog::SetHidFLBtOnOff(bool f)
|
||||
{
|
||||
g_ModeIsHiden = f; //qDebug()<<f;
|
||||
if (!cb_usebtflonoff->isChecked()) pb_fltrOnOff->setHidden(true);
|
||||
else pb_fltrOnOff->setHidden(f);
|
||||
}
|
||||
void HvFilterDialog::CBGOnOffChanged(bool)
|
||||
{
|
||||
ApplyChFilter();
|
||||
}
|
||||
void HvFilterDialog::RefreshPbSetOnOff(bool f)
|
||||
{
|
||||
if (cb_gonoff->isChecked())
|
||||
{
|
||||
//pb_fltrOnOff->setText(tr("FL IS ON"));
|
||||
pb_fltrOnOff->setText(tr("FILTERS ON"));
|
||||
if (f)
|
||||
{
|
||||
if (dsty) pb_fltrOnOff->setStyleSheet("QPushButton{background-color :rgb(140, 60, 60);}"); //170, 28, 28
|
||||
else pb_fltrOnOff->setStyleSheet("QPushButton{background-color :rgb(255, 158, 158);}"); //255, 128, 128
|
||||
//if (dsty) pb_fltrOnOff->setStyleSheet("QPushButton{background-color:rgb(155,90,90);}");
|
||||
//else pb_fltrOnOff->setStyleSheet("QPushButton{background-color:rgb(255,190,190);}");
|
||||
}
|
||||
else pb_fltrOnOff->setStyleSheet("QPushButton{background-color :palette(Button);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
//pb_fltrOnOff->setText(tr("FL IS OFF"));
|
||||
pb_fltrOnOff->setText(tr("FILTERS OFF"));
|
||||
pb_fltrOnOff->setStyleSheet("QPushButton{background-color :palette(Button);}");
|
||||
}
|
||||
}
|
||||
void HvFilterDialog::SetDefaultFilter()
|
||||
{
|
||||
for (int i = 0; i < 7; ++i) cb_hacontt[i]->setChecked(false);
|
||||
cb_cq->setChecked(false);
|
||||
cb_cq73->setChecked(false);
|
||||
cb_ccq->setChecked(false);
|
||||
//le_ccq->setText("CQ RU,CQ WW,CQ TEST,CQ FD,RRR,RR73,73");
|
||||
le_ccq->setText("CQ RU,CQ WW,CQ BU,CQ FT,CQ TEST,CQ PDC,CQ FD,RRR,RR73,73");
|
||||
cb_contm0->setChecked(false);
|
||||
le_contm0->setText("IMAGE,/QRP,/P,/R");
|
||||
cb_contm1->setChecked(false);
|
||||
le_contm1->setText("LZ2HV,SP9HWY");
|
||||
cb_contm2->setChecked(false);
|
||||
le_contm2->setText("OZ2M,G8JVM");
|
||||
cb_contm3->setChecked(false);
|
||||
le_contm3->setText("KN,FN,JN,JO");
|
||||
cb_contm4->setChecked(false);
|
||||
le_contm4->setText("Bulgaria,Poland,Denmark,England");
|
||||
cb_pfx5->setChecked(false);
|
||||
le_pfx5->setText("LZ,SP,OZ,G");
|
||||
cb_contm6->setChecked(false);
|
||||
le_contm6->setText("");
|
||||
cb_usefudpdectxt->setChecked(false);
|
||||
cb_gonoff->setChecked(false);
|
||||
cb_hide_b4qso->setChecked(false);
|
||||
cb_usebtflonoff->setChecked(false);
|
||||
|
||||
SetFilter();
|
||||
RefrCountrys();
|
||||
RefrHidCountrys();
|
||||
}
|
||||
QStringList HvFilterDialog::GetLineParms(HvLeWithSpace *le)
|
||||
{
|
||||
QStringList sl;
|
||||
sl.clear();
|
||||
QString txt = le->text();
|
||||
QStringList ltxt = txt.split(",");
|
||||
for (int i = 0; i<ltxt.count(); ++i)
|
||||
{
|
||||
QString stxt = ltxt.at(i);
|
||||
if (!stxt.isEmpty()) sl.append(stxt);
|
||||
}
|
||||
return sl;
|
||||
}
|
||||
void HvFilterDialog::SetFilter()
|
||||
{
|
||||
QStringList lc;
|
||||
QStringList lc0;
|
||||
QStringList lc1;
|
||||
QStringList lc2;
|
||||
QStringList lc3;
|
||||
QStringList lc4;
|
||||
QStringList lc5;
|
||||
bool fh[9];
|
||||
fh[0]=false;
|
||||
fh[1]=false;
|
||||
fh[2]=false;
|
||||
fh[3]=false;
|
||||
fh[4]=false;
|
||||
fh[5]=false;
|
||||
fh[6]=false;
|
||||
fh[7]=false;
|
||||
fh[8]=false;
|
||||
lc.clear();
|
||||
lc0.clear();
|
||||
lc1.clear();
|
||||
lc2.clear();
|
||||
lc3.clear();
|
||||
lc4.clear();
|
||||
lc5.clear();
|
||||
|
||||
if (cb_gonoff->isChecked())
|
||||
{
|
||||
for (int i = 0; i < 7; ++i) fh[i]=cb_hacontt[i]->isChecked();
|
||||
|
||||
fh[7]=cb_usefudpdectxt->isChecked(); //usefudpdectxt
|
||||
fh[8]=cb_hide_b4qso->isChecked();
|
||||
|
||||
if (cb_cq->isChecked()) lc.append("CQ ");
|
||||
if (cb_cq73->isChecked()) lc << "CQ " << " RR73" << " 73";
|
||||
if (cb_ccq->isChecked())
|
||||
{
|
||||
QString txt = le_ccq->text();
|
||||
QStringList ltxt = txt.split(","); //qDebug()<<ltxt<<ltxt.count();
|
||||
for (int i = 0; i<ltxt.count(); ++i)
|
||||
{
|
||||
QString stxt = ltxt.at(i);
|
||||
if (!stxt.isEmpty())
|
||||
{
|
||||
if (stxt=="73" || stxt=="RR73" || stxt=="RRR")
|
||||
lc.append(" "+stxt);
|
||||
else
|
||||
lc.append(stxt+" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cb_contm0->isChecked()) lc0 = GetLineParms(le_contm0);
|
||||
if (cb_contm1->isChecked()) lc1 = GetLineParms(le_contm1);
|
||||
else if (cb_contm2->isChecked()) lc1 = GetLineParms(le_contm2);
|
||||
if (cb_contm3->isChecked()) lc2 = GetLineParms(le_contm3);
|
||||
if (cb_contm4->isChecked()) lc3 = GetLineParms((HvLeWithSpace*)le_contm4);
|
||||
if (cb_pfx5->isChecked()) lc4 = GetLineParms(le_pfx5);
|
||||
if (cb_contm6->isChecked()) lc5 = GetLineParms((HvLeWithSpace*)le_contm6);
|
||||
|
||||
}
|
||||
emit EmitSetFilter(lc,fh,lc0,lc1,lc2,lc3,lc4,lc5);
|
||||
|
||||
bool f = false;
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
if (fh[i])
|
||||
{
|
||||
f = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fh[8] || !lc.isEmpty() || !lc0.isEmpty() || !lc1.isEmpty()|| !lc2.isEmpty()|| !lc3.isEmpty() ||
|
||||
!lc4.isEmpty() || !lc5.isEmpty()) f = true;
|
||||
RefreshPbSetOnOff(f);
|
||||
}
|
||||
void HvFilterDialog::closeEvent(QCloseEvent*)
|
||||
{
|
||||
ApplyChFilter();
|
||||
}
|
||||
void HvFilterDialog::SetSettings_p(QString s, QCheckBox *cb, HvLeWithSpace *le,bool d)
|
||||
{
|
||||
QStringList lts = s.split(",");
|
||||
if (lts.count()>0)
|
||||
{
|
||||
if (lts.at(0)=="1") cb->setChecked(true);
|
||||
int indx = s.indexOf(",");
|
||||
QString str = "";
|
||||
if (indx>-1) str = s.mid(indx, s.count()-indx);
|
||||
le->setText(CorrectSyntax(str,d));
|
||||
}
|
||||
}
|
||||
void HvFilterDialog::SetSettings(QString s)
|
||||
{
|
||||
QStringList lts = s.split("#");
|
||||
if (lts.count()>12)
|
||||
{
|
||||
lts<<"0"; //if old version
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
if (lts.at(i)=="1") cb_hacontt[i]->setChecked(true);
|
||||
}
|
||||
|
||||
if (lts.at(7)=="1") cb_cq->setChecked(true);
|
||||
if (lts.at(8)=="1") cb_cq73->setChecked(true);
|
||||
|
||||
QString str1 = lts.at(9);
|
||||
SetSettings_p(str1,cb_ccq,le_ccq,true);
|
||||
|
||||
if (lts.at(10)=="1") cb_usefudpdectxt->setChecked(true);
|
||||
if (lts.at(11)=="1") cb_gonoff->setChecked(true);
|
||||
if (lts.at(12)=="1") cb_hide_b4qso->setChecked(true);
|
||||
if (lts.at(13)=="1") cb_usebtflonoff->setChecked(true);
|
||||
}
|
||||
SetFilter();
|
||||
RefrCountrys();
|
||||
RefrHidCountrys();
|
||||
}
|
||||
void HvFilterDialog::SetSettings0(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm0,le_contm0,true);
|
||||
}
|
||||
void HvFilterDialog::SetSettings1(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm1,le_contm1,true);
|
||||
}
|
||||
void HvFilterDialog::SetSettings2(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm2,le_contm2,true);
|
||||
}
|
||||
void HvFilterDialog::SetSettings3(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm3,le_contm3,true);
|
||||
}
|
||||
void HvFilterDialog::SetSettings4(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm4,(HvLeWithSpace*)le_contm4,false);
|
||||
}
|
||||
void HvFilterDialog::SetSettings5(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_pfx5,le_pfx5,true);
|
||||
}
|
||||
void HvFilterDialog::SetSettings6(QString s)
|
||||
{
|
||||
SetSettings_p(s,cb_contm6,(HvLeWithSpace*)le_contm6,false);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings_p(QCheckBox *cb, HvLeWithSpace *le,bool d)
|
||||
{
|
||||
QString res;
|
||||
res.append(QString("%1").arg(cb->isChecked())+",");
|
||||
res.append(CorrectSyntax(le->text(),d));
|
||||
if (res.endsWith(",")) res = res.mid(0,res.count()-1);
|
||||
return res.trimmed();
|
||||
}
|
||||
QString HvFilterDialog::GetSettings()
|
||||
{
|
||||
QString res;
|
||||
for (int i = 0; i < 7; ++i) res.append(QString("%1").arg(cb_hacontt[i]->isChecked())+"#");
|
||||
|
||||
res.append(QString("%1").arg(cb_cq->isChecked())+"#");
|
||||
res.append(QString("%1").arg(cb_cq73->isChecked())+"#");
|
||||
|
||||
res.append(GetSettings_p(cb_ccq,le_ccq,true));
|
||||
|
||||
res.append("#");
|
||||
res.append(QString("%1").arg(cb_usefudpdectxt->isChecked()));
|
||||
res.append("#");
|
||||
res.append(QString("%1").arg(cb_gonoff->isChecked()));
|
||||
res.append("#");
|
||||
res.append(QString("%1").arg(cb_hide_b4qso->isChecked()));
|
||||
res.append("#");
|
||||
res.append(QString("%1").arg(cb_usebtflonoff->isChecked()));
|
||||
|
||||
return res.trimmed();
|
||||
}
|
||||
QString HvFilterDialog::GetSettings0()
|
||||
{
|
||||
return GetSettings_p(cb_contm0,le_contm0,true);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings1()
|
||||
{
|
||||
return GetSettings_p(cb_contm1,le_contm1,true);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings2()
|
||||
{
|
||||
return GetSettings_p(cb_contm2,le_contm2,true);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings3()
|
||||
{
|
||||
return GetSettings_p(cb_contm3,le_contm3,true);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings4()
|
||||
{
|
||||
return GetSettings_p(cb_contm4,(HvLeWithSpace*)le_contm4,false);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings5()
|
||||
{
|
||||
return GetSettings_p(cb_pfx5,le_pfx5,true);
|
||||
}
|
||||
QString HvFilterDialog::GetSettings6()
|
||||
{
|
||||
return GetSettings_p(cb_contm6,(HvLeWithSpace*)le_contm6,false);
|
||||
}
|
||||
|
||||
|
||||
|
107
src/HvDecodeList/hvfilterdialog.h
Normal file
@ -0,0 +1,107 @@
|
||||
/* MSHV FilterDialog
|
||||
* Copyright 2020 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef HVFILTERDIALOG_H
|
||||
#define HVFILTERDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include "../HvTxW/hvinle.h"
|
||||
class HvFilterDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvFilterDialog(bool,QWidget * parent);
|
||||
virtual ~HvFilterDialog();
|
||||
void SetFont(QFont);
|
||||
void SetSettings(QString);
|
||||
void SetSettings0(QString);
|
||||
void SetSettings1(QString);
|
||||
void SetSettings2(QString);
|
||||
void SetSettings3(QString);
|
||||
void SetSettings4(QString);
|
||||
void SetSettings5(QString);
|
||||
void SetSettings6(QString);
|
||||
QString GetSettings();
|
||||
QString GetSettings0();
|
||||
QString GetSettings1();
|
||||
QString GetSettings2();
|
||||
QString GetSettings3();
|
||||
QString GetSettings4();
|
||||
QString GetSettings5();
|
||||
QString GetSettings6();
|
||||
void SetCountries(QStringList);
|
||||
QPushButton *pb_fltrOnOff;
|
||||
void SetHidFLBtOnOff(bool);
|
||||
|
||||
signals:
|
||||
void EmitSetFilter(QStringList,bool*,QStringList,QStringList,QStringList,QStringList,
|
||||
QStringList,QStringList);
|
||||
|
||||
public slots:
|
||||
void SetTextMark(bool*,QString);
|
||||
|
||||
private slots:
|
||||
void SetDefaultFilter();
|
||||
void ApplyChFilter();
|
||||
void CBCQChanged(bool);
|
||||
void CBCQ73Changed(bool);
|
||||
void CBCCQChanged(bool);
|
||||
void CBContmChanged1(bool);
|
||||
void CBContmChanged2(bool);
|
||||
void CBGOnOffChanged(bool);
|
||||
void ClrCountrys();
|
||||
void CbCountrysChanged(QString);
|
||||
void CbRemCountrysChanged(QString);
|
||||
void ClrHidCountrys();
|
||||
void CbHidCountrysChanged(QString);
|
||||
void CbHidRemCountrysChanged(QString);
|
||||
void PbSetOnOff();
|
||||
void CbHidFLBtOnOff(bool);
|
||||
|
||||
private:
|
||||
bool dsty;
|
||||
QLabel *ltext;
|
||||
QCheckBox *cb_hacontt[7];
|
||||
QCheckBox *cb_hide_b4qso;
|
||||
QCheckBox *cb_cq;
|
||||
QCheckBox *cb_ccq;
|
||||
QCheckBox *cb_cq73;
|
||||
HvLeWithSpace *le_ccq;
|
||||
QCheckBox *cb_contm0;
|
||||
HvLeWithSpace *le_contm0;
|
||||
QCheckBox *cb_contm1;
|
||||
HvLeWithSpace *le_contm1;
|
||||
QCheckBox *cb_contm2;
|
||||
HvLeWithSpace *le_contm2;
|
||||
QCheckBox *cb_contm3;
|
||||
HvLeWithSpace *le_contm3;
|
||||
QPushButton *b_clr;
|
||||
QCheckBox *cb_contm4;
|
||||
QLineEdit *le_contm4;
|
||||
QComboBox *CbCountrys;
|
||||
QComboBox *CbRemCountrys;
|
||||
QPushButton *b_hidclr;
|
||||
QCheckBox *cb_contm6;
|
||||
QLineEdit *le_contm6;
|
||||
QComboBox *CbHidCountrys;
|
||||
QComboBox *CbHidRemCountrys;
|
||||
QCheckBox *cb_pfx5;
|
||||
HvLeWithSpace *le_pfx5;
|
||||
QCheckBox *cb_gonoff;
|
||||
QCheckBox *cb_usefudpdectxt;
|
||||
QCheckBox *cb_usebtflonoff;
|
||||
void RefrCountrys();
|
||||
void RefrHidCountrys();
|
||||
QStringList GetLineParms(HvLeWithSpace *le);
|
||||
void SetFilter();
|
||||
QString CorrectSyntax(QString,bool);
|
||||
void SetSettings_p(QString s, QCheckBox *cb, HvLeWithSpace *le,bool);
|
||||
QString GetSettings_p(QCheckBox *cb, HvLeWithSpace *le,bool);
|
||||
void RefreshPbSetOnOff(bool);
|
||||
void closeEvent(QCloseEvent*);
|
||||
|
||||
};
|
||||
#endif
|
181
src/HvDecodeList/hvtooltip.cpp
Normal file
@ -0,0 +1,181 @@
|
||||
/* MSHV ToolTipWidget
|
||||
* Copyright 2019 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvtooltip.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QToolTip>
|
||||
//#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QDesktopWidget>
|
||||
//#include <QtGui>
|
||||
|
||||
HvToolTip::HvToolTip(QWidget *w)//
|
||||
:QLabel(w,Qt::ToolTip | Qt::BypassGraphicsProxyWidget),widget(0)
|
||||
//no have shadow -> Qt::ToolTip | Qt::BypassGraphicsProxyWidget | Qt::FramelessWindowHint
|
||||
{
|
||||
tim_is_active = false;
|
||||
setForegroundRole(QPalette::ToolTipText);
|
||||
setBackgroundRole(QPalette::ToolTipBase);
|
||||
setPalette(QToolTip::palette());
|
||||
|
||||
//setAttribute(Qt::FramelessWindowHint);
|
||||
//l_tooltip->setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
|
||||
//setFrameStyle(QFrame::Box);// | QFrame::Sunken StyledPanel
|
||||
//setLineWidth(1);
|
||||
//setFrameShadow(QFrame::Plain);
|
||||
setAlignment(Qt::AlignLeft);
|
||||
qApp->installEventFilter(this);//qApp form All app
|
||||
//l_tooltip->setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
|
||||
//this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
setStyleSheet("QFrame, QLabel {border: 2px solid rgb(10,70,10); border-radius: 0px;"
|
||||
"padding-left: 2px; padding-top: 1px; padding-right: 2px; padding-bottom: 1px;"
|
||||
"color: black; background-color: #ffffe1;}"); //color: black; background-color: #ffffe1; <- for linux
|
||||
|
||||
//setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
|
||||
setHidden(true);
|
||||
tim_stop = new QTimer(this);
|
||||
connect(tim_stop, SIGNAL(timeout()), this, SLOT(Slot_stop()));
|
||||
}
|
||||
HvToolTip::~HvToolTip()
|
||||
{
|
||||
tim_stop->stop();
|
||||
}
|
||||
/*int HvToolTip::getTipScreen(const QPoint &pos, QWidget *w)
|
||||
{
|
||||
//qt5.6.3
|
||||
if (QApplication::desktop()->isVirtualDesktop())
|
||||
return QApplication::desktop()->screenNumber(pos);
|
||||
else
|
||||
return QApplication::desktop()->screenNumber(w);
|
||||
|
||||
// >= qt5.10.0
|
||||
if (QDesktopWidgetPrivate::isVirtualDesktop())
|
||||
return QDesktopWidgetPrivate::screenNumber(pos);
|
||||
else
|
||||
return QDesktopWidgetPrivate::screenNumber(w);
|
||||
}*/
|
||||
#include <QScreen>
|
||||
void HvToolTip::placeTip(const QPoint &pos, QWidget */*w*/)
|
||||
{
|
||||
//qDebug()<<getTipScreen(pos, w);
|
||||
//QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
|
||||
//QRect screen12 = QApplication::desktop()->screenGeometry(10);
|
||||
/*QDesktopWidget dw;
|
||||
QScreen* screen0 = QGuiApplication::screens()[dw.screenNumber(this)];
|
||||
if (!screen0) return;
|
||||
QRect screen = screen0->availableGeometry();*/
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)//2.61
|
||||
QScreen* screen0 = QGuiApplication::screenAt(pos); //or screenAt(this->mapToGlobal({this->width()/2,0}));
|
||||
#else
|
||||
QDesktopWidget dw;
|
||||
QScreen* screen0 = QGuiApplication::screens()[dw.screenNumber(pos)]; //or screenAt(this->mapToGlobal({this->width()/2,0}));
|
||||
#endif
|
||||
if (!screen0) return;
|
||||
QRect screen = screen0->availableGeometry(); //qDebug()<<screen0;
|
||||
|
||||
QPoint p = pos;
|
||||
p += QPoint(2,16
|
||||
/*
|
||||
#ifdef Q_DEAD_CODE_FROM_QT4_WIN
|
||||
21
|
||||
#else
|
||||
16
|
||||
#endif
|
||||
*/
|
||||
);
|
||||
if (p.x() + this->width() > screen.x() + screen.width())
|
||||
p.rx() -= 4 + this->width();
|
||||
if (p.y() + this->height() > screen.y() + screen.height())
|
||||
p.ry() -= 24 + this->height();
|
||||
if (p.y() < screen.y())
|
||||
p.setY(screen.y());
|
||||
if (p.x() + this->width() > screen.x() + screen.width())
|
||||
p.setX(screen.x() + screen.width() - this->width());
|
||||
if (p.x() < screen.x())
|
||||
p.setX(screen.x());
|
||||
if (p.y() + this->height() > screen.y() + screen.height())
|
||||
p.setY(screen.y() + screen.height() - this->height());
|
||||
move(p);
|
||||
}
|
||||
void HvToolTip::showText(QPoint pos,QString s,int time, QWidget *w)
|
||||
{
|
||||
//tim_is_active = false;
|
||||
//setHidden(true); <- not good for linux
|
||||
setText(s);
|
||||
adjustSize();// for linux
|
||||
widget = w;
|
||||
rect = QRect();
|
||||
placeTip(pos,w);
|
||||
//setObjectName(QLatin1String("qtooltip_label"));
|
||||
setHidden(false);
|
||||
//showNormal();
|
||||
tim_stop->start(time);
|
||||
tim_is_active = true;
|
||||
}
|
||||
void HvToolTip::Slot_stop()
|
||||
{
|
||||
tim_stop->stop();
|
||||
setHidden(true);
|
||||
tim_is_active = false;
|
||||
}
|
||||
void HvToolTip::hideTip()
|
||||
{
|
||||
tim_stop->start(300);
|
||||
tim_is_active = false;//qDebug()<<"hideTip"<<rrr; rrr++;
|
||||
}
|
||||
void HvToolTip::hideTipImmediately()
|
||||
{
|
||||
tim_stop->start(30);
|
||||
tim_is_active = false;//qDebug()<<"hideTipImmediately"<<rrr; rrr++;
|
||||
}
|
||||
bool HvToolTip::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
if (!tim_is_active) return false;
|
||||
|
||||
switch (e->type())
|
||||
{
|
||||
case QEvent::Leave:
|
||||
hideTip();
|
||||
break;
|
||||
#if defined (Q_OS_QNX) // On QNX the window activate and focus events are delayed and will appear
|
||||
// after the window is shown.
|
||||
case QEvent::WindowActivate:
|
||||
case QEvent::FocusIn:
|
||||
return false;
|
||||
case QEvent::WindowDeactivate:
|
||||
if (o != this)
|
||||
return false;
|
||||
hideTipImmediately();
|
||||
break;
|
||||
case QEvent::FocusOut:
|
||||
if (reinterpret_cast<QWindow*>(o) != windowHandle())
|
||||
return false;
|
||||
hideTipImmediately();
|
||||
break;
|
||||
#else
|
||||
case QEvent::WindowActivate:
|
||||
case QEvent::WindowDeactivate:
|
||||
case QEvent::FocusIn:
|
||||
case QEvent::FocusOut:
|
||||
#endif
|
||||
case QEvent::Close: // For QTBUG-55523 (QQC) specifically: Hide tooltip when windows are closed
|
||||
case QEvent::MouseButtonPress:
|
||||
//case QEvent::MouseButtonRelease:
|
||||
case QEvent::Wheel:
|
||||
hideTipImmediately();
|
||||
break;
|
||||
case QEvent::MouseButtonDblClick:
|
||||
hideTip();// qDebug()<<"dsfgsfs"<<e->type();
|
||||
break;
|
||||
case QEvent::MouseMove:
|
||||
if (o == widget && !rect.isNull() && !rect.contains(static_cast<QMouseEvent*>(e)->pos()))
|
||||
hideTip();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
39
src/HvDecodeList/hvtooltip.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* MSHV ToolTipWidget
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef HVTOOLTIP_H
|
||||
#define HVTOOLTIP_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
|
||||
class HvToolTip : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HvToolTip(QWidget *w = 0);
|
||||
~HvToolTip();
|
||||
void showText(QPoint,QString,int,QWidget *w = Q_NULLPTR);
|
||||
|
||||
private slots:
|
||||
void Slot_stop();
|
||||
|
||||
private:
|
||||
QWidget *widget;
|
||||
QRect rect;
|
||||
//int getTipScreen(const QPoint &pos, QWidget *w);
|
||||
void placeTip(const QPoint &pos, QWidget *w);
|
||||
void hideTip();
|
||||
void hideTipImmediately();
|
||||
|
||||
protected:
|
||||
bool tim_is_active;
|
||||
QTimer *tim_stop;
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
//void paintEvent(QPaintEvent *);
|
||||
|
||||
};
|
||||
#endif
|
1069
src/HvDecoderMs/decoder6m.cpp
Normal file
788
src/HvDecoderMs/decoderfsk441.cpp
Normal file
@ -0,0 +1,788 @@
|
||||
/* The algorithms, source code, look-and-feel of WSJT-X and related
|
||||
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
|
||||
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
|
||||
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
|
||||
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
|
||||
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
|
||||
* and other members of the WSJT Development Group.
|
||||
*
|
||||
* MSHV FSK Decoder
|
||||
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#include "decoderms.h"
|
||||
|
||||
#define _FSK441_DH_
|
||||
#include "../config_msg_all.h"
|
||||
//#include <QtGui>
|
||||
|
||||
double DecoderMs::max_3double(double a,double b,double c)
|
||||
{
|
||||
double res = a;
|
||||
if (b>res)
|
||||
res=b;
|
||||
if (c>res)
|
||||
res=c;
|
||||
return res;
|
||||
}
|
||||
int DecoderMs::min_3int(int a,int b,int c)
|
||||
{
|
||||
int res = a;
|
||||
if (b<res)
|
||||
res=b;
|
||||
if (c<res)
|
||||
res=c;
|
||||
return res;
|
||||
}
|
||||
double DecoderMs::max_4double(double a,double b,double c,double d)
|
||||
{
|
||||
double res = a;
|
||||
if (b>res)
|
||||
res=b;
|
||||
if (c>res)
|
||||
res=c;
|
||||
if (d>res)
|
||||
res=d;
|
||||
return res;
|
||||
}
|
||||
|
||||
void DecoderMs::detect(double*data,int dat_count_begin,int npts,double f,double*y,int mode)
|
||||
{
|
||||
//! Compute powers at the tone frequencies using 1-sample steps.
|
||||
//int NZ=(int)DEC_SAMPLE_RATE;
|
||||
double complex c[12000];//max=[NZ];
|
||||
double complex csum;
|
||||
|
||||
double dpha=twopi*f/DEC_SAMPLE_RATE;
|
||||
|
||||
int NSPD = NSPD_FOM_MODE(mode);
|
||||
|
||||
for (int i = 0; i<npts; i++)
|
||||
{
|
||||
//do i=1,npts
|
||||
//c[i]=data[i]*cmplx(cos(dpha*i),-sin(dpha*i))
|
||||
c[i]=data[i+dat_count_begin]*(cos(dpha*(double)i)-sin(dpha*(double)i)*I);
|
||||
}
|
||||
|
||||
csum=0.0+0.0*I;
|
||||
for (int i = 0; i<NSPD; i++)
|
||||
csum=csum+c[i];
|
||||
|
||||
//for (int i = 0; i<11025; i++)
|
||||
//y[i]=0.0;
|
||||
//y(1)=real(csum)**2 + aimag(csum)**2
|
||||
y[0]=pomAll.ps_hv(csum);//qDebug()<<"y0"<<y[0];
|
||||
|
||||
//do i=2,npts-(NSPD-1)
|
||||
for (int i = 1; i<npts-(NSPD-1); i++)
|
||||
{ //csum=csum-c(i-1)+c(i+NSPD-1)
|
||||
csum=csum-c[i-1]+c[i+NSPD-1];
|
||||
//y(i)=real(csum)**2 + aimag(csum)**2
|
||||
y[i]=pomAll.ps_hv(csum);
|
||||
//qDebug()<<i<<y[i];
|
||||
}
|
||||
}
|
||||
int DecoderMs::sync(double*y1,double*y2,double*y3,double*y4,int npts,/*double baud,double &bauderr,*/int mode)
|
||||
{
|
||||
//! Input data are in the y# arrays: detected sigs in four tone-channels,
|
||||
//! before decimation by NSPD.
|
||||
int jpk = 0;
|
||||
//int NSPD=25;
|
||||
|
||||
int NSPD = NSPD_FOM_MODE(mode);// to 105
|
||||
|
||||
double zf[110];
|
||||
double tmp1;
|
||||
double tmp2;
|
||||
double complex csum;
|
||||
//int nsum[NSPD+2];
|
||||
double z[65538+10]; //!Ready for FSK110
|
||||
//int beg = 0;
|
||||
|
||||
//c_agn:
|
||||
|
||||
|
||||
for (int i = 0; i<NSPD; i++)
|
||||
{
|
||||
zf[i]=0.0;
|
||||
//nsum[i]=0;
|
||||
}
|
||||
for (int i = 0; i<npts; i++)
|
||||
{//do i=1,npts
|
||||
double a1_a=max_4double(y1[i],y2[i],y3[i],y4[i]); //!Find the largest one
|
||||
double a2_a;
|
||||
|
||||
if (a1_a==y1[i]) //!Now find 2nd largest
|
||||
a2_a=max_3double(y2[i],y3[i],y4[i]);
|
||||
else if (a1_a==y2[i])
|
||||
a2_a=max_3double(y1[i],y3[i],y4[i]);
|
||||
else if (a1_a==y3[i])
|
||||
a2_a=max_3double(y1[i],y2[i],y4[i]);
|
||||
else
|
||||
a2_a=max_3double(y1[i],y2[i],y3[i]);
|
||||
|
||||
z[i]=1.e-6*(a1_a-a2_a); //!Subtract 2nd from 1st
|
||||
//j=fmod(i-1,NSPD)+1;
|
||||
int j=fmod(i,NSPD);
|
||||
zf[j]+=z[i];
|
||||
//nsum[j]=nsum[j]+1;
|
||||
//qDebug()<<"jjjjnpts="<<j;
|
||||
}
|
||||
|
||||
/* QString sss = "";///gen_osd174_[174][87];
|
||||
for (int z= 0; z < NSPD; z++)//decoded=87 cw-174
|
||||
{
|
||||
sss.append(QString("%1").arg((int)zf[z]));
|
||||
sss.append(",");
|
||||
}
|
||||
qDebug()<<"ZF="<<sss;*/
|
||||
|
||||
/*
|
||||
double complex cz[32768+10];
|
||||
int n=log(double(npts))/log(2.0);
|
||||
//double nfft=2**(n+1)
|
||||
int nfft=pow(2,(n+1));
|
||||
//call zero(z(npts+1),nfft-npts)??? npts+1
|
||||
//zero_double_beg_count(z,npts+0,nfft-npts);// towan ne prawi ni6to
|
||||
|
||||
zero_double_beg_end(z,npts,nfft);// v 1.17
|
||||
//qDebug()<<npts+0<<nfft-npts;
|
||||
xfft(cz,z,nfft);
|
||||
//! Now find the apparent baud rate.
|
||||
double df=(double)DEC_SAMPLE_RATE/(double)nfft;
|
||||
double zmax=0.0;
|
||||
int ia=391.0/df; //!Was 341/df 391.0/df;
|
||||
int ib=491.0/df; //!Was 541/df 491.0/df;
|
||||
//double baud=0.0;
|
||||
for (int i = ia; i < ib; i++)
|
||||
{
|
||||
//z(i)=real(cz(i))**2 + aimag(cz(i))**2
|
||||
z[i]=ps_hv(cz[i]);
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (z[i]>zmax)
|
||||
{
|
||||
zmax=z[i];
|
||||
//baud=df*(double)i;
|
||||
}
|
||||
}*/
|
||||
//bauderr=(baud-11025.0/nspd)/df //!Baud rate error, in bins
|
||||
//double bauderr=(baud-DEC_SAMPLE_RATE/(double)NSPD)/df;// !Baud rate error, in bins
|
||||
//double bauderr=baud-441.0;
|
||||
//qDebug()<<"bauderr="<<baud;
|
||||
//if(bauderr>2.0)
|
||||
//goto c222;
|
||||
|
||||
//! Find phase of signal at 441 Hz.
|
||||
csum=0.0+0.0*I; //qDebug()<<ia<<NSPD;
|
||||
for (int j = 0; j<NSPD; j++)
|
||||
{//do j=1,NSPD
|
||||
double pha=(double)(j)*(double)twopi/(double)NSPD; //pha=j*twopi/nspd
|
||||
//csum=csum+zf[j]*cmplx(cos(pha),-sin(pha))
|
||||
csum=csum+zf[j]*(cos(pha)-sin(pha)*I);
|
||||
//qDebug()<<cimag(csum)<<creal(csum);
|
||||
}
|
||||
|
||||
tmp1=cimag(csum);
|
||||
tmp2=creal(csum);
|
||||
double pha=-atan2(tmp1,tmp2);
|
||||
jpk=(int)((double)NSPD*pha/twopi);
|
||||
//jpk=jpk-1;//v1.43 fsk441 change -2 ??? triabva da e -1
|
||||
//qDebug()<<"jpk="<<jpk;
|
||||
|
||||
|
||||
//!The following is nearly equivalent to the above. I don't know which
|
||||
//!(if either) is better.
|
||||
//! zfmax=-1.e30
|
||||
//! do j=1,NSPD
|
||||
//! if(zf(j).gt.zfmax) then
|
||||
//! zfmax=zf(j)
|
||||
//! jpk2=j
|
||||
//! endif
|
||||
//! enddo
|
||||
|
||||
/*double zfmax=-1.e30;
|
||||
jpk = 0;
|
||||
for (int j = 0; j<NSPD; j++)
|
||||
{//do j=1,NSPD
|
||||
if (zf[j]>zfmax)
|
||||
{
|
||||
zfmax=zf[j];
|
||||
jpk=j;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/*sss = "";
|
||||
for (int z= 0; z < NSPD; z++)
|
||||
{
|
||||
sss.append(QString("%1").arg((int)zf[z]));
|
||||
sss.append(",");
|
||||
}
|
||||
qDebug()<<"zf2="<<sss;*/
|
||||
|
||||
|
||||
|
||||
//int s_jpk = (jpk2+jpk)/2;
|
||||
//qDebug()<<"jpk2==="<<jpk2;
|
||||
//qDebug()<<"s_jpk==="<<s_jpk;*/
|
||||
|
||||
//if(jpk.lt.1)
|
||||
if (jpk<0)
|
||||
{
|
||||
//beg+=2100;//NSPD;
|
||||
//qDebug()<<"jpk2="<<jpk<<beg;
|
||||
//goto c_agn;
|
||||
jpk=jpk+NSPD-1;
|
||||
}
|
||||
//qDebug()<<"jpk final===="<<jpk<<npts;
|
||||
|
||||
return jpk;
|
||||
}
|
||||
double DecoderMs::spec441(double*dat,int raw_in_c_begin,int jz,double*s)
|
||||
{
|
||||
//! Computes average spectrum over a range of dat, e.g. for a ping.
|
||||
//! Returns spectral array and frequency of peak value.
|
||||
double f0 = 0.0;
|
||||
const int NFFT=256;//256-1 HV v1.09 df441-315
|
||||
const int NR=NFFT+2;
|
||||
const int NH=NFFT/2;
|
||||
//real*4 x(NR),s(NH)
|
||||
double x[NR+10];
|
||||
//zero_double_beg_count(x,0,NR);
|
||||
|
||||
double complex c[NH*2+10];
|
||||
//zero_double_comp_beg_count(c,0,NH*2);
|
||||
//complex double *c = new complex double[NH*2];
|
||||
///complex c(0:NH)
|
||||
//equivalence (x,c)
|
||||
|
||||
//zero_double(s,NH);
|
||||
pomAll.zero_double_beg_end(s,0,NH);
|
||||
|
||||
int nz=(double)jz/NFFT;
|
||||
for (int n = 0; n<nz; n++)
|
||||
{//do n=1,nz
|
||||
//j=1 + (n-1)*NFFT
|
||||
int j=0+((n)*NFFT)+raw_in_c_begin;
|
||||
//qDebug()<<jz<<j<<NFFT;
|
||||
//call move(dat(j),x,NFFT)
|
||||
move_da_to_da(dat,j,x,0,NFFT);
|
||||
|
||||
//xfft(x,NFFT);
|
||||
xfft(c,x,NFFT);//(NFFT-1) HV v1.09 df441-315
|
||||
//four2a_double_to_complex(c,x,NFFT,1,-1,0);
|
||||
|
||||
for (int i = 0; i<NH; i++)
|
||||
{//do i=1,NH
|
||||
//s(i)=s(i)+real(c(i))**2 + aimag(c(i))**2
|
||||
s[i]+=pomAll.ps_hv(c[i]);
|
||||
}
|
||||
}
|
||||
|
||||
double smax=0.0;
|
||||
double df=(double)DEC_SAMPLE_RATE/(double)(NFFT);
|
||||
double fac=1.0/(100.0*(double)NFFT*nz);
|
||||
|
||||
for (int i = 0; i<NH; i++)
|
||||
{//do i=1,nh
|
||||
s[i]=fac*s[i];
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (s[i]>smax)
|
||||
{
|
||||
smax=s[i];
|
||||
f0=(double)i*df;
|
||||
}
|
||||
}
|
||||
//qDebug()<<"spec441"<<f0;// center frq
|
||||
return f0;
|
||||
}
|
||||
/*double DecoderMs::peakup(double ym,double y0,double yp)
|
||||
{
|
||||
double dx = 0.0;
|
||||
double b=(yp-ym)/2.0;
|
||||
double c=(yp+ym-(2*y0))/2.0;
|
||||
dx=-b/(2.0*c);
|
||||
|
||||
return dx;
|
||||
}*/
|
||||
QString DecoderMs::longx(double*dat,int dat_count_begin,int npts0,double*ps,int DFTol,int &msglen,double /*bauderr*/,int mode)
|
||||
{
|
||||
//! Look for 441-baud modulation, synchronize to it, and decode message.
|
||||
//! Longest allowed data analysis is 1 second.
|
||||
//QString str;
|
||||
QString msg;
|
||||
int NMAX=(int)DEC_SAMPLE_RATE;
|
||||
int NDMAX=NMAX/25;
|
||||
double psmo[20+5]={0.0};
|
||||
double y1[11026];
|
||||
double y2[11026];
|
||||
double y3[11026];
|
||||
double y4[11026];
|
||||
|
||||
double wgt_plus[5];
|
||||
double *wgt = &wgt_plus[2];
|
||||
int dit[441+5];//NDMAX = 441
|
||||
//integer n4(0:2)
|
||||
int n4[3];
|
||||
|
||||
//double dx = 0.0;
|
||||
int jpk = 0;
|
||||
//double baud = 0.0;
|
||||
int jsync = 0;
|
||||
//common/acom/a1,a2,a3,a4
|
||||
|
||||
wgt[-2] = 1.0;
|
||||
wgt[-1] = 4.0;
|
||||
wgt[0] = 6.0;
|
||||
wgt[1] = 4.0;
|
||||
wgt[2] = 1.0;
|
||||
|
||||
//data c/' 123456789.,?/# $ABCD FGHIJKLMNOPQRSTUVWXY 0EZ*!'/
|
||||
//data wgt/1.0,4.0,6.0,4.0,1.0/
|
||||
|
||||
|
||||
int kpk=0; //!Silence compiler warning
|
||||
for (int i = 0; i<NDMAX; i++)
|
||||
dit[i]=0;
|
||||
|
||||
int NSPD = NSPD_FOM_MODE(mode);
|
||||
int LTone = LTONE_FOM_MODE(mode);
|
||||
|
||||
int NBaud=DEC_SAMPLE_RATE/(double)NSPD;
|
||||
int npts=fmin(NMAX,npts0);//qDebug()<<npts<<NMAX<<npts0;
|
||||
|
||||
double df=(double)DEC_SAMPLE_RATE/256.0;
|
||||
double smax=0.0;
|
||||
|
||||
//! Find the frequency offset of this ping.
|
||||
//! NB: this might be improved by including a bandpass correction to ps.
|
||||
//ntol=(10,25,50,100,200,400,600) #List of available tolerances
|
||||
//DFTolerance=200;
|
||||
int ia=(int)((double)(((double)LTone*NBaud)-(double)DFTol)/df);
|
||||
int ib=(int)((double)(((double)LTone*NBaud)+(double)DFTol)/df);
|
||||
//qDebug()<<DFTol;
|
||||
|
||||
for (int i = ia; i<=ib; i++)
|
||||
{ //!Search for correct DF
|
||||
double sum=0.0;
|
||||
//do j=1,4
|
||||
for (int j = 0; j<4; j++)
|
||||
{ //!Sum over the 4 tones
|
||||
//m=(int)((i*df+(j-1)*NBaud)/df);
|
||||
int m=(int)((double)(((double)(i)*df)+(double)((double)(j)*NBaud))/df);
|
||||
//int m=(int)((i*df+(j)*NBaud)/df);
|
||||
//QString ttt;
|
||||
//do k=-2,2
|
||||
for (int k = -2; k<=2; k++)//!Weighted averages over 5 bins
|
||||
{
|
||||
sum+=wgt[k]*ps[m+k];
|
||||
}
|
||||
}
|
||||
//k=i-ia+1
|
||||
int k=i-ia+0;
|
||||
psmo[k]=sum;//qDebug()<<k<<sum;
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//qDebug()<<i*df<<LTone*NBaud<<sum;
|
||||
if (sum>smax)
|
||||
{
|
||||
smax=sum;
|
||||
//noffset=nint(i*df-LTone*NBaud)
|
||||
//qDebug()<<"00000000="<<i*df<<i;
|
||||
noffset_fsk441_dfx=(((double)i*df)-(LTone*NBaud));
|
||||
kpk=k;
|
||||
} //qDebug()<<i<<df<<i*df;
|
||||
}
|
||||
//qDebug()<<"noffset_fsk441_dfx1="<<noffset_fsk441_dfx;
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if(kpk.gt.1 .and. kpk.lt.20) then
|
||||
if (kpk>0 && kpk<19)//ok zaradi psmo[20];
|
||||
{
|
||||
double dx = pomAll.peakup(psmo[kpk-1],psmo[kpk],psmo[kpk+1]);//call peakup(psmo(kpk-1),psmo(kpk),psmo(kpk+1),dx)
|
||||
//qDebug()<<noffset_fsk441_dfx<<dx<<df<<dx*df;
|
||||
noffset_fsk441_dfx=(int)((double)noffset_fsk441_dfx+(double)dx*df);
|
||||
}
|
||||
//qDebug()<<"noffset_fsk441_dfx2="<<noffset_fsk441_dfx;
|
||||
//noffset_fsk441_dfx = 14;
|
||||
//! Do square-law detection in each of four filters.
|
||||
/*int c_pp=-1;
|
||||
c666:
|
||||
noffset_fsk441_dfx++;
|
||||
c_pp++;*/
|
||||
|
||||
double f1=(double)LTone*NBaud+(double)noffset_fsk441_dfx;
|
||||
double f2=(double)(LTone+1)*NBaud+(double)noffset_fsk441_dfx;
|
||||
double f3=(double)(LTone+2)*NBaud+(double)noffset_fsk441_dfx;
|
||||
double f4=(double)(LTone+3)*NBaud+(double)noffset_fsk441_dfx;
|
||||
|
||||
/*qDebug()<<"npts1"<<f1<<f2<<f3<<f4;
|
||||
f1=868;
|
||||
f2=1309;
|
||||
f3=1750;
|
||||
f4=2191;*/
|
||||
/*int ttt = npts/NSPD;
|
||||
npts = ttt*NSPD-NSPD;
|
||||
qDebug()<<"npts2"<<npts;*/
|
||||
|
||||
detect(dat,dat_count_begin,npts,f1,y1,mode);
|
||||
detect(dat,dat_count_begin,npts,f2,y2,mode);
|
||||
detect(dat,dat_count_begin,npts,f3,y3,mode);
|
||||
detect(dat,dat_count_begin,npts,f4,y4,mode);
|
||||
|
||||
//! Bandpass correction:
|
||||
//npts=npts-(NSPD-1)
|
||||
npts=npts-(NSPD - 0);//???? hv
|
||||
//qDebug()<<a1_<<a2_<<a3_<<a4_;
|
||||
for (int i = 0; i<npts; i++)
|
||||
{
|
||||
y1[i]=y1[i]*a1_;
|
||||
y2[i]=y2[i]*a2_;
|
||||
y3[i]=y3[i]*a3_;
|
||||
y4[i]=y4[i]*a4_;
|
||||
//qDebug()<<i;
|
||||
}
|
||||
/*QString sss = "";///gen_osd174_[174][87];
|
||||
for (int z= 0; z < 11025; z++)//decoded=87 cw-174
|
||||
{
|
||||
sss.append(QString("%1").arg((int)y1[z]));
|
||||
sss.append(",");
|
||||
}
|
||||
qDebug()<<"222 mi="<<sss;*/
|
||||
jpk = sync(y1,y2,y3,y4,npts,/*baud,bauderr,*/mode);
|
||||
//jpk=jpk-1;
|
||||
//qDebug()<<jpk;
|
||||
//qDebug()<<bauderr<<noffset_fsk441_dfx;
|
||||
//if(bauderr>1.0 && c_pp<10)
|
||||
//goto c666;
|
||||
|
||||
//! Decimate y arrays by NSPD
|
||||
//ndits=npts/NSPD - 1
|
||||
|
||||
/*int c_pp=-1;
|
||||
jpk = jpk-1;
|
||||
c77:
|
||||
c_pp++;
|
||||
jpk = jpk+1;
|
||||
qDebug()<<"jpk="<<jpk;
|
||||
msg ="";*/
|
||||
//ndits=npts/NSPD - 1
|
||||
int ndits=npts/NSPD;//??? hv
|
||||
for (int i = 0; i<ndits; i++)
|
||||
{//do i=1,ndits
|
||||
/*y1[i]=y1[jpk+(i-1)*NSPD];
|
||||
y2[i]=y2[jpk+(i-1)*NSPD];
|
||||
y3[i]=y3[jpk+(i-1)*NSPD];
|
||||
y4[i]=y4[jpk+(i-1)*NSPD];*/
|
||||
y1[i]=y1[jpk+(i)*NSPD];
|
||||
y2[i]=y2[jpk+(i)*NSPD];
|
||||
y3[i]=y3[jpk+(i)*NSPD];
|
||||
y4[i]=y4[jpk+(i)*NSPD];
|
||||
}
|
||||
|
||||
//! Now find the mod3 phase that has no tone 3's
|
||||
n4[0]=0;
|
||||
n4[1]=0;
|
||||
n4[2]=0;
|
||||
for (int i = 0; i<ndits; i++)
|
||||
{//do i=1,ndits
|
||||
double ymax=max_4double(y1[i],y2[i],y3[i],y4[i]);
|
||||
if (y1[i]==ymax) dit[i]=0;
|
||||
if (y2[i]==ymax) dit[i]=1;
|
||||
if (y3[i]==ymax) dit[i]=2;
|
||||
if (y4[i]==ymax)
|
||||
{
|
||||
dit[i]=3;
|
||||
int k=fmod(i,3);//qDebug()<<k<<i;
|
||||
//n4(k)=n4(k)+1
|
||||
n4[k]=n4[k]+1;
|
||||
//qDebug()<<n4[k]<<k;
|
||||
}
|
||||
}
|
||||
|
||||
int n4min=min_3int(n4[0],n4[1],n4[2]);
|
||||
if (n4min==n4[0]) jsync=3;
|
||||
if (n4min==n4[1]) jsync=1;
|
||||
if (n4min==n4[2]) jsync=2;
|
||||
//qDebug()<<"n4="<<n4[0]<<n4[1]<<n4[2]<<"jsync="<<jsync;
|
||||
//! Might want to notify if n4min>0 or if one of the others is equal
|
||||
//! to n4min. In both cases, could then decode 2 or 3 times, using
|
||||
//! other starting phases.
|
||||
|
||||
//! Finally, decode the message.
|
||||
|
||||
msglen=ndits/3.0;//qDebug()<<msglen;
|
||||
msglen=fmin(msglen,46);//v1.30 46 max char for fsk to list
|
||||
//qDebug()<<msglen;
|
||||
for (int i = 0; i<msglen; i++)
|
||||
{//do i=1,msglen
|
||||
//int j=(i-1)*3+jsync;
|
||||
int j=(i)*3+jsync;
|
||||
int nc=16*dit[j] + 4*dit[j+1] + dit[j+2];
|
||||
//qDebug()<<"j="<<j;
|
||||
//str[i]=' ';
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
msg.append(" ");//1.77
|
||||
if (nc<=47 && nc>=0)//1.77 msg(i:i)=c(nc+1:nc+1)
|
||||
{
|
||||
msg[i]=c_FSK441_RX[nc];//1.77
|
||||
//msg.append(c_FSK441_RX[nc]);
|
||||
//qDebug()<<i<<c_FSK441_RX[nc]<<nc<<msg[i];
|
||||
}
|
||||
}
|
||||
//qDebug()<<"fffffff"<<msg;
|
||||
//return str;
|
||||
|
||||
msg = RemWSpacesInside(msg);
|
||||
msg = RemBegEndWSpaces(msg);
|
||||
//msg = msg.mid(4,msg.count()-6);
|
||||
|
||||
//qDebug()<<"fffffff======================================="<<msg;
|
||||
|
||||
//if(c_pp < 10)// && !msg.contains(" ")
|
||||
//goto c666;
|
||||
|
||||
return msg;
|
||||
}
|
||||
int DecoderMs::abc441(char*msg,int count_msg,short *itone)
|
||||
{
|
||||
int count;// = 3*count_msg;
|
||||
// samo golemi bukwi HV
|
||||
|
||||
|
||||
for (int i = 0; i < count_msg; i++)
|
||||
{
|
||||
int j;
|
||||
j = (int)msg[i];
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (j<0 || j>91)//!Replace illegal char with blank
|
||||
j=32;
|
||||
int n;
|
||||
n = lookup_FSK441_TXRX[j];
|
||||
//qDebug()<<"NNN="<<n<<j<<msg[i];
|
||||
itone[3*(i+1)-3]=n/16 + 1;
|
||||
itone[3*(i+1)-2]=fmod(n/4,4) + 1;
|
||||
itone[3*(i+1)-1]=fmod(n,4) + 1;
|
||||
//qDebug()<<j<<n;
|
||||
}
|
||||
count=3*count_msg;
|
||||
return count;
|
||||
}
|
||||
void DecoderMs::gen441(short *itone,int ndits,double complex *cfrag, int mode)
|
||||
{
|
||||
int nspd = NSPD_FOM_MODE(mode);
|
||||
int LTone = LTONE_FOM_MODE(mode);
|
||||
|
||||
double dt=1.0/DEC_SAMPLE_RATE;
|
||||
int k=0;
|
||||
//int NSPD=25;
|
||||
double df=(double)DEC_SAMPLE_RATE/nspd;
|
||||
double pha=0.0;
|
||||
for (int m = 0; m < ndits; m++)
|
||||
{//do m=1,ndits
|
||||
double freq=(LTone-1+itone[m])*df;
|
||||
double dpha=twopi*freq*dt;
|
||||
for (int i = 0; i < nspd; i++)
|
||||
{//do i=1,NSPD
|
||||
pha=pha+dpha;
|
||||
//cfrag(k)=cmplx(sin(pha),-cos(pha));
|
||||
cfrag[k]=(sin(pha)+(-cos(pha))*I);
|
||||
//cfrag[k]=(sin(pha)*100.0+(-cos(pha)*100.0)*I);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
void DecoderMs::smo(double*x,int x_begin,int npts,double*y,double nadd)
|
||||
{
|
||||
//smo(ccf,-ia,2*ia+1,work,nadd);
|
||||
//int NMAX=512*1024;
|
||||
int nh=nadd/2;
|
||||
for (int i = 1+nh; i < npts-nh; i++)
|
||||
{//do i=1+nh,npts-nh
|
||||
double sum=0.0;
|
||||
for (int j = -nh; j < nh; j++)
|
||||
{//do j=-nh,nh
|
||||
sum=sum + x[i+(j+x_begin)];
|
||||
}
|
||||
y[i]=sum;
|
||||
//qDebug()<<i;
|
||||
}
|
||||
//y(:nh)=0.
|
||||
pomAll.zero_double_beg_end(y,0,nh);
|
||||
//y(npts-nh+1:)=0.
|
||||
//qDebug()<<npts-nh+1<<(npts-(npts-nh+1));
|
||||
//zero_double_beg_count(y,npts-nh+1,(npts - (npts-nh+1)));
|
||||
pomAll.zero_double_beg_end(y,npts-nh+0,npts);// v1.17
|
||||
|
||||
double fac=1.0/nadd;
|
||||
for (int i = 0; i < npts; i++)
|
||||
//do i=1,npts
|
||||
x[i+x_begin]=fac*y[i];
|
||||
//enddo
|
||||
}
|
||||
int DecoderMs::chk441(double *dat,int jz,double tstart,double width,int nfreeze,int mousedf,
|
||||
int dftolerance,bool pick,int mode,double &dfx_real_hv)
|
||||
{
|
||||
//! Experimental FSK441 decoder
|
||||
int nok = 0;
|
||||
int NMAX=512*1024;
|
||||
//int MAXFFT=8192;
|
||||
//qDebug()<<"AAAAA";
|
||||
double complex *cdat = new double complex[NMAX+10]; //!Analytic form of signal
|
||||
|
||||
//double complex *cfrag = new double complex[2100]; //!Complex waveform of message fragment
|
||||
double complex z;
|
||||
//!Generated tones for msg fragment
|
||||
double *s = new double[NMAX+10];
|
||||
|
||||
//double ccf(-6000:6000)
|
||||
double ccf_p[12000];
|
||||
double *ccf = &ccf_p[6000];
|
||||
int nspd = 0;
|
||||
|
||||
//double dfx = 0.0;
|
||||
//common/scratch/work(NMAX)
|
||||
//save
|
||||
|
||||
nspd = NSPD_FOM_MODE(mode);
|
||||
|
||||
if (only1_s_mode!=mode)
|
||||
{
|
||||
//short itone_all[84];
|
||||
gen441(itone_s_fsk,ndits_s,cfrag_s,mode);
|
||||
only1_s_mode=mode;
|
||||
//qDebug()<<"gen441"<<s_mod;
|
||||
}
|
||||
|
||||
double ccf0=3.0;
|
||||
double sb0=0.75;
|
||||
if (pick)
|
||||
{
|
||||
ccf0=2.1;
|
||||
sb0=0.60;
|
||||
//ccf0=2.5;//1.77 my be
|
||||
//sb0=0.73;//1.77 my be
|
||||
}
|
||||
|
||||
//int nsps=25; //!Initialize variables
|
||||
int nsam=nspd*ndits_s;
|
||||
double dt=1.0/DEC_SAMPLE_RATE;
|
||||
//int i0=(tstart-0.02)/dt;
|
||||
int i0=(int)((double)(tstart-0.02)/dt);//start -20ms
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if(i0.lt.1) i0=1
|
||||
if (i0<0) i0=0;
|
||||
//int npts=int((width+0.02)/dt)+1;//HV +0.02 ne decodira pod -150 DF v0.98
|
||||
int npts=(int)(((double)(width+0.06)/dt)+1.0);//HV v0.98 0.06 from 0.02 ina4e ne decodira pod -150 DF
|
||||
npts=fmin(npts,jz+1-i0);
|
||||
npts=fmin(npts,22050); //!Max ping length 2 s
|
||||
|
||||
double xn=log(double(npts))/log(2.0); //qDebug()<<"XN="<<xn; //+1.0 // //npts =1988;
|
||||
int n=(int)xn;
|
||||
if (xn-n >0.001) n++; //qDebug()<<"NNNN="<<n; //n=12;
|
||||
int nfft1=pow(2,n); //qDebug()<<"nfft11111="<<nfft1;
|
||||
|
||||
//no in wsjt v1.34 pod 4096 ne raboti pravilno
|
||||
//qDebug()<<"nfft11111="<<nfft1;
|
||||
nfft1=fmax(nfft1,4096); //hv 2**12=4096
|
||||
//qDebug()<<"nfft12222="<<nfft1;
|
||||
|
||||
double df1=(double)DEC_SAMPLE_RATE/(double)nfft1; //qDebug()<<"df1="<<df1; //df1=2.6;
|
||||
double sbest=0.0;
|
||||
double base = 0.0;
|
||||
double *work = new double[NMAX];
|
||||
//qDebug()<<npts; //nfft1=4908;
|
||||
|
||||
analytic(dat,i0,npts,nfft1,s,cdat); //!Convert to analytic signal
|
||||
//analytic_msk(dat,i0,npts,nfft1,cdat);
|
||||
|
||||
//! call len441(cdat,npts,lenacf,nacf) //!Do ACF to find message length
|
||||
|
||||
int ia=int((double)dftolerance/df1);
|
||||
i0=0;
|
||||
if (nfreeze!=0) i0=int(mousedf/df1);
|
||||
double ccfmax=0.0;
|
||||
for (int i = -ia; i < ia; i++)
|
||||
{
|
||||
//do i=-ia,ia //!Find DF
|
||||
//fsk441 882, 1323, 1764, and 2205 Hz
|
||||
//fsk315 945, 1260, 1575 and 1890 Hz
|
||||
if (mode==2)//fsk441 <- fsk315
|
||||
ccf[i]=s[i0+i+int(882.0/df1)] + s[i0+i+int(1323.0/df1)] + s[i0+i+int(1764.0/df1)] + s[i0+i+int(2205.0/df1)];
|
||||
else
|
||||
ccf[i]=s[i0+i+int(945.0/df1)] + s[i0+i+int(1260.0/df1)] + s[i0+i+int(1575.0/df1)] + s[i0+i+int(1890.0/df1)];
|
||||
}
|
||||
//enddo
|
||||
//ccf(:-ia-1)=0.
|
||||
//qDebug()<<-6000<<(6000+(-ia-1));
|
||||
//zero_double_beg_count(ccf,-6000,(6000+(-ia-1)));
|
||||
pomAll.zero_double_beg_end(ccf,-6000,(-ia-1));// v1.17
|
||||
|
||||
//ccf(ia+1:)=0.
|
||||
//qDebug()<<ia+1<<6000-(ia+1);
|
||||
//zero_double_beg_count(ccf,ia+1,6000-(ia+1));
|
||||
pomAll.zero_double_beg_end(ccf,ia+1,6000);//v1.17
|
||||
//for (int i = -ia-1; i < ia+1+1; i++)
|
||||
//ccf[i]=0.0;
|
||||
|
||||
double nadd=2.0*(int)(5.0/df1)+1.0; //qDebug()<<"nadd="<<nadd; nadd=2;
|
||||
//double nadd=2.0*(5.0/df1)+1.0;
|
||||
//smo(ccf(-ia),2*ia+1,work,nadd) //!Smooth CCF by nadd
|
||||
smo(ccf,-ia,2*ia+1,work,nadd);
|
||||
|
||||
//double dfx = 0.0;
|
||||
int ipk = 0;
|
||||
//qDebug()<<"DD"<<-ia<<ia<<width;
|
||||
for (int i = -ia; i < ia; i++)
|
||||
{//do i=-ia,ia
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. //!Find max of smoothed CCF
|
||||
if (ccf[i]>ccfmax)
|
||||
{
|
||||
ccfmax=ccf[i];
|
||||
ipk=i0+i;
|
||||
dfx_real_hv=(double)ipk*df1;
|
||||
}
|
||||
}
|
||||
|
||||
int ic=fmin((220.0/df1),ia); //!Baseline range +/- 220 Hz
|
||||
//pctile(ccf(ipk-ic),work,2*ic+1,50,base)
|
||||
base = pctile(ccf,ipk-ic,work,2*ic+1,50);
|
||||
if(base==0.0)//no divide by zero
|
||||
base=1.0;
|
||||
ccfmax=ccfmax/base;
|
||||
if (ccfmax<ccf0) goto c800; //!Reject non-FSK441 signals
|
||||
//qDebug()<<"dfx"<<dfx;
|
||||
//! We seem to have an FSK441 ping, and we know DF; now find DT.
|
||||
tweak1(cdat,npts,-dfx_real_hv,cdat); //!Mix to standard frequency
|
||||
//qDebug()<<dfx;
|
||||
//! Look for best match to "frag", find its DT
|
||||
for (int i = 0; i < npts-nsam; i++)
|
||||
{//do i=1,npts-nsam
|
||||
z=0.0;
|
||||
double a=0.0;
|
||||
for (int j = 0; j < nsam; j++)
|
||||
{//do j=1,nsam
|
||||
a += cabs(cdat[j+i-0]);
|
||||
z += cdat[j+i-0]*conj(cfrag_s[j]);//*10
|
||||
}
|
||||
if(a==0.0)//no didvide by zero
|
||||
a=1.0;
|
||||
double ss=cabs(z)/a;
|
||||
if (ss>sbest)
|
||||
{
|
||||
sbest=ss;
|
||||
ipk=i;
|
||||
}
|
||||
}
|
||||
//qDebug()<<"sbest"<<sbest<<sb0;
|
||||
|
||||
if (sbest<sb0)
|
||||
goto c800; //!Skip if not decodable FSK441 data
|
||||
nok=1;
|
||||
|
||||
c800: //continue;
|
||||
//qDebug()<<"nok"<<nok<<dfx;
|
||||
delete [] cdat;
|
||||
delete [] s;
|
||||
delete [] work;
|
||||
return nok;
|
||||
}
|
1702
src/HvDecoderMs/decoderft4.cpp
Normal file
3067
src/HvDecoderMs/decoderft8.cpp
Normal file
863
src/HvDecoderMs/decoderiscat.cpp
Normal file
@ -0,0 +1,863 @@
|
||||
/* The algorithms, source code, look-and-feel of WSJT-X and related
|
||||
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
|
||||
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
|
||||
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
|
||||
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
|
||||
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
|
||||
* and other members of the WSJT Development Group.
|
||||
*
|
||||
* MSHV ISCAT Decoder
|
||||
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#include "decoderms.h"
|
||||
|
||||
#define _ISCAT_DH_
|
||||
#include "../config_msg_all.h"
|
||||
//#include <QtGui>
|
||||
|
||||
int DecoderMs::ana932(double *dat,int npts0,double complex *cdat)
|
||||
{
|
||||
int npts = 0;
|
||||
//double complex cfft[147456];
|
||||
//common/down932/cfft(147456),npts2,df932
|
||||
|
||||
//n=log(float(npts0))/log(2.0)
|
||||
if(npts0==0) npts0=1;
|
||||
int n=log(double(npts0))/log(2.0);
|
||||
//nfft1=2**(n+1)
|
||||
int nfft1=pow(2,(n+1));
|
||||
int nfft2=(double)9.0*nfft1/32.0;//qDebug()<<nfft1<<nfft2;
|
||||
double fac=2.0/nfft1;
|
||||
|
||||
for (int i = 0; i<npts0/2; i++)
|
||||
//cdat[i]=fac*cmplx(dat(2*i-1),dat(2*i))
|
||||
cdat[i]=fac*(dat[2*i] + dat[2*i+1]*I);
|
||||
|
||||
//for (int i = 0; i<nfft1/2; i++)
|
||||
//cdat(npts0/2+1:nfft1/2)=0.0;
|
||||
//cdat[i+npts0/2]=0.0+0.0*I;
|
||||
for (int i = npts0/2; i<nfft1/2; i++)// 1.32
|
||||
//cdat(npts0/2+1:nfft1/2)=0.0;
|
||||
cdat[i]=0.0+0.0*I;
|
||||
|
||||
//qDebug()<<npts0/2<<nfft1/2;
|
||||
//call four2a(cdat,nfft1,1,-1,0)
|
||||
f2a.four2a_d2c(cdat,dat,nfft1,-1,0);//!Forward r2c FFT
|
||||
//call four2a(cdat,nfft2,1,1,1)
|
||||
f2a.four2a_c2c(cdat,nfft2,1,1); //!Inverse c2c FFT
|
||||
npts=(double)npts0*9.0/32.0; //!Downsampled data length
|
||||
//int npts2=npts;
|
||||
return npts;
|
||||
}
|
||||
|
||||
void DecoderMs::synciscat(double complex*cdat,int npts,double s0_[5601][289],int &jsym,int DFTolerance,
|
||||
int mode4,double &xsync,double &sig,int &ndf0,int &msglen,int &ipk,int &jpk,
|
||||
int &idf)
|
||||
/*no used 1.33 int mousebutton,int nafc,double &df1*/
|
||||
{
|
||||
|
||||
//! Synchronize an ISCAT signal
|
||||
//! cdat() is the downsampled analytic signal.
|
||||
//! Sample rate = fsample = BW = DEC_SAMPLE_RATE * (9/32) = 3100.78125 Hz
|
||||
//! npts, nsps, etc., are all reduced by 9/32
|
||||
|
||||
//int NMAX=30*3101;
|
||||
//int NSZ=4*1400;
|
||||
//qDebug()<<"WWWWWWWW";
|
||||
double complex c[289*4+10];
|
||||
double fs0_[96][289]; //!108 = 96 + 3*4
|
||||
|
||||
int icos[4] = {0,1,3,2};
|
||||
|
||||
//qDebug()<<"WWWWWWWW"<<nlen;
|
||||
//! Silence compiler warnings:
|
||||
double sigbest=-20.0;
|
||||
int ndf0best=0;
|
||||
int msglenbest=0;
|
||||
int ipkbest=0;
|
||||
int jpkbest=0;
|
||||
int ipk2=0;
|
||||
//int idfbest=mousebutton;// no use 1.33
|
||||
|
||||
double fsample=3100.78125; //!New sample rate
|
||||
int nsps=144/mode4;
|
||||
//nsym=npts/nsps - 1
|
||||
int nsym=npts/nsps - 0;//qDebug()<<nsym<<npts<<nsps;
|
||||
int nblk=nsync_rx+nlen_rx+ndat_rx;
|
||||
int nfft=2*nsps; //!FFTs at twice the symbol length,
|
||||
|
||||
int kstep=nsps/4; //! stepped by 1/4 symbol
|
||||
double df=(double)fsample/nfft;
|
||||
double fac=1.0/1000.0; //!Somewhat arbitrary
|
||||
|
||||
double sref[289];
|
||||
double tmp[289];
|
||||
int nh = 3;
|
||||
int npct = 40;
|
||||
double savg[289];
|
||||
//zero_double_beg_end(sref,0,289);
|
||||
//zero_double_beg_end(tmp,0,289);
|
||||
|
||||
//savg=0.
|
||||
//for (int i = 0; i<289; i++)
|
||||
pomAll.zero_double_beg_end(savg,0,289);
|
||||
/*for (int i = 0; i<5601; i++)
|
||||
{
|
||||
for (int j = 1; j<289; j++)
|
||||
s0_[i][j]=0.0;
|
||||
}*/
|
||||
|
||||
//qDebug()<<nsps;
|
||||
int ia=0-kstep;//1-kstep po4va ot 1 a pri men ot 0
|
||||
// double hh[289];
|
||||
//double savg[289];
|
||||
|
||||
//qDebug()<<npts<<4*nsym;
|
||||
for (int j = 0; j<4*nsym; j++)
|
||||
{//do j=1,4*nsym
|
||||
//j=0;
|
||||
//double h; //!Compute symbol spectra
|
||||
|
||||
ia+=kstep;
|
||||
//ib=ia+nsps-1
|
||||
int ib=ia+nsps;
|
||||
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (ib>npts) break;
|
||||
//c(1:nsps)=fac*cdat(ia:ib)
|
||||
|
||||
for (int x = 0; x<nsps; x++)
|
||||
c[x]=fac*cdat[x+ia];
|
||||
|
||||
//for (int h = 0; h<nfft; h++)
|
||||
//c(nsps+1:nfft)=0.
|
||||
//c[h+nsps]=0.0+0.0*I;//hv pri 0 po dobre stana
|
||||
for (int h = nsps; h<nfft; h++)// 1.32
|
||||
//c(nsps+1:nfft)=0.
|
||||
c[h]=0.0+0.0*I;
|
||||
|
||||
f2a.four2a_c2c(c,nfft,-1,1);
|
||||
|
||||
/*fftw_plan plan;
|
||||
plan=fftw_plan_dft_1d(nfft,c,c,FFTW_FORWARD,FFTW_ESTIMATE_PATIENT);
|
||||
fftw_execute(plan);
|
||||
fftw_destroy_plan(plan);*/
|
||||
|
||||
//qDebug()<<"pppppp"<<j<<nfft;
|
||||
for (int i = 0; i<nfft; i++)
|
||||
{//do i=1,nfft
|
||||
s0_[j][i]=pomAll.ps_hv(c[i]);//*0.0000000000001;
|
||||
savg[i]+=s0_[j][i];//!Accumulate avg spectrum
|
||||
}
|
||||
}
|
||||
|
||||
jsym=4*nsym; //qDebug()<<savg[0]<<savg[1]<<savg[2]<<savg[3];
|
||||
//qDebug()<<"Sum20savg"<<savg[20];
|
||||
//qDebug()<<"Sum20h"<<hh[20];
|
||||
for (int i = 0; i<289; i++)
|
||||
savg[i]=(double)savg[i]/jsym;
|
||||
|
||||
//qDebug()<<savg[20]<<jsym;
|
||||
|
||||
for (int i = nh; i<nfft-nh; i++) //nfft=288/144 0,1,2
|
||||
{//do i=nh+1,nfft-nh
|
||||
sref[i] = pctile(savg,i-nh,tmp,2*nh+1,npct); //call pctile(savg(i-nh),tmp,2*nh+1,npct,sref(i))
|
||||
}
|
||||
for (int i = 0; i<nh; i++)
|
||||
{
|
||||
sref[i]=sref[nh+10]; //sref(1:nh)=sref(nh+11)
|
||||
sref[(nfft-nh+0)+i]=sref[(nfft-nh-1)]; //sref(nfft-nh+1:nfft)=sref(nfft-nh)
|
||||
}
|
||||
|
||||
for (int i = 0; i<nfft; i++) //nfft=288/144
|
||||
{//do i=1,nfft //!Normalize the symbol spectra
|
||||
//fac=(1.0/savg[i]);//qDebug()<<fac; 1.32
|
||||
fac=(1.0/sref[i]); // 1.32
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if(i.lt.11) fac=1.0/savg(11)
|
||||
if (i<10) fac=1.0/savg[10];
|
||||
for (int j = 0; j<jsym; j++)
|
||||
{//do j=1,jsym
|
||||
s0_[j][i]=fac*s0_[j][i];//*0.001;
|
||||
}
|
||||
}
|
||||
|
||||
/* for (int j = 0; j<jsym; j++) //nfft=288/144
|
||||
{//do i=1,nfft //!Normalize the symbol spectra
|
||||
for (int i = 0; i<nfft; i++)
|
||||
{//do j=1,jsym
|
||||
//fac=(1.0/savg[i]);//qDebug()<<fac; 1.32
|
||||
fac=(1.0/sref[i]); // 1.32
|
||||
//if(i.lt.11) fac=1.0/savg(11)
|
||||
if (i<10) fac=1.0/savg[10];
|
||||
s0_[j][i]=fac*s0_[j][i];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
double nfold=(double)jsym/96.0;//qDebug()<<nfold<<jsym;
|
||||
int jb=96.0*nfold;
|
||||
|
||||
//double ttot=npts/fsample; // no used 1.33 //!Length of record (s)
|
||||
//df1=df/ttot; //!Step size for f1=fdot
|
||||
// no use 1.33
|
||||
//int idf1=-25.0/df1;
|
||||
//int idf2=5.0/df1;
|
||||
//qDebug()<<"IDF"<<idf1<<idf2;
|
||||
//if (nafc==0)
|
||||
//{
|
||||
// idf1=0;
|
||||
// idf2=0;
|
||||
//}
|
||||
//else if (fmod(-idf1,2)==1)
|
||||
// idf1=idf1-1;
|
||||
|
||||
double xsyncbest=0.0;
|
||||
//qDebug()<<"KKKK"<<idf1<<idf2<<df1;
|
||||
/// VAZNO <<<=== HV //////
|
||||
//for (idf = idf1; idf<=idf2; idf++)
|
||||
//{//do idf=idf1,idf2 //!Loop over fdot
|
||||
for (int z = 0; z<96; z++)//288 -> 289 hv podobri se zna4itelno
|
||||
{//fs0[289][96]; fs0_[96][289];
|
||||
for (int x = 0; x<289; x++)
|
||||
fs0_[z][x]=0.0;
|
||||
}
|
||||
//qDebug()<<jb<<4*nblk;
|
||||
for (int j = 0; j<jb; j++)
|
||||
{//do j=1,jb //!Fold s0 into fs0, modulo 4*nblk
|
||||
//k=mod(j-1,4*nblk)+1
|
||||
int k=fmod(j,4*nblk);
|
||||
int ii=int(idf*double(j-jb/2.0)/double(jb));
|
||||
//ia=max(1-ii,1)
|
||||
ia=fmax(0-ii,0);//hv 1-143 posle 1-144 ???????
|
||||
int ib=fmin(nfft-ii,nfft);//qDebug()<<ia<<ib;
|
||||
//qDebug()<<"ia-ib"<<ia<<ib;
|
||||
for (int i = ia; i<=ib; i++)// po dobre <=
|
||||
//do i=ia,ib
|
||||
fs0_[k][i]+=s0_[j][i+ii];
|
||||
//enddo
|
||||
}
|
||||
//qDebug()<<fs0[20][20];
|
||||
double ref=nfold*4.0;
|
||||
|
||||
//i0=27
|
||||
int i0=26;
|
||||
if (mode4==1) i0=94; //if(mode4.eq.1) i0=95
|
||||
ia=i0-(int)((double)DFTolerance/df);
|
||||
int ib=i0+(int)((double)DFTolerance/df);
|
||||
//qDebug()<<ia<<ib<<DFTolerance<<df;
|
||||
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if(ia.lt.1) ia=1
|
||||
if (ia<0) ia=0;//hv
|
||||
//if(ib.gt.nfft-3) ib=nfft-3
|
||||
if (ib>nfft-3) ib=nfft-3;
|
||||
|
||||
double smax=0.0;
|
||||
//ipk=1
|
||||
//jpk=1
|
||||
ipk=0;
|
||||
jpk=0;
|
||||
//qDebug()<<"Boo="<<4*nblk<<ia<<ib;
|
||||
for (int j = 0; j<4*nblk; j++) //4*nblk=96
|
||||
{//do j=0,4*nblk-1
|
||||
//qDebug()<<"ia-ib"<<ia<<ib; //!Find sync pattern: lags 0-95
|
||||
for (int i = ia; i<=ib; i++)
|
||||
{//do i=ia,ib //!Search specified freq range
|
||||
double ss=0.0;
|
||||
//int k;
|
||||
for (int n = 0; n<4; n++)
|
||||
{//do n=1,4
|
||||
//k=j+4*n-3 //!Sum over 4 sync tones
|
||||
int k=j+4*n;
|
||||
//if(k.gt.96) k=k-96
|
||||
if (k>95) k=k-96;
|
||||
//qDebug()<<j<<k;
|
||||
ss=ss + fs0_[k][i+2*icos[n]];
|
||||
}
|
||||
if (ss>smax)
|
||||
{ //qDebug()<<ss<<smax;
|
||||
smax=ss;
|
||||
ipk=i;
|
||||
//jpk=j+1 //!Frequency offset, DF
|
||||
jpk=j;//hv 0 ima efekt //!Time offset, DT
|
||||
//qDebug()<<"fs0_"<<k*i+2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xsync=smax/ref - 1.0;//qDebug()<<smax<<ref<<nfold;
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//qDebug()<<xsync<<sqrt(nfold/26.0);
|
||||
if (nfold<26) xsync=xsync * sqrt(nfold/26.0);
|
||||
xsync=xsync-0.5; //!Empirical
|
||||
|
||||
sig=(pomAll.db(smax/ref - 1.0) -15.0);
|
||||
if (mode4==1) sig=sig-5.0;
|
||||
//if (nsig<-20 || xsync<1.0) nsig=-20; // 1.32
|
||||
//qDebug()<<"ndf0"<<ipk<<i0;
|
||||
ndf0=int(df*(ipk-i0));
|
||||
//if(ndf0>200)
|
||||
//qDebug()<<"ndf0"<<ndf0<<df<<ipk<<i0;
|
||||
|
||||
smax=0.0;
|
||||
int ja=jpk+16-1;//tested hv 1.32 -1
|
||||
if (ja>4*nblk) ja=ja-4*nblk;
|
||||
int jj=jpk+20-1;//tested hv 1.32 -1
|
||||
if (jj>4*nblk) jj=jj-4*nblk;
|
||||
for (int i = ipk; i<=ipk+80; i+=2)//hv v1.01 ipk+60 to ipk+120 -> hv v1.32 ipk+120 to ipk+80 max 40 symbols
|
||||
{//do i=ipk,ipk+60,2 //!Find User's message length
|
||||
double ss=fs0_[ja][i] + fs0_[jj][i+10];
|
||||
if (ss>smax)
|
||||
{
|
||||
smax=ss;
|
||||
ipk2=i;
|
||||
}
|
||||
}
|
||||
|
||||
msglen=(ipk2-ipk)/2;
|
||||
//if (msglen<2 || msglen>40) msglen=3;//hv v1.01 29 to 40 kolkoto e v listata za 1 red max za iskat
|
||||
//if (msglen<2 || msglen>39) continue; //1.32 max 39 symbols
|
||||
if (msglen<2 || msglen>39) goto c22; // 1.33 no need loop
|
||||
|
||||
if (xsync>=xsyncbest)
|
||||
{
|
||||
xsyncbest=xsync;
|
||||
sigbest=sig;
|
||||
ndf0best=ndf0;
|
||||
msglenbest=msglen;
|
||||
ipkbest=ipk;
|
||||
jpkbest=jpk;
|
||||
//idfbest=idf;
|
||||
}
|
||||
//}
|
||||
c22:
|
||||
|
||||
xsync=xsyncbest;
|
||||
sig=sigbest;
|
||||
ndf0=ndf0best;
|
||||
msglen=msglenbest;
|
||||
ipk=ipkbest;
|
||||
jpk=jpkbest;
|
||||
//idf=idfbest;
|
||||
//if (nafc==0) idf=0;
|
||||
|
||||
//qDebug()<<"IDF DF1"<<idf<<df1;
|
||||
}
|
||||
|
||||
void DecoderMs::iscat(double complex*cdat0,int npts0,double t2,bool pick,int MinSigdB,int DFTolerance,int mode4)
|
||||
/*no used 1.33 int mousebutton,int nafc,int nmore*/
|
||||
{
|
||||
//! Decode an ISCAT signal
|
||||
// pick =true;
|
||||
bool f_only_one_color = true;
|
||||
const int NMAX=30*3101;
|
||||
//int NSZ=4*1400;=5600
|
||||
//character cfile6*6 //!File time
|
||||
QString msg;
|
||||
QString msg1;
|
||||
QString msgbig;
|
||||
//char csync;//qDebug()<<"AAAAA";
|
||||
double complex cdat[NMAX];
|
||||
//double complex *cdat=new double complex[NMAX];
|
||||
//double s0_[5601][289];
|
||||
//auto s0_=new double[5601][289];
|
||||
double (*s0_)[289]=new double[5601][289];
|
||||
|
||||
//qDebug()<<"BBBB";
|
||||
//int NSZ=4*1400;=5600
|
||||
//double s0[288][NSZ];
|
||||
//double (*s0)[5601] = new double[289][5601];
|
||||
|
||||
//double fs1(0:41,30)
|
||||
double fs1_[60][42]; //hv v1.01 fs1[42][30] to fs1[42][60]
|
||||
//int icos[4] = {0,1,3,2};
|
||||
bool last = false;
|
||||
|
||||
double fsample=3100.78125; //!Sample rate after 9/32 downsampling
|
||||
int nsps=144/mode4;
|
||||
double bigworst=-1.e30; //!Silence compiler warnings ...
|
||||
double bigxsync=0.0;
|
||||
double bsigbig=-1.e30;
|
||||
int msglenbig=0;
|
||||
int ndf0big=0;
|
||||
int nfdotbig=0;
|
||||
double bigt2=0.0;
|
||||
double bigavg=0.0;
|
||||
double bigtana=0.0;
|
||||
// 1.33 no use
|
||||
//if (nmore==-999) bsigbig=-1.0; //!... to here
|
||||
double worst = 0.0;
|
||||
double avg=1.0;
|
||||
int ndf0=0;
|
||||
int ipk3=0;
|
||||
double tana = 0.0;
|
||||
double isync;
|
||||
int nfdot=0;
|
||||
|
||||
double xsync = 0.0;
|
||||
int msglen = 0;
|
||||
int idf = 0;
|
||||
//double df1 = 0.0; no used 1.33
|
||||
int jsym = 0;
|
||||
int jpk = 0;
|
||||
int ipk = 0;
|
||||
int nsig = 0;
|
||||
int nworst = 0;
|
||||
double sig = 0.0;
|
||||
int navg = 0;
|
||||
QString csync;
|
||||
|
||||
QStringList list_1;
|
||||
bool f_msg_1 = false;
|
||||
QStringList list_2;
|
||||
|
||||
int nsum[60];//integer nsum(30)
|
||||
double dsp_tb = 0.0;
|
||||
double dsp_te = 0.0;
|
||||
|
||||
for (int i = 0; i<5601; i++)
|
||||
{
|
||||
for (int j = 0; j<289; j++)
|
||||
s0_[i][j]=0.0;
|
||||
}
|
||||
|
||||
for (int inf = 1; inf<=6; inf++)//do inf=1,6
|
||||
{ //!Loop over data-segment sizes
|
||||
int nframes=pow(2,inf);//qDebug()<<nframes;
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//qDebug()<<nframes*24*nsps<<npts0;
|
||||
if (nframes*24*nsps>npts0)
|
||||
{
|
||||
nframes=npts0/(24*nsps);
|
||||
last=true; //qDebug()<<"LLLLLLLLLLL";
|
||||
}
|
||||
int npts=nframes*24*nsps;
|
||||
//int move_ib = 0;
|
||||
for (int ia = 0; ia<(npts0-npts); ia+=npts)//npts (nsps*24)
|
||||
{ //do ia=1,npts0-npts,nsps*24 //!Loop over start times stepped by 1 frame
|
||||
//qDebug()<<ia<<npts0-npts;
|
||||
//if(ia==0)
|
||||
//qDebug()<<npts<<nframes<<ia<<last;
|
||||
double sum;
|
||||
int mpk = -1;
|
||||
int k;
|
||||
int n;
|
||||
double nfold;
|
||||
double jb;
|
||||
int nblk;
|
||||
//qDebug()<<ia;
|
||||
//int ib=ia+npts-1;
|
||||
//int ib=ia+npts-0;// da ne propuska stojnost
|
||||
|
||||
//cdat(1:npts)=cdat0(ia:ib)
|
||||
//qDebug()<<"endA="<<ia+npts<<npts0;
|
||||
|
||||
for (int i = 0; i<npts; i++)
|
||||
cdat[i]=cdat0[i+ia];
|
||||
|
||||
//t4 = t2+((double)ia + (double)0.5*npts)/fsample + 0.9;
|
||||
//double t3=((double)ia + (double)0.5*npts)/fsample + 0.9; //old t3=t2+(ia + 0.5*npts)/fsample + 0.9
|
||||
//if (pick) t3=t4;//old t3=t2; //t3=t2+t3
|
||||
|
||||
//double t3=((double)ia + (double)0.5*npts)/fsample + 0.9;
|
||||
|
||||
double t3=((double)ia + (double)0.5*npts)/fsample + 0.9;
|
||||
if (pick) t3=t2+t3;
|
||||
|
||||
//move_ib += npts;
|
||||
//qDebug()<<"t3=============="<<t3;
|
||||
|
||||
//! Compute symbol spectra and establish sync:
|
||||
synciscat(cdat,npts,s0_,jsym,DFTolerance,/**/
|
||||
mode4,xsync,sig,ndf0,msglen,ipk,jpk,idf);/*mousebutton,nafc,idf,df1,*/
|
||||
//qDebug()<<"SyncOut="<<xsync<<nsig<<ndf0<<msglen<<ipk<<jpk<<idf<<df1;
|
||||
nfdot=(int)(idf*0.0);//int(idf*df1);
|
||||
//qDebug()<<"IDF DF1"<<idf<<df1<<msglen<<xsync;
|
||||
|
||||
isync=xsync; //continue;
|
||||
if (msglen==0 || isync<fmax((double)MinSigdB,0))
|
||||
{
|
||||
msglen=0;
|
||||
worst=1.0;
|
||||
avg=1.0;
|
||||
ndf0=0;
|
||||
//qDebug()<<"msglen="<<msglen<<isync<<fmax(MinSigdB,0);
|
||||
//goto c100; //1.32
|
||||
continue; //cycle 1.32
|
||||
}
|
||||
|
||||
ipk3=0; //!Silence compiler warning
|
||||
nblk=nsync_rx+nlen_rx+ndat_rx;
|
||||
|
||||
//if(jpk==0)jpk=1;
|
||||
//qDebug()<<jpk<<nblk;
|
||||
//double t3=((((npts)-ia)/jpk)*nblk + 0 )/fsample + 0.9;//(double)0.5*npts
|
||||
//double t3=((double)ia )/fsample + 0.9;
|
||||
//if (pick) t3=t2+t3;
|
||||
//qDebug()<<t3;
|
||||
|
||||
//qDebug()<<"s="<<nblk<<nsync_rx<<nlen_rx<<ndat_rx;
|
||||
for (int i = 0; i<42; i++)//42 ne pre4i
|
||||
{
|
||||
for (int z = 0; z<60; z++)//hv v1.01 z<30; to z<60;
|
||||
fs1_[z][i] = 0.0;
|
||||
}
|
||||
|
||||
zero_int_beg_end(nsum,0,60);
|
||||
nfold=jsym/96.0;
|
||||
jb=96.0*nfold;
|
||||
k=0;
|
||||
n=0;
|
||||
//qDebug()<<"Booming="<<jpk<<jsym<<ipk;
|
||||
for (int j = jpk; j<=jsym; j+=4)
|
||||
{//do j=jpk,jsym,4 //!Fold information symbols into fs1
|
||||
//k=k+1
|
||||
//km=mod(k-1,nblk)+1
|
||||
double km=fmod(k,nblk);
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if(km.gt.6) then
|
||||
if (km>5)
|
||||
{
|
||||
//n=n+1;
|
||||
//m=mod(n-1,msglen)+1
|
||||
int m=fmod(n,msglen);//qDebug()<<m;
|
||||
int ii=int(idf*double(j-jb/2.0)/double(jb));
|
||||
for (int i = 0; i<42; i++)
|
||||
{//do i=0,41
|
||||
int iii=ii+ipk+2*i;
|
||||
//if(iii.ge.1 .and. iii.le.288)
|
||||
if (iii>=0 && iii<=288)
|
||||
fs1_[m][i]+=s0_[j][iii];
|
||||
}
|
||||
n++;
|
||||
nsum[m]=nsum[m]+1;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
|
||||
for (int m = 0; m<msglen; m++)//fs1_[60][42]; real fs1(0:41,30)
|
||||
{//do m=1,msglen
|
||||
for (int x = 0; x<42; x++)
|
||||
{
|
||||
double div = (double)nsum[m];
|
||||
if(div==0.0)
|
||||
div=1.0;
|
||||
fs1_[m][x]=fs1_[m][x]/div;//fs1(0:41,m)=fs1(0:41,m)/nsum(m)
|
||||
//if(fs1_[m][x]>3)
|
||||
//qDebug()<<"m="<<fs1_[m][x]<<nsum[m];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! Read out the message contents:
|
||||
msg.clear();
|
||||
msg1.clear();
|
||||
|
||||
//mpk=-1;
|
||||
worst=9999.0;
|
||||
sum=0.0;
|
||||
|
||||
//if(msglen>29)msglen=29;
|
||||
|
||||
for (int m = 0; m<msglen; m++)
|
||||
{//do m=1,msglen
|
||||
double smax=0.0;
|
||||
double smax2=0.0;
|
||||
for (int i = 0; i<42; i++)
|
||||
{//do i=0,41
|
||||
if (fs1_[m][i]>smax)
|
||||
{
|
||||
smax=fs1_[m][i];
|
||||
ipk3=i;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i<42; i++)
|
||||
{//do i=0,41
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (fs1_[m][i]>smax2 && i!=ipk3)
|
||||
smax2=fs1_[m][i];
|
||||
}
|
||||
double rr=0.0;
|
||||
if (smax2>0.0)
|
||||
rr=smax/smax2;
|
||||
|
||||
//qDebug()<<"rr="<<rr<<smax<<smax2<<m<<msglen;
|
||||
|
||||
sum += rr;
|
||||
if (rr<worst) worst=rr;
|
||||
//if(ipk3.eq.40) mpk=m
|
||||
if (ipk3==40)
|
||||
mpk=m;
|
||||
msg1.append(c_ISCAT_RX[ipk3]);
|
||||
//qDebug()<<"RR Worst="<<m<<rr<<worst;
|
||||
}
|
||||
//qDebug()<<"Booming="<<mpk;
|
||||
//qDebug()<<"MSG1="<<msg1;
|
||||
avg=sum/msglen;
|
||||
//qDebug()<<"avg================"<<avg<<sum<<msglen;
|
||||
//if(mpk.eq.1) then
|
||||
//if (mpk==0)
|
||||
//msg=msg1(2:)
|
||||
//copy_c2c(msg,0,msg1,1,29);
|
||||
// msg.append(msg1.mid(1,msg1.count()));
|
||||
if (mpk!=-1 && mpk<msglen)
|
||||
//msg=msg1(mpk+1:msglen)//msg1(1:mpk-1)
|
||||
//copy_c2c(msg,0,msg1,mpk+1,msglen);// hv +1 reze @ otpred
|
||||
{
|
||||
//qDebug()<<"1="<<msg1;
|
||||
msg.append(msg1.midRef(mpk+1,(msg1.count()-(mpk+1))));
|
||||
msg.append(msg1.midRef(0,mpk-0));
|
||||
//qDebug()<<"2="<<msg;
|
||||
}
|
||||
else
|
||||
//msg=msg1(1:msglen-1)
|
||||
//copy_c2c(msg,0,msg1,0,msglen-0);
|
||||
msg.append(msg1);
|
||||
|
||||
//qDebug()<<"MSG="<<msg;
|
||||
|
||||
if (worst>bigworst)
|
||||
{ //qDebug()<<"WorstOut="<<worst;
|
||||
bigworst=worst;
|
||||
bigavg=avg;
|
||||
bigxsync=xsync;
|
||||
bsigbig=sig;
|
||||
ndf0big=ndf0;
|
||||
nfdotbig=nfdot;
|
||||
msgbig=msg;
|
||||
//copy_c2c(msgbig,0,msg,0,29);
|
||||
msglenbig=msglen;
|
||||
//qDebug()<<"IDF0"<<ndf0<<msg<<t3;
|
||||
//qDebug()<<jpk<<ipk<<ia<<npts<<t3<<jpk;
|
||||
//if(ia==0)
|
||||
//bigt2 = 0.0;
|
||||
//else
|
||||
//qDebug()<<"IA="<<ia<<inf<<t3;
|
||||
//if(ia!=0 || inf<5)
|
||||
bigt2 = t3;
|
||||
|
||||
bigtana=nframes*24.0*nsps/fsample;
|
||||
dsp_tb = (double)ia/fsample;
|
||||
dsp_te = (double)(ia+npts)/fsample;
|
||||
//qDebug()<<"T="<<t3<<dsp_tb<<dsp_te;
|
||||
// tana=nframes*24*nsps/fsample;
|
||||
//if (bigworst>2.0) goto c110;
|
||||
//if (bigworst>2.0) break;
|
||||
}
|
||||
|
||||
//! if(minsigdb.le.0 .and. worst.gt.1.1) then
|
||||
//qDebug()<<avg<< xsync<<msg;
|
||||
isync = xsync; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
//if (navg>0 && isync>=fmax(MinSigdB,0))
|
||||
//if(avg.gt.2.5 .and. xsync.ge.max(float(minsync),1.5) .and. maxlines.ge.2)
|
||||
if (avg>2.5 && xsync>=fmax(double(MinSigdB),1.5) && bigworst>2.0) //v1.33 && bigworst>2.0
|
||||
{
|
||||
//qDebug()<<"avg="<<avg<<xsync<<worst;
|
||||
nsig=(int)sig;
|
||||
nworst=10.0*(worst-1.0);
|
||||
navg=10.0*(avg-1.0);
|
||||
if (nworst>10) nworst=10;
|
||||
if (navg>10) navg=10;
|
||||
tana=nframes*24.0*nsps/fsample;
|
||||
//qDebug()<<"tana="<<tana<<nframes<<nsps<<fsample;
|
||||
csync=" ";
|
||||
if (isync>=1) csync="* ";
|
||||
//if(nlines<=maxlines-1) nlines = nlines + 1 //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (!msg.isEmpty() && !f_msg_1) //1.33 && !f_msg_1
|
||||
{
|
||||
list_1.clear();//samo poslednoto
|
||||
list_1 <<s_time<<QString("%1").arg((int)isync)<<QString("%1").arg(nsig)<<
|
||||
QString("%1").arg(t2,0,'f',1)<<QString("%1").arg(ndf0)<<QString("%1").arg(nfdot)
|
||||
<<msg<<csync+QString("%1").arg(msglen)<<QString("%1").arg(nworst)
|
||||
<<QString("%1").arg(navg)<<QString("%1").arg(tana,0,'f',1);
|
||||
//t4 = t2;
|
||||
f_msg_1=true;
|
||||
//qDebug()<<avg<<xsync<<bigworst<<list_accumulate;
|
||||
}
|
||||
//if(isync>=10) goto c110;
|
||||
}
|
||||
//c100: continue; //1.32
|
||||
//continue; //1.32
|
||||
}
|
||||
if (last) break;
|
||||
//if (last) goto c110;
|
||||
//c100: continue;
|
||||
}
|
||||
//c110: //continue;
|
||||
|
||||
worst=bigworst;
|
||||
avg=bigavg;
|
||||
xsync=bigxsync;
|
||||
sig=bsigbig;
|
||||
ndf0=ndf0big;
|
||||
nfdot=nfdotbig;
|
||||
msg=msgbig;
|
||||
msglen=msglenbig; //qDebug()<<"t2="<<t2<<bigt2;
|
||||
t2=bigt2;
|
||||
tana=bigtana;
|
||||
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
isync=xsync;
|
||||
nworst=10.0*(worst-1.0);
|
||||
navg=10.0*(avg-1.0);
|
||||
if (nworst>10) nworst=10;
|
||||
if (navg>10) navg=10;
|
||||
|
||||
if (navg<=0 || isync<fmax(MinSigdB,0))
|
||||
{
|
||||
//for (int i = 0; i<29; i++)
|
||||
//msg[i]=' ';
|
||||
msg.clear();
|
||||
nworst=0;
|
||||
navg=0;
|
||||
ndf0=0;
|
||||
nfdot=0;
|
||||
sig=-20.0;
|
||||
msglen=0;
|
||||
tana=0.0;
|
||||
t2=0.0;
|
||||
}
|
||||
|
||||
//if(isync.ge.1)
|
||||
if (isync>=1)
|
||||
csync="* ";
|
||||
|
||||
nsig=(int)sig;
|
||||
|
||||
|
||||
bool f_msg_2=true;
|
||||
int nf1=-DFTolerance;
|
||||
int nf2=DFTolerance;
|
||||
if ((ndf0<nf1 || ndf0>nf2 || msg.isEmpty()))//hv pazi ot msg-> 000 i prazno
|
||||
f_msg_2 = false;
|
||||
else
|
||||
{
|
||||
list_2.clear();
|
||||
list_2 <<s_time<<QString("%1").arg((int)isync)<<QString("%1").arg(nsig)<<
|
||||
QString("%1").arg(t2,0,'f',1)<<QString("%1").arg(ndf0)<<QString("%1").arg(nfdot)
|
||||
<<msg<<csync+QString("%1").arg(msglen)<<QString("%1").arg(nworst)
|
||||
<<QString("%1").arg(navg)<<QString("%1").arg(tana,0,'f',1);
|
||||
}
|
||||
|
||||
|
||||
if (f_msg_1 || f_msg_2)
|
||||
{
|
||||
if (f_only_one_color)
|
||||
{
|
||||
f_only_one_color = false;
|
||||
SetBackColor();
|
||||
}
|
||||
|
||||
if (f_msg_1)
|
||||
emit EmitDecodetText(list_1,s_fopen,true);
|
||||
if (f_msg_2)
|
||||
{
|
||||
emit EmitDecodetText(list_2,s_fopen,true);//1.27 psk rep fopen bool true false no file open
|
||||
|
||||
if (s_mousebutton == 0) // && t2!=0.0 1.32 ia is no real 0.0 mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
{
|
||||
emit EmitDecLinesPosToDisplay(1,dsp_tb,dsp_tb,s_time);
|
||||
emit EmitDecLinesPosToDisplay(2,dsp_te,dsp_te,s_time);
|
||||
}
|
||||
}
|
||||
|
||||
/*if (t2>t4)
|
||||
{
|
||||
//int c_ = 1;
|
||||
if (f_msg4)
|
||||
{
|
||||
emit EmitDecodetText(list_4,s_fopen);
|
||||
//if (s_mousebutton == 0) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
//emit EmitDecLinesPosToDisplay(c_,t4,t4,s_time);
|
||||
//c_++;
|
||||
}
|
||||
if (f_msg2)
|
||||
{
|
||||
emit EmitDecodetText(list_2,s_fopen);//1.27 psk rep fopen bool true false no file open
|
||||
|
||||
if (s_mousebutton == 0) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
emit EmitDecLinesPosToDisplay(1,t2,t2,s_time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//int c_ = 1;
|
||||
if (f_msg2)
|
||||
{
|
||||
emit EmitDecodetText(list_2,s_fopen);//1.27 psk rep fopen bool true false no file open
|
||||
|
||||
if (s_mousebutton == 0) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
emit EmitDecLinesPosToDisplay(1,t2,t2,s_time);
|
||||
//c_++;
|
||||
}
|
||||
if (f_msg4)
|
||||
{
|
||||
emit EmitDecodetText(list_4,s_fopen);
|
||||
//if (s_mousebutton == 0) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
//emit EmitDecLinesPosToDisplay(c_,t4,t4,s_time);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/* niama smisal decodira vinagi samo vednaz 1.32
|
||||
if (s_mousebutton == 0 && disp_lines_dec_cou < MAX_DISP_DEC_COU) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
{
|
||||
disp_lines_dec_cou++;
|
||||
emit EmitDecLinesPosToDisplay(disp_lines_dec_cou,t2,t2,s_time);
|
||||
}
|
||||
*/
|
||||
//qDebug()<<"DeLETEs0";
|
||||
delete [] s0_;
|
||||
}
|
||||
|
||||
void DecoderMs::wsjt1_iscat(double *dat,int dat_count,int mode4,bool pick)
|
||||
{
|
||||
int jz = dat_count;
|
||||
double t2=0.0;
|
||||
int npts = 0;
|
||||
//double complex *cdat = new double complex[262145];
|
||||
double complex *cdat = new double complex[262145*2+10];
|
||||
int DFTolerance = G_DfTolerance; //!Defines DF search range
|
||||
int MinSigdB = G_MinSigdB;
|
||||
//int NFreeze = 0;
|
||||
//int MouseDF = 0;
|
||||
//int mousebutton = 0;//1.33 no used
|
||||
//int nafc = 0; //1.33 no used integer nafc !Is AFC checked?
|
||||
//int ndebug = 0; //1.33 no used integer ndebug !Write debugging info? GUI
|
||||
//double psavg[450];
|
||||
//bool pick = false;
|
||||
//int istart =s_istart;
|
||||
|
||||
//if (pick) t2=((double)s_istart+(double)0.5*jz)/DEC_SAMPLE_RATE + 0.5; //!### +0.5 is empirical
|
||||
if (pick) t2=((double)s_in_istart)/DEC_SAMPLE_RATE;
|
||||
|
||||
//for (int i = 0; i < jz; i++)
|
||||
//dat[i]=dat[i]*0.01;
|
||||
|
||||
jz=fmin(jz,30.0*DEC_SAMPLE_RATE);//qDebug()<<jz;
|
||||
//jz=330750;
|
||||
//qDebug()<<"npts";
|
||||
//qDebug()<<dat[0]<<dat[4000]<<dat[40002]<<dat[40004]<<jz;
|
||||
npts = ana932(dat,jz,cdat); //!Make downsampled analytic signal
|
||||
//for (int m = 0; m<jz; m++)
|
||||
//npts = 93030;
|
||||
|
||||
//qDebug()<<npts<<creal(cdat[npts-2])<<creal(cdat[npts/2]);
|
||||
//! write(74) npts,cfile6,(cdat(j),j=1,npts)
|
||||
|
||||
//! Now cdat() is the downsampled analytic signal.
|
||||
//! New sample rate = fsample = BW = DEC_SAMPLE_RATE * (9/32) = 3100.78125 Hz
|
||||
//! NB: npts, nsps, etc., are all reduced by 9/32
|
||||
//qDebug()<<"CCCCC";
|
||||
|
||||
iscat(cdat,npts,t2,pick,MinSigdB,DFTolerance,mode4);/* no used 1.33 mousebutton,nafc,ndebug*/
|
||||
//psavg(65:)=0.0;
|
||||
//go to 800;
|
||||
|
||||
//qDebug()<<"DeLETE Cdat";
|
||||
delete [] cdat;//delete [] cdat;
|
||||
}
|
||||
|
5041
src/HvDecoderMs/decoderjt65.cpp
Normal file
665
src/HvDecoderMs/decoderjtms.cpp
Normal file
@ -0,0 +1,665 @@
|
||||
/* The algorithms, source code, look-and-feel of WSJT-X and related
|
||||
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
|
||||
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
|
||||
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
|
||||
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
|
||||
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
|
||||
* and other members of the WSJT Development Group.
|
||||
*
|
||||
* MSHV Decoder
|
||||
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#include "decoderms.h"
|
||||
|
||||
#define _JTMS_DH_
|
||||
#include "../config_msg_all.h"
|
||||
//#include <QtGui>
|
||||
|
||||
void DecoderMs::setupms()
|
||||
{
|
||||
int nb[7];
|
||||
int nsps=8;
|
||||
//double twopi=8*atan(1.0);
|
||||
double dt=1.0/DEC_SAMPLE_RATE; // !Sample interval
|
||||
double f0=1155.46875;
|
||||
double f1=1844.53125;
|
||||
double dphi0=twopi*dt*f0;
|
||||
double dphi1=twopi*dt*f1;
|
||||
|
||||
for (int i = 0; i<64; i++)//63 hv???
|
||||
{
|
||||
int k=0;
|
||||
int m=0;
|
||||
for (int n = 5; n>=0; n--)
|
||||
{ //!Each character gets 6+1 bits
|
||||
nb[k]=1 & (i >> n);
|
||||
m=m+nb[k];
|
||||
k++;
|
||||
}
|
||||
|
||||
nb[k]=m & 1; //!Insert parity bit
|
||||
k++;
|
||||
double phi=0.0;
|
||||
int j=0;
|
||||
for (int x = 0; x<7; x++)//2.12
|
||||
{
|
||||
double dphi; //!Generate the waveform
|
||||
if (nb[x]==0)
|
||||
dphi=dphi0;
|
||||
else
|
||||
dphi=dphi1;
|
||||
for (int ii = 0; ii<nsps; ii++)
|
||||
{
|
||||
//j=j+1;
|
||||
phi=phi+dphi;
|
||||
//cw(j,i)=cmplx(cos(phi),sin(phi));
|
||||
cw_jtms_[i][j]=cos(phi)+sin(phi)*I;
|
||||
j++;
|
||||
//qDebug()<<j;
|
||||
}
|
||||
//qDebug()<<j;
|
||||
}
|
||||
}
|
||||
|
||||
//cwb=cw(1:56,57);
|
||||
for (int z = 0; z<56; z++)
|
||||
{
|
||||
cwb_jtms[z]=cw_jtms_[57][z];// pod 57 ne priema
|
||||
// qDebug()<<creal(cwb[z]);
|
||||
}
|
||||
/* for (int z = 0; z<56; z++)
|
||||
{
|
||||
//double complex sum;
|
||||
for (int p = 0; p<56; p++)
|
||||
{
|
||||
cwb[z] = cwb[z] + cw[z][p];
|
||||
}
|
||||
//cwb[z]=sum;
|
||||
}*/
|
||||
}
|
||||
|
||||
double DecoderMs::dot_product_da_da(double *a, double *b,int size,int offset_b)
|
||||
{
|
||||
double sum = 0;
|
||||
int i;
|
||||
//If the vectors are INTEGER or REAL -> DOT_PRODUCT(VECTOR_A, VECTOR_B) = SUM(VECTOR_A*VECTOR_B)
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
sum += a[i] * b[i+offset_b];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void DecoderMs::hipass(double*y,int y_begin,int npts,int nwidth)
|
||||
{
|
||||
//! Hipass filter for time-domain data. Removes an RC-type running
|
||||
//! mean (time constant nwidth) from array y(1:npts).
|
||||
if(nwidth<1)
|
||||
return;
|
||||
|
||||
double c1=1.0/nwidth;
|
||||
double c2=1.0-c1;
|
||||
double s=0.0;
|
||||
|
||||
for (int i = 0; i<nwidth; i++) // !Get initial average
|
||||
s=s+y[i+y_begin];
|
||||
|
||||
double ave=c1*s;
|
||||
|
||||
for (int i = 0; i<npts; i++)
|
||||
{ ///!Do the filtering
|
||||
double y0=y[i+y_begin];
|
||||
y[i+y_begin]=y0-ave; //!Remove the mean
|
||||
ave=c1*y0 + c2*ave; //!Update the mean
|
||||
//qDebug()<<i+y_begin;//1623max
|
||||
}
|
||||
}
|
||||
|
||||
double DecoderMs::msdf(double complex *cdat,int npts,int t2,int nfft1,double f0,int nfreeze,int mousedf,
|
||||
int dftolerance)
|
||||
{
|
||||
double snrsq2;
|
||||
const int NZ=32768;//32768;
|
||||
//double *sq = new double[NZ];
|
||||
double sq[NZ];
|
||||
|
||||
//real ccf(-2600:2600)//5200 //!Correct limits?
|
||||
double ccf_plus[6404];//7201
|
||||
double *ccf = &ccf_plus[3202];//ot -2600 to 2600//pri 2s max limits is +-3200 hv +2 rezerv
|
||||
|
||||
double tmp[NZ];
|
||||
double complex *c = new double complex[NZ*2+10];
|
||||
//data nsps/8/
|
||||
int nsps = 8;
|
||||
double base;
|
||||
|
||||
double df1=DEC_SAMPLE_RATE/nfft1;
|
||||
int nh=nfft1/2;
|
||||
double fac=1.0/(nfft1*nfft1);
|
||||
|
||||
for (int i = 0; i<npts; i++)
|
||||
c[i]=fac*(cdat[i]*cdat[i]);
|
||||
//qDebug()<<npts<<nfft1;
|
||||
|
||||
for (int i = npts; i<nfft1; i++)
|
||||
{//c(npts+1:nfft1)=0.
|
||||
//qDebug()<<i;
|
||||
c[i]=0.0+0.0*I;
|
||||
}
|
||||
|
||||
f2a.four2a_c2c(c,nfft1,-1,1);
|
||||
|
||||
//! In the "doubled-frequencies" spectrum of squared cdat:
|
||||
double fa=2.0*(f0-400.0);
|
||||
double fb=2.0*(f0+400.0);
|
||||
int j0=(int)(2.0*f0/df1);
|
||||
int ja=(int)(fa/df1);
|
||||
int jb=(int)(fb/df1);
|
||||
int jd=(int)(nfft1/nsps);
|
||||
//qDebug()<<"0strlen(msg)"<<ja<<jb<<j0;
|
||||
|
||||
for (int j = 0; j<nh+0; j++)
|
||||
//do j=1,nh+1
|
||||
//sq[j]=(creal(c[j])*creal(c[j])) + (cimag(c[j])*cimag(c[j]));
|
||||
sq[j]=pomAll.ps_hv(c[j]);
|
||||
|
||||
//for (int j =-3201; j<3201; j++)
|
||||
//{
|
||||
//qDebug()<<j;
|
||||
//ccf[j]=0.0;
|
||||
//}
|
||||
//zero_double_beg_count(ccf,-3202,6404); ccf=0.
|
||||
pomAll.zero_double_beg_end(ccf,-3202,3202);//v 1.17
|
||||
|
||||
//qDebug()<<"1strlen(msg)"<<ja-j0-0<<jb-j0-0<<nh+0;
|
||||
//qDebug()<<"sq="<<ja<<ja+jd;
|
||||
for (int j = ja; j<jb; j++)
|
||||
//ccf[j-j0-1]=sq[j]+sq[j+jd];
|
||||
ccf[j-j0-0]=sq[j]+sq[j+jd];
|
||||
|
||||
//qDebug()<<"2strlen(msg)"<<ja-j0-0<<jb-ja+0;
|
||||
//qDebug()<<"tmp="<<0<<jb-ja+0;
|
||||
//call pctile(ccf(ja-j0-1),tmp,jb-ja+1,50,base)
|
||||
base = pctile(ccf,(ja-j0-0),tmp,jb-ja+0,50.0);//hv????
|
||||
if(base==0.0)
|
||||
base=1.0;
|
||||
for (int j =-3201; j<3201; j++)
|
||||
ccf[j]=ccf[j]/base;
|
||||
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (nfreeze>0)
|
||||
{
|
||||
fa=2.0*(f0+mousedf-dftolerance);
|
||||
fb=2.0*(f0+mousedf+dftolerance);
|
||||
}
|
||||
ja=(int)(fa/df1);
|
||||
jb=(int)(fb/df1);
|
||||
|
||||
double smax=0.0;
|
||||
int jpk=t2; //!Silence compiler warning
|
||||
|
||||
for (int j = ja; j<jb; j++)
|
||||
{
|
||||
//k=j-j0-1
|
||||
int k=j-j0-0;
|
||||
if (ccf[k]>smax)
|
||||
{
|
||||
smax=ccf[k];
|
||||
jpk=j;
|
||||
}
|
||||
}
|
||||
//fpk=(jpk-1)*df1
|
||||
double fpk=(jpk-0)*df1;
|
||||
jtms_dfx=0.5*fpk-f0;
|
||||
snrsq2=smax;
|
||||
|
||||
//qDebug()<<snrsq2<<"msdf";
|
||||
//qDebug()<<dfx<<"1";
|
||||
delete [] c;
|
||||
return snrsq2;
|
||||
}
|
||||
|
||||
int DecoderMs::syncms(double complex *cdat,int npts,double complex *cwb,double *r)
|
||||
{
|
||||
double tmp[60000];
|
||||
int hist[56];
|
||||
// const int N = sizeof(hist) / sizeof(int);
|
||||
// vector <int> hist;
|
||||
// int hmax[1];
|
||||
//double complex z;
|
||||
double rlim;
|
||||
|
||||
|
||||
//r=0.0;
|
||||
// qDebug()<<npts<<npts;
|
||||
int jz=npts-55;
|
||||
for (int j = 0; j<jz; j++)
|
||||
{
|
||||
double complex z=0.0+0.0*I;
|
||||
double ss=0.0;
|
||||
for (int i = 0; i<56; i++)
|
||||
{
|
||||
//ss=ss + cabs(cdat[i+j-1]); // !Total power
|
||||
//z=z + cdat[i+j-1]*conjg(cwb[i]); //!Signal matching <space>
|
||||
ss=ss + cabs(cdat[i+j]); // !Total power
|
||||
z=z + cdat[i+j]*conj(cwb[i]); //!Signal matching <space>
|
||||
}
|
||||
if(ss==0.0)
|
||||
ss=1.0;
|
||||
r[j]=cabs(z)/ss; //!Goodness-of-fit to <space>
|
||||
}
|
||||
|
||||
double ncut=99.0*double(jz-10)/double(jz);
|
||||
rlim = pctile(r,0,tmp,jz,ncut);
|
||||
//qDebug()<<(int)((jz-10)*0.01*ncut);
|
||||
|
||||
for (int j = 0; j<56; j++)
|
||||
hist[j]=0;
|
||||
|
||||
for (int j = 0; j<jz; j++)
|
||||
{
|
||||
//int k=fmod(j-1,56)+1;
|
||||
//if (r[j]>rlim) hist[k]=hist[k]+1;
|
||||
int k=(int)fmod(j,56);
|
||||
if (r[j]>rlim) hist[k]=hist[k]+1;
|
||||
}
|
||||
//hmax=maxloc(hist);
|
||||
//hmax=max(hist);
|
||||
//i1=hmax(1)
|
||||
//int max;
|
||||
int pos = 0;
|
||||
int s_max = -300000;
|
||||
for (int x = 0; x<56; x++)
|
||||
{
|
||||
int max=hist[x];
|
||||
//qDebug()<<max;
|
||||
if (s_max < max)// i = kogato ima mnogo ravni dava poslednata
|
||||
{
|
||||
s_max=max;
|
||||
pos = x;
|
||||
}
|
||||
}
|
||||
//qDebug()<<"pos"<<pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int DecoderMs::lenms(double *r,int npts)
|
||||
{
|
||||
int msglen =0;
|
||||
const int NMSGMAX = (37+9)*56; //v2.12 1624 29*56
|
||||
double *acf = new double[NMSGMAX];//1624 29*56
|
||||
//int np[9] ={5,7,9,11,13,17,19,23,29}; //!Permissible message lengths
|
||||
int np[13] ={5,7,9,11,13,17,19,23,29,31,33,35,37};// hv v1.01 {5,7,9,11,13,17,19,23,29} to {5,7,9,11,13,17,19,23,29,31,33,35,37,39}
|
||||
//!Why necessary? (But don't remove!)
|
||||
msglen=0; //!Use ACF to find msg length
|
||||
//qDebug()<<"glenms="<<npts;
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
if (npts>=8*56)
|
||||
{//if(npts.ge.8*56) then
|
||||
//r=r-sum(r(1:npts))/npts;
|
||||
double sum =0.0;
|
||||
for (int i = 0; i<npts; i++)
|
||||
{
|
||||
sum += r[i];
|
||||
}
|
||||
for (int i = 0; i<npts; i++)
|
||||
{
|
||||
r[i]=r[i]-sum/npts;
|
||||
}
|
||||
// r=r-sum/npts;
|
||||
|
||||
double acfmax=0.0;
|
||||
//double acf0=dot_product(r(1:npts),r(1:npts))
|
||||
double acf0=dot_product_da_da(r,r,npts,0);
|
||||
if(acf0==0.0)
|
||||
acf0=1.0;
|
||||
|
||||
int kz=fmin((int)(0.75*npts),NMSGMAX);//// hv v1.01 <-1624 29*56 to 39*56
|
||||
//qDebug()<<"lenms="<<kz;
|
||||
for (int k = 7; k<kz; k++)
|
||||
{//do k=8,kz
|
||||
double fac=float(npts)/(npts-k);
|
||||
//acf[k]=fac*dot_product(r[1:npts],r[1+k:npts+k])/acf0;
|
||||
acf[k]=fac*dot_product_da_da(r,r,npts,k)/acf0;
|
||||
}
|
||||
//call hipass(acf(8),kz-7,50)
|
||||
hipass(acf,7,kz-7,50);//acf,7,kz-7,50 <- probvano 8 garmi hv acf[0-1623]<-(kz-7)
|
||||
|
||||
int kpk=1; //!Silence compiler warning
|
||||
for (int k = 7; k<kz; k++)
|
||||
{//do k=8,kz //!Find acfmax, kpk
|
||||
if (acf[k]>acfmax)
|
||||
{
|
||||
acfmax=acf[k];
|
||||
kpk=k;
|
||||
}
|
||||
}
|
||||
|
||||
double sumsq=0.0;
|
||||
int n=0;
|
||||
for (int k = 7; k<kz; k++)
|
||||
{//do k=8,kz //!Find rms, skipping around kpk
|
||||
if (abs(k-kpk)>10)
|
||||
{
|
||||
sumsq=sumsq+(acf[k]*acf[k]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
if(n==0)
|
||||
n=1;
|
||||
double rms=sqrt(sumsq/n);
|
||||
if(rms==0.0)
|
||||
rms=1.0;
|
||||
for (int z = 0; z<NMSGMAX; z++) // hv v1.01 1624 to 2184
|
||||
acf[z]=acf[z]/rms; //!Normalize the acf
|
||||
|
||||
double amax2=0.0;
|
||||
double acflim=3.5;
|
||||
for (int i = 0; i<13; i++)// hv v.1.01 9 to 13
|
||||
{//do i=1,9
|
||||
int k=56*np[i]; //!Check only the permitted lengths
|
||||
if (k>kz) goto c10;
|
||||
if (acf[k]>acflim && acf[k]>amax2)
|
||||
{
|
||||
amax2=acf[k]; //!Save best value >3.5 sigma
|
||||
msglen=np[i]; //!Save message length
|
||||
//qDebug()<<"lenms="<<msglen;
|
||||
}
|
||||
}
|
||||
//c10: //continue;
|
||||
}
|
||||
c10:
|
||||
|
||||
delete [] acf;//delete [] acf;
|
||||
return msglen;
|
||||
}
|
||||
|
||||
void DecoderMs::decodems(double complex *cdat,int,double complex cww_[64][56],int i1,int nchar,double s2_[400][64],char*msg)
|
||||
{
|
||||
//! DF snd sync have been established, now decode the message
|
||||
//complex cw(56,0:63) //!Complex waveforms for codewords
|
||||
//real s2(0:63,400)
|
||||
//character msg*400
|
||||
double complex z;
|
||||
int kpk=0; //!Silence compiler warning
|
||||
|
||||
for (int j = 0; j<nchar; j++)
|
||||
{ //!Find best match for each character
|
||||
//int ia=i1 + (j-1)*56;
|
||||
int ia=i1 + (j)*56;
|
||||
//qDebug()<<ia<<i1<<(j-1)*56;
|
||||
double smax=0.0;
|
||||
for (int k = 0; k<41; k++)
|
||||
{
|
||||
int kk=k;
|
||||
if (k==40) kk=57;//kk=57;
|
||||
z=0.0;
|
||||
|
||||
for (int i = 0; i<56; i++)
|
||||
{
|
||||
//qDebug()<<i<<ia<<kk;
|
||||
z=z + cdat[ia+i]*conj(cww_[kk][i]);
|
||||
}
|
||||
|
||||
double ss=cabs(z);
|
||||
s2_[j][k]=ss;//?????
|
||||
if (ss>smax)
|
||||
{
|
||||
smax=ss;
|
||||
kpk=kk;
|
||||
}
|
||||
}
|
||||
//msg[j]=cc[kpk+1];
|
||||
msg[j]=cc_JTMS_RX[kpk];//ko hv
|
||||
if (kpk==57) // kpk==57
|
||||
msg[j]=' ';
|
||||
}
|
||||
}
|
||||
|
||||
void DecoderMs::foldms(double s2_[400][64],int msglen,int nchar,char *msg)
|
||||
{
|
||||
//! Fold the 2-d "goodness of fit" array s2 modulo message length,
|
||||
//! then decode the folded message.
|
||||
double fs2_[39][64];//hv v1.01 29 to 39
|
||||
int nfs2[39];//hv v1.01 29 to 39
|
||||
|
||||
for (int x = 0; x<64; x++)
|
||||
{
|
||||
for (int y = 0; y<39; y++) // hv v1.01 29 to 39
|
||||
fs2_[y][x]=0.0;
|
||||
}
|
||||
for (int z = 0; z<39; z++)// hv v1.01 29 to 39
|
||||
nfs2[z]=0;
|
||||
|
||||
for (int j = 0; j<nchar; j++)
|
||||
{ // !Fold s2 into fs2, modulo msglen
|
||||
//jj=mod(j-1,msglen)+1
|
||||
int jj=fmod(j,msglen);
|
||||
nfs2[jj]=nfs2[jj]+1;
|
||||
//do i=0,40
|
||||
for (int i = 0; i<41; i++)
|
||||
fs2_[jj][i]=fs2_[jj][i] + s2_[j][i];
|
||||
}
|
||||
|
||||
for (int w = 0; w<400; w++)
|
||||
msg[w]=' ';
|
||||
|
||||
int kpk=0; //!Silence compiler warning
|
||||
|
||||
for (int j = 0; j<msglen; j++)
|
||||
{
|
||||
double smax=0.0;
|
||||
//do k=0,40
|
||||
for (int k = 0; k<41; k++)
|
||||
{
|
||||
if (fs2_[j][k]>smax)
|
||||
{
|
||||
smax=fs2_[j][k];
|
||||
kpk=k;
|
||||
}
|
||||
}
|
||||
//if(kpk.eq.40) kpk=57
|
||||
if (kpk==40) kpk=57;
|
||||
//msg(j:j)=cc(kpk+1:kpk+1)
|
||||
msg[j]=cc_JTMS_RX[kpk];
|
||||
//if(kpk.eq.57) msg(j:j)=' '
|
||||
if (kpk==57) msg[j]=' ';
|
||||
}
|
||||
/*
|
||||
msg29=msg(1:msglen)
|
||||
call alignmsg(' ',2,msg29,msglen,idone)
|
||||
if(idone.eq.0) call alignmsg('CQ', 3,msg29,msglen,idone)
|
||||
if(idone.eq.0) call alignmsg('QRZ', 3,msg29,msglen,idone)
|
||||
if(idone.eq.0) call alignmsg(mycall,4,msg29,msglen,idone)
|
||||
if(idone.eq.0) call alignmsg(' ', 1,msg29,msglen,idone)
|
||||
msg29=adjustl(msg29)
|
||||
*/
|
||||
}
|
||||
|
||||
void DecoderMs::jtms(double *dat,int dat_c_begin,int npts,int DFTol,double t2,int mswidth,int peak,
|
||||
int nrpt,bool pick,bool &f_only_one_color,int &disp_lines_dec_cou)
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
int max_count_msg = 46;//v1.30 46 for 800pix
|
||||
//int part = max_count_msg;
|
||||
|
||||
QString mssg = "";
|
||||
//double complex *idft = new double complex[N + 1];
|
||||
int NZ = 512*1024;
|
||||
double *s = new double[NZ+10];
|
||||
int nfft1;
|
||||
double complex *cdat = new double complex[NZ+10];
|
||||
//int t2 = 2;//ne sluzi tuk za ni6to hv?
|
||||
double f0 = 1155.46875; //!Nominal frequency for bit=0
|
||||
int nfreeze = 1; // hv??? > 0 stava ne6to
|
||||
int mousedf = 0; //otklonenie ot mouse hv ?
|
||||
//double dfx; //hv? 6te priema stoinost
|
||||
double snrsq2;//hv? 6te priema stoinost
|
||||
//double complex *cwb = new double complex[56]; //!Complex waveform for <space>
|
||||
// complex cw(56,0:63) dalgo 63 i natapkano s 56.0
|
||||
//double complex (*cw)[64] = new double complex[56][64]; //!Complex waveforms for all codewords
|
||||
|
||||
//bool first = true;
|
||||
//char *mycall = new char[12];
|
||||
//char *theircall = new char[12];
|
||||
//char mycall[13];
|
||||
//char theircall[13];
|
||||
double r[60000];
|
||||
int i1;
|
||||
int msglen = 0;
|
||||
//real s2(0:63,400)
|
||||
double s2_[400][64];
|
||||
char msg[400];
|
||||
int nchar;
|
||||
int nchk;
|
||||
//QString fold = "no fold";
|
||||
|
||||
for (int i = 0; i<400; i++)
|
||||
msg[i]=' ';
|
||||
|
||||
pomAll.zero_double_beg_end(r,0,60000);
|
||||
|
||||
//for (int i = 0; i<npts; i++)
|
||||
//qDebug()<<dat[i];
|
||||
/*if (theircall==(char*)"dummy ") first=true;// !Silence compiler warning
|
||||
if (first)
|
||||
setupms(cw,cwb); //!Calculate waveforms for codewords
|
||||
first=false;*/
|
||||
|
||||
// ograni4ava da ne e po goliamo ot celia razmer ot 30sec
|
||||
/*qDebug()<<"1"<<npts;
|
||||
qDebug()<<"2"<<npts;*/
|
||||
|
||||
double n=log(double(npts))/log(2.0) + 1.0;
|
||||
nfft1=pow(2,n);// nfft1=2**n !FFT length
|
||||
|
||||
analytic(dat,dat_c_begin,npts,nfft1,s,cdat); //!Convert to analytic signal
|
||||
//analytic_msk(dat,dat_c_begin,npts,nfft1,cdat);//qDebug()<<"2";
|
||||
|
||||
snrsq2 = msdf(cdat,npts,t2,nfft1,f0,nfreeze,mousedf,DFTol); //!Get DF
|
||||
//qDebug()<<snrsq2<<"snrsq2";
|
||||
//dfx = 0.0;
|
||||
|
||||
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
|
||||
double sq2lim=7.0;
|
||||
if (pick) sq2lim=5.0;
|
||||
if (snrsq2<sq2lim) goto c900; //!Reject non-JTMS signals
|
||||
|
||||
//qDebug()<<"cb="<<creal(cdat[100]);
|
||||
tweak1(cdat,npts,-jtms_dfx,cdat); //!Mix to standard frequency
|
||||
|
||||
//! DF is known, now establish character sync.
|
||||
i1 = syncms(cdat,npts,cwb_jtms,r); //!Get character sync
|
||||
//qDebug()<<"il="<<i1;
|
||||
msglen = lenms(r,npts); //!Find message length
|
||||
//qDebug()<<"dolu msglen="<<msglen;
|
||||
|
||||
|
||||
//s2=0.0;
|
||||
for (int i = 0; i<400; i++)
|
||||
{
|
||||
for (int j = 0; j<64; j++)
|
||||
s2_[i][j]=0.0;
|
||||
}
|
||||
|
||||
nchar=(npts-55-i1)/56;
|
||||
if (nchar>400) nchar=400;
|
||||
//qDebug()<<nchar<<npts<<i1;
|
||||
|
||||
decodems(cdat,npts,cw_jtms_,i1,nchar,s2_,msg); //!Decode the message
|
||||
//qDebug()<<"dolu msg="<<nchar;
|
||||
|
||||
nchk = fmax(20,(int)(1.5*msglen));
|
||||
|
||||
//qDebug()<<nchar<<nchk<<msglen;
|
||||
|
||||
//if(msglen.eq.0 .or. nchar.lt.nchk .or. pick) then
|
||||
if (msglen==0 || nchar<nchk || pick)
|
||||
{
|
||||
mssg = CharToQString(msg,400);
|
||||
|
||||
mssg = FormatLongMsg(mssg,max_count_msg);
|
||||
|
||||
f0 = 1155.46875+jtms_dfx;
|
||||
|
||||
if (f_only_one_color)
|
||||
{
|
||||
f_only_one_color = false;
|
||||
SetBackColor();
|
||||
}
|
||||
list <<s_time<<QString("%1").arg(t2,0,'f',1)<<QString("%1").arg(mswidth)<<
|
||||
QString("%1").arg((int)peak)<<QString("%1").arg(nrpt)<<QString("%1").arg((int)jtms_dfx)
|
||||
<<mssg<<QString("%1").arg((int)f0);
|
||||
|
||||
|
||||
emit EmitDecodetText(list,s_fopen,true);//1.27 psk rep fopen bool true false no file open
|
||||
|
||||
if (s_mousebutton == 0 && disp_lines_dec_cou < MAX_DISP_DEC_COU) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
{
|
||||
disp_lines_dec_cou++;
|
||||
emit EmitDecLinesPosToDisplay(disp_lines_dec_cou,t2,t2,s_time);
|
||||
}
|
||||
}
|
||||
//if(msglen.gt.0 .and. nchar.ge.nchk) then
|
||||
if (msglen>0 && nchar>=nchk)
|
||||
{
|
||||
list.clear();
|
||||
foldms(s2_,msglen,nchar,msg);
|
||||
mssg = CharToQString(msg,msglen);
|
||||
//qDebug()<<"1="<<mssg;
|
||||
mssg = FormatFoldMsg(mssg);
|
||||
//mssg = " SP9HWY 26R LZ2HV ";
|
||||
//qDebug()<<"2="<<mssg;
|
||||
bool f_align = false;
|
||||
mssg = AlignMsgSpecWord(mssg,"CQ",f_align);
|
||||
if (!f_align)
|
||||
mssg = AlignMsgSpecWord(mssg,"QRZ",f_align);
|
||||
if (!f_align)
|
||||
mssg = AlignMsgSpecWord(mssg,s_MyCall,f_align);
|
||||
//qDebug()<<"3="<<mssg;
|
||||
mssg = RemWSpacesInside(mssg);
|
||||
//qDebug()<<"4="<<mssg;
|
||||
|
||||
mssg = RemBegEndWSpaces(mssg);
|
||||
//mssg.prepend("* ");// removed v095 hv
|
||||
//folded_m = true;
|
||||
|
||||
f0 = 1155.46875+jtms_dfx;
|
||||
|
||||
if (f_only_one_color)
|
||||
{
|
||||
f_only_one_color = false;
|
||||
SetBackColor();
|
||||
}
|
||||
list <<s_time<<QString("%1").arg(t2,0,'f',1)<<QString("%1").arg(mswidth)<<
|
||||
QString("%1").arg((int)peak)<<QString("%1").arg(nrpt)<<QString("%1").arg((int)jtms_dfx)
|
||||
<<mssg<<"* "+QString("%1").arg((int)f0);
|
||||
|
||||
|
||||
|
||||
emit EmitDecodetText(list,s_fopen,true);//1.27 psk rep fopen bool true false no file open
|
||||
|
||||
if (s_mousebutton == 0 && disp_lines_dec_cou < MAX_DISP_DEC_COU) //mousebutton Left=1, Right=3 fullfile=0 rtd=2
|
||||
{
|
||||
disp_lines_dec_cou++;
|
||||
emit EmitDecLinesPosToDisplay(disp_lines_dec_cou,t2,t2,s_time);
|
||||
}
|
||||
}
|
||||
|
||||
//QString str = " lots\t of\nwhitespace\r\n ";
|
||||
//str = str.trimmed();
|
||||
// str == "lots\t of\nwhitespace"
|
||||
|
||||
c900:
|
||||
/*QString ss = AlignMsg(" SP9HWY 26R LZ2HV ");
|
||||
qDebug()<<ss;
|
||||
ss = RemWSpacesInside(ss);
|
||||
qDebug()<<ss;*/
|
||||
|
||||
delete [] s;
|
||||
delete [] cdat;
|
||||
//return mssg;
|
||||
}
|
2856
src/HvDecoderMs/decoderms.cpp
Normal file
893
src/HvDecoderMs/decoderms.h
Normal file
@ -0,0 +1,893 @@
|
||||
/* MSHV DecoderMs
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef DECODERMS_H
|
||||
#define DECODERMS_H
|
||||
|
||||
#include <complex.h>
|
||||
#define complex _Complex
|
||||
//#include "../Hv_Lib_fftw/fftw3.h"
|
||||
|
||||
#include "decoderpom.h"
|
||||
|
||||
#include "../HvMsPlayer/libsound/HvGenFt8/gen_ft8.h"
|
||||
#include <QObject> //2.53
|
||||
#define ALL_MSG_SNR 120 //2.63 from 100 to 120
|
||||
#define MAXDEC 120
|
||||
class DecoderFt8 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DecoderFt8(int id);
|
||||
~DecoderFt8();
|
||||
void SetStMultiAnswerMod(bool f);
|
||||
void SetStWords(QString,QString,int,int);
|
||||
void SetStTheirCall(QString s1);
|
||||
void SetStDecode(QString time,int mousebutton,bool);
|
||||
void SetStDecoderDeep(int d);
|
||||
void SetStApDecode(bool f);
|
||||
void SetStQSOProgress(int i);
|
||||
void SetStTxFreq(double f);
|
||||
void Decode3intFt(bool);//2.39 remm
|
||||
void SetNewP(bool);
|
||||
//void SetResetPrevT(QString ptime);
|
||||
void ft8_decode(double *dd,int c_dd,double f0a,double f0b,double fqso,bool &f,int id3dec,double,double);
|
||||
|
||||
signals:
|
||||
void EmitDecodetTextFt(QStringList);
|
||||
void EmitBackColor();
|
||||
|
||||
private:
|
||||
int decid;
|
||||
F2a f2a;
|
||||
PomAll pomAll;
|
||||
PomFt pomFt;
|
||||
GenFt8 *TGenFt8;
|
||||
double DEC_SAMPLE_RATE;
|
||||
double twopi;
|
||||
double pi;
|
||||
|
||||
bool f_new_p;
|
||||
//QString s_time8_prev;
|
||||
int s_ndecodes;
|
||||
QString allmessages[ALL_MSG_SNR+20];
|
||||
//int allsnrs[ALL_MSG_SNR+20];
|
||||
double f1_save[ALL_MSG_SNR+20];
|
||||
double xdt_save[ALL_MSG_SNR+20];
|
||||
int itone_save[ALL_MSG_SNR+20][100];
|
||||
bool lsubtracted[ALL_MSG_SNR+20];
|
||||
int s_cou_dd1;
|
||||
double dd1[182600];
|
||||
|
||||
bool first_sync8d;
|
||||
double complex csync_ft8_2[7][32];
|
||||
void sync8d(double complex *cd0,int i0,double complex *ctwk,int itwk,double &sync);
|
||||
|
||||
bool first_ft8_downsample;
|
||||
double taper_ft8_ds[120];
|
||||
double complex cx_ft8[192100];//2.09 ->error //96000+100 //(0:NFFT1/2) NFFT1=192000 // 96000
|
||||
void ft8_downsample(double *dd0,bool &newdat,double f1,double complex *cd0);
|
||||
|
||||
double pulse_ft8_rx[5770]; // !1920*3=5760
|
||||
double complex ctab8_[65536+10];
|
||||
void gen_ft8cwaveRx(int *i4tone,double f_tx,double complex *cwave);
|
||||
|
||||
bool first_subsft8;
|
||||
double complex cw_subsft8[180300];//180000+300 15*12000
|
||||
double endcorrectionft8[2200]; //(NFILT/2+1) NFILT=4000; 4000/2+1=2001
|
||||
double BestIdtft8(double *dd,double f0,double dt,double idt,double complex *cref,
|
||||
double complex *cfilt,double complex *cw_subs,double *endcorr,
|
||||
double *xdd,double complex *cx);
|
||||
void subtractft8(double *dd,int *itone,double f0,double dt,bool refdt);
|
||||
|
||||
bool first_ft8b_2;
|
||||
int mcq_ft8_2[29];
|
||||
/*int mcqfd_ft8_2[29];
|
||||
int mcqru_ft8_2[29];
|
||||
int mcqtest_ft8_2[29];
|
||||
int mcqww_ft8_2[29];
|
||||
int mcqbu_ft8_2[29];
|
||||
int mcqft_ft8_2[29];*/
|
||||
int mrrr_ft8_2[19];
|
||||
int m73_ft8_2[19];
|
||||
int mrr73_ft8_2[19];
|
||||
int cont_id0_ft8_2;
|
||||
bool one_ft8_2[9][512];//(0:511,0:8);
|
||||
QString theircall12_0_ft8_2;
|
||||
bool ft8_downs_sync_bmet(double *,bool ap7,bool &,double &,double &,int &,int &,double s8_[79][8],
|
||||
double *,double *,double *,double *);
|
||||
void ft8b(double *dd,bool &newdat,int nQSOProgress,double nfqso,double nftx,int ndepth,bool n4pas3int,bool lapon,
|
||||
double napwid,bool lsubtract,bool nagain,int cid,int cty,int &iaptype,double &f1,double &xdt,
|
||||
double xbase,int *apsym,int &nharderrors,double &dmin,int &nbadcrc,QString &message,
|
||||
double &xsnr,QString theircall12,int *it);
|
||||
|
||||
void baseline(double *s,int nfa,int nfb,double *sbase);
|
||||
bool first_ft8sbl;
|
||||
double window_ft8sbl[3890]; //NFFT1=2*NSPS NSPS=1920 1920*2=3840
|
||||
void get_spectrum_baseline(double *dd,int nfa,int nfb,double *sbase);
|
||||
void sync8(double *dd,double nfa,double nfb,double syncmin,double nfqso,double s_[402][1970],double candidate[2][620],int &ncand,double *sbase);
|
||||
void ft8apset(QString mycall12,QString theircall12,int *apsym2);//int &iaptype ,QString theirgrid6,bool bcontest,QString mygrid6,
|
||||
|
||||
void PrintMsg(QString,int,double,double,QString,int,float,float,bool &,bool);
|
||||
QString nutc0;
|
||||
int c_zerop;
|
||||
QString msg0[2][2][MAXDEC+20];
|
||||
double dt0[2][2][MAXDEC+20];
|
||||
double f0[2][2][MAXDEC+20];
|
||||
int ndec[2][2];
|
||||
int jseq;
|
||||
bool isgrid4(QString);
|
||||
int ft8_even_odd(QString);
|
||||
void ft8_a7_save(QString,double,double,QString);
|
||||
void ft8_a7d(double *dd0,bool &newdat,QString call_1,QString call_2,QString grid4,
|
||||
double &xdt,double &f1,double xbase,int &nharderrors,double &,QString &msg37,double &xsnr);
|
||||
|
||||
};
|
||||
|
||||
#include "../HvMsPlayer/libsound/HvGenFt4/gen_ft4.h"
|
||||
class DecoderFt4 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DecoderFt4(int id);
|
||||
~DecoderFt4();
|
||||
void SetStTxFreq(double f);
|
||||
void SetStMultiAnswerMod(bool f);
|
||||
void SetStDecoderDeep(int d);
|
||||
void SetStApDecode(bool f);// only in mshv
|
||||
void SetStQSOProgress(int i);
|
||||
void SetStDecode(QString time,int mousebutton);
|
||||
void SetStWords(QString,QString,int,int);
|
||||
void SetStTheirCall(QString c);
|
||||
void SetMAMCalls(QStringList ls);
|
||||
//void SetNewP(bool);
|
||||
//void SetResetPrevT(QString ptime);
|
||||
void ft4_decode(double *dd,double f0a,double f0b,double,double,double fqso,bool &f);
|
||||
|
||||
signals:
|
||||
void EmitDecodetTextFt(QStringList);
|
||||
void EmitBackColor();
|
||||
|
||||
private:
|
||||
int decid;
|
||||
F2a f2a;
|
||||
PomAll pomAll;
|
||||
PomFt pomFt;
|
||||
GenFt4 *TGenFt4;
|
||||
double DEC_SAMPLE_RATE;
|
||||
double twopi;
|
||||
double pi;
|
||||
|
||||
//bool f_new_p;
|
||||
void dshift1(double *a,int cou_a,int ish);//???
|
||||
|
||||
bool first_ft4_ds;
|
||||
double complex cx_ft4_ds[40000]; //(0:NMAX/2)=36288 31104 [NMAX] (NMAX=21*3456)=72576
|
||||
double window_ft4_ds[4096]; //(0:NFFT2-1) (NFFT2=NMAX/18)=4032 (0:NFFT2-1) (NFFT2=NMAX/16)=3888
|
||||
void ft4_downsample(double *dd,bool newdata,double f0,double complex *c);
|
||||
|
||||
//void nuttal_window(double *win,int n);
|
||||
void ft4_baseline(double *s,int nfa,int nfb,double *sbase);
|
||||
|
||||
bool first_ft4detcad;
|
||||
double window_ft4[2314]; //2304;//NFFT1=2048;
|
||||
void getcandidates4(double *dd,double fa,double fb,double,double,double syncmin,double nfqso,
|
||||
int maxcand,double candidate[2][115],int &ncand);
|
||||
|
||||
bool first_ft4_sync4d;
|
||||
double complex csynca_ft4_sync[70];//(2*NSS) 2*32=64
|
||||
double complex csyncb_ft4_sync[70];
|
||||
double complex csyncc_ft4_sync[70];
|
||||
double complex csyncd_ft4_sync[70];
|
||||
void sync4d(double complex *cd0,int i0,double complex *ctwk,int itwk,double &sync);
|
||||
|
||||
double pulse_ft4_rx[1748]; //576*3=1728 !512*3=1536
|
||||
void gen_ft4cwaveRx(int *i4tone,double f_tx,double complex *cwave);
|
||||
|
||||
bool first_subsft4;
|
||||
double complex cw_subsft4[72800];//72576 =62208
|
||||
void subtractft4(double *dd,int *itone,double f0,double dt);
|
||||
|
||||
int count_eq_bits(bool *a,int b_a,bool *b,int c);
|
||||
|
||||
bool first_ft4bm;
|
||||
bool one_ft4_2[8][256];//(0:255,0:7)
|
||||
void get_ft4_bitmetrics(double complex *cd,double bitmetrics_[3][220],bool &badsync);//2*NN=206
|
||||
|
||||
bool first_ft4d;
|
||||
int mrrr_ft4[19];
|
||||
int m73_ft4[19];
|
||||
int mrr73_ft4[19];
|
||||
int mcq_ft4[29];
|
||||
/*int mcqru_ft4[29];
|
||||
int mcqfd_ft4[29];
|
||||
int mcqtest_ft4[29];
|
||||
int mcqww_ft4[29];
|
||||
int mcqbu_ft4[29];
|
||||
int mcqft_ft4[29];*/
|
||||
int cont_id0_ft4_2;
|
||||
QString mycall0_ft4;
|
||||
QString theircall0_ft4;
|
||||
double fac_ft4_sync;
|
||||
double complex ctwk2_ft4_[41][70]; //ctwk2(2*NSS,-16:16) 2*32=64
|
||||
int apbits_ft4[174];//174
|
||||
int apmy_ru_ft4[28];
|
||||
int aptheir_fd_ft4[28];
|
||||
|
||||
};
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QElapsedTimer>
|
||||
#include <math.h> //los
|
||||
#include <unistd.h> //usleep x86_64 pthread.h
|
||||
/*
|
||||
#include "../config.h"
|
||||
#if defined _WIN32_
|
||||
#include "../Hv_Lib_DirectX90c/dsound.h"
|
||||
#endif
|
||||
*/
|
||||
#include "../HvMsPlayer/libsound/HvGenMsk/genmesage_msk.h"
|
||||
#include "../HvMsPlayer/libsound/HvGen65/gen65.h"
|
||||
|
||||
#define STATIC_DAT_COUNT 12000*90 //1.35 jt65abc 90sec max 60sec static dufer for decode thread
|
||||
#define RECENT_CALLS_COU 6
|
||||
#define HASH_CALLS_COUNT 36 //for any case manualy HV-> 6 reserved (6 + (RECENT_CALLS_COU*(RECENT_CALLS_COU-1)))
|
||||
#define RECENT_SHMSGS_COU 50
|
||||
#define MAX_DISP_DEC_COU 40 //max 40 labels for 30s and display_ms.h
|
||||
#define MAX_RTD_DISP_DEC_COU 140 //max 140 lines for 30s and display_ms.h
|
||||
#include "decoderq65.h"
|
||||
|
||||
class DecoderMs : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DecoderMs();
|
||||
~DecoderMs();
|
||||
|
||||
void setMode(int);
|
||||
//void ResetCalsHashFileOpen(); //msk40 za po natatak ako ima oplakwane 1.31
|
||||
void SetCalsHashFileOpen(QString);
|
||||
void SetDecoderDeep(int);//1-fast 2-normal 3-deep
|
||||
////jt65abc/////
|
||||
void SetMaxCandidats65(int max_cand);
|
||||
////jt65abc/////
|
||||
/// FT8 JT65 ////////////////////////
|
||||
void SetApDecode(bool);
|
||||
void SetVhfUhfFeatures(bool f);
|
||||
void DeepSearchChanged(bool);
|
||||
void AvgDecodeChanged(bool);
|
||||
void SetPerodTime(int);
|
||||
void SetMultiAnswerMod(bool);//for AP MAM ft8 2.03
|
||||
void SetThrLevel(int);
|
||||
void SetMsk144RxEqual(int);
|
||||
|
||||
public slots:
|
||||
void Decode3intFt(bool);//2.39 remm
|
||||
void SetZapData(short*dat, int count);
|
||||
void SetDecode(short*,int,QString,int t_istart,int mousebutton,bool f_rtd,bool end_rtd,bool fopen);//1.27 psk rep fopen bool true false no file open
|
||||
void SetDfSdb(int sdb,int df);
|
||||
void SetWords(QStringList,int,int);
|
||||
void SetZap(bool f);
|
||||
void SetNexColor(bool);
|
||||
///JTMSK SHORT////
|
||||
void SetCalsHash(QStringList);
|
||||
///JTMSK SHORT////
|
||||
void SetShOpt(bool f);
|
||||
void SetSwlOpt(bool f);
|
||||
//void SetMyGridMsk144ContM(QString,bool);//for " R " in msg 1.31
|
||||
//void SetMsk144RxEqual(int);
|
||||
/// JT56ABC ////////////////////////
|
||||
//void AvgDecodeChanged(bool);
|
||||
//void DeepSearchChanged(bool);
|
||||
void SetClearAvg65();
|
||||
void SetRxFreqF0F1(double,double,double);
|
||||
//void SetVhfUhfFeatures(bool f);
|
||||
void SetAggresLevFtd(int val);
|
||||
void SetAggresLevDeepS(int val);
|
||||
/// END JT56ABC ////////////////////////
|
||||
void SetClearAvgPi4();
|
||||
void SetTxFreq(double);
|
||||
void Set65DeepSearchDb(QStringList);
|
||||
|
||||
/// FT8 and JT65 ////////////////////////
|
||||
void SetQSOProgress(int);
|
||||
void SetMAMCalls(QStringList);//2.00 mam hash
|
||||
void AutoClrAvgChanged(bool f);
|
||||
void SetSingleDecQ65(bool);
|
||||
void SetClearAvgQ65();
|
||||
void SetDecAftEMEDelay(bool);
|
||||
void SetMaxDrift(bool);
|
||||
//void SetMultiAnswerMod(bool);//for AP MAM ft8 2.03
|
||||
/// END FT8 ////////////////////////
|
||||
|
||||
signals:
|
||||
void EmitDecodetText(QStringList,bool,bool); //1.27 psk rep fopen bool true false no file open
|
||||
void EmitDecode(bool,int dec_state);//dec_state no=0 dec=1 rtddec=2
|
||||
void EmitBackColor(bool);
|
||||
void EmitDecLinesPosToDisplay(int count,double pos,double pos_ping,QString p_time);//1.28 p_time for identif perood
|
||||
void EmitDecodeInProgresPskRep(bool);
|
||||
void EmitAvgSaves(int,int,int,int);
|
||||
void EmitAvgSavesPi4(int,int);
|
||||
void EmitAvgSavesQ65(int,int);
|
||||
void EmitDecodetTextRxFreq(QStringList,bool,bool);
|
||||
void EmitTimeElapsed(float);//2.33
|
||||
|
||||
private slots:
|
||||
//void SetDecodetTextFt(QStringList);
|
||||
//void SetDecodetTextQ65(QStringList);//bool
|
||||
void SetDecodetTextFtQ65(QStringList);
|
||||
void ThrSetBackColor();
|
||||
void SetBackColorQ65();
|
||||
|
||||
private:
|
||||
QString dup_amsgs_thr[140];
|
||||
int dup_afs_thr[140];
|
||||
int dup_camsgf_thr;
|
||||
void ResetDupThr();
|
||||
|
||||
int s_thr_used;
|
||||
bool is_thrTime;
|
||||
void CreateStartTimerthr();
|
||||
QElapsedTimer *thrTime;
|
||||
F2a f2a;
|
||||
PomAll pomAll;
|
||||
//PomFt pomFt;
|
||||
void EndRtdPeriod();
|
||||
bool s_fopen;
|
||||
int rtd_dupe_cou;
|
||||
double rtd_dupe_pos;
|
||||
|
||||
int s_decoder_deep;//1-fast 2-normal 3-deep
|
||||
double DEC_SAMPLE_RATE;
|
||||
bool s_nzap;
|
||||
double twopi;
|
||||
double pi;
|
||||
int s_mod;
|
||||
int G_MinSigdB;
|
||||
int G_DfTolerance;
|
||||
bool G_ShOpt;
|
||||
bool G_SwlOpt;
|
||||
double a1_;
|
||||
double a2_;
|
||||
double a3_;
|
||||
double a4_;
|
||||
double s_basevb;
|
||||
QString s_MyCall;// in SetWords decoderms
|
||||
QString s_MyBaseCall;// in SetWords decoderms
|
||||
QString CharToQString(char*,int count);
|
||||
QString FormatFoldMsg(QString);
|
||||
QString AlignMsgSpecWord(QString msg, QString word, bool &f_align);
|
||||
QString RemBegEndWSpaces(QString);
|
||||
QString RemWSpacesInside(QString);
|
||||
QString FormatLongMsg(QString,int);
|
||||
void analytic(double*,int,int,int,double*,double complex*);
|
||||
void xfft(double complex *c,double *d,int nfft);
|
||||
void ssort(double *x,double *y,int n,int kflag);
|
||||
void sort(int nmax,double *tmp);
|
||||
double pctile(double *x,int begin_x,double *tmp,int nmax,double npct);
|
||||
void tweak1(double complex *ca,int jz,double f0,double complex *cb);
|
||||
void smooth(double *x,int nz);
|
||||
|
||||
int ping(double *s,int nz,double dtbuf,int slim,double wmin,double pingdat_[100][3]);
|
||||
void indexx(int n,double *arr,int *indx);
|
||||
void set_double_to_d(double a,double*y,int n);
|
||||
void spec2d(double *data, int jz, double &sigma);
|
||||
void wsjt1_mtdecode(double*,int,bool);
|
||||
void bzap(double*dat,int jz,int nadd,int mode,double*fzap);
|
||||
//double gran(int iset);
|
||||
void dtrim(short*,int);
|
||||
void zero_int_beg_end(int*,int begin,int end);
|
||||
void add_da_da2_da(double *a,double b_[324][558],int b_beg,int b_row,double *c,int n);
|
||||
void flatten(double s2_[324][558],int nbins,int jz,double *psa,double *ref,double *birdie,double *variance);
|
||||
void move_da_to_da2(double *x,double y_[324][558],int b,int k,int n);
|
||||
void ps(double *dat,int dat_begin,int nfft,double*s);
|
||||
void avesp2(double *dat,int jza,int nadd,int mode,bool NFreeze,int MouseDF,int DFTolerance,double *fzap);
|
||||
void move_da_to_da(double*x,int begin_x,double*y,int begin_y,int n);
|
||||
bool f_back_color;
|
||||
void SetBackColor();
|
||||
//double s2[558][324];
|
||||
|
||||
GenMsk *TGenMsk;
|
||||
/// MSK144 ///////////////
|
||||
//double pcoeffs_msk144_dec[3];
|
||||
bool first_dec_msk;
|
||||
//QString My_Grid_Loc; // in SetMyGridMsk144ContM decodermsk144 //for " R " in msg 1.31
|
||||
char s_msk144_2s8[8];
|
||||
double pp_msk144[12];
|
||||
double rcw_msk144[12];
|
||||
double complex cb_msk144[42];
|
||||
bool f_first_msk144;
|
||||
double dt_msk144;
|
||||
double fs_msk144;
|
||||
//double df_msk144; //problem zavisi ot NFFT a toi se promenia
|
||||
void first_msk144();
|
||||
int ihlo_msk144;
|
||||
int ihhi_msk144;
|
||||
int illo_msk144;
|
||||
int ilhi_msk144;
|
||||
int i2000_msk144;
|
||||
int i4000_msk144;
|
||||
int last_ntol_msk144;
|
||||
double last_df_msk144;
|
||||
void dftool_msk144(int ntol, double nrxfreq,double fd);
|
||||
void cshift2(double complex *a,double complex *b,int cou,int ish);//HV for save vareable b in orginal and out is a
|
||||
void mplay_dca_dca_dca(double complex *a,int a_beg,int a_end,double complex *b,int b_beg,double complex *mp,int mp_b,int ord);
|
||||
void mplay_dca_dca_da(double complex *a,int a_beg,int a_end,double complex *b,int b_beg,double *mp,int mp_b,int ord);
|
||||
void mplay_da_da_i(double *a,int b_a,int e_a,double *b,int b_b,int mp);
|
||||
//void mplay_da_absdca_absdca(double *a,int b_a,int e_a,double complex *b,int b_b,double complex *mp,int mp_b);
|
||||
void mplay_da_absdca_absdca(double *a,int a_c,double complex *b,double complex *mp);
|
||||
void sum_dca_dca_dca(double complex *a,int a_cou,double complex *b,double complex *c);
|
||||
//void copy_int_ar(int*a,int a_beg,int a_odd,int*b,int b_beg,int b_end);
|
||||
void copy_double_ar_ainc(double*a,int a_beg,int a_inc,double*b,int b_beg,int b_end);
|
||||
void copy_dca_or_sum_max3dca(double complex *a,int a_cou, double complex *b, int b_beg,
|
||||
double complex *c=0, int c_beg=-1, double complex *d=0, int d_beg=-1);
|
||||
double sum_da(double*a,int a_beg,int a_end);
|
||||
int sum_ia(int*a,int a_beg,int a_end);
|
||||
//void set_ba(bool *a,int a_beg,int a_end,bool f);
|
||||
int maxloc_absdca_beg_to_end(double complex*a,int a_beg,int a_end);
|
||||
//int maxloc_da_end_to_beg(double*a,int a_beg,int a_end);
|
||||
//int maxloc_abs_dca(double complex *a,int a_beg,int a_end);
|
||||
QString extractmessage144(char *decoded,int &nhashflag,char &ident);
|
||||
void msk144decodeframe_p(double complex *c,double *softbits,QString &msgreceived,int &nsuccess,char &ident,double phase0);
|
||||
void msk144decodeframe(double complex *c,double *softbits,QString &msg, int &nsuccess,char &ident,bool f_phase);
|
||||
///rtd msk144/////
|
||||
bool s_f_rtd;
|
||||
bool s_end_rtd;
|
||||
//double tframe_msk144;
|
||||
double tsec0_rtd_msk;
|
||||
bool first_rtd_msk;
|
||||
double pnoise_rtd_msk;
|
||||
QString s_time_last;
|
||||
int s_nsnrlast;
|
||||
QString s_msglast;
|
||||
int s_nsnrlastswl;
|
||||
QString s_msglastswl;
|
||||
double complex dot_product_dca_dca(double complex *a,int b_a,double complex *b,int b_b,int count);
|
||||
double complex dot_product_dca_sum_dca_dca(double complex *a,int a_b,int b_b,double complex *c,int c_count);
|
||||
void msk144sync(double complex *cdat,int nframes,int ntol,double delf,int *navmask,int npeaks,double fc,double &fest,int *npklocs,int &nsuccess,double complex *c);
|
||||
void msk144spd(double complex *cdat,int np,int &nsuccess,QString &msgreceived,double fc,double &fest,double &tdec,char &ident,int &navg,double complex *ct,double *softbits);
|
||||
int navg_sq;
|
||||
double complex cross_avg_sq[864];
|
||||
double wt_avg_sq;
|
||||
double tlast_sq;
|
||||
QString trained_dxcall_sq;
|
||||
QString training_dxcall_sq;
|
||||
bool currently_training_sq;
|
||||
bool first_sq;
|
||||
QString s_TheirCall;// in SetCalsHash decodermsk40
|
||||
void msk144signalquality(double complex *cframe,double snr,double freq,double t0,double *softbits,QString msg,
|
||||
QString dxcall,int &nbiterrors,double &eyeopening,bool &trained,double *pcoeffs,bool f_calc_pcoeffs);
|
||||
double s_pcoeffs_msk144[3];
|
||||
bool s_trained_msk144;
|
||||
QStringList s_list_rpt_msk;
|
||||
double prev_pt_msk;
|
||||
double ping_width_msk;
|
||||
double prev_ping_t_msk;
|
||||
double last_rpt_snr_msk;
|
||||
bool one_end_ping_msk;
|
||||
bool is_new_rpt_msk;
|
||||
bool ss_msk144ms;
|
||||
QString GetStandardRPT(double width, double peak);
|
||||
void print_rtd_decode_text(QString msg,QString &smsg,int in_snr,int &s_snr,double ts,double fest,
|
||||
double t0,int navg,int ncorrected,double eyeopening,char ident);
|
||||
QString str_round_20ms(double v);
|
||||
void msk_144_40_rtd(double *d2,int n,double s_istart,bool);
|
||||
void msk144_freq_search(double complex *cdat,double fc,int if1,int if2,double delf,int nframes,
|
||||
int *navmask,double &xmax,double &bestf,double complex *cs,double *xccs);/*double complex *cdat2,*/
|
||||
///rtd msk144 end/////
|
||||
double MskPingDuration(double *detmet_dur,int istp_real,int il,double level,int nstepsize,int nspm,double dt);
|
||||
void SetDecodetTextMsk2DL(QStringList);//2.46
|
||||
void detectmsk144(double complex *cdat,int npts,double s_istart,int &nmessages);
|
||||
//double maxval_da_beg_to_end(double*a,int a_beg,int a_end);
|
||||
void opdetmsk144(double complex *cdat,int npts,double s_istart,int &nmessages);
|
||||
/////////////////////////////////
|
||||
|
||||
//double h_msk144[1024*1024];
|
||||
//int nfft0_msk144;
|
||||
//void analytic_msk144(double *d,int d_count_begin,int npts,int nfft,double complex *c);
|
||||
// new analytic /////////////////////////////
|
||||
bool s_msk144rxequal_s;
|
||||
bool s_msk144rxequal_d;
|
||||
double complex h_msk144_2[524500]; //new analytic 1024*1024/2 HV need for auto decode 30s=524288
|
||||
double complex s_corrs[524500]; //vazno hv 1.31 HV need for auto decode 30s=524288
|
||||
double complex s_corrd[524500]; //vazno hv 1.31 HV need for auto decode 30s=524288
|
||||
int nfft0_msk144_2;//new analytic
|
||||
double dpclast_msk144_2[3];
|
||||
//double spclast_msk144_2[3];
|
||||
//double saclast_msk144_2[5];
|
||||
bool any_not_and_save_in_a(double *a,double *b,int c);
|
||||
void analytic_msk144_2_init_s_corrs_full();
|
||||
void analytic_msk144_2(double *d,int d_count_begin,int npts,int nfft,double complex *c,double *dpc,bool bseq,bool bdeq);
|
||||
// end new analytic ////////////////////////////////
|
||||
void msk_144_40_decode(double *dat,int npts_in,double s_istart,bool);
|
||||
/// MSK144 end///////////////
|
||||
|
||||
//double minval_da_beg_to_end(double*a,int a_beg,int a_end);
|
||||
/// MSK40 ///////////////
|
||||
typedef struct
|
||||
{
|
||||
int hash;
|
||||
QString calls;
|
||||
}
|
||||
call_;
|
||||
call_ hash_msk40_calls[HASH_CALLS_COUNT];
|
||||
QString recent_calls[RECENT_CALLS_COU];
|
||||
void update_recent_calls(QString call);
|
||||
bool check_hash_msk40(int hash_in,int rpt,QString &msg);
|
||||
//bool isValidCallsign(QString callsign);//2.00
|
||||
//QString FindBaseFullCallRemAllSlash(QString str);//2.00
|
||||
void hash_msk40_all_calls(int id, QString calls);
|
||||
bool check_hash_msk40_swl(int hash_in,int rpt,QString &msg);
|
||||
void hash_msk40_swl();
|
||||
QString recent_shmsgs[RECENT_SHMSGS_COU];
|
||||
bool update_recent_shmsgs(QString message);
|
||||
/*typedef struct
|
||||
{
|
||||
call_ hash_calls[6];
|
||||
}
|
||||
call_h40;
|
||||
call_h40 hash_msk40_rpt[32];*/
|
||||
|
||||
//int ig_msk32_[4096][24]; //integer ig(0:23,0:4095)
|
||||
//int nhashes_msk32[32];
|
||||
char s_msk40_2s8r[8];
|
||||
double pp_msk40[12];
|
||||
double rcw_msk40[12];
|
||||
double complex cbr_msk40[42];
|
||||
bool f_first_msk40;
|
||||
double dt_msk40;
|
||||
double fs_msk40;
|
||||
//double df_msk40; //problem zavisi ot NFFT a toi se promenia
|
||||
void first_msk40();
|
||||
int ihlo_msk40;
|
||||
int ihhi_msk40;
|
||||
int illo_msk40;
|
||||
int ilhi_msk40;
|
||||
int i2000_msk40;
|
||||
int i4000_msk40;
|
||||
int last_ntol_msk40;
|
||||
double last_df_msk40;
|
||||
void dftool_msk40(int ntol, double nrxfreq,double df);
|
||||
//int minloc_da_beg_to_end(double*a,int a_beg,int a_end);
|
||||
void detectmsk40(double complex *cdat,int npts,double s_istart);
|
||||
///rtd MSK40///////////////
|
||||
void msk40decodeframe_p(double complex *c,double *softbits,double xsnr,QString &msgreceived,int &nsuccess,char &ident,double phase0);
|
||||
void msk40decodeframe(double complex *ct,double *softbits,double xsnr,QString &msg, int &nsuccess,char &ident,bool f_phase); //hv
|
||||
void msk40sync(double complex *cdat,int nframes,int ntol,double delf,int *navmask,int npeaks,double fc,double &fest,int *npklocs,int &nsuccess,double complex *c);
|
||||
void msk40spd(double complex *cdat,int np,int &nsuccess,QString &msgreceived,double fc,double &fest,double &tdec,char &ident,int &navg,double complex *ct,double *softbits);
|
||||
void msk40_freq_search(double complex *cdat,double fc,int if1,int if2,double delf,int nframes,
|
||||
int *navmask,double &xmax,double &bestf,double complex *cs,double *xccs);//double complex *cdat2,
|
||||
///rtd MSK40///////////////
|
||||
/// MSK40 end///////////////
|
||||
|
||||
/// JTMSK ///////////////
|
||||
/// JTMS ///////////////
|
||||
double jtms_dfx;
|
||||
double complex cwb_jtms[56];
|
||||
double complex cw_jtms_[64][56];
|
||||
void setupms();
|
||||
double dot_product_da_da(double *a, double *b,int size,int offset_b);
|
||||
void hipass(double*y,int y_begin,int npts,int nwidth);
|
||||
double msdf(double complex *,int,int,int,double,int,int,int);
|
||||
int syncms(double complex *cdat,int npts,double complex *cwb,double *r);
|
||||
int lenms(double *r,int npts);
|
||||
void decodems(double complex *cdat,int npts,double complex cww_[64][56],int i1,int nchar,double s2_[400][64],char*msg);
|
||||
void foldms(double s2_[400][64],int msglen,int nchar,char *msg);
|
||||
void jtms(double*,int c_begin,int,int DFTol,double,int,int,int,bool pick,bool &f_only_one_color,int &disp_lines_dec_cou);
|
||||
/// JTMS ///////////////
|
||||
/// FSK441 ///////////////
|
||||
int only1_s_mode;
|
||||
short itone_s_fsk[84];
|
||||
int ndits_s;
|
||||
int noffset_fsk441_dfx;
|
||||
double complex cfrag_s[2100];
|
||||
double spec441(double*raw_in,int raw_in_c_begin,int count_in,double*ps);
|
||||
QString longx(double*raw_in,int raw_begin,int count_in,double*ps,int DFTol,int &msglen,double bauderr,int mode);
|
||||
double max_4double(double,double,double,double);
|
||||
int min_3int(int,int,int);
|
||||
void detect(double*data,int data_begin,int npts,double f,double*y,int mode);
|
||||
int sync(double*y1,double*y2,double*y3,double*y4,int npts,/*double baud,double &bauderr,*/int mode);
|
||||
double max_3double(double,double,double);
|
||||
int abc441(char*msg,int count_msg,short *itone);
|
||||
void gen441(short *itone,int ndits,double complex *cfrag,int mode);
|
||||
void smo(double*x,int x_begin,int npts,double*y,double nadd);
|
||||
int chk441(double *dat,int jz,double tstart,double width,int nfreeze,int mousedf,
|
||||
int dftolerance,bool pick,int mode,double &dfx_real_hv);
|
||||
/// FSK441 /////////////////
|
||||
///// JT6M /////////////////////////////////
|
||||
//double complex c[1024*1024];
|
||||
void syncf0(double *data,int jz,int NFreeze,int NTol,int &jstart,double &f0);
|
||||
void add_da_da_to_da(double *a,double *b,double *c,int n);
|
||||
void add_da2_da_to_da2(double a_[6][128],double *b,double c_[6][128],int begin,int row,int n);
|
||||
void add_da_da2_to_da(double *a,double b_[646][44],int b_row,double *c,int n);
|
||||
void add_da2_da2_to_da2(double a_[646][44],int j,double b_[53][44],int k,double c_[53][44],int kk,int n);// hv v1.01 23 to 53
|
||||
void move_da2_to_da2(double x_[646][44],int j,double y_[646][44],int k,int n);
|
||||
void synct(double *data,int jz,int &jstart,double f0);
|
||||
void syncf1(double*data,int jz,int jstart,double &f0,int NFreeze,int DFTol,double*red);
|
||||
double max_2double(double,double);
|
||||
void decode6m(double *data,int d_start,int jz,int minSigdb,int NFixLen,double f0);//int npkept,double*yellow);
|
||||
void avemsg6m(double s2db_[646][44],int nz,int nslim,int NFixLen,double f0,bool);//,int npkept
|
||||
void wsjt1_jt6m(double*,int,double);
|
||||
///// JT6M /////////////////////////////////
|
||||
///// ISCAT /////////////////////////////////
|
||||
//double s0_[5601][289];
|
||||
//double s01_[289][5601];
|
||||
//double savg[289];
|
||||
int ana932(double *dat,int jz,double complex *cdat);
|
||||
void synciscat(double complex*cdat,int npts,double s0_[5601][289],int &jsym,int DFTolerance,
|
||||
int mode4,double &xsync,double &sig,int &ndf0,int &msglen,
|
||||
int &ipk,int &jpk,int &idf);
|
||||
/*int mousebutton,int nafc,double &df1*/
|
||||
void iscat(double complex*cdat0,int npts0,double t2,bool pick,int MinSigdB,int DFTolerance,int mode4);
|
||||
/*int mousebutton,int nafc,int nmore*/
|
||||
void wsjt1_iscat(double *dat,int count,int mode4,bool pick);
|
||||
///// ISCAT /////////////////////////////////
|
||||
|
||||
///// JT65ABC /////////////////////////////////
|
||||
//QString App_Path;
|
||||
int s_aggres_lev_ftd;
|
||||
int s_aggres_lev_deeps;
|
||||
QStringList db_call_loc4_list;
|
||||
double s_nfqso_all;
|
||||
double s_f00;
|
||||
double s_f01;
|
||||
bool clearave_jt65;
|
||||
bool s_avg_jt65;
|
||||
bool s_deep_search_jt65;
|
||||
//void SetDepthAvg65(int);
|
||||
Gen65 *TGen65;
|
||||
double width_jt65;
|
||||
int nsave_jt65;
|
||||
bool first_symspec65;
|
||||
double thresh0_jt65;
|
||||
double ref_jt65[3413];
|
||||
double dfref_jt65;
|
||||
double w_symspec65[8192];
|
||||
double s1_jt65_[126][512+40];
|
||||
int s1_ofs_jt65;
|
||||
double s3a_jt65_[63][64];
|
||||
int mrs_jt65[63];
|
||||
int mrs2_jt65[63];
|
||||
int param_jt65[10]; // integer param(0:9)
|
||||
int nsum_jt65;
|
||||
int s_max65_cand_for_dec;
|
||||
|
||||
/// avg ////
|
||||
bool first_avg65;
|
||||
int iutc_jt65[64];
|
||||
int nfsave_jt65[64];
|
||||
double dtdiff_jt65;
|
||||
double s1save_jt65_[64][126][512+40]; //double s1save(-255:256,126,MAXAVE)
|
||||
double s3save_jt65_[64][63][64]; //real s3save(64,63,MAXAVE)
|
||||
double syncsave_jt65[64];
|
||||
double dtsave_jt65[64];
|
||||
int nflipsave_jt65[64];
|
||||
char cused_jt65[64];
|
||||
int iused_jt65[64];
|
||||
char csync_jt65;
|
||||
int count_saved_avgs_1jt65;
|
||||
int count_saved_avgs_2jt65;
|
||||
int count_use_avgs_1jt65;
|
||||
int count_use_avgs_2jt65;
|
||||
//int count_saved_avgs_jt65;
|
||||
/// end avg ///
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double freq;
|
||||
double dt;
|
||||
double sync;
|
||||
double flip;
|
||||
}
|
||||
candidate_jt65;
|
||||
|
||||
double complex cw_jt65[721000];// 60*12000+40
|
||||
bool first_subtract65;
|
||||
int correct_jt65[63];
|
||||
bool s_bVHF_jt65;
|
||||
//AP jt65
|
||||
QString mycall0_jt65ap;
|
||||
QString theircall0_jt65ap;
|
||||
QString theirgrid0_jt65ap;
|
||||
int apsymbols_jt65[8][14];
|
||||
void hint65(double s3_[63][64],int nadd,int nflip,QString mycall,QString theircall,
|
||||
QString theirgrid,double &qual,QString &decoded);
|
||||
void subtract65(double *dd,int npts,double f0,double dt);
|
||||
void getpp_(int *workdat,float &p);
|
||||
void ftrsd2_ap(int *mrsym, int *mrprob, int *mr2sym, int *mr2prob,
|
||||
bool f_ap_d,int *ap,int ntrials0, int *correct, int *param, int *ntry);
|
||||
void chkhist(int *mrsym,int &nmax,int &ipk);
|
||||
void demod64a(double s3_[63][64],int nadd,int *mrsym,int *mrprob,
|
||||
int *mr2sym,int *mr2prob,int &ntest,int &nlow);
|
||||
void extract(double s3_[63][64],int nadd,int mode65,int ntrials,int naggressive,
|
||||
bool f_deep_search,int nflip,QString mycall_12,QString theircall_12,QString theirgrid,
|
||||
int &ncount,int &nhist,QString &decoded,bool <ext,int &nft,double &qual,int nQSOProgress,bool ljt65apon);
|
||||
void decode65b(double s2_[126][66],int nflip,int nadd,int mode65,int ntrials,int naggressive,bool f_deep_search,
|
||||
QString mycall,QString theircall,QString theirgrid,int nqd,int &nft,double &qual,
|
||||
int &nhist,QString &decoded,int nQSOProgress,bool ljt65apon);
|
||||
void smo121(double *x,int beg,int nz);
|
||||
void twkfreq65(double complex *c4aa,int n5,double *a);
|
||||
void ccf2(double *ss,int nz,int nflip,double &ccfbest,double &xlagpk);
|
||||
double fchisq65(double complex *cx,int npts,double fsample,int nflip,double *a,double &ccfmax,double &dtmax);
|
||||
void afc65b(double complex *cx,int npts,double fsample,int nflip,double *a,double &ccfbest,double &dtbest);
|
||||
//void afc65b(double complex *cx,int npts,double fsample,int nflip,int mod65,double *a,double &ccfbest,double &dtbest);
|
||||
void fil6521(double complex *c1,int n1,double complex *c2,int &n2);
|
||||
void sh65snr(double *x,int beg,int nz,double &snr);
|
||||
void sh65(double complex *cx,int n5,int mode65,int ntol,double &xdf,int &nspecial,double &snrdb,double &nstest);
|
||||
void filbig(double *dd,int npts,double f0,bool &newdat,double complex *c4a,int &n4,double &sq0);
|
||||
void decode65a(double *dd,int npts,bool &first_time,int nqd,double freq,int &nflip,
|
||||
int mode65,int nvec,int naggressive,bool f_deep_search,int ntol,QString mycall,QString theircall,
|
||||
QString theirgrid,bool bVHF,double &sync2,double *a,double &dtx,int &nft,int &nspecial,
|
||||
double &qual,int nsmo,QString &decoded,double &nstestn,int nQSOProgress,bool ljt65apon);
|
||||
void fqso_first(double nfqso,int ntol,candidate_jt65 *ca,int ncand);
|
||||
void slope(double *y,int beg, int npts,double xpk);
|
||||
void xcor(double ss_[3413][642],int ipk,int nsteps,int nsym,int lag1,int lag2,double *ccf,
|
||||
double &ccf0,int &lagpk,double &flip,double fdot,int nrobust);
|
||||
void sync65(double ss_[3413][642],double nfa,double nfb,/*int naggressive,int ntol,*/
|
||||
int nhsym,candidate_jt65 *ca,int &ncand,int nrobust,bool bVHF);
|
||||
double fchisq0(double *y,int npts,double *a);
|
||||
void lorentzian(double *y,int npts,double *a);
|
||||
void flat65(double ss_[3413][642],int nhsym,int NSZ,double *ref);
|
||||
void symspec65(double *dd,int npts,double ss_[3413][642],int &nhsym,double *savg);
|
||||
void avg65(int nutc,int &nsave,double snrsync,double dtxx,int nflip,int nfreq,int mode65,int ntol,
|
||||
bool f_deep_search,bool nagain,int ntrials,int naggressive,int neme,QString mycall,
|
||||
QString theircall,QString theirgrid,int &nftt,QString &avemsg,double &qave,QString &deepave,
|
||||
int &nsum,int ndeepave,int nQSOProgress,bool ljt65apon);
|
||||
//void SetRxFreq65(double);
|
||||
void jt65_decode(double *dat,int dat_count,int mode65);
|
||||
///// END JT65ABC /////////////////////////////////
|
||||
|
||||
///// single sync JT65ABC /////////////////////////////////
|
||||
//void sync65_single(double ss_[3413][552],double nfa,double nfb,int nhsym,double &dtx,double &dfx,
|
||||
//double &snrx,double &snrsync,double &flip,/*double &width,*/double *savg,int mode65);
|
||||
void sync65_single(double ss_[3413][642],double nfa,double nfb,int nhsym,double &dtx,double &dfx,
|
||||
double &snrx,double &snrsync,double &flip,/*double &width,*/double *savg,int mode65,int nrob);//1.52+nrob
|
||||
///// emd single sync JT65ABC /////////////////////////////////
|
||||
|
||||
/////////// PI4 ///////////////////////////////////////////////////////////
|
||||
int count_use_avgs_pi4;
|
||||
int count_saved_avgs_pi4;
|
||||
bool clearave_pi4;
|
||||
bool first_pi4;
|
||||
int nsave_pi4;
|
||||
QString blank_pi4;
|
||||
int iutc_pi4[64];
|
||||
bool first_avgpi4;
|
||||
double nfsave_pi4[64];
|
||||
double dtdiff_pi4;
|
||||
double ppsave_pi4_[64][207];
|
||||
double rsymbol_pi4_[207];
|
||||
double dtsave_pi4[64];
|
||||
double syncsave_pi4[64];
|
||||
double flipsave_pi4[64];
|
||||
int iused_pi4[64];
|
||||
char cused_pi4[64];
|
||||
double nfreq0_pi4;
|
||||
bool first_xcorpi4;
|
||||
double pr2_pi4[207];
|
||||
bool first_extractpi4;
|
||||
int ndelta_pi4;
|
||||
int off_mettab_pi4; //130
|
||||
int mettab_pi4_[2][270];//(-128:127,0:1)
|
||||
bool first_interleavepi4;
|
||||
int j0_pi4[207];//(0:205)
|
||||
int ich1_pi4;
|
||||
int ich2_pi4;
|
||||
int nutc0_pi4;
|
||||
void fano232(char *symbol,int beg,int nbits,int maxcycles,unsigned char *dat,int &ncycles,int &ierr);
|
||||
void interleavepi4(char *id,int beg,int ndir);
|
||||
void getmetpi4();
|
||||
void extractpi4(double *sym0,int &ncount,QString &decoded);
|
||||
void decodepi4(double *dat,int npts,double dtx,double nfreq/*,double flip*/,int mode4,
|
||||
QString &decoded,int &nfano);
|
||||
void xcorpi4(double s2_[770][1260],int ipk,int nsteps,int nsym,int lag1,int lag2,int mode4,
|
||||
double *ccf,double &ccf0,int &lagpk,double &flip);
|
||||
void smo_pi4(double*x,int x_begin,int npts,double*y,double nadd);
|
||||
void flat1b(double *psavg,int nsmo,double s2_[770][1260],int nh,int nsteps);
|
||||
void pspi4(double *dat,int beg,int nfft,double *s);
|
||||
void syncpi4(double *dat,int jz,int ntol,int NFreeze,int MouseDF,int mode,int mode4,
|
||||
double &dtx,double &dfx,double &snrx,double &snrsync,double *ccfblue,double *ccfred1,
|
||||
double &flip,double &width/*,double *ps0*/);
|
||||
void print_msgpi4(int nsync,int nsnr,double dtx,int df,int width,QString decoded,QString csync,QString cflags,int nfreq);
|
||||
void avgpi4(int nutc,double snrsync,double dtxx,double flip,double nfreq,int ntol,
|
||||
QString &avemsg/*,double &qave*/,int &nfanoave);
|
||||
void mshvpi4(double *dat,int jz2,int nutc,int minsync,int ntol,
|
||||
int mode4,double nfqso,int ndepth/*,int neme*/);
|
||||
//void resample_12_6(double *d2,int &npts,double *dd);
|
||||
void lpf1(double *dd,int jz,double *dat,int &jz2);
|
||||
void pi4_decode(double *dd,int npts);
|
||||
///////////END PI4 ///////////////////////////////////////////////////////////
|
||||
|
||||
/////////// FT8 ///////////////////////////////////////////////////////////
|
||||
bool s_lapon;
|
||||
int s_nQSOProgress;
|
||||
//bool f_multi_answer_mod;//for ap mam ft8;
|
||||
double s_nftx;
|
||||
//int s_ncontest_ft8_2;
|
||||
QString TheirGridLoc; // in SetCalsHash decodermsk40
|
||||
QString s_R1TheirCall; //for fr8 MA QSO Foxs in SetCalsHash decodermsk40
|
||||
QString s_R2TheirCall; //for fr8 MA QSO Foxs in SetCalsHash decodermsk40
|
||||
|
||||
DecoderFt8 *DecFt8_0;
|
||||
DecoderFt8 *DecFt8_1;
|
||||
DecoderFt8 *DecFt8_2;
|
||||
DecoderFt8 *DecFt8_3;
|
||||
DecoderFt8 *DecFt8_4;
|
||||
DecoderFt8 *DecFt8_5;
|
||||
///////////END FT8 ///////////////////////////////////////////////////////////
|
||||
/////////// FT4 ///////////////////////////////////////////////////////////
|
||||
DecoderFt4 *DecFt4_0;
|
||||
DecoderFt4 *DecFt4_1;
|
||||
DecoderFt4 *DecFt4_2;
|
||||
DecoderFt4 *DecFt4_3;
|
||||
DecoderFt4 *DecFt4_4;
|
||||
DecoderFt4 *DecFt4_5;
|
||||
/////////// FT4 end ///////////////////////////////////////////////////////////
|
||||
|
||||
void TryEndThr();
|
||||
void StrtDec0();
|
||||
void StrtDec1();
|
||||
void StrtDec2();
|
||||
void StrtDec3();
|
||||
void StrtDec4();
|
||||
void StrtDec5();
|
||||
void StrtDecode();
|
||||
|
||||
bool allq65;
|
||||
DecoderQ65 *DecQ65;
|
||||
|
||||
protected:
|
||||
bool thred_busy;
|
||||
int s_static_dat_count;
|
||||
double s_in_istart;
|
||||
int s_mousebutton;
|
||||
QString s_time;
|
||||
//double raw_in_s1[STATIC_DAT_COUNT];
|
||||
short raw_in_s[STATIC_DAT_COUNT];
|
||||
double static_dat0[STATIC_DAT_COUNT];
|
||||
double static_dat1[190000];//15,8s
|
||||
double static_dat2[190000];//15,8s
|
||||
double static_dat3[190000];//15,8s
|
||||
double static_dat4[190000];//15,8s
|
||||
double static_dat5[190000];//15,8s
|
||||
|
||||
bool fromBufFt;
|
||||
int id3decFt;
|
||||
int c_stat_ftb[2];
|
||||
bool is_stat_ftb[2];
|
||||
int s_mousebftb[2];
|
||||
QString s_timeftb[2];
|
||||
bool s_fopenftb[2];
|
||||
short stat_1ftb[190000];//15,8s
|
||||
short stat_2ftb[190000];//15,8s
|
||||
bool is_ftBuff;
|
||||
void SETftBuff();
|
||||
|
||||
void CalcZapDat();
|
||||
int s_zap_count;
|
||||
short s_zap_in[STATIC_DAT_COUNT];
|
||||
double s_zap_dat[STATIC_DAT_COUNT];
|
||||
|
||||
pthread_t th0;
|
||||
static void *ThrDec0(void *);
|
||||
pthread_t th1;
|
||||
static void *ThrDec1(void *);
|
||||
pthread_t th2;
|
||||
static void *ThrDec2(void *);
|
||||
pthread_t th3;
|
||||
static void *ThrDec3(void *);
|
||||
pthread_t th4;
|
||||
static void *ThrDec4(void *);
|
||||
pthread_t th5;
|
||||
static void *ThrDec5(void *);
|
||||
pthread_t th;
|
||||
static void *ThreadDecode(void *);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
2826
src/HvDecoderMs/decodermsk144.cpp
Normal file
1848
src/HvDecoderMs/decodermsk40.cpp
Normal file
1864
src/HvDecoderMs/decoderpi4.cpp
Normal file
1945
src/HvDecoderMs/decoderpom.cpp
Normal file
111
src/HvDecoderMs/decoderpom.h
Normal file
@ -0,0 +1,111 @@
|
||||
/* MSHV decoderpom
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef DECODERPOM_H
|
||||
#define DECODERPOM_H
|
||||
|
||||
#include <complex.h>
|
||||
#define complex _Complex
|
||||
#include "../Hv_Lib_fftw/fftw3.h"
|
||||
#define NPMAX 100
|
||||
class HvThr
|
||||
{
|
||||
public:
|
||||
void four2a_c2c(double complex *a,double complex *a1,fftw_plan *pc,int &cpc,int nfft,int isign,int iform);
|
||||
void four2a_d2c(double complex *a,double complex *a1,double *d,double *d1,fftw_plan *pd,int &cpd,
|
||||
int nfft,int isign,int iform);
|
||||
void DestroyPlans(fftw_plan *pc,int &cpc,fftw_plan *pd,int &cpd,bool imid);
|
||||
private:
|
||||
int nn_c2c[NPMAX+10];
|
||||
int ns_c2c[NPMAX+10];
|
||||
int nf_c2c[NPMAX+10];
|
||||
int nn_d2c[NPMAX+10];
|
||||
int ns_d2c[NPMAX+10];
|
||||
int nf_d2c[NPMAX+10];
|
||||
};
|
||||
class F2a
|
||||
{
|
||||
public:
|
||||
void four2a_c2c(double complex *a,int nfft,int isign,int iform,int thr = 0);
|
||||
void four2a_d2c(double complex *a,double *d,int nfft,int isign,int iform,int thr = 0);
|
||||
void DestroyPlansAll(bool imid);
|
||||
private:
|
||||
HvThr HvThr0;
|
||||
HvThr HvThr1;
|
||||
HvThr HvThr2;
|
||||
HvThr HvThr3;
|
||||
HvThr HvThr4;
|
||||
HvThr HvThr5;
|
||||
};
|
||||
|
||||
#include <QString>//2.61
|
||||
class PomAll
|
||||
{
|
||||
public:
|
||||
void initPomAll();
|
||||
double peakup(double ym,double y0,double yp);
|
||||
double maxval_da_beg_to_end(double*a,int a_beg,int a_end);
|
||||
int maxloc_da_end_to_beg(double*a,int a_beg,int a_end);
|
||||
//int minloc_da(double *da,int count);
|
||||
double db(double x);
|
||||
void polyfit(double*x,double*y,double*sigmay,int npts,int nterms,int mode,double*a,double &chisqr);
|
||||
void zero_double_beg_end(double*,int begin,int end);
|
||||
double pctile_shell(double *yellow,int nblks,int npct);
|
||||
int maxloc_da_beg_to_end(double*a,int a_beg,int a_end);
|
||||
void zero_double_comp_beg_end(double complex*,int begin,int end);
|
||||
double ps_hv(double complex z);
|
||||
void cshift1(double complex *a,int cou_a,int ish);
|
||||
double complex sum_dca_mplay_conj_dca(double complex *a,int a_beg,int a_end,double complex *b);
|
||||
void indexx_msk(double *arr,int n,int *indx);
|
||||
bool isStandardCall(QString);//2.61 same as MultiAnswerModW
|
||||
//bool isStandardCall(char*,int);
|
||||
private:
|
||||
double pctile_shell_tmp[141122];//141072+50
|
||||
void shell(int n,double*a);
|
||||
double determ(double array_[10][10],int norder);
|
||||
//bool is_digit(char c);
|
||||
//bool is_letter(char c);
|
||||
};
|
||||
|
||||
class PomFt
|
||||
{
|
||||
public:
|
||||
void initPomFt();
|
||||
void nuttal_window(double *win,int n);
|
||||
void normalizebmet(double *bmet,int n);
|
||||
void twkfreq1(double complex *ca,int npts,double fsample,double *a,double complex *cb);
|
||||
|
||||
void decode174_91(double *llr,int maxosd,int norder,bool *apmask,bool *message91,bool *cw,int &nharderror,double &dmin);//ntype,//int Keff,
|
||||
|
||||
//void bpdecode174_91(double *llr,bool *apmask,int maxiterations,bool *decoded77,bool *cw,int &nharderror);
|
||||
//void osd174_91(double *llr,bool *apmask,int ndeep,bool *message77,bool *cw,int &nhardmin,double &dmin);
|
||||
private:
|
||||
PomAll pomAll;
|
||||
double twopi;
|
||||
double pi;
|
||||
//short crc14(unsigned char const * data, int length);
|
||||
void platanh(double x, double &y);
|
||||
//void chkcrc14a(bool *decoded,int &nbadcrc);
|
||||
int indexes_ft8_2_[2][5020];//5000+20
|
||||
int fp_ft8_2[525020];//525000+20
|
||||
int np_ft8_2[5020];//5000+20
|
||||
void boxit91(bool &reset,bool *e2,int ntau,int npindex,int i1,int i2);
|
||||
int lastpat_ft8_2;
|
||||
int inext_ft8_2;
|
||||
void fetchit91(bool &reset,bool *e2,int ntau,int &i1,int &i2);
|
||||
bool any_ca_iand_ca_eq1_91(bool *a,bool *b,int count);
|
||||
void nextpat_step1_91(bool *mi,int k,int iorder,int &iflag);
|
||||
void mrbencode91(bool *me,bool *codeword,bool g2_[91][174],int N,int K);
|
||||
|
||||
void bshift1(bool *a,int cou_a,int ish);
|
||||
void get_crc14(bool *mc,int len,int &ncrc);
|
||||
bool first_osd174_91;
|
||||
//N=174, K=91, M=N-K=83
|
||||
char gen_osd174_91_[180][97];//integer*1 gen(K,N) out from array +3
|
||||
bool first_enc174_91_nocrc;
|
||||
char gen_osd174_91_nocrc[100][95];//gen(M,K) [100][95];//91 83
|
||||
void encode174_91_nocrc(bool *message910,bool *codeword);
|
||||
void osd174_91_1(double *llr,/*int Keff=91*/bool *apmask,int ndeep,bool *message91,bool *cw,int &nhardmin,double &dmin);
|
||||
};
|
||||
#endif
|
2638
src/HvDecoderMs/decoderq65.cpp
Normal file
161
src/HvDecoderMs/decoderq65.h
Normal file
@ -0,0 +1,161 @@
|
||||
/* The algorithms, source code, look-and-feel of WSJT-X and related
|
||||
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
|
||||
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
|
||||
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
|
||||
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
|
||||
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
|
||||
* and other members of the WSJT Development Group.
|
||||
*
|
||||
* MSHV Q65 Decoder
|
||||
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2021
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#ifndef DECODERQ65_H
|
||||
#define DECODERQ65_H
|
||||
|
||||
#include <QObject>
|
||||
#include <complex.h>
|
||||
#define complex _Complex
|
||||
#include "../Hv_Lib_fftw/fftw3.h"
|
||||
#include "../HvMsPlayer/libsound/HvGenQ65/gen_q65.h"
|
||||
#include "../HvMsPlayer/libsound/HvGenQ65/q65_subs.h"
|
||||
#include "decoderpom.h"
|
||||
|
||||
#define MAX_NCW 206
|
||||
|
||||
class DecoderQ65 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DecoderQ65();
|
||||
~DecoderQ65();
|
||||
|
||||
void SetStMultiAnswerMod(bool);
|
||||
void SetPeriod(int);
|
||||
void SetStDecoderDeep(int);
|
||||
void SetStWords(QString,QString,int,int);
|
||||
void SetStTheirCallGrid(QString c,QString g);
|
||||
void SetStDecode(QString,int);
|
||||
void SetStQSOProgress(int);
|
||||
void AutoClrAvgChanged(bool);
|
||||
void AvgDecodeChanged(bool);
|
||||
void SetSingleDecQ65(bool);
|
||||
void SetClearAvgQ65();
|
||||
void SetClearAvgQ65all();
|
||||
void SetTxFreq(double);
|
||||
void SetDecAftEMEDelay(bool);
|
||||
void q65_decode(double *dd,double f0a,double f0b,double fqso,int,bool &hdec);
|
||||
void SetStApDecode(bool);
|
||||
void SetMaxDrift(bool);
|
||||
|
||||
signals:
|
||||
void EmitDecodetText(QStringList);//bool
|
||||
void EmitBackColor();
|
||||
void EmitAvgSavesQ65(int,int);
|
||||
|
||||
private:
|
||||
F2a f2a;
|
||||
PomAll pomAll;
|
||||
GenQ65 *TGenQ65;
|
||||
q65subs q65S;
|
||||
|
||||
QString decoded;
|
||||
QString s_time;
|
||||
int s_ntrperiod;
|
||||
int s_ndepth;
|
||||
QString s_mycall;
|
||||
QString s_theircall;
|
||||
QString s_theirgrid;
|
||||
int ibwa,ibwb;
|
||||
double nfa,nfb;
|
||||
int npasses;
|
||||
int s_mousebutton;
|
||||
int s_nQSOprogress;
|
||||
bool f_clravg_after_decode;
|
||||
bool f_averaging;
|
||||
bool f_single_decode;
|
||||
bool lclearave;
|
||||
double nftx;
|
||||
bool f_emedelay;
|
||||
int s_cont_id;
|
||||
int s_cont_type;
|
||||
int s_maxiters;
|
||||
bool s_lapon;
|
||||
bool f_multi_answer_modq65;
|
||||
|
||||
void q65_clravg();
|
||||
double s1raw_[800][7000];
|
||||
void q65_snr(int *dat4,double dtdec,double f0dec,int mode_q65,double &snr2);//int nused,
|
||||
void PrintMsg(QString tmm,double snrr,double dtt,int dff,QString mss,int frqq,QString,QString,
|
||||
bool &bgc,bool &havdd);
|
||||
bool isgrid4_rr73(QString s);
|
||||
int nhist;
|
||||
int nf0[105];
|
||||
QString msg[105];
|
||||
void q65_hist(int if0,QString msg0,QString &dxcall,QString &dxgrid);//,bool f
|
||||
int ncw;
|
||||
int codewords_[MAX_NCW+5][86];//63 integer codewords(63,MAX_NCW)
|
||||
int codewords_1da[14000];//MAX_NCW*63=12978
|
||||
void q65_set_list(QString,QString,QString);
|
||||
void smo121(double *x,int beg,int nz); // from jt65
|
||||
void q65_symspec(double *iwave,int iz,int jz,double s1_[800][7000]);
|
||||
void q65_ccf_85(double s1_[800][7000],int iz,int jz,double nfqso,int ia,int ia2,
|
||||
int &ipk,int &jpk,double &f0,double &xdt/*,int &imsg_best*/,double &better/*,double *ccf1*/);
|
||||
int fmaxloc_da_beg_to_end(float*a,int a_beg,int a_end);
|
||||
int imaxval_da_beg_to_end(int*a,int a_beg,int a_end);
|
||||
void q65_bzap(float *s3,int LL);
|
||||
void q65_s1_to_s3(double s1_[800][7000],int iz,int jz,int ipk,int jpk,int LL,
|
||||
float *s3_1df);
|
||||
void SetArrayBits(int in,int in_bits,bool *ar,int &co);
|
||||
void q65_dec1(float *s3_1fa,int nsubmode,float b90ts,float &esnodb,int &irc,
|
||||
int *dat4,QString &decoded);
|
||||
void q65_dec_q3(double s1_[800][7000],int iz,int jz,float *s3_1df,int LL,
|
||||
int ipk,int jpk,double &snr2,int *dat4,int &idec,QString &decoded);
|
||||
int ncand;
|
||||
double candidates_[2][20];
|
||||
int max_drift;
|
||||
bool f_max_drift;
|
||||
double drift;
|
||||
double f0nd;
|
||||
double xdtnd;
|
||||
void q65_ccf_22(double s1_[800][7000],int iz,int jz,double nfqso,int iavg,int &ipk,int &jpk,
|
||||
double &f0,double &xdt); /*,double *ccf2*/
|
||||
//void q65_sync_curve(double *ccf1,int ia,int ib,double &rms1);
|
||||
int BinToInt32(bool*a,int b_a,int bits_sz);
|
||||
void q65_dec2(float *s3_1fa,int nsubmode,float b90ts,float &esnodb,int &irc,int *dat4);
|
||||
int apmask[20];//13
|
||||
int apsymbols[20];//13
|
||||
int apsym0[68];//58
|
||||
bool apmask1[80];//78
|
||||
bool apsymbols1[80];//78
|
||||
int ncontest0;
|
||||
int mcq_q65[30];//29
|
||||
void q65_ap(int nQSOprogress,int ipass,int,int,bool lapcqonly,int &iaptype,int *,bool *,bool *);
|
||||
void q65_dec_q012(float *s3_1fa,double &snr2,int *dat4,int &idec,int,int,int);
|
||||
|
||||
void ana64(double *iwave,int,double complex *c0);
|
||||
void q65apset(QString mycall12,QString theircall12,int *apsym2);
|
||||
void twkfreq(double complex *c3,double complex *c4,int npts,double fsample,double *a);
|
||||
void spec64(double complex *c0,int nsps,int jpk,float *s3,int LL,int NN);
|
||||
void q65_loops(double complex *c00,int npts2,int nsps2,int nsubmode,int ndepth,int jpk0,
|
||||
double xdt0,double f0,int iaptype,double &xdt1,double &f1,double &snr2,int *dat4,int &idec,bool);
|
||||
|
||||
bool lnewdat;
|
||||
int nsmo;
|
||||
int mode_q65;
|
||||
int nsps;
|
||||
int istep;
|
||||
double df;
|
||||
double sync[90];//=85
|
||||
int iseq;
|
||||
int LL0,iz0,jz0;
|
||||
int lag1,lag2;
|
||||
int i0,j0;
|
||||
double dtstep;
|
||||
int navg[2];//integer navg(0:1)
|
||||
double s1a_[2][800][7000];//s1a(iz,jz,0:1) = iz =6666 jz=733
|
||||
void q65_dec0(int iavg,double *iwave,double nfqso,
|
||||
bool &lclearave,bool emedelay,double &xdt,double &f0,double &snr1,
|
||||
int *dat4,double &snr2,int &idec,int,int,int,int);
|
||||
};
|
||||
#endif
|
27
src/HvDecoderMs/ft_all_ap_def.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __FT_ALL_AP_DEF_H__
|
||||
#define __FT_ALL_AP_DEF_H_
|
||||
|
||||
static const bool mcq_ft[8][29]=
|
||||
{
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, //0=CQ
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0}, //1=CQ RU
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0}, //2=CQ FD
|
||||
{0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,1,0}, //3=CQ TEST
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0}, //4=CQ WW
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0}, //5=CQ BU
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0}, //6=CQ FT
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,1,0,0}, //7=CQ PDC
|
||||
};
|
||||
static const bool mrrr_ft[19]=
|
||||
{
|
||||
0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1
|
||||
};
|
||||
static const bool m73_ft[19]=
|
||||
{
|
||||
0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1
|
||||
};
|
||||
static const bool mrr73_ft[19]=
|
||||
{
|
||||
0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1
|
||||
};
|
||||
#endif // __FT_ALL_AP_DEF_H_ 2.66 from int to bool
|
106
src/HvHelpMs/hvhelpms.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/* MSHV HelpMs
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvhelpms.h"
|
||||
#include <QIcon>
|
||||
#include <QTextBrowser>
|
||||
|
||||
HvHelpMs::HvHelpMs(QString title,QString app_name,QString path,int lid,int x,int y,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
//setFixedSize(700,500);//1.30 800x513pix
|
||||
//this->setFixedWidth(750);
|
||||
//setMinimumWidth(750);
|
||||
setMinimumSize(790,525);
|
||||
//this->setMinimumHeight(450);//1.30 800x513pix
|
||||
//setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);// otva e da go ima
|
||||
setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint &~ Qt::WindowContextHelpButtonHint);
|
||||
|
||||
//setWindowIcon(QPixmap(":pic_main/icon_sdr.png"));
|
||||
setWindowIcon(QPixmap(":pic/ms_ico.png"));
|
||||
setWindowTitle(title+" "+app_name);
|
||||
QTextBrowser *text_browser = new QTextBrowser();
|
||||
text_browser->setReadOnly(true);
|
||||
|
||||
//QUrl
|
||||
//text_browser->setFixedSize(this->width(), this->height());
|
||||
|
||||
QLabel *lab_title;
|
||||
lab_title = new QLabel();
|
||||
lab_title->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||
lab_title->setOpenExternalLinks(true);
|
||||
lab_title->setText(app_name+"<br><a href=\"mailto:lz2hv@abv.bg\">lz2hv@abv.bg</a>"+" & "+"<a href=\"http://lz2hv.org/mshv\">MSHV Web Site</a>");
|
||||
lab_title->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
/*QPixmap pixmap1(":pic/en_press.png");
|
||||
QPixmap pixmap2(":pic/en_release.png");
|
||||
Bt_En = new HvButton_Left2(this);
|
||||
Bt_En->SetupButton_hv(pixmap2, pixmap1, 0, 0);
|
||||
connect(Bt_En, SIGNAL(Release_Lift_Button_hv()), this, SLOT(SetText_en()));
|
||||
QPixmap pixmap3(":pic/bg_press.png");
|
||||
QPixmap pixmap4(":pic/bg_release.png");
|
||||
Bt_Bg = new HvButton_Left2(this);
|
||||
Bt_Bg->SetupButton_hv(pixmap4, pixmap3, 0, 0);
|
||||
connect(Bt_Bg, SIGNAL(Release_Lift_Button_hv()), this, SLOT(SetText_bg()));*/
|
||||
QHBoxLayout *layout_h = new QHBoxLayout();
|
||||
layout_h->setContentsMargins ( 0, 0, 0, 0);
|
||||
layout_h->setAlignment(Qt::AlignCenter);
|
||||
layout_h->setSpacing(40);
|
||||
//layout_h->addWidget(Bt_En);
|
||||
layout_h->addWidget(lab_title);
|
||||
//layout_h->addWidget(Bt_Bg);
|
||||
|
||||
QVBoxLayout *layout_v = new QVBoxLayout();
|
||||
layout_v->setContentsMargins ( 4, 4, 4, 4);
|
||||
this->setLayout(layout_v);
|
||||
layout_v->addLayout(layout_h);
|
||||
layout_v->addWidget(text_browser);
|
||||
|
||||
//setStyleSheet("QTextBrowser { background: rgb(60, 60, 60); }");
|
||||
|
||||
//url_hv = new QUrl();
|
||||
|
||||
//if (lid==0 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));
|
||||
if (lid==1 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));
|
||||
else if (lid==2 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/ru/help_ru.html"));
|
||||
/*else if (lid==3 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//ZH
|
||||
else if (lid==4 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//ZHHK
|
||||
else if (lid==5 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//ESES
|
||||
else if (lid==6 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//CAES
|
||||
else if (lid==7 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//PTPT
|
||||
else if (lid==8 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//RORO
|
||||
else if (lid==9 ) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//DADK
|
||||
else if (lid==10) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//PLPL
|
||||
else if (lid==11) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//FRFR
|
||||
else if (lid==12) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//PTBR
|
||||
else if (lid==13) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//NBNO
|
||||
else if (lid==14) text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//ITIT
|
||||
*/
|
||||
else text_browser->setSource(QUrl::fromLocalFile(path + "/settings/resources/url_help/en/help_en.html"));//any other
|
||||
|
||||
move(x,y);
|
||||
}
|
||||
HvHelpMs::~HvHelpMs()
|
||||
{}
|
||||
void HvHelpMs::SetPosXY(QString s)
|
||||
{
|
||||
QStringList list_s = s.split("#");
|
||||
if(list_s.count()==2)
|
||||
{
|
||||
move(list_s[0].toInt(),list_s[1].toInt());
|
||||
}
|
||||
}
|
||||
/*
|
||||
void HvHelpMs::SetText_en()
|
||||
{
|
||||
QString path;// = (QCoreApplication::applicationDirPath());
|
||||
text_browser->setSource(QUrl::fromLocalFile(path + "/Resources/url_help/help_en.html"));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void HvHelpMs::SetText_bg()
|
||||
{
|
||||
text_browser->setSource(QUrl::fromLocalFile(":url/help_bg.html"));
|
||||
}
|
||||
*/
|
48
src/HvHelpMs/hvhelpms.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVHELPMS_H
|
||||
#define HVHELPMS_H
|
||||
|
||||
#include <QWidget>
|
||||
//#include <QDialog>
|
||||
//#include <QDesktopWidget>
|
||||
//#include <QApplication>
|
||||
//#include <QIcon>
|
||||
//#include <QTextBrowser>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
//#include "../HvButtons/hvbutton_left2.h"
|
||||
//#include <QUrl>
|
||||
|
||||
class HvHelpMs : public QWidget
|
||||
{
|
||||
//Q_OBJECT //2.65 <- for tr() Q_OBJECT
|
||||
public:
|
||||
HvHelpMs(QString title,QString app_name,QString path,int lid,int,int,QWidget *parent = 0);
|
||||
virtual ~HvHelpMs();
|
||||
|
||||
public:
|
||||
QString GetPosXY()
|
||||
{
|
||||
return QString("%1").arg(pos().x())+"#"+QString("%1").arg(pos().y());
|
||||
}
|
||||
void SetPosXY(QString);
|
||||
|
||||
//private slots:
|
||||
//void SetText_en();
|
||||
//void SetText_bg();
|
||||
|
||||
//private:
|
||||
//QTextBrowser *text_browser;
|
||||
//QUrl *url_hv;
|
||||
//HvButton_Left2 *Bt_En;
|
||||
//HvButton_Left2 *Bt_Bg;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
101
src/HvHelpSkMs/hvhelpskms.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/* MSHV HelpSkMs
|
||||
* Copyright 2015 Hrisimir Hristov, LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
#include "hvhelpskms.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
//#include <QDesktopWidget>
|
||||
//#include <QApplication>
|
||||
#include <QIcon>
|
||||
//#include <QByteArray>
|
||||
|
||||
#undef _MOUNTH_H_
|
||||
#define _SHKY_H_
|
||||
#include "../config_str_sk.h"
|
||||
|
||||
//#include <QTextBrowser>
|
||||
//#include <QTextTable>
|
||||
|
||||
//#include <QtGui>
|
||||
|
||||
HvHelpSkMs::HvHelpSkMs(QString title,QString app_name,int lid,int x,int y,QWidget *parent )
|
||||
: QWidget(parent)
|
||||
{
|
||||
//setMinimumSize(190,280);
|
||||
setWindowTitle(title+" "+app_name);
|
||||
//setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||
setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint &~ Qt::WindowContextHelpButtonHint);
|
||||
setWindowIcon(QPixmap(":pic/ms_ico.png"));
|
||||
//setFixedSize(412,432);// setFixedSize(410,420);
|
||||
|
||||
move(x,y);
|
||||
|
||||
/*QHBoxLayout *lv_h1 = new QHBoxLayout();
|
||||
QLabel *l_helpw1 = new QLabel;
|
||||
QLabel *l_helpw2 = new QLabel;
|
||||
QString s1;
|
||||
QString s2;
|
||||
for (int i = 0; i<COUNT_SK; ++i)
|
||||
{
|
||||
s1.append(ShKey[lid][i][0]+"\n");
|
||||
s2.append(ShKey[lid][i][1]+"\n");
|
||||
}
|
||||
l_helpw1->setText(s1);
|
||||
l_helpw2->setText(s2);
|
||||
QVBoxLayout *la_helpw1 = new QVBoxLayout();
|
||||
la_helpw1->setContentsMargins ( 1, 1, 1, 1);
|
||||
la_helpw1->addWidget(l_helpw1);
|
||||
la_helpw1->setAlignment(l_helpw1,Qt::AlignLeft);
|
||||
QVBoxLayout *la_helpw2 = new QVBoxLayout();
|
||||
la_helpw2->setContentsMargins ( 1, 1, 1, 1);
|
||||
la_helpw2->addWidget(l_helpw2);
|
||||
la_helpw2->setAlignment(l_helpw2,Qt::AlignLeft);
|
||||
lv_h1->addLayout(la_helpw1);
|
||||
lv_h1->addLayout(la_helpw2);*/
|
||||
|
||||
QVBoxLayout *lv_h1 = new QVBoxLayout();
|
||||
lv_h1->setContentsMargins(10,10,10,10);
|
||||
lv_h1->setSpacing(1);
|
||||
|
||||
for (int i = 0; i<COUNT_SK; ++i)
|
||||
{
|
||||
QLabel *l_t1 = new QLabel;
|
||||
QLabel *l_t2 = new QLabel;
|
||||
QHBoxLayout *lh_h1 = new QHBoxLayout();
|
||||
lh_h1->setContentsMargins(0,0,0,0);
|
||||
lh_h1->setSpacing(1);
|
||||
l_t1->setText(ShKey[lid][i][0]);
|
||||
l_t1->setFixedWidth(100);
|
||||
l_t2->setText(ShKey[lid][i][1]);
|
||||
lh_h1->addWidget(l_t1);
|
||||
//lh_h1->setAlignment(l_t1,Qt::AlignLeft);
|
||||
lh_h1->addWidget(l_t2);
|
||||
//lh_h1->setAlignment(l_t2,Qt::AlignCenter);
|
||||
//lh_h1->setAlignment(Qt::AlignHCenter);
|
||||
lv_h1->addLayout(lh_h1);
|
||||
}
|
||||
|
||||
/*QTextBrowser *TBStatistic = new QTextBrowser();
|
||||
TBStatistic->setReadOnly(true);
|
||||
lv_h1->addWidget(TBStatistic);
|
||||
QTextCursor cursor(TBStatistic->textCursor());
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QTextTableFormat tableFormat;
|
||||
tableFormat.setBorder(0);
|
||||
tableFormat.setCellPadding(0);
|
||||
tableFormat.setCellSpacing(0);
|
||||
tableFormat.setWidth(QTextLength(QTextLength::PercentageLength,100));
|
||||
QTextTable *table = cursor.insertTable(COUNT_SK,2,tableFormat);
|
||||
for (int i = 0; i<COUNT_SK; ++i)
|
||||
{
|
||||
table->cellAt(i,0).firstCursorPosition().insertText(ShKey[lid][i][0]);
|
||||
table->cellAt(i,1).firstCursorPosition().insertText(ShKey[lid][i][1]);
|
||||
}*/
|
||||
|
||||
//lv_h1->setAlignment(Qt::AlignTop);
|
||||
setLayout(lv_h1);
|
||||
}
|
||||
HvHelpSkMs::~HvHelpSkMs()
|
||||
{}
|
44
src/HvHelpSkMs/hvhelpskms.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* MSHV
|
||||
*
|
||||
* By Hrisimir Hristov - LZ2HV
|
||||
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifndef HVHELPSKMS_H
|
||||
#define HVHELPSKMS_H
|
||||
|
||||
#include <QWidget>
|
||||
//#include <QDialog>
|
||||
//#include <QVBoxLayout>
|
||||
//#include <QLabel>
|
||||
//#include <QDesktopWidget>
|
||||
//#include <QApplication>
|
||||
//#include <QIcon>
|
||||
//#include <QByteArray>
|
||||
//#include <QPixmap>
|
||||
//#include <QtGui>
|
||||
|
||||
class HvHelpSkMs : public QWidget
|
||||
{
|
||||
//Q_OBJECT //2.65 <- for tr() Q_OBJECT
|
||||
public:
|
||||
HvHelpSkMs(QString title,QString app_name, int lid,int,int,QWidget *parent = 0);
|
||||
virtual ~HvHelpSkMs();
|
||||
|
||||
//public slots:
|
||||
//void
|
||||
|
||||
|
||||
//private slots:
|
||||
//void SetText_en();
|
||||
//void SetText_bg();
|
||||
|
||||
//private:
|
||||
//QTextBrowser *text_browser;
|
||||
//QUrl *url_hv;
|
||||
//HvButton_Left2 *Bt_En;
|
||||
//HvButton_Left2 *Bt_Bg;
|
||||
|
||||
|
||||
};
|
||||
#endif
|