diff options
Diffstat (limited to 'src/frontend/displaywindow/clexiconreadwindow.cpp')
-rw-r--r-- | src/frontend/displaywindow/clexiconreadwindow.cpp | 68 |
1 files changed, 54 insertions, 14 deletions
diff --git a/src/frontend/displaywindow/clexiconreadwindow.cpp b/src/frontend/displaywindow/clexiconreadwindow.cpp index 894c787..dae85e3 100644 --- a/src/frontend/displaywindow/clexiconreadwindow.cpp +++ b/src/frontend/displaywindow/clexiconreadwindow.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2009 by the BibleTime developers. +* Copyright 1999-2011 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -16,6 +16,7 @@ #include <QMenu> #include <QDebug> +#include "bibletime.h" #include "backend/config/cbtconfig.h" #include "backend/keys/cswordldkey.h" #include "backend/keys/cswordkey.h" @@ -154,7 +155,7 @@ void CLexiconReadWindow::initConnections() { Q_ASSERT(keyChooser()); connect(keyChooser(), SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*))); - connect(keyChooser()->history(), SIGNAL(historyChanged(bool, bool)), this, SLOT(slotUpdateHistoryButtons(bool, bool))); + connect(history(), SIGNAL(historyChanged(bool, bool)), this, SLOT(slotUpdateHistoryButtons(bool, bool))); //connect the history actions to the right slots bool ok = connect( @@ -182,42 +183,81 @@ void CLexiconReadWindow::initConnections() { void CLexiconReadWindow::initView() { qDebug() << "CLexiconReadWindow::initView"; + + // Create display widget for this window setDisplayWidget( CDisplay::createReadInstance(this) ); + setCentralWidget( displayWidget()->view() ); + setWindowIcon(util::tool::getIconForModule(modules().first())); + + // Create the Navigation toolbar setMainToolBar( new QToolBar(this) ); addToolBar(mainToolBar()); - setKeyChooser( CKeyChooser::createInstance(modules(), key(), mainToolBar()) ); - mainToolBar()->addWidget(keyChooser()); - setModuleChooserBar( new BtModuleChooserBar(getModuleList(), modules().first()->type(), this) ); + + // Create keychooser + setKeyChooser( CKeyChooser::createInstance(modules(), history(), key(), mainToolBar()) ); + + // Create the Works toolbar + setModuleChooserBar( new BtModuleChooserBar(this)); + moduleChooserBar()->setModules(getModuleList(), modules().first()->type(), this); addToolBar(moduleChooserBar()); + + // Create the Tools toolbar setButtonsToolBar( new QToolBar(this) ); addToolBar(buttonsToolBar()); + + // Create the Text Header toolbar addToolBarBreak(); setHeaderBar(new QToolBar(this)); addToolBar(headerBar()); - BtTextWindowHeader* h = new BtTextWindowHeader(this, modules().first()->type(), getModuleList()); - headerBar()->addWidget(h); - setWindowIcon(util::tool::getIconForModule(modules().first())); - setCentralWidget( displayWidget()->view() ); } void CLexiconReadWindow::initToolbars() { - //main toolbar + //Navigation toolbar Q_ASSERT(m_actions.backInHistory); + mainToolBar()->addWidget(keyChooser()); mainToolBar()->addAction(m_actions.backInHistory); //1st button mainToolBar()->addAction(m_actions.forwardInHistory); //2nd button - //buttons toolbar + //Tools toolbar QAction* action = qobject_cast<QAction*>(actionCollection()->action( CResMgr::displaywindows::general::search::actionName)); Q_ASSERT( action ); if (action) { buttonsToolBar()->addAction(action); } + BtDisplaySettingsButton* button = new BtDisplaySettingsButton(buttonsToolBar()); + setDisplaySettingsButton(button); + buttonsToolBar()->addWidget(button); - setDisplaySettingsButton(new BtDisplaySettingsButton(buttonsToolBar())); + // Text Header toolbar + BtTextWindowHeader *h = new BtTextWindowHeader(modules().first()->type(), getModuleList(), this); + headerBar()->addWidget(h); +} - /// \todo find the right place for the button - buttonsToolBar()->addWidget(displaySettingsButton()); +void CLexiconReadWindow::setupMainWindowToolBars() { + // Navigation toolbar + CKeyChooser* keyChooser = CKeyChooser::createInstance(modules(), history(), key(), btMainWindow()->navToolBar() ); + btMainWindow()->navToolBar()->addWidget(keyChooser); + bool ok = connect(keyChooser, SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*))); + Q_ASSERT(ok); + ok = connect(this, SIGNAL(sigKeyChanged(CSwordKey*)), keyChooser, SLOT(updateKey(CSwordKey*)) ); + Q_ASSERT(ok); + btMainWindow()->navToolBar()->addAction(m_actions.backInHistory); //1st button + btMainWindow()->navToolBar()->addAction(m_actions.forwardInHistory); //2nd button + + // Works toolbar + btMainWindow()->worksToolBar()->setModules(getModuleList(), modules().first()->type(), this); + + // Tools toolbar + QAction* action = actionCollection()->action( + CResMgr::displaywindows::general::search::actionName); + Q_ASSERT( action ); + if (action) { + btMainWindow()->toolsToolBar()->addAction(action); + } + BtDisplaySettingsButton* button = new BtDisplaySettingsButton(buttonsToolBar()); + setDisplaySettingsButton(button); + btMainWindow()->toolsToolBar()->addWidget(button); } void CLexiconReadWindow::setupPopupMenu() { |