diff options
23 files changed, 1153 insertions, 887 deletions
diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 0e7601196..2cf6382dd 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -36,7 +36,6 @@ set (SUBSURFACE_UI filterwidget.ui listfilter.ui locationInformation.ui - maintab.ui mainwindow.ui plannerDetails.ui plannerSettings.ui @@ -51,6 +50,11 @@ set (SUBSURFACE_UI urldialog.ui usersurvey.ui webservices.ui + tab-widgets/maintab.ui + tab-widgets/TabDiveStatistics.ui + tab-widgets/TabDiveInformation.ui + tab-widgets/TabDivePhotos.ui + tab-widgets/TabDiveExtraInfo.ui ) # the interface, in C++ @@ -64,7 +68,6 @@ set(SUBSURFACE_INTERFACE downloadfromdivecomputer.cpp globe.cpp kmessagewidget.cpp - maintab.cpp mainwindow.cpp modeldelegates.cpp notificationwidget.cpp @@ -82,6 +85,12 @@ set(SUBSURFACE_INTERFACE undocommands.cpp locationinformation.cpp qtwaitingspinner.cpp + tab-widgets/TabDiveStatistics.cpp + tab-widgets/TabDiveInformation.cpp + tab-widgets/TabDivePhotos.cpp + tab-widgets/TabDiveExtraInfo.cpp + tab-widgets/maintab.cpp + tab-widgets/TabBase.cpp ) if(NOT NO_USERMANUAL) diff --git a/desktop-widgets/globe.cpp b/desktop-widgets/globe.cpp index 2bab4e83f..2aef1438b 100644 --- a/desktop-widgets/globe.cpp +++ b/desktop-widgets/globe.cpp @@ -3,7 +3,7 @@ #include "desktop-widgets/mainwindow.h" #include "core/helpers.h" #include "desktop-widgets/divelistview.h" -#include "desktop-widgets/maintab.h" +#include "desktop-widgets/tab-widgets/maintab.h" #include "core/display.h" #include <QTimer> diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 28bc6cee6..5f70fa2e3 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -24,7 +24,7 @@ #include "profile-widget/profilewidget2.h" #include "desktop-widgets/globe.h" #include "core/divecomputer.h" -#include "desktop-widgets/maintab.h" +#include "desktop-widgets/tab-widgets/maintab.h" #include "desktop-widgets/diveplanner.h" #ifndef NO_PRINTING #include <QPrintDialog> @@ -643,9 +643,7 @@ ProfileWidget2 *MainWindow::graphics() const void MainWindow::cleanUpEmpty() { - information()->clearStats(); - information()->clearInfo(); - information()->clearEquipment(); + information()->clearTabs(); information()->updateDiveInfo(true); graphics()->setEmptyState(); dive_list()->reload(DiveTripModel::TREE); diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index dd5d0943f..156f724e0 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -5,7 +5,7 @@ #include "desktop-widgets/usersurvey.h" #include "core/divelist.h" #include "desktop-widgets/globe.h" -#include "desktop-widgets/maintab.h" +#include "desktop-widgets/tab-widgets/maintab.h" #include "core/display.h" #include "core/membuffer.h" #include "core/subsurface-qt/SettingsObjectWrapper.h" diff --git a/desktop-widgets/tab-widgets/TabBase.cpp b/desktop-widgets/tab-widgets/TabBase.cpp new file mode 100644 index 000000000..127cce6e4 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabBase.cpp @@ -0,0 +1,6 @@ +#include "TabBase.h" + +TabBase::TabBase(QWidget *parent) : QWidget(parent) +{ +} + diff --git a/desktop-widgets/tab-widgets/TabBase.h b/desktop-widgets/tab-widgets/TabBase.h new file mode 100644 index 000000000..c5f3c4dcc --- /dev/null +++ b/desktop-widgets/tab-widgets/TabBase.h @@ -0,0 +1,17 @@ +#ifndef TAB_BASE_H +#define TAB_BASE_H + +#include <QWidget> + +struct dive; + +class TabBase : public QWidget { + Q_OBJECT + +public: + TabBase(QWidget *parent); + virtual void updateData() = 0; + virtual void clear() = 0; +}; + +#endif diff --git a/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp b/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp new file mode 100644 index 000000000..0560da7b3 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp @@ -0,0 +1,29 @@ +#include "TabDiveExtraInfo.h" +#include "ui_TabDiveExtraInfo.h" + +#include <qt-models/divecomputerextradatamodel.h> + +TabDiveExtraInfo::TabDiveExtraInfo(QWidget *parent) : + TabBase(parent), + ui(new Ui::TabDiveExtraInfo()), + extraDataModel(new ExtraDataModel()) +{ + ui->setupUi(this); + ui->extraData->setModel(extraDataModel); +} + +TabDiveExtraInfo::~TabDiveExtraInfo() +{ + delete ui; +} + +void TabDiveExtraInfo::updateData() +{ + extraDataModel->updateDive(); +} + +void TabDiveExtraInfo::clear() +{ + extraDataModel->updateDive(); +} + diff --git a/desktop-widgets/tab-widgets/TabDiveExtraInfo.h b/desktop-widgets/tab-widgets/TabDiveExtraInfo.h new file mode 100644 index 000000000..194e6cfd3 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveExtraInfo.h @@ -0,0 +1,24 @@ +#ifndef TAB_DIVE_EXTRA_INFO_H +#define TAB_DIVE_EXTRA_INFO_H + +#include "TabBase.h" + +namespace Ui { + class TabDiveExtraInfo; +}; + +class ExtraDataModel; + +class TabDiveExtraInfo : public TabBase { + Q_OBJECT +public: + TabDiveExtraInfo(QWidget *parent); + ~TabDiveExtraInfo(); + void updateData() override; + void clear() override; +private: + Ui::TabDiveExtraInfo *ui; + ExtraDataModel *extraDataModel; +}; + +#endif diff --git a/desktop-widgets/tab-widgets/TabDiveExtraInfo.ui b/desktop-widgets/tab-widgets/TabDiveExtraInfo.ui new file mode 100644 index 000000000..0e3008d1a --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveExtraInfo.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TabDiveExtraInfo</class> + <widget class="QWidget" name="TabDiveExtraInfo"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Extra Info</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTableView" name="extraData"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp new file mode 100644 index 000000000..c9f9a4c44 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -0,0 +1,100 @@ +#include "TabDiveInformation.h" +#include "ui_TabDiveInformation.h" +#include "../tagwidget.h" + +#include <core/helpers.h> +#include <core/statistics.h> +#include <core/display.h> + +TabDiveInformation::TabDiveInformation(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveInformation()) +{ + ui->setupUi(this); +} + +TabDiveInformation::~TabDiveInformation() +{ + delete ui; +} + +void TabDiveInformation::clear() +{ + ui->sacText->clear(); + ui->otuText->clear(); + ui->maxcnsText->clear(); + ui->oxygenHeliumText->clear(); + ui->gasUsedText->clear(); + ui->dateText->clear(); + ui->diveTimeText->clear(); + ui->surfaceIntervalText->clear(); + ui->maximumDepthText->clear(); + ui->averageDepthText->clear(); + ui->waterTemperatureText->clear(); + ui->airTemperatureText->clear(); + ui->airPressureText->clear(); + ui->salinityText->clear(); +} + +void TabDiveInformation::updateData() +{ + clear(); + + ui->maxcnsText->setText(QString("%1\%").arg(displayed_dive.maxcns)); + ui->otuText->setText(QString("%1").arg(displayed_dive.otu)); + ui->maximumDepthText->setText(get_depth_string(displayed_dive.maxdepth, true)); + ui->averageDepthText->setText(get_depth_string(displayed_dive.meandepth, true)); + ui->dateText->setText(get_short_dive_date_string(displayed_dive.when)); + ui->waterTemperatureText->setText(get_temperature_string(displayed_dive.watertemp, true)); + ui->airTemperatureText->setText(get_temperature_string(displayed_dive.airtemp, true)); + + volume_t gases[MAX_CYLINDERS] = {}; + get_gas_used(&displayed_dive, gases); + QString volumes; + int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS]; + per_cylinder_mean_depth(&displayed_dive, select_dc(&displayed_dive), mean, duration); + volume_t sac; + QString gaslist, SACs, separator; + + gaslist = ""; SACs = ""; volumes = ""; separator = ""; + for (int i = 0; i < MAX_CYLINDERS; i++) { + if (!is_cylinder_used(&displayed_dive, i)) + continue; + gaslist.append(separator); volumes.append(separator); SACs.append(separator); + separator = "\n"; + + gaslist.append(gasname(&displayed_dive.cylinder[i].gasmix)); + if (!gases[i].mliter) + continue; + volumes.append(get_volume_string(gases[i], true)); + if (duration[i]) { + sac.mliter = gases[i].mliter / (depth_to_atm(mean[i], &displayed_dive) * duration[i] / 60); + SACs.append(get_volume_string(sac, true).append(tr("/min"))); + } + } + ui->gasUsedText->setText(volumes); + ui->oxygenHeliumText->setText(gaslist); + + int sum = displayed_dive.dc.divemode != FREEDIVE ? 30 : 0; + ui->diveTimeText->setText(get_time_string_s(displayed_dive.duration.seconds + sum, 0, false)); + + struct dive *prevd; + process_all_dives(&displayed_dive, &prevd); + + if (prevd) + ui->surfaceIntervalText->setText(get_time_string_s(displayed_dive.when - (prevd->when + prevd->duration.seconds), 4, + (displayed_dive.dc.divemode == FREEDIVE))); + else + ui->surfaceIntervalText->clear(); + + ui->sacText->setText( mean[0] ? SACs : QString()); + + if (displayed_dive.surface_pressure.mbar) /* this is ALWAYS displayed in mbar */ + ui->airPressureText->setText(QString("%1mbar").arg(displayed_dive.surface_pressure.mbar)); + else + ui->airPressureText->clear(); + + if (displayed_dive.salinity) + ui->salinityText->setText(QString("%1g/l").arg(displayed_dive.salinity / 10.0)); + else + ui->salinityText->clear(); + +} diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.h b/desktop-widgets/tab-widgets/TabDiveInformation.h new file mode 100644 index 000000000..e67b981c9 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveInformation.h @@ -0,0 +1,23 @@ +#ifndef TAB_DIVE_INFORMATION_H +#define TAB_DIVE_INFORMATION_H + +#include "TabBase.h" + +namespace Ui { + class TabDiveInformation; +}; + +class TabDiveInformation : public TabBase { + Q_OBJECT +public: + TabDiveInformation(QWidget *parent); + ~TabDiveInformation(); + void updateData() override; + void clear() override; + +private: + Ui::TabDiveInformation *ui; +}; + + +#endif diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.ui b/desktop-widgets/tab-widgets/TabDiveInformation.ui new file mode 100644 index 000000000..feb547334 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveInformation.ui @@ -0,0 +1,340 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TabDiveInformation</class> + <widget class="QWidget" name="TabDiveInformation"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>421</height> + </rect> + </property> + <property name="windowTitle"> + <string>Information</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QScrollArea" name="scrollArea_3"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_3"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>409</height> + </rect> + </property> + <layout class="QGridLayout" name="diveInfoScrollAreaLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="spacing"> + <number>2</number> + </property> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Date</string> + </property> + <layout class="QHBoxLayout" name="diveInfoDateLayout"> + <item> + <widget class="QLabel" name="dateText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="QGroupBox" name="groupBox_12"> + <property name="title"> + <string>Interval</string> + </property> + <layout class="QHBoxLayout" name="diveInfoSurfintervallLayout"> + <item> + <widget class="QLabel" name="surfaceIntervalText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>Gases used</string> + </property> + <layout class="QHBoxLayout" name="diveInfoGasesUsedLayout"> + <item> + <widget class="QLabel" name="oxygenHeliumText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="1"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Gas consumed</string> + </property> + <layout class="QHBoxLayout" name="diveInfoGasConsumedLayout"> + <item> + <widget class="QLabel" name="gasUsedText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="2"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>SAC</string> + </property> + <layout class="QHBoxLayout" name="diveInfoSacLayout"> + <item> + <widget class="QLabel" name="sacText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox_15"> + <property name="title"> + <string>CNS</string> + </property> + <layout class="QHBoxLayout" name="diveInfoCnsLayout"> + <item> + <widget class="QLabel" name="maxcnsText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>OTU</string> + </property> + <layout class="QHBoxLayout" name="diveInfoOtuLayout"> + <item> + <widget class="QLabel" name="otuText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="1"> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Max. depth</string> + </property> + <layout class="QHBoxLayout" name="diveInfoMaxDepthLayout"> + <item> + <widget class="QLabel" name="maximumDepthText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="groupBox_7"> + <property name="title"> + <string>Avg. depth</string> + </property> + <layout class="QHBoxLayout" name="diveInfoAvgDepthLayout"> + <item> + <widget class="QLabel" name="averageDepthText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="2"> + <widget class="QGroupBox" name="groupBox_10"> + <property name="title"> + <string>Air pressure</string> + </property> + <layout class="QHBoxLayout" name="diveInfoAirPressureLayout"> + <item> + <widget class="QLabel" name="airPressureText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="2"> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Air temp.</string> + </property> + <layout class="QHBoxLayout" name="diveInfoAirTempLayout"> + <item> + <widget class="QLabel" name="airTemperatureText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="4" column="0"> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>Water temp.</string> + </property> + <layout class="QHBoxLayout" name="diveInfoWaterTempLayout"> + <item> + <widget class="QLabel" name="waterTemperatureText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QGroupBox" name="groupBox_11"> + <property name="title"> + <string>Dive time</string> + </property> + <layout class="QHBoxLayout" name="diveInfoDiveTimeLayout"> + <item> + <widget class="QLabel" name="diveTimeText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="4" column="1"> + <widget class="QGroupBox" name="groupBox_1"> + <property name="title"> + <string>Salinity</string> + </property> + <layout class="QHBoxLayout" name="diveInfoSalinityLayout"> + <item> + <widget class="QLabel" name="salinityText"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="5" column="0"> + <spacer> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/desktop-widgets/tab-widgets/TabDivePhotos.cpp b/desktop-widgets/tab-widgets/TabDivePhotos.cpp new file mode 100644 index 000000000..7f8b3a8b0 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDivePhotos.cpp @@ -0,0 +1,98 @@ +#include "TabDivePhotos.h" +#include "ui_TabDivePhotos.h" + +#include <qt-models/divepicturemodel.h> + +#include <QDesktopServices> +#include <QContextMenuEvent> +#include <QMenu> +#include <QUrl> +#include <QMessageBox> + +//TODO: Remove those in the future. +#include "../mainwindow.h" +#include "../divelistview.h" + +TabDivePhotos::TabDivePhotos(QWidget *parent) + : TabBase(parent), + ui(new Ui::TabDivePhotos()), + divePictureModel(DivePictureModel::instance()) +{ + ui->setupUi(this); + ui->photosView->setModel(divePictureModel); + ui->photosView->setSelectionMode(QAbstractItemView::MultiSelection); + + connect(ui->photosView, &DivePictureWidget::photoDoubleClicked, + [](const QString& path) { + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); + } + ); +} + +TabDivePhotos::~TabDivePhotos() +{ + delete ui; +} + +void TabDivePhotos::clear() +{ + updateData(); +} + +void TabDivePhotos::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu popup(this); + popup.addAction(tr("Load image(s) from file(s)"), this, &TabDivePhotos::addPhotosFromFile); + popup.addAction(tr("Load image(s) from web"), this, &TabDivePhotos::addPhotosFromURL); + popup.addSeparator(); + popup.addAction(tr("Delete selected images"), this, &TabDivePhotos::removeSelectedPhotos); + popup.addAction(tr("Delete all images"), this, &TabDivePhotos::removeAllPhotos); + popup.exec(event->globalPos()); + event->accept(); +} + +void TabDivePhotos::removeSelectedPhotos() +{ + bool last = false; + if (!ui->photosView->selectionModel()->hasSelection()) + return; + QModelIndexList indexes = ui->photosView->selectionModel()->selectedRows(); + if (indexes.count() == 0) + indexes = ui->photosView->selectionModel()->selectedIndexes(); + QModelIndex photo = indexes.first(); + do { + photo = indexes.first(); + last = indexes.count() == 1; + if (photo.isValid()) { + QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString(); + if (fileUrl.length() > 0) + DivePictureModel::instance()->removePicture(fileUrl, last); + } + indexes.removeFirst(); + } while(!indexes.isEmpty()); +} + +//TODO: This looks overly wrong. We shouldn't call MainWindow to retrieve the DiveList to add Images. +void TabDivePhotos::addPhotosFromFile() +{ + MainWindow::instance()->dive_list()->loadImages(); +} + +void TabDivePhotos::addPhotosFromURL() +{ + MainWindow::instance()->dive_list()->loadWebImages(); +} + +void TabDivePhotos::removeAllPhotos() +{ + if (QMessageBox::warning(this, tr("Deleting Images"), tr("Are you sure you want to delete all images?"), QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Cancel ) { + ui->photosView->selectAll(); + removeSelectedPhotos(); + } +} + +void TabDivePhotos::updateData() +{ + divePictureModel->updateDivePictures(); +} + diff --git a/desktop-widgets/tab-widgets/TabDivePhotos.h b/desktop-widgets/tab-widgets/TabDivePhotos.h new file mode 100644 index 000000000..f2c73b572 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDivePhotos.h @@ -0,0 +1,33 @@ +#ifndef TAB_DIVE_PHOTOS_H +#define TAB_DIVE_PHOTOS_H + +#include "TabBase.h" + +namespace Ui { + class TabDivePhotos; +}; + +class DivePictureModel; + +class TabDivePhotos : public TabBase { + Q_OBJECT +public: + TabDivePhotos(QWidget *parent); + ~TabDivePhotos(); + void updateData() override; + void clear() override; + +protected: + void contextMenuEvent(QContextMenuEvent *ev) override; + +private: + void addPhotosFromFile(); + void addPhotosFromURL(); + void removeAllPhotos(); + void removeSelectedPhotos(); + + Ui::TabDivePhotos *ui; + DivePictureModel *divePictureModel; +}; + +#endif diff --git a/desktop-widgets/tab-widgets/TabDivePhotos.ui b/desktop-widgets/tab-widgets/TabDivePhotos.ui new file mode 100644 index 000000000..35cfd375a --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDivePhotos.ui @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TabDivePhotos</class> + <widget class="QWidget" name="TabDivePhotos"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Photos</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="DivePictureWidget" name="photosView"> + <property name="viewMode"> + <enum>QListView::IconMode</enum> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>DivePictureWidget</class> + <extends>QListView</extends> + <header>desktop-widgets/divepicturewidget.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp new file mode 100644 index 000000000..6f8c207b1 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -0,0 +1,125 @@ +#include "TabDiveStatistics.h" +#include "ui_TabDiveStatistics.h" + +#include <core/helpers.h> +#include <core/display.h> +#include <core/statistics.h> + +TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveStatistics()) +{ + ui->setupUi(this); + ui->sacLimits->overrideMaxToolTipText(tr("Highest total SAC of a dive")); + ui->sacLimits->overrideMinToolTipText(tr("Lowest total SAC of a dive")); + ui->sacLimits->overrideAvgToolTipText(tr("Average total SAC of all selected dives")); + ui->tempLimits->overrideMaxToolTipText(tr("Highest temperature")); + ui->tempLimits->overrideMinToolTipText(tr("Lowest temperature")); + ui->tempLimits->overrideAvgToolTipText(tr("Average temperature of all selected dives")); + ui->depthLimits->overrideMaxToolTipText(tr("Deepest dive")); + ui->depthLimits->overrideMinToolTipText(tr("Shallowest dive")); + ui->timeLimits->overrideMaxToolTipText(tr("Longest dive")); + ui->timeLimits->overrideMinToolTipText(tr("Shortest dive")); + ui->timeLimits->overrideAvgToolTipText(tr("Average length of all selected dives")); + + Q_FOREACH (QObject *obj, children()) { + if (QLabel *label = qobject_cast<QLabel *>(obj)) + label->setAlignment(Qt::AlignHCenter); + } +} + +TabDiveStatistics::~TabDiveStatistics() +{ + delete ui; +} + +void TabDiveStatistics::clear() +{ + ui->depthLimits->clear(); + ui->sacLimits->clear(); + ui->divesAllText->clear(); + ui->tempLimits->clear(); + ui->totalTimeAllText->clear(); + ui->timeLimits->clear(); +} + +void TabDiveStatistics::updateData() +{ + clear(); + ui->depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true)); + ui->depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, true)); + // the overall average depth is really confusing when listed between the + // deepest and shallowest dive - let's just not set it + // ui->depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, true)); + + + if (amount_selected > 1 && stats_selection.max_sac.mliter) + ui->sacLimits->setMaximum(get_volume_string(stats_selection.max_sac, true).append(tr("/min"))); + else + ui->sacLimits->setMaximum(""); + if (amount_selected > 1 && stats_selection.min_sac.mliter) + ui->sacLimits->setMinimum(get_volume_string(stats_selection.min_sac, true).append(tr("/min"))); + else + ui->sacLimits->setMinimum(""); + if (stats_selection.avg_sac.mliter) + ui->sacLimits->setAverage(get_volume_string(stats_selection.avg_sac, true).append(tr("/min"))); + else + ui->sacLimits->setAverage(""); + + temperature_t temp; + temp.mkelvin = stats_selection.max_temp; + ui->tempLimits->setMaximum(get_temperature_string(temp, true)); + temp.mkelvin = stats_selection.min_temp; + ui->tempLimits->setMinimum(get_temperature_string(temp, true)); + if (stats_selection.combined_temp && stats_selection.combined_count) { + const char *unit; + get_temp_units(0, &unit); + ui->tempLimits->setAverage(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit)); + } + + + ui->divesAllText->setText(QString::number(stats_selection.selection_size)); + ui->totalTimeAllText->setText(get_time_string_s(stats_selection.total_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); + int seconds = stats_selection.total_time.seconds; + if (stats_selection.selection_size) + seconds /= stats_selection.selection_size; + ui->timeLimits->setAverage(get_time_string_s(seconds, 0,(displayed_dive.dc.divemode == FREEDIVE))); + if (amount_selected > 1) { + ui->timeLimits->setMaximum(get_time_string_s(stats_selection.longest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); + ui->timeLimits->setMinimum(get_time_string_s(stats_selection.shortest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); + } else { + ui->timeLimits->setMaximum(""); + ui->timeLimits->setMinimum(""); + } + + QVector<QPair<QString, int> > gasUsed; + QString gasUsedString; + volume_t vol; + selectedDivesGasUsed(gasUsed); + for (int j = 0; j < 20; j++) { + if (gasUsed.isEmpty()) + break; + QPair<QString, int> gasPair = gasUsed.last(); + gasUsed.pop_back(); + vol.mliter = gasPair.second; + gasUsedString.append(gasPair.first).append(": ").append(get_volume_string(vol, true)).append("\n"); + } + if (!gasUsed.isEmpty()) + gasUsedString.append("..."); + volume_t o2_tot = {}, he_tot = {}; + selected_dives_gas_parts(&o2_tot, &he_tot); + + /* No need to show the gas mixing information if diving + * with pure air, and only display the he / O2 part when + * it is used. + */ + if (he_tot.mliter || o2_tot.mliter) { + gasUsedString.append(tr("These gases could be\nmixed from Air and using:\n")); + if (he_tot.mliter) + gasUsedString.append(QString("He: %1").arg(get_volume_string(he_tot, true))); + if (he_tot.mliter && o2_tot.mliter) + gasUsedString.append(tr(" and ")); + if (o2_tot.mliter) + gasUsedString.append(QString("O2: %2\n").arg(get_volume_string(o2_tot, true))); + } + ui->gasConsumption->setText(gasUsedString); +} + diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.h b/desktop-widgets/tab-widgets/TabDiveStatistics.h new file mode 100644 index 000000000..fd0d4ec0d --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.h @@ -0,0 +1,22 @@ +#ifndef TAB_DIVE_STATISTICS_H +#define TAB_DIVE_STATISTICS_H + +#include "TabBase.h" + +namespace Ui { + class TabDiveStatistics; +}; + +class TabDiveStatistics : public TabBase { + Q_OBJECT +public: + TabDiveStatistics(QWidget *parent); + ~TabDiveStatistics(); + void updateData() override; + void clear() override; + +private: + Ui::TabDiveStatistics *ui; +}; + +#endif diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.ui b/desktop-widgets/tab-widgets/TabDiveStatistics.ui new file mode 100644 index 000000000..251983611 --- /dev/null +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.ui @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TabDiveStatistics</class> + <widget class="QWidget" name="TabDiveStatistics"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Statistics</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QScrollArea" name="scrollArea_4"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_4"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>288</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QGroupBox" name="groupBoxb"> + <property name="title"> + <string>Depth</string> + </property> + <layout class="QHBoxLayout" name="statsDepthLayout"> + <item> + <widget class="MinMaxAvgWidget" name="depthLimits" native="true"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_14"> + <property name="title"> + <string>Duration</string> + </property> + <layout class="QHBoxLayout" name="statsDurationLayout"> + <item> + <widget class="MinMaxAvgWidget" name="timeLimits" native="true"/> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QGroupBox" name="groupBox_8b"> + <property name="title"> + <string>Temperature</string> + </property> + <layout class="QHBoxLayout" name="statsTempLayout"> + <item> + <widget class="MinMaxAvgWidget" name="tempLimits" native="true"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_11b"> + <property name="title"> + <string>Total time</string> + </property> + <layout class="QHBoxLayout" name="statsTotalTimeLayout"> + <item> + <widget class="QLabel" name="totalTimeAllText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_7b"> + <property name="title"> + <string>Dives</string> + </property> + <layout class="QHBoxLayout" name="statsDivesLayout"> + <item> + <widget class="QLabel" name="divesAllText"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <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> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QGroupBox" name="groupBox_4b"> + <property name="title"> + <string>SAC</string> + </property> + <layout class="QHBoxLayout" name="statsSacLayout"> + <item> + <widget class="MinMaxAvgWidget" name="sacLimits" native="true"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_13"> + <property name="title"> + <string>Gas consumption</string> + </property> + <layout class="QHBoxLayout" name="statsGasConsumptionLayout"> + <item> + <widget class="QLabel" name="gasConsumption"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>MinMaxAvgWidget</class> + <extends>QWidget</extends> + <header>desktop-widgets/simplewidgets.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index d8ccafb0a..0b712c8fb 100644 --- a/desktop-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -4,7 +4,7 @@ * classes for the "notebook" area of the main window of Subsurface * */ -#include "desktop-widgets/maintab.h" +#include "desktop-widgets/tab-widgets/maintab.h" #include "desktop-widgets/mainwindow.h" #include "desktop-widgets/globe.h" #include "core/helpers.h" @@ -18,12 +18,16 @@ #include "core/divesitehelpers.h" #include "qt-models/cylindermodel.h" #include "qt-models/weightmodel.h" -#include "qt-models/divepicturemodel.h" #include "qt-models/divecomputerextradatamodel.h" #include "qt-models/divelocationmodel.h" #include "core/divesite.h" #include "desktop-widgets/locationinformation.h" +#include "TabDiveExtraInfo.h" +#include "TabDiveInformation.h" +#include "TabDivePhotos.h" +#include "TabDiveStatistics.h" + #include <QCompleter> #include <QSettings> #include <QScrollBar> @@ -35,13 +39,21 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), weightModel(new WeightModel(this)), cylindersModel(new CylindersModel(this)), - extraDataModel(new ExtraDataModel(this)), editMode(NONE), - divePictureModel(DivePictureModel::instance()), copyPaste(false), currentTrip(0) { ui.setupUi(this); + + extraWidgets << new TabDiveExtraInfo(this); + addTab(extraWidgets.last(), "Extra Info"); + extraWidgets << new TabDiveInformation(this); + addTab(extraWidgets.last(), "Information"); + extraWidgets << new TabDiveStatistics(this); + addTab(extraWidgets.last(), "Statistics"); + extraWidgets << new TabDivePhotos(this); + addTab(extraWidgets.last(), "Photos"); + ui.dateEdit->setDisplayFormat(prefs.date_format); memset(&displayed_dive, 0, sizeof(displayed_dive)); @@ -49,9 +61,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.cylinders->setModel(cylindersModel); ui.weights->setModel(weightModel); - ui.photosView->setModel(divePictureModel); - connect(ui.photosView, SIGNAL(photoDoubleClicked(QString)), this, SLOT(photoDoubleClicked(QString))); - ui.extraData->setModel(extraDataModel); closeMessage(); connect(ui.editDiveSiteButton, SIGNAL(clicked()), MainWindow::instance(), SIGNAL(startDiveSiteEdit())); @@ -80,11 +89,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), // filled from a dive, they are made writeable setEnabled(false); - Q_FOREACH (QObject *obj, ui.statisticsTab->children()) { - QLabel *label = qobject_cast<QLabel *>(obj); - if (label) - label->setAlignment(Qt::AlignHCenter); - } ui.cylinders->setTitle(tr("Cylinders")); ui.cylinders->setBtnToolTip(tr("Add cylinder")); connect(ui.cylinders, SIGNAL(addButtonClicked()), this, SLOT(addCylinder_clicked())); @@ -118,8 +122,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.tagWidget->setCompleter(completers.tags); ui.diveNotesMessage->hide(); ui.diveEquipmentMessage->hide(); - ui.diveInfoMessage->hide(); - ui.diveStatisticsMessage->hide(); ui.depth->hide(); ui.depthLabel->hide(); ui.duration->hide(); @@ -134,8 +136,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), p.setColor(QPalette::Window, QColor(Qt::white)); ui.scrollArea->viewport()->setPalette(p); ui.scrollArea_2->viewport()->setPalette(p); - ui.scrollArea_3->viewport()->setPalette(p); - ui.scrollArea_4->viewport()->setPalette(p); // GroupBoxes in Gnome3 looks like I'v drawn them... static const QString gnomeCss( @@ -204,7 +204,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), acceptingEdit = false; ui.diveTripLocation->hide(); - ui.photosView->setSelectionMode(QAbstractItemView::MultiSelection); + + } MainTab::~MainTab() @@ -262,16 +263,12 @@ void MainTab::addMessageAction(QAction *action) { ui.diveEquipmentMessage->addAction(action); ui.diveNotesMessage->addAction(action); - ui.diveInfoMessage->addAction(action); - ui.diveStatisticsMessage->addAction(action); } void MainTab::hideMessage() { ui.diveNotesMessage->animatedHide(); ui.diveEquipmentMessage->animatedHide(); - ui.diveInfoMessage->animatedHide(); - ui.diveStatisticsMessage->animatedHide(); updateTextLabels(false); } @@ -280,24 +277,16 @@ void MainTab::closeMessage() hideMessage(); ui.diveNotesMessage->setCloseButtonVisible(false); ui.diveEquipmentMessage->setCloseButtonVisible(false); - ui.diveInfoMessage->setCloseButtonVisible(false); - ui.diveStatisticsMessage->setCloseButtonVisible(false); } void MainTab::displayMessage(QString str) { ui.diveNotesMessage->setCloseButtonVisible(false); ui.diveEquipmentMessage->setCloseButtonVisible(false); - ui.diveInfoMessage->setCloseButtonVisible(false); - ui.diveStatisticsMessage->setCloseButtonVisible(false); ui.diveNotesMessage->setText(str); ui.diveNotesMessage->animatedShow(); ui.diveEquipmentMessage->setText(str); ui.diveEquipmentMessage->animatedShow(); - ui.diveInfoMessage->setText(str); - ui.diveInfoMessage->animatedShow(); - ui.diveStatisticsMessage->setText(str); - ui.diveStatisticsMessage->animatedShow(); updateTextLabels(); } @@ -370,35 +359,6 @@ void MainTab::nextInputField(QKeyEvent *event) keyPressEvent(event); } -void MainTab::clearInfo() -{ - ui.sacText->clear(); - ui.otuText->clear(); - ui.maxcnsText->clear(); - ui.oxygenHeliumText->clear(); - ui.gasUsedText->clear(); - ui.dateText->clear(); - ui.diveTimeText->clear(); - ui.surfaceIntervalText->clear(); - ui.maximumDepthText->clear(); - ui.averageDepthText->clear(); - ui.waterTemperatureText->clear(); - ui.airTemperatureText->clear(); - ui.airPressureText->clear(); - ui.salinityText->clear(); - ui.tagWidget->clear(); -} - -void MainTab::clearStats() -{ - ui.depthLimits->clear(); - ui.sacLimits->clear(); - ui.divesAllText->clear(); - ui.tempLimits->clear(); - ui.totalTimeAllText->clear(); - ui.timeLimits->clear(); -} - #define UPDATE_TEXT(d, field) \ if (clear || !d.field) \ ui.field->setText(QString()); \ @@ -459,14 +419,15 @@ void MainTab::updateDiveInfo(bool clear) // If exactly one trip has been selected, we show the location / notes // for the trip in the Info tab, otherwise we show the info of the // selected_dive - temperature_t temp; struct dive *prevd; char buf[1024]; process_selected_dives(); process_all_dives(&displayed_dive, &prevd); - divePictureModel->updateDivePictures(); + for (auto widget : extraWidgets) { + widget->updateData(); + } ui.notes->setText(QString()); if (!clear) { @@ -590,7 +551,6 @@ void MainTab::updateDiveInfo(bool clear) ui.equipmentTab->setEnabled(true); cylindersModel->updateDive(); weightModel->updateDive(); - extraDataModel->updateDive(); taglist_get_tagstring(displayed_dive.tag_list, buf, 1024); ui.tagWidget->setText(QString(buf)); bool isManual = !current_dive || same_string(current_dive->dc.model, "manually added dive"); @@ -601,12 +561,6 @@ void MainTab::updateDiveInfo(bool clear) } ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm")); ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true)); - ui.maximumDepthText->setText(get_depth_string(displayed_dive.maxdepth, true)); - ui.averageDepthText->setText(get_depth_string(displayed_dive.meandepth, true)); - ui.maxcnsText->setText(QString("%1\%").arg(displayed_dive.maxcns)); - ui.otuText->setText(QString("%1").arg(displayed_dive.otu)); - ui.waterTemperatureText->setText(get_temperature_string(displayed_dive.watertemp, true)); - ui.airTemperatureText->setText(get_temperature_string(displayed_dive.airtemp, true)); ui.DiveType->setCurrentIndex(get_dive_dc(&displayed_dive, dc_number)->divemode); volume_t gases[MAX_CYLINDERS] = {}; @@ -614,100 +568,7 @@ void MainTab::updateDiveInfo(bool clear) QString volumes; int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS]; per_cylinder_mean_depth(&displayed_dive, select_dc(&displayed_dive), mean, duration); - volume_t sac; - QString gaslist, SACs, separator; - - gaslist = ""; SACs = ""; volumes = ""; separator = ""; - for (int i = 0; i < MAX_CYLINDERS; i++) { - if (!is_cylinder_used(&displayed_dive, i)) - continue; - gaslist.append(separator); volumes.append(separator); SACs.append(separator); - separator = "\n"; - - gaslist.append(gasname(&displayed_dive.cylinder[i].gasmix)); - if (!gases[i].mliter) - continue; - volumes.append(get_volume_string(gases[i], true)); - if (duration[i]) { - sac.mliter = lrint(gases[i].mliter / (depth_to_atm(mean[i], &displayed_dive) * duration[i] / 60)); - SACs.append(get_volume_string(sac, true).append(tr("/min"))); - } - } - ui.gasUsedText->setText(volumes); - ui.oxygenHeliumText->setText(gaslist); - ui.dateText->setText(get_short_dive_date_string(displayed_dive.when)); - if (displayed_dive.dc.divemode != FREEDIVE) - ui.diveTimeText->setText(get_time_string_s(displayed_dive.duration.seconds + 30, 0, false)); - else - ui.diveTimeText->setText(get_time_string_s(displayed_dive.duration.seconds, 0, true)); - if (prevd) - ui.surfaceIntervalText->setText(get_time_string_s(displayed_dive.when - (prevd->when + prevd->duration.seconds), 4, - (displayed_dive.dc.divemode == FREEDIVE))); - else - ui.surfaceIntervalText->clear(); - if (mean[0]) - ui.sacText->setText(SACs); - else - ui.sacText->clear(); - if (displayed_dive.surface_pressure.mbar) - /* this is ALWAYS displayed in mbar */ - ui.airPressureText->setText(QString("%1mbar").arg(displayed_dive.surface_pressure.mbar)); - else - ui.airPressureText->clear(); - if (displayed_dive.salinity) - ui.salinityText->setText(QString("%1g/l").arg(displayed_dive.salinity / 10.0)); - else - ui.salinityText->clear(); - ui.depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true)); - ui.depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, true)); - // the overall average depth is really confusing when listed between the - // deepest and shallowest dive - let's just not set it - // ui.depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, true)); - ui.depthLimits->overrideMaxToolTipText(tr("Deepest dive")); - ui.depthLimits->overrideMinToolTipText(tr("Shallowest dive")); - if (amount_selected > 1 && stats_selection.max_sac.mliter) - ui.sacLimits->setMaximum(get_volume_string(stats_selection.max_sac, true).append(tr("/min"))); - else - ui.sacLimits->setMaximum(""); - if (amount_selected > 1 && stats_selection.min_sac.mliter) - ui.sacLimits->setMinimum(get_volume_string(stats_selection.min_sac, true).append(tr("/min"))); - else - ui.sacLimits->setMinimum(""); - if (stats_selection.avg_sac.mliter) - ui.sacLimits->setAverage(get_volume_string(stats_selection.avg_sac, true).append(tr("/min"))); - else - ui.sacLimits->setAverage(""); - ui.sacLimits->overrideMaxToolTipText(tr("Highest total SAC of a dive")); - ui.sacLimits->overrideMinToolTipText(tr("Lowest total SAC of a dive")); - ui.sacLimits->overrideAvgToolTipText(tr("Average total SAC of all selected dives")); - ui.divesAllText->setText(QString::number(stats_selection.selection_size)); - temp.mkelvin = stats_selection.max_temp; - ui.tempLimits->setMaximum(get_temperature_string(temp, true)); - temp.mkelvin = stats_selection.min_temp; - ui.tempLimits->setMinimum(get_temperature_string(temp, true)); - if (stats_selection.combined_temp && stats_selection.combined_count) { - const char *unit; - get_temp_units(0, &unit); - ui.tempLimits->setAverage(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit)); - } - ui.tempLimits->overrideMaxToolTipText(tr("Highest temperature")); - ui.tempLimits->overrideMinToolTipText(tr("Lowest temperature")); - ui.tempLimits->overrideAvgToolTipText(tr("Average temperature of all selected dives")); - ui.totalTimeAllText->setText(get_time_string_s(stats_selection.total_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); - int seconds = stats_selection.total_time.seconds; - if (stats_selection.selection_size) - seconds /= stats_selection.selection_size; - ui.timeLimits->setAverage(get_time_string_s(seconds, 0,(displayed_dive.dc.divemode == FREEDIVE))); - if (amount_selected > 1) { - ui.timeLimits->setMaximum(get_time_string_s(stats_selection.longest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); - ui.timeLimits->setMinimum(get_time_string_s(stats_selection.shortest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE))); - } else { - ui.timeLimits->setMaximum(""); - ui.timeLimits->setMinimum(""); - } - ui.timeLimits->overrideMaxToolTipText(tr("Longest dive")); - ui.timeLimits->overrideMinToolTipText(tr("Shortest dive")); - ui.timeLimits->overrideAvgToolTipText(tr("Average length of all selected dives")); + // now let's get some gas use statistics QVector<QPair<QString, int> > gasUsed; QString gasUsedString; @@ -726,20 +587,6 @@ void MainTab::updateDiveInfo(bool clear) volume_t o2_tot = {}, he_tot = {}; selected_dives_gas_parts(&o2_tot, &he_tot); - /* No need to show the gas mixing information if diving - * with pure air, and only display the he / O2 part when - * it is used. - */ - if (he_tot.mliter || o2_tot.mliter) { - gasUsedString.append(tr("These gases could be\nmixed from Air and using:\n")); - if (he_tot.mliter) - gasUsedString.append(QString("He: %1").arg(get_volume_string(he_tot, true))); - if (he_tot.mliter && o2_tot.mliter) - gasUsedString.append(tr(" and ")); - if (o2_tot.mliter) - gasUsedString.append(QString("O₂: %2\n").arg(get_volume_string(o2_tot, true))); - } - ui.gasConsumption->setText(gasUsedString); if(ui.locationTags->text().isEmpty()) ui.locationTags->hide(); else @@ -750,9 +597,7 @@ void MainTab::updateDiveInfo(bool clear) } else { /* clear the fields */ - clearInfo(); - clearStats(); - clearEquipment(); + clearTabs(); ui.rating->setCurrentStars(0); ui.visibility->setCurrentStars(0); ui.location->clear(); @@ -1186,7 +1031,10 @@ void MainTab::rejectChanges() else clear_dive(&displayed_dive); updateDiveInfo(selected_dive < 0); - DivePictureModel::instance()->updateDivePictures(); + + for (auto widget : extraWidgets) { + widget->updateData(); + } // the user could have edited the location and then canceled the edit // let's get the correct location back in view #ifndef NO_MARBLE @@ -1199,7 +1047,6 @@ void MainTab::rejectChanges() weightModel->changed = false; cylindersModel->updateDive(); weightModel->updateDive(); - extraDataModel->updateDive(); ui.editDiveSiteButton->setEnabled(true); } #undef EDIT_TEXT2 @@ -1627,48 +1474,11 @@ void MainTab::escDetected() rejectChanges(); } -void MainTab::photoDoubleClicked(const QString filePath) -{ - QDesktopServices::openUrl(QUrl::fromLocalFile(filePath)); -} - -void MainTab::removeSelectedPhotos() -{ - bool last = false; - if (!ui.photosView->selectionModel()->hasSelection()) - return; - QModelIndexList indexes = ui.photosView->selectionModel()->selectedRows(); - if (indexes.count() == 0) - indexes = ui.photosView->selectionModel()->selectedIndexes(); - QModelIndex photo = indexes.first(); - do { - photo = indexes.first(); - last = indexes.count() == 1; - if (photo.isValid()) { - QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString(); - if (fileUrl.length() > 0) - DivePictureModel::instance()->removePicture(fileUrl, last); - } - indexes.removeFirst(); - } while(!indexes.isEmpty()); -} - -void MainTab::removeAllPhotos() -{ - if (QMessageBox::warning(this, tr("Deleting Images"), tr("Are you sure you want to delete all images?"), QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Cancel ) { - ui.photosView->selectAll(); - removeSelectedPhotos(); +void MainTab::clearTabs() { + for (auto widget : extraWidgets) { + widget->clear(); } -} - -void MainTab::addPhotosFromFile() -{ - MainWindow::instance()->dive_list()->loadImages(); -} - -void MainTab::addPhotosFromURL() -{ - MainWindow::instance()->dive_list()->loadWebImages(); + clearEquipment(); } #define SHOW_SELECTIVE(_component) \ @@ -1710,15 +1520,3 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what) weightModel->changed = true; } } - -void MainTab::contextMenuEvent(QContextMenuEvent *event) -{ - QMenu popup(this); - popup.addAction(tr("Load image(s) from file(s)"), this, SLOT(addPhotosFromFile())); - popup.addAction(tr("Load image(s) from web"), this, SLOT(addPhotosFromURL())); - popup.addSeparator(); - popup.addAction(tr("Delete selected images"), this, SLOT(removeSelectedPhotos())); - popup.addAction(tr("Delete all images"), this, SLOT(removeAllPhotos())); - popup.exec(event->globalPos()); - event->accept(); -} diff --git a/desktop-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h index 25d078434..a33d6053b 100644 --- a/desktop-widgets/maintab.h +++ b/desktop-widgets/tab-widgets/maintab.h @@ -30,6 +30,7 @@ struct Completers { QCompleter *tags; }; +class TabBase; class MainTab : public QTabWidget { Q_OBJECT public: @@ -44,8 +45,7 @@ public: MainTab(QWidget *parent = 0); ~MainTab(); - void clearStats(); - void clearInfo(); + void clearTabs(); void clearEquipment(); void reload(); void initialUiSetup(); @@ -54,7 +54,6 @@ public: void refreshDisplayedDiveSite(); void nextInputField(QKeyEvent *event); void showAndTriggerEditSelective(struct dive_components what); - void contextMenuEvent(QContextMenuEvent *event); signals: void addDiveFinished(); @@ -98,11 +97,6 @@ slots: void toggleTriggeredColumn(); void updateTextLabels(bool showUnits = true); void escDetected(void); - void photoDoubleClicked(const QString filePath); - void removeSelectedPhotos(); - void removeAllPhotos(); - void addPhotosFromFile(); - void addPhotosFromURL(); void showLocation(); void enableGeoLookupEdition(); void disableGeoLookupEdition(); @@ -112,13 +106,11 @@ private: Ui::MainTab ui; WeightModel *weightModel; CylindersModel *cylindersModel; - ExtraDataModel *extraDataModel; EditMode editMode; BuddyCompletionModel buddyModel; DiveMasterCompletionModel diveMasterModel; SuitCompletionModel suitModel; TagCompletionModel tagModel; - DivePictureModel *divePictureModel; Completers completers; bool modified; bool copyPaste; @@ -131,6 +123,7 @@ private: dive_trip_t displayedTrip; bool acceptingEdit; uint32_t updateDiveSite(uint32_t pickedUuid, int divenr); + QList<TabBase*> extraWidgets; }; #endif // MAINTAB_H diff --git a/desktop-widgets/maintab.ui b/desktop-widgets/tab-widgets/maintab.ui index 4a6ed9807..e1e29d052 100644 --- a/desktop-widgets/maintab.ui +++ b/desktop-widgets/tab-widgets/maintab.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="notesTab"> <attribute name="title"> @@ -237,7 +237,7 @@ <string>...</string> </property> <property name="icon"> - <iconset resource="../subsurface.qrc"> + <iconset resource="../../subsurface.qrc"> <normaloff>:/geocode</normaloff>:/geocode</iconset> </property> </widget> @@ -546,7 +546,7 @@ <x>0</x> <y>0</y> <width>445</width> - <height>754</height> + <height>720</height> </rect> </property> <layout class="QGridLayout" name="equipmentTabScrollAreaLayout"> @@ -601,625 +601,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="infoTab"> - <attribute name="title"> - <string>Info</string> - </attribute> - <attribute name="toolTip"> - <string>Dive information</string> - </attribute> - <layout class="QGridLayout" name="diveInfoLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item row="0" column="0"> - <widget class="KMessageWidget" name="diveInfoMessage"/> - </item> - <item row="1" column="0"> - <widget class="QScrollArea" name="scrollArea_3"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_3"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>287</width> - <height>320</height> - </rect> - </property> - <layout class="QGridLayout" name="diveInfoScrollAreaLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="spacing"> - <number>2</number> - </property> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Date</string> - </property> - <layout class="QHBoxLayout" name="diveInfoDateLayout"> - <item> - <widget class="QLabel" name="dateText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="2"> - <widget class="QGroupBox" name="groupBox_12"> - <property name="title"> - <string>Interval</string> - </property> - <layout class="QHBoxLayout" name="diveInfoSurfintervallLayout"> - <item> - <widget class="QLabel" name="surfaceIntervalText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="title"> - <string>Gases used</string> - </property> - <layout class="QHBoxLayout" name="diveInfoGasesUsedLayout"> - <item> - <widget class="QLabel" name="oxygenHeliumText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="1"> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Gas consumed</string> - </property> - <layout class="QHBoxLayout" name="diveInfoGasConsumedLayout"> - <item> - <widget class="QLabel" name="gasUsedText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="2"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>SAC</string> - </property> - <layout class="QHBoxLayout" name="diveInfoSacLayout"> - <item> - <widget class="QLabel" name="sacText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="0"> - <widget class="QGroupBox" name="groupBox_15"> - <property name="title"> - <string>CNS</string> - </property> - <layout class="QHBoxLayout" name="diveInfoCnsLayout"> - <item> - <widget class="QLabel" name="maxcnsText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="1"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>OTU</string> - </property> - <layout class="QHBoxLayout" name="diveInfoOtuLayout"> - <item> - <widget class="QLabel" name="otuText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="1"> - <widget class="QGroupBox" name="groupBox_6"> - <property name="title"> - <string>Max. depth</string> - </property> - <layout class="QHBoxLayout" name="diveInfoMaxDepthLayout"> - <item> - <widget class="QLabel" name="maximumDepthText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="0"> - <widget class="QGroupBox" name="groupBox_7"> - <property name="title"> - <string>Avg. depth</string> - </property> - <layout class="QHBoxLayout" name="diveInfoAvgDepthLayout"> - <item> - <widget class="QLabel" name="averageDepthText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="2"> - <widget class="QGroupBox" name="groupBox_10"> - <property name="title"> - <string>Air pressure</string> - </property> - <layout class="QHBoxLayout" name="diveInfoAirPressureLayout"> - <item> - <widget class="QLabel" name="airPressureText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="2"> - <widget class="QGroupBox" name="groupBox_9"> - <property name="title"> - <string>Air temp.</string> - </property> - <layout class="QHBoxLayout" name="diveInfoAirTempLayout"> - <item> - <widget class="QLabel" name="airTemperatureText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="4" column="0"> - <widget class="QGroupBox" name="groupBox_8"> - <property name="title"> - <string>Water temp.</string> - </property> - <layout class="QHBoxLayout" name="diveInfoWaterTempLayout"> - <item> - <widget class="QLabel" name="waterTemperatureText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="1"> - <widget class="QGroupBox" name="groupBox_11"> - <property name="title"> - <string>Dive time</string> - </property> - <layout class="QHBoxLayout" name="diveInfoDiveTimeLayout"> - <item> - <widget class="QLabel" name="diveTimeText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="4" column="1"> - <widget class="QGroupBox" name="groupBox_1"> - <property name="title"> - <string>Salinity</string> - </property> - <layout class="QHBoxLayout" name="diveInfoSalinityLayout"> - <item> - <widget class="QLabel" name="salinityText"> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="5" column="0"> - <spacer> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="statisticsTab"> - <attribute name="title"> - <string>Stats</string> - </attribute> - <attribute name="toolTip"> - <string>Simple statistics about the selection</string> - </attribute> - <layout class="QGridLayout" name="statsLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item row="1" column="1"> - <widget class="QScrollArea" name="scrollArea_4"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_4"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>297</width> - <height>187</height> - </rect> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <widget class="QGroupBox" name="groupBoxb"> - <property name="title"> - <string>Depth</string> - </property> - <layout class="QHBoxLayout" name="statsDepthLayout"> - <item> - <widget class="MinMaxAvgWidget" name="depthLimits" native="true"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_14"> - <property name="title"> - <string>Duration</string> - </property> - <layout class="QHBoxLayout" name="statsDurationLayout"> - <item> - <widget class="MinMaxAvgWidget" name="timeLimits" native="true"/> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <item> - <widget class="QGroupBox" name="groupBox_8b"> - <property name="title"> - <string>Temperature</string> - </property> - <layout class="QHBoxLayout" name="statsTempLayout"> - <item> - <widget class="MinMaxAvgWidget" name="tempLimits" native="true"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_11b"> - <property name="title"> - <string>Total time</string> - </property> - <layout class="QHBoxLayout" name="statsTotalTimeLayout"> - <item> - <widget class="QLabel" name="totalTimeAllText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_7b"> - <property name="title"> - <string>Dives</string> - </property> - <layout class="QHBoxLayout" name="statsDivesLayout"> - <item> - <widget class="QLabel" name="divesAllText"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <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> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QGroupBox" name="groupBox_4b"> - <property name="title"> - <string>SAC</string> - </property> - <layout class="QHBoxLayout" name="statsSacLayout"> - <item> - <widget class="MinMaxAvgWidget" name="sacLimits" native="true"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_13"> - <property name="title"> - <string>Gas consumption</string> - </property> - <layout class="QHBoxLayout" name="statsGasConsumptionLayout"> - <item> - <widget class="QLabel" name="gasConsumption"> - <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - <item row="0" column="1"> - <widget class="KMessageWidget" name="diveStatisticsMessage"/> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Photos</string> - </attribute> - <attribute name="toolTip"> - <string>All photos from the current selection</string> - </attribute> - <layout class="QVBoxLayout" name="photosLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item> - <widget class="DivePictureWidget" name="photosView"> - <property name="viewMode"> - <enum>QListView::IconMode</enum> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2"> - <attribute name="title"> - <string>Extra data</string> - </attribute> - <attribute name="toolTip"> - <string>Adittional data from the dive computer</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item> - <widget class="QTableView" name="extraData"/> - </item> - </layout> - </widget> </widget> <customwidgets> <customwidget> @@ -1235,12 +616,6 @@ <container>1</container> </customwidget> <customwidget> - <class>MinMaxAvgWidget</class> - <extends>QWidget</extends> - <header>desktop-widgets/simplewidgets.h</header> - <container>1</container> - </customwidget> - <customwidget> <class>TableView</class> <extends>QWidget</extends> <header>desktop-widgets/tableview.h</header> @@ -1252,11 +627,6 @@ <header>desktop-widgets/tagwidget.h</header> </customwidget> <customwidget> - <class>DivePictureWidget</class> - <extends>QListView</extends> - <header>desktop-widgets/divepicturewidget.h</header> - </customwidget> - <customwidget> <class>QtWaitingSpinner</class> <extends>QWidget</extends> <header>desktop-widgets/qtwaitingspinner.h</header> @@ -1281,7 +651,7 @@ <tabstop>notes</tabstop> </tabstops> <resources> - <include location="../subsurface.qrc"/> + <include location="../../subsurface.qrc"/> </resources> <connections/> </ui> diff --git a/desktop-widgets/tagwidget.cpp b/desktop-widgets/tagwidget.cpp index 3b61b492a..754a8886f 100644 --- a/desktop-widgets/tagwidget.cpp +++ b/desktop-widgets/tagwidget.cpp @@ -1,6 +1,6 @@ #include "tagwidget.h" #include "mainwindow.h" -#include "maintab.h" +#include "tab-widgets/maintab.h" #include <QCompleter> TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NULL), lastFinishedTag(false) diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index e30df687c..e38101302 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -9,7 +9,7 @@ #include "core/qt-gui.h" #include "core/subsurfacestartup.h" #include "desktop-widgets/mainwindow.h" -#include "desktop-widgets/maintab.h" +#include "desktop-widgets/tab-widgets/maintab.h" #include "profile-widget/profilewidget2.h" #include "desktop-widgets/preferences/preferencesdialog.h" #include "desktop-widgets/diveplanner.h" |