umbrello API Documentation

rubycodegenerationpolicypage.cpp

00001 /***************************************************************************
00002                           rubycodegenerationpolicypage.cpp
00003                           Derived from the Java code generator by thomas
00004 
00005     begin                : Thur Jul 21 2005
00006     author               : Richard Dale
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   copyright (C) 2006-2007                                               *
00017  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00018  ***************************************************************************/
00019 
00020 // own header
00021 #include "rubycodegenerationpolicypage.h"
00022 // qt/kde includes
00023 #include <qlabel.h>
00024 #include <qcombobox.h>
00025 #include <qcheckbox.h>
00026 #include <kdebug.h>
00027 #include <klocale.h>
00028 // app includes
00029 #include "rubycodegenerationformbase.h"
00030 #include "../codegenerationpolicy.h"
00031 #include "../uml.h"
00032 
00033 RubyCodeGenerationPolicyPage::RubyCodeGenerationPolicyPage( QWidget *parent, const char *name, RubyCodeGenerationPolicy * policy )
00034   : CodeGenerationPolicyPage(parent, name, policy)
00035 {
00036     CodeGenerationPolicy *common = UMLApp::app()->getCommonPolicy();
00037     form = new RubyCodeGenerationFormBase(this);
00038     form->m_SelectCommentStyle->setCurrentItem((int)(common->getCommentStyle()));
00039     form->m_generateConstructors->setChecked(common->getAutoGenerateConstructors());
00040     form->m_generateAttribAccessors->setChecked(policy->getAutoGenerateAttribAccessors());
00041     form->m_generateAssocAccessors->setChecked(policy->getAutoGenerateAssocAccessors());
00042     form->m_accessorScopeCB->setCurrentItem((common->getAttributeAccessorScope() - 200));
00043     form->m_assocFieldScopeCB->setCurrentItem((common->getAssociationFieldScope() - 200));
00044 }
00045 
00046 RubyCodeGenerationPolicyPage::~RubyCodeGenerationPolicyPage()
00047 {
00048 }
00049 
00050 void RubyCodeGenerationPolicyPage::apply()
00051 {
00052     CodeGenerationPolicy *common = UMLApp::app()->getCommonPolicy();
00053 
00054     // now do our ruby-specific configs
00055     RubyCodeGenerationPolicy * parent = (RubyCodeGenerationPolicy*) m_parentPolicy;
00056 
00057     // block signals so we don't cause too many update content calls to code documents
00058     parent->blockSignals(true);
00059 
00060     common->setCommentStyle((CodeGenerationPolicy::CommentStyle) form->m_SelectCommentStyle->currentItem());
00061     common->setAttributeAccessorScope((CodeGenerationPolicy::ScopePolicy) (form->m_accessorScopeCB->currentItem()+200));
00062     common->setAssociationFieldScope((CodeGenerationPolicy::ScopePolicy) (form->m_assocFieldScopeCB->currentItem()+200));
00063     common->setAutoGenerateConstructors(form->m_generateConstructors->isChecked());
00064     parent->setAutoGenerateAttribAccessors(form->m_generateAttribAccessors->isChecked());
00065     parent->setAutoGenerateAssocAccessors(form->m_generateAssocAccessors->isChecked());
00066 
00067     parent->blockSignals(false);
00068 
00069     // now send out modified code content signal
00070     common->emitModifiedCodeContentSig();
00071 
00072 }
00073 
00074 
00075 #include "rubycodegenerationpolicypage.moc"
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:00 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003