mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Take advantage of the new KVASD v1.12
Pass the temporary directory to jt9 and use it to give the correct paths to temporary files. Also jt9 passes the absolute path to kvasd.dat in the temporary directory to kvasd. Clear out all the annoying cruft that has accumulated due to having to run with $CWD as the temporary directory. Use QStandardPaths to find the writable data directory where needed rather than passing it around between objects. This now works because the $CWD hasn't been changed. Do away with the CMake option WSJT_STANDARD_FILE_LOCATIONS as it is no longer needed. Fix astro status file azel.dat formatting. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4732 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c7e74af254
commit
f37ed4cd78
@ -83,7 +83,6 @@ option (WSJT_QDEBUG_TO_FILE "Redirect Qt debuging messages to a trace file.")
|
|||||||
option (WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.")
|
option (WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.")
|
||||||
option (WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.")
|
option (WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.")
|
||||||
option (WSJT_HAMLIB_TRACE "Debugging option that turns on full Hamlib internal diagnostics.")
|
option (WSJT_HAMLIB_TRACE "Debugging option that turns on full Hamlib internal diagnostics.")
|
||||||
option (WSJT_STANDARD_FILE_LOCATIONS "All non-installation files located in \"Standard\" platfom specific locations." ON)
|
|
||||||
option (WSJT_SOFT_KEYING "Apply a ramp to CW keying envelope to reduce transients." ON)
|
option (WSJT_SOFT_KEYING "Apply a ramp to CW keying envelope to reduce transients." ON)
|
||||||
option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation.")
|
option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation.")
|
||||||
|
|
||||||
|
@ -343,9 +343,8 @@ private:
|
|||||||
|
|
||||||
QSettings * settings_;
|
QSettings * settings_;
|
||||||
|
|
||||||
QDir doc_path_;
|
QDir doc_dir_;
|
||||||
QDir temp_path_;
|
QDir temp_dir_;
|
||||||
QDir data_path_;
|
|
||||||
QDir default_save_directory_;
|
QDir default_save_directory_;
|
||||||
QDir save_directory_;
|
QDir save_directory_;
|
||||||
|
|
||||||
@ -438,8 +437,8 @@ Configuration::~Configuration ()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir Configuration::doc_path () const {return m_->doc_path_;}
|
QDir Configuration::doc_dir () const {return m_->doc_dir_;}
|
||||||
QDir Configuration::data_path () const {return m_->data_path_;}
|
QDir Configuration::temp_dir () const {return m_->temp_dir_;}
|
||||||
|
|
||||||
int Configuration::exec () {return m_->exec ();}
|
int Configuration::exec () {return m_->exec ();}
|
||||||
|
|
||||||
@ -554,9 +553,6 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
|
|||||||
, self_ {self}
|
, self_ {self}
|
||||||
, ui_ {new Ui::configuration_dialog}
|
, ui_ {new Ui::configuration_dialog}
|
||||||
, settings_ {settings}
|
, settings_ {settings}
|
||||||
, doc_path_ {QApplication::applicationDirPath ()}
|
|
||||||
, temp_path_ {QApplication::applicationDirPath ()}
|
|
||||||
, data_path_ {QApplication::applicationDirPath ()}
|
|
||||||
, font_ {QApplication::font ()}
|
, font_ {QApplication::font ()}
|
||||||
, font_changed_ {false}
|
, font_changed_ {false}
|
||||||
, decoded_text_font_changed_ {false}
|
, decoded_text_font_changed_ {false}
|
||||||
@ -601,64 +597,51 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
|
|||||||
#define WSJT_DOC_DESTINATION "."
|
#define WSJT_DOC_DESTINATION "."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// we must find this before changing the CWD since that breaks
|
|
||||||
// QCoreApplication::applicationDirPath() which is used internally
|
|
||||||
// by QStandardPaths :(
|
|
||||||
#if !defined (Q_OS_WIN) || QT_VERSION >= 0x050300
|
#if !defined (Q_OS_WIN) || QT_VERSION >= 0x050300
|
||||||
auto path = QStandardPaths::locate (QStandardPaths::DataLocation, WSJT_DOC_DESTINATION, QStandardPaths::LocateDirectory);
|
auto path = QStandardPaths::locate (QStandardPaths::DataLocation, WSJT_DOC_DESTINATION, QStandardPaths::LocateDirectory);
|
||||||
if (path.isEmpty ())
|
if (path.isEmpty ())
|
||||||
{
|
{
|
||||||
doc_path_.cdUp ();
|
doc_dir_.cdUp ();
|
||||||
#if defined (Q_OS_MAC)
|
#if defined (Q_OS_MAC)
|
||||||
doc_path_.cdUp ();
|
doc_dir_.cdUp ();
|
||||||
doc_path_.cdUp ();
|
doc_dir_.cdUp ();
|
||||||
#endif
|
#endif
|
||||||
doc_path_.cd (WSJT_SHARE_DESTINATION);
|
doc_dir_.cd (WSJT_SHARE_DESTINATION);
|
||||||
doc_path_.cd (WSJT_DOC_DESTINATION);
|
doc_dir_.cd (WSJT_DOC_DESTINATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
doc_path_.cd (path);
|
doc_dir_.cd (path);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
doc_path_.cd (WSJT_DOC_DESTINATION);
|
doc_dir_.cd (WSJT_DOC_DESTINATION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WSJT_STANDARD_FILE_LOCATIONS
|
|
||||||
// the following needs to be done on all platforms but changes need
|
|
||||||
// coordination with JTAlert developers
|
|
||||||
{
|
{
|
||||||
// Create a temporary directory in a suitable location
|
// Create a temporary directory in a suitable location
|
||||||
QString temp_location {QStandardPaths::writableLocation (QStandardPaths::TempLocation)};
|
QString temp_location {QStandardPaths::writableLocation (QStandardPaths::TempLocation)};
|
||||||
if (!temp_location.isEmpty ())
|
if (!temp_location.isEmpty ())
|
||||||
{
|
{
|
||||||
temp_path_.setPath (temp_location);
|
temp_dir_.setPath (temp_location);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString unique_directory {QApplication::applicationName ()};
|
QString unique_directory {QApplication::applicationName ()};
|
||||||
if (!temp_path_.mkpath (unique_directory) || !temp_path_.cd (unique_directory))
|
if (!temp_dir_.mkpath (unique_directory) || !temp_dir_.cd (unique_directory))
|
||||||
{
|
{
|
||||||
QMessageBox::critical (this, "WSJT-X", tr ("Create temporary directory error: ") + temp_path_.absolutePath ());
|
QMessageBox::critical (this, "WSJT-X", tr ("Create temporary directory error: ") + temp_dir_.absolutePath ());
|
||||||
throw std::runtime_error {"Failed to create usable temporary directory"};
|
throw std::runtime_error {"Failed to create usable temporary directory"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// kvasd writes files to $cwd so by changing to the temp directory
|
// copy the kvasd.dat file used for inter-process communication with
|
||||||
// we can keep these files out of the startup directory
|
// kvasd from the resources file system to the temporary directory
|
||||||
QDir::setCurrent (temp_path_.absolutePath ());
|
|
||||||
|
|
||||||
// we run kvasd with a $cwd of our temp directory so we need to copy
|
|
||||||
// in a fresh kvasd.dat for it
|
|
||||||
//
|
|
||||||
// this requirement changes with kvasd v 1.12 since it has a
|
|
||||||
// parameter to set the data file path
|
|
||||||
QString kvasd_data_file {"kvasd.dat"};
|
QString kvasd_data_file {"kvasd.dat"};
|
||||||
if (!temp_path_.exists (kvasd_data_file))
|
if (!temp_dir_.exists (kvasd_data_file))
|
||||||
{
|
{
|
||||||
auto dest_file = temp_path_.absoluteFilePath (kvasd_data_file);
|
auto dest_file = temp_dir_.absoluteFilePath (kvasd_data_file);
|
||||||
if (!QFile::copy (":/" + kvasd_data_file, dest_file))
|
if (!QFile::copy (":/" + kvasd_data_file, dest_file))
|
||||||
{
|
{
|
||||||
QMessageBox::critical (this, "WSJT-X", tr ("Cannot copy: :/") + kvasd_data_file + tr (" to: ") + temp_path_.absolutePath ());
|
QMessageBox::critical (this, "WSJT-X", tr ("Cannot copy: :/") + kvasd_data_file + tr (" to: ") + temp_dir_.absolutePath ());
|
||||||
throw std::runtime_error {"Failed to copy kvasd.dat to temporary directory"};
|
throw std::runtime_error {"Failed to copy kvasd.dat to temporary directory"};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -670,30 +653,16 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Find a suitable data file location
|
// Find a suitable data file location
|
||||||
QString data_location {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
|
QDir data_dir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
|
||||||
if (!data_location.isEmpty ())
|
if (!data_dir.mkpath ("."))
|
||||||
{
|
{
|
||||||
data_path_.setPath (data_location);
|
QMessageBox::critical (this, "WSJT-X", tr ("Create data directory error: ") + data_dir.absolutePath ());
|
||||||
}
|
|
||||||
|
|
||||||
if (!data_path_.mkpath ("."))
|
|
||||||
{
|
|
||||||
QMessageBox::critical (this, "WSJT-X", tr ("Create data directory error: ") + data_path_.absolutePath ());
|
|
||||||
throw std::runtime_error {"Failed to create data directory"};
|
throw std::runtime_error {"Failed to create data directory"};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// qDebug () << "Data store path:" << data_path_.absolutePath ();
|
|
||||||
// auto paths = QStandardPaths::standardLocations (QStandardPaths::DataLocation);
|
|
||||||
// Q_FOREACH (auto const& path, paths)
|
|
||||||
// {
|
|
||||||
// qDebug () << "path:" << path;
|
|
||||||
// }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
// Make sure the default save directory exists
|
// Make sure the default save directory exists
|
||||||
QString save_dir {"save"};
|
QString save_dir {"save"};
|
||||||
default_save_directory_ = data_path_;
|
default_save_directory_ = data_dir;
|
||||||
if (!default_save_directory_.mkpath (save_dir) || !default_save_directory_.cd (save_dir))
|
if (!default_save_directory_.mkpath (save_dir) || !default_save_directory_.cd (save_dir))
|
||||||
{
|
{
|
||||||
QMessageBox::critical (this, "WSJT-X", tr ("Create Directory", "Cannot create directory \"") + default_save_directory_.absoluteFilePath (save_dir) + "\".");
|
QMessageBox::critical (this, "WSJT-X", tr ("Create Directory", "Cannot create directory \"") + default_save_directory_.absoluteFilePath (save_dir) + "\".");
|
||||||
@ -869,10 +838,7 @@ Configuration::impl::~impl ()
|
|||||||
transceiver_thread_.quit ();
|
transceiver_thread_.quit ();
|
||||||
transceiver_thread_.wait ();
|
transceiver_thread_.wait ();
|
||||||
|
|
||||||
QDir::setCurrent (QApplication::applicationDirPath ());
|
temp_dir_.removeRecursively (); // clean up temp files
|
||||||
#if WSJT_STANDARD_FILE_LOCATIONS
|
|
||||||
temp_path_.removeRecursively (); // clean up temp files
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configuration::impl::initialise_models ()
|
void Configuration::impl::initialise_models ()
|
||||||
@ -1809,7 +1775,6 @@ bool Configuration::impl::open_rig ()
|
|||||||
, static_cast<TransceiverFactory::SplitMode> (ui_->split_mode_button_group->checkedId ())
|
, static_cast<TransceiverFactory::SplitMode> (ui_->split_mode_button_group->checkedId ())
|
||||||
, ui_->PTT_port_combo_box->currentText ()
|
, ui_->PTT_port_combo_box->currentText ()
|
||||||
, ui_->CAT_poll_interval_spin_box->value () * 1000
|
, ui_->CAT_poll_interval_spin_box->value () * 1000
|
||||||
, data_path_
|
|
||||||
, &transceiver_thread_
|
, &transceiver_thread_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ public:
|
|||||||
|
|
||||||
int exec ();
|
int exec ();
|
||||||
|
|
||||||
QDir data_path () const;
|
QDir temp_dir () const;
|
||||||
QDir doc_path () const;
|
QDir doc_dir () const;
|
||||||
|
|
||||||
QAudioDeviceInfo const& audio_input_device () const;
|
QAudioDeviceInfo const& audio_input_device () const;
|
||||||
AudioDevice::Channel audio_input_channel () const;
|
AudioDevice::Channel audio_input_channel () const;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "NetworkServerLookup.hpp"
|
#include "NetworkServerLookup.hpp"
|
||||||
|
|
||||||
@ -66,13 +68,11 @@ qint32 const HRDMessage::magic_2_value_ (0xABCD1234);
|
|||||||
HRDTransceiver::HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped
|
HRDTransceiver::HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped
|
||||||
, QString const& server
|
, QString const& server
|
||||||
, bool use_for_ptt
|
, bool use_for_ptt
|
||||||
, int poll_interval
|
, int poll_interval)
|
||||||
, QDir const& data_path)
|
|
||||||
: PollingTransceiver {poll_interval}
|
: PollingTransceiver {poll_interval}
|
||||||
, wrapped_ {std::move (wrapped)}
|
, wrapped_ {std::move (wrapped)}
|
||||||
, use_for_ptt_ {use_for_ptt}
|
, use_for_ptt_ {use_for_ptt}
|
||||||
, server_ {server}
|
, server_ {server}
|
||||||
, data_path_ {data_path}
|
|
||||||
, hrd_ {0}
|
, hrd_ {0}
|
||||||
, protocol_ {none}
|
, protocol_ {none}
|
||||||
, current_radio_ {0}
|
, current_radio_ {0}
|
||||||
@ -158,11 +158,10 @@ void HRDTransceiver::do_start ()
|
|||||||
send_command ("get context", false, false);
|
send_command ("get context", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HRD_info_path {data_path_.absoluteFilePath ("HRD Interface Information.txt")};
|
QFile HRD_info_file {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("HRD Interface Information.txt")};
|
||||||
QFile HRD_info_file {HRD_info_path};
|
|
||||||
if (!HRD_info_file.open (QFile::WriteOnly | QFile::Text | QFile::Truncate))
|
if (!HRD_info_file.open (QFile::WriteOnly | QFile::Text | QFile::Truncate))
|
||||||
{
|
{
|
||||||
throw error {tr ("Failed to open file \"%1\".").arg (HRD_info_path)};
|
throw error {tr ("Failed to open file \"%1\".").arg (HRD_info_file.fileName ())};
|
||||||
}
|
}
|
||||||
QTextStream HRD_info {&HRD_info_file};
|
QTextStream HRD_info {&HRD_info_file};
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include "TransceiverFactory.hpp"
|
#include "TransceiverFactory.hpp"
|
||||||
#include "PollingTransceiver.hpp"
|
#include "PollingTransceiver.hpp"
|
||||||
@ -34,8 +33,7 @@ public:
|
|||||||
explicit HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped
|
explicit HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped
|
||||||
, QString const& server
|
, QString const& server
|
||||||
, bool use_for_ptt
|
, bool use_for_ptt
|
||||||
, int poll_interval
|
, int poll_interval);
|
||||||
, QDir const& data_path);
|
|
||||||
~HRDTransceiver ();
|
~HRDTransceiver ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -81,8 +79,6 @@ private:
|
|||||||
QString server_; // The TCP/IP addrress and port for
|
QString server_; // The TCP/IP addrress and port for
|
||||||
// the HRD server.
|
// the HRD server.
|
||||||
|
|
||||||
QDir data_path_; // Directory to write files to
|
|
||||||
|
|
||||||
QTcpSocket * hrd_; // The TCP/IP client that links to the
|
QTcpSocket * hrd_; // The TCP/IP client that links to the
|
||||||
// HRD server.
|
// HRD server.
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
|
|||||||
, SplitMode split_mode
|
, SplitMode split_mode
|
||||||
, QString const& ptt_port
|
, QString const& ptt_port
|
||||||
, int poll_interval
|
, int poll_interval
|
||||||
, QDir const& data_path
|
|
||||||
, QThread * target_thread
|
, QThread * target_thread
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -170,7 +169,7 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
|
|||||||
}
|
}
|
||||||
|
|
||||||
// wrap the basic Transceiver object instance with a decorator object that talks to ham Radio Deluxe
|
// wrap the basic Transceiver object instance with a decorator object that talks to ham Radio Deluxe
|
||||||
result.reset (new HRDTransceiver {std::move (basic_transceiver), cat_port, PTT_method_CAT == ptt_type, poll_interval, data_path});
|
result.reset (new HRDTransceiver {std::move (basic_transceiver), cat_port, PTT_method_CAT == ptt_type, poll_interval});
|
||||||
if (target_thread)
|
if (target_thread)
|
||||||
{
|
{
|
||||||
result.get ()->moveToThread (target_thread);
|
result.get ()->moveToThread (target_thread);
|
||||||
|
@ -112,7 +112,6 @@ public:
|
|||||||
, SplitMode split_mode // how to support split TX mode
|
, SplitMode split_mode // how to support split TX mode
|
||||||
, QString const& ptt_port // serial port device name or special value "CAT"
|
, QString const& ptt_port // serial port device name or special value "CAT"
|
||||||
, int poll_interval // in milliseconds for interfaces that require polling for parameter changes
|
, int poll_interval // in milliseconds for interfaces that require polling for parameter changes
|
||||||
, QDir const& data_path
|
|
||||||
, QThread * target_thread = nullptr
|
, QThread * target_thread = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
393
astro.cpp
393
astro.cpp
@ -1,187 +1,206 @@
|
|||||||
#include "astro.h"
|
#include "astro.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include "commons.h"
|
#include <QDir>
|
||||||
|
|
||||||
#include "ui_astro.h"
|
#include "commons.h"
|
||||||
|
|
||||||
#include "moc_astro.cpp"
|
#include "ui_astro.h"
|
||||||
|
|
||||||
Astro::Astro(QSettings * settings, QDir const& dataPath, QWidget * parent) :
|
#include "moc_astro.cpp"
|
||||||
QWidget {parent},
|
|
||||||
settings_ {settings},
|
Astro::Astro(QSettings * settings, QWidget * parent)
|
||||||
ui_ {new Ui::Astro},
|
: QWidget {parent}
|
||||||
data_path_ {dataPath}
|
, settings_ {settings}
|
||||||
{
|
, ui_ {new Ui::Astro}
|
||||||
ui_->setupUi(this);
|
{
|
||||||
|
ui_->setupUi(this);
|
||||||
setWindowFlags (Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
|
|
||||||
|
setWindowFlags (Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
|
||||||
setWindowTitle(QApplication::applicationName () + " - " + tr ("Astronomical Data"));
|
|
||||||
|
setWindowTitle(QApplication::applicationName () + " - " + tr ("Astronomical Data"));
|
||||||
read_settings ();
|
|
||||||
|
read_settings ();
|
||||||
ui_->text_label->clear();
|
|
||||||
}
|
ui_->text_label->clear();
|
||||||
|
}
|
||||||
Astro::~Astro ()
|
|
||||||
{
|
Astro::~Astro ()
|
||||||
if (isVisible ())
|
{
|
||||||
{
|
if (isVisible ())
|
||||||
write_settings ();
|
{
|
||||||
}
|
write_settings ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void Astro::closeEvent (QCloseEvent * e)
|
|
||||||
{
|
void Astro::closeEvent (QCloseEvent * e)
|
||||||
write_settings ();
|
{
|
||||||
QWidget::closeEvent (e);
|
write_settings ();
|
||||||
}
|
QWidget::closeEvent (e);
|
||||||
|
}
|
||||||
void Astro::read_settings ()
|
|
||||||
{
|
void Astro::read_settings ()
|
||||||
settings_->beginGroup ("Astro");
|
{
|
||||||
move (settings_->value ("window/pos", pos ()).toPoint ());
|
settings_->beginGroup ("Astro");
|
||||||
QFont font;
|
move (settings_->value ("window/pos", pos ()).toPoint ());
|
||||||
if (font.fromString (settings_->value ("font", ui_->text_label->font ().toString ()).toString ()))
|
QFont font;
|
||||||
{
|
if (font.fromString (settings_->value ("font", ui_->text_label->font ().toString ()).toString ()))
|
||||||
ui_->text_label->setFont (font);
|
{
|
||||||
adjustSize ();
|
ui_->text_label->setFont (font);
|
||||||
}
|
adjustSize ();
|
||||||
settings_->endGroup ();
|
}
|
||||||
}
|
settings_->endGroup ();
|
||||||
|
}
|
||||||
void Astro::write_settings ()
|
|
||||||
{
|
void Astro::write_settings ()
|
||||||
settings_->beginGroup ("Astro");
|
{
|
||||||
settings_->setValue ("window/pos", pos ());
|
settings_->beginGroup ("Astro");
|
||||||
settings_->setValue ("font", ui_->text_label->font ().toString ());
|
settings_->setValue ("window/pos", pos ());
|
||||||
settings_->endGroup ();
|
settings_->setValue ("font", ui_->text_label->font ().toString ());
|
||||||
}
|
settings_->endGroup ();
|
||||||
|
}
|
||||||
void Astro::on_font_push_button_clicked (bool /* checked */)
|
|
||||||
{
|
void Astro::on_font_push_button_clicked (bool /* checked */)
|
||||||
bool changed;
|
{
|
||||||
ui_->text_label->setFont (QFontDialog::getFont (&changed
|
bool changed;
|
||||||
, ui_->text_label->font ()
|
ui_->text_label->setFont (QFontDialog::getFont (&changed
|
||||||
, this
|
, ui_->text_label->font ()
|
||||||
, tr ("WSJT-X Astro Text Font Chooser")
|
, this
|
||||||
#if QT_VERSION >= 0x050201
|
, tr ("WSJT-X Astro Text Font Chooser")
|
||||||
, QFontDialog::MonospacedFonts
|
#if QT_VERSION >= 0x050201
|
||||||
#endif
|
, QFontDialog::MonospacedFonts
|
||||||
));
|
#endif
|
||||||
if (changed)
|
));
|
||||||
{
|
if (changed)
|
||||||
adjustSize ();
|
{
|
||||||
}
|
adjustSize ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
|
||||||
int fQSO, int nsetftx, int ntxFreq)
|
void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
||||||
{
|
int fQSO, int nsetftx, int ntxFreq)
|
||||||
static int ntxFreq0=-99;
|
{
|
||||||
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
|
static int ntxFreq0=-99;
|
||||||
double ramoon,decmoon,dgrd,poloffset,xnr,techo;
|
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
|
||||||
int ntsky,ndop,ndop00;
|
double ramoon,decmoon,dgrd,poloffset,xnr,techo;
|
||||||
QString date = t.date().toString("yyyy MMM dd").trimmed ();
|
int ntsky,ndop,ndop00;
|
||||||
QString utc = t.time().toString().trimmed ();
|
QString date = t.date().toString("yyyy MMM dd").trimmed ();
|
||||||
int nyear=t.date().year();
|
QString utc = t.time().toString().trimmed ();
|
||||||
int month=t.date().month();
|
int nyear=t.date().year();
|
||||||
int nday=t.date().day();
|
int month=t.date().month();
|
||||||
int nhr=t.time().hour();
|
int nday=t.date().day();
|
||||||
int nmin=t.time().minute();
|
int nhr=t.time().hour();
|
||||||
double sec=t.time().second() + 0.001*t.time().msec();
|
int nmin=t.time().minute();
|
||||||
int isec=sec;
|
double sec=t.time().second() + 0.001*t.time().msec();
|
||||||
double uth=nhr + nmin/60.0 + sec/3600.0;
|
int isec=sec;
|
||||||
// int nfreq=(int)datcom_.fcenter;
|
double uth=nhr + nmin/60.0 + sec/3600.0;
|
||||||
int nfreq=10368;
|
// int nfreq=(int)datcom_.fcenter;
|
||||||
if(nfreq<10 or nfreq > 50000) nfreq=144;
|
int nfreq=10368;
|
||||||
|
if(nfreq<10 or nfreq > 50000) nfreq=144;
|
||||||
astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(),
|
|
||||||
hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
|
astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(),
|
||||||
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
|
hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
|
||||||
&dgrd, &poloffset, &xnr, &techo, 6, 6);
|
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
|
||||||
|
&dgrd, &poloffset, &xnr, &techo, 6, 6);
|
||||||
QString message;
|
|
||||||
{
|
QString message;
|
||||||
QTextStream out {&message};
|
{
|
||||||
out
|
QTextStream out {&message};
|
||||||
<< " " << date << "\n"
|
out
|
||||||
"UTC: " << utc << "\n"
|
<< " " << date << "\n"
|
||||||
<< fixed
|
"UTC: " << utc << "\n"
|
||||||
<< qSetFieldWidth (6)
|
<< fixed
|
||||||
<< qSetRealNumberPrecision (1)
|
<< qSetFieldWidth (6)
|
||||||
<< "Az: " << azmoon << "\n"
|
<< qSetRealNumberPrecision (1)
|
||||||
"El: " << elmoon << "\n"
|
<< "Az: " << azmoon << "\n"
|
||||||
"MyDop: " << ndop00 << "\n"
|
"El: " << elmoon << "\n"
|
||||||
<< qSetRealNumberPrecision (2)
|
"MyDop: " << ndop00 << "\n"
|
||||||
<< "Delay: " << techo << "\n"
|
<< qSetRealNumberPrecision (2)
|
||||||
<< qSetRealNumberPrecision (1)
|
<< "Delay: " << techo << "\n"
|
||||||
<< "DxAz: " << azmoondx << "\n"
|
<< qSetRealNumberPrecision (1)
|
||||||
"DxEl: " << elmoondx << "\n"
|
<< "DxAz: " << azmoondx << "\n"
|
||||||
"DxDop: " << ndop << "\n"
|
"DxEl: " << elmoondx << "\n"
|
||||||
"Dec: " << decmoon << "\n"
|
"DxDop: " << ndop << "\n"
|
||||||
"SunAz: " << azsun << "\n"
|
"Dec: " << decmoon << "\n"
|
||||||
"SunEl: " << elsun << "\n"
|
"SunAz: " << azsun << "\n"
|
||||||
"Freq: " << nfreq << "\n"
|
"SunEl: " << elsun << "\n"
|
||||||
"Tsky: " << ntsky << "\n"
|
"Freq: " << nfreq << "\n"
|
||||||
"MNR: " << xnr << "\n"
|
"Tsky: " << ntsky << "\n"
|
||||||
"Dgrd: " << dgrd;
|
"MNR: " << xnr << "\n"
|
||||||
}
|
"Dgrd: " << dgrd;
|
||||||
ui_->text_label->setText(message);
|
}
|
||||||
|
ui_->text_label->setText(message);
|
||||||
QString fname {"azel.dat"};
|
|
||||||
QFile f(data_path_.absoluteFilePath (fname));
|
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("azel.dat")};
|
||||||
if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (!f.open (QIODevice::WriteOnly | QIODevice::Text))
|
||||||
QMessageBox mb;
|
{
|
||||||
mb.setText("Cannot open \"" + f.fileName () + "\".");
|
QMessageBox mb;
|
||||||
mb.exec();
|
mb.setText ("Cannot open \"" + f.fileName () + "\".");
|
||||||
return;
|
mb.exec();
|
||||||
}
|
return;
|
||||||
int ndiff=0;
|
}
|
||||||
if(ntxFreq != ntxFreq0) ndiff=1;
|
int ndiff=0;
|
||||||
ntxFreq0=ntxFreq;
|
if(ntxFreq != ntxFreq0) ndiff=1;
|
||||||
{
|
ntxFreq0=ntxFreq;
|
||||||
QTextStream out {&f};
|
{
|
||||||
out << fixed
|
QTextStream out {&f};
|
||||||
<< qSetFieldWidth (2)
|
out << fixed
|
||||||
<< qSetRealNumberPrecision (1)
|
<< qSetRealNumberPrecision (1)
|
||||||
<< qSetPadChar ('0')
|
<< qSetPadChar ('0')
|
||||||
<< right
|
<< right
|
||||||
<< nhr << ':' << nmin << ':' << isec
|
<< qSetFieldWidth (2) << nhr
|
||||||
<< qSetFieldWidth (5)
|
<< qSetFieldWidth (0) << ':'
|
||||||
<< ',' << azmoon << ',' << elmoon << ",Moon\n"
|
<< qSetFieldWidth (2) << nmin
|
||||||
<< qSetFieldWidth (2)
|
<< qSetFieldWidth (0) << ':'
|
||||||
<< nhr << ':' << nmin << ':' << isec
|
<< qSetFieldWidth (2) << isec
|
||||||
<< qSetFieldWidth (5)
|
<< qSetFieldWidth (0) << ','
|
||||||
<< ',' << azsun << ',' << elsun << ",Sun\n"
|
<< qSetFieldWidth (5) << azmoon
|
||||||
<< qSetFieldWidth (2)
|
<< qSetFieldWidth (0) << ','
|
||||||
<< nhr << ':' << nmin << ':' << isec
|
<< qSetFieldWidth (5) << elmoon
|
||||||
<< qSetFieldWidth (5)
|
<< qSetFieldWidth (0) << ",Moon\n"
|
||||||
<< ',' << 0. << ',' << 0. << ",Sun\n"
|
<< qSetFieldWidth (2) << nhr
|
||||||
<< qSetPadChar (' ')
|
<< qSetFieldWidth (0) << ':'
|
||||||
<< qSetFieldWidth (4)
|
<< qSetFieldWidth (2) << nmin
|
||||||
<< nfreq << ','
|
<< qSetFieldWidth (0) << ':'
|
||||||
<< qSetFieldWidth (6)
|
<< qSetFieldWidth (2) << isec
|
||||||
<< ndop << ",Doppler\n"
|
<< qSetFieldWidth (0) << ','
|
||||||
<< qSetFieldWidth (3)
|
<< qSetFieldWidth (5) << azsun
|
||||||
<< fQSO << ','
|
<< qSetFieldWidth (0) << ','
|
||||||
<< qSetFieldWidth (1)
|
<< qSetFieldWidth (5) << elsun
|
||||||
<< nsetftx << ",fQSO\n"
|
<< qSetFieldWidth (0) << ",Sun\n"
|
||||||
<< qSetFieldWidth (3)
|
<< qSetFieldWidth (2) << nhr
|
||||||
<< ntxFreq << ','
|
<< qSetFieldWidth (0) << ':'
|
||||||
<< qSetFieldWidth (1)
|
<< qSetFieldWidth (2) << nmin
|
||||||
<< ndiff << ",fQSO2";
|
<< qSetFieldWidth (0) << ':'
|
||||||
}
|
<< qSetFieldWidth (2) << isec
|
||||||
f.close();
|
<< qSetFieldWidth (0) << ','
|
||||||
}
|
<< qSetFieldWidth (5) << 0.
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (5) << 0.
|
||||||
|
<< qSetFieldWidth (0) << ",Sun\n"
|
||||||
|
<< qSetPadChar (' ')
|
||||||
|
<< qSetFieldWidth (4) << nfreq
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (6) << ndop
|
||||||
|
<< qSetFieldWidth (0) << ",Doppler\n"
|
||||||
|
<< qSetFieldWidth (3) << fQSO
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (1) << nsetftx
|
||||||
|
<< qSetFieldWidth (0) << ",fQSO\n"
|
||||||
|
<< qSetFieldWidth (3) << ntxFreq
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (1) << ndiff
|
||||||
|
<< qSetFieldWidth (0) << ",fQSO2";
|
||||||
|
}
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
103
astro.h
103
astro.h
@ -1,52 +1,51 @@
|
|||||||
// -*- Mode: C++ -*-
|
// -*- Mode: C++ -*-
|
||||||
#ifndef ASTRO_H
|
#ifndef ASTRO_H
|
||||||
#define ASTRO_H
|
#define ASTRO_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Astro;
|
class Astro;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Astro final
|
class Astro final
|
||||||
: public QWidget
|
: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY (Astro);
|
Q_DISABLE_COPY (Astro);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Astro(QSettings * settings, QDir const& dataPath, QWidget * parent = nullptr);
|
explicit Astro(QSettings * settings, QWidget * parent = nullptr);
|
||||||
~Astro ();
|
~Astro ();
|
||||||
|
|
||||||
void astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
void astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
||||||
int fQSO, int nsetftx, int ntxFreq);
|
int fQSO, int nsetftx, int ntxFreq);
|
||||||
|
|
||||||
Q_SLOT void on_font_push_button_clicked (bool);
|
Q_SLOT void on_font_push_button_clicked (bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent (QCloseEvent *) override;
|
void closeEvent (QCloseEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void read_settings ();
|
void read_settings ();
|
||||||
void write_settings ();
|
void write_settings ();
|
||||||
|
|
||||||
QSettings * settings_;
|
QSettings * settings_;
|
||||||
QScopedPointer<Ui::Astro> ui_;
|
QScopedPointer<Ui::Astro> ui_;
|
||||||
QDir data_path_;
|
};
|
||||||
};
|
|
||||||
|
extern "C" {
|
||||||
extern "C" {
|
void astrosub_(int* nyear, int* month, int* nday, double* uth, int* nfreq,
|
||||||
void astrosub_(int* nyear, int* month, int* nday, double* uth, int* nfreq,
|
const char* mygrid, const char* hisgrid, double* azsun,
|
||||||
const char* mygrid, const char* hisgrid, double* azsun,
|
double* elsun, double* azmoon, double* elmoon, double* azmoondx,
|
||||||
double* elsun, double* azmoon, double* elmoon, double* azmoondx,
|
double* elmoondx, int* ntsky, int* ndop, int* ndop00,
|
||||||
double* elmoondx, int* ntsky, int* ndop, int* ndop00,
|
double* ramoon, double* decmoon, double* dgrd, double* poloffset,
|
||||||
double* ramoon, double* decmoon, double* dgrd, double* poloffset,
|
double* xnr, double* techo, int len1, int len2);
|
||||||
double* xnr, double* techo, int len1, int len2);
|
}
|
||||||
}
|
|
||||||
|
#endif // ASTRO_H
|
||||||
#endif // ASTRO_H
|
|
||||||
|
@ -27,12 +27,12 @@ subroutine decoder(ss,id2)
|
|||||||
ndecodes1=0
|
ndecodes1=0
|
||||||
|
|
||||||
if (nagain .eq. 0) then
|
if (nagain .eq. 0) then
|
||||||
open(13,file='decoded.txt',status='unknown')
|
open(13,file=trim(temp_dir)//'/decoded.txt',status='unknown')
|
||||||
else
|
else
|
||||||
open(13,file='decoded.txt',status='unknown',position='append')
|
open(13,file=trim(temp_dir)//'/decoded.txt',status='unknown',position='append')
|
||||||
end if
|
end if
|
||||||
|
|
||||||
open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown')
|
open(22,file=trim(temp_dir)//'/kvasd.dat',access='direct',recl=1024,status='unknown')
|
||||||
|
|
||||||
npts65=52*12000
|
npts65=52*12000
|
||||||
if(baddata(id2,npts65)) then
|
if(baddata(id2,npts65)) then
|
||||||
|
238
lib/extract.F90
238
lib/extract.F90
@ -1,121 +1,117 @@
|
|||||||
subroutine extract(s3,nadd,ncount,nhist,decoded,ltext,nbmkv)
|
subroutine extract(s3,nadd,ncount,nhist,decoded,ltext,nbmkv)
|
||||||
!subroutine extract(s3,nadd,nbirdie,afac1,xlambda,ncount,nhist,decoded, &
|
!subroutine extract(s3,nadd,nbirdie,afac1,xlambda,ncount,nhist,decoded, &
|
||||||
! ltext,nbmkv,ntest)
|
! ltext,nbmkv,ntest)
|
||||||
|
|
||||||
|
|
||||||
! Input:
|
! Input:
|
||||||
! s3 64-point spectra for each of 63 data symbols
|
! s3 64-point spectra for each of 63 data symbols
|
||||||
! nadd number of spectra summed into s3
|
! nadd number of spectra summed into s3
|
||||||
|
|
||||||
! Output:
|
! Output:
|
||||||
! ncount number of symbols requiring correction
|
! ncount number of symbols requiring correction
|
||||||
! nhist maximum number of identical symbol values
|
! nhist maximum number of identical symbol values
|
||||||
! decoded decoded message (if ncount >=0)
|
! decoded decoded message (if ncount >=0)
|
||||||
! ltext true if decoded message is free text
|
! ltext true if decoded message is free text
|
||||||
! nbmkv 0=no decode; 1=BM decode; 2=KV decode
|
! nbmkv 0=no decode; 1=BM decode; 2=KV decode
|
||||||
|
|
||||||
use prog_args !shm_key, exe_dir, data_dir
|
use prog_args !shm_key, exe_dir, data_dir
|
||||||
|
|
||||||
real s3(64,63)
|
real s3(64,63)
|
||||||
character decoded*22
|
character decoded*22
|
||||||
integer dat4(12)
|
integer dat4(12)
|
||||||
integer mrsym(63),mr2sym(63),mrprob(63),mr2prob(63)
|
integer mrsym(63),mr2sym(63),mrprob(63),mr2prob(63)
|
||||||
logical nokv,ltext
|
logical nokv,ltext
|
||||||
data nokv/.false./,nsec1/0/
|
data nokv/.false./,nsec1/0/
|
||||||
save
|
save
|
||||||
|
|
||||||
nbirdie=7
|
nbirdie=7
|
||||||
npct=40
|
npct=40
|
||||||
afac1=10.1
|
afac1=10.1
|
||||||
xlambda=8.0
|
xlambda=8.0
|
||||||
nbmkv=0
|
nbmkv=0
|
||||||
nfail=0
|
nfail=0
|
||||||
decoded=' '
|
decoded=' '
|
||||||
call pctile(s3,4032,npct,base)
|
call pctile(s3,4032,npct,base)
|
||||||
s3=s3/base
|
s3=s3/base
|
||||||
|
|
||||||
! Get most reliable and second-most-reliable symbol values, and their
|
! Get most reliable and second-most-reliable symbol values, and their
|
||||||
! probabilities
|
! probabilities
|
||||||
1 call demod64a(s3,nadd,afac1,mrsym,mrprob,mr2sym,mr2prob,ntest,nlow)
|
1 call demod64a(s3,nadd,afac1,mrsym,mrprob,mr2sym,mr2prob,ntest,nlow)
|
||||||
if(ntest.lt.100) then
|
if(ntest.lt.100) then
|
||||||
ncount=-999 !Flag and reject bad data
|
ncount=-999 !Flag and reject bad data
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call chkhist(mrsym,nhist,ipk) !Test for birdies and QRM
|
call chkhist(mrsym,nhist,ipk) !Test for birdies and QRM
|
||||||
if(nhist.ge.nbirdie) then
|
if(nhist.ge.nbirdie) then
|
||||||
nfail=nfail+1
|
nfail=nfail+1
|
||||||
call pctile(s3,4032,npct,base)
|
call pctile(s3,4032,npct,base)
|
||||||
s3(ipk,1:63)=base
|
s3(ipk,1:63)=base
|
||||||
if(nfail.gt.30) then
|
if(nfail.gt.30) then
|
||||||
decoded=' '
|
decoded=' '
|
||||||
ncount=-1
|
ncount=-1
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
go to 1
|
go to 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call graycode65(mrsym,63,-1) !Remove gray code and interleaving
|
call graycode65(mrsym,63,-1) !Remove gray code and interleaving
|
||||||
call interleave63(mrsym,-1) !from most reliable symbols
|
call interleave63(mrsym,-1) !from most reliable symbols
|
||||||
call interleave63(mrprob,-1)
|
call interleave63(mrprob,-1)
|
||||||
|
|
||||||
! Decode using Berlekamp-Massey algorithm
|
! Decode using Berlekamp-Massey algorithm
|
||||||
call timer('rs_decod',0)
|
call timer('rs_decod',0)
|
||||||
call rs_decode(mrsym,0,0,dat4,ncount)
|
call rs_decode(mrsym,0,0,dat4,ncount)
|
||||||
call timer('rs_decod',1)
|
call timer('rs_decod',1)
|
||||||
if(ncount.ge.0) then
|
if(ncount.ge.0) then
|
||||||
call unpackmsg(dat4,decoded)
|
call unpackmsg(dat4,decoded)
|
||||||
if(iand(dat4(10),8).ne.0) ltext=.true.
|
if(iand(dat4(10),8).ne.0) ltext=.true.
|
||||||
nbmkv=1
|
nbmkv=1
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! Berlekamp-Massey algorithm failed, try Koetter-Vardy
|
! Berlekamp-Massey algorithm failed, try Koetter-Vardy
|
||||||
if(nokv) go to 900
|
if(nokv) go to 900
|
||||||
|
|
||||||
maxe=8 !Max KV errors in 12 most reliable symbols
|
maxe=8 !Max KV errors in 12 most reliable symbols
|
||||||
call graycode65(mr2sym,63,-1) !Remove gray code and interleaving
|
call graycode65(mr2sym,63,-1) !Remove gray code and interleaving
|
||||||
call interleave63(mr2sym,-1) !from second-most-reliable symbols
|
call interleave63(mr2sym,-1) !from second-most-reliable symbols
|
||||||
call interleave63(mr2prob,-1)
|
call interleave63(mr2prob,-1)
|
||||||
|
|
||||||
nsec1=nsec1+1
|
nsec1=nsec1+1
|
||||||
dat4=0
|
dat4=0
|
||||||
write(22,rec=1) nsec1,xlambda,maxe,200,mrsym,mrprob,mr2sym,mr2prob
|
write(22,rec=1) nsec1,xlambda,maxe,200,mrsym,mrprob,mr2sym,mr2prob
|
||||||
write(22,rec=2) -1,-1,dat4
|
write(22,rec=2) -1,-1,dat4
|
||||||
call flush(22)
|
call flush(22)
|
||||||
call timer('kvasd ',0)
|
call timer('kvasd ',0)
|
||||||
|
|
||||||
! TODO G4WJS: Take out '-q' argument once kvasd 1.12 is available for
|
#ifdef WIN32
|
||||||
! Mac and in the repo where CMake fetches it from.
|
iret=system('""'//trim(exe_dir)//'/kvasd" "'//trim(temp_dir)//'/kvasd.dat" >"'//trim(temp_dir)//'/dev_null""')
|
||||||
#ifdef WIN32
|
#else
|
||||||
iret=system('""'//trim(exe_dir)//'/kvasd" -q >dev_null"')
|
iret=system('"'//trim(exe_dir)//'/kvasd" "'//trim(temp_dir)//'/kvasd.dat" >/dev/null')
|
||||||
! iret=system('""'//trim(exe_dir)//'/kvasd" kvasd.dat >dev_null"')
|
#endif
|
||||||
#else
|
|
||||||
iret=system('"'//trim(exe_dir)//'/kvasd" -q >/dev/null')
|
call timer('kvasd ',1)
|
||||||
! iret=system('"'//trim(exe_dir)//'/kvasd" kvasd.dat >/dev/null')
|
if(iret.ne.0) then
|
||||||
#endif
|
if(.not.nokv) write(*,1000) iret
|
||||||
|
1000 format('Error in KV decoder, or no KV decoder present.',i12)
|
||||||
call timer('kvasd ',1)
|
! nokv=.true.
|
||||||
if(iret.ne.0) then
|
go to 900
|
||||||
if(.not.nokv) write(*,1000) iret
|
endif
|
||||||
1000 format('Error in KV decoder, or no KV decoder present.',i12)
|
|
||||||
! nokv=.true.
|
read(22,rec=2,err=900) nsec2,ncount,dat4
|
||||||
go to 900
|
j=nsec2 !Silence compiler warning
|
||||||
endif
|
decoded=' '
|
||||||
|
ltext=.false.
|
||||||
read(22,rec=2,err=900) nsec2,ncount,dat4
|
if(ncount.ge.0) then
|
||||||
j=nsec2 !Silence compiler warning
|
call unpackmsg(dat4,decoded) !Unpack the user message
|
||||||
decoded=' '
|
if(index(decoded,'...... ').gt.0) then
|
||||||
ltext=.false.
|
ncount=-1
|
||||||
if(ncount.ge.0) then
|
go to 900
|
||||||
call unpackmsg(dat4,decoded) !Unpack the user message
|
endif
|
||||||
if(index(decoded,'...... ').gt.0) then
|
if(iand(dat4(10),8).ne.0) ltext=.true.
|
||||||
ncount=-1
|
nbmkv=2
|
||||||
go to 900
|
endif
|
||||||
endif
|
|
||||||
if(iand(dat4(10),8).ne.0) ltext=.true.
|
900 return
|
||||||
nbmkv=2
|
end subroutine extract
|
||||||
endif
|
|
||||||
|
|
||||||
900 return
|
|
||||||
end subroutine extract
|
|
||||||
|
@ -23,7 +23,7 @@ program jt9
|
|||||||
data npatience/1/
|
data npatience/1/
|
||||||
|
|
||||||
do
|
do
|
||||||
call getopt('s:e:a:r:p:d:f:w:',long_options,c,optarg,arglen,stat,offset,remain)
|
call getopt('s:e:a:r:p:d:f:w:t:',long_options,c,optarg,arglen,stat,offset,remain)
|
||||||
if (stat .ne. 0) then
|
if (stat .ne. 0) then
|
||||||
exit
|
exit
|
||||||
end if
|
end if
|
||||||
@ -39,6 +39,9 @@ program jt9
|
|||||||
case ('a')
|
case ('a')
|
||||||
data_dir = optarg(:arglen)
|
data_dir = optarg(:arglen)
|
||||||
|
|
||||||
|
case ('t')
|
||||||
|
temp_dir = optarg(:arglen)
|
||||||
|
|
||||||
case ('p')
|
case ('p')
|
||||||
read_files = .true.
|
read_files = .true.
|
||||||
read (optarg(:arglen), *) ntrperiod
|
read (optarg(:arglen), *) ntrperiod
|
||||||
@ -62,7 +65,7 @@ program jt9
|
|||||||
print*,'Usage: jt9 -p TRperiod [-d ndepth] [-f rxfreq] {-w patience] -e exe_dir file1 [file2 ...]'
|
print*,'Usage: jt9 -p TRperiod [-d ndepth] [-f rxfreq] {-w patience] -e exe_dir file1 [file2 ...]'
|
||||||
print*,' Reads data from *.wav files.'
|
print*,' Reads data from *.wav files.'
|
||||||
print*,''
|
print*,''
|
||||||
print*,' jt9 -s <key> [-w patience] -e exe_dir'
|
print*,' jt9 -s <key> [-w patience] -e exe_dir -a data_dir -t temp_dir'
|
||||||
print*,' Gets data from shared memory region with key==<key>'
|
print*,' Gets data from shared memory region with key==<key>'
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
|
142
lib/jt9a.f90
142
lib/jt9a.f90
@ -1,71 +1,71 @@
|
|||||||
subroutine jt9a()
|
subroutine jt9a()
|
||||||
|
|
||||||
use prog_args
|
use prog_args
|
||||||
|
|
||||||
! These routines connect the shared memory region to the decoder.
|
! These routines connect the shared memory region to the decoder.
|
||||||
interface
|
interface
|
||||||
function address_jt9()
|
function address_jt9()
|
||||||
integer*1, pointer :: address_jt9
|
integer*1, pointer :: address_jt9
|
||||||
end function address_jt9
|
end function address_jt9
|
||||||
end interface
|
end interface
|
||||||
|
|
||||||
integer*1 attach_jt9
|
integer*1 attach_jt9
|
||||||
! integer*1 lock_jt9,unlock_jt9
|
! integer*1 lock_jt9,unlock_jt9
|
||||||
integer size_jt9
|
integer size_jt9
|
||||||
integer*1, pointer :: p_jt9
|
integer*1, pointer :: p_jt9
|
||||||
character*80 cwd
|
character*80 cwd
|
||||||
! Multiple instances:
|
! Multiple instances:
|
||||||
character*80 mykey
|
character*80 mykey
|
||||||
logical fileExists
|
logical fileExists
|
||||||
common/tracer/limtrace,lu
|
common/tracer/limtrace,lu
|
||||||
|
|
||||||
! Multiple instances:
|
! Multiple instances:
|
||||||
i0 = len(trim(shm_key))
|
i0 = len(trim(shm_key))
|
||||||
|
|
||||||
call getcwd(cwd)
|
call getcwd(cwd)
|
||||||
open(12,file=trim(data_dir)//'/timer.out',status='unknown')
|
open(12,file=trim(data_dir)//'/timer.out',status='unknown')
|
||||||
|
|
||||||
limtrace=0
|
limtrace=0
|
||||||
! limtrace=-1 !Disable all calls to timer()
|
! limtrace=-1 !Disable all calls to timer()
|
||||||
lu=12
|
lu=12
|
||||||
|
|
||||||
! Multiple instances: set the shared memory key before attaching
|
! Multiple instances: set the shared memory key before attaching
|
||||||
mykey=trim(repeat(shm_key,1))
|
mykey=trim(repeat(shm_key,1))
|
||||||
i0 = len(mykey)
|
i0 = len(mykey)
|
||||||
i0=setkey_jt9(trim(mykey))
|
i0=setkey_jt9(trim(mykey))
|
||||||
|
|
||||||
i1=attach_jt9()
|
i1=attach_jt9()
|
||||||
|
|
||||||
10 inquire(file='.lock',exist=fileExists)
|
10 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
||||||
if(fileExists) then
|
if(fileExists) then
|
||||||
call sleep_msec(100)
|
call sleep_msec(100)
|
||||||
go to 10
|
go to 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
inquire(file='.quit',exist=fileExists)
|
inquire(file=trim(temp_dir)//'/.quit',exist=fileExists)
|
||||||
if(fileExists) then
|
if(fileExists) then
|
||||||
i1=detach_jt9()
|
i1=detach_jt9()
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
if(i1.eq.999999) stop !Silence compiler warning
|
if(i1.eq.999999) stop !Silence compiler warning
|
||||||
|
|
||||||
nbytes=size_jt9()
|
nbytes=size_jt9()
|
||||||
if(nbytes.le.0) then
|
if(nbytes.le.0) then
|
||||||
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
||||||
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
p_jt9=>address_jt9()
|
p_jt9=>address_jt9()
|
||||||
call timer('jt9b ',0)
|
call timer('jt9b ',0)
|
||||||
call jt9b(p_jt9,nbytes)
|
call jt9b(p_jt9,nbytes)
|
||||||
call timer('jt9b ',1)
|
call timer('jt9b ',1)
|
||||||
|
|
||||||
100 inquire(file='.lock',exist=fileExists)
|
100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
||||||
if(fileExists) go to 10
|
if(fileExists) go to 10
|
||||||
call sleep_msec(100)
|
call sleep_msec(100)
|
||||||
go to 100
|
go to 100
|
||||||
|
|
||||||
999 call timer('jt9b ',101)
|
999 call timer('jt9b ',101)
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine jt9a
|
end subroutine jt9a
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MODULE prog_args
|
MODULE prog_args
|
||||||
CHARACTER(len=80) :: shm_key
|
CHARACTER(len=80) :: shm_key
|
||||||
CHARACTER(len=500) :: exe_dir = '.', data_dir = '.'
|
CHARACTER(len=500) :: exe_dir = '.', data_dir = '.', temp_dir = '.'
|
||||||
END MODULE prog_args
|
END MODULE prog_args
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "logbook.h"
|
#include "logbook.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -9,8 +10,9 @@ namespace
|
|||||||
auto countryFileName = "cty.dat";
|
auto countryFileName = "cty.dat";
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogBook::init(QDir const& dataPath)
|
void LogBook::init()
|
||||||
{
|
{
|
||||||
|
QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
|
||||||
QString countryDataFilename;
|
QString countryDataFilename;
|
||||||
if (dataPath.exists (countryFileName))
|
if (dataPath.exists (countryFileName))
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ class QDir;
|
|||||||
class LogBook
|
class LogBook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(QDir const& dataPath);
|
void init();
|
||||||
void match(/*in*/ const QString call,
|
void match(/*in*/ const QString call,
|
||||||
/*out*/ QString &countryName,
|
/*out*/ QString &countryName,
|
||||||
bool &callWorkedBefore,
|
bool &callWorkedBefore,
|
||||||
|
19
logqso.cpp
19
logqso.cpp
@ -2,21 +2,20 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "Configuration.hpp"
|
|
||||||
#include "logbook/adif.h"
|
#include "logbook/adif.h"
|
||||||
|
|
||||||
#include "ui_logqso.h"
|
#include "ui_logqso.h"
|
||||||
|
|
||||||
#include "moc_logqso.cpp"
|
#include "moc_logqso.cpp"
|
||||||
|
|
||||||
LogQSO::LogQSO(QString const& programTitle, QSettings * settings, Configuration const * configuration, QWidget *parent) :
|
LogQSO::LogQSO(QString const& programTitle, QSettings * settings, QWidget *parent)
|
||||||
QDialog(parent),
|
: QDialog(parent)
|
||||||
ui(new Ui::LogQSO),
|
, ui(new Ui::LogQSO)
|
||||||
m_settings (settings),
|
, m_settings (settings)
|
||||||
m_configuration (configuration)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle(programTitle + " - Log QSO");
|
setWindowTitle(programTitle + " - Log QSO");
|
||||||
@ -109,7 +108,7 @@ void LogQSO::accept()
|
|||||||
//Log this QSO to ADIF file "wsjtx_log.adi"
|
//Log this QSO to ADIF file "wsjtx_log.adi"
|
||||||
QString filename = "wsjtx_log.adi"; // TODO allow user to set
|
QString filename = "wsjtx_log.adi"; // TODO allow user to set
|
||||||
ADIF adifile;
|
ADIF adifile;
|
||||||
auto adifilePath = m_configuration->data_path ().absoluteFilePath (filename);
|
auto adifilePath = QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log.adi");
|
||||||
adifile.init(adifilePath);
|
adifile.init(adifilePath);
|
||||||
if (!adifile.addQSOToFile(hisCall,hisGrid,mode,rptSent,rptRcvd,date,time,band,comments,name,strDialFreq,m_myCall,m_myGrid,m_txPower))
|
if (!adifile.addQSOToFile(hisCall,hisGrid,mode,rptSent,rptRcvd,date,time,band,comments,name,strDialFreq,m_myCall,m_myGrid,m_txPower))
|
||||||
{
|
{
|
||||||
@ -119,7 +118,7 @@ void LogQSO::accept()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Log this QSO to file "wsjtx.log"
|
//Log this QSO to file "wsjtx.log"
|
||||||
QFile f(m_configuration->data_path ().absoluteFilePath ("wsjtx.log"));
|
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
|
||||||
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
||||||
QMessageBox m;
|
QMessageBox m;
|
||||||
m.setText("Cannot open file \"" + f.fileName () + "\".");
|
m.setText("Cannot open file \"" + f.fileName () + "\".");
|
||||||
@ -138,13 +137,13 @@ void LogQSO::accept()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Clean up and finish logging
|
//Clean up and finish logging
|
||||||
emit(acceptQSO(true));
|
Q_EMIT acceptQSO(true);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogQSO::reject()
|
void LogQSO::reject()
|
||||||
{
|
{
|
||||||
emit(acceptQSO(false));
|
Q_EMIT acceptQSO(false);
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
logqso.h
4
logqso.h
@ -15,14 +15,13 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
class Configuration;
|
|
||||||
|
|
||||||
class LogQSO : public QDialog
|
class LogQSO : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LogQSO(QString const& programTitle, QSettings *, Configuration const *, QWidget *parent = 0);
|
explicit LogQSO(QString const& programTitle, QSettings *, QWidget *parent = 0);
|
||||||
~LogQSO();
|
~LogQSO();
|
||||||
void initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
void initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
||||||
QString rptSent, QString rptRcvd, QDateTime dateTime,
|
QString rptSent, QString rptRcvd, QDateTime dateTime,
|
||||||
@ -45,7 +44,6 @@ private:
|
|||||||
|
|
||||||
QScopedPointer<Ui::LogQSO> ui;
|
QScopedPointer<Ui::LogQSO> ui;
|
||||||
QSettings * m_settings;
|
QSettings * m_settings;
|
||||||
Configuration const * m_configuration;
|
|
||||||
QString m_txPower;
|
QString m_txPower;
|
||||||
QString m_comments;
|
QString m_comments;
|
||||||
double m_dialFreq;
|
double m_dialFreq;
|
||||||
|
9
main.cpp
9
main.cpp
@ -5,11 +5,6 @@
|
|||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#ifdef QT5
|
|
||||||
#include <QtWidgets>
|
|
||||||
#else
|
|
||||||
#include <QtGui>
|
|
||||||
#endif
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -65,13 +60,11 @@ int main(int argc, char *argv[])
|
|||||||
auto help_option = parser.addHelpOption ();
|
auto help_option = parser.addHelpOption ();
|
||||||
auto version_option = parser.addVersionOption ();
|
auto version_option = parser.addVersionOption ();
|
||||||
|
|
||||||
#if WSJT_STANDARD_FILE_LOCATIONS
|
|
||||||
// support for multiple instances running from a single installation
|
// support for multiple instances running from a single installation
|
||||||
QCommandLineOption rig_option (QStringList {} << "r" << "rig-name"
|
QCommandLineOption rig_option (QStringList {} << "r" << "rig-name"
|
||||||
, a.translate ("main", "Where <rig-name> is for multi-instance support.")
|
, a.translate ("main", "Where <rig-name> is for multi-instance support.")
|
||||||
, a.translate ("main", "rig-name"));
|
, a.translate ("main", "rig-name"));
|
||||||
parser.addOption (rig_option);
|
parser.addOption (rig_option);
|
||||||
#endif
|
|
||||||
|
|
||||||
QCommandLineOption test_option (QStringList {} << "test-mode"
|
QCommandLineOption test_option (QStringList {} << "test-mode"
|
||||||
, a.translate ("main", "Writable files in test location. Use with caution, for testing only."));
|
, a.translate ("main", "Writable files in test location. Use with caution, for testing only."));
|
||||||
@ -98,7 +91,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QStandardPaths::setTestModeEnabled (parser.isSet (test_option));
|
QStandardPaths::setTestModeEnabled (parser.isSet (test_option));
|
||||||
|
|
||||||
#if WSJT_STANDARD_FILE_LOCATIONS
|
|
||||||
// support for multiple instances running from a single installation
|
// support for multiple instances running from a single installation
|
||||||
if (parser.isSet (rig_option))
|
if (parser.isSet (rig_option))
|
||||||
{
|
{
|
||||||
@ -148,7 +140,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto config_directory = QStandardPaths::writableLocation (QStandardPaths::ConfigLocation);
|
auto config_directory = QStandardPaths::writableLocation (QStandardPaths::ConfigLocation);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
@ -74,13 +75,14 @@ private:
|
|||||||
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem,
|
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem,
|
||||||
unsigned downSampleFactor, QWidget *parent) :
|
unsigned downSampleFactor, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
m_dataDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)},
|
||||||
m_revision {revision ("$Rev$")},
|
m_revision {revision ("$Rev$")},
|
||||||
m_multiple {multiple},
|
m_multiple {multiple},
|
||||||
m_settings (settings),
|
m_settings (settings),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
m_config (settings, this),
|
m_config (settings, this),
|
||||||
m_wideGraph (new WideGraph (settings)),
|
m_wideGraph (new WideGraph (settings)),
|
||||||
m_logDlg (new LogQSO (program_title (), settings, &m_config, this)),
|
m_logDlg (new LogQSO (program_title (), settings, this)),
|
||||||
m_dialFreq {0},
|
m_dialFreq {0},
|
||||||
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor),
|
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor),
|
||||||
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
||||||
@ -357,7 +359,7 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
|||||||
//delete any .quit file that might have been left lying around
|
//delete any .quit file that might have been left lying around
|
||||||
//since its presence will cause jt9 to exit a soon as we start it
|
//since its presence will cause jt9 to exit a soon as we start it
|
||||||
//and decodes will hang
|
//and decodes will hang
|
||||||
QFile quitFile (".quit");
|
QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
|
||||||
while (quitFile.exists ())
|
while (quitFile.exists ())
|
||||||
{
|
{
|
||||||
if (!quitFile.remove ())
|
if (!quitFile.remove ())
|
||||||
@ -368,19 +370,20 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile lockFile(".lock"); //Create .lock so jt9 will wait
|
//Create .lock so jt9 will wait
|
||||||
lockFile.open(QIODevice::ReadWrite);
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite);
|
||||||
|
|
||||||
QStringList jt9_args {
|
QStringList jt9_args {
|
||||||
"-s", QApplication::applicationName ()
|
"-s", QApplication::applicationName ()
|
||||||
, "-w", "1"
|
, "-w", "1"
|
||||||
, "-e", QDir::toNativeSeparators (m_appDir)
|
, "-e", QDir::toNativeSeparators (m_appDir)
|
||||||
, "-a", QDir::toNativeSeparators (m_config.data_path ().absolutePath ())
|
, "-a", QDir::toNativeSeparators (m_dataDir.absolutePath ())
|
||||||
|
, "-t", QDir::toNativeSeparators (m_config.temp_dir ().absolutePath ())
|
||||||
};
|
};
|
||||||
proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
|
proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
|
||||||
"jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
|
"jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||||
|
|
||||||
QString fname(QDir::toNativeSeparators(m_config.data_path ().absoluteFilePath ("wsjtx_wisdom.dat")));
|
QString fname {QDir::toNativeSeparators(m_dataDir.absoluteFilePath ("wsjtx_wisdom.dat"))};
|
||||||
QByteArray cfname=fname.toLocal8Bit();
|
QByteArray cfname=fname.toLocal8Bit();
|
||||||
fftwf_import_wisdom_from_filename(cfname);
|
fftwf_import_wisdom_from_filename(cfname);
|
||||||
|
|
||||||
@ -439,7 +442,7 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
|||||||
//--------------------------------------------------- MainWindow destructor
|
//--------------------------------------------------- MainWindow destructor
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
QString fname(QDir::toNativeSeparators(m_config.data_path ().absoluteFilePath ("wsjtx_wisdom.dat")));
|
QString fname {QDir::toNativeSeparators(m_dataDir.absoluteFilePath ("wsjtx_wisdom.dat"))};
|
||||||
QByteArray cfname=fname.toLocal8Bit();
|
QByteArray cfname=fname.toLocal8Bit();
|
||||||
fftwf_export_wisdom_to_filename(cfname);
|
fftwf_export_wisdom_to_filename(cfname);
|
||||||
m_audioThread->wait ();
|
m_audioThread->wait ();
|
||||||
@ -898,7 +901,7 @@ void MainWindow::qsy (Frequency f)
|
|||||||
m_repeatMsg=0;
|
m_repeatMsg=0;
|
||||||
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
||||||
|
|
||||||
QFile f2(m_config.data_path ().absoluteFilePath ("ALL.TXT"));
|
QFile f2 {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
||||||
QTextStream out(&f2);
|
QTextStream out(&f2);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
|
||||||
@ -947,7 +950,7 @@ void MainWindow::displayDialFrequency ()
|
|||||||
|
|
||||||
void MainWindow::statusChanged()
|
void MainWindow::statusChanged()
|
||||||
{
|
{
|
||||||
QFile f("wsjtx_status.txt");
|
QFile f {m_config.temp_dir ().absoluteFilePath ("wsjtx_status.txt")};
|
||||||
if(f.open(QFile::WriteOnly | QIODevice::Text)) {
|
if(f.open(QFile::WriteOnly | QIODevice::Text)) {
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
out << (m_dialFreq / 1.e6) << ";" << m_mode << ";" << m_hisCall << ";"
|
out << (m_dialFreq / 1.e6) << ";" << m_mode << ";" << m_hisCall << ";"
|
||||||
@ -1010,10 +1013,9 @@ void MainWindow::closeEvent(QCloseEvent * e)
|
|||||||
if(m_fname != "") killFile();
|
if(m_fname != "") killFile();
|
||||||
m_killAll=true;
|
m_killAll=true;
|
||||||
mem_jt9->detach();
|
mem_jt9->detach();
|
||||||
QFile quitFile(".quit");
|
QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
|
||||||
quitFile.open(QIODevice::ReadWrite);
|
quitFile.open(QIODevice::ReadWrite);
|
||||||
QFile lockFile(".lock");
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate
|
||||||
lockFile.remove(); // Allow jt9 to terminate
|
|
||||||
bool b=proc_jt9.waitForFinished(1000);
|
bool b=proc_jt9.waitForFinished(1000);
|
||||||
if(!b) proc_jt9.kill();
|
if(!b) proc_jt9.kill();
|
||||||
quitFile.remove();
|
quitFile.remove();
|
||||||
@ -1046,7 +1048,7 @@ void MainWindow::on_actionOnline_User_Guide_triggered() //Display manual
|
|||||||
void MainWindow::on_actionLocal_User_Guide_triggered()
|
void MainWindow::on_actionLocal_User_Guide_triggered()
|
||||||
{
|
{
|
||||||
#if defined (CMAKE_BUILD)
|
#if defined (CMAKE_BUILD)
|
||||||
auto file = m_config.doc_path ().absoluteFilePath (PROJECT_MANUAL);
|
auto file = m_config.doc_dir ().absoluteFilePath (PROJECT_MANUAL);
|
||||||
QDesktopServices::openUrl (QUrl {"file:///" + file});
|
QDesktopServices::openUrl (QUrl {"file:///" + file});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1060,7 +1062,7 @@ void MainWindow::on_actionAstronomical_data_triggered()
|
|||||||
{
|
{
|
||||||
if (!m_astroWidget)
|
if (!m_astroWidget)
|
||||||
{
|
{
|
||||||
m_astroWidget.reset (new Astro {m_settings, m_config.data_path ()});
|
m_astroWidget.reset (new Astro {m_settings});
|
||||||
|
|
||||||
// hook up termination signal
|
// hook up termination signal
|
||||||
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
|
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
|
||||||
@ -1306,8 +1308,7 @@ void MainWindow::decode() //decode()
|
|||||||
}
|
}
|
||||||
memcpy(to, from, qMin(mem_jt9->size(), size));
|
memcpy(to, from, qMin(mem_jt9->size(), size));
|
||||||
|
|
||||||
QFile lockFile(".lock"); // Allow jt9 to start
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove (); // Allow jt9 to start
|
||||||
lockFile.remove();
|
|
||||||
decodeBusy(true);
|
decodeBusy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,8 +1339,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
if(!keepFile and !m_diskData) killFileTimer->start(45*1000); //Kill in 45 s
|
if(!keepFile and !m_diskData) killFileTimer->start(45*1000); //Kill in 45 s
|
||||||
jt9com_.nagain=0;
|
jt9com_.nagain=0;
|
||||||
jt9com_.ndiskdat=0;
|
jt9com_.ndiskdat=0;
|
||||||
QFile lockFile(".lock");
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.open(QIODevice::ReadWrite);
|
||||||
lockFile.open(QIODevice::ReadWrite);
|
|
||||||
ui->DecodeButton->setChecked (false);
|
ui->DecodeButton->setChecked (false);
|
||||||
decodeBusy(false);
|
decodeBusy(false);
|
||||||
m_RxLog=0;
|
m_RxLog=0;
|
||||||
@ -1347,7 +1347,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
m_blankLine=true;
|
m_blankLine=true;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
QFile f(m_config.data_path().absoluteFilePath ("ALL.TXT"));
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
if(m_RxLog==1) {
|
if(m_RxLog==1) {
|
||||||
@ -1547,7 +1547,7 @@ void MainWindow::guiUpdate()
|
|||||||
if(m_tune) t="TUNE";
|
if(m_tune) t="TUNE";
|
||||||
last_tx_label->setText("Last Tx: " + t);
|
last_tx_label->setText("Last Tx: " + t);
|
||||||
if(m_restart) {
|
if(m_restart) {
|
||||||
QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT"));
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
||||||
@ -1615,7 +1615,7 @@ void MainWindow::guiUpdate()
|
|||||||
|
|
||||||
if(!m_tune)
|
if(!m_tune)
|
||||||
{
|
{
|
||||||
QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT"));
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
|
||||||
QTextStream out(&f);
|
QTextStream out(&f);
|
||||||
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
out << QDateTime::currentDateTimeUtc().toString("hhmm")
|
||||||
@ -2089,7 +2089,7 @@ void MainWindow::lookup() //lookup()
|
|||||||
{
|
{
|
||||||
QString hisCall=ui->dxCallEntry->text().toUpper().trimmed();
|
QString hisCall=ui->dxCallEntry->text().toUpper().trimmed();
|
||||||
ui->dxCallEntry->setText(hisCall);
|
ui->dxCallEntry->setText(hisCall);
|
||||||
QFile f(m_config.data_path ().absoluteFilePath ("CALL3.TXT"));
|
QFile f {m_dataDir.absoluteFilePath ("CALL3.TXT")};
|
||||||
if (f.open (QIODevice::ReadOnly | QIODevice::Text))
|
if (f.open (QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
char c[132];
|
char c[132];
|
||||||
@ -2143,7 +2143,7 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
newEntry += ",,,";
|
newEntry += ",,,";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
QFile f1(m_config.data_path ().absoluteFilePath ("CALL3.TXT"));
|
QFile f1 {m_dataDir.absoluteFilePath ("CALL3.TXT")};
|
||||||
if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f1.fileName () + "\".");
|
msgBox("Cannot open \"" + f1.fileName () + "\".");
|
||||||
return;
|
return;
|
||||||
@ -2154,7 +2154,7 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
f1.close();
|
f1.close();
|
||||||
f1.open(QIODevice::ReadOnly | QIODevice::Text);
|
f1.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
}
|
}
|
||||||
QFile f2(m_config.data_path ().absoluteFilePath ("CALL3.TMP"));
|
QFile f2 {m_dataDir.absoluteFilePath ("CALL3.TMP")};
|
||||||
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
msgBox("Cannot open \"" + f2.fileName () + "\".");
|
msgBox("Cannot open \"" + f2.fileName () + "\".");
|
||||||
return;
|
return;
|
||||||
@ -2195,12 +2195,11 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
f1.close();
|
f1.close();
|
||||||
if(hc>hc1 && !m_call3Modified) out << newEntry + "\n";
|
if(hc>hc1 && !m_call3Modified) out << newEntry + "\n";
|
||||||
if(m_call3Modified) {
|
if(m_call3Modified) {
|
||||||
QDir data_path {m_config.data_path ()};
|
QFile f0 {m_dataDir.absoluteFilePath ("CALL3.OLD")};
|
||||||
QFile f0(data_path.absoluteFilePath ("CALL3.OLD"));
|
|
||||||
if(f0.exists()) f0.remove();
|
if(f0.exists()) f0.remove();
|
||||||
QFile f1(data_path.absoluteFilePath ("CALL3.TXT"));
|
QFile f1 {m_dataDir.absoluteFilePath ("CALL3.TXT")};
|
||||||
f1.rename(data_path.absoluteFilePath ("CALL3.OLD"));
|
f1.rename(m_dataDir.absoluteFilePath ("CALL3.OLD"));
|
||||||
f2.rename(data_path.absoluteFilePath ("CALL3.TXT"));
|
f2.rename(m_dataDir.absoluteFilePath ("CALL3.TXT"));
|
||||||
f2.close();
|
f2.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2500,7 +2499,7 @@ void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT
|
|||||||
"Are you sure you want to erase file ALL.TXT ?",
|
"Are you sure you want to erase file ALL.TXT ?",
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
if(ret==QMessageBox::Yes) {
|
if(ret==QMessageBox::Yes) {
|
||||||
QFile f(m_config.data_path ().absoluteFilePath ("ALL.TXT"));
|
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||||
f.remove();
|
f.remove();
|
||||||
m_RxLog=1;
|
m_RxLog=1;
|
||||||
}
|
}
|
||||||
@ -2512,14 +2511,14 @@ void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
|
|||||||
"Are you sure you want to erase file wsjtx_log.adi ?",
|
"Are you sure you want to erase file wsjtx_log.adi ?",
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
if(ret==QMessageBox::Yes) {
|
if(ret==QMessageBox::Yes) {
|
||||||
QFile f(m_config.data_path ().absoluteFilePath ("wsjtx_log.adi"));
|
QFile f {m_dataDir.absoluteFilePath ("wsjtx_log.adi")};
|
||||||
f.remove();
|
f.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionOpen_log_directory_triggered ()
|
void MainWindow::on_actionOpen_log_directory_triggered ()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl (QUrl::fromLocalFile (m_config.data_path ().absolutePath ()));
|
QDesktopServices::openUrl (QUrl::fromLocalFile (m_dataDir.absolutePath ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::gridOK(QString g)
|
bool MainWindow::gridOK(QString g)
|
||||||
@ -2589,7 +2588,7 @@ void MainWindow::enable_DXCC_entity (bool on)
|
|||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
// re-read the log and cty.dat files
|
// re-read the log and cty.dat files
|
||||||
m_logBook.init(m_config.data_path ());
|
m_logBook.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (on) // adjust the proportions between the two text displays
|
if (on) // adjust the proportions between the two text displays
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QAudioDeviceInfo>
|
#include <QAudioDeviceInfo>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "soundin.h"
|
#include "soundin.h"
|
||||||
#include "AudioDevice.hpp"
|
#include "AudioDevice.hpp"
|
||||||
@ -197,6 +198,7 @@ private:
|
|||||||
Q_SIGNAL void outAttenuationChanged (qreal) const;
|
Q_SIGNAL void outAttenuationChanged (qreal) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QDir m_dataDir;
|
||||||
QString m_revision;
|
QString m_revision;
|
||||||
bool m_multiple;
|
bool m_multiple;
|
||||||
QSettings * m_settings;
|
QSettings * m_settings;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#cmakedefine01 WSJT_TRACE_CAT
|
#cmakedefine01 WSJT_TRACE_CAT
|
||||||
#cmakedefine01 WSJT_TRACE_CAT_POLLS
|
#cmakedefine01 WSJT_TRACE_CAT_POLLS
|
||||||
#cmakedefine01 WSJT_HAMLIB_TRACE
|
#cmakedefine01 WSJT_HAMLIB_TRACE
|
||||||
#cmakedefine01 WSJT_STANDARD_FILE_LOCATIONS
|
|
||||||
#cmakedefine01 WSJT_SOFT_KEYING
|
#cmakedefine01 WSJT_SOFT_KEYING
|
||||||
#cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES
|
#cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES
|
||||||
#cmakedefine01 WSJT_INCLUDE_KVASD
|
#cmakedefine01 WSJT_INCLUDE_KVASD
|
||||||
|
Loading…
Reference in New Issue
Block a user