Code Cleanup: Buttons on Graphical Planner

Removed a bunch of non-used graphics buttons,
since the new widget now contains everything
needed for the creation / cancelation of the
dive plan.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-08-26 08:47:45 -03:00
parent 0a043528f7
commit 6cb1f1a250
2 changed files with 4 additions and 17 deletions

View file

@ -114,13 +114,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
ADDBTN(plusTime, ":plus", "" , 95, 5, tr("Increase minimum time by 10m"), increaseTime()); ADDBTN(plusTime, ":plus", "" , 95, 5, tr("Increase minimum time by 10m"), increaseTime());
ADDBTN(lessDepth, ":minimum","" , 2, 5, tr("Decreases maximum depth by 10m"), decreaseDepth()); ADDBTN(lessDepth, ":minimum","" , 2, 5, tr("Decreases maximum depth by 10m"), decreaseDepth());
ADDBTN(lessTime, ":minimum","" , 92, 95, tr("Decreases minimum time by 10m"), decreaseTime()); ADDBTN(lessTime, ":minimum","" , 92, 95, tr("Decreases minimum time by 10m"), decreaseTime());
ADDBTN(okBtn, "", tr("Ok"), 1, 95, "", okClicked());
ADDBTN(cancelBtn, "", tr("Cancel"), 0,0, "", cancelClicked());
#undef ADDBTN #undef ADDBTN
cancelBtn->setPos(okBtn->pos().x() + okBtn->boundingRect().width()
+ fromPercent(2, Qt::Horizontal), fromPercent(95, Qt::Vertical));
minMinutes = TIME_INITIAL_MAX; minMinutes = TIME_INITIAL_MAX;
QAction *action = NULL; QAction *action = NULL;
@ -265,7 +259,7 @@ void DivePlannerGraphics::keyEscAction()
return; return;
} }
cancelClicked(); cancelPlan();
} }
qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation) qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation)
@ -275,7 +269,7 @@ qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientatio
return result; return result;
} }
void DivePlannerGraphics::cancelClicked() void DivePlannerGraphics::cancelPlan()
{ {
if (handles.size()){ if (handles.size()){
if (QMessageBox::warning(mainWindow(), tr("Save the Plan?"), if (QMessageBox::warning(mainWindow(), tr("Save the Plan?"),
@ -287,11 +281,6 @@ void DivePlannerGraphics::cancelClicked()
mainWindow()->showProfile(); mainWindow()->showProfile();
} }
void DivePlannerGraphics::okClicked()
{
// todo.
}
void DivePlannerGraphics::increaseDepth() void DivePlannerGraphics::increaseDepth()
{ {
if (depthLine->maximum() + 10 > MAX_DEEPNESS) if (depthLine->maximum() + 10 > MAX_DEEPNESS)

View file

@ -92,8 +92,8 @@ private slots:
void increaseDepth(); void increaseDepth();
void decreaseTime(); void decreaseTime();
void decreaseDepth();; void decreaseDepth();;
void okClicked();
void cancelClicked(); void cancelPlan();
void prepareSelectGas(); void prepareSelectGas();
void selectGas(const QModelIndex& index); void selectGas(const QModelIndex& index);
@ -142,8 +142,6 @@ private:
Button *plusDepth; // adds 10 meters to the depth ruler. Button *plusDepth; // adds 10 meters to the depth ruler.
Button *lessTime; // remove 10 minutes to the time ruler. Button *lessTime; // remove 10 minutes to the time ruler.
Button *lessDepth; // remove 10 meters to the depth ruler. Button *lessDepth; // remove 10 meters to the depth ruler.
Button *okBtn; // accepts, and creates a new dive based on the plan.
Button *cancelBtn; // rejects, and clears the dive plan.
int minMinutes; // this holds the minimum duration of the dive. int minMinutes; // this holds the minimum duration of the dive.
int dpMaxTime; // this is the time of the dive calculated by the deco. int dpMaxTime; // this is the time of the dive calculated by the deco.