diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-06-03 10:06:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-03 07:23:43 -0700 |
commit | 6699e3ab3e3f617d5080720733df85cb6a9e2296 (patch) | |
tree | f5ecd9491f29d6dc5451240410dc7a33adbd5a0d | |
parent | 2785d7bc3eaaf9a2015dc2d281d7bf6136edc2c4 (diff) | |
download | subsurface-6699e3ab3e3f617d5080720733df85cb6a9e2296.tar.gz |
Add print button to planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/diveplanner.cpp | 6 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 1 | ||||
-rw-r--r-- | qt-ui/diveplanner.ui | 21 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 12 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 |
5 files changed, 34 insertions, 7 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 36c8538a1..516c29126 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -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; diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index f96094059..fabf2e683 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -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; diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui index 4e1071470..043214340 100644 --- a/qt-ui/diveplanner.ui +++ b/qt-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> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index a49cdc460..d94ec8561 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -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()) diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 57c205ba4..6f352cc74 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -78,6 +78,7 @@ public: void setLoadedWithFiles(bool filesFromCommandLine); bool filesFromCommandLine() const; void setPlanNotes(const char *notes); + void printPlan(); private slots: /* file menu action */ |