2007-12-01 10:47:15 +00:00
/*
2015-02-20 14:56:22 +00:00
Copyright 2006 - 2015 The QElectroTech Team
2007-12-01 10:47:15 +00:00
This file is part of QElectroTech .
QElectroTech 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 .
QElectroTech is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with QElectroTech . If not , see < http : //www.gnu.org/licenses/>.
*/
2010-12-20 02:45:36 +00:00
# ifndef TITLEBLOCK_PROPERTIES_H
# define TITLEBLOCK_PROPERTIES_H
2009-04-03 19:30:25 +00:00
# include <QtXml>
2011-01-09 15:16:51 +00:00
# include "diagramcontext.h"
2015-04-17 11:36:28 +00:00
# include "qet.h"
2007-10-10 17:50:26 +00:00
/**
2012-11-09 21:09:24 +00:00
This class provides a container for the properties of a particular title
block , i . e . title , author , date , filename , folio , template , custom
properties , . . .
2007-10-10 17:50:26 +00:00
*/
2010-12-20 02:45:36 +00:00
class TitleBlockProperties {
2007-09-28 17:39:30 +00:00
public :
2010-12-20 02:45:36 +00:00
TitleBlockProperties ( ) ;
virtual ~ TitleBlockProperties ( ) ;
2012-11-09 21:09:24 +00:00
/// Lists the various ways to handle the date
2007-12-01 10:29:03 +00:00
enum DateManagement {
2012-11-09 21:09:24 +00:00
UseDateValue , ///< use the date attribute
CurrentDate ///< use the current date
2007-12-01 10:29:03 +00:00
} ;
2010-12-20 02:45:36 +00:00
bool operator = = ( const TitleBlockProperties & ) ;
bool operator ! = ( const TitleBlockProperties & ) ;
2009-04-03 19:30:25 +00:00
void toXml ( QDomElement & ) const ;
2011-01-09 15:16:51 +00:00
void fromXml ( const QDomElement & ) ;
2009-04-03 19:30:25 +00:00
void toSettings ( QSettings & , const QString & = QString ( ) ) const ;
void fromSettings ( QSettings & , const QString & = QString ( ) ) ;
2014-10-26 11:57:38 +00:00
static TitleBlockProperties defaultProperties ( ) ;
2009-04-03 19:30:25 +00:00
2007-12-01 10:29:03 +00:00
QDate finalDate ( ) const ;
2012-11-09 21:09:24 +00:00
// attributes
QString title ; ///< Folio title (displayed by the default template)
QString author ; ///< Author of the diagram/folio (displayed by the default template)
QDate date ; ///< Date (displayed by the default template)
QString filename ; ///< Filename (displayed by the default template)
QString folio ; ///< Folio information (displayed by the default template)
2016-05-13 15:00:22 +00:00
QString auto_page_num ;
2012-11-09 21:09:24 +00:00
DateManagement useDate ; ///< Wheter to use the date attribute
2010-12-24 23:35:40 +00:00
QString template_name ; ///< Name of the template used to render the title block - an empty string means "the default template provided by the application"
2011-01-09 15:16:51 +00:00
DiagramContext context ; ///< Container for the additional, user-defined fields
2015-03-16 13:29:27 +00:00
Qt : : Edge display_at ; ///< Edge to display the titleblock
2015-04-17 11:36:28 +00:00
QET : : QetCollection collection ; ///<Specify the location of the title block
2009-04-03 19:30:25 +00:00
private :
QString exportDate ( ) const ;
void setDateFromString ( const QString & ) ;
2007-09-28 17:39:30 +00:00
} ;
# endif