mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
85
astro.cpp
85
astro.cpp
@ -10,6 +10,8 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "commons.h"
|
#include "commons.h"
|
||||||
|
|
||||||
@ -17,11 +19,10 @@
|
|||||||
|
|
||||||
#include "moc_astro.cpp"
|
#include "moc_astro.cpp"
|
||||||
|
|
||||||
Astro::Astro(QSettings * settings, QDir const& dataPath, QWidget * parent) :
|
Astro::Astro(QSettings * settings, QWidget * parent)
|
||||||
QWidget {parent},
|
: QWidget {parent}
|
||||||
settings_ {settings},
|
, settings_ {settings}
|
||||||
ui_ {new Ui::Astro},
|
, ui_ {new Ui::Astro}
|
||||||
data_path_ {dataPath}
|
|
||||||
{
|
{
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
@ -140,11 +141,11 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
|||||||
}
|
}
|
||||||
ui_->text_label->setText(message);
|
ui_->text_label->setText(message);
|
||||||
|
|
||||||
QString fname {"azel.dat"};
|
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("azel.dat")};
|
||||||
QFile f(data_path_.absoluteFilePath (fname));
|
if (!f.open (QIODevice::WriteOnly | QIODevice::Text))
|
||||||
if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
{
|
||||||
QMessageBox mb;
|
QMessageBox mb;
|
||||||
mb.setText("Cannot open \"" + f.fileName () + "\".");
|
mb.setText ("Cannot open \"" + f.fileName () + "\".");
|
||||||
mb.exec();
|
mb.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -154,34 +155,52 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
|||||||
{
|
{
|
||||||
QTextStream out {&f};
|
QTextStream out {&f};
|
||||||
out << fixed
|
out << fixed
|
||||||
<< qSetFieldWidth (2)
|
|
||||||
<< 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
|
||||||
|
<< qSetFieldWidth (0) << ':'
|
||||||
|
<< qSetFieldWidth (2) << nmin
|
||||||
|
<< qSetFieldWidth (0) << ':'
|
||||||
|
<< qSetFieldWidth (2) << isec
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (5) << azsun
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (5) << elsun
|
||||||
|
<< qSetFieldWidth (0) << ",Sun\n"
|
||||||
|
<< qSetFieldWidth (2) << nhr
|
||||||
|
<< qSetFieldWidth (0) << ':'
|
||||||
|
<< qSetFieldWidth (2) << nmin
|
||||||
|
<< qSetFieldWidth (0) << ':'
|
||||||
|
<< qSetFieldWidth (2) << isec
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (5) << 0.
|
||||||
|
<< qSetFieldWidth (0) << ','
|
||||||
|
<< qSetFieldWidth (5) << 0.
|
||||||
|
<< qSetFieldWidth (0) << ",Sun\n"
|
||||||
<< qSetPadChar (' ')
|
<< qSetPadChar (' ')
|
||||||
<< qSetFieldWidth (4)
|
<< qSetFieldWidth (4) << nfreq
|
||||||
<< nfreq << ','
|
<< qSetFieldWidth (0) << ','
|
||||||
<< qSetFieldWidth (6)
|
<< qSetFieldWidth (6) << ndop
|
||||||
<< ndop << ",Doppler\n"
|
<< qSetFieldWidth (0) << ",Doppler\n"
|
||||||
<< qSetFieldWidth (3)
|
<< qSetFieldWidth (3) << fQSO
|
||||||
<< fQSO << ','
|
<< qSetFieldWidth (0) << ','
|
||||||
<< qSetFieldWidth (1)
|
<< qSetFieldWidth (1) << nsetftx
|
||||||
<< nsetftx << ",fQSO\n"
|
<< qSetFieldWidth (0) << ",fQSO\n"
|
||||||
<< qSetFieldWidth (3)
|
<< qSetFieldWidth (3) << ntxFreq
|
||||||
<< ntxFreq << ','
|
<< qSetFieldWidth (0) << ','
|
||||||
<< qSetFieldWidth (1)
|
<< qSetFieldWidth (1) << ndiff
|
||||||
<< ndiff << ",fQSO2";
|
<< qSetFieldWidth (0) << ",fQSO2";
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
3
astro.h
3
astro.h
@ -20,7 +20,7 @@ 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,
|
||||||
@ -37,7 +37,6 @@ private:
|
|||||||
|
|
||||||
QSettings * settings_;
|
QSettings * settings_;
|
||||||
QScopedPointer<Ui::Astro> ui_;
|
QScopedPointer<Ui::Astro> ui_;
|
||||||
QDir data_path_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -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
|
||||||
|
@ -85,14 +85,10 @@ subroutine extract(s3,nadd,ncount,nhist,decoded,ltext,nbmkv)
|
|||||||
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
|
|
||||||
! Mac and in the repo where CMake fetches it from.
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
iret=system('""'//trim(exe_dir)//'/kvasd" -q >dev_null"')
|
iret=system('""'//trim(exe_dir)//'/kvasd" "'//trim(temp_dir)//'/kvasd.dat" >"'//trim(temp_dir)//'/dev_null""')
|
||||||
! iret=system('""'//trim(exe_dir)//'/kvasd" kvasd.dat >dev_null"')
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
call timer('kvasd ',1)
|
call timer('kvasd ',1)
|
||||||
|
@ -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
|
||||||
|
@ -36,13 +36,13 @@ subroutine jt9a()
|
|||||||
|
|
||||||
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
|
||||||
@ -60,7 +60,7 @@ subroutine jt9a()
|
|||||||
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
|
||||||
|
@ -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