mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Wire gui for diagnostic logs from dc configuration
This copies peaces from the downloadfromdivecomputer dialog into the configuredivecomputerdialog and connects them to be able to create a logfile form the configuration of the divecomputer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4321ef1d88
commit
b76a0f0b97
3 changed files with 43 additions and 0 deletions
|
@ -124,6 +124,9 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
|
|||
this, SLOT(deviceDetailsReceived(DeviceDetails *)));
|
||||
connect(ui.retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
|
||||
connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
|
||||
ui.chooseLogFile->setEnabled(ui.logToFile->isChecked());
|
||||
connect(ui.chooseLogFile, SIGNAL(clicked()), this, SLOT(pickLogFile()));
|
||||
connect(ui.logToFile, SIGNAL(stateChanged(int)), this, SLOT(checkLogFile(int)));
|
||||
|
||||
memset(&device_data, 0, sizeof(device_data));
|
||||
fill_computer_list();
|
||||
|
@ -1117,3 +1120,25 @@ void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int curr
|
|||
dcType = DC_TYPE_UEMIS;
|
||||
fill_device_list(dcType);
|
||||
}
|
||||
|
||||
void ConfigureDiveComputerDialog::checkLogFile(int state)
|
||||
{
|
||||
ui.chooseLogFile->setEnabled(state == Qt::Checked);
|
||||
device_data.libdc_log = (state == Qt::Checked);
|
||||
if (state == Qt::Checked && logFile.isEmpty()) {
|
||||
pickLogFile();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureDiveComputerDialog::pickLogFile()
|
||||
{
|
||||
QString filename = existing_filename ?: prefs.default_filename;
|
||||
QFileInfo fi(filename);
|
||||
filename = fi.absolutePath().append(QDir::separator()).append("subsurface.log");
|
||||
logFile = QFileDialog::getSaveFileName(this, tr("Choose file for divecomputer download logfile"),
|
||||
filename, tr("Log files (*.log)"));
|
||||
if (!logFile.isEmpty()) {
|
||||
free(logfile_name);
|
||||
logfile_name = strdup(logFile.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue