mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: move MinMaxAvgWidget to TabDiveStatistics
This is its only user and the widget is scheduled for removal. Let's move it there temporarilly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ab94956759
commit
49fc05de7e
5 changed files with 128 additions and 124 deletions
|
|
@ -25,106 +25,6 @@
|
||||||
#include "core/metadata.h"
|
#include "core/metadata.h"
|
||||||
#include "core/tag.h"
|
#include "core/tag.h"
|
||||||
|
|
||||||
double MinMaxAvgWidget::average() const
|
|
||||||
{
|
|
||||||
return avgValue->text().toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
double MinMaxAvgWidget::maximum() const
|
|
||||||
{
|
|
||||||
return maxValue->text().toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
double MinMaxAvgWidget::minimum() const
|
|
||||||
{
|
|
||||||
return minValue->text().toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
MinMaxAvgWidget::MinMaxAvgWidget(QWidget *parent) : QWidget(parent)
|
|
||||||
{
|
|
||||||
avgIco = new QLabel(this);
|
|
||||||
avgIco->setPixmap(QIcon(":value-average-icon").pixmap(16, 16));
|
|
||||||
avgIco->setToolTip(gettextFromC::tr("Average"));
|
|
||||||
minIco = new QLabel(this);
|
|
||||||
minIco->setPixmap(QIcon(":value-minimum-icon").pixmap(16, 16));
|
|
||||||
minIco->setToolTip(gettextFromC::tr("Minimum"));
|
|
||||||
maxIco = new QLabel(this);
|
|
||||||
maxIco->setPixmap(QIcon(":value-maximum-icon").pixmap(16, 16));
|
|
||||||
maxIco->setToolTip(gettextFromC::tr("Maximum"));
|
|
||||||
avgValue = new QLabel(this);
|
|
||||||
minValue = new QLabel(this);
|
|
||||||
maxValue = new QLabel(this);
|
|
||||||
|
|
||||||
QGridLayout *formLayout = new QGridLayout;
|
|
||||||
formLayout->addWidget(maxIco, 0, 0);
|
|
||||||
formLayout->addWidget(maxValue, 0, 1);
|
|
||||||
formLayout->addWidget(avgIco, 1, 0);
|
|
||||||
formLayout->addWidget(avgValue, 1, 1);
|
|
||||||
formLayout->addWidget(minIco, 2, 0);
|
|
||||||
formLayout->addWidget(minValue, 2, 1);
|
|
||||||
setLayout(formLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::clear()
|
|
||||||
{
|
|
||||||
avgValue->setText(QString());
|
|
||||||
maxValue->setText(QString());
|
|
||||||
minValue->setText(QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setAverage(double average)
|
|
||||||
{
|
|
||||||
avgValue->setText(QString::number(average));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setMaximum(double maximum)
|
|
||||||
{
|
|
||||||
maxValue->setText(QString::number(maximum));
|
|
||||||
}
|
|
||||||
void MinMaxAvgWidget::setMinimum(double minimum)
|
|
||||||
{
|
|
||||||
minValue->setText(QString::number(minimum));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setAverage(const QString &average)
|
|
||||||
{
|
|
||||||
avgValue->setText(average);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setMaximum(const QString &maximum)
|
|
||||||
{
|
|
||||||
maxValue->setText(maximum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setMinimum(const QString &minimum)
|
|
||||||
{
|
|
||||||
minValue->setText(minimum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::overrideMinToolTipText(const QString &newTip)
|
|
||||||
{
|
|
||||||
minIco->setToolTip(newTip);
|
|
||||||
minValue->setToolTip(newTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::overrideAvgToolTipText(const QString &newTip)
|
|
||||||
{
|
|
||||||
avgIco->setToolTip(newTip);
|
|
||||||
avgValue->setToolTip(newTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::overrideMaxToolTipText(const QString &newTip)
|
|
||||||
{
|
|
||||||
maxIco->setToolTip(newTip);
|
|
||||||
maxValue->setToolTip(newTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MinMaxAvgWidget::setAvgVisibility(bool visible)
|
|
||||||
{
|
|
||||||
avgIco->setVisible(visible);
|
|
||||||
avgValue->setVisible(visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenumberDialog::buttonClicked(QAbstractButton *button)
|
void RenumberDialog::buttonClicked(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
|
|
|
||||||
|
|
@ -24,29 +24,6 @@ struct dive_components;
|
||||||
#include "ui_listfilter.h"
|
#include "ui_listfilter.h"
|
||||||
#include "ui_addfilterpreset.h"
|
#include "ui_addfilterpreset.h"
|
||||||
|
|
||||||
class MinMaxAvgWidget : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
QLabel *avgIco, *avgValue;
|
|
||||||
QLabel *minIco, *minValue;
|
|
||||||
QLabel *maxIco, *maxValue;
|
|
||||||
public:
|
|
||||||
MinMaxAvgWidget(QWidget *parent);
|
|
||||||
double minimum() const;
|
|
||||||
double maximum() const;
|
|
||||||
double average() const;
|
|
||||||
void setMinimum(double minimum);
|
|
||||||
void setMaximum(double maximum);
|
|
||||||
void setAverage(double average);
|
|
||||||
void setMinimum(const QString &minimum);
|
|
||||||
void setMaximum(const QString &maximum);
|
|
||||||
void setAverage(const QString &average);
|
|
||||||
void overrideMinToolTipText(const QString &newTip);
|
|
||||||
void overrideAvgToolTipText(const QString &newTip);
|
|
||||||
void overrideMaxToolTipText(const QString &newTip);
|
|
||||||
void setAvgVisibility(bool visible);
|
|
||||||
void clear();
|
|
||||||
};
|
|
||||||
|
|
||||||
class RenumberDialog : public QDialog {
|
class RenumberDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#include "core/qthelper.h"
|
#include "core/qthelper.h"
|
||||||
#include "core/selection.h"
|
#include "core/selection.h"
|
||||||
#include "core/statistics.h"
|
#include "core/statistics.h"
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveStatistics())
|
TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveStatistics())
|
||||||
{
|
{
|
||||||
|
|
@ -156,3 +158,102 @@ void TabDiveStatistics::updateData()
|
||||||
ui->gasConsumption->setText(gasUsedString);
|
ui->gasConsumption->setText(gasUsedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double MinMaxAvgWidget::average() const
|
||||||
|
{
|
||||||
|
return avgValue->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
double MinMaxAvgWidget::maximum() const
|
||||||
|
{
|
||||||
|
return maxValue->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
double MinMaxAvgWidget::minimum() const
|
||||||
|
{
|
||||||
|
return minValue->text().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
MinMaxAvgWidget::MinMaxAvgWidget(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
avgIco = new QLabel(this);
|
||||||
|
avgIco->setPixmap(QIcon(":value-average-icon").pixmap(16, 16));
|
||||||
|
avgIco->setToolTip(gettextFromC::tr("Average"));
|
||||||
|
minIco = new QLabel(this);
|
||||||
|
minIco->setPixmap(QIcon(":value-minimum-icon").pixmap(16, 16));
|
||||||
|
minIco->setToolTip(gettextFromC::tr("Minimum"));
|
||||||
|
maxIco = new QLabel(this);
|
||||||
|
maxIco->setPixmap(QIcon(":value-maximum-icon").pixmap(16, 16));
|
||||||
|
maxIco->setToolTip(gettextFromC::tr("Maximum"));
|
||||||
|
avgValue = new QLabel(this);
|
||||||
|
minValue = new QLabel(this);
|
||||||
|
maxValue = new QLabel(this);
|
||||||
|
|
||||||
|
QGridLayout *formLayout = new QGridLayout;
|
||||||
|
formLayout->addWidget(maxIco, 0, 0);
|
||||||
|
formLayout->addWidget(maxValue, 0, 1);
|
||||||
|
formLayout->addWidget(avgIco, 1, 0);
|
||||||
|
formLayout->addWidget(avgValue, 1, 1);
|
||||||
|
formLayout->addWidget(minIco, 2, 0);
|
||||||
|
formLayout->addWidget(minValue, 2, 1);
|
||||||
|
setLayout(formLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::clear()
|
||||||
|
{
|
||||||
|
avgValue->setText(QString());
|
||||||
|
maxValue->setText(QString());
|
||||||
|
minValue->setText(QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setAverage(double average)
|
||||||
|
{
|
||||||
|
avgValue->setText(QString::number(average));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setMaximum(double maximum)
|
||||||
|
{
|
||||||
|
maxValue->setText(QString::number(maximum));
|
||||||
|
}
|
||||||
|
void MinMaxAvgWidget::setMinimum(double minimum)
|
||||||
|
{
|
||||||
|
minValue->setText(QString::number(minimum));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setAverage(const QString &average)
|
||||||
|
{
|
||||||
|
avgValue->setText(average);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setMaximum(const QString &maximum)
|
||||||
|
{
|
||||||
|
maxValue->setText(maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setMinimum(const QString &minimum)
|
||||||
|
{
|
||||||
|
minValue->setText(minimum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::overrideMinToolTipText(const QString &newTip)
|
||||||
|
{
|
||||||
|
minIco->setToolTip(newTip);
|
||||||
|
minValue->setToolTip(newTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::overrideAvgToolTipText(const QString &newTip)
|
||||||
|
{
|
||||||
|
avgIco->setToolTip(newTip);
|
||||||
|
avgValue->setToolTip(newTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::overrideMaxToolTipText(const QString &newTip)
|
||||||
|
{
|
||||||
|
maxIco->setToolTip(newTip);
|
||||||
|
maxValue->setToolTip(newTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinMaxAvgWidget::setAvgVisibility(bool visible)
|
||||||
|
{
|
||||||
|
avgIco->setVisible(visible);
|
||||||
|
avgValue->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,30 @@ private:
|
||||||
Ui::TabDiveStatistics *ui;
|
Ui::TabDiveStatistics *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Widget describing, minimum, maximum and average value.
|
||||||
|
// Scheduled for removal in due course.
|
||||||
|
class QLabel;
|
||||||
|
class MinMaxAvgWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
QLabel *avgIco, *avgValue;
|
||||||
|
QLabel *minIco, *minValue;
|
||||||
|
QLabel *maxIco, *maxValue;
|
||||||
|
public:
|
||||||
|
MinMaxAvgWidget(QWidget *parent);
|
||||||
|
double minimum() const;
|
||||||
|
double maximum() const;
|
||||||
|
double average() const;
|
||||||
|
void setMinimum(double minimum);
|
||||||
|
void setMaximum(double maximum);
|
||||||
|
void setAverage(double average);
|
||||||
|
void setMinimum(const QString &minimum);
|
||||||
|
void setMaximum(const QString &maximum);
|
||||||
|
void setAverage(const QString &average);
|
||||||
|
void overrideMinToolTipText(const QString &newTip);
|
||||||
|
void overrideAvgToolTipText(const QString &newTip);
|
||||||
|
void overrideMaxToolTipText(const QString &newTip);
|
||||||
|
void setAvgVisibility(bool visible);
|
||||||
|
void clear();
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>MinMaxAvgWidget</class>
|
<class>MinMaxAvgWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>desktop-widgets/simplewidgets.h</header>
|
<header>desktop-widgets/tab-widgets/TabDiveStatistics.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue