mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 06:38:44 -05:00
User-configurable directory for file azel.dat.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5566 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
e1727dc927
commit
4ccdb42107
@ -409,6 +409,7 @@ private:
|
||||
Q_SLOT void delete_macro ();
|
||||
void delete_selected_macros (QModelIndexList);
|
||||
Q_SLOT void on_save_path_select_push_button_clicked (bool);
|
||||
Q_SLOT void on_azel_path_select_push_button_clicked (bool);
|
||||
Q_SLOT void delete_frequencies ();
|
||||
Q_SLOT void on_reset_frequencies_push_button_clicked (bool);
|
||||
Q_SLOT void insert_frequency ();
|
||||
@ -446,6 +447,8 @@ private:
|
||||
QDir temp_dir_;
|
||||
QDir default_save_directory_;
|
||||
QDir save_directory_;
|
||||
QDir default_azel_directory_;
|
||||
QDir azel_directory_;
|
||||
|
||||
QFont font_;
|
||||
QFont next_font_;
|
||||
@ -631,6 +634,7 @@ FrequencyList const * Configuration::frequencies () const {return &m_->frequenci
|
||||
QStringListModel * Configuration::macros () {return &m_->macros_;}
|
||||
QStringListModel const * Configuration::macros () const {return &m_->macros_;}
|
||||
QDir Configuration::save_directory () const {return m_->save_directory_;}
|
||||
QDir Configuration::azel_directory () const {return m_->azel_directory_;}
|
||||
QString Configuration::rig_name () const {return m_->rig_params_.rig_name;}
|
||||
|
||||
bool Configuration::transceiver_online (bool open_if_closed)
|
||||
@ -797,9 +801,11 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
|
||||
// Make sure the default save directory exists
|
||||
QString save_dir {"save"};
|
||||
default_save_directory_ = data_dir;
|
||||
default_azel_directory_ = data_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) + "\".");
|
||||
throw std::runtime_error {"Failed to create save directory"};
|
||||
}
|
||||
|
||||
@ -809,7 +815,8 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget *
|
||||
QString samples_dir {"samples"};
|
||||
if (!default_save_directory_.mkpath (samples_dir))
|
||||
{
|
||||
QMessageBox::critical (this, "WSJT-X", tr ("Create Directory", "Cannot create directory \"") + default_save_directory_.absoluteFilePath (samples_dir) + "\".");
|
||||
QMessageBox::critical (this, "WSJT-X", tr ("Create Directory", "Cannot create directory \"") +
|
||||
default_save_directory_.absoluteFilePath (samples_dir) + "\".");
|
||||
throw std::runtime_error {"Failed to create save directory"};
|
||||
}
|
||||
|
||||
@ -1011,6 +1018,7 @@ void Configuration::impl::initialize_models ()
|
||||
ui_->CW_id_interval_spin_box->setValue (id_interval_);
|
||||
ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true);
|
||||
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
|
||||
ui_->azel_path_display_label->setText (azel_directory_.absolutePath ());
|
||||
ui_->CW_id_after_73_check_box->setChecked (id_after_73_);
|
||||
ui_->tx_QSY_check_box->setChecked (tx_QSY_allowed_);
|
||||
ui_->psk_reporter_check_box->setChecked (spot_to_psk_reporter_);
|
||||
@ -1122,6 +1130,7 @@ void Configuration::impl::read_settings ()
|
||||
id_interval_ = settings_->value ("IDint", 0).toInt ();
|
||||
|
||||
save_directory_ = settings_->value ("SaveDir", default_save_directory_.absolutePath ()).toString ();
|
||||
azel_directory_ = settings_->value ("AzElDir", default_azel_directory_.absolutePath ()).toString ();
|
||||
|
||||
{
|
||||
//
|
||||
@ -1256,6 +1265,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("PTTMethod", QVariant::fromValue (rig_params_.ptt_type));
|
||||
settings_->setValue ("PTTport", rig_params_.ptt_port);
|
||||
settings_->setValue ("SaveDir", save_directory_.absolutePath ());
|
||||
settings_->setValue ("AzElDir", azel_directory_.absolutePath ());
|
||||
|
||||
if (default_audio_input_device_selected_)
|
||||
{
|
||||
@ -1671,6 +1681,7 @@ void Configuration::impl::accept ()
|
||||
TX_messages_ = ui_->TX_messages_check_box->isChecked ();
|
||||
data_mode_ = static_cast<DataMode> (ui_->TX_mode_button_group->checkedId ());
|
||||
save_directory_ = ui_->save_path_display_label->text ();
|
||||
azel_directory_ = ui_->azel_path_display_label->text ();
|
||||
enable_VHF_features_ = ui_->enable_VHF_features_check_box->isChecked ();
|
||||
decode_at_52s_ = ui_->decode_at_52s_check_box->isChecked ();
|
||||
frequency_calibration_intercept_ = ui_->calibration_intercept_spin_box->value ();
|
||||
@ -2056,6 +2067,18 @@ void Configuration::impl::on_save_path_select_push_button_clicked (bool /* check
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::impl::on_azel_path_select_push_button_clicked (bool /* checked */)
|
||||
{
|
||||
QFileDialog fd {this, tr ("AzEl Directory"), ui_->azel_path_display_label->text ()};
|
||||
fd.setFileMode (QFileDialog::Directory);
|
||||
fd.setOption (QFileDialog::ShowDirsOnly);
|
||||
if (fd.exec ()) {
|
||||
if (fd.selectedFiles ().size ()) {
|
||||
ui_->azel_path_display_label->setText(fd.selectedFiles().at(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Configuration::impl::have_rig (bool open_if_closed)
|
||||
{
|
||||
if (open_if_closed && !open_rig ())
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
QStringListModel * macros ();
|
||||
QStringListModel const * macros () const;
|
||||
QDir save_directory () const;
|
||||
QDir azel_directory () const;
|
||||
QString rig_name () const;
|
||||
unsigned jt9w_bw_mult () const;
|
||||
float jt9w_min_dt () const;
|
||||
|
@ -44,7 +44,7 @@
|
||||
<string>Select tab to change configuration parameters.</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="general_tab">
|
||||
<attribute name="title">
|
||||
@ -1161,6 +1161,26 @@ radio interface behave as expected.</string>
|
||||
<string>Audio interface settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="save_path_group_box">
|
||||
<property name="title">
|
||||
@ -1328,7 +1348,7 @@ both here.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QGroupBox" name="jt9w_group_box">
|
||||
<property name="title">
|
||||
<string>JT9W Settings</string>
|
||||
@ -1482,24 +1502,49 @@ both here.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="azel_path_group_box">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>0</width>
|
||||
<height>56</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="title">
|
||||
<string>AzEl Directory</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="azel_path_label">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="azel_path_display_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="azel_path_select_push_button">
|
||||
<property name="text">
|
||||
<string>Select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -2376,12 +2421,12 @@ soundcard changes</string>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
@ -100,8 +100,7 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, qint64 fre
|
||||
int nfreq=freqMoon/1000000;
|
||||
double freq8=(double)freqMoon;
|
||||
|
||||
QDir writable = QStandardPaths::writableLocation (QStandardPaths::DataLocation);
|
||||
QString AzElFileName = QDir::toNativeSeparators(writable.absoluteFilePath ("azel.dat"));
|
||||
QString AzElFileName = QDir::toNativeSeparators(m_azelDir.absoluteFilePath ("azel.dat"));
|
||||
|
||||
astrosub_(&nyear, &month, &nday, &uth, &freq8, mygrid.toLatin1().constData(),
|
||||
hisgrid.toLatin1().constData(), &azsun, &elsun, &azmoon, &elmoon,
|
||||
|
2
astro.h
2
astro.h
@ -34,6 +34,8 @@ public:
|
||||
qint32 m_Hz;
|
||||
qint32 m_stepHz;
|
||||
|
||||
QDir m_azelDir;
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent *) override;
|
||||
|
||||
|
@ -958,6 +958,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
|
||||
{
|
||||
Q_EMIT m_config.transceiver_frequency (m_dialFreq);
|
||||
}
|
||||
if(m_astroWidget) m_astroWidget->m_azelDir=m_config.azel_directory();
|
||||
}
|
||||
|
||||
void MainWindow::on_monitorButton_clicked (bool checked)
|
||||
@ -1358,6 +1359,7 @@ void MainWindow::on_actionAstronomical_data_triggered()
|
||||
connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
|
||||
}
|
||||
m_astroWidget->showNormal();
|
||||
m_astroWidget->m_azelDir=m_config.azel_directory();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionMessage_averaging_triggered()
|
||||
|
Loading…
Reference in New Issue
Block a user