1 // Copyright (C) 2006-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "FormUndoRedo.hxx"
21 #include "GraphicsView.hxx"
22 #include "QtGuiContext.hxx"
23 #include "commands.hxx"
28 #include <QTreeWidget>
32 #include "YacsTrace.hxx"
35 using namespace YACS::HMI;
37 FormUndoRedo::FormUndoRedo(QWidget *parent)
41 Invocator *procInvoc = GuiContext::getCurrent()->getInvoc();
42 list<string> commandsDone = procInvoc->getDone();
43 list<string> commandsUndone = procInvoc->getUndone();
45 QList<QTreeWidgetItem *> itemsDone;
46 list<string>::iterator it;
47 for(it = commandsDone.begin(); it != commandsDone.end(); ++it)
49 (*it).erase((*it).rfind("\n"));
50 QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
51 itemsDone.append(commItem);
53 treeWdUndo->insertTopLevelItems(0, itemsDone);
55 QList<QTreeWidgetItem *> itemsUndone;
56 for(it = commandsUndone.begin(); it != commandsUndone.end(); ++it)
58 (*it).erase((*it).rfind("\n"));
59 QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
60 itemsUndone.append(commItem);
62 treeWdRedo->insertTopLevelItems(0, itemsUndone);
65 FormUndoRedo::~FormUndoRedo()
68 // QTreeWidget *treeWidget = new QTreeWidget();
69 // treeWidget->setColumnCount(1);
70 // QList<QTreeWidgetItem *> items;
71 // for (int i = 0; i < 10; ++i)
72 // items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
73 // treeWidget->insertTopLevelItems(0, items);