aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/mainwindow.cpp3
-rw-r--r--qt-ui/simplewidgets.cpp30
-rw-r--r--qt-ui/simplewidgets.h20
3 files changed, 50 insertions, 3 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 8b216bd8c..789d410da 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -29,6 +29,7 @@
#include "downloadfromdivecomputer.h"
#include "preferences.h"
#include "subsurfacewebservices.h"
+#include "simplewidgets.h"
static MainWindow* instance = 0;
@@ -222,7 +223,7 @@ void MainWindow::on_actionAddDive_triggered()
void MainWindow::on_actionRenumber_triggered()
{
- qDebug("actionRenumber");
+ RenumberDialog::instance()->show();
}
void MainWindow::on_actionAutoGroup_triggered()
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index c389a34c3..a6e01a724 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -4,6 +4,14 @@
#include <QLabel>
#include <QFormLayout>
#include <QIcon>
+#include <QAbstractButton>
+#include <QSpinBox>
+#include <QButtonGroup>
+#include <QDebug>
+
+#include "../dive.h"
+
+#include "ui_renumber.h"
class MinMaxAvgWidgetPrivate{
public:
@@ -24,7 +32,7 @@ public:
avgValue = new QLabel(owner);
minValue = new QLabel(owner);
maxValue = new QLabel(owner);
-
+
QGridLayout *formLayout = new QGridLayout();
formLayout->addWidget(maxIco, 0, 0);
formLayout->addWidget(maxValue, 0, 1);
@@ -90,3 +98,23 @@ void MinMaxAvgWidget::setMinimum(const QString& minimum)
{
d->minValue->setText(minimum);
}
+
+RenumberDialog* RenumberDialog::instance()
+{
+ static RenumberDialog* self = new RenumberDialog();
+ return self;
+}
+
+void RenumberDialog::buttonClicked(QAbstractButton* button)
+{
+ if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole){
+ qDebug() << "Renumbering.";
+ renumber_dives(ui->spinBox->value());
+ }
+}
+
+RenumberDialog::RenumberDialog(): QDialog(), ui( new Ui::RenumberDialog())
+{
+ ui->setupUi(this);
+ connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
+}
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index b05dd8f0e..ffd415767 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -2,7 +2,10 @@
#define SIMPLEWIDGETS_H
class MinMaxAvgWidgetPrivate;
+class QAbstractButton;
+
#include <QWidget>
+#include <QDialog>
class MinMaxAvgWidget : public QWidget{
Q_OBJECT
@@ -25,4 +28,19 @@ private:
MinMaxAvgWidgetPrivate *d;
};
-#endif \ No newline at end of file
+namespace Ui{
+ class RenumberDialog;
+};
+
+class RenumberDialog : public QDialog {
+ Q_OBJECT
+public:
+ static RenumberDialog *instance();
+private slots:
+ void buttonClicked(QAbstractButton *button);
+private:
+ explicit RenumberDialog();
+ Ui::RenumberDialog *ui;
+};
+
+#endif