qt4-mechanised

View: New views
4 Messages — Rating Filter:   Alert me  

qt4-mechanised

by Yves Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just commit an add to convert.pl which replaces some occurences of QVBox and
QHBox.
All QVBox and QHBox are still not replaced, in particular those related to
KDialoBase which has to be replaced itself...

The results are rather poor : not any new file is compiling.

Yves


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Re: qt4-mechanised

by cannam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jul 4, 2008 at 9:41 PM, Yves Guillemot <yc.guillemot@...> wrote:
> I just commit an add to convert.pl which replaces some occurences of QVBox and
> QHBox.
> All QVBox and QHBox are still not replaced, in particular those related to
> KDialoBase which has to be replaced itself...

Impressive bit of work.  It's a bit alarming how much work is needed
to handle that one case, isn't it?

I tried it on gui/widgets/DiatonicPitchChooser.cpp (at random) and
found that it didn't add the necessary hboxLayout->addWidget(x) line
after each widget's construction.  I can see that you have code in
there to do that, and it's not obvious to me at first glance why it
didn't work.


Chris

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Re: qt4-mechanised

by D. Michael McIntyre :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 06 July 2008, Chris Cannam wrote:

> Impressive bit of work.  It's a bit alarming how much work is needed
> to handle that one case, isn't it?

Gack.

--
D. Michael McIntyre

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Re: qt4-mechanised

by Yves Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 06 July 2008 11:52, Chris Cannam wrote:
> It's a bit alarming how much work is needed
> to handle that one case, isn't it?

I've exactly the same feeling you have. But I don't see much other solutions.


A first possibility would be to use, inside convert.pl script, functions to
process some generic replacement problems.

Actual QVBox replacement should be handled with some code like the following
one (it's only an example to illustrate how this should work, it still needs
some reflexions) :

qhboxChange (
     [ ' S QHBox * %%w1 = new QHBox ( %w2 ) ; ',
       ' D QWidget * %%w1 = new QWidget ( %%w2 ) ; ',
       ' D QHBoxLayout * %%w1.Layout = new QHBoxLayout ; '
     ],
     [ ' S %%w3 * %%w4 = new %%w3 ( %%l %%, %%w1 %%, %%l ) ; ',
       ' D %%w3 * %%w4 = new %%w3 ( %%l %%, %%w1 %%, %%l ) ; ',
       ' D %%w1.Layout -> addWidget ( %%w4 ) ; ',
       ' L %%w1 -> setLayout ( %%w1.Layout ) ; '
     ],
     [ ' S %%w1 -> setSpacing ( %%l ) ; ',
       ' D %%w1.Layout -> setMargin ( %%l ) ; '
     ],
     [ ' S %%w1 -> setStretchFactor ( %%l ) ; ",
       ' D %%w1.Layout -> setStretchFactor ( %%l ) ; '
     ],
     [ ' S %%w1 -> setMargin ( %%l ) ; ',
       ' D %%w1.Layout -> setMargin ( %%l ) ; '
     ] );

where
    "S" stands for "Source" line
    "D" for "Destination" line (may be R for "Replacement" should be better)
    "L" for "Last" line (replace only the last time)
    "%%w1, %%w2, etc... are words
    "%%l" is a comma separated list without any ";" (to be improved)
    "%%," is a comma or nothing
    "%%w1.Layout" is  "%%w1" word concatenated with "Layout" string
    others character groups stand for themselves
    white space are used as separators

Maybe all of this is not very much more readable than Perl source and regular
expressions. Nevertheless a lot of work is hide in qhboxChange() function
here.

The question is how much sould generic functions like this one be needed ?



Another possibility would be to write an isolation layer between Qt/KDE an RG
code.
QVBox class, for example, should be replaced by some RGVBox class built above
Qt3.
Porting to Qt4 would only need to port RGVBox and similar classes from
Qt3/KDE3 to Qt4/KDE4 ie to write the new code only once and not to have to
write it again each time QVBox is used in RGcode.

Nevertheless this second possibility may very well be plain stupid as I never
take the time to try to understand how was working the moc compiler and I'm
not sure it is really easy (if even possible) to write such a layer across
the Qt extension to C++.



> I tried it on gui/widgets/DiatonicPitchChooser.cpp (at random) and
> found that it didn't add the necessary hboxLayout->addWidget(x) line
> after each widget's construction.  I can see that you have code in
> there to do that, and it's not obvious to me at first glance why it
> didn't work.

It didn't work because my code is looking for
   YyyWidget * yyy = new YyyWidget(x);
lines and it finds only
   m_yyy = new YyyWidget(x);
in gui/widgets/DiatonicPitchChooser.cpp

I tried a quick fix, but it was a too quick one and it breaks almost
everything in the replace process.

Moreover a least one other file (ControlEditorDialog.cpp) has lines such
    new YyyWidget(x);
which would need the script to automatically generate child names...


Yves


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel