summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmraw.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmraw.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmraw.cpp')
-rw-r--r--kpovmodeler/pmraw.cpp135
1 files changed, 135 insertions, 0 deletions
diff --git a/kpovmodeler/pmraw.cpp b/kpovmodeler/pmraw.cpp
new file mode 100644
index 00000000..a2d44784
--- /dev/null
+++ b/kpovmodeler/pmraw.cpp
@@ -0,0 +1,135 @@
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2002 by Andreas Zehender
+**************************************************************************
+
+**************************************************************************
+* *
+* 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. *
+* *
+**************************************************************************/
+
+
+#include "pmraw.h"
+#include "pmxmlhelper.h"
+
+#include "pmrawedit.h"
+#include "pmmemento.h"
+
+#include <klocale.h>
+#include <qtextstream.h>
+
+PMDefinePropertyClass( PMRaw, PMRawProperty );
+
+PMMetaObject* PMRaw::s_pMetaObject = 0;
+PMObject* createNewRaw( PMPart* part )
+{
+ return new PMRaw( part );
+}
+
+PMRaw::PMRaw( PMPart* part )
+ : Base( part )
+{
+}
+
+PMRaw::PMRaw( const PMRaw& r )
+ : Base( r )
+{
+ m_code = r.m_code;
+}
+
+PMRaw::PMRaw( PMPart* part, const QString& t )
+ : Base( part )
+{
+ m_code = t;
+}
+
+PMRaw::~PMRaw( )
+{
+}
+
+QString PMRaw::description( ) const
+{
+ return i18n( "raw povray" );
+}
+
+void PMRaw::setCode( const QString& code )
+{
+ if( code != m_code )
+ {
+ if( m_pMemento )
+ m_pMemento->addData( s_pMetaObject, PMCodeID, m_code );
+ m_code = code;
+ }
+}
+
+PMMetaObject* PMRaw::metaObject( ) const
+{
+ if( !s_pMetaObject )
+ {
+ s_pMetaObject = new PMMetaObject( "Raw", Base::metaObject( ),
+ createNewRaw );
+ s_pMetaObject->addProperty(
+ new PMRawProperty( "code", &PMRaw::setCode, &PMRaw::code ) );
+ }
+ return s_pMetaObject;
+}
+
+void PMRaw::cleanUp( ) const
+{
+ if( s_pMetaObject )
+ {
+ delete s_pMetaObject;
+ s_pMetaObject = 0;
+ }
+ Base::cleanUp( );
+}
+
+void PMRaw::serialize( QDomElement& e, QDomDocument& doc ) const
+{
+ QDomText t = doc.createTextNode( m_code );
+ e.appendChild( t );
+}
+
+void PMRaw::readAttributes( const PMXMLHelper& h )
+{
+ QDomNode e = h.element( ).firstChild( );
+ if( e.isText( ) )
+ m_code = e.toText( ).data( );
+}
+
+PMDialogEditBase* PMRaw::editWidget( QWidget* parent ) const
+{
+ return new PMRawEdit( parent );
+}
+
+void PMRaw::restoreMemento( PMMemento* s )
+{
+ PMMementoDataIterator it( s );
+ PMMementoData* data;
+
+ for( ; it.current( ); ++it )
+ {
+ data = it.current( );
+ if( data->objectType( ) == s_pMetaObject )
+ {
+ switch( data->valueID( ) )
+ {
+ case PMCodeID:
+ setCode( data->stringData( ) );
+ break;
+ default:
+ kdError( PMArea ) << "Wrong ID in PMRaw::restoreMemento\n";
+ break;
+ }
+ }
+ }
+ Base::restoreMemento( s );
+}
+