Merged master 8748

This commit is contained in:
Jordan Sherer
2018-08-05 11:33:30 -04:00
parent 8f8772f1bd
commit 62899069bf
1095 changed files with 31298 additions and 367679 deletions
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>wf_palette_design_dialog</class>
<widget class="QDialog" name="wf_palette_design_dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>219</width>
<height>209</height>
</rect>
</property>
<property name="windowTitle">
<string>Palette Designer</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="colour_table_widget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Double click a color to edit it.&lt;/p&gt;&lt;p&gt;Right click to insert or delete colors.&lt;/p&gt;&lt;p&gt;Colors at the top represent weak signals&lt;/p&gt;&lt;p&gt;and colors at the bottom represent strong&lt;/p&gt;&lt;p&gt;signals. You can have up to 256 colors.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="columnCount">
<number>1</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column/>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="button_box">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>button_box</sender>
<signal>accepted()</signal>
<receiver>wf_palette_design_dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>button_box</sender>
<signal>rejected()</signal>
<receiver>wf_palette_design_dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -1,49 +0,0 @@
/*
* Reads an ADIF log file into memory
* Searches log for call, band and mode
* VK3ACF July 2013
*/
#ifndef __ADIF_H
#define __ADIF_H
#if defined (QT5)
#include <QList>
#include <QString>
#include <QMultiHash>
#else
#include <QtGui>
#endif
class QDateTime;
class ADIF
{
public:
void init(QString const& filename);
void load();
void add(QString const& call, QString const& band, QString const& mode, QString const& date);
bool match(QString const& call, QString const& band, QString const& mode) const;
QList<QString> getCallList() const;
int getCount() const;
// open ADIF file and append the QSO details. Return true on success
bool addQSOToFile(QString const& hisCall, QString const& hisGrid, QString const& mode, QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn, QDateTime const& dateTimeOff, QString const& band,
QString const& comments, QString const& name, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid, QString const& m_txPower);
private:
struct QSO
{
QString call,band,mode,date;
};
QMultiHash<QString, QSO> _data;
QString _filename;
QString extractField(QString const& line, QString const& fieldName) const;
};
#endif
@@ -1,237 +0,0 @@
#include "CyclesOfGraph.h"
NodesOfGraph::NodesOfGraph(void) { parityConnections=NULL;symbolConnections=NULL;
}
NodesOfGraph::~NodesOfGraph(void) {
delete [] parityConnections;
delete [] symbolConnections;
delete [] symbolMapping;
}
void NodesOfGraph::setParityConnections(int num, int *value) {
numOfParityConnections=num;
parityConnections=new int[num];
for(int i=0;i<numOfParityConnections;i++){
parityConnections[i]=value[i];
//cout<<parityConnections[i]<<" ";
}
//cout<<endl;
}
void NodesOfGraph::setSymbolConnections(int num, int *value) {
numOfSymbolConnections=num;
symbolConnections=new int[num];
for(int i=0;i<numOfSymbolConnections;i++){
symbolConnections[i]=value[i];
//cout<<symbolConnections[i]<<" ";
}
//cout<<endl;
}
void NodesOfGraph::setSymbolMapping(int num, int *value) {
numOfSymbolMapping=num;
//cout<<num<<endl;
symbolMapping=new int[num];
for(int i=0;i<numOfSymbolMapping;i++){
symbolMapping[i]=value[i];
//cout<<symbolMapping[i]<<" ";
}
//cout<<endl;
}
CyclesOfGraph::CyclesOfGraph(int mm, int n, int *(*h)){
int i, j, k, m, index;
M=mm;
N=n;
H=h;
tmp=new int [N];
med=new int [N];
tmpCycles=new int [N];
cyclesTable=new int [N];
nodesOfGraph=new NodesOfGraph [N];
//cout<<M<<" "<<N<<endl;
/*
for(i=0;i<M;i++){
for(j=0;j<N;j++)
cout<<H[i][j]<<" ";
cout<<endl;
}
*/
for(i=0;i<N;i++){
index=0;
for(j=0;j<M;j++){
if(H[j][i]==1){
tmp[index]=j;
index++;
}
}
nodesOfGraph[i].setSymbolConnections(index, tmp);
}
for(i=0;i<M;i++){
index=0;
for(j=0;j<N;j++){
if(H[i][j]==1){
tmp[index]=j;
index++;
}
}
nodesOfGraph[i].setParityConnections(index, tmp);
}
for(i=0;i<N;i++){
index=0;
for(j=0;j<nodesOfGraph[i].numOfSymbolConnections;j++){
for(k=0;k<nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].numOfParityConnections;k++){
int t=0;
for(m=0;m<index;m++){
if(nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].parityConnections[k]==tmp[m]){
t=1; break;
}
}
if(nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].parityConnections[k]==i) t=1;
if(t==0) {
tmp[index]=nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].parityConnections[k];
index++;
}
}
}
nodesOfGraph[i].setSymbolMapping(index, tmp);
}
}
CyclesOfGraph::~CyclesOfGraph(void){
delete [] tmp;
tmp=NULL;
delete [] med;
med=NULL;
delete [] tmpCycles;
tmpCycles=NULL;
delete [] cyclesTable;
cyclesTable=NULL;
delete [] nodesOfGraph;
nodesOfGraph=NULL;
}
void CyclesOfGraph::getCyclesTable(void) {
int i, j, k, m, n, t, imed;
for(i=0;i<N;i++){
//special handlement for nodes having only one or zero connections
if(nodesOfGraph[i].numOfSymbolConnections<=1) {
cyclesTable[i]=2*N;
continue;
}
for(j=0;j<nodesOfGraph[i].numOfSymbolConnections-1;j++){ //-1 because the graph is undirected
for(k=0;k<nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].numOfParityConnections;k++){
tmp[k]=nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].parityConnections[k];
//cout<<tmp[k]<<" ";
}
//cout<<endl;
int cycles=2;
int index=nodesOfGraph[nodesOfGraph[i].symbolConnections[j]].numOfParityConnections;
LOOP:
imed=0;
for(k=0;k<index;k++){
if(tmp[k]==i) continue;
//cout<<"k="<<k<<" "<<tmp[k]<<endl;
for(m=0;m<nodesOfGraph[tmp[k]].numOfSymbolConnections;m++){
for(n=0;n<nodesOfGraph[i].numOfSymbolConnections;n++){
if((n!=j)&&(nodesOfGraph[tmp[k]].symbolConnections[m]==nodesOfGraph[i].symbolConnections[n])){
cycles+=2;
goto OUTLOOP;
}
}
}
for(m=0;m<nodesOfGraph[tmp[k]].numOfSymbolMapping;m++){
t=0;
for(int l=0;l<imed;l++) {
if(nodesOfGraph[tmp[k]].symbolMapping[m]==med[l]){
t=1; break;
}
}
if(t==0){
med[imed]=nodesOfGraph[tmp[k]].symbolMapping[m];
//cout<<med[imed]<<endl;
imed++;
}
}
}
index=imed;//cout<<index<<" "<<endl;
for(k=0;k<index;k++) {
tmp[k]=med[k];//cout<<tmp[k]<<" ";
}
//cout<<"j="<<j<<endl;
cycles+=2;
if(cycles>=2*N) //dead lock
goto OUTLOOP;
else
goto LOOP;
OUTLOOP:
tmpCycles[j]=cycles;
}
//for(j=0;j<nodesOfGraph[i].numOfSymbolConnections-1;j++) cout<<tmpCycles[j]<<" ";
//cout<<endl;
cyclesTable[i]=tmpCycles[0];
for(j=1;j<nodesOfGraph[i].numOfSymbolConnections-1;j++){
if(cyclesTable[i]>tmpCycles[j])
cyclesTable[i]=tmpCycles[j];
}
//OUTPUT cycles per symbol node
//cout<<"i="<<i<<" "<<cyclesTable[i]<<endl;
}
}
int CyclesOfGraph::girth(void) {
int girth=2*N;
for(int i=0;i<N;i++)
if(girth>cyclesTable[i]) girth=cyclesTable[i];
return(girth);
}
void CyclesOfGraph::printCyclesTable(void){
using namespace std;
int i, temp[20];
/*
for(i=0;i<N;i++)
cout<<cyclesTable[i]<<" ";
cout<<endl;
*/
for(i=0;i<20;i++) temp[i]=0;
for(i=0;i<N;i++){
if(cyclesTable[i]==4) temp[0]++;
else if(cyclesTable[i]==6) temp[1]++;
else if(cyclesTable[i]==8) temp[2]++;
else if(cyclesTable[i]==10) temp[3]++;
else if(cyclesTable[i]==12) temp[4]++;
else if(cyclesTable[i]==14) temp[5]++;
else if(cyclesTable[i]==16) temp[6]++;
else if(cyclesTable[i]==18) temp[7]++;
else if(cyclesTable[i]==20) temp[8]++;
else if(cyclesTable[i]==22) temp[9]++;
else if(cyclesTable[i]==24) temp[10]++;
else if(cyclesTable[i]==26) temp[11]++;
else if(cyclesTable[i]==28) temp[12]++;
else if(cyclesTable[i]==30) temp[13]++;
else {
cout<<"Wrong cycles calculation "<<cyclesTable[i]<<endl;
exit(-1);
}
}
cout<<endl;
cout<<"Num of Nodes with local girth 4: "<< temp[0]<<endl;
cout<<"Num of Nodes with local girth 6: "<< temp[1]<<endl;
cout<<"Num of Nodes with local girth 8: "<< temp[2]<<endl;
cout<<"Num of Nodes with local girth 10: "<< temp[3]<<endl;
cout<<"Num of Nodes with local girth 12: "<< temp[4]<<endl;
cout<<"Num of Nodes with local girth 14: "<< temp[5]<<endl;
cout<<"Num of Nodes with local girth 16: "<< temp[6]<<endl;
cout<<"Num of Nodes with local girth 18: "<< temp[7]<<endl;
cout<<"Num of Nodes with local girth 20: "<< temp[8]<<endl;
cout<<"Num of Nodes with local girth 22: "<< temp[9]<<endl;
cout<<"Num of Nodes with local girth 24: "<< temp[10]<<endl;
cout<<"Num of Nodes with local girth 26: "<< temp[11]<<endl;
cout<<"Num of Nodes with local girth 28: "<< temp[12]<<endl;
cout<<"Num of Nodes with local girth 30: "<< temp[13]<<endl;
}
@@ -1,35 +0,0 @@
/*
* Reads cty.dat file
* Establishes a map between prefixes and their country names
* VK3ACF July 2013
*/
#ifndef __COUNTRYDAT_H
#define __COUNTRYDAT_H
#include <QString>
#include <QStringList>
#include <QHash>
class CountryDat
{
public:
void init(const QString filename);
void load();
QString find(QString prefix) const; // return country name or ""
QStringList getCountryNames() const { return _countryNames; };
private:
QString _extractName(const QString line) const;
void _removeBrackets(QString &line, const QString a, const QString b) const;
QStringList _extractPrefix(QString &line, bool &more) const;
QString _filename;
QStringList _countryNames;
QHash<QString, QString> _data;
};
#endif
@@ -1,147 +0,0 @@
/* MOD2SPARSE.H - Interface to module for handling sparse mod2 matrices. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
/* This module implements operations on sparse matrices of mod2 elements
(bits, with addition and multiplication being done modulo 2).
All procedures in this module display an error message on standard
error and terminate the program if passed an invalid argument (indicative
of a programming error), or if memory cannot be allocated. Errors from
invalid contents of a file result in an error code being returned to the
caller, with no message being printed by this module.
*/
/* DATA STRUCTURES USED TO STORE A SPARSE MATRIX. Non-zero entries (ie, 1s)
are represented by nodes that are doubly-linked both by row and by column,
with the headers for these lists being kept in arrays. Nodes are allocated
in blocks to reduce time and space overhead. Freed nodes are kept for
reuse in the same matrix, rather than being freed for other uses, except
that they are all freed when the matrix is cleared to all zeros by the
mod2sparse_clear procedure, or copied into by mod2sparse_copy.
Direct access to these structures should be avoided except in low-level
routines. Use the macros and procedures defined below instead. */
typedef struct mod2entry /* Structure representing a non-zero entry, or
the header for a row or column */
{
int row, col; /* Row and column indexes of this entry, starting
at 0, and with -1 for a row or column header */
struct mod2entry *left, *right, /* Pointers to entries adjacent in row */
*up, *down; /* and column, or to headers. Free */
/* entries are linked by 'left'. */
double pr, lr; /* Probability and likelihood ratios - not used */
/* by the mod2sparse module itself */
} mod2entry;
#define Mod2sparse_block 10 /* Number of entries to block together for
memory allocation */
typedef struct mod2block /* Block of entries allocated all at once */
{
struct mod2block *next; /* Next block that has been allocated */
mod2entry entry[Mod2sparse_block]; /* Entries in this block */
} mod2block;
typedef struct /* Representation of a sparse matrix */
{
int n_rows; /* Number of rows in the matrix */
int n_cols; /* Number of columns in the matrix */
mod2entry *rows; /* Pointer to array of row headers */
mod2entry *cols; /* Pointer to array of column headers */
mod2block *blocks; /* Blocks that have been allocated */
mod2entry *next_free; /* Next free entry */
} mod2sparse;
/* MACROS TO GET AT ELEMENTS OF A SPARSE MATRIX. The 'first', 'last', 'next',
and 'prev' macros traverse the elements in a row or column. Moving past
the first/last element gets one to a header element, which can be identified
using the 'at_end' macro. Macros also exist for finding out the row
and column of an entry, and for finding out the dimensions of a matrix. */
#define mod2sparse_first_in_row(m,i) ((m)->rows[i].right) /* Find the first */
#define mod2sparse_first_in_col(m,j) ((m)->cols[j].down) /* or last entry in */
#define mod2sparse_last_in_row(m,i) ((m)->rows[i].left) /* a row or column */
#define mod2sparse_last_in_col(m,j) ((m)->cols[j].up)
#define mod2sparse_next_in_row(e) ((e)->right) /* Move from one entry to */
#define mod2sparse_next_in_col(e) ((e)->down) /* another in any of the four */
#define mod2sparse_prev_in_row(e) ((e)->left) /* possible directions */
#define mod2sparse_prev_in_col(e) ((e)->up)
#define mod2sparse_at_end(e) ((e)->row<0) /* See if we've reached the end */
#define mod2sparse_row(e) ((e)->row) /* Find out the row or column index */
#define mod2sparse_col(e) ((e)->col) /* of an entry (indexes start at 0) */
#define mod2sparse_rows(m) ((m)->n_rows) /* Get the number of rows or columns*/
#define mod2sparse_cols(m) ((m)->n_cols) /* in a matrix */
/* POSSIBLE LU DECOMPOSITION STRATEGIES. For use with mod2sparse_decomp. */
typedef enum
{ Mod2sparse_first,
Mod2sparse_mincol,
Mod2sparse_minprod
} mod2sparse_strategy;
/* PROCEDURES TO MANIPULATE SPARSE MATRICES. */
mod2sparse *mod2sparse_allocate (int, int);
void mod2sparse_free (mod2sparse *);
void mod2sparse_clear (mod2sparse *);
void mod2sparse_copy (mod2sparse *, mod2sparse *);
void mod2sparse_copyrows (mod2sparse *, mod2sparse *, int *);
void mod2sparse_copycols (mod2sparse *, mod2sparse *, int *);
void mod2sparse_print (FILE *, mod2sparse *);
int mod2sparse_write (FILE *, mod2sparse *);
mod2sparse *mod2sparse_read (FILE *);
mod2entry *mod2sparse_find (mod2sparse *, int, int);
mod2entry *mod2sparse_insert (mod2sparse *, int, int);
void mod2sparse_delete (mod2sparse *, mod2entry *);
void mod2sparse_transpose (mod2sparse *, mod2sparse *);
void mod2sparse_add (mod2sparse *, mod2sparse *, mod2sparse *);
void mod2sparse_multiply (mod2sparse *, mod2sparse *, mod2sparse *);
void mod2sparse_mulvec (mod2sparse *, char *, char *);
int mod2sparse_equal (mod2sparse *, mod2sparse *);
int mod2sparse_count_row (mod2sparse *, int);
int mod2sparse_count_col (mod2sparse *, int);
void mod2sparse_add_row (mod2sparse *, int, mod2sparse *, int);
void mod2sparse_add_col (mod2sparse *, int, mod2sparse *, int);
int mod2sparse_decomp (mod2sparse *, int, mod2sparse *, mod2sparse *,
int *, int *, mod2sparse_strategy, int, int);
int mod2sparse_forward_sub (mod2sparse *, int *, char *, char *);
int mod2sparse_backward_sub (mod2sparse *, int *, char *, char *);