mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'renumberDialog' of github.com:tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
commit
14ccbbf6e8
4 changed files with 135 additions and 3 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "subsurfacewebservices.h"
|
#include "subsurfacewebservices.h"
|
||||||
#include "divecomputermanagementdialog.h"
|
#include "divecomputermanagementdialog.h"
|
||||||
|
#include "simplewidgets.h"
|
||||||
|
|
||||||
static MainWindow* instance = 0;
|
static MainWindow* instance = 0;
|
||||||
|
|
||||||
|
@ -224,7 +225,7 @@ void MainWindow::on_actionAddDive_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionRenumber_triggered()
|
void MainWindow::on_actionRenumber_triggered()
|
||||||
{
|
{
|
||||||
qDebug("actionRenumber");
|
RenumberDialog::instance()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAutoGroup_triggered()
|
void MainWindow::on_actionAutoGroup_triggered()
|
||||||
|
|
85
qt-ui/renumber.ui
Normal file
85
qt-ui/renumber.ui
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>RenumberDialog</class>
|
||||||
|
<widget class="QDialog" name="RenumberDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>181</width>
|
||||||
|
<height>95</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Renumber</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>New starting number</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox"/>
|
||||||
|
</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>RenumberDialog</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>RenumberDialog</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>
|
|
@ -4,6 +4,14 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QAbstractButton>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "../dive.h"
|
||||||
|
|
||||||
|
#include "ui_renumber.h"
|
||||||
|
|
||||||
class MinMaxAvgWidgetPrivate{
|
class MinMaxAvgWidgetPrivate{
|
||||||
public:
|
public:
|
||||||
|
@ -90,3 +98,23 @@ void MinMaxAvgWidget::setMinimum(const QString& minimum)
|
||||||
{
|
{
|
||||||
d->minValue->setText(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*)));
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
#define SIMPLEWIDGETS_H
|
#define SIMPLEWIDGETS_H
|
||||||
|
|
||||||
class MinMaxAvgWidgetPrivate;
|
class MinMaxAvgWidgetPrivate;
|
||||||
|
class QAbstractButton;
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
class MinMaxAvgWidget : public QWidget{
|
class MinMaxAvgWidget : public QWidget{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -25,4 +28,19 @@ private:
|
||||||
MinMaxAvgWidgetPrivate *d;
|
MinMaxAvgWidgetPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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
|
#endif
|
Loading…
Add table
Reference in a new issue