void KoPathPointTypeCommand::undo()
{
    KUndo2Command::undo();
    repaint(false);

    /*
    QList<PointData>::iterator it(m_oldPointData.begin());
    for (; it != m_oldPointData.end(); ++it)
    {
        KoPathShape *pathShape = it->m_pointData.pathShape;
        KoPathPoint *point = pathShape->pointByIndex(it->m_pointData.pointIndex);

        point->setProperties(it->m_oldProperties);
        if (it->m_hadControlPoint1)
            point->setControlPoint1(pathShape->documentToShape(it->m_oldControlPoint1));
        else
            point->removeControlPoint1();
        if (it->m_hadControlPoint2)
            point->setControlPoint2(pathShape->documentToShape(it->m_oldControlPoint2));
        else
            point->removeControlPoint2();
    }
    */
    undoChanges(m_oldPointData);
    undoChanges(m_additionalPointData);

    repaint(true);
}
Exemple #2
0
void SettingsPageDlg::buttonClicked(QAbstractButton *button)
{
    switch (ui.buttonBox->standardButton(button)) {
    case QDialogButtonBox::Ok:
        if (currentPage() && currentPage()->hasChanged()) {
            if (applyChanges()) accept();
        }
        else accept();
        break;
    case QDialogButtonBox::Apply:
        applyChanges();
        break;
    case QDialogButtonBox::Cancel:
        undoChanges();
        reject();
        break;
    case QDialogButtonBox::Reset:
        reload();
        break;
    case QDialogButtonBox::RestoreDefaults:
        loadDefaults();
        break;
    default:
        break;
    }
}
Exemple #3
0
void CodeEdit::onTextChanged()
{
    QMdiSubWindow *sub = (QMdiSubWindow *)this->parent();

    updateTitle();

    //if hasShredded and text changed (now!) make a new revision
    if ( rev->hasShredded && undoText.compare(toPlainText())!=0 ){

        //get info from the parent revision
        QString bufferTextChanged = toPlainText();
        int cursorPos = textCursor().position();

        //new revision
        Revision *r = new Revision( rev );
        CodeArea *area = (CodeArea *)sub->mdiArea();

        undoChanges();
        listenChanges();

        undoText = toPlainText();

        area->addCodeWindow(r, bufferTextChanged, cursorPos, font().pointSize() ); //make a code window
    }
}
Exemple #4
0
void SettingsDlg::selectPage(SettingsPage *sp)
{
    if (!sp) {
        _currentPage = 0;
        ui.settingsStack->setCurrentIndex(0);
        ui.pageTitle->setText(tr("Settings"));
        return;
    }

    if (!pageIsLoaded[sp]) {
        sp->load();
        pageIsLoaded[sp] = true;
    }

    if (sp != currentPage() && currentPage() != 0 && currentPage()->hasChanged()) {
        int ret = QMessageBox::warning(this, tr("Save changes"),
            tr("There are unsaved changes on the current configuration page. Would you like to apply your changes now?"),
            QMessageBox::Discard|QMessageBox::Save|QMessageBox::Cancel, QMessageBox::Cancel);
        if (ret == QMessageBox::Save) {
            if (!applyChanges()) sp = currentPage();
        }
        else if (ret == QMessageBox::Discard) {
            undoChanges();
        }
        else sp = currentPage();
    }

    if (sp != currentPage()) {
        if (sp->title().isEmpty()) {
            ui.pageTitle->setText(sp->category());
            setWindowTitle(tr("Configure %1").arg(sp->category()));
        }
        else {
            ui.pageTitle->setText(sp->title());
            setWindowTitle(tr("Configure %1").arg(sp->title()));
        }

        ui.settingsStack->setCurrentWidget(sp);
        _currentPage = sp;
    }
    setButtonStates();
}
QMenu* KickViewHeaderedWidget::createEditMenu() const
{
  QMenu* menu = new QMenu(tr("&KickEdit"));

  QAction* undoAct, *redoAct, *singleDraw, *reachedDraw, *show3D, *showEditor,
           *show1D, *show2D, *showVelo, *showAccel, *noExtraView, *followMode;

  undoAct = new QAction(QIcon(":/Icons/arrow_undo.png"), tr("Undo"), menu);
  undoAct->setShortcut(QKeySequence::Undo);
  undoAct->setStatusTip(tr("Undo last change"));
  undoAct->setEnabled(!undo.empty());
  connect(this, SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool)));

  redoAct = new QAction(QIcon(":/Icons/arrow_redo.png"), tr("Redo"), menu);
  redoAct->setShortcut(QKeySequence::Redo);
  redoAct->setStatusTip(tr("Redo last undone change"));
  redoAct->setEnabled(!redo.empty());
  connect(this, SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool)));

  show3D = new QAction(tr("Display Phase Drawings"), menu);
  show3D->setStatusTip(tr("Draws curves for every limb either for the current phase or all phases"));
  show3D->setCheckable(true);

  singleDraw = new QAction(tr("Display Only Current Phase"), menu);
  singleDraw->setStatusTip(tr("Draws only curves for the current Phase"));
  singleDraw->setCheckable(true);

  reachedDraw = new QAction(tr("Display Reached Positions"), menu);
  reachedDraw->setStatusTip(tr("Draws the reached positions into the 3D view"));
  reachedDraw->setCheckable(true);

  showEditor = new QAction(tr("Display Editor View"), menu);
  showEditor->setStatusTip(tr("Shows the editor view"));
  showEditor->setCheckable(true);

  show1D = new QAction(tr("Display 1D Views"), menu);
  show1D->setStatusTip(tr("Shows 1D views of one curve for each axis"));
  show1D->setCheckable(true);

  show2D = new QAction(tr("Display 2D Views"), menu);
  show2D->setStatusTip(tr("Shows 2D views of one curve for plane"));
  show2D->setCheckable(true);

  showVelo = new QAction(tr("Display Velocity Views"), menu);
  showVelo->setStatusTip(tr("Shows the velocity of one curve"));
  showVelo->setCheckable(true);

  showAccel = new QAction(tr("Display Acceleration Views"), menu);
  showAccel->setStatusTip(tr("Shows the acceleration of one curve"));
  showAccel->setCheckable(true);

  noExtraView = new QAction(tr("Display No Extra View"), menu);
  noExtraView->setStatusTip(tr("Hides all extra views"));
  noExtraView->setCheckable(true);

  followMode = new QAction(tr("Enable Follow Mode"), menu);
  followMode->setStatusTip(tr("The robot will react to changes directly"));
  followMode->setCheckable(true);

  connect(undoAct, SIGNAL(triggered()), this, SLOT(undoChanges()));
  connect(redoAct, SIGNAL(triggered()), this, SLOT(redoChanges()));

  connect(singleDraw, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setSingleDrawing(bool)));
  connect(reachedDraw, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setReachedDrawing(bool)));
  connect(show3D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setDrawings(bool)));
  connect(showEditor, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setEditor(bool)));
  connect(show1D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setTra1d(bool)));
  connect(show2D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setTra2d(bool)));
  connect(showVelo, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setVelocity(bool)));
  connect(showAccel, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setAccel(bool)));
  connect(followMode, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setFollowMode(bool)));

  QActionGroup* showing = new QActionGroup(menu);
  showing->addAction(show1D);
  showing->addAction(show2D);
  showing->addAction(showVelo);
  showing->addAction(showAccel);
  showing->addAction(noExtraView);

  menu->addAction(undoAct);
  menu->addAction(redoAct);
  menu->addSeparator();
  menu->addAction(show3D);
  menu->addAction(singleDraw);
  menu->addAction(reachedDraw);
  menu->addAction(showEditor);
  menu->addSeparator();
  menu->addAction(noExtraView);
  menu->addAction(show1D);
  menu->addAction(show2D);
  menu->addAction(showVelo);
  menu->addAction(showAccel);
  menu->addSeparator();
  menu->addAction(followMode);

  showEditor->setChecked(true);
  show3D->setChecked(true);
  noExtraView->setChecked(true);

  return menu;
}