mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Finish code to export a valid Cabrillo log.
This commit is contained in:
parent
5e9297bb74
commit
6e843a960b
@ -1,6 +1,7 @@
|
||||
#include "ExportCabrillo.h"
|
||||
#include "ui_exportCabrillo.h"
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "MessageBox.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
@ -18,27 +19,106 @@ ExportCabrillo::ExportCabrillo(QSettings *settings, QWidget *parent) :
|
||||
|
||||
ExportCabrillo::~ExportCabrillo()
|
||||
{
|
||||
if (isVisible ()) write_settings();
|
||||
if(isVisible()) write_settings();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExportCabrillo::closeEvent (QCloseEvent * e)
|
||||
{
|
||||
write_settings();
|
||||
QWidget::closeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ExportCabrillo::read_settings ()
|
||||
{
|
||||
SettingsGroup group {settings_, "ExportCabrillo"};
|
||||
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
||||
restoreGeometry (settings_->value("window/geometry").toByteArray());
|
||||
ui->lineEdit_1->setText(settings_->value("Location").toString());
|
||||
ui->lineEdit_2->setText(settings_->value("Contest").toString());
|
||||
ui->lineEdit_3->setText(settings_->value("Callsign").toString());
|
||||
ui->lineEdit_4->setText(settings_->value("Category-Operator").toString());
|
||||
ui->lineEdit_5->setText(settings_->value("Category-Transmitter").toString());
|
||||
ui->lineEdit_6->setText(settings_->value("Category-Power").toString());
|
||||
ui->lineEdit_7->setText(settings_->value("Category-Assisted").toString());
|
||||
ui->lineEdit_8->setText(settings_->value("Category-Band").toString());
|
||||
ui->lineEdit_9->setText(settings_->value("Claimed-Score").toString());
|
||||
ui->lineEdit_10->setText(settings_->value("Operators").toString());
|
||||
ui->lineEdit_11->setText(settings_->value("Club").toString());
|
||||
ui->lineEdit_12->setText(settings_->value("Name").toString());
|
||||
ui->lineEdit_13->setText(settings_->value("Address1").toString());
|
||||
ui->lineEdit_14->setText(settings_->value("Address2").toString());
|
||||
}
|
||||
|
||||
void ExportCabrillo::write_settings ()
|
||||
{
|
||||
SettingsGroup group {settings_, "ExportCabrillo"};
|
||||
settings_->setValue ("window/geometry", saveGeometry ());
|
||||
settings_->setValue("Location",ui->lineEdit_1->text());
|
||||
settings_->setValue("Contest",ui->lineEdit_2->text());
|
||||
settings_->setValue("Callsign",ui->lineEdit_3->text());
|
||||
settings_->setValue("Category-Operator",ui->lineEdit_4->text());
|
||||
settings_->setValue("Category-Transmitter",ui->lineEdit_5->text());
|
||||
settings_->setValue("Category-Power",ui->lineEdit_6->text());
|
||||
settings_->setValue("Category-Assisted",ui->lineEdit_7->text());
|
||||
settings_->setValue("Category-Band",ui->lineEdit_8->text());
|
||||
settings_->setValue("Claimed-Score",ui->lineEdit_9->text());
|
||||
settings_->setValue("Operators",ui->lineEdit_10->text());
|
||||
settings_->setValue("Club",ui->lineEdit_11->text());
|
||||
settings_->setValue("Name",ui->lineEdit_12->text());
|
||||
settings_->setValue("Address1",ui->lineEdit_13->text());
|
||||
settings_->setValue("Address2",ui->lineEdit_14->text());
|
||||
}
|
||||
|
||||
void ExportCabrillo::setFile(QString t)
|
||||
{
|
||||
m_CabLog=t;
|
||||
}
|
||||
|
||||
|
||||
void ExportCabrillo::on_pbSaveAs_clicked()
|
||||
{
|
||||
QString fname;
|
||||
QFileDialog saveAs(this);
|
||||
saveAs.setFileMode(QFileDialog::AnyFile);
|
||||
fname=saveAs.getSaveFileName(this, "Save File", "","Cabrillo Log (*.log)");
|
||||
qDebug() << "AA" << fname;
|
||||
QFile f {fname};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&f);
|
||||
out << "START-OF-LOG:3.0" << endl
|
||||
<< "LOCATION: " << ui->lineEdit_1->text() << endl
|
||||
<< "CONTEST: " << ui->lineEdit_2->text() << endl
|
||||
<< "CALLSIGN: " << ui->lineEdit_3->text() << endl
|
||||
<< "CATEGORY-OPERATOR: " << ui->lineEdit_4->text() << endl
|
||||
<< "CATEGORY-TRANSMITTER: " << ui->lineEdit_5->text() << endl
|
||||
<< "CATEGORY-POWER: " << ui->lineEdit_6->text() << endl
|
||||
<< "CATEGORY-ASSISTED: " << ui->lineEdit_7->text() << endl
|
||||
<< "CATEGORY-BAND: " << ui->lineEdit_8->text() << endl
|
||||
<< "CLAIMED-SCORE: " << ui->lineEdit_9->text() << endl
|
||||
<< "OPERATORS: " << ui->lineEdit_10->text() << endl
|
||||
<< "CLUB: " << ui->lineEdit_11->text() << endl
|
||||
<< "NAME: " << ui->lineEdit_12->text() << endl
|
||||
<< "ADDRESS: " << ui->lineEdit_13->text() << endl
|
||||
<< "ADDRESS: " << ui->lineEdit_14->text() << endl;
|
||||
|
||||
QFile f2(m_CabLog);
|
||||
if(f2.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream s(&f2);
|
||||
QString t=s.readAll();
|
||||
out << t << "END-OF-LOG:" << endl;
|
||||
f2.close();
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
auto const& message = tr ("Cannot open \"%1\" for writing: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ());
|
||||
MessageBox::warning_message (this, tr ("Export Cabrillo File Error"), message);
|
||||
}
|
||||
write_settings();
|
||||
}
|
||||
|
||||
void ExportCabrillo::accept()
|
||||
{
|
||||
write_settings();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
@ -14,13 +14,21 @@ class ExportCabrillo : public QDialog
|
||||
|
||||
public:
|
||||
explicit ExportCabrillo(QSettings *settings, QWidget *parent = 0);
|
||||
void setFile(QString t);
|
||||
~ExportCabrillo();
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent *) override;
|
||||
|
||||
private slots:
|
||||
void on_pbSaveAs_clicked();
|
||||
|
||||
private:
|
||||
QSettings * settings_;
|
||||
QString m_CabLog;
|
||||
void read_settings();
|
||||
void write_settings();
|
||||
Ui::ExportCabrillo *ui;
|
||||
|
@ -17,14 +17,14 @@
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<widget class="QLineEdit" name="lineEdit_1">
|
||||
<property name="text">
|
||||
<string>SNJ</string>
|
||||
</property>
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
else
|
||||
{
|
||||
url_valid_ = false; // reset
|
||||
qDebug () << "LotW Users Data downloaded from" << reply_->url ().toDisplayString ();
|
||||
// qDebug () << "LotW Users Data downloaded from" << reply_->url ().toDisplayString ();
|
||||
// load the database asynchronously
|
||||
future_load_ = std::async (std::launch::async, &LotWUsers::impl::load_dictionary, this, csv_file_.fileName ());
|
||||
}
|
||||
@ -201,7 +201,7 @@ public:
|
||||
auto pos = l.indexOf (',');
|
||||
result[l.left (pos)] = QDate::fromString (l.mid (pos + 1, l.indexOf (',', pos + 1) - pos - 1), "yyyy-MM-dd");
|
||||
}
|
||||
qDebug () << "LotW User Data Loaded";
|
||||
// qDebug () << "LotW User Data Loaded";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4610,7 +4610,6 @@ void MainWindow::genCQMsg ()
|
||||
QString t=ui->tx6->text();
|
||||
if((m_mode=="FT8" or m_mode=="MSK144") and m_nContest!=NONE and
|
||||
t.split(" ").at(1)==m_config.my_callsign()) {
|
||||
qDebug() << "aa" << m_nContest;
|
||||
if(m_nContest==NA_VHF) t="CQ TEST" + t.mid(2,-1);
|
||||
if(m_nContest==EU_VHF) t="CQ TEST" + t.mid(2,-1);
|
||||
if(m_nContest==FIELD_DAY) t="CQ FD" + t.mid(2,-1);
|
||||
@ -4676,7 +4675,6 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
|
||||
bool bHisCall=stdCall(hisCall);
|
||||
bool b77=(m_mode=="MSK144" or m_mode=="FT8") and
|
||||
(!bMyCall or !bHisCall or m_config.bGenerate77());
|
||||
// qDebug() << "aa" << my_callsign << hisCall << bMyCall << bHisCall << b77;
|
||||
|
||||
QString t0=hisBase + " " + m_baseCall + " ";
|
||||
QString t0a,t0b;
|
||||
@ -5979,8 +5977,9 @@ void MainWindow::on_actionExport_Cabrillo_log_triggered()
|
||||
if(!m_exportCabrillo) {
|
||||
m_exportCabrillo.reset(new ExportCabrillo{m_settings});
|
||||
}
|
||||
bool ret=m_exportCabrillo->exec();
|
||||
qDebug() << "aa" << ret;
|
||||
QString CabLog=m_config.writeable_data_dir ().absoluteFilePath ("cabrillo.log");
|
||||
m_exportCabrillo->setFile(CabLog);
|
||||
m_exportCabrillo->exec();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2633,11 +2633,11 @@ QPushButton[state="ok"] {
|
||||
<addaction name="actionErase_FoxQSO_txt"/>
|
||||
<addaction name="actionErase_wsjtx_log_adi"/>
|
||||
<addaction name="actionErase_cabrillo_log"/>
|
||||
<addaction name="actionExport_Cabrillo_log"/>
|
||||
<addaction name="actionOpen_log_directory"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExport_Cabrillo_log"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
|
@ -68,7 +68,7 @@ SOURCES += \
|
||||
WSPRBandHopping.cpp MessageAggregator.cpp SampleDownloader.cpp qt_helpers.cpp\
|
||||
MultiSettings.cpp PhaseEqualizationDialog.cpp IARURegions.cpp MessageBox.cpp \
|
||||
EqualizationToolsDialog.cpp CallsignValidator.cpp ExchangeValidator.cpp \
|
||||
colorhighlighting.cpp ExportCabrillo.cpp
|
||||
colorhighlighting.cpp ExportCabrillo.cpp LotWUsers.cpp
|
||||
|
||||
HEADERS += qt_helpers.hpp \
|
||||
pimpl_h.hpp pimpl_impl.hpp \
|
||||
@ -85,7 +85,7 @@ HEADERS += qt_helpers.hpp \
|
||||
messageaveraging.h echoplot.h echograph.h fastgraph.h fastplot.h Modes.hpp WSPRBandHopping.hpp \
|
||||
WsprTxScheduler.h SampleDownloader.hpp MultiSettings.hpp PhaseEqualizationDialog.hpp \
|
||||
IARURegions.hpp MessageBox.hpp EqualizationToolsDialog.hpp CallsignValidator.hpp \
|
||||
ExchangeValidator.hpp colorhighlighting.h ExportCabrillo.h
|
||||
ExchangeValidator.hpp colorhighlighting.h ExportCabrillo.h LotWUsers.h
|
||||
|
||||
|
||||
INCLUDEPATH += qmake_only
|
||||
|
Loading…
Reference in New Issue
Block a user