From 272338875d315e24b019917e35fbfadf36c05f09 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 17 Jun 2013 13:41:00 -0300 Subject: Addes a simple 'Renumber Dialog', very similar to the GTK one. This code adds a Renumber Dialog, that's most a copy & paste of the GTK visual, I didn't tried to do anything fance with it, but I still dont like how it looks like. a better management form is needed. :) ( Well, actually my dislike is mostly because it's on a menu and it's on a popup, I think a 'toolbox' should exist to hold all of those widgets that don't belong to the menu - will try that later ) Signed-off-by: Tomaz Canabrava --- qt-ui/simplewidgets.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'qt-ui/simplewidgets.cpp') 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 #include #include +#include +#include +#include +#include + +#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*))); +} -- cgit v1.2.3-70-g09d2