[Kstars-devel] Issues while separating AstroCalc from main application to make it accessible from cmd line aswell

nalin chhibber nalin.chhibber at gmail.com
Sat May 25 19:35:36 UTC 2013


Hello Devs
    I was trying to separate the Astrocalc tool from main application to
make it accessible from command line argument:
./kstars --calc(or ./run.sh kstars --calc)

This has been addressed here: https://bugs.kde.org/show_bug.cgi?id=122329

It seemed to be easy at-first but apparently I encountered some dependency
issues while separating the module.

So far, I have changed the code in main.cpp(~/kde/kstars/kstars/)
to accommodate the new command line argument(calc in this case). I have
tried a couple of possibilities(even tried to include a separate wrapper
class) but but things doesnt seem to work while I am calling the
AstroCalc() function from the code in main.cpp.

Here's a brief about the flow:
Astrocalc.cpp(~/kde/kstars/kstars/tools/) is the code responsible for the
Astrocalc tool(which has some cool features viz. composition/opposition
module,coordinate converter, time calculator etc)

This tool is being initiated(and displayed) from slotcalculator( )
slotcalculator( ) has been ->
declared in kstars.h:535
defined at kstarsactions.cpp:210 and
being called from kstarsinit.cpp:360 upon user action

Here's the issue I have encountered.
AstroCalc is using KDialog internally to display its components. The
KDialog needs
a QWidget to use as main widget, so we create it first but this should not
be the case if we want to call it from command line right ?
(currently, a reference of KXmlGuiWindow is being passed implicitly for
QWidget *parent)
I googled a little and found Inheritance Diagram of KDialog at
http://www.purinchu.net/kdelibs-apidocs/kdeui/html/classKDialog.html

So AstroCalc is dependent on KDialog
KDialog uses QWidget
and Qwidget is using KXmlGuiWindow as its parent widget.

Is there any way to break this dependency? I am new to QT so might be
missing something.

Any suggestions?

Regards,
Nalin Chhibber (codeinjector)
www.nalinchhibber.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kstars-devel/attachments/20130526/b083bcb6/attachment.html>


More information about the Kstars-devel mailing list