diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-05-24 12:39:40 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-24 09:07:34 -0700 |
commit | bc047238d4630c2090cbd424e26f6476b1cd435a (patch) | |
tree | 17a6da2c13d13d675cf6d194730a139631540d91 /qt-ui/diveplanner.cpp | |
parent | ba1c4fcec1760748846ff6ad14127409bed0a783 (diff) | |
download | subsurface-bc047238d4630c2090cbd424e26f6476b1cd435a.tar.gz |
Port the KeyPress actions to the new profile.
[Dirk Hohndel: combined two commits into one and cleaned up some
whitespace issues]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index b01cbf252..e6780c164 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -45,137 +45,9 @@ static DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance() DivePlannerGraphics::DivePlannerGraphics(QWidget *parent) : QGraphicsView(parent) { - QAction *action = NULL; -#define ADD_ACTION(SHORTCUT, Slot) \ - action = new QAction(this); \ - action->setShortcut(SHORTCUT); \ - action->setShortcutContext(Qt::WindowShortcut); \ - addAction(action); \ - connect(action, SIGNAL(triggered(bool)), this, SLOT(Slot)) - ADD_ACTION(Qt::Key_Escape, keyEscAction()); - ADD_ACTION(Qt::Key_Delete, keyDeleteAction()); - ADD_ACTION(Qt::Key_Up, keyUpAction()); - ADD_ACTION(Qt::Key_Down, keyDownAction()); - ADD_ACTION(Qt::Key_Left, keyLeftAction()); - ADD_ACTION(Qt::Key_Right, keyRightAction()); -#undef ADD_ACTION } -void DivePlannerGraphics::keyDownAction() -{ -#if 0 - Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { - if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { - int row = handles.indexOf(handler); - divedatapoint dp = plannerModel->at(row); - if (dp.depth >= depthLine->maximum()) - continue; - - dp.depth += M_OR_FT(1, 5); - plannerModel->editStop(row, dp); - } - } -#endif -} - -void DivePlannerGraphics::keyUpAction() -{ -#if 0 - Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { - if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { - int row = handles.indexOf(handler); - divedatapoint dp = plannerModel->at(row); - - if (dp.depth <= 0) - continue; - - dp.depth -= M_OR_FT(1, 5); - plannerModel->editStop(row, dp); - } - } - drawProfile(); -#endif -} - -void DivePlannerGraphics::keyLeftAction() -{ -#if 0 - Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { - if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { - int row = handles.indexOf(handler); - divedatapoint dp = plannerModel->at(row); - - if (dp.time / 60 <= 0) - continue; - - // don't overlap positions. - // maybe this is a good place for a 'goto'? - double xpos = timeLine->posAtValue((dp.time - 60) / 60); - bool nextStep = false; - Q_FOREACH (DiveHandler *h, handles) { - if (IS_FP_SAME(h->pos().x(), xpos)) { - nextStep = true; - break; - } - } - if (nextStep) - continue; - - dp.time -= 60; - plannerModel->editStop(row, dp); - } - } -#endif -} - -void DivePlannerGraphics::keyRightAction() -{ -#if 0 - Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { - if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { - int row = handles.indexOf(handler); - divedatapoint dp = plannerModel->at(row); - if (dp.time / 60 >= timeLine->maximum()) - continue; - - // don't overlap positions. - // maybe this is a good place for a 'goto'? - double xpos = timeLine->posAtValue((dp.time + 60) / 60); - bool nextStep = false; - Q_FOREACH (DiveHandler *h, handles) { - if (IS_FP_SAME(h->pos().x(), xpos)) { - nextStep = true; - break; - } - } - if (nextStep) - continue; - - dp.time += 60; - plannerModel->editStop(row, dp); - } - } -#endif -} - -void DivePlannerGraphics::keyDeleteAction() -{ -#if 0 - int selCount = scene()->selectedItems().count(); - if (selCount) { - QVector<int> selectedIndexes; - Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { - if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { - selectedIndexes.push_back(handles.indexOf(handler)); - } - } - plannerModel->removeSelectedPoints(selectedIndexes); - } -#endif -} - - bool intLessThan(int a, int b) { return a <= b; @@ -192,16 +64,6 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows) endRemoveRows(); } -void DivePlannerGraphics::keyEscAction() -{ - if (scene()->selectedItems().count()) { - scene()->clearSelection(); - return; - } - if (DivePlannerPointsModel::instance()->isPlanner()) - plannerModel->cancelPlan(); -} - void DivePlannerPointsModel::createSimpleDive() { // plannerModel->addStop(0, 0, O2_IN_AIR, 0, 0); |