mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 14:48:46 -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
5d4af665ed
commit
d4e69f0b23
@ -207,7 +207,7 @@ class Configuration::impl final
|
||||
public:
|
||||
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 ();
|
||||
|
||||
bool have_rig (bool open_if_closed = true);
|
||||
@ -398,8 +398,8 @@ private:
|
||||
|
||||
|
||||
// delegate to implementation class
|
||||
Configuration::Configuration (QString const& instance_key, QSettings * settings, QWidget * parent)
|
||||
: m_ {this, instance_key, settings, parent}
|
||||
Configuration::Configuration (QString const& instance_key, QSettings * settings, bool test_mode, QWidget * 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}
|
||||
, self_ {self}
|
||||
, ui_ {new Ui::configuration_dialog}
|
||||
@ -576,6 +576,10 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS
|
||||
}
|
||||
|
||||
QString unique_directory {instance_key};
|
||||
if (test_mode)
|
||||
{
|
||||
unique_directory += " - test_mode";
|
||||
}
|
||||
if (!temp_path_.mkpath (unique_directory) || !temp_path_.cd (unique_directory))
|
||||
{
|
||||
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};
|
||||
|
||||
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 ();
|
||||
|
||||
int exec ();
|
||||
|
2
main.cpp
2
main.cpp
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||
).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();
|
||||
|
||||
QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));
|
||||
|
@ -67,13 +67,13 @@ private:
|
||||
|
||||
//--------------------------------------------------- MainWindow constructor
|
||||
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem, QString const& thekey,
|
||||
unsigned downSampleFactor, QWidget *parent) :
|
||||
unsigned downSampleFactor, bool test_mode, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
m_revision {revision ("$Rev$")},
|
||||
m_multiple {multiple},
|
||||
m_settings (settings),
|
||||
ui(new Ui::MainWindow),
|
||||
m_config (thekey, settings, this),
|
||||
m_config (thekey, settings, test_mode, this),
|
||||
m_wideGraph (new WideGraph (settings)),
|
||||
m_logDlg (new LogQSO (program_title (), settings, &m_config, this)),
|
||||
m_dialFreq {0},
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
// Multiple instances: call MainWindow() with *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();
|
||||
|
||||
public slots:
|
||||
|
Loading…
Reference in New Issue
Block a user