KLog 0.9.8 started

This commit is contained in:
jaime 2019-04-06 08:56:00 +00:00
parent 568af2bb67
commit 91dfded1b0
15 changed files with 730 additions and 41 deletions

View File

@ -1,11 +1,16 @@
March - 0.9.7.2
TBD - 0.9.7.3
- TODO: Remove the band 0 / Light from the DB.
- UI: KLog warns the user if the frequency used is out of the hamradio bands.
- Reworked how freqs and bands are managed.
March 2019 - 0.9.7.2
- Bugfix: Frequency boxes did not accepted frequencies higher than 99.999 MHz. (TNX KB2YSI)
March - 0.9.7.1
March 2019 - 0.9.7.1
- Bugfix: The frequency was not properly saved in the DB. (TNX KB2YSI)
- Bugfix: The QSO_DATE was not exported into ADIF. (TNX KB2YSI)
March - 0.9.7
March 2019 - 0.9.7
- Bugfix: When clicking on Check updates, the dialog froze.
- Bugfix: Printing log is not longer showing band in the mode column.
- Updated the default date on date boxes to the current date.

View File

@ -2,7 +2,7 @@ CONFIG += app_bundle
CONFIG += static
#CONFIG += release
TEMPLATE = app
VERSION = 0.9.7.2
VERSION = 0.9.8
DEFINES += APP_VERSION="$$VERSION"
APP_NAME = KLog
@ -24,6 +24,7 @@ QT += core \
gui \
sql \
network \
serialport \
widgets
greaterThan(QT_MAJOR_VERSION, 4) {
@ -100,7 +101,8 @@ HEADERS += setupdialog.h \
charts/statssentconfirmedpiechartwidget.h \
charts/statsqsosperbandbarchartwidget.h \
setuppagesats.h \
setuppagesatsnew.h
setuppagesatsnew.h \
setuppagehamlib.h
SOURCES += main.cpp \
@ -165,7 +167,8 @@ SOURCES += main.cpp \
charts/statssentconfirmedpiechartwidget.cpp \
charts/statsqsosperbandbarchartwidget.cpp \
setuppagesats.cpp \
setuppagesatsnew.cpp
setuppagesatsnew.cpp \
setuppagehamlib.cpp
OTHER_FILES += \
@ -248,6 +251,7 @@ unix:!mac {
datafiles.files = $$DISTFILES
INSTALLS += translations
INSTALLS += datafiles
LIBS += -lhamlib
}

View File

@ -986,7 +986,7 @@ int DataBase::getBandIdFromName(const QString b)
{
queryErrorManagement(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().number(), query.lastQuery());
query.finish();
return -1;
return -2;
}
//qDebug() << "DataBase::getBandIdFromName: NOK 3" << endl;
}
@ -995,7 +995,7 @@ int DataBase::getBandIdFromName(const QString b)
//qDebug() << "DataBase::getBandIdFromName: BAND NOT VALID: " << b << endl;
}
query.finish();
return -1;
return -3;
}
int DataBase::getModeIdFromName(const QString b)

View File

