You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/src/projectsession.h

91 lines
3.0 KiB

/***************************************************************************
projectsession.h - description
-------------------
begin : 30 Nov 2002
copyright : (C) 2002 by Falk Brettschneider
email : falk@kdevelop.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _PROJECTSESSION_H_
#define _PROJECTSESSION_H_
#include <tqobject.h>
#include <tqdom.h>
#include <tqdict.h>
#include <tqvaluelist.h>
class TQWidget;
class KURL;
class KDevPlugin;
/**
* This class stores and restores the last situation before the certain project
* was closed.
* Session stuff that is not related to a certain project doesn't belong to here;
* it must be saved in a program session which likely is "tdeveloprc".
**/
class ProjectSession : public TQObject
{
TQ_OBJECT
// methods
public:
ProjectSession();
virtual ~ProjectSession();
/** Opens the .kdevses file and saves the project session in XML format to it. */
bool saveToFile(const TQString& fileName, const TQValueList<KDevPlugin*> plugins );
/** Opens the .kdevses file and loads the project session from it. */
bool restoreFromFile(const TQString& fileName, const TQValueList<KDevPlugin*> plugins );
signals:
void sig_restoreMainWindowProperties(const TQDomElement* el);
void sig_saveMainWindowProperties(TQDomElement* el);
void sig_restoreAdditionalViewProperties(const TQString& viewName, const TQDomElement* el);
void sig_saveAdditionalViewProperties(const TQString& viewName, TQDomElement* el);
private slots:
/**
* This slot loads one document from _docDataList and sets a timer to load the next
*/
void loadDocument();
private:
/** Restores the part of the project session that concerns to the documents (files). */
void recreateDocs(TQDomElement& el);
/** recreates views and their properties of a certain document. */
void recreateViews(KURL& url, TQDomElement docEl, bool activate);
/** setup a valid XML file. */
void initXMLTree();
// attributes
private:
/** the XML document object controlling the XML tree. */
TQDomDocument domdoc;
struct DocumentData
{
DocumentData() : line(0) {}
KURL url;
int line;
TQString type;
bool activate;
TQString encoding;
};
TQValueList<DocumentData> _docDataList;
};
#endif // _PROJECTSESSION_H_