[bt-devel] Doxygen
Joachim Ansorg
nospam+bt-devel at joachim-ansorg.de
Tue Jul 20 12:15:57 MST 2010
Hi Olaf,
my name is Joachim, I've been on the project for quite a while but decided to
leave the project a few years ago.
Most of the code you're complaining about is mine :)
Please try to keep the discussion on a professional level, I'm trying as well.
At first, may I ask if you use any kind of development tools ? (KDevelop, for
example). This is usually very helpful to navigate and analyze the codebase.
Second, instead of looking at the code for days, just ask. There are others
who know where it's done and how it works. That's what a mailing list is for.
Third, you're absolutely right. Large parts of the code are not very well
written. There are many reasons for that. One certainly is "learning by
doing". As you already mentioned there is way to much inheritance, too large
classes, bad inheritance, too much responsibilities for a single class, and
so on.
The later additions to BibleTime have been of higher quality, the part you
were looking at is from BibleTime's early days, I think.
Fourth, start small. Rewriting all things at once or looking at everything at
the same time usually ends in chaos and frustration.
Fifth, for the following information I only used the doxygen pages. I did not
checkout the source code.
The start page of doxygen gives a short introduction. There is a link to the
frontend introduction,
http://sourcearchives.com/doxygen/bibletime/frontend.html . It's actually a
good idea to read it ;)
It mentions the window classas and a class CDisplay (in a cryptic sentence).
The name sounds like it display something, doesn't it? Click it to see the
hierarchy. There is CReadDisplay and CWriteDisplay with various
subclasses. "read" sounds like what you're looking for, I think.
So, have a look at the methods of that class and of CReadDisplay (in the
diagram). Because you're looking where the text comes from,
CDisplay::setText() sounds like a good guess to me.
Scroll down to the list "Public Member Functions", click on setText . Look at
the referencing methods, lookupSwordKey is my best guess here. Click on it,
read the source code of that method.
It doesn't look too bad, does it?
There is the call display->text(...). I did not look further, but obviously
the text lookup happens in that method, doesn't it?
Regards,
Joachim
> german: Das Diagramm ist nicht zu lesen, weil der Code nicht zu lesen Ist.
> english: the diagram is confused because, the code is confused.
>
> german: Ich suche schon seid Tagen die Stelle im Code, die den Text von
> SWord holt und im Fenster darstellt. Das ist wohl die Kernfunktion von
> BibleTime. Aber das ist echt nicht so leicht!
>
> english: some tady, i search the text area in the code, which display
> SWord-Text.
>
> german: Hier meine Odyssee durch den Code...
> english: Here my odyssey in the code...
>
> // start in file /src/main.cpp:
>
> [...]
>
> int main(int argc, char* argv[]) {
>
> [...]
>
> BibleTime *mainWindow = new BibleTime();
>
>
> // go to /src/bibletime.cpp
> // german: warum ist die Datei nicht unterhalb von /src/frontend/ ?
> // english: why the file is not in /src/frontend/ ?
>
> [...]
>
> BibleTime::BibleTime(QWidget *parent, Qt::WindowFlags flags)
>
> : QMainWindow(parent, flags),
> : m_WindowWasMaximizedBeforeFullScreen(false)
>
> {
>
> [...]
>
> QSplashScreen splash;
>
> // german: WAS? BibleTime hat von QMainWindow geerbt. Ein SplashScreen wird
> als // erstes gestartet und nicht von MainWindow. Das ist unsinnig.
> // english: SplashScreen is a init-window, so is not good idea, start this
> // in a MainWindow-Class.
>
> [...]
>
> initBackends();
>
> // german: Hä? Das Backend wird in der GUI initziert?
> // english: the GUI starting the backand-init?
>
> [...]
> initView();
>
> // german: Wo ist "initView()"?
> // english: where is "initView()"?
> // go to /src/bibletime_init.cpp:
>
> [...]
>
> void BibleTime::initView() {
>
> [...]
>
> void BibleTime::initSwordConfigFile() {
>
> // german: SwordConfig ist kein Teil von MainWindow. Das ist der Grund
> warum // bibletime.cpp zu groß ist und auf mehrere Dateien aufgeteilt
> werden muss. // Die Klasse tut Dinge, die sie nichts angeht. Das ist das
> Problem. // english: if the class make only their owen job, then her in not
> so largely.
>
> [...]
>
> void BibleTime::initBackends()
>
> // german: Gleiches Problem wie "initSwordConfigFile()"
> // english: same problem as "initSwordConfigFile()"
>
> [...]
> m_mdi = new CMDIArea(this);
> setCentralWidget(m_mdi);
>
> // Okay, was ich suchen muss, ist ein "CMDIArea"
> // go to /src/frontend/cmdiarea.cpp:
>
> [...]
> QMdiSubWindow* CMDIArea::addSubWindow(QWidget * widget, Qt::WindowFlags
> windowFlags) {
>
> // german: Wer ruft diese Funktion auf?
> // english: Who calls this function?
> // Springe zurück zu /src/bibletime.cpp:
>
> [...]
> CDisplayWindow* BibleTime::createReadDisplayWindow(QList<CSwordModuleInfo*>
> modules, const QString& key) { [...]
> CDisplayWindow* displayWindow =
> CDisplayWindowFactory::createReadInstance(modules, m_mdi); if (
> displayWindow ) {
> displayWindow->init();
> m_mdi->addSubWindow(displayWindow);
>
> // go to frontend/displaywindow/cdisplaywindowfactory.h:
> [...]
> public:
> static CReadWindow* createReadInstance(QList<CSwordModuleInfo*>
> modules, CMDIArea* parent);
>
> // german: Hä? Die Funktion gibt "CReadWindow*" zurück und nicht
> // "CDisplayWindow*".
> // english: the function is returns "CReadWindow*" and not
> "CDisplayWindow*"? // go to /src/frontend/displaywindow/cdisplaywindow.h:
> // german: Ich sehe jede menge inlines und virtuals.
> // Scheint wohl eine Basisklasse zu sein.
> // go to /src/frontend/displaywindow/cdisplaywindow.cpp:
>
> [...]
> bool CDisplayWindow::init() {
>
> // german: Kein Textfeld zu sehen. Suche wer von CDisplayWindow erbt.
> // english: cannot found a text area...
> // go to /src/frontend/displaywindow/creadwindow.h:
>
> [...]
>
> class CReadWindow : public CDisplayWindow {
>
> // german: Ich kann keine andere Klasse finden, die von CDisplayWindow
> // erbt. Also was soll das komplexe Konstrukt? Das riecht schwer nach
> Ärger! // Und ich sehe wieder jede menge virtuals, aber kein Textfeld. Also
> wer // erbt jetzt wieder von "CReadWindow"? Warum heißt die Klasse
> überhaupt // "Read"? Was wird denn gelesen?
> // english: which is "read"? only CReadWindow is inherit from
> CDisplayWindow. // so what?
> // go to /src/frontend/displaywindow/clexiconreadwindow.h:
>
> [..]
>
> class CLexiconReadWindow : public CReadWindow {
>
> // german: ...Okay, was für ein Lexikon? Ich kann kein Textfeld finden.
> // Und keine andere Klasse scheint von CReadWindow zu erben.
> // english: the same with CLexiconReadWindow. And which "Lexicon" is meant?
> // go to zu /src/frontend/displaywindow/cbiblereadwindow.h
>
> [...]
>
> class CBibleReadWindow : public CLexiconReadWindow {
>
> // go to /src/frontend/displaywindow/cbookreadwindow.h:
>
> [...]
>
> class CBookReadWindow : public CLexiconReadWindow {
>
> // german: Ein Lexikon ist ein Buch, aber ein Bucht ist nicht immer ein
> Lexikon. // Warum erbt "CBookReadWindow" von "CLexiconReadWindow"???
> // english: a Lexicon is a book, but a book is not always a Lexicon. So
> // why book is inherit from Lexicon?
>
> // go to /src/frontend/displaywindow/ccommentaryreadwindow.h:
>
> [...]
>
> class CCommentaryReadWindow : public CLexiconReadWindow {
>
> // german: Ein Kommentar ist keine Spezialisierung eines Lexikon. Ein
> // "Biblelexikon" ist eine Ableitung/Spezialisierung und könnte
> // von "Lexikon" erben, aber ein Kommentar?
> // english: same inherit confused.
> // go back to /src/frontend/displaywindow/cbiblereadwindow.h
> // german: Ich kann kein Textfeld entdeken.
> // english: cannot found a text area...
> // go back to /src/frontend/displaywindow/cbiblereadwindow.cpp
>
> [...]
>
> void CBibleReadWindow::nextBook() {
> if (verseKey()->next(CSwordVerseKey::UseBook)) {
> keyChooser()->setKey(key());
> }
> }
>
> // german: Die Klasse hat keine Methode "keyChooser()".
> // english: this class have not a function "keyChooser()".
> // go back to base class /src/frontend/displaywindow/clexiconreadwindow.h:
> // german: Die Klasse hat keine Methode "keyChooser()".
> // english: this class have not a function "keyChooser()".
> // go back to base class /src/frontend/displaywindow/creadwindow.h:
> // german: Auch diese Klasse hat keine Methode "keyChooser()".
> // english: this class have not a function "keyChooser()" too.
> // go back to /src/frontend/displaywindow/cdisplaywindow.h:
>
> [...]
>
> /** Returns the keychooser widget of this display window. */
> inline CKeyChooser *keyChooser() const {
> return m_keyChooser;
> }
>
> [...]
>
> CKeyChooser* m_keyChooser;
>
> // go to /src/frontend/keychooser/ckeychooser.h:
> // german: Wieder jede menge virtuals. Es wird also wieder vererbt.
> // go to /src/frontend/keychooser/ckeychooser.h:
>
> [...]
>
> class CLexiconKeyChooser : public CKeyChooser {
>
> // and /src/frontend/keychooser/versekeychooser/cbiblekeychooser.h:
> // and /src/frontend/keychooser/cbooktreechooser.h
>
> // german: Das hält man ja im Kopf nicht aus. Wer soll den bitte aus dem
> // Spagetti-Code schlau werden?
> // english: ... i to cark it.
>
> greeting
>
> Olaf Radicke
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel
--
<>< Re: deemed
More information about the bt-devel
mailing list