@ -128,6 +128,7 @@ QString DataProxy::getBandNameFromFreq(const double _n)
return QString();
}
double DataProxy::getLowLimitBandFromBandName(const QString _sm)
{
return -1.0;

View File

@ -65,6 +65,7 @@ public:
virtual QString getFreqFromBandId(const int _id);
virtual int getBandIdFromFreq(const double _n);
virtual QString getBandNameFromFreq(const double _n);
virtual double getLowLimitBandFromBandName(const QString _sm);
virtual double getLowLimitBandFromBandId(const QString _sm);
virtual bool isThisFreqInBand(const QString b, const QString fr);

View File

@ -78,6 +78,7 @@ public:
QString getFreqFromBandId(const int _id);
int getBandIdFromFreq(const double _n);
QString getBandNameFromFreq(const double _n);
double getLowLimitBandFromBandName(const QString _sm);
double getLowLimitBandFromBandId(const QString _sm);
bool isThisFreqInBand(const QString _band, const QString _fr);

View File

@ -31,7 +31,7 @@
int main(int argc, char *argv[])
{
QString version = "0.9.7.2" ;
QString version = "0.9.8" ;
QDir d1 = QDir();
Utilities util = Utilities();
QStringList arguments;

View File

@ -84,6 +84,7 @@ MainWindow::MainWindow(const QString _klogDir, const QString tversion)
noMoreModeErrorShown = false;
qslingNeeded = false; // When clicking on Find QSO to QSL
manageMode = false;
txFreqBeingChanged = false;
selectedYear = 0;
defaultMode = 1;
defaultBand = 1;
@ -747,7 +748,7 @@ void MainWindow::slotModeComboBoxChanged()
}
void MainWindow::slotBandComboBoxChanged(){
//qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << bandComboBox->currentText()<< endl;
qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << "/" << bandComboBox->currentText()<< endl;
/*
int i;
i = dataProxy->getIdFromBandName(bandComboBox->currentText());
@ -757,8 +758,20 @@ void MainWindow::slotBandComboBoxChanged(){
//txFreqSpinBox->setValue(dataProxy->getFreqFromBandId(i));
}
*/
//qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << "/" << QString::number(currentBand) << endl;
if (txFreqBeingChanged)
{
qDebug() << "MainWindow::slotBandComboBoxChanged: txFreqBeingChanged" << endl;
return;
}
bool isFRinBand = dataProxy->isThisFreqInBand(bandComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if ((isFRinBand) && (txFreqSpinBox->value() >0 ))
{
qDebug() << "MainWindow::slotBandComboBoxChanged: idFRinBand and Freq >0" << endl;
return;
}
//qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << "/" << QString::number(currentBand) << endl;
//qDebug() << "MainWindow::slotBandComboBoxChanged: currentBandShown: " << QString::number(currentBandShown) << endl;
currentBandShown = dataProxy->getIdFromBandName(bandComboBox->currentText());
//qDebug() << "MainWindow::slotBandComboBoxChanged: currentBandShown2: " << QString::number(currentBandShown) << endl;
@ -775,12 +788,18 @@ void MainWindow::slotBandComboBoxChanged(){
//qDebug() << "MainWindow::MainWindow: 9.4 - currentBandShown: " << QString::number(currentBandShown) << endl;
//qDebug() << "MainWindow::MainWindow: Going to update the UpLink with: " << bandComboBox->currentText() << endl;
//satTabWidget->setUpLink(bandComboBox->currentText());
if (!dataProxy->isThisFreqInBand((dataProxy->getNameFromBandId(currentBandShown)), QString::number(txFreqSpinBox->value())))
{
double txFr = (dataProxy->getFreqFromBandId(currentBandShown)).toDouble();
satTabWidget->setUpLinkFreq(txFr);
//qDebug() << "MainWindow::slotBandComboBoxChanged Freq in txFreqSpinBox" << QString::number(txFreqSpinBox->value()) << endl;
//qDebug() << "MainWindow::slotBandComboBoxChanged: Band Shown: " << dataProxy->getNameFromBandId(currentBandShown) << endl;
// bool isFRinBand = dataProxy->isThisFreqInBand((dataProxy->getNameFromBandId(currentBandShown)), QString::number(txFreqSpinBox->value()));
qDebug() << "MainWindow::MainWindow: Freq: " << QString::number(txFreqSpinBox->value()) << endl;
if ((!isFRinBand) || (txFreqSpinBox->value()<=0))
{
double txFr = (dataProxy->getFreqFromBandId(currentBandShown)).toDouble();
//satTabWidget->setUpLinkFreq(txFr);
qDebug() << "MainWindow::slotBandComboBoxChanged updating txFreqSpinBox" << QString::number(txFr) << endl;
txFreqSpinBox->setValue(txFr);
}
qDebug() << "MainWindow::MainWindow: Freq2: " << QString::number(txFreqSpinBox->value()) << endl;
//currentModeShown = modeComboBox->currentIndex();
checkIfWorkedB4(currentQrz);
@ -791,6 +810,7 @@ void MainWindow::slotBandComboBoxChanged(){
showStatusOfDXCC(_qs);
qDebug() << "MainWindow::slotBandComboBoxChanged: END" << endl;
}
@ -3274,6 +3294,7 @@ void MainWindow::slotClearButtonClicked()
void MainWindow::clearUIDX(bool full)
{
qDebug() << "MainWindow::clearUIDX" << endl;
SRXLineEdit->setText("59");
STXLineEdit->setText("59");
nameLineEdit->clear();
@ -3290,7 +3311,7 @@ void MainWindow::clearUIDX(bool full)
myDataTabWidget->clear(keepMyData);
if (full)
{
txFreqSpinBox->setValue(0);
txFreqSpinBox->setValue((dataProxy->getFreqFromBandId(dataProxy->getIdFromBandName(bandComboBox->currentText()))).toDouble());
rxFreqSpinBox->setValue(0);
}
@ -7122,11 +7143,69 @@ void MainWindow::slotSatBandTXComboBoxChanged(const QString _q)
bandComboBox->setCurrentIndex(bandComboBox->findText(_q, Qt::MatchCaseSensitive));
//qDebugf() << "MainWindow::slotSatBandTXComboBoxChanged2: " << bandComboBox->currentText() << endl;
}
void MainWindow::updateBandComboBox(const QString _band)
{
//qDebug() << "MainWindow::updateBandComboBox: " << _band << endl;
if (bandComboBox->findText(_band, Qt::MatchCaseSensitive) < 0)
{// The selected frequency is of a band that is not currently selected
//qDebug() << "MainWindow::updateBandComboBox - New band found: " << _q << endl;
if (dataProxy->getIdFromBandName(_band) > 1)
{// Not affected if 0 (light) is the frequency
// In this case the user should select the band in the setup
//qDebug() << "MainWindow::updateBandComboBox- Band is valid: " << _q << endl;
QStringList qsTemp;
qsTemp.clear();
qsTemp << bands;
qsTemp << _band;
bands.clear();
bands << dataProxy->sortBandNamesBottonUp(qsTemp);
bandComboBox->clear();
bandComboBox->addItems(bands);
dxccStatusWidget->setBands(bands);
satTabWidget->addBands(bands);
//qDebug() << "MainWindow::updateBandComboBox - Band has been added!" << endl;
}
else
{
//qDebug() << "MainWindow::updateBandComboBox- (END) Band is NOT valid: " <<_band<< endl;
return;
}
}
//bandComboBox->setCurrentIndex(bandComboBox->findText(_band, Qt::MatchCaseSensitive));
//qDebug() << "MainWindow::updateBandComboBox- END" << endl;
}
void MainWindow::slotFreqTXChanged()
{
//qDebug() << "MainWindow::slotFreqTXChanged" << QString::number(txFreqSpinBox->value()) << endl;
//qDebug() << "MainWindow::slotFreqTXChanged" << QString::number(txFreqSpinBox->value()) << endl;
txFreqBeingChanged = true;
int bandId = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
if (bandId > 1)
{ // If the freq belongs to onne ham band
txFreqSpinBox->setPalette(palBlack);
txFreqSpinBox->setToolTip(tr("TX Frequency in MHz."));
bool freqInBand = dataProxy->isThisFreqInBand(bandComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindow::slotFreqTXChanged Freq is not in band" << endl;
QString _newBand = dataProxy->getBandNameFromFreq(txFreqSpinBox->value());
updateBandComboBox(_newBand);
bandComboBox->setCurrentIndex(bandComboBox->findText(_newBand, Qt::MatchCaseSensitive));
}
}
else
{
txFreqSpinBox->setToolTip(tr("TX Frequency in MHz.\nFrequency is not in a hamradio band!"));
txFreqSpinBox->setPalette(palRed);
//qDebug() << "MainWindow::slotFreqTXChanged Freq is not in ANY ham band" << endl;
}
satTabWidget->setUpLinkFreq(txFreqSpinBox->value());
txFreqBeingChanged = false;
//slotBandComboBoxChanged();
/*
QString _q;
int v = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
//if ((v<0) || (modify))
@ -7134,6 +7213,8 @@ void MainWindow::slotFreqTXChanged()
{
return;
}
satTabWidget->setUpLink(QString::number(txFreqSpinBox->value()));
_q = dataProxy->getNameFromBandId (v);
if (bandComboBox->findText(_q, Qt::MatchCaseSensitive) < 0)
@ -7165,10 +7246,37 @@ void MainWindow::slotFreqTXChanged()
//qDebug() << "MainWindow::slotFreqTXChanged - band1: " << bandComboBox->currentText() << endl;
bandComboBox->setCurrentIndex(bandComboBox->findText(_q, Qt::MatchCaseSensitive));
//qDebug() << "MainWindow::slotFreqTXChanged - band2: " << bandComboBox->currentText() << endl;
*/
}
void MainWindow::slotFreqRXChanged()
{
//qDebug() << "MainWindow::slotFreqRXChanged: " << QString::number(rxFreqSpinBox->value()) << endl;
int bandId = dataProxy->getBandIdFromFreq(rxFreqSpinBox->value());
if (bandId > 1)
{ // If the freq belongs to onne ham band
rxFreqSpinBox->setPalette(palBlack);
rxFreqSpinBox->setToolTip(tr("RX Frequency in MHz."));
bool freqInBand = dataProxy->isThisFreqInBand(bandComboBox->currentText(), QString::number(rxFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindow::slotFreqTXChanged Freq is not in band" << endl;
QString _newBand = dataProxy->getBandNameFromFreq(rxFreqSpinBox->value());
updateBandComboBox(_newBand);
//bandComboBox->setCurrentIndex(bandComboBox->findText(_newBand, Qt::MatchCaseSensitive));
}
}
else
{
rxFreqSpinBox->setPalette(palRed);
rxFreqSpinBox->setToolTip(tr("RX Frequency in MHz.\nFrequency is not in a hamradio band!"));
//qDebug() << "MainWindow::slotFreqTXChanged Freq is not in ANY ham band" << endl;
}
satTabWidget->setDownLinkFreq(rxFreqSpinBox->value());
//satTabWidget->setUpLinkFreq(txFreqSpinBox->value());
/*
QString _q;
int v = dataProxy->getBandIdFromFreq(rxFreqSpinBox->value());
@ -7194,7 +7302,8 @@ void MainWindow::slotFreqRXChanged()
//qDebug() << "MainWindow::slotFreqRXChanged: TX is there, no change" << endl;
//_q = dataProxy->getNameFromBandId (v);
}
//qDebug() << "MainWindow::slotFreqRXChanged: END" << endl;
*/
//qDebug() << "MainWindow::slotFreqRXChanged: END" << endl;
}
void MainWindow::slotShowQSOFromDXCCWidget(const int _q)
@ -7472,7 +7581,7 @@ void MainWindow::slotWSJXstatusFromUDPServer(const int _type, const QString _dxc
{
modeComboBox->setCurrentIndex(modeComboBox->findText(_mode, Qt::MatchCaseSensitive));
}
//qDebug() << "MainWindow::slotWSJXstatusFromUDPServer updating txFreqSpinBox" << QString::number(_freq) << endl;
txFreqSpinBox->setValue(_freq);
slotUpdateLocator(_dx_grid);
rstTXLineEdit->setText(_report);
@ -7580,6 +7689,7 @@ void MainWindow::slotSatChangeRXFreq(const double _f)
void MainWindow::slotSatChangeTXFreq(const double _f)
{
//qDebug() << "MainWindow::slotSatChangeTXFreq updating txFreqSpinBox" << QString::number(_f) << endl;
txFreqSpinBox->setValue(_f);
}

View File

@ -298,7 +298,7 @@ private slots:
private:
bool maybeSave();
void updateBandComboBox(const QString _band);
UpdateSatsData *updateSatsData;
//UPDATE CTY.DAT
DownLoadCTY *downloadcty;
@ -543,7 +543,7 @@ private:
//bool searchSelectAllClicked, stationCallSignShownInSearch;
bool checkNewVersions, reportInfo; // Selected in the Setup->Misc to check if new versions and report info back to KLog's servers
bool txFreqBeingChanged; // When the TX freq is being modified it is defined to true to prevent other automated to change.
bool qslingNeeded;
bool noMoreErrorShown; // If true, the errors shown in slotQueryErrorManagement will not be shown anymore in that KLog execution
bool noMoreModeErrorShown; // If true, the non-valid modes received from WSJT-x will not be showed to the user

View File

@ -50,6 +50,10 @@ MainWindowSatTab::MainWindowSatTab(DataProxy *dp, QWidget *parent) :
createUI();
populateSatComboBox();
txBandBeingChanged = false;
rxBandBeingChanged = false;
txFreqBeingAutoChanged = false;
rxFreqBeingAutoChanged = false;
satNameLineEdit->setEnabled(false);
satOtherLabel->setEnabled(false);
@ -68,8 +72,6 @@ void MainWindowSatTab::createUI()
connect(satBandRXComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotSatBandRXComboBoxChanged()) ) ;
connect(satBandTXComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotSatBandTXComboBoxChanged()) ) ;
connect(txFreqSpinBox, SIGNAL(valueChanged(double)), this, SLOT(slotSatFreqTXChanged()) ) ;
connect(rxFreqSpinBox, SIGNAL(valueChanged(double)), this, SLOT(slotSatFreqRXChanged()) ) ;
@ -466,19 +468,65 @@ void MainWindowSatTab::setDefaultBands()
void MainWindowSatTab::slotSatBandRXComboBoxChanged()
{
//qDebug() << "MainWindowsatTab::slotSatBandRXComboBoxChanged" << endl;
//qDebug() << "MainWindowsatTab::slotSatBandRXComboBoxChanged" << endl;
rxBandBeingChanged = true;
emit satBandRXChanged(satBandRXComboBox->currentText());
//qDebug() << "MainWindowsatTab::slotSatBandRXComboBoxChanged-END" << endl;
}
void MainWindowSatTab::slotSatBandTXComboBoxChanged()
{
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged" << endl;
emit satBandTXChanged(satBandTXComboBox->currentText());
}
void MainWindowSatTab::slotSatFreqRXChanged()
{
//qDebug() << "MainWindowsatTab::slotSatFreqRXChanged: " << QString::number(rxFreqSpinBox->value()) << endl;
// user changes RX Freq
// If band is real and band is configured, bandcombo is selected
// If band is real and not configured, we launch the band config and select the band.
// if band is real emit the band
// if (dataProxy->getBandIdFromFreq(rxFreqSpinBox->value())<1)
// { //This prevent that a non-hamradio frequency is used on TX
// //qDebug() << "MainWindowsatTab::slotSatFreqRXChanged: Not in band, exiting... - " << QString::number(dataProxy->getBandIdFromFreq(rxFreqSpinBox->value())) << endl;
// return;
// }
rxFreqBeingChanged = true;
int bandId = dataProxy->getBandIdFromFreq(rxFreqSpinBox->value());
//if (!rxFreqBeingAutoChanged)
//{
emit satRxFreqChanged(rxFreqSpinBox->value());
// rxFreqBeingAutoChanged = false;
//}
if (bandId > 1)
{ // If the freq belongs to one ham band
//qDebug() << "MainWindowSatTab::slotSatFreqTXChanged Freq is HamBand" << endl;
bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(rxFreqSpinBox->value()));
if(freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowSatTab::slotSatFreqTXChanged Freq is in band" << endl;
//QString _newBand = dataProxy->getBandNameFromFreq(txFreqSpinBox->value());
//updateBandComboBox(_newBand);
//satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(dataProxy->getBandNameFromFreq(txFreqSpinBox->value()), Qt::MatchCaseSensitive));
}
else
{
satBandRXComboBox->setCurrentIndex(satBandRXComboBox->findText(dataProxy->getBandNameFromFreq(rxFreqSpinBox->value()), Qt::MatchCaseSensitive));
//qDebug() << "MainWindowSatTab::slotSatFreqRXChanged Freq is not in band" << endl;
}
}
else
{
//qDebug() << "MainWindowsatTab::slotSatFreqRXChanged Freq is not in ANY ham band" << endl;
}
rxFreqBeingChanged = false;
/*
QString _q;
int v = dataProxy->getBandIdFromFreq(rxFreqSpinBox->value());
if (v<0)
@ -489,11 +537,80 @@ void MainWindowSatTab::slotSatFreqRXChanged()
_q = dataProxy->getNameFromBandId (v);
satBandRXComboBox->setCurrentIndex(satBandRXComboBox->findText(_q));
*/
//qDebug() << "MainWindowsatTab::slotSatFreqRXChanged-END" << endl;
}
void MainWindowSatTab::slotSatBandTXComboBoxChanged()
{
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged" << endl;
txBandBeingChanged = true;
if (!dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(txFreqSpinBox->value())))
{
setUpLinkFreq(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText()));
}
emit satBandTXChanged(satBandTXComboBox->currentText());
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged-END" << endl;
}
void MainWindowSatTab::slotSatFreqTXChanged()
{
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged" << endl;
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: " << QString::number(txFreqSpinBox->value()) << endl;
// user changes TX Freq
// If band is real and band is configured, bandcombo is selected
// If band is real and not configured, we launch the band config and select the band.
// if band is real emit the band
//if (txFreqBeingAutoChanged)
//{
// //qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: Freq being changed from the outside, not the user" << endl;
//}
if (dataProxy->getBandIdFromFreq(txFreqSpinBox->value())<1)
{ //This prevent that a non-hamradio frequency is used on TX
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: Not in band, exiting... " << endl;
return;
}
txFreqBeingChanged = true;
int bandId = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
if (bandId > 1)
{ // If the freq belongs to one ham band
//qDebug() << "MainWindowSatTab::slotSatFreqTXChanged Freq is HamBand" << endl;
if (!txFreqBeingAutoChanged)
{
emit satTxFreqChanged(txFreqSpinBox->value());
}
bool freqInBand = dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if(freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowSatTab::slotSatFreqTXChanged Freq is in band" << endl;
//QString _newBand = dataProxy->getBandNameFromFreq(txFreqSpinBox->value());
//updateBandComboBox(_newBand);
//satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(dataProxy->getBandNameFromFreq(txFreqSpinBox->value()), Qt::MatchCaseSensitive));
}
else
{
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(dataProxy->getBandNameFromFreq(txFreqSpinBox->value()), Qt::MatchCaseSensitive));
//qDebug() << "MainWindowSatTab::slotSatFreqTXChanged Freq is not in band" << endl;
}
}
else
{
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged Freq is not in ANY ham band" << endl;
}
txFreqBeingChanged = false;
/*
QString _q;
int v = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
@ -502,10 +619,22 @@ void MainWindowSatTab::slotSatFreqTXChanged()
return;
}
_q = dataProxy->getNameFromBandId (v);
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(_q));
if (txFreqBeingChanged)
{
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged-FreqBeingChanged = true" << endl;
txFreqBeingChanged = true;
emit satTxFreqChanged(txFreqSpinBox->value());
}
else
{
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged-FreqBeingChanged = false" << endl;
_q = dataProxy->getNameFromBandId (v);
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(_q));
txFreqBeingChanged = false;
}
*/
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged-END" << endl;
}
void MainWindowSatTab::setUpLink(const QString _t)
@ -545,11 +674,44 @@ void MainWindowSatTab::setUpLink(const QString _t)
void MainWindowSatTab::setUpLinkFreq(const double _t)
{
//qDebug) << "MainWindowsatTab::setUpLinkFreq: " << QString::number(_t) << endl;
if ((dataProxy->getBandIdFromFreq(_t))>0)
{
txFreqSpinBox->setValue(_t);
//qDebug() << "MainWindowsatTab::setUpLinkFreq: " << QString::number(_t) << endl;
if (dataProxy->getBandIdFromFreq(_t)<1)
{ //This prevent that a non-hamradio frequency is used on TX
return;
}
txFreqBeingAutoChanged = true;
txFreqSpinBox->setValue(_t);
/*
int bandId = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
if (bandId > 1)
{ // If the freq belongs to one ham band
bool freqInBand = dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowSatTab::setUpLinkFreq Freq is not in band" << endl;
emit satTxFreqChanged(txFreqSpinBox->value());
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(dataProxy->getBandNameFromFreq(txFreqSpinBox->value()), Qt::MatchCaseSensitive));
}
}
else
{
//qDebug() << "MainWindowsatTab::setUpLinkFreq Freq is not in ANY ham band" << endl;
}
*/
txFreqBeingAutoChanged = false;
//qDebug() << "MainWindowsatTab::setUpLinkFreq END" << endl;
}
void MainWindowSatTab::setDownLinkFreq(const double _t)
{
//qDebug() << "MainWindowsatTab::setDownLinkFreq: " << QString::number(_t) << endl;
rxFreqBeingAutoChanged = true;
rxFreqSpinBox->setValue(_t);
// rxFreqBeingAutoChanged = false;
//qDebug() << "MainWindowsatTab::setDownLinkFreq END" << endl;
}
void MainWindowSatTab::setBandsOfSat(const QString _p)

View File

@ -54,8 +54,10 @@ public:
void addBands(QStringList _bands);
void setDefaultBands(); //Defines the default bands for SAT communications: 10m/2m/70cm/23CM only if they exist on the selected bands
void setUpLink(const QString _t);
void setUpLinkFreq(const double _t);
void setDownLinkFreq(const double _t);
void setLocator(const QString _t);
void refreshData();
@ -87,6 +89,7 @@ private:
int getSatIndex(const QString _p);
void setBandsOfSat(const QString _p);
void addNewBand(const QString _p);
void setUpLink(const QString _t);
QLineEdit *satNameLineEdit;
QLineEdit *satModeLineEdit;
@ -100,6 +103,7 @@ private:
QComboBox *satBandTXComboBox, *satBandRXComboBox;
QStringList satNames, satModes;
QStringList satellitesList;
bool txBandBeingChanged, rxBandBeingChanged, txFreqBeingChanged, txFreqBeingAutoChanged, rxFreqBeingChanged, rxFreqBeingAutoChanged;
QDoubleSpinBox *txFreqSpinBox, *rxFreqSpinBox;
DataProxy *dataProxy;

View File

@ -63,7 +63,7 @@ SetupDialog::SetupDialog(DataProxy *dp, const bool _firstTime)
tabWidget = new QTabWidget;
//qDebug() << "SetupDialog::SetupDialog 3.4" << endl;
hamlibPage = new SetupPageHamLib(dataProxy, this);
userDataPage = new SetupPageUserDataPage(dataProxy);
//qDebug() << "SetupDialog::SetupDialog 3.5" << endl;
bandModePage = new SetupPageBandMode(dataProxy, this);
@ -83,6 +83,7 @@ SetupDialog::SetupDialog(DataProxy *dp, const bool _firstTime)
UDPPage = new SetupPageUDP(this);
//qDebug() << "SetupDialog::SetupDialog 3.13" << endl;
satsPage = new SetupPageSats(dataProxy, this);
//hamlibPage = new SetupPageHamLib(dataProxy, this);
//qDebug() << "SetupDialog::SetupDialog 4" << endl;
@ -96,6 +97,7 @@ SetupDialog::SetupDialog(DataProxy *dp, const bool _firstTime)
tabWidget->addTab(clubLogPage, "ClubLog");
tabWidget->addTab(UDPPage, "WSJT-X");
tabWidget->addTab(satsPage , tr("Satellites"));
tabWidget->addTab(hamlibPage, tr ("HamLib"));
QPushButton *closeButton = new QPushButton(tr("Cancel"));
@ -162,6 +164,8 @@ SetupDialog::SetupDialog(DataProxy *dp, const QString _configFile, const QString
clubLogPage = new SetupPageClubLog(this);
UDPPage = new SetupPageUDP(this);
satsPage = new SetupPageSats(dataProxy, this);
hamlibPage = new SetupPageHamLib(dataProxy, this);
//qDebug() << "SetupDialog::SetupDialog 02" << endl;
tabWidget->addTab(userDataPage, tr("User data"));
@ -174,6 +178,7 @@ SetupDialog::SetupDialog(DataProxy *dp, const QString _configFile, const QString
tabWidget->addTab(clubLogPage, tr("ClubLog"));
tabWidget->addTab(UDPPage, tr("WSJT-X"));
tabWidget->addTab(satsPage , tr("Satellites"));
tabWidget->addTab(hamlibPage, tr ("HamLib"));
//qDebug() << "SetupDialog::SetupDialog 03" << endl;
@ -580,6 +585,12 @@ void SetupDialog::slotOkButtonClicked()
stream << "RealTimeFromWSJTX=" << UDPPage->getReaDataFromWSJTx() << ";" << endl;
stream << "InfoTimeOut=" << UDPPage->getTimeout() << ";" << endl;
qDebug() << "SetupDialog::slotOkButtonClicked: hamlib" << endl;
QString _aa = hamlibPage->getData();
stream << _aa << endl;
qDebug() << "SetupDialog::slotOkButtonClicked: hamlib-2: " << _aa << endl;
//WSJTX
file.close ();

View File

@ -39,6 +39,7 @@
#include "setuppageclublog.h"
#include "setuppageudp.h"
#include "setuppagesats.h"
#include "setuppagehamlib.h"
#include "utilities.h"
@ -121,6 +122,7 @@ private:
SetupPageClubLog *clubLogPage;
SetupPageUDP *UDPPage;
SetupPageSats *satsPage;
SetupPageHamLib *hamlibPage;
int pageRequested; // The page on the Dialog that is requested to be shown when you call it
//QString klogDir;

309
setuppagehamlib.cpp Executable file
View File

@ -0,0 +1,309 @@
#include "setuppagehamlib.h"
SetupPageHamLib::SetupPageHamLib(DataProxy *dp, QWidget *parent) : QWidget(parent)
{
//qDebug() << "SetupPageHamLib::SetupPageHamLib" << endl;
rigTypeComboBox = new QComboBox();
serialBaudsComboBox = new QComboBox();
serialPortComboBox = new QComboBox();
dataBits7CheckBox = new QCheckBox();
dataBits8CheckBox = new QCheckBox();
stopBits1CheckBox = new QCheckBox();
stopBits2CheckBox = new QCheckBox();
handshakeNoneCheckBox = new QCheckBox();
handshakeXCheckBox = new QCheckBox();
handshakeHCheckBox = new QCheckBox();
flowControlLinesDTRCheckBox = new QCheckBox();
flowControlLinesRTSCheckBox = new QCheckBox();
//serialBaudsSpinBox = new QSpinBox;
serialPort = new QLineEdit;
//defaultPortSpeed = 9600;
baudSpeeds.clear();
baudSpeeds << "1200" << "2400" << "4800" << "9600" << "19200" << "38400" << "57600" << "115200";
createUI();
setDefaults();
qDebug() << "SetupPageHamLib::SetupPageHamLib END" << endl;
}
void SetupPageHamLib::createUI()
{
rigTypeComboBox->clear();
strings.clear();
setRig();
serialPortComboBox->addItems(getAvailableSerialPorts());
rigTypeComboBox->setCurrentIndex(0);
QLabel *rigTypeLabel = new QLabel(tr("Radio"));
rigTypeLabel->setBuddy(rigTypeComboBox);
rigTypeLabel->setToolTip(tr("Select your rig."));
rigTypeLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter);
rigTypeLabel->setEnabled(true);
serialPortComboBox->addItems(serialPorts);
QLabel *serialPortLabel = new QLabel(tr("Port"));
serialPortLabel->setBuddy(serialPortComboBox);
serialPortLabel->setToolTip(tr("Select the serial port. Only the serial ports that are detected are shown."));
serialPortLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter);
serialPortLabel->setEnabled(true);
serialBaudsComboBox->addItems(baudSpeeds);
QLabel *serialBaudsLabel = new QLabel(tr("Bauds"));
serialBaudsLabel->setBuddy(serialBaudsComboBox);
serialBaudsLabel->setToolTip(tr("Select the serial port speed."));
serialBaudsLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter);
serialBaudsLabel->setEnabled(true);
QGridLayout *topData = new QGridLayout;
topData->addWidget(rigTypeLabel, 0, 0);
topData->addWidget(rigTypeComboBox, 0, 1);
topData->addWidget(serialPortLabel, 1, 0);
topData->addWidget(serialPortComboBox, 1, 1);
topData->addWidget(serialBaudsLabel, 2, 0);
topData->addWidget(serialBaudsComboBox, 2, 1);
/*
QGroupBox *dataBitsGroupBox = new QGroupBox (tr("Data Bits"));
dataBits7CheckBox->setText(tr("7 bits"));
dataBits8CheckBox->setText(tr("8 bits"));
dataBitsGroupButton = new QButtonGroup(this);
dataBitsGroupButton->setExclusive(true);
dataBitsGroupButton->addButton(dataBits7CheckBox);
dataBitsGroupButton->addButton(dataBits8CheckBox);
QVBoxLayout *dataBitsButtonsLayout = new QVBoxLayout;
dataBitsButtonsLayout->addWidget(dataBits7CheckBox);
dataBitsButtonsLayout->addWidget(dataBits8CheckBox);
dataBitsGroupBox->setLayout(dataBitsButtonsLayout);
QGroupBox *stopBitsGroupBox = new QGroupBox(tr("Stop bits"));
stopBits1CheckBox->setText(tr("1 bit"));
stopBits2CheckBox->setText(tr("2 bits"));
stopBitsButtonGroup = new QButtonGroup(this);
stopBitsButtonGroup->setExclusive(true);
stopBitsButtonGroup->addButton(stopBits1CheckBox);
stopBitsButtonGroup->addButton(stopBits2CheckBox);
QVBoxLayout *stopBitsButtonsLayout = new QVBoxLayout;
stopBitsButtonsLayout->addWidget(stopBits1CheckBox);
stopBitsButtonsLayout->addWidget(stopBits2CheckBox);
stopBitsGroupBox->setLayout(stopBitsButtonsLayout);
QGroupBox *handShakeGroupBox = new QGroupBox(tr("Handshake"));
handshakeNoneCheckBox->setText(tr("None"));
handshakeXCheckBox->setText(tr("XON/XOFF"));
handshakeHCheckBox->setText(tr("Hardware"));
handshakeButtonGroup = new QButtonGroup(this);
handshakeButtonGroup->setExclusive(true);
handshakeButtonGroup->addButton(handshakeNoneCheckBox);
handshakeButtonGroup->addButton(handshakeXCheckBox);
handshakeButtonGroup->addButton(handshakeHCheckBox);
QVBoxLayout *handShakeButtonsLayout = new QVBoxLayout;
handShakeButtonsLayout->addWidget(handshakeNoneCheckBox);
handShakeButtonsLayout->addWidget(handshakeXCheckBox);
handShakeButtonsLayout->addWidget(handshakeHCheckBox);
handShakeGroupBox->setLayout(handShakeButtonsLayout);
QGroupBox *flowControlLineGroupBox = new QGroupBox(tr("Control Lines"));
flowControlLinesDTRCheckBox->setText(tr("DTR"));
flowControlLinesRTSCheckBox->setText(tr("RTS"));
flowControlLineButtonGroup = new QButtonGroup;
flowControlLineButtonGroup->setExclusive(true);
flowControlLineButtonGroup->addButton(flowControlLinesDTRCheckBox);
flowControlLineButtonGroup->addButton(flowControlLinesRTSCheckBox);
QVBoxLayout *flowControlLineButtonsLayout = new QVBoxLayout;
flowControlLineButtonsLayout->addWidget(flowControlLinesDTRCheckBox);
flowControlLineButtonsLayout->addWidget(flowControlLinesRTSCheckBox);
flowControlLineGroupBox->setLayout(flowControlLineButtonsLayout);
*/
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addLayout(topData, 0, 0);
//mainLayout->addWidget(dataBitsGroupBox, 1, 0);
//mainLayout->addWidget(stopBitsGroupBox, 1, 1);
//mainLayout->addWidget(handShakeGroupBox, 2, 0);
//mainLayout->addWidget(flowControlLineGroupBox, 2, 1);
setLayout(mainLayout);
}
void SetupPageHamLib::setRig ()
{
qDebug() << "SetupPageHamLib::SetRig" << endl;
// Rutine to fill the rig combo boxes
// Do not display debug codes when load the rig's
rig_set_debug (RIG_DEBUG_NONE);
// and continue...
rig_load_all_backends ();
rig_list_foreach (addRigToList, this);
strings.sort ();
rigTypeComboBox->insertItems (0, strings);
strings.clear ();
}
int SetupPageHamLib::addRigToList (const struct rig_caps *caps, void *data)
{
qDebug() << "SetupPageHamLib::addRigToList" << endl;
QString name;
SetupPageHamLib *r = (SetupPageHamLib *) data;
name = caps->model_name;
//qDebug() << "SetupPageHamLib::addRigToList: " << name << endl;
//if (name == "Dummy")
// name = "None";
//r->rigname2rigid[name] = caps->rig_model;
//r->rigid2rigname[caps->rig_model] = name;
r->strings << name;
return -1; // not 0 --> we want all rigs
}
QStringList SetupPageHamLib::getAvailableSerialPorts()
{
QStringList st;
st.clear();
const auto infos = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &info : infos)
{
//st << info.portName();
st << info.systemLocation();
}
return st;
}
void SetupPageHamLib::setDefaults()
{
rigTypeComboBox->setCurrentIndex(0);
serialPortComboBox->setCurrentIndex(0);
serialBaudsComboBox->setCurrentIndex(0);
//dataBits8CheckBox->setChecked(true);
//stopBits1CheckBox->setChecked(true);
//handshakeNoneCheckBox->setChecked(true);
}
QString SetupPageHamLib::getData()
{
qDebug() << "SetupPageHamLib::getData" << endl;
QString _output;
_output.clear();
QString _rigType, _serialPort, _baudsSpeed;//, dataBits, stopBits, handshake, flowControlLine;
_rigType = rigTypeComboBox->currentText();
_serialPort = serialPortComboBox->currentText();
_baudsSpeed = serialBaudsComboBox->currentText();
qDebug() << "SetupPageHamLib::getData: " << _rigType << endl;
/*
if (dataBits7CheckBox->isChecked())
{
dataBits = "7;";
}
else
{
dataBits = "8;";
}
if (stopBits1CheckBox->isChecked())
{
stopBits = "1;";
}
else
{
stopBits = "2;";
}
if (handshakeHCheckBox->isChecked())
{
handshake = "Hardware;";
}
else if (handshakeXCheckBox->isChecked())
{
handshake = "XON;";
}
else
{
handshake = "None;";
}
if (flowControlLinesDTRCheckBox->isChecked())
{
flowControlLine = "DRT;";
}
else if (flowControlLinesRTSCheckBox->isChecked())
{
flowControlLine ="RTS;";
}
else
{
flowControlLine = "None";
}
*/
_output.clear();
_output = _output + "HamLibRigType=" + _rigType + "\n";
_output = _output + "HamlibSerialPort=" + _serialPort + "\n";
_output = _output + "HamlibSerialBauds=" + _baudsSpeed + "\n";
//_output + "SerialDataBits=" + dataBits + "\n";
//_output + "SerialStopBits=" + stopBits + "\n";
//_output + "SerialHandShake=" + handshake + "\n";
//_output + "SerialFlowControlLine=" + flowControlLine + "\n";
qDebug() << "SetupPageHamLib::getData: " << _output << endl;
return _output;
}
bool SetupPageHamLib::setRigType(const QString _radio)
{
int _index = rigTypeComboBox->findText(_radio, Qt::MatchFlag::MatchExactly);
if (_index >= 0)
{
rigTypeComboBox->setCurrentIndex(_index);
return true;
}
else
{
rigTypeComboBox->setCurrentIndex(0);
}
return false;
}
bool SetupPageHamLib::setSerialPort(const QString _port)
{
int _index = serialPortComboBox->findText(_port, Qt::MatchFlag::MatchExactly);
if (_index >= 0)
{
serialPortComboBox->setCurrentIndex(_index);
return true;
}
else
{
serialPortComboBox->setCurrentIndex(0);
}
return false;
}
bool SetupPageHamLib::setSerialSpeed(const QString _speed )
{
int _index = serialBaudsComboBox->findText(_speed, Qt::MatchFlag::MatchExactly);
if (_index >= 0)
{
serialBaudsComboBox->setCurrentIndex(_index);
return true;
}
else
{
serialPortComboBox->setCurrentIndex(0);
}
return false;
}

