mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:23:25 +00:00
Add print button to planner
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2785d7bc3e
commit
6699e3ab3e
5 changed files with 34 additions and 7 deletions
|
@ -277,6 +277,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
|||
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
|
||||
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
|
||||
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
|
||||
connect(ui.printPlan, SIGNAL(pressed()), this, SLOT(printDecoPlan()));
|
||||
|
||||
// Creating (and canceling) the plan
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
|
||||
|
@ -320,6 +321,11 @@ void DivePlannerWidget::decoSacChanged(const QString &decosac)
|
|||
plannerModel->setDecoSac(decosac.toInt());
|
||||
}
|
||||
|
||||
void DivePlannerWidget::printDecoPlan()
|
||||
{
|
||||
MainWindow::instance()->printPlan();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setPlanMode(Mode m)
|
||||
{
|
||||
mode = m;
|
||||
|
|
|
@ -136,6 +136,7 @@ slots:
|
|||
void atmPressureChanged(const QString &pressure);
|
||||
void bottomSacChanged(const QString &bottomSac);
|
||||
void decoSacChanged(const QString &decosac);
|
||||
void printDecoPlan();
|
||||
|
||||
private:
|
||||
Ui::DivePlanner ui;
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QTimeEdit" name="startTime"/>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<item row="13" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Abort|QDialogButtonBox::Save</set>
|
||||
|
@ -189,6 +189,16 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="ATMPressure"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="display_transitions">
|
||||
<property name="toolTip">
|
||||
<string>In diveplan, list transitions or treat them as implicit</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>display transitions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="display_duration">
|
||||
<property name="toolTip">
|
||||
|
@ -212,13 +222,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="display_transitions">
|
||||
<property name="toolTip">
|
||||
<string>In diveplan, list transitions or treat them as implicit</string>
|
||||
</property>
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="printPlan">
|
||||
<property name="text">
|
||||
<string>display transitions</string>
|
||||
<string>Print</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
#include <QPrintDialog>
|
||||
#include <fcntl.h>
|
||||
#include "divelistview.h"
|
||||
#include "starwidget.h"
|
||||
|
@ -419,6 +420,17 @@ void MainWindow::setPlanNotes(const char *notes)
|
|||
ui.divePlanOutput->setHtml(notes);
|
||||
}
|
||||
|
||||
void MainWindow::printPlan()
|
||||
{
|
||||
QPrinter printer;
|
||||
QPrintDialog *dialog = new QPrintDialog(&printer, this);
|
||||
dialog->setWindowTitle(tr("Print runtime table"));
|
||||
if (dialog->exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
ui.divePlanOutput->print(&printer);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDivePlanner_triggered()
|
||||
{
|
||||
if(!plannerStateClean())
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
void setLoadedWithFiles(bool filesFromCommandLine);
|
||||
bool filesFromCommandLine() const;
|
||||
void setPlanNotes(const char *notes);
|
||||
void printPlan();
|
||||
private
|
||||
slots:
|
||||
/* file menu action */
|
||||
|
|
Loading…
Add table
Reference in a new issue