summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-05-27 21:19:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-27 15:37:50 -0700
commitb76a0f0b97a463bffeeb263e583dc6ed06302a6a (patch)
tree83a90b41188eda2fc5bf674e2388b54c961e9841 /qt-ui
parent4321ef1d88d33e8eb2763d7ec54bcb59e21a285e (diff)
downloadsubsurface-b76a0f0b97a463bffeeb263e583dc6ed06302a6a.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp25
-rw-r--r--qt-ui/configuredivecomputerdialog.h4
-rw-r--r--qt-ui/configuredivecomputerdialog.ui14
3 files changed, 43 insertions, 0 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 172a1a480..c1d36a167 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -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());
+ }
+}
diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h
index b2e4ff636..e41479f32 100644
--- a/qt-ui/configuredivecomputerdialog.h
+++ b/qt-ui/configuredivecomputerdialog.h
@@ -58,6 +58,8 @@ public:
private
slots:
+ void checkLogFile(int state);
+ void pickLogFile();
void readSettings();
void resetSettings();
void configMessage(QString msg);
@@ -78,6 +80,8 @@ slots:
private:
Ui::ConfigureDiveComputerDialog ui;
+ QString logFile;
+
QStringList vendorList;
QHash<QString, QStringList> productList;
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
index 99d07432b..22450f2f6 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -129,6 +129,20 @@
</spacer>
</item>
<item>
+ <widget class="QCheckBox" name="logToFile">
+ <property name="text">
+ <string>Save libdivecomputer logfile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="chooseLogFile">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>Cancel</string>