This commit is contained in:
ea4k 2023-12-25 23:14:41 +01:00
parent 9c9757d71c
commit 6d5bad5383
6 changed files with 92 additions and 96 deletions

View File

@ -1416,28 +1416,26 @@ int DataBase::getBandIdFromFreq(const QString &fr)
bool DataBase::isThisFreqInBand(const QString &b, const QString &fr)
{//Freq should be in MHz
//qDebug() << "DataBase::isThisFreqInBand: " << b << "/" << fr ;
qDebug() << Q_FUNC_INFO << ": " << b << "/" << fr ;
if (b.length()<2)
{
//qDebug() << "DataBase::isThisFreqInBand returning false" ;
qDebug() << Q_FUNC_INFO << ": returning false" ;
return false;
}
int bandNf = getBandIdFromFreq(fr);
int bandN = getBandIDFromName2(b);
//qDebug() << "DataBase::isThisFreqInBand: (b/f)" << QString::number(bandN) << "/" << QString::number(bandNf) ;
qDebug() << Q_FUNC_INFO << ": (b/f)" << QString::number(bandN) << "/" << QString::number(bandNf) ;
if (bandNf == bandN)
{
//qDebug() << "DataBase::isThisFreqInBand: OK " << b << "/" << fr ;
qDebug() << Q_FUNC_INFO << ": OK " << b << "/" << fr ;
return true;
}
else
{
//qDebug() << "DataBase::isThisFreqInBand: NOK " << b << "/" << fr ;
qDebug() << Q_FUNC_INFO << ": NOK " << b << "/" << fr ;
//emit debugLog(Q_FUNC_INFO, "1", 7);
return false;
}
//qDebug() << "DataBase::isThisFreqInBand: END" ;
//return false;
}

View File

@ -162,22 +162,22 @@ void MainWindowSatTab::createUI()
void MainWindowSatTab::slotSatNameComboBoxChanged()
{
//qDebug() << Q_FUNC_INFO << ": " << satNameComboBox->currentText();
qDebug() << Q_FUNC_INFO << ": " << satNameComboBox->currentText();
if (modifying || (satNameComboBox->currentText().length()<4))
{
//qDebug() << Q_FUNC_INFO << ": Modifying: return";
qDebug() << Q_FUNC_INFO << ": Modifying: return";
return;
}
updatingSat = true;
int i = satNameComboBox->currentIndex();
//qDebug() << Q_FUNC_INFO << ": " << QString::number(i);
qDebug() << Q_FUNC_INFO << ": SAT index: " << QString::number(i);
satNameLineEdit->clear();
if (i == 0)
{
//qDebug() << Q_FUNC_INFO << ": i=0, emitting setPropModeSat - Not";
qDebug() << Q_FUNC_INFO << ": i=0, emitting setPropModeSat - Not";
emit setPropModeSat("Not", false);
satNameLineEdit->setEnabled(false);
satOtherLabel->setEnabled(false);
@ -185,7 +185,7 @@ void MainWindowSatTab::slotSatNameComboBoxChanged()
}
else if(i == 1)
{
//qDebug() << Q_FUNC_INFO << ": i=1, emitting setPropModeSat - SAT";
qDebug() << Q_FUNC_INFO << ": i=1, emitting setPropModeSat - SAT";
emit setPropModeSat("SAT", keepThisDataForNextQSOQcheckbox->isChecked());
satNameLineEdit->setEnabled(true);
satOtherLabel->setEnabled(true);
@ -193,7 +193,7 @@ void MainWindowSatTab::slotSatNameComboBoxChanged()
}
else
{
//qDebug() << Q_FUNC_INFO << ": i = else, , emitting setPropModeSat - SAT";
qDebug() << Q_FUNC_INFO << ": i = else, emitting setPropModeSat - SAT";
emit setPropModeSat("SAT", keepThisDataForNextQSOQcheckbox->isChecked());
satNameLineEdit->setEnabled(false);
satOtherLabel->setEnabled(false);
@ -202,7 +202,7 @@ void MainWindowSatTab::slotSatNameComboBoxChanged()
autofillSatMode();
}
updatingSat = false;
//qDebug() << Q_FUNC_INFO << " - END";
qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowSatTab::slotSatNameTextChanged()
@ -608,15 +608,15 @@ void MainWindowSatTab::setUpLink(const QString &_t)
void MainWindowSatTab::setUpLinkFreq(const double _t)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_t);
qDebug() << Q_FUNC_INFO << ": " << QString::number(_t);
if ((!updatingSat) && (!qsoToEditInProcess))
{
//qDebug() << Q_FUNC_INFO << ": Calling setNoSat";
qDebug() << Q_FUNC_INFO << ": Calling setNoSat";
setNoSat ();
}
updateTXFreq(_t);
setUpLink(dataProxy->getBandNameFromFreq(_t));
//qDebug() << Q_FUNC_INFO << "END";
qDebug() << Q_FUNC_INFO << "END";
}
double MainWindowSatTab::getRXFreq()
@ -648,18 +648,18 @@ void MainWindowSatTab::setDownLinkFreq(const double _t)
void MainWindowSatTab::updateRXFreq(const double _f)
{
//qDebug() << Q_FUNC_INFO << QString::number(_f);
qDebug() << Q_FUNC_INFO << QString::number(_f);
if (util->isSameFreq (freqRX, _f))
{
//qDebug() << Q_FUNC_INFO << " - END-1";
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
freqRX = _f;
if (modifying)
{
//qDebug() << Q_FUNC_INFO << " - END-2";
qDebug() << Q_FUNC_INFO << " - END-2";
return;
}
@ -667,11 +667,11 @@ void MainWindowSatTab::updateRXFreq(const double _f)
int bandId = dataProxy->getBandIdFromFreq(freqRX);
if (bandId>=1)
{ //This prevent that a non-hamradio frequency is used on TX
//qDebug() << Q_FUNC_INFO << " - Freq not in ham band";
qDebug() << Q_FUNC_INFO << " - Freq IS in ham band";
bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(freqRX));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << Q_FUNC_INFO << " - Freq in current band";
qDebug() << Q_FUNC_INFO << " - Freq in current band";
QString aux;
aux = dataProxy->getBandNameFromFreq(freqRX);
if (satBandRXComboBox->findText(aux, Qt::MatchCaseSensitive)<0)
@ -683,7 +683,7 @@ void MainWindowSatTab::updateRXFreq(const double _f)
}
}
emit satRxFreqChanged(freqRX);
//qDebug() << Q_FUNC_INFO << " - END";
qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowSatTab::updateTXFreq(const double _f)
@ -734,50 +734,50 @@ void MainWindowSatTab::updateTXFreq(const double _f)
void MainWindowSatTab::setBandsOfSat(const QString &_p)
{
// Until the data is in the DB, this function tries to solve data of active sats from: http://www.amsat.org/status/
// This functio:
// This function:
// - identifies the freqs & bands that the sat is using
//qDebug() << Q_FUNC_INFO << ": " << _p << " - Short: " << _p.section(' ', 0, 0);
qDebug() << Q_FUNC_INFO << ": " << _p << " - Short: " << _p.section(' ', 0, 0);
//"AO-7 - AMSAT-OSCAT 7"
//2M/10M << 2M/70CM
if (modifying)
{
//qDebug() << Q_FUNC_INFO << ": modifying return";
qDebug() << Q_FUNC_INFO << ": modifying return";
return;
}
double upLink = (dataProxy->getSatelliteUplink(_p.section(' ', 0, 0))).toDouble();
double downLink = (dataProxy->getSatelliteDownlink(_p.section(' ', 0, 0))).toDouble();
//qDebug() << Q_FUNC_INFO << ": upLink: " << QString::number(upLink)<< QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": downLink: " << QString::number(downLink)<< QT_ENDL;
qDebug() << Q_FUNC_INFO << ": upLink: " << QString::number(upLink)<< QT_ENDL;
qDebug() << Q_FUNC_INFO << ": downLink: " << QString::number(downLink)<< QT_ENDL;
if (upLink>0)
{
//qDebug() << "MainWindowSatTab::setBandsOfSat upLink: emitting: " << QString::number(upLink)<< QT_ENDL;
qDebug() << "MainWindowSatTab::setBandsOfSat upLink: emitting: " << QString::number(upLink)<< QT_ENDL;
emit satTXFreqNeeded(upLink);
//qDebug() << "MainWindowSatTab::setBandsOfSat upLink: emitted: " << QString::number(upLink)<< QT_ENDL;
//qDebug() << "MainWindowSatTab::setBandsOfSat upLink: emitted: " << QString::number(upLink)<< QT_ENDL;
}
else
{
//qDebug() << "MainWindowSatTab::setBandsOfSat upLink: setting to ZERO (should be = RX) " << QT_ENDL;
qDebug() << "MainWindowSatTab::setBandsOfSat upLink: setting to ZERO (should be = RX) " << QT_ENDL;
updateTXFreq(0.0);
}
if (downLink>0)
{
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emitting: " << QString::number(downLink)<< QT_ENDL;
qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emitting: " << QString::number(downLink)<< QT_ENDL;
emit satRXFreqNeeded(downLink);
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emitted: " << QString::number(downLink)<< QT_ENDL;
}
else
{
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: setting to ZERO" << QT_ENDL;
qDebug() << "MainWindowSatTab::setBandsOfSat downLink: setting to ZERO" << QT_ENDL;
updateRXFreq(0.0);
//satBandRXComboBox->setCurrentIndex(0);
}
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emiting: " << QString::number(downLink)<< QT_ENDL;
//emit satRxFreqChanged(downLink);
//qDebug() << Q_FUNC_INFO << ": " << _p << " - END " ;
qDebug() << Q_FUNC_INFO << ": " << _p << " - END " ;
}
void MainWindowSatTab::addNewBand(const QString &_p)

