mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 13:48:42 -05:00
Make temp directory unique in test mode.
The Qt test mode that uses special paths for writeable files (via QtStandardPaths) doesn't make a special temporary file path. This change appends " - test_mode" to the WSJT-X unique temporary file path so that an application run in test mode will not interact with another running in normal mode. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4240 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
df93758d9b
commit
fbf58ae3f3
@ -207,7 +207,7 @@ class Configuration::impl final
|
|||||||
public:
|
public:
|
||||||
using FrequencyDelta = Radio::FrequencyDelta;
|
using FrequencyDelta = Radio::FrequencyDelta;
|
||||||
|
|
||||||
explicit impl (Configuration * self, QString const& instance_key, QSettings * settings, QWidget * parent);
|
explicit impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent);
|
||||||
~impl ();
|
~impl ();
|
||||||
|
|
||||||
bool have_rig (bool open_if_closed = true);
|
bool have_rig (bool open_if_closed = true);
|
||||||
@ -398,8 +398,8 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
// delegate to implementation class
|
// delegate to implementation class
|
||||||
Configuration::Configuration (QString const& instance_key, QSettings * settings, QWidget * parent)
|
Configuration::Configuration (QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
|
||||||
: m_ {this, instance_key, settings, parent}
|
: m_ {this, instance_key, settings, test_mode, parent}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Configuration::impl::impl (Configuration * self, QString const& instance_key, QSettings * settings, QWidget * parent)
|
Configuration::impl::impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
|
||||||
: QDialog {parent}
|
: QDialog {parent}
|
||||||
, self_ {self}
|
, self_ {self}
|
||||||
, ui_ {new Ui::configuration_dialog}
|
, ui_ {new Ui::configuration_dialog}
|
||||||
@ -576,6 +576,10 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString unique_directory {instance_key};
|
QString unique_directory {instance_key};
|
||||||
|
if (test_mode)
|
||||||
|
{
|
||||||
|
unique_directory += " - test_mode";
|
||||||
|
}
|
||||||
if (!temp_path_.mkpath (unique_directory) || !temp_path_.cd (unique_directory))
|
if (!temp_path_.mkpath (unique_directory) || !temp_path_.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_path_.absolutePath ());
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
enum DataMode {data_mode_none, data_mode_USB, data_mode_data};
|
enum DataMode {data_mode_none, data_mode_USB, data_mode_data};
|
||||||
|
|
||||||
explicit Configuration (QString const& instance_key, QSettings * settings, QWidget * parent = nullptr);
|
explicit Configuration (QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent = nullptr);
|
||||||
~Configuration ();
|
~Configuration ();
|
||||||
|
|
||||||
int exec ();
|
int exec ();
|
||||||
|
2
main.cpp
2
main.cpp
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
|||||||
).toBool () ? 1u : 4u;
|
).toBool () ? 1u : 4u;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow w(multiple, &settings, &mem_jt9, my_key, downSampleFactor);
|
MainWindow w(multiple, &settings, &mem_jt9, my_key, downSampleFactor, parser.isSet (test_option));
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));
|
QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));
|
||||||
|
@ -67,13 +67,13 @@ private:
|
|||||||
|
|
||||||
//--------------------------------------------------- MainWindow constructor
|
//--------------------------------------------------- MainWindow constructor
|
||||||
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem, QString const& thekey,
|
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem, QString const& thekey,
|
||||||
unsigned downSampleFactor, QWidget *parent) :
|
unsigned downSampleFactor, bool test_mode, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
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 (thekey, settings, this),
|
m_config (thekey, settings, test_mode, 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, &m_config, this)),
|
||||||
m_dialFreq {0},
|
m_dialFreq {0},
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// Multiple instances: call MainWindow() with *thekey
|
// Multiple instances: call MainWindow() with *thekey
|
||||||
explicit MainWindow(bool multiple, QSettings *, QSharedMemory *shdmem, QString const& thekey,
|
explicit MainWindow(bool multiple, QSettings *, QSharedMemory *shdmem, QString const& thekey,
|
||||||
unsigned downSampleFactor, QWidget *parent = 0);
|
unsigned downSampleFactor, bool test_mode, QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user