[bt-devel] [bibletime-cvs] SF.net SVN: bibletime:[1765] trunk/bibletime/src/frontend/keychooser/ versekeychooser

Martin Gruner mg.pub at gmx.net
Mon Nov 9 12:47:12 MST 2009


Hi Gary,

BibleTime does not crash on navigating, that's great!
I just tested, if I open the WLC in Maleachi 4:1 and navigate to the next 
verse, it will jump to Chronicles (next book). This might be caused by using a 
VerseKey somewhere which is not bound to the module (WLC), because Mal 4 
requires correct alternative versification support. Not sure if it worked 
before...

mg

Am Montag, 9. November 2009 05:57:53 schrieb gholmlund at users.sourceforge.net:
> Revision: 1765
>           http://bibletime.svn.sourceforge.net/bibletime/?rev=1765&view=rev
> Author:   gholmlund
> Date:     2009-11-09 04:57:53 +0000 (Mon, 09 Nov 2009)
> 
> Log Message:
> -----------
> Fix keychooser navigation problem.
> 
> Modified Paths:
> --------------
>    
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.c
> pp
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.cpp
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.h
> 
> Modified:
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.c
> pp =================================================================== ---
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.c
> pp	2009-11-08 04:33:51 UTC (rev 1764) +++
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.c
> pp	2009-11-09 04:57:53 UTC (rev 1765) @@ -39,6 +39,7 @@
>      setFocusProxy(w_ref);
>      layout->addWidget(w_ref);
> 
> +    connect(w_ref, SIGNAL(beforeChange(CSwordVerseKey *)),
>  SLOT(beforeRefChange(CSwordVerseKey *))); connect(w_ref,
>  SIGNAL(changed(CSwordVerseKey *)), SLOT(refChanged(CSwordVerseKey *)));
> 
>      setKey(m_key); //set the key without changing it, setKey(key()) would
>  change it @@ -60,29 +61,28 @@
>      emit keyChanged(m_key);
>  }
> 
> +void CBibleKeyChooser::beforeRefChange(CSwordVerseKey* key) {
> +    Q_ASSERT(m_key);
> +
> +	if (!updatesEnabled())
> +		return;
> +
> +	if (m_key)
> +		emit beforeKeyChange(m_key->key());
> +
> +}
> +
>  void CBibleKeyChooser::refChanged(CSwordVerseKey* key) {
>      Q_ASSERT(m_key);
>      Q_ASSERT(key);
> 
> -    if (!updatesEnabled()) return;
> +    if (!updatesEnabled())
> +		return;
> 
>      setUpdatesEnabled(false);
> -    if (m_key)
> -		emit beforeKeyChange(m_key->key());
> +    m_key = key;
> +    emit keyChanged(m_key);
> 
> -	// Must copy, the "key" pointer may be deleted without this class knowing
>  about that. -	CSwordVerseKey* tmpKey = m_key;
> -    m_key = dynamic_cast<CSwordVerseKey*>(key->copy());
> -    emit keyChanged(tmpKey);
> -
> -    /**
> -      \bug Memory leak. Because several widgets share the m_key pointer it
>  is -      currently impossible to delete it here. Doing so will cause
>  crashes in -      other classes such as the CKeyReferenceWidget. More
>  investigation is -      needed to make this safe.
> -    */
> -	// delete tmpKey;
> -
>      setUpdatesEnabled(true);
>  }
> 
> 
> Modified:
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
>  =================================================================== ---
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
> 	2009-11-08 04:33:51 UTC (rev 1764) +++
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
> 	2009-11-09 04:57:53 UTC (rev 1765) @@ -55,9 +55,12 @@
>          */
>          virtual void setModules(const QList<CSwordModuleInfo*>& modules,
>  const bool refresh = true); /**
> -        * used to react to changes
> -        * @param index not used
> +        * used to do actions before key changes
>          */
> +        void beforeRefChange(CSwordVerseKey *key);
> +        /**
> +        * used to do actions after key changes
> +        */
>          void refChanged(CSwordVerseKey *key);
> 
>          void updateKey(CSwordKey* key);
> 
> Modified:
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.cpp ===================================================================
>  ---
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.cpp	2009-11-08 04:33:51 UTC (rev 1764) +++
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.cpp	2009-11-09 04:57:53 UTC (rev 1765) @@ -239,32 +239,33 @@
>  }
> 
>  void CKeyReferenceWidget::slotStepBook(int n) {
> -    CSwordVerseKey key = *m_key;
> -    n > 0 ? key.next( CSwordVerseKey::UseBook ) : key.previous(
>  CSwordVerseKey::UseBook ); +	emit beforeChange(m_key);
> +    n > 0 ? m_key->next( CSwordVerseKey::UseBook ) : m_key->previous(
>  CSwordVerseKey::UseBook ); if (!updatelock)
> -        emit changed(&key); // does *m_key = key
> +        emit changed(m_key);
>      updateText();
>  }
> 
>  void CKeyReferenceWidget::slotStepChapter(int n) {
> -    CSwordVerseKey key = *m_key;
> -    n > 0 ? key.next( CSwordVerseKey::UseChapter ) : key.previous(
>  CSwordVerseKey::UseChapter ); +	emit beforeChange(m_key);
> +    n > 0 ? m_key->next( CSwordVerseKey::UseChapter ) : m_key->previous(
>  CSwordVerseKey::UseChapter ); if (!updatelock)
> -        emit changed(&key); // does *m_key = key
> +        emit changed(m_key);
>      updateText();
>  }
> 
>  void CKeyReferenceWidget::slotStepVerse(int n) {
> -    CSwordVerseKey key = *m_key;
> -    n > 0 ? key.next( CSwordVerseKey::UseVerse ) : key.previous(
>  CSwordVerseKey::UseVerse ); +	emit beforeChange(m_key);
> +    n > 0 ? m_key->next( CSwordVerseKey::UseVerse ) : m_key->previous(
>  CSwordVerseKey::UseVerse ); if (!updatelock)
> -        emit changed(&key); // does *m_key = key
> +        emit changed(m_key);
>      updateText();
>  }
> 
> 
>  void CKeyReferenceWidget::slotChangeVerse(int n) {
>      if (m_key->Verse() != n) {
> +		emit beforeChange(m_key);
>          m_key->Verse( n );
>          setKey( m_key );
>      }
> @@ -274,6 +275,7 @@
> 
>  void CKeyReferenceWidget::slotChangeChapter(int n) {
>      if (m_key->Chapter() != n) {
> +		emit beforeChange(m_key);
>          m_key->Chapter( n );
>          setKey( m_key );
>      }
> @@ -284,6 +286,7 @@
> 
>  void CKeyReferenceWidget::slotChangeBook(QString bookname) {
>      if (m_key->book() != bookname) {
> +		emit beforeChange(m_key);
>          m_key->book( bookname );
>          setKey( m_key );
>      }
> 
> Modified:
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.h =================================================================== ---
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.h	2009-11-08 04:33:51 UTC (rev 1764) +++
>  trunk/bibletime/src/frontend/keychooser/versekeychooser/ckeyreferencewidge
> t.h	2009-11-09 04:57:53 UTC (rev 1765) @@ -35,7 +35,8 @@
>          void setModule(CSwordBibleModuleInfo *m = 0);
>          bool eventFilter(QObject *o, QEvent *e);
> 
> -    signals:
> +signals:
> +		void beforeChange(CSwordVerseKey* key);
>          void changed(CSwordVerseKey* key);
> 
>      protected:
> 
> 
> This was sent by the SourceForge.net collaborative development platform,
>  the world's largest Open Source development site.
> 
> ---------------------------------------------------------------------------
> --- Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>  30-Day trial. Simplify your report design, integration and deployment -
>  and focus on what you do best, core application coding. Discover what's
>  new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> bibletime-cvs mailing list
> bibletime-cvs at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bibletime-cvs
> 

-- 

Bauplan des Lebens - längst im Gen entdeckt!
Die Wissenschaft ist stolz: Sie hat's gecheckt.
Nun ist der Bauplan als Beweis beliebt,
dass es den Architekten gar nicht gibt.

Wolf Rahn



More information about the bt-devel mailing list