79
setuppagehamlib.h Executable file
View File

@ -0,0 +1,79 @@
#ifndef SETUPPAGEHAMLIB_H
#define SETUPPAGEHAMLIB_H
/***************************************************************************
setuppagehamlib.h - description
-------------------
begin : feb 2018
copyright : (C) 2018 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QObject>
#include <QWidget>
#include <QtWidgets>
//#include <QSerialPort>
#include <QSerialPortInfo>
#include "dataproxy.h"
#include <hamlib/rig.h>
class SetupPageHamLib : public QWidget
{
Q_OBJECT
public:
explicit SetupPageHamLib(DataProxy *dp, QWidget *parent = nullptr);
QString getData();
bool setRigType(const QString _radio);
bool setSerialPort(const QString _port);
bool setSerialSpeed(const QString _speed );
signals:
public slots:
private:
void createUI();
void setRig();
void setDefaults();
static int addRigToList(const struct rig_caps* caps, void* data);
QStringList getAvailableSerialPorts();
QButtonGroup *flowControlLineButtonGroup, *handshakeButtonGroup, *dataBitsGroupButton, *stopBitsButtonGroup;
QComboBox *rigTypeComboBox, *serialBaudsComboBox, *serialPortComboBox;
//QSpinBox *serialBaudsSpinBox;
QLineEdit *serialPort;
RIG *my_rig; // handle to rig (instance)
freq_t freq;
rig_model_t myrig_model;
QStringList strings, baudSpeeds, serialPorts;
QCheckBox *dataBits7CheckBox, *dataBits8CheckBox, *stopBits1CheckBox, *stopBits2CheckBox,
*handshakeNoneCheckBox, *handshakeXCheckBox, *handshakeHCheckBox,
*flowControlLinesDTRCheckBox, *flowControlLinesRTSCheckBox;
//int defaultPortSpeed;
};
#endif // SETUPPAGEHAMLIB_H