summaryrefslogtreecommitdiffstats
path: root/smtk-import
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2015-11-08 18:50:05 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-12 07:39:14 -0800
commitddc77845142c19097b5c8094d7601f78719d3e53 (patch)
treec144f5bd37c0cff89c498257f341ceac41907a3a /smtk-import
parentdc4d8f26ece3d11b0931e486c7190813afbfb6f3 (diff)
downloadsubsurface-ddc77845142c19097b5c8094d7601f78719d3e53.tar.gz
SmartTrak import - CLI parser and GUI files
The tool can be called from CLI with or without arguments, if called with a single argument (this is, no destination file specified) an usage message will be displayed on the terminal; if called with arguments, these should be the .slg file(s) to be imported and a single .xml file to store the resulting Subsurface formatted data; if called without arguments a GUI will display to select the file(s) to import and to store. WARNING, if destination file exists, its previous content will be erased. The GUI is pretty simple and don't think any more is needed but, as this is my first QT thing, I expect those with much better knowledge of QT/C++ will improve it as needed. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'smtk-import')
-rw-r--r--smtk-import/smrtk2ssrfc_window.cpp104
-rw-r--r--smtk-import/smrtk2ssrfc_window.h39
-rw-r--r--smtk-import/smrtk2ssrfc_window.ui823
-rw-r--r--smtk-import/smtk_standalone.cpp49
4 files changed, 1015 insertions, 0 deletions
diff --git a/smtk-import/smrtk2ssrfc_window.cpp b/smtk-import/smrtk2ssrfc_window.cpp
new file mode 100644
index 000000000..cb332cd81
--- /dev/null
+++ b/smtk-import/smrtk2ssrfc_window.cpp
@@ -0,0 +1,104 @@
+#include "smrtk2ssrfc_window.h"
+#include "ui_smrtk2ssrfc_window.h"
+#include "filtermodels.h"
+#include "dive.h"
+#include "divelist.h"
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QSettings>
+#include <QDebug>
+
+QStringList inputFiles;
+QString outputFile;
+
+Smrtk2ssrfcWindow::Smrtk2ssrfcWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::Smrtk2ssrfcWindow)
+{
+ ui->setupUi(this);
+ ui->plainTextEdit->setDisabled(true);
+ ui->progressBar->setDisabled(true);
+ ui->statusBar->adjustSize();
+}
+
+Smrtk2ssrfcWindow::~Smrtk2ssrfcWindow()
+{
+ delete ui;
+}
+
+QString Smrtk2ssrfcWindow::lastUsedDir()
+{
+ QSettings settings;
+ QString lastDir = QDir::homePath();
+
+ settings.beginGroup("FileDialog");
+ if (settings.contains("LastDir"))
+ if (QDir::setCurrent(settings.value("LastDir").toString()))
+ lastDir = settings.value("LastDir").toString();
+ return lastDir;
+}
+
+void Smrtk2ssrfcWindow::updateLastUsedDir(const QString &dir)
+{
+ QSettings s;
+ s.beginGroup("FileDialog");
+ s.setValue("LastDir", dir);
+}
+
+void Smrtk2ssrfcWindow::on_inputFilesButton_clicked()
+{
+ inputFiles = QFileDialog::getOpenFileNames(this, tr("Open SmartTrak files"), lastUsedDir(),
+ tr("SmartTrak files (*.slg *.SLG);;"
+ "All files (*)"));
+ if (inputFiles.isEmpty())
+ return;
+ updateLastUsedDir(QFileInfo(inputFiles[0]).dir().path());
+ ui->inputLine->setText(inputFiles.join(" "));
+ ui->progressBar->setEnabled(true);
+}
+
+void Smrtk2ssrfcWindow::on_outputFileButton_clicked()
+{
+ outputFile = QFileDialog::getSaveFileName(this, tr("Open Subsurface files"), lastUsedDir(),
+ tr("Subsurface files (*.ssrf *SSRF *.xml *.XML);;"
+ "All files (*)"));
+ if (outputFile.isEmpty())
+ return;
+ updateLastUsedDir(QFileInfo(outputFile).dir().path());
+ ui->outputLine->setText(outputFile);
+}
+
+void Smrtk2ssrfcWindow::on_importButton_clicked()
+{
+ if (inputFiles.isEmpty())
+ return;
+
+ QByteArray fileNamePtr;
+
+ ui->plainTextEdit->setDisabled(false);
+ ui->progressBar->setRange(0, inputFiles.size());
+ for (int i = 0; i < inputFiles.size(); ++i) {
+ ui->progressBar->setValue(i);
+ fileNamePtr = QFile::encodeName(inputFiles.at(i));
+ smartrak_import(fileNamePtr.data(), &dive_table);
+ ui->plainTextEdit->appendPlainText(QString(get_error_string()));
+ }
+ ui->progressBar->setValue(inputFiles.size());
+ save_dives_logic(outputFile.toUtf8().data(), false);
+ ui->progressBar->setDisabled(true);
+}
+
+void Smrtk2ssrfcWindow::on_exitButton_clicked()
+{
+ this->close();
+}
+
+void Smrtk2ssrfcWindow::on_outputLine_textEdited()
+{
+ outputFile = ui->outputLine->text();
+}
+
+void Smrtk2ssrfcWindow::on_inputLine_textEdited()
+{
+ inputFiles = ui->inputLine->text().split(" ");
+}
diff --git a/smtk-import/smrtk2ssrfc_window.h b/smtk-import/smrtk2ssrfc_window.h
new file mode 100644
index 000000000..8d5ae9027
--- /dev/null
+++ b/smtk-import/smrtk2ssrfc_window.h
@@ -0,0 +1,39 @@
+#ifndef SMRTK2SSRFC_WINDOW_H
+#define SMRTK2SSRFC_WINDOW_H
+
+#include <QMainWindow>
+#include <QFileDialog>
+#include <QFileInfo>
+
+extern "C" void smartrak_import(const char *file, struct dive_table *divetable);
+
+namespace Ui {
+class Smrtk2ssrfcWindow;
+}
+
+class Smrtk2ssrfcWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit Smrtk2ssrfcWindow(QWidget *parent = 0);
+ ~Smrtk2ssrfcWindow();
+
+private:
+ Ui::Smrtk2ssrfcWindow *ui;
+ QString lastUsedDir();
+ QString filter();
+ void updateLastUsedDir(const QString &s);
+ void closeCurrentFile();
+
+private
+slots:
+ void on_inputFilesButton_clicked();
+ void on_outputFileButton_clicked();
+ void on_importButton_clicked();
+ void on_exitButton_clicked();
+ void on_outputLine_textEdited();
+ void on_inputLine_textEdited();
+};
+
+#endif // SMRTK2SSRFC_WINDOW_H
diff --git a/smtk-import/smrtk2ssrfc_window.ui b/smtk-import/smrtk2ssrfc_window.ui
new file mode 100644
index 000000000..4e5e2ecb3
--- /dev/null
+++ b/smtk-import/smrtk2ssrfc_window.ui
@@ -0,0 +1,823 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Smrtk2ssrfcWindow</class>
+ <widget class="QMainWindow" name="Smrtk2ssrfcWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>512</width>
+ <height>431</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>SmartTrak files importer</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="documentMode">
+ <bool>false</bool>
+ </property>
+ <property name="dockNestingEnabled">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <widget class="Line" name="line">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>360</y>
+ <width>438</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_3">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>150</y>
+ <width>127</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#6ebeb9;&quot;&gt;Subsurface divelog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="outputLine">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>142</x>
+ <y>150</y>
+ <width>241</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="outputFileButton">
+ <property name="geometry">
+ <rect>
+ <x>390</x>
+ <y>150</y>
+ <width>80</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string>Choose</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>120</y>
+ <width>113</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#6ebeb9;&quot;&gt;Smartrak divelog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::NoTextInteraction</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="inputLine">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>142</x>
+ <y>120</y>
+ <width>241</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="inputMethodHints">
+ <set>Qt::ImhNone</set>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="inputFilesButton">
+ <property name="geometry">
+ <rect>
+ <x>390</x>
+ <y>120</y>
+ <width>80</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string>Choose</string>
+ </property>
+ </widget>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>380</y>
+ <width>401</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="cursor">
+ <cursorShape>ArrowCursor</cursorShape>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="invertedAppearance">
+ <bool>false</bool>
+ </property>
+ <property name="textDirection">
+ <enum>QProgressBar::TopToBottom</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="exitButton">
+ <property name="geometry">
+ <rect>
+ <x>390</x>
+ <y>180</y>
+ <width>80</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="importButton">
+ <property name="geometry">
+ <rect>
+ <x>300</x>
+ <y>180</y>
+ <width>80</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::WheelFocus</enum>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::PreventContextMenu</enum>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string>Import</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>10</y>
+ <width>431</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#6ebeb9;&quot;&gt;Select the .slg file(s) you want to import to Subsurface format, and the exported .xml file. It's advisable to use a new output file, as its actual content will be erased.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::AutoText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="indent">
+ <number>-1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>-40</x>
+ <y>-30</y>
+ <width>571</width>
+ <height>471</height>
+ </rect>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="../subsurface.qrc">:/subsurface-icon</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QPlainTextEdit" name="plainTextEdit">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>220</y>
+ <width>401</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="inputMethodHints">
+ <set>Qt::ImhNone</set>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="lineWrapMode">
+ <enum>QPlainTextEdit::NoWrap</enum>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ <property name="backgroundVisible">
+ <bool>true</bool>
+ </property>
+ <property name="placeholderText">
+ <string>Import messages (Errors, warnings, etc)</string>
+ </property>
+ </widget>
+ <zorder>label_4</zorder>
+ <zorder>line</zorder>
+ <zorder>label_3</zorder>
+ <zorder>outputLine</zorder>
+ <zorder>outputFileButton</zorder>
+ <zorder>label_2</zorder>
+ <zorder>inputLine</zorder>
+ <zorder>inputFilesButton</zorder>
+ <zorder>progressBar</zorder>
+ <zorder>exitButton</zorder>
+ <zorder>importButton</zorder>
+ <zorder>label</zorder>
+ <zorder>plainTextEdit</zorder>
+ </widget>
+ <widget class="QStatusBar" name="statusBar">
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>51</red>
+ <green>111</green>
+ <blue>200</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>42</red>
+ <green>92</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>22</red>
+ <green>49</green>
+ <blue>89</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>144</red>
+ <green>164</green>
+ <blue>194</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>51</red>
+ <green>111</green>
+ <blue>200</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>42</red>
+ <green>92</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>22</red>
+ <green>49</green>
+ <blue>89</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>144</red>
+ <green>164</green>
+ <blue>194</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>51</red>
+ <green>111</green>
+ <blue>200</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>42</red>
+ <green>92</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>22</red>
+ <green>49</green>
+ <blue>89</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>17</red>
+ <green>37</green>
+ <blue>66</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>34</red>
+ <green>74</green>
+ <blue>133</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources>
+ <include location="../subsurface.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/smtk-import/smtk_standalone.cpp b/smtk-import/smtk_standalone.cpp
new file mode 100644
index 000000000..54d5b6a99
--- /dev/null
+++ b/smtk-import/smtk_standalone.cpp
@@ -0,0 +1,49 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "dive.h"
+#include "smrtk2ssrfc_window.h"
+#include <QApplication>
+#include <QDebug>
+
+extern "C" void smartrak_import(const char *file, struct dive_table *table);
+
+/*
+ * Simple command line interface to call directly smartrak_import() or launch
+ * the GUI if called without arguments.
+ */
+
+int main(int argc, char *argv[])
+{
+ char *infile, *outfile;
+ int i;
+ QApplication a(argc, argv);
+ Smrtk2ssrfcWindow w;
+
+ switch (argc) {
+ case 1:
+ w.show();
+ return a.exec();
+ break;
+ case 2:
+ qDebug() << "\nUsage:\n";
+ qDebug() << "Smrtk2ssrfc importer can be used without arguments (in a graphical UI)";
+ qDebug() << "or with, at least, two arguments (in a CLI, the file to be imported and";
+ qDebug() << "the file to store the Subsurface formatted dives), so you have to use one";
+ qDebug() << "of these examples:\n";
+ qDebug() << "$smrtk2ssrfc";
+ qDebug() << "or";
+ qDebug() << "$smrtk2ssrfc /input/file.slg[ file_2[ file_n]] /output/file.xml\n\n";
+ break;
+ default:
+ outfile = argv[argc - 1];
+ qDebug() << "\n[Importing]\n";
+ for(i = 1; i < argc -1; i++) {
+ infile = argv[i];
+ qDebug() << "\t" << infile << "\n";
+ smartrak_import(infile, &dive_table);
+ }
+ qDebug() << "\n[Writing]\n\t" << outfile << "\n";
+ save_dives_logic(outfile, false);
+ break;
+ }
+}