View File

@ -600,7 +600,7 @@ QStringList MainQSOEntryWidget::getModes()
bool MainQSOEntryWidget::setFreq(const double _f, bool isRX)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_f);
qDebug() << Q_FUNC_INFO << ": " << QString::number(_f);
logEvent (Q_FUNC_INFO, "Start", Debug);
if (isRX)
@ -622,18 +622,18 @@ bool MainQSOEntryWidget::setFreq(const double _f, bool isRX)
if (newBandNeededForFreq (_f))
{
//qDebug() << Q_FUNC_INFO << ": New band needed";
qDebug() << Q_FUNC_INFO << ": New band needed";
if ((bottomBandLimit<=freqTX) && (freqTX<= upperBandLimit))
{
logEvent (Q_FUNC_INFO, "END-3", Debug);
return true;
}
//qDebug() << Q_FUNC_INFO << ": Freq is not in the current band";
qDebug() << Q_FUNC_INFO << ": Freq is not in the current band";
QString _newBand = dataProxy->getBandNameFromFreq(_f);
//qDebug() << Q_FUNC_INFO << ": before setting band: " << _newBand ;
qDebug() << Q_FUNC_INFO << ": before setting band: " << _newBand ;
if (isRX)
{
//qDebug() << Q_FUNC_INFO << ": RX Freq no more actions " ;
qDebug() << Q_FUNC_INFO << ": RX Freq no more actions " ;
logEvent (Q_FUNC_INFO, "END-4", Debug);
return true;
}
@ -642,7 +642,7 @@ bool MainQSOEntryWidget::setFreq(const double _f, bool isRX)
}
else
{
//qDebug() << Q_FUNC_INFO << ": NO New band needed - BORRAR";
qDebug() << Q_FUNC_INFO << ": NO New band needed - REMOVE THIS else";
}
logEvent (Q_FUNC_INFO, "END", Debug);
return false;
@ -650,16 +650,16 @@ bool MainQSOEntryWidget::setFreq(const double _f, bool isRX)
bool MainQSOEntryWidget::newBandNeededForFreq(const double _f)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_f);
qDebug() << Q_FUNC_INFO << ": " << QString::number(_f);
logEvent (Q_FUNC_INFO, "Start: " + QString::number(_f), Debug);
QString _newBand = dataProxy->getBandNameFromFreq(_f);
if (!updateBandComboBox (_newBand))
{
logEvent (Q_FUNC_INFO, "END-1", Debug);
//qDebug() << Q_FUNC_INFO << " - END false";
qDebug() << Q_FUNC_INFO << " - END false";
return false;
}
//qDebug() << Q_FUNC_INFO << " - END true ";
qDebug() << Q_FUNC_INFO << " - END true ";
logEvent (Q_FUNC_INFO, "END", Debug);
return true;
}

