mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
A widget to add a set-point change
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
584775cbc0
commit
96a94f1a19
4 changed files with 180 additions and 0 deletions
130
qt-ui/setpoint.ui
Normal file
130
qt-ui/setpoint.ui
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SetpointDialog</class>
|
||||||
|
<widget class="QDialog" name="SetpointDialog">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::WindowModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>211</width>
|
||||||
|
<height>125</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Renumber</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset>
|
||||||
|
<normalon>:/subsurface-icon</normalon>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>New set-point (0 for OC)</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<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>
|
||||||
|
<widget class="QDoubleSpinBox" name="spinbox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>bar</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>2.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>SetpointDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>SetpointDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -18,6 +18,8 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "ui_filterwidget.h"
|
#include "ui_filterwidget.h"
|
||||||
|
#include "libdivecomputer/parser.h"
|
||||||
|
|
||||||
|
|
||||||
class MinMaxAvgWidgetPrivate {
|
class MinMaxAvgWidgetPrivate {
|
||||||
public:
|
public:
|
||||||
|
@ -160,6 +162,35 @@ RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly(
|
||||||
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetpointDialog *SetpointDialog::instance()
|
||||||
|
{
|
||||||
|
static SetpointDialog *self = new SetpointDialog(MainWindow::instance());
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetpointDialog::setpointData(struct divecomputer *divecomputer, int second)
|
||||||
|
{
|
||||||
|
dc = divecomputer;
|
||||||
|
time = second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetpointDialog::buttonClicked(QAbstractButton *button)
|
||||||
|
{
|
||||||
|
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
|
add_event(dc, time, SAMPLE_EVENT_PO2, 0, ui.spinbox->value(), "SP change");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||||
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
||||||
|
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
||||||
|
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
||||||
|
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
||||||
|
}
|
||||||
|
|
||||||
ShiftTimesDialog *ShiftTimesDialog::instance()
|
ShiftTimesDialog *ShiftTimesDialog::instance()
|
||||||
{
|
{
|
||||||
static ShiftTimesDialog *self = new ShiftTimesDialog(MainWindow::instance());
|
static ShiftTimesDialog *self = new ShiftTimesDialog(MainWindow::instance());
|
||||||
|
|
|
@ -9,11 +9,13 @@ class QAbstractButton;
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "ui_renumber.h"
|
#include "ui_renumber.h"
|
||||||
|
#include "ui_setpoint.h"
|
||||||
#include "ui_shifttimes.h"
|
#include "ui_shifttimes.h"
|
||||||
#include "ui_shiftimagetimes.h"
|
#include "ui_shiftimagetimes.h"
|
||||||
#include "ui_divecomponentselection.h"
|
#include "ui_divecomponentselection.h"
|
||||||
#include "ui_listfilter.h"
|
#include "ui_listfilter.h"
|
||||||
#include "exif.h"
|
#include "exif.h"
|
||||||
|
#include <dive.h>
|
||||||
|
|
||||||
class MinMaxAvgWidget : public QWidget {
|
class MinMaxAvgWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -56,6 +58,22 @@ private:
|
||||||
bool selectedOnly;
|
bool selectedOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetpointDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static SetpointDialog *instance();
|
||||||
|
void setpointData(struct divecomputer *divecomputer, int time);
|
||||||
|
private
|
||||||
|
slots:
|
||||||
|
void buttonClicked(QAbstractButton *button);
|
||||||
|
|
||||||
|
private:
|
||||||
|
explicit SetpointDialog(QWidget *parent);
|
||||||
|
Ui::SetpointDialog ui;
|
||||||
|
struct divecomputer *dc;
|
||||||
|
int time;
|
||||||
|
};
|
||||||
|
|
||||||
class ShiftTimesDialog : public QDialog {
|
class ShiftTimesDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -220,6 +220,7 @@ FORMS = \
|
||||||
qt-ui/preferences.ui \
|
qt-ui/preferences.ui \
|
||||||
qt-ui/printoptions.ui \
|
qt-ui/printoptions.ui \
|
||||||
qt-ui/renumber.ui \
|
qt-ui/renumber.ui \
|
||||||
|
qt-ui/setpoint.ui \
|
||||||
qt-ui/shifttimes.ui \
|
qt-ui/shifttimes.ui \
|
||||||
qt-ui/shiftimagetimes.ui \
|
qt-ui/shiftimagetimes.ui \
|
||||||
qt-ui/webservices.ui \
|
qt-ui/webservices.ui \
|
||||||
|
|
Loading…
Add table
Reference in a new issue