Disallow multiple instances without a unique rig name

Because of confilicts using the  shared memory to communicate with jt9
only one instance of WSJT-X may run with each unique key (rig name).

Added a QLockFile for each unique  key in the temp directory and logic
to deal with stale locks and retries.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4465 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2014-10-03 16:07:43 +00:00
parent 4980d0cdc9
commit 4075f5dbb7
5 changed files with 51 additions and 28 deletions
+5 -11
View File
@@ -235,7 +235,7 @@ class Configuration::impl final
public:
using FrequencyDelta = Radio::FrequencyDelta;
explicit impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent);
explicit impl (Configuration * self, QSettings * settings, QWidget * parent);
~impl ();
bool have_rig (bool open_if_closed = true);
@@ -428,8 +428,8 @@ private:
// delegate to implementation class
Configuration::Configuration (QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
: m_ {this, instance_key, settings, test_mode, parent}
Configuration::Configuration (QSettings * settings, QWidget * parent)
: m_ {this, settings, parent}
{
}
@@ -549,7 +549,7 @@ void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_s
}
Configuration::impl::impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget * parent)
: QDialog {parent}
, self_ {self}
, ui_ {new Ui::configuration_dialog}
@@ -593,8 +593,6 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS
, default_audio_input_device_selected_ {false}
, default_audio_output_device_selected_ {false}
{
(void)instance_key; // quell compiler warning
ui_->setupUi (this);
@@ -637,11 +635,7 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS
temp_path_.setPath (temp_location);
}
QString unique_directory {instance_key};
if (test_mode)
{
unique_directory += " - test_mode";
}
QString unique_directory {QApplication::applicationName ()};
if (!temp_path_.mkpath (unique_directory) || !temp_path_.cd (unique_directory))
{
QMessageBox::critical (this, "WSJT-X", tr ("Create temporary directory error: ") + temp_path_.absolutePath ());