[Clam-devel] Request for votes: Thinking on 'Connect to' feature
David García Garzón
dgarcia at iua.upf.edu
Thu Jun 19 11:18:18 PDT 2008
I made an structural change that i hope it will help you to refactor the code.
I just splitted the context menu virtual function into:
connectionContextMenu(menu, event, processingBox, region)
processingContextMenu(menu, event, processingBox)
canvasContextMenu(menu, event)
to avoid conflicts with your local changes i made connectionContextMenu to
call to the previous contextMenu function which has the processing and canvas
parts removed but it still contains the loop and the condition for the region
(same indentation, hopefully no conflict). Once you merge the changes i'll
move the content of contextMenu to processingContextMenu removing the loop
and the region condition. Anyway be aware of any conflict.
Why i did this change:
- To split a very looong function with too many levels.
- To centralize an enchancement on selection handling on context menu. Now
right clicking selects teh processing if unselected. This solves the conflict
between having processings selected and right clicking an unselected
processing)
- To allow to move common actions to the base canvas class and allow the
subclasses to call them and add their own actions.
Also, althought the Add-linked-processing feature is too CLAMish, the
Connect-to feature is more generic and should be available to, say, JACK.
Thus we should identify which are the generic parts of this menu population.
For example i was thinking in a processingIcon(proc) virtual method.
Anyway i still don't like the 'Connect to' menu. I still think that
the 'Connect to...' dialog would be cleaner.
On Thursday 19 June 2008 11:51:01 Natanael Olaiz wrote:
> Are you hungry? Here you have some spaghetti.... :-/
>
> It's a really ugly code, but now it really does what you purposed. :)
> Just for test if you like the interface...
> It NEED to merge and refactor code on the context menu... and it would
> be good to merge also some code between onProcessingsConnectTo() and
> onAddLinkedProcessing(). For instance, to use explicits "Add xxxxx" on
> context menu titles, I'm using regexp to cut the string within
> onAddLinkedProcessing() and get the processing key.
>
> Do you like the QMap <QString, QVariant> method used on
> onProcessingsConnectTo() to use in AddLinked... too?
I do use them with Actions because it is 'the way' but i avoid QVariants as
much as i can. They are not that safe to use. Maybe that asks for unifying
control/ports functions with a ConnectionKind enum. I would keep it like it
is rather than adding more QVariants. Just personal taste.
David.
More information about the clam-devel
mailing list