void
WorkoutWindow::ergFileSelected(ErgFile*f)
{
    if (active) return;

    if (workout->isDirty()) {
        QMessageBox msgBox;
        msgBox.setText(tr("You have unsaved changes to a workout."));
        msgBox.setInformativeText(tr("Do you want to save them?"));
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::Cancel);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.exec();

        // save first, otherwise changes lost
        if(msgBox.clickedButton() == msgBox.button(QMessageBox::Yes)) {
            active = true;
            saveFile();
            active = false;
        }
    }

    // just get on with it.
    ergFile = f;
    workout->ergFileSelected(f);

    // almost certainly hides it on load
    setScroller(QPointF(workout->minVX(), workout->maxVX()));
}
void
WorkoutWindow::zoomOut()
{
    setScroller(workout->zoomOut());
}
Beispiel #3
0
ScrollAnchor::ScrollAnchor(ScrollableArea* scroller) : ScrollAnchor() {
  setScroller(scroller);
}