[Clam-devel] Adding descriptions to networks

David García Garzón dgarcia at iua.upf.edu
Thu Jun 4 10:44:58 PDT 2009


A couple of corrections more, angelo, and we can commit it :-) Venga!!!

When loading the description the ternary is not needed. When the element is 
not found, 'Load' will let the 'text' as is, in this case initialized by 
default as "", so it will be simpler:
storage.Load(descriptionAdapter);
_description=text;

BTW, why don't defining description as Text directly?

Other minor issue, when you set the widget text you use the 'tr' function 
(MainWindow.cxx+233). The 'tr' method is used for translating strings. But 
hardcoded strings, it won't translate the description, so please remove this.
Also i guess that the ternary expression there is fully unneeded. Even an 
empty string will have a buffer with a single \0 char so is safe to take it 
to initialize a QString, so, simply:
_textDescriptionEdit->setText(_network.GetDescription().c_str());

An the last one, when including Qt headers, prefix the module directory, in 
the case of QTextEdit should be QtGui/QTextEdit.



On Thursday 04 June 2009 18:50:07 Angelo A.S. wrote:
> Hello everybody! ... and thanks David for your recommendations!
>
> I attached a patch with the modifications necessary to add Description to
> networks. This version has corrected the details recommended by David.
>
> Details arranged:
>
> - when the ui file has no real modification, is better not to include it in
> the patch. designer often just rewrites the formating from one version to
> another. [solved]
>
> > I deleted the file and download it again
>
> - do not include in the patch the networks with dummy descriptions, copy
> the networks and work with the copies or just edit the patch to delete
> them. [solved]
>
> - DescriptionDefinitionAdapter class is not needed at all, Text is already
> a component, so remove the man in the middle and use the
> XMLComponentAdapter with the Text. [solved]
>
> > I deleted all traces of DescriptionDefinitionAdapter  :o)
>
> - do not trigger an error if the description is not present, just take it
> as empty. [solved]
>
> - and, when storing it, if it is empty, do write it (you are currently
> skiping) [solved]
>
> - allow us to migrate silently old networks [solved]
>
> > Every time you open a network and no description is added, it adds the
>
> label <description/>
>
> *Modified classes*:
>
> BaseNetwork.hxx: added virtual method 'get' and 'set' for description.
> FlattenedNetwork.cxx: reimplementation of StoreOn and LoadFrom (methods)...
> this was necessary to support reading and writing
> descriptionsFlattenedNetwork.hxx: added method 'get' and 'set' for
> description ant attribute '_description'
> MainWindows.hxx: added a _descriptionPanel and _textDescriptionEdit... this
> was necessary to show the description
>
> *See you*!! :o)
>
> ~ Angelo Scorza ~
> "El que no posee el don de maravillarse ni de entusiasmarse más le valdría
> estar muerto, porque sus ojos están cerrados." A. Einstein.






More information about the clam-devel mailing list