View File

@ -1047,6 +1047,7 @@ void MainWindow::slotQRZReturnPressed()
if (!readQSOFromUI ())
{return;}
qDebug() << Q_FUNC_INFO << ": " << QString("Modifying QSO %1").arg(modifyingQSO);
bool addedOK = qso->toDB (modifyingQSO);
if (addedOK)
@ -5912,24 +5913,25 @@ void MainWindow::slotValidBandsReceived(const QStringList &_b)
void MainWindow::slotFreqRXChanged(const double _fr)
{
logEvent(Q_FUNC_INFO, "Start", Debug);
qDebug() << Q_FUNC_INFO << ": " << QString::number(_fr);
if (!upAndRunning)
{
//qDebug() << Q_FUNC_INFO << " - not running" ;
qDebug() << Q_FUNC_INFO << " - not running" ;
return;
}
int bandId = dataProxy->getBandIdFromFreq(_fr);
if (bandId < 1)
{
//qDebug() << Q_FUNC_INFO << " - wrong band" ;
qDebug() << Q_FUNC_INFO << " - wrong band" ;
return;
}
//mainQSOEntryWidget->setFreq (_fr, true);
mainQSOEntryWidget->setFreq (_fr, true);
QSOTabWidget->setRXFreq (_fr);
satTabWidget->setDownLinkFreq(_fr);
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "MainWindow::slotFreqRXChanged - END" ;
qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}
void MainWindow::slotFreqTXChangedFromSat(const double _fr)
@ -5937,30 +5939,34 @@ void MainWindow::slotFreqTXChangedFromSat(const double _fr)
logEvent(Q_FUNC_INFO, "Start", Debug);
if (!upAndRunning)
{
//qDebug() << "MainWindow::slotFreqTXChanged !upAndRunning" ;
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
if (dataProxy->isThisFreqInBand (mainQSOEntryWidget->getBand (), QString::number(_fr)))
{
qDebug() << Q_FUNC_INFO << " - END-2";
return;
}
slotFreqTXChanged (_fr);
qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}
void MainWindow::slotFreqTXChanged(const double _fr)
{
logEvent(Q_FUNC_INFO, "Start", Debug);
qDebug() << Q_FUNC_INFO << ": " << QString::number(_fr);
if (!upAndRunning)
{
//qDebug() << "MainWindow::slotFreqTXChanged !upAndRunning" ;
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
qDebug() << Q_FUNC_INFO << " - 10";
QSOTabWidget->setTXFreq (_fr);
qDebug() << Q_FUNC_INFO << " - 11";
mainQSOEntryWidget->setFreq (_fr);
qDebug() << Q_FUNC_INFO << " - calling setUpLinkFreq";
satTabWidget->setUpLinkFreq(_fr);
if (hamlibActive && !manualMode)
{
@ -5988,7 +5994,7 @@ void MainWindow::slotFreqTXChanged(const double _fr)
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "MainWindow::slotFreqTXChanged - END" ;
qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindow::slotShowQSOsFromDXCCWidget(QList<int> _qsos)

View File

@ -357,7 +357,7 @@ QString QSO::getCall()
bool QSO::setBand(const QString &_c)
{
//qDebug() << "QSO::setBand: "<< _c;
//qDebug() << Q_FUNC_INFO << ": " << _c;
if (_c.length()>0)
{
band = _c;
@ -378,7 +378,7 @@ QString QSO::getBand()
bool QSO::setBandRX(const QString &_c)
{
//qDebug() << "QSO::setBandRX: "<< _c;
//qDebug() << Q_FUNC_INFO << ": " << _c;
if (_c.length()>0)
{
band_rx = _c;
@ -486,10 +486,10 @@ QTime QSO::getTimeOff()
bool QSO::setTimeOn(const QTime &_c)
{
//qDebug() << "QSO::setQSLTime: " << _c.toString("mmhhss");
//qDebug() << Q_FUNC_INFO << ": " << _c.toString("mmhhss");
if (_c.isValid())
{
//qDebug() << "QSO::setQSLTime: VALID";
//qDebug() << Q_FUNC_INFO << ": VALID";
qso_dateTime.setTime(_c);
if (qso_dateTime.date().isValid ())
haveDateTime = true;
@ -738,16 +738,16 @@ QDate QSO::getLoTWQSLSDate()
bool QSO::setLoTWQSL_RCVD(const QString &_c)
{
//qDebug() << "QSO::setLoTWQSL_RCVD: " << _c ;
//qDebug() << Q_FUNC_INFO << ": " << _c ;
if (util->isValidQSL_Rcvd(_c))
{
//qDebug() << "QSO::setLoTWQSL_RCVD: VALID ";
//qDebug() << Q_FUNC_INFO << ": VALID ";
lotw_qsl_rcvd = _c;
return true;
}
else
{
//qDebug() << "QSO::setLoTWQSL_RCVD: NOT valid ";
//qDebug() << Q_FUNC_INFO << ": NOT valid ";
return false;
}
}
@ -759,16 +759,16 @@ QString QSO::getLoTWQSL_RCVD()
bool QSO::setLoTWQSLRDate(const QDate &_c)
{
//qDebug() << "QSO::setLoTWQSLRDate: " << _c.toString("yyyy-MM-dd");
//qDebug() << Q_FUNC_INFO << ": << _c.toString("yyyy-MM-dd");
if (_c.isValid())
{
//qDebug() << "QSO::setLoTWQSLRDate: TRUE";
//qDebug() << Q_FUNC_INFO << ": TRUE";
QSLLoTWRDate = _c;
return true;
}
else
{
//qDebug() << "QSO::setLoTWQSLRDate: FALSE";
//qDebug() << Q_FUNC_INFO << ": FALSE";
QSLLoTWRDate = QDate();
return false;
}
@ -2751,7 +2751,7 @@ void QSO::InitializeHash() {
bool QSO::setData(const QString &_adifPair)
{
logEvent (Q_FUNC_INFO, "Start", Debug);
//qDebug() << "QSO::setData: " << _adifPair;
//qDebug() << Q_FUNC_INFO << ": " << _adifPair;
QStringList d;
d.clear();
d << util->getValidADIFFieldAndData(_adifPair);
@ -2760,7 +2760,7 @@ bool QSO::setData(const QString &_adifPair)
logEvent (Q_FUNC_INFO, "END - ADIF not valid", Debug);
return false;
}
//qDebug() << "QSO::setData: " << d.at(0) << "/" << d.at(1);
//qDebug() << Q_FUNC_INFO << ": " << d.at(0) << "/" << d.at(1);
QString field = d.at(0).toUpper();
QString data = d.at(1);
@ -2817,7 +2817,8 @@ bool QSO::toDB(int _qsoId)
}
QString QSO::getAddQueryString()
{
{ // submode is not used, keep it empty.
// mode field is populated with the submode
return QString( "INSERT INTO log ("
"qso_date, call, rst_sent, rst_rcvd, bandid, modeid, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, "
"ant_path, arrl_sect, award_submitted, award_granted, band_rx, checkcontest, class, clublog_qso_upload_date, "
@ -2832,7 +2833,7 @@ QString QSO::getAddQueryString()
"notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qrzcom_qso_upload_date, "
"qrzcom_qso_upload_status, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, "
"qth, region, rig, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, silent_key, skcc, sota_ref, srx_string, srx, stx_string, stx, state, "
"station_callsign, submode, swl, uksmg, usaca_counties, ve_prov, vucc_grids, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber) "
"station_callsign, swl, uksmg, usaca_counties, ve_prov, vucc_grids, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber) "
"VALUES ("
":qso_date, :call, :rst_sent, :rst_rcvd, :bandid, :modeid, :cqz, :ituz, :dxcc, :address, :age, :cnty, :comment, :a_index, :ant_az, :ant_el, "
":ant_path, :arrl_sect, :award_submitted, :award_granted, :band_rx, :checkcontest, :class, :clublog_qso_upload_date, :clublog_qso_upload_status, :cont, "
@ -2845,12 +2846,13 @@ QString QSO::getAddQueryString()
":notes, :nr_bursts, :nr_pings, :operator, :owner_callsign, :pfx, :precedence, :prop_mode, :public_key, :qrzcom_qso_upload_date, "
":qrzcom_qso_upload_status, :qslmsg, :qslrdate, :qslsdate, :qsl_rcvd, :qsl_sent, :qsl_rcvd_via, :qsl_sent_via, :qsl_via, :qso_complete, :qso_random, "
":qth, :region, :rig, :rx_pwr, :sat_mode, :sat_name, :sfi, :sig, :sig_info, :silent_key, :skcc, :sota_ref, :srx_string, :srx, :stx_string, :stx, :state,"
":station_callsign, :submode, :swl, :uksmg, :usaca_counties, :ve_prov, :vucc_grids, :ten_ten, :tx_pwr, :web, :qso_date_off, "
":station_callsign, :swl, :uksmg, :usaca_counties, :ve_prov, :vucc_grids, :ten_ten, :tx_pwr, :web, :qso_date_off, "
":marked, :lognumber)" );
}
QString QSO::getModifyQueryString()
{
{ // submode is not used, keep it empty.
// mode field is populated with the submode
return QString("UPDATE log SET call = :call, qso_date = :qso_date, rst_sent = :rst_sent, rst_rcvd = :rst_rcvd, "
"bandid = :bandid, modeid = :modeid, cqz = :cqz, ituz = :ituz, dxcc = :dxcc, address = :address, "
"age = :age, cnty = :cnty, comment = :comment, a_index = :a_index, ant_az = :ant_az, ant_el = :ant_el, "
@ -2882,7 +2884,7 @@ QString QSO::getModifyQueryString()
"qth = :qth, region = :region, rig = :rig, rx_pwr = :rx_pwr, sat_mode = :sat_mode, sat_name = :sat_name, "
"sfi = :sfi, sig = :sig, sig_info = :sig_info, silent_key = :silent_key, skcc = :skcc, "
"sota_ref = :sota_ref, srx_string = :srx_string, srx = :srx, stx_string = :stx_string, stx = :stx, "
"state = :state, station_callsign = :station_callsign, submode = :submode, swl = :swl, uksmg = :uksmg, "
"state = :state, station_callsign = :station_callsign, swl = :swl, uksmg = :uksmg, "
"usaca_counties = :usaca_counties, ve_prov = :ve_prov, vucc_grids = :vucc_grids, ten_ten = :ten_ten, "
"tx_pwr = :tx_pwr, web = :web, qso_date_off = :qso_date_off, marked = :marked, lognumber = :lognumber "
"WHERE id = :id");
@ -2931,24 +2933,18 @@ int QSO::getBandIdFromBandName(bool _rxBand)
return -1;
}
int QSO::getModeIdFromModeName(bool _submode)
int QSO::getModeIdFromModeName()
{
// submode is not used, keep it empty.
// mode field is populated with the submode
qDebug() << Q_FUNC_INFO;
QSqlQuery query;
//qDebug() << Q_FUNC_INFO << "Mode: " << getSubmode();
//SELECT id from mode WHERE CASE WHEN 1=1 THEN submode='AM' ELSE name = 'FM' END;
bool ok = query.prepare ("SELECT id from mode WHERE CASE WHEN ''<>:submode THEN submode=:submode ELSE name = :name END");
if (!ok)
{
//qDebug() << Q_FUNC_INFO << " - Query NOT prepared";
}
if (_submode)
{
query.bindValue (":submode", getSubmode ());
}
else
{
query.bindValue (":name", getMode());
}
//
// SELECT mode.id FROM mode WHERE mode.submode="FT4"
// SELECT mode.id FROM mode WHERE mode.name="MFSK"
bool ok = query.prepare ("SELECT mode.id FROM mode WHERE mode.submode=:submode");
//bool ok = query.prepare ("SELECT id from mode WHERE CASE WHEN ''<>:submode THEN submode=:submode ELSE name = :name END");
query.bindValue (":submode", getMode ());
if (query.exec ())
{
@ -2956,17 +2952,16 @@ int QSO::getModeIdFromModeName(bool _submode)
{
if (query.isValid ())
{
return query.value (0).toInt ();
}
else
{
//qDebug() << Q_FUNC_INFO << " - Query NOT Valid";
qDebug() << Q_FUNC_INFO << " - Query NOT Valid";
}
}
else
{
//qDebug() << Q_FUNC_INFO << " - Query NOT Next";
qDebug() << Q_FUNC_INFO << " - Query NOT Next";
}
}
else
@ -2984,8 +2979,6 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
//qDebug() << Q_FUNC_INFO << "Band: " << getBand();
//qDebug() << Q_FUNC_INFO << "Mode: " << getMode ();
query.clear ();
if (!query.prepare (_s))
{
@ -3027,7 +3020,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
query.bindValue(":country", getCountry());
query.bindValue(":credit_submitted", getCreditSubmitted());
query.bindValue(":credit_granted,", getCreditGranted());
query.bindValue (":darc_dok", getDarcDok ());
query.bindValue(":darc_dok", getDarcDok ());
query.bindValue(":distance", getDistance());
query.bindValue(":email", getEmail());
query.bindValue(":eq_call", getEQ_Call());
@ -3129,8 +3122,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
query.bindValue(":stx", getStx());
query.bindValue(":state", getState());
query.bindValue(":station_callsign", getStationCallsign());
//query.bindValue(":submode", getSubmode ());
query.bindValue(":modeid", getModeIdFromModeName (true));
//query.bindValue(":submode", getModeIdFromModeName (true));
query.bindValue(":swl", getSwl());
query.bindValue(":uksmg", getUksmg ());

View File

@ -399,7 +399,7 @@ private:
QString getModifyQueryString();
QSqlQuery getPreparedQuery(const QString &_s);
int getBandIdFromBandName(bool _rxBand=false); // if rxBand = true, it will chec the bandRX
int getModeIdFromModeName(bool _submode=false);
int getModeIdFromModeName();
int qsoId, logId, dxcc, a_index, k_index, cqz, fists, fists_cc, my_fists, iota_ID, itu_zone, nr_bursts, max_bursts, nr_pings, my_cqz, my_itu_zone, my_dxcc, my_iota_ID, srx, stx, uksmg;