Version: 9.16.0
FormUndoRedo.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
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, or (at your option) any later version.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "FormUndoRedo.hxx"
21#include "GraphicsView.hxx"
22#include "QtGuiContext.hxx"
23#include "commands.hxx"
24
25#include <string>
26#include <list>
27
28#include <QTreeWidget>
29#include <QList>
30
31//#define _DEVDEBUG_
32#include "YacsTrace.hxx"
33
34using namespace std;
35using namespace YACS::HMI;
36
38{
39 setupUi(this);
40
41 Invocator *procInvoc = GuiContext::getCurrent()->getInvoc();
42 list<string> commandsDone = procInvoc->getDone();
43 list<string> commandsUndone = procInvoc->getUndone();
44
45 QList<QTreeWidgetItem *> itemsDone;
46 list<string>::iterator it;
47 for(it = commandsDone.begin(); it != commandsDone.end(); ++it)
48 {
49 (*it).erase((*it).rfind("\n"));
50 QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
51 itemsDone.append(commItem);
52 }
53 treeWdUndo->insertTopLevelItems(0, itemsDone);
54
55 QList<QTreeWidgetItem *> itemsUndone;
56 for(it = commandsUndone.begin(); it != commandsUndone.end(); ++it)
57 {
58 (*it).erase((*it).rfind("\n"));
59 QTreeWidgetItem *commItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString((*it).c_str())));
60 itemsUndone.append(commItem);
61 }
62 treeWdRedo->insertTopLevelItems(0, itemsUndone);
63}
64
66{
67}
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);
74
virtual ~FormUndoRedo()
FormUndoRedo(QWidget *parent=0)
std::list< std::string > getUndone()
Definition: commands.cxx:279
std::list< std::string > getDone()
Definition: commands.cxx:270