diff options
Diffstat (limited to 'src/frontend/keychooser')
18 files changed, 107 insertions, 101 deletions
diff --git a/src/frontend/keychooser/bthistory.cpp b/src/frontend/keychooser/bthistory.cpp index 329ce78..93651a5 100644 --- a/src/frontend/keychooser/bthistory.cpp +++ b/src/frontend/keychooser/bthistory.cpp @@ -10,7 +10,6 @@ #include "frontend/keychooser/bthistory.h" #include <QAction> -#include <QDebug> #include <QList> #include "backend/keys/cswordkey.h" @@ -24,7 +23,6 @@ BTHistory::BTHistory(QWidget* parent) } void BTHistory::add(CSwordKey* newKey) { - qDebug() << "BTHistory::add"; Q_ASSERT(newKey); // Add new key Action after current index if we were not using the history functions, // if it's not a duplicate and if it's not empty. @@ -39,7 +37,6 @@ void BTHistory::add(CSwordKey* newKey) { } void BTHistory::move(QAction* historyItem) { - qDebug() << "BTHistory::move"; //Q_ASSERT(historyItem); Q_ASSERT(m_historyList.count()); @@ -56,7 +53,6 @@ void BTHistory::move(QAction* historyItem) { } void BTHistory::back() { - qDebug() << "BTHistory::back"; if ( m_index >= 1) { move(m_historyList.at(m_index - 1)); } @@ -64,7 +60,6 @@ void BTHistory::back() { } void BTHistory::fw() { - qDebug() << "BTHistory::fw"; if (m_index < (m_historyList.size() - 1)) { move(m_historyList.at(m_index + 1)); } @@ -72,28 +67,21 @@ void BTHistory::fw() { } QList<QAction*> BTHistory::getBackList() { - qDebug() << "BTHistory::getBackList"; QList<QAction*> list; for (int i = m_index - 1; i >= 0; --i) { list.append(m_historyList.at(i)); } - qDebug() << "return:" << list; Q_ASSERT(class_invariant()); return list; } QList<QAction*> BTHistory::getFwList() { - qDebug() << "BTHistory::getFwList"; - QList<QAction*> list; - //qDebug() << "historyList.size:" << m_historyList.size(); for (int i = m_index + 1; i < m_historyList.size(); ++i) { - //qDebug() << "i:" << i; list.append(m_historyList.at(i)); } - qDebug() << "return:" << list; Q_ASSERT(class_invariant()); return list; diff --git a/src/frontend/keychooser/bthistory.h b/src/frontend/keychooser/bthistory.h index 2a374b6..a92a25e 100644 --- a/src/frontend/keychooser/bthistory.h +++ b/src/frontend/keychooser/bthistory.h @@ -23,7 +23,6 @@ class BTHistory: public QObject { Q_OBJECT public: BTHistory(QWidget* parent); - ~BTHistory() {} /** * Return a list of Actions behind the current point, the first of the history list will be the diff --git a/src/frontend/keychooser/cbooktreechooser.cpp b/src/frontend/keychooser/cbooktreechooser.cpp index 1b0edd4..a41922e 100644 --- a/src/frontend/keychooser/cbooktreechooser.cpp +++ b/src/frontend/keychooser/cbooktreechooser.cpp @@ -10,7 +10,6 @@ #include "frontend/keychooser/cbooktreechooser.h" #include <QApplication> -#include <QDebug> #include <QHBoxLayout> #include <QTreeWidget> #include <QTreeWidgetItem> @@ -57,7 +56,6 @@ void CBookTreeChooser::setKey(CSwordKey* key) { /** Sets a new key to this keychooser. Inherited from ckeychooser. */ void CBookTreeChooser::setKey(CSwordKey* newKey, const bool emitSignal) { - qDebug() << "CBookTreeChooser::setKey"; if (m_key != newKey ) { m_key = dynamic_cast<CSwordTreeKey*>(newKey); @@ -130,7 +128,6 @@ void CBookTreeChooser::refreshContent() { /** Slot for signal when item is selected by user. */ void CBookTreeChooser::itemActivated( QTreeWidgetItem* item ) { - qDebug() << "CBookTreeChooser::itemActivated"; //Sometimes Qt calls this function with a null pointer. if (item) { m_key->setKey(item->text(1)); diff --git a/src/frontend/keychooser/ckeychooser.cpp b/src/frontend/keychooser/ckeychooser.cpp index 4d58298..b46ee51 100644 --- a/src/frontend/keychooser/ckeychooser.cpp +++ b/src/frontend/keychooser/ckeychooser.cpp @@ -10,7 +10,6 @@ #include "frontend/keychooser/ckeychooser.h" #include <QAction> -#include <QDebug> #include "backend/drivers/cswordbiblemoduleinfo.h" #include "backend/drivers/cswordcommentarymoduleinfo.h" #include "backend/drivers/cswordlexiconmoduleinfo.h" @@ -26,7 +25,6 @@ CKeyChooser::CKeyChooser(const QList<const CSwordModuleInfo*> &, BTHistory* hist CSwordKey *, QWidget *parent) : QWidget(parent), m_history(historyPtr) { - //qDebug() << "CKeyChooser::CKeyChooser"; bool ok = QObject::connect(history(), SIGNAL(historyMoved(QString&)), this, SLOT(setKey(QString&))); Q_ASSERT(ok); } @@ -44,13 +42,13 @@ CKeyChooser* CKeyChooser::createInstance( } CSwordModuleInfo::ModuleType typeOfModules = modules.first()->type(); - +/* #ifdef BT_DEBUG Q_FOREACH (const CSwordModuleInfo *module, modules) { Q_ASSERT(module->type() == typeOfModules); } #endif - +*/ switch (typeOfModules) { case CSwordModuleInfo::Commentary: /* Fall thru - Bibles and commentaries use the same key chooser */ diff --git a/src/frontend/keychooser/ckeychooser.h b/src/frontend/keychooser/ckeychooser.h index 2a52de3..0ab9c5b 100644 --- a/src/frontend/keychooser/ckeychooser.h +++ b/src/frontend/keychooser/ckeychooser.h @@ -83,10 +83,6 @@ class CKeyChooser : public QWidget { * is emitted if the @ref CKey was changed by the user */ void keyChanged(CSwordKey* newKey); - /** - * Is emitted before the key is changed! - */ - void beforeKeyChange(const QString& key); protected: @@ -94,8 +90,6 @@ class CKeyChooser : public QWidget { BTHistory *history, CSwordKey *key = 0, QWidget *parent = 0); - virtual inline ~CKeyChooser() {} - /** Resets the appropriate font to for the modules. */ diff --git a/src/frontend/keychooser/ckeychooserwidget.cpp b/src/frontend/keychooser/ckeychooserwidget.cpp index 1c8cc4d..36fc05b 100644 --- a/src/frontend/keychooser/ckeychooserwidget.cpp +++ b/src/frontend/keychooser/ckeychooserwidget.cpp @@ -10,7 +10,6 @@ #include "frontend/keychooser/ckeychooserwidget.h" #include <QComboBox> -#include <QDebug> #include <QFocusEvent> #include <QHBoxLayout> #include <QLineEdit> @@ -180,7 +179,7 @@ void CKeyChooserWidget::reset(const QStringList *list, int index, bool do_emit) emit changed(m_comboBox->currentIndex()); } - const QSize dummySize = m_comboBox->sizeHint(); //without this function call the combo box won't be properly sized! + m_comboBox->sizeHint(); //without this function call the combo box won't be properly sized! //DON'T REMOVE OR MOVE THE show()! Otherwise QComboBox's sizeHint() function won't work properly! m_comboBox->show(); @@ -193,7 +192,6 @@ void CKeyChooserWidget::reset(const QStringList *list, int index, bool do_emit) /** Initializes this widget. We need this function because we have more than one constructor. */ void CKeyChooserWidget::init() { - qDebug() << "CKeyChooserWidget::init"; oldKey = QString::null; setFocusPolicy(Qt::WheelFocus); @@ -234,7 +232,6 @@ void CKeyChooserWidget::init() { /** Is called when the return key was presed in the combobox. */ void CKeyChooserWidget::slotReturnPressed( /*const QString& text*/) { Q_ASSERT(comboBox()->lineEdit()); - qDebug() << "return pressed"; QString text = comboBox()->lineEdit()->text(); for (int index = 0; index < comboBox()->count(); ++index) { @@ -248,7 +245,6 @@ void CKeyChooserWidget::slotReturnPressed( /*const QString& text*/) { /** Is called when the current item of the combo box was changed. */ void CKeyChooserWidget::slotComboChanged(int index) { - qDebug() << "CKeyChooserWidget::slotComboChanged(int index)"; if (!updatesEnabled()) { return; } diff --git a/src/frontend/keychooser/ckeychooserwidget.h b/src/frontend/keychooser/ckeychooserwidget.h index 384b19a..3121af8 100644 --- a/src/frontend/keychooser/ckeychooserwidget.h +++ b/src/frontend/keychooser/ckeychooserwidget.h @@ -158,7 +158,7 @@ class CKeyChooserWidget : public QWidget { private: - friend class CLexiconKeyChooser; + QStringList m_list; bool m_useNextPrevSignals; bool updatelock; diff --git a/src/frontend/keychooser/clexiconkeychooser.cpp b/src/frontend/keychooser/clexiconkeychooser.cpp index e09efb1..42fb4e8 100644 --- a/src/frontend/keychooser/clexiconkeychooser.cpp +++ b/src/frontend/keychooser/clexiconkeychooser.cpp @@ -11,8 +11,6 @@ #include <algorithm> #include <QHBoxLayout> -#include <QDebug> -#include "backend/config/cbtconfig.h" #include "backend/drivers/cswordlexiconmoduleinfo.h" #include "backend/keys/cswordldkey.h" #include "frontend/keychooser/bthistory.h" @@ -77,8 +75,6 @@ void CLexiconKeyChooser::updateKey(CSwordKey* key) { } void CLexiconKeyChooser::setKey(CSwordKey* key) { - qDebug() << "CLexiconKeyChooser::setKey"; - if (!(m_key = dynamic_cast<CSwordLDKey*>(key))) { return; } diff --git a/src/frontend/keychooser/cscrollbutton.cpp b/src/frontend/keychooser/cscrollbutton.cpp index df1c35d..9a92b5f 100644 --- a/src/frontend/keychooser/cscrollbutton.cpp +++ b/src/frontend/keychooser/cscrollbutton.cpp @@ -19,7 +19,7 @@ CScrollButton::CScrollButton(QWidget *parent) - : QToolButton(parent), m_isLocked(false) { + : QToolButton(parent), m_isLocked(false), m_movement(0.0) { setFocusPolicy(Qt::WheelFocus); setCursor(Qt::SplitVCursor); } @@ -40,10 +40,11 @@ void CScrollButton::mouseReleaseEvent(QMouseEvent *e) { if (!m_isLocked) return; if (e->button() != Qt::LeftButton) return; m_isLocked = false; + m_movement = 0.0; releaseMouse(); emit unlock(); } - +#include <stdio.h> void CScrollButton::mouseMoveEvent(QMouseEvent *e) { if (m_isLocked) { // Recalculate the center of the widget (might change during grab): @@ -53,29 +54,16 @@ void CScrollButton::mouseMoveEvent(QMouseEvent *e) { int vchange = (e->globalY() - center.y()); if (vchange != 0) { - // Calculate the real change we are going to emit: - int avchange(vchange >= 0 ? vchange : -vchange); - if (avchange < 10) { - avchange = (int) pow(avchange, 0.3); - } - else if (avchange < 30) { - avchange = (int) pow(avchange, 0.6); - } - else if (avchange < 40) { - avchange = (int) pow(avchange, 1.2); - } - else { - avchange = (int) pow(avchange, 2.0); - } + // Adapt the change value, so we get a more natural feeling: + if(vchange > 0) + m_movement += pow((float)vchange/10.0, 1.2); + else // (vchange < 0) + m_movement -= pow(-(float)vchange/10.0, 1.2); - // Emit the change request signal only when necessary: - if (avchange != 0) { - if (vchange > 0) { - emit change_requested(avchange); - } - else if (vchange < 0) { - emit change_requested(-avchange); - } + // Emit the change request signal only when the mouse was moved far enough + if (m_movement >= 1.0 || m_movement <= -1.0) { + emit change_requested((int) m_movement); + m_movement = 0.0; } } diff --git a/src/frontend/keychooser/cscrollbutton.h b/src/frontend/keychooser/cscrollbutton.h index 2c298b3..06d272d 100644 --- a/src/frontend/keychooser/cscrollbutton.h +++ b/src/frontend/keychooser/cscrollbutton.h @@ -75,6 +75,14 @@ class CScrollButton: public QToolButton { * change_requested() signal. */ bool m_isLocked; + + /** + * \brief The amount the mouse moved. + * + * This is saved so slow movements of mice can still be tracked and yet not + * emitting a change for every smallest movement of the mouse. + */ + float m_movement; }; #endif diff --git a/src/frontend/keychooser/cscrollerwidgetset.h b/src/frontend/keychooser/cscrollerwidgetset.h index 8645efc..f2ae643 100644 --- a/src/frontend/keychooser/cscrollerwidgetset.h +++ b/src/frontend/keychooser/cscrollerwidgetset.h @@ -37,8 +37,9 @@ class CScrollerWidgetSet : public QWidget { signals: /** - * is emitted to proceed to some other entry relative to the - * current, indicated by the int value + * Is emitted to proceed to some other entry relative to the + * current, indicated by the int value. + * \param count offset to change to */ void change(int count); diff --git a/src/frontend/keychooser/versekeychooser/btbiblekeywidget.cpp b/src/frontend/keychooser/versekeychooser/btbiblekeywidget.cpp index b74752e..5feb371 100644 --- a/src/frontend/keychooser/versekeychooser/btbiblekeywidget.cpp +++ b/src/frontend/keychooser/versekeychooser/btbiblekeywidget.cpp @@ -20,7 +20,6 @@ #include <QString> #include <QStringList> #include <QToolButton> -#include "backend/config/cbtconfig.h" #include "backend/keys/cswordversekey.h" #include "frontend/keychooser/cscrollerwidgetset.h" #include "frontend/keychooser/versekeychooser/btdropdownchooserbutton.h" @@ -240,41 +239,66 @@ void BtBibleKeyWidget::slotUpdateUnlock() { emit changed(m_key); } -void BtBibleKeyWidget::slotStepBook(int n) { +void BtBibleKeyWidget::slotStepBook(int offset) { emit beforeChange(m_key); - n > 0 ? m_key->next( CSwordVerseKey::UseBook ) : m_key->previous( CSwordVerseKey::UseBook ); + + if(offset >= 0) + for(; offset != 0; offset--) + m_key->next( CSwordVerseKey::UseBook ); + else + for(; offset != 0; offset++) + m_key->previous( CSwordVerseKey::UseBook ); + if (!updatelock) emit changed(m_key); } -void BtBibleKeyWidget::slotStepChapter(int n) { +void BtBibleKeyWidget::slotStepChapter(int offset) { emit beforeChange(m_key); - n > 0 ? m_key->next( CSwordVerseKey::UseChapter ) : m_key->previous( CSwordVerseKey::UseChapter ); + + if(offset >= 0) + for(; offset != 0; offset--) + m_key->next( CSwordVerseKey::UseChapter ); + else + for(; offset != 0; offset++) + m_key->previous( CSwordVerseKey::UseChapter ); + if (!updatelock) emit changed(m_key); } -void BtBibleKeyWidget::slotStepVerse(int n) { +void BtBibleKeyWidget::slotStepVerse(int offset) { emit beforeChange(m_key); - n > 0 ? m_key->next( CSwordVerseKey::UseVerse ) : m_key->previous( CSwordVerseKey::UseVerse ); + + if(offset >= 0) + for(; offset != 0; offset--) + m_key->next( CSwordVerseKey::UseVerse ); + else + for(; offset != 0; offset++) + m_key->previous( CSwordVerseKey::UseVerse ); + if (!updatelock) emit changed(m_key); } void BtBibleKeyWidget::slotChangeVerse(int n) { - if (m_key->Verse() != n) { + if (m_key->getVerse() != n) { emit beforeChange(m_key); - m_key->Verse( n ); + m_key->emitBeforeChanged(); + m_key->setVerse(n); + m_key->emitChanged(); setKey( m_key ); } if (!updatelock) emit changed(m_key); } void BtBibleKeyWidget::slotChangeChapter(int n) { - if (m_key->Chapter() != n) { + if (m_key->getChapter() != n) { emit beforeChange(m_key); - m_key->Chapter( n ); + m_key->emitBeforeChanged(); + m_key->setChapter(n); + m_key->emitChanged(); setKey( m_key ); } if (!updatelock) @@ -284,7 +308,9 @@ void BtBibleKeyWidget::slotChangeChapter(int n) { void BtBibleKeyWidget::slotChangeBook(QString bookname) { if (m_key->book() != bookname) { emit beforeChange(m_key); + m_key->emitBeforeChanged(); m_key->book( bookname ); + m_key->emitChanged(); setKey( m_key ); } if (!updatelock) diff --git a/src/frontend/keychooser/versekeychooser/btbiblekeywidget.h b/src/frontend/keychooser/versekeychooser/btbiblekeywidget.h index 29633fd..644bc75 100644 --- a/src/frontend/keychooser/versekeychooser/btbiblekeywidget.h +++ b/src/frontend/keychooser/versekeychooser/btbiblekeywidget.h @@ -55,11 +55,41 @@ class BtBibleKeyWidget : public QWidget { void slotUpdateLock(); void slotUpdateUnlock(); - void slotStepBook(int); - void slotStepChapter(int); - void slotStepVerse(int); + + /** + * \brief Change the book by the given offset. + * \param offset The offset to move to. + */ + void slotStepBook(int offset); + + /** + * \brief Change the chapter by the given offset. + * \param offset The offset to move to. + */ + void slotStepChapter(int offset); + + /** + * \brief Change the verse by the given offset. + * \param offset The offset to move to. + */ + void slotStepVerse(int offset); + + /** + * \brief Jump to the specified book. + * \param bookname name of the book to change to + */ void slotChangeBook(QString bookname); + + /** + * \brief Jump to the specified chapter. + * \param chapter number of the chapter to change to + */ void slotChangeChapter(int chapter); + + /** + * \brief Jump to the specified verse. + * \param bookname number of the verse to change to + */ void slotChangeVerse(int verse); public slots: diff --git a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp index 512a0f3..8030aaf 100644 --- a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp +++ b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp @@ -9,7 +9,6 @@ #include "frontend/keychooser/versekeychooser/btdropdownchooserbutton.h" -#include <QDebug> #include <QWheelEvent> #include "frontend/keychooser/versekeychooser/btversekeymenu.h" #include "frontend/keychooser/versekeychooser/btbiblekeywidget.h" @@ -37,7 +36,6 @@ BtDropdownChooserButton::BtDropdownChooserButton(BtBibleKeyWidget* ref) void BtDropdownChooserButton::mousePressEvent(QMouseEvent* e) { - //qDebug() << "BtDropdownChooserButton::mousePressEvent"; //recreate the menu menu()->clear(); this->newList(); @@ -76,7 +74,6 @@ void BtBookDropdownChooserButton::newList() { } void BtBookDropdownChooserButton::slotMenuTriggered(QAction* action) { - qDebug() << "BtBookDropdownChooserButton::slotMenuTriggered" << action->text(); m_ref->slotChangeBook(action->text()); } @@ -112,7 +109,7 @@ BtVerseDropdownChooserButton::BtVerseDropdownChooserButton(BtBibleKeyWidget* ref void BtVerseDropdownChooserButton::newList() { QMenu* m = menu(); - int count = ref()->m_module->verseCount(ref()->m_key->book(), ref()->m_key->Chapter()); + int count = ref()->m_module->verseCount(ref()->m_key->book(), ref()->m_key->getChapter()); for (int i = 1; i <= count; i++) { m->addAction(QString::number(i)); } diff --git a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h index 04b7000..bdd56da 100644 --- a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h +++ b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h @@ -23,7 +23,6 @@ class BtDropdownChooserButton : public QToolButton { public: BtDropdownChooserButton(BtBibleKeyWidget* ref); - virtual ~BtDropdownChooserButton() {} /** The item list is constructed here just before the menu is shown.*/ virtual void mousePressEvent(QMouseEvent* event); /** Recreates the menu list.*/ @@ -47,7 +46,6 @@ class BtBookDropdownChooserButton : public BtDropdownChooserButton { Q_OBJECT public: BtBookDropdownChooserButton(BtBibleKeyWidget* ref); - ~BtBookDropdownChooserButton() {} virtual void newList(); public slots: virtual void slotMenuTriggered(QAction* action); @@ -58,7 +56,6 @@ class BtChapterDropdownChooserButton : public BtDropdownChooserButton { Q_OBJECT public: BtChapterDropdownChooserButton(BtBibleKeyWidget* ref); - ~BtChapterDropdownChooserButton() {} virtual void newList(); public slots: virtual void slotMenuTriggered(QAction* action); @@ -69,7 +66,6 @@ class BtVerseDropdownChooserButton : public BtDropdownChooserButton { Q_OBJECT public: BtVerseDropdownChooserButton(BtBibleKeyWidget* ref); - ~BtVerseDropdownChooserButton() {} virtual void newList(); public slots: virtual void slotMenuTriggered(QAction* action); diff --git a/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp b/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp index 9c6e77f..ac94299 100644 --- a/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp +++ b/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp @@ -9,22 +9,21 @@ #include "frontend/keychooser/versekeychooser/btversekeymenu.h" -#include <QDebug> #include <QMenu> #include <QMouseEvent> #include <QTimerEvent> BtVerseKeyMenu::BtVerseKeyMenu(QWidget* parent) - : QMenu(parent), - m_timerId(0), - m_firstClickLock(true) { - qDebug() << "BtVerseKeyMenu::BtVerseKeyMenu"; - QObject::connect(this, SIGNAL(aboutToShow()), this, SLOT(startFirstClickDelayTimer())); + : QMenu(parent) + , m_timerId(0) + , m_firstClickLock(true) +{ + connect(this, SIGNAL(aboutToShow()), + this, SLOT(startFirstClickDelayTimer())); } void BtVerseKeyMenu::startFirstClickDelayTimer() { - //qDebug() << "BtVerseKeyMenu::startFirstClickDelayTimer"; m_firstClickLock = true; killTimer(m_timerId); m_timerId = startTimer(300); @@ -32,7 +31,6 @@ void BtVerseKeyMenu::startFirstClickDelayTimer() { void BtVerseKeyMenu::timerEvent(QTimerEvent* e) { if (e->timerId() == m_timerId) { - //qDebug() << "BtVerseKeyMenu::timerEvent"; killTimer(m_timerId); m_firstClickLock = false; } @@ -42,8 +40,6 @@ void BtVerseKeyMenu::timerEvent(QTimerEvent* e) { } void BtVerseKeyMenu::mouseReleaseEvent(QMouseEvent* e) { - //qDebug() << "BtVerseKeyMenu::mouseReleaseEvent"; if (m_firstClickLock) return; - //qDebug() << "BtVerseKeyMenu::mouseReleaseEvent 2"; QMenu::mouseReleaseEvent(e); } diff --git a/src/frontend/keychooser/versekeychooser/btversekeymenu.h b/src/frontend/keychooser/versekeychooser/btversekeymenu.h index 7f5b333..343277c 100644 --- a/src/frontend/keychooser/versekeychooser/btversekeymenu.h +++ b/src/frontend/keychooser/versekeychooser/btversekeymenu.h @@ -26,7 +26,6 @@ class BtVerseKeyMenu : public QMenu { Q_OBJECT public: BtVerseKeyMenu(QWidget* parent); - ~BtVerseKeyMenu() {} protected: virtual void mouseReleaseEvent(QMouseEvent* event); /** Frees the mouse button release after the delay has elapsed.*/ diff --git a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp index 6a16d8d..358c9c4 100644 --- a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp +++ b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp @@ -46,7 +46,9 @@ CBibleKeyChooser::CBibleKeyChooser( layout->addWidget(w_ref); bool ok = connect(w_ref, SIGNAL(beforeChange(CSwordVerseKey *)), SLOT(beforeRefChange(CSwordVerseKey *))); - connect(w_ref, SIGNAL(changed(CSwordVerseKey *)), SLOT(refChanged(CSwordVerseKey *))); + Q_ASSERT(ok); + + ok =connect(w_ref, SIGNAL(changed(CSwordVerseKey *)), SLOT(refChanged(CSwordVerseKey *))); Q_ASSERT(ok); setKey(m_key); //set the key without changing it, setKey(key()) would change it @@ -63,7 +65,6 @@ void CBibleKeyChooser::setKey(CSwordKey* key) { Q_ASSERT(dynamic_cast<CSwordVerseKey*>(key)); if (dynamic_cast<CSwordVerseKey*>(key) == 0) return; - emit (beforeKeyChange(m_key->key())); //required to make direct setKey calls work from the outside m_key = dynamic_cast<CSwordVerseKey*>(key); w_ref->setKey(m_key); emit keyChanged(m_key); @@ -76,10 +77,6 @@ void CBibleKeyChooser::beforeRefChange(CSwordVerseKey* key) { if (!updatesEnabled()) return; - - if (m_key) - emit beforeKeyChange(m_key->key()); - } void CBibleKeyChooser::refChanged(CSwordVerseKey* key) { |