summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp5
-rw-r--r--qt-ui/mainwindow.cpp61
-rw-r--r--qt-ui/mainwindow.h3
-rw-r--r--qt-ui/mainwindow.ui14
4 files changed, 71 insertions, 12 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 37ca2775b..f3cd45c71 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -183,7 +183,10 @@ DownloadThread::DownloadThread(device_data_t* data): data(data)
void DownloadThread::run()
{
DownloadFromDCWidget *dfdcw = DownloadFromDCWidget::instance();
- do_libdivecomputer_import(data);
+ if (!strcmp(data->vendor, "Uemis"))
+ do_uemis_import(data->devname, data->force_download);
+ else
+ do_libdivecomputer_import(data);
process_dives(TRUE, dfdcw->preferDownloaded());
dfdcw->stoppedDownloading();
}
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index fc454ab2f..0655e7a40 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -86,7 +86,7 @@ void MainWindow::redrawProfile()
void MainWindow::on_actionNew_triggered()
{
- qDebug("actionNew");
+ on_actionClose_triggered();
}
void MainWindow::on_actionOpen_triggered()
@@ -120,6 +120,7 @@ void MainWindow::on_actionOpen_triggered()
char *error = NULL;
parse_file(fileNamePtr.data(), &error);
set_filename(fileNamePtr.data(), TRUE);
+ setTitle(MWTF_FILENAME);
if (error != NULL) {
showError(error);
@@ -164,13 +165,49 @@ void MainWindow::on_actionClose_triggered()
ui->ProfileWidget->clear();
ui->ListWidget->reload(DiveTripModel::TREE);
ui->globe->reload();
+ setTitle(MWTF_DEFAULT);
clear_events();
}
void MainWindow::on_actionImport_triggered()
{
- qDebug("actionImport");
+ 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();
+ settings.endGroup();
+
+ QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Import Files"), lastDir, filter());
+ if (!fileNames.size())
+ return; // no selection
+
+ // Keep last open dir
+ QFileInfo fileInfo(fileNames.at(0));
+ settings.beginGroup("FileDialog");
+ settings.setValue("LastDir", fileInfo.dir().path());
+ settings.endGroup();
+
+ QByteArray fileNamePtr;
+ char *error = NULL;
+ for (int i = 0; i < fileNames.size(); ++i) {
+ fileNamePtr = fileNames.at(i).toLocal8Bit();
+ parse_file(fileNamePtr.data(), &error);
+ if (error != NULL) {
+ showError(error);
+ free(error);
+ error = NULL;
+ }
+ }
+ process_dives(FALSE, FALSE);
+
+ ui->InfoWidget->reload();
+ ui->globe->reload();
+ ui->ListWidget->reload(DiveTripModel::TREE);
+ ui->ListWidget->setFocus();
}
void MainWindow::on_actionExportUDDF_triggered()
@@ -295,8 +332,8 @@ void MainWindow::on_actionViewInfo_triggered()
void MainWindow::on_actionViewGlobe_triggered()
{
- ui->infoProfileSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED);
- ui->mainSplitter->setSizes( BEHAVIOR << COLLAPSED << EXPANDED);
+ ui->mainSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED);
+ ui->listGlobeSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED);
}
#undef BEHAVIOR
@@ -638,6 +675,7 @@ void MainWindow::file_save_as(void)
if (!filename.isNull() && !filename.isEmpty()) {
save_dives(filename.toUtf8().data());
set_filename(filename.toUtf8().data(), TRUE);
+ setTitle(MWTF_FILENAME);
mark_divelist_changed(FALSE);
}
}
@@ -670,3 +708,18 @@ void MainWindow::showError(QString message)
ui->mainErrorMessage->setMessageType(KMessageWidget::Error);
ui->mainErrorMessage->animatedShow();
}
+
+void MainWindow::setTitle(enum MainWindowTitleFormat format)
+{
+ switch (format) {
+ case MWTF_DEFAULT:
+ setWindowTitle("Subsurface");
+ break;
+ case MWTF_FILENAME:
+ QFile f(existing_filename);
+ QFileInfo fileInfo(f);
+ QString fileName(fileInfo.fileName());
+ setWindowTitle("Subsurface: " + fileName);
+ break;
+ }
+}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 85825958d..bac74689d 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -31,6 +31,8 @@ class MainTab;
class ProfileGraphicsView;
class QTextBrowser;
+enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };
+
class MainWindow : public QMainWindow
{
Q_OBJECT
@@ -43,6 +45,7 @@ public:
DiveListView *dive_list();
GlobeGPS *globe();
void showError(QString message);
+ void setTitle(enum MainWindowTitleFormat format);
private slots:
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 1dfb8a27b..b1274b8ea 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -103,7 +103,7 @@
<x>0</x>
<y>0</y>
<width>763</width>
- <height>20</height>
+ <height>18</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -144,11 +144,11 @@
<property name="title">
<string>View</string>
</property>
+ <addaction name="actionViewAll"/>
<addaction name="actionViewList"/>
<addaction name="actionViewProfile"/>
<addaction name="actionViewInfo"/>
<addaction name="actionViewGlobe"/>
- <addaction name="actionViewAll"/>
<addaction name="separator"/>
<addaction name="actionPreviousDC"/>
<addaction name="actionNextDC"/>
@@ -296,7 +296,7 @@
<string>View List</string>
</property>
<property name="shortcut">
- <string>Ctrl+1</string>
+ <string>Ctrl+2</string>
</property>
</action>
<action name="actionViewProfile">
@@ -304,7 +304,7 @@
<string>View Profile</string>
</property>
<property name="shortcut">
- <string>Ctrl+2</string>
+ <string>Ctrl+3</string>
</property>
</action>
<action name="actionViewInfo">
@@ -312,7 +312,7 @@
<string>View Info</string>
</property>
<property name="shortcut">
- <string>Ctrl+3</string>
+ <string>Ctrl+4</string>
</property>
</action>
<action name="actionViewAll">
@@ -320,7 +320,7 @@
<string>View All</string>
</property>
<property name="shortcut">
- <string>Ctrl+5</string>
+ <string>Ctrl+1</string>
</property>
</action>
<action name="actionPreviousDC">
@@ -367,7 +367,7 @@
<string>View Globe</string>
</property>
<property name="shortcut">
- <string>Ctrl+4</string>
+ <string>Ctrl+5</string>
</property>
</action>
<action name="actionDivePlanner">