File indexing completed on 2024-05-26 16:11:33

0001 /*
0002  *  Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation;
0007  * either version 2, or (at your option) any later version of the License.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public License
0015  * along with this library; see the file COPYING.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef _ROOT_SECTION_H_
0021 #define _ROOT_SECTION_H_
0022 
0023 #include <QObject>
0024 #include <QMap>
0025 
0026 #include "SectionGroup.h"
0027 
0028 class KActionCollection;
0029 class KUndo2Stack;
0030 class KUndo2Command;
0031 class ViewManager;
0032 class SectionsIO;
0033 
0034 class RootSection : public QObject, public SectionGroup
0035 {
0036     Q_OBJECT
0037 public:
0038     RootSection();
0039     ~RootSection();
0040     ViewManager* viewManager();
0041     SectionsIO* sectionsIO();
0042     void addCommand(Section* , KUndo2Command* command);
0043     void createActions(KActionCollection*);
0044     KUndo2Stack* undoStack(); // TODO remove when it is again possible to hide the undo stack
0045     void setCurrentSection(Section*);  // TODO when the command stack is hidden again, remove
0046 Q_SIGNALS:
0047     /// This signal is emitted when a command is executed in the undo stack
0048     void commandExecuted();
0049 private Q_SLOTS:
0050     void undoIndexChanged(int idx);
0051 private:
0052     KUndo2Stack* m_undoStack;
0053     ViewManager* m_viewManager;
0054     SectionsIO* m_sectionsSaver;
0055     QMap<const KUndo2Command*, Section* > m_commandsMap;
0056     Section* m_currentSection; // TODO when the command stack is hidden again, remove
0057 };
0058 
0059 #endif