mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: use member-to-function style connect() statements
This makes things compile-time instead of run-time checked. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2829909376
commit
c1963fd5dd
2 changed files with 17 additions and 23 deletions
|
@ -1331,13 +1331,11 @@ void ProfileWidget2::setAddState()
|
||||||
actionsForKeys[Qt::Key_Delete]->setShortcut(Qt::Key_Delete);
|
actionsForKeys[Qt::Key_Delete]->setShortcut(Qt::Key_Delete);
|
||||||
|
|
||||||
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
||||||
connect(plannerModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(replot()));
|
connect(plannerModel, &DivePlannerPointsModel::dataChanged, this, &ProfileWidget2::replot);
|
||||||
connect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
|
connect(plannerModel, &DivePlannerPointsModel::cylinderModelEdited, this, &ProfileWidget2::replot);
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
connect(plannerModel, &DivePlannerPointsModel::rowsInserted, this, &ProfileWidget2::pointInserted);
|
||||||
this, SLOT(pointInserted(const QModelIndex &, int, int)));
|
connect(plannerModel, &DivePlannerPointsModel::rowsRemoved, this, &ProfileWidget2::pointsRemoved);
|
||||||
connect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
|
||||||
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
|
|
||||||
#endif
|
#endif
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
currentState = ADD; /* enable the add state. */
|
currentState = ADD; /* enable the add state. */
|
||||||
|
@ -1366,12 +1364,10 @@ void ProfileWidget2::setPlanState()
|
||||||
actionsForKeys[Qt::Key_Delete]->setShortcut(Qt::Key_Delete);
|
actionsForKeys[Qt::Key_Delete]->setShortcut(Qt::Key_Delete);
|
||||||
|
|
||||||
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
||||||
connect(plannerModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(replot()));
|
connect(plannerModel, &DivePlannerPointsModel::dataChanged, this, &ProfileWidget2::replot);
|
||||||
connect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
|
connect(plannerModel, &DivePlannerPointsModel::cylinderModelEdited, this, &ProfileWidget2::replot);
|
||||||
connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
connect(plannerModel, &DivePlannerPointsModel::rowsInserted, this, &ProfileWidget2::pointInserted);
|
||||||
this, SLOT(pointInserted(const QModelIndex &, int, int)));
|
connect(plannerModel, &DivePlannerPointsModel::rowsRemoved, this, &ProfileWidget2::pointsRemoved);
|
||||||
connect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
|
||||||
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
|
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
currentState = PLAN; /* enable the add state. */
|
currentState = PLAN; /* enable the add state. */
|
||||||
diveCeiling->setVisible(true);
|
diveCeiling->setVisible(true);
|
||||||
|
@ -1471,7 +1467,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
||||||
[this, seconds](){ addDivemodeSwitch(seconds, PSCR); });
|
[this, seconds](){ addDivemodeSwitch(seconds, PSCR); });
|
||||||
|
|
||||||
if (same_string(current_dc->model, "manually added dive"))
|
if (same_string(current_dc->model, "manually added dive"))
|
||||||
m.addAction(tr("Edit the profile"), this, SIGNAL(editCurrentDive()));
|
m.addAction(tr("Edit the profile"), this, &ProfileWidget2::editCurrentDive);
|
||||||
|
|
||||||
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
|
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
|
||||||
m.addAction(tr("Remove event"), [this,item] { removeEvent(item); });
|
m.addAction(tr("Remove event"), [this,item] { removeEvent(item); });
|
||||||
|
@ -1713,13 +1709,11 @@ void ProfileWidget2::disconnectTemporaryConnections()
|
||||||
{
|
{
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
||||||
disconnect(plannerModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(replot()));
|
disconnect(plannerModel, &DivePlannerPointsModel::dataChanged, this, &ProfileWidget2::replot);
|
||||||
disconnect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
|
disconnect(plannerModel, &DivePlannerPointsModel::cylinderModelEdited, this, &ProfileWidget2::replot);
|
||||||
|
|
||||||
disconnect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
disconnect(plannerModel, &DivePlannerPointsModel::rowsInserted, this, &ProfileWidget2::pointInserted);
|
||||||
this, SLOT(pointInserted(const QModelIndex &, int, int)));
|
disconnect(plannerModel, &DivePlannerPointsModel::rowsRemoved, this, &ProfileWidget2::pointsRemoved);
|
||||||
disconnect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
|
||||||
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
|
|
||||||
#endif
|
#endif
|
||||||
Q_FOREACH (QAction *action, actionsForKeys.values()) {
|
Q_FOREACH (QAction *action, actionsForKeys.values()) {
|
||||||
action->setShortcut(QKeySequence());
|
action->setShortcut(QKeySequence());
|
||||||
|
@ -1734,9 +1728,9 @@ void ProfileWidget2::pointInserted(const QModelIndex&, int, int)
|
||||||
scene()->addItem(item);
|
scene()->addItem(item);
|
||||||
handles << item;
|
handles << item;
|
||||||
|
|
||||||
connect(item, SIGNAL(moved()), this, SLOT(recreatePlannedDive()));
|
connect(item, &DiveHandler::moved, this, &ProfileWidget2::recreatePlannedDive);
|
||||||
connect(item, SIGNAL(clicked()), this, SLOT(divePlannerHandlerClicked()));
|
connect(item, &DiveHandler::clicked, this, &ProfileWidget2::divePlannerHandlerClicked);
|
||||||
connect(item, SIGNAL(released()), this, SLOT(divePlannerHandlerReleased()));
|
connect(item, &DiveHandler::released, this, &ProfileWidget2::divePlannerHandlerReleased);
|
||||||
QGraphicsSimpleTextItem *gasChooseBtn = new QGraphicsSimpleTextItem();
|
QGraphicsSimpleTextItem *gasChooseBtn = new QGraphicsSimpleTextItem();
|
||||||
scene()->addItem(gasChooseBtn);
|
scene()->addItem(gasChooseBtn);
|
||||||
gasChooseBtn->setZValue(10);
|
gasChooseBtn->setZValue(10);
|
||||||
|
|
|
@ -108,7 +108,6 @@ slots: // Necessary to call from QAction's signals.
|
||||||
void actionRequestedReplot(bool triggered);
|
void actionRequestedReplot(bool triggered);
|
||||||
void setEmptyState();
|
void setEmptyState();
|
||||||
void setProfileState();
|
void setProfileState();
|
||||||
void replot();
|
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
void plotPictures();
|
void plotPictures();
|
||||||
void removePictures(const QVector<QString> &fileUrls);
|
void removePictures(const QVector<QString> &fileUrls);
|
||||||
|
@ -148,6 +147,7 @@ private:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
|
|
||||||
|
void replot();
|
||||||
void changeGas(int tank, int seconds);
|
void changeGas(int tank, int seconds);
|
||||||
void fixBackgroundPos();
|
void fixBackgroundPos();
|
||||||
void scrollViewTo(const QPoint &pos);
|
void scrollViewTo(const QPoint &pos);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue