summaryrefslogtreecommitdiff
path: root/src/frontend/displaywindow
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:25 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:25 -0400
commitb954e6dbcceaba3b50aca624e1bddc6db4830829 (patch)
tree31fa8e2579585c9626d56bc9beb55326cbd40ff2 /src/frontend/displaywindow
parent04e7ba8bf082e2b170595eef488834accd9d946e (diff)
Imported Upstream version 2.2
Diffstat (limited to 'src/frontend/displaywindow')
-rw-r--r--src/frontend/displaywindow/btactioncollection.cpp126
-rw-r--r--src/frontend/displaywindow/btactioncollection.h22
-rw-r--r--src/frontend/displaywindow/bttoolbarpopupaction.cpp29
-rw-r--r--src/frontend/displaywindow/bttoolbarpopupaction.h7
-rw-r--r--src/frontend/displaywindow/cbiblereadwindow.cpp262
-rw-r--r--src/frontend/displaywindow/cbiblereadwindow.h2
-rw-r--r--src/frontend/displaywindow/cbookreadwindow.cpp67
-rw-r--r--src/frontend/displaywindow/cbookreadwindow.h8
-rw-r--r--src/frontend/displaywindow/ccommentaryreadwindow.cpp136
-rw-r--r--src/frontend/displaywindow/ccommentaryreadwindow.h7
-rw-r--r--src/frontend/displaywindow/cdisplaywindow.cpp255
-rw-r--r--src/frontend/displaywindow/cdisplaywindow.h219
-rw-r--r--src/frontend/displaywindow/clexiconreadwindow.cpp133
-rw-r--r--src/frontend/displaywindow/clexiconreadwindow.h12
14 files changed, 730 insertions, 555 deletions
diff --git a/src/frontend/displaywindow/btactioncollection.cpp b/src/frontend/displaywindow/btactioncollection.cpp
index f71709a..046c3c0 100644
--- a/src/frontend/displaywindow/btactioncollection.cpp
+++ b/src/frontend/displaywindow/btactioncollection.cpp
@@ -7,7 +7,25 @@
*
**********/
+#include "util/directoryutil.h"
+#include "backend/config/cbtconfig.h"
#include "btactioncollection.h"
+#include <QAction>
+#include <QKeySequence>
+#include <QSettings>
+#include <QString>
+#include <QStringList>
+
+class BtActionItem : public QObject
+{
+public:
+ BtActionItem(QObject* parent)
+ : QObject(parent)
+ {
+ }
+ QKeySequence defaultKeys;
+ QAction* action;
+};
BtActionCollection::BtActionCollection(QObject* parent)
: QObject(parent)
@@ -18,21 +36,119 @@ BtActionCollection::~BtActionCollection()
{
}
+QList<QAction*> BtActionCollection::actions()
+{
+ QList<QAction*> actionList;
+
+ QMap<QString, BtActionItem*>::const_iterator iter = m_actions.constBegin();
+ while (iter != m_actions.constEnd())
+ {
+ QAction* action = iter.value()->action;
+ actionList.append(action);
+ ++iter;
+ }
+ return actionList;
+}
+
QAction* BtActionCollection::action(const QString& name)
{
Q_ASSERT(m_actions[name] != 0);
- return m_actions[name];
+ QAction* action = m_actions[name]->action;
+ Q_ASSERT(action != 0);
+ return action;
}
-void BtActionCollection::addAction(const QString& name, QAction* action)
+QAction* BtActionCollection::addAction(const QString& name, QAction* action)
{
Q_ASSERT(action != 0);
-// Q_ASSERT(m_actions[name] == 0); // TODO - replacing actions is ok???
- m_actions[name] = action;
+ Q_ASSERT(m_actions[name] == 0); // TODO - replacing actions is ok???
+ int count;
+ count = m_actions.count();
+ BtActionItem* item = new BtActionItem(this);
+ item->action = action;
+ item->defaultKeys = action->shortcut();
+ m_actions[name] = item;
+ return action;
+}
+
+QAction* BtActionCollection::addAction(const QString &name, const QObject *receiver, const char* member)
+{
+ QAction* action = new QAction(name, this);
+ if (receiver && member)
+ {
+ bool ok = connect(action, SIGNAL(triggered()), receiver, SLOT(triggered()));
+ Q_ASSERT(ok);
+ }
+ return addAction(name, action);
}
-void BtActionCollection::addAction(const QString &name, const QObject *receiver)
+QKeySequence BtActionCollection::getDefaultShortcut(QAction* action)
{
+ QMap<QString, BtActionItem*>::const_iterator iter = m_actions.constBegin();
+ while (iter != m_actions.constEnd())
+ {
+ if ( iter.value()->action == action)
+ {
+ return iter.value()->defaultKeys;
+ }
+ iter++;
+ }
+ return QKeySequence();
}
+void BtActionCollection::setConfigGroup(const QString &group)
+{
+ m_groupName = group;
+}
+
+void BtActionCollection::readSettings()
+{
+ QSettings* settings = CBTConfig::getConfig();
+ settings->beginGroup(m_groupName);
+ QStringList keyList = settings->childKeys();
+ for (int i=0; i<keyList.size(); i++)
+ {
+ QString key = keyList.at(i);
+ QVariant variant = settings->value(key);
+ QList<QKeySequence> shortcuts;
+ if ( variant != QVariant())
+ {
+ QList<QVariant> varShortcuts = variant.toList();
+ for (int i=0; i<varShortcuts.count(); i++)
+ {
+ QString keys = varShortcuts.at(i).toString();
+ QKeySequence shortcut(keys);
+ shortcuts.append(shortcut);
+ }
+ }
+ action(key)->setShortcuts(shortcuts);
+ }
+ settings->endGroup();
+}
+static QList<QVariant> keyListToVariantList(const QList<QKeySequence>& keyList)
+{
+ QList<QVariant> varList;
+ for (int i=0; i<keyList.count(); i++)
+ {
+ QKeySequence keySeq = keyList.at(i);
+ varList.append(keySeq.toString());
+ }
+ return varList;
+}
+
+void BtActionCollection::writeSettings()
+{
+ QSettings* settings = CBTConfig::getConfig();
+ settings->beginGroup(m_groupName);
+ QMap<QString, BtActionItem*>::const_iterator iter = m_actions.constBegin();
+ while (iter != m_actions.constEnd())
+ {
+ QString actionName = iter.key();
+ QList<QKeySequence> keyList = iter.value()->action->shortcuts();
+ QList<QVariant> varList = keyListToVariantList(keyList);
+ settings->setValue(actionName, varList);
+ iter++;
+ }
+ settings->endGroup();
+}
diff --git a/src/frontend/displaywindow/btactioncollection.h b/src/frontend/displaywindow/btactioncollection.h
index 23ee1cf..48e6b10 100644
--- a/src/frontend/displaywindow/btactioncollection.h
+++ b/src/frontend/displaywindow/btactioncollection.h
@@ -6,14 +6,18 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#ifndef BT_ACTION_COLLECTION_S
-#define BT_ACTION_COLLECTION_S
+#ifndef BT_ACTION_COLLECTION_H
+#define BT_ACTION_COLLECTION_H
-#include <QObject>
#include <QMap>
+#include <QObject>
+#include <QList>
+
class QString;
class QAction;
+class QKeySequence;
+class BtActionItem;
class BtActionCollection : public QObject
{
@@ -21,12 +25,18 @@ class BtActionCollection : public QObject
public:
BtActionCollection(QObject* parent);
~BtActionCollection();
- void addAction(const QString& name, QAction* action);
- void addAction(const QString &name, const QObject *receiver);
+ QAction* addAction(const QString& name, QAction* action);
+ QAction* addAction(const QString &name, const QObject *receiver, const char* member=0);
+ QList<QAction*> actions();
QAction* action(const QString& name);
+ void setConfigGroup(const QString &group);
+ void readSettings();
+ void writeSettings();
+ QKeySequence getDefaultShortcut(QAction* action);
private:
- QMap<QString, QAction*> m_actions;
+ QMap<QString, BtActionItem*> m_actions;
+ QString m_groupName;
};
#endif
diff --git a/src/frontend/displaywindow/bttoolbarpopupaction.cpp b/src/frontend/displaywindow/bttoolbarpopupaction.cpp
index 907a779..ffa672a 100644
--- a/src/frontend/displaywindow/bttoolbarpopupaction.cpp
+++ b/src/frontend/displaywindow/bttoolbarpopupaction.cpp
@@ -11,6 +11,20 @@
#include <QMenu>
#include <QToolButton>
#include <QAction>
+#include <QEvent>
+
+class BtToolButton : public QToolButton
+{
+public:
+ BtToolButton(QWidget* parent=0) : QToolButton(parent)
+ {
+ }
+private:
+ void nextCheckState()
+ {
+ }
+};
+
// This class provides a toolbar widget that has a icon plus a right side down arrow
// The icon is typically set to a back or forward arrow and the down arrow has a popup
@@ -18,6 +32,7 @@
BtToolBarPopupAction::BtToolBarPopupAction(const QIcon& icon, const QString& text, QObject* parent)
: QWidgetAction(parent), m_icon(icon), m_text(text)
{
+ setText(text);
m_menu = new QMenu();
}
@@ -26,6 +41,7 @@ BtToolBarPopupAction::~BtToolBarPopupAction()
delete m_menu;
}
+// return the QMenu object so a popup menu can be constructed
QMenu* BtToolBarPopupAction::popupMenu() const
{
return m_menu;
@@ -33,7 +49,7 @@ QMenu* BtToolBarPopupAction::popupMenu() const
QWidget* BtToolBarPopupAction::createWidget(QWidget* parent)
{
- m_button = new QToolButton(parent);
+ m_button = new BtToolButton(parent);
setIcon(m_icon);
setToolTip(m_text);
m_button->setDefaultAction(this);
@@ -44,8 +60,19 @@ QWidget* BtToolBarPopupAction::createWidget(QWidget* parent)
return m_button;
}
+// Slot to emit a triggered signal when the toolbar button is pressed
void BtToolBarPopupAction::buttonPressed()
{
emit triggered();
}
+// Function to catch the Shortcut event and emit the triggered signal
+bool BtToolBarPopupAction::event(QEvent *event)
+{
+ if (event->type() == QEvent::Shortcut)
+ {
+ emit triggered();
+ return true;
+ }
+ return QWidgetAction::event(event);
+}
diff --git a/src/frontend/displaywindow/bttoolbarpopupaction.h b/src/frontend/displaywindow/bttoolbarpopupaction.h
index 63ed491..7615c02 100644
--- a/src/frontend/displaywindow/bttoolbarpopupaction.h
+++ b/src/frontend/displaywindow/bttoolbarpopupaction.h
@@ -24,7 +24,12 @@ public:
BtToolBarPopupAction(const QIcon& icon, const QString& text, QObject* parent);
~BtToolBarPopupAction();
+
+// return the QMenu object so a popup menu can be constructed
QMenu* popupMenu() const;
+
+// Function to catch the Shortcut event and emit the triggered signal
+ virtual bool event(QEvent* e);
signals:
void triggered();
@@ -33,6 +38,8 @@ protected:
QWidget* createWidget(QWidget* parent);
private slots:
+
+// Slot to emit a triggered signal when the toolbar button is pressed
void buttonPressed();
private:
diff --git a/src/frontend/displaywindow/cbiblereadwindow.cpp b/src/frontend/displaywindow/cbiblereadwindow.cpp
index 15354fa..9b59544 100644
--- a/src/frontend/displaywindow/cbiblereadwindow.cpp
+++ b/src/frontend/displaywindow/cbiblereadwindow.cpp
@@ -2,29 +2,24 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-
#include "cbiblereadwindow.h"
#include "btactioncollection.h"
-
#include "ccommentaryreadwindow.h"
#include "cbuttons.h"
-
#include "backend/keys/cswordversekey.h"
#include "backend/drivers/cswordbiblemoduleinfo.h"
-
#include "frontend/profile/cprofilewindow.h"
#include "frontend/cexportmanager.h"
#include "backend/config/cbtconfig.h"
#include "frontend/cmdiarea.h"
#include "frontend/display/creaddisplay.h"
#include "frontend/keychooser/ckeychooser.h"
-
#include "util/ctoolclass.h"
#include "util/cresmgr.h"
#include "util/directoryutil.h"
@@ -50,32 +45,40 @@ CBibleReadWindow::CBibleReadWindow(QList<CSwordModuleInfo*> moduleList, CMDIArea
qDebug("CBibleReadWindow::CBibleReadWindow");
}
-CBibleReadWindow::~CBibleReadWindow() {}
+CBibleReadWindow::~CBibleReadWindow()
+{
+}
-void CBibleReadWindow::applyProfileSettings( CProfileWindow* const settings ) {
+void CBibleReadWindow::applyProfileSettings( CProfileWindow* const settings )
+{
CLexiconReadWindow::applyProfileSettings(settings);
const int count = displaySettingsButton()->menuItemCount();
int result = settings->windowSettings();
- for (int i = count-1; i>=1; i--) {
- if (result-(int)pow((double)2,i-1)>= 0) { //2^i was added before, so item with index i is set
+ for (int i = count-1; i>=1; i--)
+ {
+ if (result-(int)pow((double)2,i-1)>= 0)
+ { //2^i was added before, so item with index i is set
result -= (int)pow((double)2,i-1);
displaySettingsButton()->setItemStatus(i,true);
}
- else {
+ else
+ {
displaySettingsButton()->setItemStatus(i,false);
}
}
displaySettingsButton()->setChanged();
}
-void CBibleReadWindow::storeProfileSettings( CProfileWindow* const settings ) {
+void CBibleReadWindow::storeProfileSettings( CProfileWindow* const settings )
+{
CLexiconReadWindow::storeProfileSettings(settings);
const int count = displaySettingsButton()->menuItemCount();
int result = 0;
//now check every item
- for (int i = 1; i < count; i++) { //first item is a title
+ for (int i = 1; i < count; i++)
+ { //first item is a title
if (displaySettingsButton()->itemStatus(i)) //item is checked
result += (int)pow((double)2,i-1);//add 2^i (the i. digit in binary)
}
@@ -84,8 +87,8 @@ void CBibleReadWindow::storeProfileSettings( CProfileWindow* const settings ) {
/** Reimplementation. */
-void CBibleReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
-
+void CBibleReadWindow::insertKeyboardActions( BtActionCollection* const a )
+{
QAction* qaction;
qaction = new QAction(tr("Next book"), a);
@@ -112,153 +115,151 @@ void CBibleReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousVerse::accel);
a->addAction("previousVerse", qaction);
-
//popup menu items
- // new KAction(tr("Select all"), KStdAccel::selectAll(), a, "selectAll");
-
- //copy menu items
- // new KAction(tr("Copy reference only"), KShortcut(0), a, "copyReferenceOnly");
- // new KAction(tr("Text of reference"), KShortcut(0), a, "copyTextOfReference");
- // new KAction(tr("Reference with text"), KShortcut(0), a, "copyReferenceWithText");
qaction = new QAction(tr("Copy chapter"), a);
a->addAction("copyChapter", qaction);
- // new KAction(tr("Copy selected text"), KStdAccel::copy(), a, "copySelectedText");
- //save menu
- // new KAction(tr("Reference with text"), KShortcut(0), a, "saveReferenceWithText");
qaction = new QAction(tr("Save chapter as plain text"), a);
a->addAction("saveChapterAsPlainText", qaction);
qaction = new QAction(tr("Save chapter as HTML"), a);
a->addAction("saveChapterAsHTML", qaction);
- // new KAction(tr("Reference with text"), KShortcut(0), a, "saveReferenceWithText");
- //print
qaction = new QAction(tr("Print chapter"), a);
qaction->setShortcut(QKeySequence::Print);
a->addAction("printChapter", qaction);
+
+// qaction = new QAction( /* QIcon(CResMgr::displaywindows::general::findStrongs::icon), */ tr("Strong's search"), a);
+// qaction->setShortcut(CResMgr::displaywindows::general::findStrongs::accel);
+// qaction->setToolTip(tr("Find all occurences of the Strong number currently under the mouse cursor"));
+// a->addAction(CResMgr::displaywindows::general::findStrongs::actionName, qaction);
+
+// qaction = new QAction(tr("Reference only"), a );
+// a->addAction("copyReferenceOnly", qaction);
+
+ qaction = new QAction(tr("Text of reference"), a);
+ a->addAction("copyTextOfReference", qaction);
+
+ qaction = new QAction(tr("Reference with text"), a);
+ a->addAction( "copyReferenceWithText", qaction);
+
+ qaction = new QAction(tr("Reference with text"), a);
+ a->addAction("saveReferenceWithText", qaction);
}
-void CBibleReadWindow::initActions() {
+void CBibleReadWindow::initActions()
+{
qDebug("CBibleReadWindow::initActions");
BtActionCollection* ac = actionCollection();
- CBibleReadWindow::insertKeyboardActions(ac);
+
CLexiconReadWindow::initActions(); //make sure the predefined actions are available
+ CBibleReadWindow::insertKeyboardActions(ac);
+
//cleanup, not a clean oo-solution
ac->action("nextEntry")->setEnabled(false);
ac->action("previousEntry")->setEnabled(false);
QAction* qaction;
- qaction = new QAction(tr("Next book"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextBook::accel);
+ qaction = m_actionCollection->action("nextBook");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextBook()) );
- ac->addAction("nextBook", qaction);
+ addAction(qaction);
- qaction = new QAction(tr("Previous book"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousBook::accel);
+ qaction = m_actionCollection->action("previousBook");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousBook()) );
- ac->addAction("previousBook", qaction);
+ addAction(qaction);
- qaction = new QAction(tr("Next chapter"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextChapter::accel);
+ qaction = m_actionCollection->action("nextChapter");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextChapter()) );
- ac->addAction("nextChapter", qaction);
+ addAction(qaction);
- qaction = new QAction(tr("Previous chapter"),ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousChapter::accel);
+ qaction = m_actionCollection->action("previousChapter");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousChapter()) );
- ac->addAction("previousChapter", qaction);
+ addAction(qaction);
- qaction = new QAction(tr("Next verse"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextVerse::accel);
+ qaction = m_actionCollection->action("nextVerse");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextVerse()) );
- ac->addAction("nextVerse", qaction);
+ addAction(qaction);
- qaction = new QAction(tr("Previous verse"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousVerse::accel);
+ qaction = m_actionCollection->action("previousVerse");
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousVerse()) );
- ac->addAction("previousVerse", qaction);
+ addAction(qaction);
- m_actions.selectAll = qobject_cast<QAction*>(ac->action("selectAll"));
+ m_actions.selectAll = ac->action("selectAll");
Q_ASSERT(m_actions.selectAll);
- m_actions.findText = qobject_cast<QAction*>(ac->action("findText"));
+ m_actions.findText = ac->action("findText");
Q_ASSERT(m_actions.findText);
- m_actions.findStrongs = new QAction(
-// QIcon(CResMgr::displaywindows::general::findStrongs::icon),
- tr("Strong's search"),
- ac
- );
- m_actions.findStrongs->setShortcut(CResMgr::displaywindows::general::findStrongs::accel);
- m_actions.findStrongs->setToolTip(tr("Find all occurences of the Strong number currently under the mouse cursor"));
- QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) );
- ac->addAction(CResMgr::displaywindows::general::findStrongs::actionName, m_actions.findStrongs);
-
- m_actions.copy.referenceOnly = new QAction(tr("Reference only"), ac );
- QObject::connect(m_actions.copy.referenceOnly, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()));
- ac->addAction("copyReferenceOnly", m_actions.copy.referenceOnly);
-
- m_actions.copy.referenceTextOnly = new QAction(tr("Text of reference"), ac);
+ m_actions.findStrongs = m_actionCollection->action(CResMgr::displaywindows::general::findStrongs::actionName);
+
+ m_actions.copy.referenceOnly = m_actionCollection->action("copyReferenceOnly");
+
+ m_actions.copy.referenceTextOnly = m_actionCollection->action("copyTextOfReference");
QObject::connect(m_actions.copy.referenceTextOnly, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorTextOnly()) );
- ac->addAction("copyTextOfReference", m_actions.copy.referenceTextOnly);
+ addAction(m_actions.copy.referenceTextOnly);
- m_actions.copy.referenceAndText = new QAction(tr("Reference with text"), ac);
+ m_actions.copy.referenceAndText = m_actionCollection->action("copyReferenceWithText");
QObject::connect(m_actions.copy.referenceAndText, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorWithText()) );
- ac->addAction( "copyReferenceWithText", m_actions.copy.referenceAndText);
+ addAction(m_actions.copy.referenceAndText);
- m_actions.copy.chapter = new QAction(tr("Chapter"), ac);
+ m_actions.copy.chapter = m_actionCollection->action("copyChapter");
QObject::connect(m_actions.copy.chapter, SIGNAL(triggered()), this, SLOT(copyDisplayedText()) );
- ac->addAction("copyChapter", m_actions.copy.chapter);
+ addAction(m_actions.copy.chapter);
- m_actions.copy.selectedText = qobject_cast<QAction*>(ac->action("copySelectedText"));
+ m_actions.copy.selectedText = ac->action("copySelectedText");
Q_ASSERT(m_actions.copy.selectedText);
- m_actions.save.referenceAndText = new QAction(tr("Reference with text"), ac );
+ m_actions.save.referenceAndText = m_actionCollection->action("saveReferenceWithText");
QObject::connect(m_actions.save.referenceAndText, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(saveAnchorWithText()) );
- ac->addAction("saveReferenceWithText", m_actions.save.referenceAndText);
+ addAction(m_actions.copy.chapter);
- m_actions.save.chapterAsPlain = new QAction(tr("Chapter as plain text"), ac);
+ m_actions.save.chapterAsPlain = m_actionCollection->action("saveChapterAsPlainText");
QObject::connect(m_actions.save.chapterAsPlain, SIGNAL(triggered()), this, SLOT(saveChapterPlain()) );
- ac->addAction("saveChapterAsPlainText", m_actions.save.chapterAsPlain);
+ addAction(m_actions.save.referenceAndText);
- m_actions.save.chapterAsHTML = new QAction(tr("Chapter as HTML"), ac);
+ m_actions.save.chapterAsHTML = m_actionCollection->action("saveChapterAsHTML");
QObject::connect(m_actions.save.chapterAsHTML, SIGNAL(triggered()), this, SLOT(saveChapterHTML()) );
- ac->addAction("saveChapterAsHTML", m_actions.save.chapterAsHTML);
+ addAction(m_actions.save.chapterAsHTML);
- m_actions.print.reference = new QAction(tr("Reference with text"), ac);
+ m_actions.print.reference = m_actionCollection->action("saveReferenceWithText");
QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()) );
- ac->addAction("saveReferenceWithText", m_actions.print.reference);
+ addAction(m_actions.print.reference);
- m_actions.print.chapter = new QAction(tr("Chapter"), ac);
+ m_actions.print.chapter = m_actionCollection->action("printChapter");
QObject::connect(m_actions.print.chapter, SIGNAL(triggered()), this, SLOT(printAll()) );
- ac->addAction("printChapter", m_actions.print.chapter);
+ addAction(m_actions.print.chapter);
-// CBTConfig::setupAccelSettings(CBTConfig::bibleWindow, ac);
+ CBTConfig::setupAccelSettings(CBTConfig::bibleWindow, ac);
}
-void CBibleReadWindow::initConnections() {
+void CBibleReadWindow::initConnections()
+{
CLexiconReadWindow::initConnections();
}
-void CBibleReadWindow::initToolbars() {
+void CBibleReadWindow::initToolbars()
+{
CLexiconReadWindow::initToolbars();
}
-void CBibleReadWindow::initView() {
+void CBibleReadWindow::initView()
+{
CLexiconReadWindow::initView();
- parentWidget()->installEventFilter( this );
+ parentWidget()->installEventFilter(this);
}
/** Reimplementation. */
-void CBibleReadWindow::setupPopupMenu() {
+void CBibleReadWindow::setupPopupMenu()
+{
popup()->setTitle(tr("Bible window"));
popup()->setIcon(CToolClass::getIconForModule(modules().first()) );
popup()->addAction(m_actions.findText);
+ QKeySequence ks = m_actions.findText->shortcut();
+ QString keys = ks.toString();
popup()->addAction(m_actions.findStrongs);
popup()->addAction(m_actions.selectAll);
@@ -279,8 +280,10 @@ void CBibleReadWindow::setupPopupMenu() {
m_actions.saveMenu->addAction(m_actions.save.referenceAndText);
m_actions.saveMenu->addAction(m_actions.save.chapterAsPlain);
m_actions.saveMenu->addAction(m_actions.save.chapterAsHTML);
+
// Save raw HTML action for debugging purposes
- if (qApp->property("--debug").toBool()) {
+ if (qApp->property("--debug").toBool())
+ {
QAction* debugAction = new QAction("Raw HTML", this);
QObject::connect(debugAction, SIGNAL(triggered()), this, SLOT(saveRawHTML()));
m_actions.saveMenu->addAction(debugAction);
@@ -294,22 +297,11 @@ void CBibleReadWindow::setupPopupMenu() {
}
/** Reimplemented. */
-void CBibleReadWindow::updatePopupMenu() {
+void CBibleReadWindow::updatePopupMenu()
+{
qWarning("CBibleReadWindow::updatePopupMenu()");
- //enable the action depending on the supported module features
-// bool hasStrongs = false;
-// QList<CSwordModuleInfo*> mods = modules();
-// for (QList<CSwordModuleInfo*>::iterator it = mods.begin(); it != mods.end(); ++it) {
-// if ( (*it)->has( CSwordModuleInfo::strongNumbers ) ) {
-// hasStrongs = true;
-// break;
-// }
-// }
-//
-// m_actions.findStrongs->setEnabled( hasStrongs );
m_actions.findStrongs->setEnabled( displayWidget()->getCurrentNodeInfo()[CDisplay::Lemma] != QString::null );
-
m_actions.copy.referenceOnly->setEnabled( ((CReadDisplay*)displayWidget())->hasActiveAnchor() );
m_actions.copy.referenceTextOnly->setEnabled( ((CReadDisplay*)displayWidget())->hasActiveAnchor() );
@@ -322,49 +314,61 @@ void CBibleReadWindow::updatePopupMenu() {
}
/** Moves to the next book. */
-void CBibleReadWindow::nextBook() {
- if (verseKey()->next(CSwordVerseKey::UseBook)) {
+void CBibleReadWindow::nextBook()
+{
+ if (verseKey()->next(CSwordVerseKey::UseBook))
+ {
keyChooser()->setKey(key());
}
}
/** Moves one book behind. */
void CBibleReadWindow::previousBook() {
- if (verseKey()->previous(CSwordVerseKey::UseBook)) {
+ if (verseKey()->previous(CSwordVerseKey::UseBook))
+ {
keyChooser()->setKey(key());
}
}
/** Moves to the next book. */
-void CBibleReadWindow::nextChapter() {
- if (verseKey()->next(CSwordVerseKey::UseChapter)) {
+void CBibleReadWindow::nextChapter()
+{
+ if (verseKey()->next(CSwordVerseKey::UseChapter))
+ {
keyChooser()->setKey(key());
}
}
/** Moves one book behind. */
-void CBibleReadWindow::previousChapter() {
- if (verseKey()->previous(CSwordVerseKey::UseChapter)) {
+void CBibleReadWindow::previousChapter()
+{
+ if (verseKey()->previous(CSwordVerseKey::UseChapter))
+ {
keyChooser()->setKey(key());
}
}
/** Moves to the next book. */
-void CBibleReadWindow::nextVerse() {
- if (verseKey()->next(CSwordVerseKey::UseVerse)) {
+void CBibleReadWindow::nextVerse()
+{
+ if (verseKey()->next(CSwordVerseKey::UseVerse))
+ {
keyChooser()->setKey(key());
}
}
/** Moves one book behind. */
-void CBibleReadWindow::previousVerse() {
- if (verseKey()->previous(CSwordVerseKey::UseVerse)) {
+void CBibleReadWindow::previousVerse()
+{
+ if (verseKey()->previous(CSwordVerseKey::UseVerse))
+ {
keyChooser()->setKey(key());
}
}
/** rapper around key() to return the right type of key. */
-CSwordVerseKey* CBibleReadWindow::verseKey() {
+CSwordVerseKey* CBibleReadWindow::verseKey()
+{
CSwordVerseKey* k = dynamic_cast<CSwordVerseKey*>(CDisplayWindow::key());
Q_ASSERT(k);
@@ -372,7 +376,8 @@ CSwordVerseKey* CBibleReadWindow::verseKey() {
}
/** Copies the current chapter into the clipboard. */
-void CBibleReadWindow::copyDisplayedText() {
+void CBibleReadWindow::copyDisplayedText()
+{
CSwordVerseKey dummy(*verseKey());
dummy.Verse(1);
@@ -388,7 +393,8 @@ void CBibleReadWindow::copyDisplayedText() {
}
/** Saves the chapter as valid HTML page. */
-void CBibleReadWindow::saveChapterHTML() {
+void CBibleReadWindow::saveChapterHTML()
+{
//saves the complete chapter to disk
CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(modules().first());
Q_ASSERT(bible);
@@ -409,7 +415,8 @@ void CBibleReadWindow::saveChapterHTML() {
}
/** Saves the chapter as valid HTML page. */
-void CBibleReadWindow::saveChapterPlain() {
+void CBibleReadWindow::saveChapterPlain()
+{
//saves the complete chapter to disk
CSwordVerseKey vk(*verseKey());
@@ -426,30 +433,32 @@ void CBibleReadWindow::saveChapterPlain() {
mgr.saveKey(&vk, CExportManager::Text, true);
}
-void CBibleReadWindow::reload(CSwordBackend::SetupChangedReason reason) {
+void CBibleReadWindow::reload(CSwordBackend::SetupChangedReason reason)
+{
CLexiconReadWindow::reload(reason);
- if (m_modules.count() == 0) {
+ if (m_modules.count() == 0)
+ {
close();
return;
}
//refresh the book lists
-// qDebug("lang is %s",backend()->booknameLanguage().latin1());
verseKey()->setLocale( backend()->booknameLanguage().toLatin1() );
keyChooser()->refreshContent();
-// CBTConfig::setupAccelSettings(CBTConfig::readWindow, actionCollection()); //setup the predefined actions
-// CBTConfig::setupAccelSettings(CBTConfig::bibleWindow, actionCollection());
+ CBTConfig::setupAccelSettings(CBTConfig::bibleWindow, actionCollection());
}
/** No descriptions */
-bool CBibleReadWindow::eventFilter( QObject* o, QEvent* e) {
+bool CBibleReadWindow::eventFilter( QObject* o, QEvent* e)
+{
const bool ret = CLexiconReadWindow::eventFilter(o,e);
// Q_ASSERT(o->inherits("CDisplayWindow"));
// qWarning("class: %s", o->className());
- if (e && (e->type() == QEvent::FocusIn)) { //sync other windows to this active
+ if (e && (e->type() == QEvent::FocusIn))
+ { //sync other windows to this active
/* This is a hack to work around a KHTML problem (similair to the Drag&Drop problem we had):
* If new HTML content is loaded from inside a kHTML event handler
@@ -465,13 +474,16 @@ bool CBibleReadWindow::eventFilter( QObject* o, QEvent* e) {
return ret;
}
-void CBibleReadWindow::lookupSwordKey( CSwordKey* newKey ) {
+void CBibleReadWindow::lookupSwordKey( CSwordKey* newKey )
+{
CLexiconReadWindow::lookupSwordKey(newKey);
syncWindows();
}
-void CBibleReadWindow::syncWindows() {
- foreach (QMdiSubWindow* subWindow, mdi()->subWindowList()) {
+void CBibleReadWindow::syncWindows()
+{
+ foreach (QMdiSubWindow* subWindow, mdi()->subWindowList())
+ {
CDisplayWindow* w = dynamic_cast<CDisplayWindow*>(subWindow->widget());
if (w && w->syncAllowed()) {
w->lookupKey( key()->key() );
diff --git a/src/frontend/displaywindow/cbiblereadwindow.h b/src/frontend/displaywindow/cbiblereadwindow.h
index e044463..3a5f64f 100644
--- a/src/frontend/displaywindow/cbiblereadwindow.h
+++ b/src/frontend/displaywindow/cbiblereadwindow.h
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
diff --git a/src/frontend/displaywindow/cbookreadwindow.cpp b/src/frontend/displaywindow/cbookreadwindow.cpp
index 657238f..40f737d 100644
--- a/src/frontend/displaywindow/cbookreadwindow.cpp
+++ b/src/frontend/displaywindow/cbookreadwindow.cpp
@@ -2,27 +2,21 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-
-
#include "cbookreadwindow.h"
#include "bttoolbarpopupaction.h"
#include "btactioncollection.h"
-
#include "cmodulechooserbar.h"
#include "cbuttons.h"
-
#include "backend/keys/cswordtreekey.h"
-
#include "frontend/display/cdisplay.h"
#include "frontend/keychooser/cbooktreechooser.h"
#include "frontend/profile/cprofilewindow.h"
#include "backend/config/cbtconfig.h"
-
#include "util/ctoolclass.h"
#include "util/cresmgr.h"
@@ -33,9 +27,14 @@
using namespace Profile;
-CBookReadWindow::CBookReadWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent) : CLexiconReadWindow(modules, parent) {}
+CBookReadWindow::CBookReadWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent)
+ : CLexiconReadWindow(modules, parent), m_treeAction(0), m_treeChooser(0)
+{
+}
-CBookReadWindow::~CBookReadWindow() {}
+CBookReadWindow::~CBookReadWindow()
+{
+}
void CBookReadWindow::applyProfileSettings( CProfileWindow* profileWindow )
{
@@ -59,50 +58,30 @@ void CBookReadWindow::initActions()
{
CLexiconReadWindow::initActions();
BtActionCollection* ac = actionCollection();
+ insertKeyboardActions(ac);
+
//cleanup, not a clean oo-solution
Q_ASSERT(ac->action("nextEntry"));
Q_ASSERT(ac->action("previousEntry"));
ac->action("nextEntry")->setEnabled(false);
ac->action("previousEntry")->setEnabled(false);
- m_treeAction = new QAction(
- QIcon(CResMgr::displaywindows::bookWindow::toggleTree::icon),
- tr("Toggle tree view"),
- ac
- );
- m_treeAction->setCheckable(true);
- m_treeAction->setShortcut(CResMgr::displaywindows::bookWindow::toggleTree::accel);
+ m_treeAction = ac->action("toggleTree");
QObject::connect(m_treeAction, SIGNAL(triggered()), this, SLOT(treeToggled()) );
- ac->addAction("toggleTree", m_treeAction);
+ addAction(m_treeAction);
-// CBTConfig::setupAccelSettings(CBTConfig::bookWindow, ac);
+ CBTConfig::setupAccelSettings(CBTConfig::bookWindow, ac);
}
void CBookReadWindow::insertKeyboardActions( BtActionCollection* const a )
{
QAction* qaction;
- qaction = new QAction(
- QIcon(CResMgr::displaywindows::bookWindow::toggleTree::icon),
- tr("Toggle tree view"),
- a
- );
+ qaction = new QAction( /* QIcon(CResMgr::displaywindows::bookWindow::toggleTree::icon), */
+ tr("Toggle tree view"), a);
qaction->setCheckable(true);
qaction->setShortcut(CResMgr::displaywindows::bookWindow::toggleTree::accel);
a->addAction("toggleTree", qaction);
-
- // new QAction(tr("Copy reference only"), KShortcut(0), a, "copyReferenceOnly");
- qaction = new QAction(tr("Copy entry with text"), a);
- a->addAction("copyEntryWithText", qaction);
- // new QAction(tr("Copy selected text"), KShortcut(0), a, "copySelectedText");
- qaction = new QAction(tr("Save entry as plain text"), a);
- a->addAction("saveEntryAsPlainText", qaction);
- qaction = new QAction(tr("Save entry as HTML"),a);
- a->addAction("saveEntryAsHTML", qaction);
- // new QAction(tr("Print reference only"), KShortcut(0), a, "printReferenceOnly");
- qaction = new QAction(tr("Print entry with text"), a);
- a->addAction("printEntryWithText", qaction);
-
}
/** No descriptions */
@@ -122,7 +101,6 @@ void CBookReadWindow::initView()
setMainToolBar( new QToolBar(this) );
addToolBar(mainToolBar());
- //addDockWindow(mainToolBar());
m_treeChooser = new CBookTreeChooser(modules(), key(), splitter);
setDisplayWidget( CDisplay::createReadInstance(this, splitter) );
@@ -132,15 +110,12 @@ void CBookReadWindow::initView()
setModuleChooserBar( new CModuleChooserBar(modules(), modules().first()->type(), this) );
moduleChooserBar()->setButtonLimit(1);
addToolBar(moduleChooserBar());
- //addDockWindow( moduleChooserBar() );
setButtonsToolBar( new QToolBar(this) );
- //addDockWindow( buttonsToolBar() );
setDisplaySettingsButton( new CDisplaySettingsButton( &displayOptions(), &filterOptions(), modules(), buttonsToolBar()) );
addToolBar(buttonsToolBar());
m_treeChooser->hide();
- //splitter->setResizeMode(m_treeChooser, QSplitter::Stretch);
setCentralWidget( splitter );
setWindowIcon(CToolClass::getIconForModule(modules().first()));
}
@@ -165,16 +140,13 @@ void CBookReadWindow::initToolbars()
if (action) {
buttonsToolBar()->addAction(action);
}
-
- //#if KDE_VERSION_MINOR < 1
- //action->plugAccel( accel() );
- //#endif
}
/** Is called when the action was executed to toggle the tree view. */
void CBookReadWindow::treeToggled()
{
- if (m_treeAction->isChecked()) {
+ if (m_treeAction->isChecked())
+ {
m_treeChooser->show();
}
else {
@@ -193,3 +165,8 @@ void CBookReadWindow::setupPopupMenu()
{
CLexiconReadWindow::setupPopupMenu();
}
+
+void CBookReadWindow::reload(CSwordBackend::SetupChangedReason reason)
+{
+ CLexiconReadWindow::reload(reason);
+}
diff --git a/src/frontend/displaywindow/cbookreadwindow.h b/src/frontend/displaywindow/cbookreadwindow.h
index eaa0c15..a2a2219 100644
--- a/src/frontend/displaywindow/cbookreadwindow.h
+++ b/src/frontend/displaywindow/cbookreadwindow.h
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's BtActionCollection code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime BtActionCollection code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -41,6 +41,12 @@ public:
*/
virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow );
+public slots:
+ /**
+ * Refreshes the content of this display window and the content of the keychooser.
+ */
+ virtual void reload(CSwordBackend::SetupChangedReason reason);
+
protected:
virtual void initActions();
virtual void initToolbars();
diff --git a/src/frontend/displaywindow/ccommentaryreadwindow.cpp b/src/frontend/displaywindow/ccommentaryreadwindow.cpp
index 9228c2d..7ead206 100644
--- a/src/frontend/displaywindow/ccommentaryreadwindow.cpp
+++ b/src/frontend/displaywindow/ccommentaryreadwindow.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -10,15 +10,12 @@
//BibleTime includes
#include "ccommentaryreadwindow.h"
#include "btactioncollection.h"
-
#include "frontend/profile/cprofilewindow.h"
#include "backend/config/cbtconfig.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/display/cdisplay.h"
#include "frontend/display/creaddisplay.h"
-
#include "backend/keys/cswordversekey.h"
-
#include "util/ctoolclass.h"
#include "util/cresmgr.h"
#include "util/directoryutil.h"
@@ -30,10 +27,12 @@
using namespace Profile;
-CCommentaryReadWindow::CCommentaryReadWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent) : CLexiconReadWindow(modules, parent) {}
-
-void CCommentaryReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
+CCommentaryReadWindow::CCommentaryReadWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent) : CLexiconReadWindow(modules, parent)
+{
+}
+void CCommentaryReadWindow::insertKeyboardActions(BtActionCollection* const a)
+{
QAction* qaction;
qaction = new QAction(tr("Next book"), a);
@@ -59,22 +58,63 @@ void CCommentaryReadWindow::insertKeyboardActions( BtActionCollection* const a )
qaction = new QAction(tr("Previous verse"), a);
qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousVerse::accel);
a->addAction("previousVerse", qaction);
+}
+
+void CCommentaryReadWindow::initActions()
+{
+ CLexiconReadWindow::initActions(); //make sure the predefined actions are available
+ BtActionCollection* ac = actionCollection();
+ insertKeyboardActions(ac);
+
+ //cleanup, not a clean oo-solution
+ ac->action("nextEntry")->setEnabled(false);
+ ac->action("previousEntry")->setEnabled(false);
+
+ QAction* qaction;
+ qaction = ac->action("nextBook");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextBook()) );
+ addAction(qaction);
+
+ qaction = ac->action("previousBook");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousBook()) );
+ addAction(qaction);
+
+ qaction = ac->action("nextChapter");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextChapter()) );
+ addAction(qaction);
+
+ qaction = ac->action("previousChapter");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousChapter()) );
+ addAction(qaction);
+
+ qaction = ac->action("nextVerse");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextVerse()) );
+ addAction(qaction);
+
+ qaction = ac->action("previousVerse");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousVerse()) );
+ addAction(qaction);
+
+ CBTConfig::setupAccelSettings(CBTConfig::commentaryWindow, actionCollection());
}
-void CCommentaryReadWindow::applyProfileSettings( CProfileWindow* profileWindow ) {
+void CCommentaryReadWindow::applyProfileSettings( CProfileWindow* profileWindow )
+{
CLexiconReadWindow::applyProfileSettings(profileWindow);
if (profileWindow->windowSettings()) {
m_syncButton->setChecked(true);
}
}
-void CCommentaryReadWindow::storeProfileSettings( CProfileWindow* profileWindow ) {
+void CCommentaryReadWindow::storeProfileSettings( CProfileWindow* profileWindow )
+{
CLexiconReadWindow::storeProfileSettings(profileWindow);
profileWindow->setWindowSettings( m_syncButton->isChecked() );
}
-void CCommentaryReadWindow::initToolbars() {
+void CCommentaryReadWindow::initToolbars()
+{
CLexiconReadWindow::initToolbars();
m_syncButton = new QAction(
@@ -90,102 +130,69 @@ void CCommentaryReadWindow::initToolbars() {
}
/** Reimplementation to handle the keychooser refresh. */
-void CCommentaryReadWindow::reload(CSwordBackend::SetupChangedReason reason) {
+void CCommentaryReadWindow::reload(CSwordBackend::SetupChangedReason reason)
+{
CLexiconReadWindow::reload(reason);
//refresh the book lists
verseKey()->setLocale( backend()->booknameLanguage().toLatin1() );
keyChooser()->refreshContent();
+
+ CBTConfig::setupAccelSettings(CBTConfig::commentaryWindow, actionCollection());
}
/** rapper around key() to return the right type of key. */
-CSwordVerseKey* CCommentaryReadWindow::verseKey() {
+CSwordVerseKey* CCommentaryReadWindow::verseKey()
+{
CSwordVerseKey* k = dynamic_cast<CSwordVerseKey*>(CDisplayWindow::key());
Q_ASSERT(k);
return k;
}
-void CCommentaryReadWindow::initActions() {
- CLexiconReadWindow::initActions(); //make sure the predefined actions are available
-
- BtActionCollection* ac = actionCollection();
-
- //cleanup, not a clean oo-solution
- ac->action("nextEntry")->setEnabled(false);
- ac->action("previousEntry")->setEnabled(false);
-
- QAction* qaction;
-
- qaction = new QAction(tr("Next book"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextBook::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextBook()) );
- ac->addAction("nextBook", qaction);
-
- qaction = new QAction(tr("Previous book"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousBook::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousBook()) );
- ac->addAction("previousBook", qaction);
-
- qaction = new QAction(tr("Next chapter"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextChapter::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextChapter()) );
- ac->addAction("nextChapter", qaction);
-
- qaction = new QAction(tr("Previous chapter"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousChapter::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousChapter()) );
- ac->addAction("previousChapter", qaction);
-
- qaction = new QAction(tr("Next verse"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::nextVerse::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextVerse()) );
- ac->addAction("nextVerse", qaction);
-
- qaction = new QAction(tr("Previous verse"), ac);
- qaction->setShortcut(CResMgr::displaywindows::bibleWindow::previousVerse::accel);
- QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousVerse()) );
- ac->addAction("previousVerse", qaction);
-
-// CBTConfig::setupAccelSettings(CBTConfig::commentaryWindow, actionCollection());
-}
-
/** Moves to the next book. */
-void CCommentaryReadWindow::nextBook() {
+void CCommentaryReadWindow::nextBook()
+{
if (verseKey()->next(CSwordVerseKey::UseBook))
keyChooser()->setKey(key());
}
/** Moves one book behind. */
-void CCommentaryReadWindow::previousBook() {
+void CCommentaryReadWindow::previousBook()
+{
if (verseKey()->previous(CSwordVerseKey::UseBook))
keyChooser()->setKey(key());
}
/** Moves to the next book. */
-void CCommentaryReadWindow::nextChapter() {
+void CCommentaryReadWindow::nextChapter()
+{
if (verseKey()->next(CSwordVerseKey::UseChapter))
keyChooser()->setKey(key());
}
/** Moves one book behind. */
-void CCommentaryReadWindow::previousChapter() {
+void CCommentaryReadWindow::previousChapter()
+{
if (verseKey()->previous(CSwordVerseKey::UseChapter))
keyChooser()->setKey(key());
}
/** Moves to the next book. */
-void CCommentaryReadWindow::nextVerse() {
+void CCommentaryReadWindow::nextVerse()
+{
if (verseKey()->next(CSwordVerseKey::UseVerse))
keyChooser()->setKey(key());
}
/** Moves one book behind. */
-void CCommentaryReadWindow::previousVerse() {
+void CCommentaryReadWindow::previousVerse()
+{
if (verseKey()->previous(CSwordVerseKey::UseVerse))
keyChooser()->setKey(key());
}
-bool CCommentaryReadWindow::syncAllowed() const {
+bool CCommentaryReadWindow::syncAllowed() const
+{
return m_syncButton->isChecked();
}
@@ -193,6 +200,7 @@ bool CCommentaryReadWindow::syncAllowed() const {
/*!
\fn CCommentaryReadWindow::setupPopupMenu()
*/
-void CCommentaryReadWindow::setupPopupMenu() {
+void CCommentaryReadWindow::setupPopupMenu()
+{
CLexiconReadWindow::setupPopupMenu();
}
diff --git a/src/frontend/displaywindow/ccommentaryreadwindow.h b/src/frontend/displaywindow/ccommentaryreadwindow.h
index 1bac735..333b48f 100644
--- a/src/frontend/displaywindow/ccommentaryreadwindow.h
+++ b/src/frontend/displaywindow/ccommentaryreadwindow.h
@@ -2,23 +2,18 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-
#ifndef CCOMMENTARYREADWINDOW_H
#define CCOMMENTARYREADWINDOW_H
//BibleTime includes
#include "cbiblereadwindow.h"
-//Qt includes
-//#include <qwidget.h>
-
-
class QAction;
class CSwordVerseKey;
class BtActionCollection;
diff --git a/src/frontend/displaywindow/cdisplaywindow.cpp b/src/frontend/displaywindow/cdisplaywindow.cpp
index 59fccab..6cf160d 100644
--- a/src/frontend/displaywindow/cdisplaywindow.cpp
+++ b/src/frontend/displaywindow/cdisplaywindow.cpp
@@ -10,7 +10,6 @@
#include "cdisplaywindow.h"
#include "bttoolbarpopupaction.h"
#include "btactioncollection.h"
-
#include "cmodulechooserbar.h"
#include "cbuttons.h"
#include "backend/keys/cswordkey.h"
@@ -54,21 +53,24 @@ CDisplayWindow::CDisplayWindow(QList<CSwordModuleInfo*> modules, CMDIArea *paren
// Connect this to the backend module list changes
connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)), SLOT(reload(CSwordBackend::SetupChangedReason)));
- //KMainWindow::setAttribute(Qt::WA_DeleteOnClose); //what about QMdiSubWindow?
}
-CDisplayWindow::~CDisplayWindow() {
+CDisplayWindow::~CDisplayWindow()
+{
delete m_swordKey;
m_swordKey = 0;
}
-CMDIArea* CDisplayWindow::mdi() const {
+CMDIArea* CDisplayWindow::mdi() const
+{
return m_mdi;
}
/** Returns the right window caption. */
-const QString CDisplayWindow::windowCaption() {
- if (!m_modules.count()) {
+const QString CDisplayWindow::windowCaption()
+{
+ if (!m_modules.count())
+ {
return QString::null;
}
@@ -76,12 +78,15 @@ const QString CDisplayWindow::windowCaption() {
}
/** Returns the used modules as a QPtrList */
-QList<CSwordModuleInfo*> CDisplayWindow::modules() {
+QList<CSwordModuleInfo*> CDisplayWindow::modules()
+{
QList<CSwordModuleInfo*> mods;
- for (QStringList::iterator it = m_modules.begin(); it != m_modules.end(); ++it) {
+ for (QStringList::iterator it = m_modules.begin(); it != m_modules.end(); ++it)
+ {
Q_ASSERT(backend()->findModuleByName(*it));
- if (CSwordModuleInfo* m = backend()->findModuleByName(*it)) {
+ if (CSwordModuleInfo* m = backend()->findModuleByName(*it))
+ {
mods.append(m);
}
}
@@ -90,38 +95,39 @@ QList<CSwordModuleInfo*> CDisplayWindow::modules() {
}
/** Set the window caption. */
-void CDisplayWindow::setCaption( const QString& ) {
+void CDisplayWindow::setCaption( const QString& )
+{
QWidget::setWindowTitle( windowCaption() );
m_mdi->emitWindowCaptionChanged();
}
-void CDisplayWindow::insertKeyboardActions( BtActionCollection* a ) {
+void CDisplayWindow::insertKeyboardActions( BtActionCollection* a )
+{
qDebug() << "CDisplayWindow::insertKeyboardActions: ac: " << a;
QAction* actn = new QAction(QIcon(), tr("Zoom in"), 0);
actn->setShortcut(QKeySequence::ZoomIn);
a->addAction("zoomIn", actn);
- //a->addAction(KStandardAction::ZoomIn, "zoomIn", 0, 0);
+
actn = new QAction(QIcon(), tr("Zoom out"), 0);
actn->setShortcut(QKeySequence::ZoomOut);
- a->addAction("zoomIn", actn);
- //a->addAction(KStandardAction::ZoomOut, "zoomOut", 0, 0);
+ a->addAction("zoomOut", actn);
+
actn = new QAction(QIcon(), tr("Close"), 0);
actn->setShortcut(QKeySequence::Close);
a->addAction("closeWindow", actn);
- //a->addAction(KStandardAction::Close, "closeWindow", 0, 0);
+
actn = new QAction(QIcon(), tr("Select all"), 0);
actn->setShortcut(QKeySequence::SelectAll);
a->addAction("selectAll", actn);
- //a->addAction(KStandardAction::SelectAll, "selectAll", 0, 0);
+
actn = new QAction(QIcon(), tr("Copy"), 0);
actn->setShortcut(QKeySequence::Copy);
a->addAction("copySelectedText", actn);
- //a->addAction(KStandardAction::Copy, "copySelectedText", 0, 0);
+
actn = new QAction(QIcon(), tr("Find..."), 0);
actn->setShortcut(QKeySequence::Find);
a->addAction("findText", actn);
- //a->addAction(KStandardAction::Find, "findText", 0, 0);
BtToolBarPopupAction* action = new BtToolBarPopupAction(
QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::backInHistory::icon)),
@@ -146,85 +152,70 @@ void CDisplayWindow::initActions()
BtActionCollection* ac = actionCollection();
- QAction* kaction = new QAction(
+ CDisplayWindow::insertKeyboardActions(ac);
+
+ QAction* qaction = new QAction(
QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::search::icon)),
tr("Open the search dialog with the works of this window"),
ac
);
- kaction->setShortcut(CResMgr::displaywindows::general::search::accel);
- QObject::connect(kaction, SIGNAL(triggered()), this, SLOT(slotSearchInModules()));
- ac->addAction(CResMgr::displaywindows::general::search::actionName, kaction);
+ qaction->setShortcut(CResMgr::displaywindows::general::search::accel);
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(slotSearchInModules()));
+ ac->addAction(CResMgr::displaywindows::general::search::actionName, qaction);
CDisplayConnections* conn = displayWidget()->connectionsProxy();
- QAction* actn = new QAction(QIcon(), tr("Zoom in"), ac);
- actn->setShortcut(QKeySequence::ZoomIn);
+ QAction* actn = ac->action("zoomIn");
QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(zoomIn()));
- ac->addAction("zoomIn", actn);
addAction(actn);
- //a->addAction(KStandardAction::ZoomIn, "zoomIn", 0, 0);
- actn = new QAction(QIcon(), tr("Zoom out"), ac);
- actn->setShortcut(QKeySequence::ZoomOut);
+
+ actn = ac->action("zoomOut");
QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(zoomOut()));
- ac->addAction("zoomOut", actn);
addAction(actn);
- //a->addAction(KStandardAction::ZoomOut, "zoomOut", 0, 0);
- actn = new QAction(QIcon(), tr("Close"), ac);
- actn->setShortcut(QKeySequence::Close);
+
+ actn = ac->action("closeWindow");
QObject::connect(actn, SIGNAL(triggered()), this, SLOT(close()));
- ac->addAction("closeWindow", actn);
addAction(actn);
- //a->addAction(KStandardAction::Close, "closeWindow", 0, 0);
- actn = new QAction(QIcon(), tr("Select all"), ac);
- actn->setShortcut(QKeySequence::SelectAll);
+
+ actn = ac->action("selectAll");
QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(selectAll()));
- ac->addAction("selectAll", actn);
addAction(actn);
- //a->addAction(KStandardAction::SelectAll, "selectAll", 0, 0);
- actn = new QAction(QIcon(), tr("Copy"), ac);
- actn->setShortcut(QKeySequence::Copy);
+
+ actn = ac->action("copySelectedText");
QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(copySelection()));
- ac->addAction("copySelectedText", actn);
addAction(actn);
- //a->addAction(KStandardAction::Copy, "copySelectedText", 0, 0);
- actn = new QAction(QIcon(), tr("Find..."), ac);
- actn->setShortcut(QKeySequence::Find);
+
+ actn = ac->action("findText");
QObject::connect(actn, SIGNAL(triggered()), conn, SLOT(openFindTextDialog()));
- ac->addAction("findText", actn);
addAction(actn);
- //a->addAction(KStandardAction::Find, "findText", 0, 0);
- BtToolBarPopupAction* popupaction = new BtToolBarPopupAction(
- QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::backInHistory::icon)),
- tr("Back in history"),
- ac
- );
+ QAction* popupaction = ac->action(CResMgr::displaywindows::general::backInHistory::actionName);
bool ok = QObject::connect(popupaction, SIGNAL(triggered()), keyChooser()->history(), SLOT(back()));
Q_ASSERT(ok);
- ac->addAction(CResMgr::displaywindows::general::backInHistory::actionName, popupaction);
+ addAction(popupaction);
- popupaction = new BtToolBarPopupAction(
- QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::forwardInHistory::icon)),
- tr("Forward in history"),
- ac
- );
+ popupaction = ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName);
ok = QObject::connect(popupaction, SIGNAL(triggered()), keyChooser()->history(), SLOT(fw()) );
Q_ASSERT(ok);
- ac->addAction(CResMgr::displaywindows::general::forwardInHistory::actionName, popupaction);
+ addAction(popupaction);
+ CBTConfig::setupAccelSettings(CBTConfig::allWindows,ac);
}
/** Refresh the settings of this window. */
-void CDisplayWindow::reload(CSwordBackend::SetupChangedReason) {
+void CDisplayWindow::reload(CSwordBackend::SetupChangedReason)
+{
//first make sure all used Sword modules are still present
QMutableStringListIterator it(m_modules);
while (it.hasNext()) {
- if (!backend()->findModuleByName(it.next())) {
+ if (!backend()->findModuleByName(it.next()))
+ {
it.remove();
}
}
- if (m_modules.count() == 0){
+ if (m_modules.count() == 0)
+ {
close();
return;
}
@@ -236,75 +227,93 @@ void CDisplayWindow::reload(CSwordBackend::SetupChangedReason) {
}
modulesChanged();
lookup();
+
+ CBTConfig::setupAccelSettings(CBTConfig::allWindows,actionCollection());
+ CBTConfig::setupAccelSettings(CBTConfig::readWindow, actionCollection());
}
/** Returns the filter options used by this window. */
-CSwordBackend::FilterOptions& CDisplayWindow::filterOptions() {
+CSwordBackend::FilterOptions& CDisplayWindow::filterOptions()
+{
return m_filterOptions;
}
/** Returns the display options used by this display window. */
-CSwordBackend::DisplayOptions& CDisplayWindow::displayOptions() {
+CSwordBackend::DisplayOptions& CDisplayWindow::displayOptions()
+{
return m_displayOptions;
}
/** Sets the new display options for this window. */
-void CDisplayWindow::setDisplayOptions( const CSwordBackend::DisplayOptions& displayOptions ) {
+void CDisplayWindow::setDisplayOptions( const CSwordBackend::DisplayOptions& displayOptions )
+{
m_displayOptions = displayOptions;
}
/** Sets the new filter options of this window. */
-void CDisplayWindow::setFilterOptions( CSwordBackend::FilterOptions& filterOptions ) {
+void CDisplayWindow::setFilterOptions( CSwordBackend::FilterOptions& filterOptions )
+{
m_filterOptions = filterOptions;
}
/** Returns true if the widget is ready for use. */
-bool CDisplayWindow::isReady() const {
+bool CDisplayWindow::isReady() const
+{
return m_isReady;
}
/** Set the ready status */
-void CDisplayWindow::setReady( const bool& ready ) {
+void CDisplayWindow::setReady( const bool& ready )
+{
m_isReady = ready;
}
/** Returns true if the window may be closed. */
-bool CDisplayWindow::queryClose() {
+bool CDisplayWindow::queryClose()
+{
return true;
}
/** Returns the keychooser widget of this display window. */
-CKeyChooser* CDisplayWindow::keyChooser() const {
+CKeyChooser* CDisplayWindow::keyChooser() const
+{
return m_keyChooser;
}
/** Sets the keychooser widget for this display window. */
-void CDisplayWindow::setKeyChooser( CKeyChooser* ck ) {
+void CDisplayWindow::setKeyChooser( CKeyChooser* ck )
+{
m_keyChooser = ck;
}
/** Returns the key of this display window. */
-CSwordKey* CDisplayWindow::key() const {
+CSwordKey* CDisplayWindow::key() const
+{
Q_ASSERT( m_swordKey );
return m_swordKey;
}
/** Sets the new sword key. */
-void CDisplayWindow::setKey( CSwordKey* key ) {
+void CDisplayWindow::setKey( CSwordKey* key )
+{
Q_ASSERT( key );
m_swordKey = key;
}
-void CDisplayWindow::modulesChanged() {
+void CDisplayWindow::modulesChanged()
+{
if (moduleChooserBar()) { //necessary for write windows
setModules( m_moduleChooserBar->getModuleList() );
}
- if (!modules().count()) {
+ if (!modules().count())
+ {
close();
}
- else {
- if (displaySettingsButton()) {
+ else
+ {
+ if (displaySettingsButton())
+ {
displaySettingsButton()->reset(modules());
}
@@ -314,35 +323,42 @@ void CDisplayWindow::modulesChanged() {
}
/** Returns the module chooser bar. */
-CModuleChooserBar* CDisplayWindow::moduleChooserBar() const {
+CModuleChooserBar* CDisplayWindow::moduleChooserBar() const
+{
return m_moduleChooserBar;
}
/** Sets the module chooser bar. */
-void CDisplayWindow::setModuleChooserBar( CModuleChooserBar* bar ) {
- if (m_moduleChooserBar) {
+void CDisplayWindow::setModuleChooserBar( CModuleChooserBar* bar )
+{
+ if (m_moduleChooserBar)
+ {
disconnect(m_moduleChooserBar, SIGNAL(sigChanged()), this, SLOT(modulesChanged()));
}
//if a new bar should be set!
- if (bar) {
+ if (bar)
+ {
m_moduleChooserBar = bar;
connect(bar, SIGNAL(sigChanged()), SLOT(modulesChanged()));
}
}
/** Sets the modules. */
-void CDisplayWindow::setModules( const QList<CSwordModuleInfo*>& newModules ) {
+void CDisplayWindow::setModules( const QList<CSwordModuleInfo*>& newModules )
+{
qDebug("CDisplayWindow::setModules");
m_modules.clear();
- foreach (CSwordModuleInfo* mod, newModules) {
+ foreach (CSwordModuleInfo* mod, newModules)
+ {
m_modules.append(mod->name());
}
}
/** Initialize the window. Call this method from the outside, because calling this in the constructor is not possible! */
-bool CDisplayWindow::init() {
+bool CDisplayWindow::init()
+{
qDebug("CDisplayWindow::init");
initView();
setMinimumSize( 100,100 );
@@ -367,32 +383,38 @@ bool CDisplayWindow::init() {
}
/** Returns the main toolbar. */
-QToolBar* CDisplayWindow::mainToolBar() const {
+QToolBar* CDisplayWindow::mainToolBar() const
+{
return m_mainToolBar;
}
/** Returns the main toolbar. */
-QToolBar* CDisplayWindow::buttonsToolBar() const {
+QToolBar* CDisplayWindow::buttonsToolBar() const
+{
return m_buttonsToolBar;
}
/** Sets the main toolbar. */
-void CDisplayWindow::setMainToolBar( QToolBar* bar ) {
+void CDisplayWindow::setMainToolBar( QToolBar* bar )
+{
m_mainToolBar = bar;
}
/** Sets the main toolbar. */
-void CDisplayWindow::setButtonsToolBar( QToolBar* bar ) {
+void CDisplayWindow::setButtonsToolBar( QToolBar* bar )
+{
m_buttonsToolBar = bar;
}
/** Returns the display settings button */
-CDisplaySettingsButton* CDisplayWindow::displaySettingsButton() const {
+CDisplaySettingsButton* CDisplayWindow::displaySettingsButton() const
+{
return m_displaySettingsButton;
}
/** Sets the display settings button. */
-void CDisplayWindow::setDisplaySettingsButton( CDisplaySettingsButton* button ) {
+void CDisplayWindow::setDisplaySettingsButton( CDisplaySettingsButton* button )
+{
if (m_displaySettingsButton)
disconnect(m_displaySettingsButton, SIGNAL( sigChanged() ),this, SLOT(lookup() ));
@@ -401,27 +423,33 @@ void CDisplayWindow::setDisplaySettingsButton( CDisplaySettingsButton* button )
}
/** Lookup the current key. Used to refresh the display. */
-void CDisplayWindow::lookup() {
+void CDisplayWindow::lookup()
+{
lookupSwordKey( key() );
}
-void CDisplayWindow::lookupModKey( const QString& moduleName, const QString& keyName ) {
- if (!isReady()) {
+void CDisplayWindow::lookupModKey( const QString& moduleName, const QString& keyName )
+{
+ if (!isReady())
+ {
return;
}
CSwordModuleInfo* m = backend()->findModuleByName(moduleName);
Q_ASSERT(m);
- if (!m) {
+ if (!m)
+ {
return;
}
//ToDo: check for containsRef compat
- if (m && modules().contains(m)) {
+ if (m && modules().contains(m))
+ {
key()->key(keyName);
keyChooser()->setKey(key()); //the key chooser does send an update signal
}
- else { //given module not displayed in this window
+ else
+ { //given module not displayed in this window
//if the module is displayed in another display window we assume a wrong drop
//create a new window for the given module
QList<CSwordModuleInfo*> mList;
@@ -430,7 +458,8 @@ void CDisplayWindow::lookupModKey( const QString& moduleName, const QString& key
}
}
-void CDisplayWindow::lookupKey( const QString& keyName ) {
+void CDisplayWindow::lookupKey( const QString& keyName )
+{
/* This function is called for example after a bookmark was dropped on this window
*/
Q_ASSERT(modules().first());
@@ -440,16 +469,21 @@ void CDisplayWindow::lookupKey( const QString& keyName ) {
}
/** Update the status of the popup menu entries. */
-void CDisplayWindow::updatePopupMenu() {}
+void CDisplayWindow::updatePopupMenu()
+{
+}
///** Returns the installed popup menu. */
-QMenu* CDisplayWindow::popup() {
+QMenu* CDisplayWindow::popup()
+{
// qWarning("CReadWindow::popup()");
- if (!m_popupMenu) {
+ if (!m_popupMenu)
+ {
m_popupMenu = new QMenu(this);
connect(m_popupMenu, SIGNAL(aboutToShow()), this, SLOT(updatePopupMenu()));
- if (displayWidget()) {
+ if (displayWidget())
+ {
displayWidget()->installPopup(m_popupMenu);
}
/* else {
@@ -460,18 +494,22 @@ QMenu* CDisplayWindow::popup() {
}
/** Returns the display widget used by this implementation of CDisplayWindow. */
-CDisplay* CDisplayWindow::displayWidget() const {
+CDisplay* CDisplayWindow::displayWidget() const
+{
Q_ASSERT(m_displayWidget);
return m_displayWidget;
}
/** Sets the display widget used by this display window. */
-void CDisplayWindow::setDisplayWidget( CDisplay* newDisplay ) {
+void CDisplayWindow::setDisplayWidget( CDisplay* newDisplay )
+{
m_displayWidget = newDisplay;
}
-void CDisplayWindow::closeEvent(QCloseEvent* e) {
- if (!queryClose()) {
+void CDisplayWindow::closeEvent(QCloseEvent* e)
+{
+ if (!queryClose())
+ {
e->ignore();
}
else {
@@ -479,15 +517,18 @@ void CDisplayWindow::closeEvent(QCloseEvent* e) {
}
}
-void CDisplayWindow::slotSearchInModules() {
+void CDisplayWindow::slotSearchInModules()
+{
Search::CSearchDialog::openDialog(modules());
}
-void CDisplayWindow::printAll() {
+void CDisplayWindow::printAll()
+{
m_displayWidget->connectionsProxy()->printAll( m_displayOptions, m_filterOptions);
}
-void CDisplayWindow::printAnchorWithText() {
+void CDisplayWindow::printAnchorWithText()
+{
m_displayWidget->connectionsProxy()->printAnchorWithText( m_displayOptions, m_filterOptions);
}
diff --git a/src/frontend/displaywindow/cdisplaywindow.h b/src/frontend/displaywindow/cdisplaywindow.h
index 1eb7d06..80877fb 100644
--- a/src/frontend/displaywindow/cdisplaywindow.h
+++ b/src/frontend/displaywindow/cdisplaywindow.h
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -12,10 +12,8 @@
//BibleTime includes
#include "util/cpointers.h"
-
class CSwordModuleInfo;
#include "backend/managers/cswordbackend.h"
-
#include "frontend/profile/cprofilewindow.h"
//Qt includes
@@ -41,145 +39,117 @@ class BtActionCollection;
* @author The BibleTime team
*/
-class CDisplayWindow : public QMainWindow, public CPointers {
+class CDisplayWindow : public QMainWindow, public CPointers
+{
Q_OBJECT
public:
- enum WriteWindowType {
+ enum WriteWindowType
+ {
HTMLWindow = 1,
PlainTextWindow = 2
};
- /**
- * Insert the keyboard accelerators of this window into the given KAccel object.
- */
- // static void insertKeyboardActions( KAccel* const accel );
+ // Insert the keyboard accelerators of this window into the given KAccel object.
static void insertKeyboardActions( BtActionCollection* const a );
CMDIArea* mdi() const;
- /**
- * Returns the right window caption.
- */
+
+ // Returns the right window caption.
const QString windowCaption();
- /**
- * Returns the used modules as a QPtrList
- */
+
+ // Returns the used modules as a QPtrList
QList<CSwordModuleInfo*> modules();
- /**
- * Store the settings of this window in the given CProfileWindow object.
- */
+
+ // Store the settings of this window in the given CProfileWindow object.
virtual void storeProfileSettings( Profile::CProfileWindow* profileWindow ) = 0;
- /**
- * Store the settings of this window in the given profile window.
- */
+
+ // Store the settings of this window in the given profile window.
virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow ) = 0;
- /**
- * Set the window caption.
- */
+
+ // Set the window caption.
virtual void setCaption( const QString& );
- /**
- * Sets the new filter options of this window.
- */
+
+ // Sets the new filter options of this window.
void setFilterOptions( CSwordBackend::FilterOptions& filterOptions );
- /**
- * Sets the new display options for this window.
- */
+
+ // Sets the new display options for this window.
void setDisplayOptions( const CSwordBackend::DisplayOptions& displayOptions );
- /**
- * Returns the display options used by this display window.
- */
+
+ // Returns the display options used by this display window.
CSwordBackend::DisplayOptions& displayOptions();
- /**
- * Returns the filter options used by this window.
- */
+
+ // Returns the filter options used by this window.
CSwordBackend::FilterOptions& filterOptions();
- /**
- * Set the ready status
- */
+
+ // Set the ready status
void setReady( const bool& ready );
- /**
- * Returns true if the widget is ready for use.
- */
+
+ // Returns true if the widget is ready for use.
bool isReady() const;
- /**
- * Returns true if the window may be closed.
- */
+
+ // Returns true if the window may be closed.
virtual bool queryClose();
- /**
- * Returns the keychooser widget of this display window.
- */
+
+ // Returns the keychooser widget of this display window.
CKeyChooser* keyChooser() const;
- /**
- * Sets the new sword key.
- */
+
+ // Sets the new sword key.
void setKey( CSwordKey* key );
- /**
- * Returns the key of this display window.
- */
+
+ // Returns the key of this display window.
CSwordKey* key() const;
- /**
- * Initialize the window. Call this method from the outside, because calling this in the constructor is not possible!
- */
+
+ // Initialize the window. Call this method from the outside, because calling this in the constructor is not possible!
virtual bool init();
- /**
- * Sets the main toolbar.
- */
+
+ // Sets the main toolbar.
void setMainToolBar( QToolBar* bar );
- /**
- * Sets the buttons toolbar.
- */
+
+ // Sets the buttons toolbar.
void setButtonsToolBar( QToolBar* bar );
- /**
- * Returns the main toolbar.
- */
+
+ // Returns the main toolbar.
QToolBar* mainToolBar() const;
- /**
- * Returns the buttons toolbar.
- */
+
+ // Returns the buttons toolbar.
QToolBar* buttonsToolBar() const;
- /**
- * Initialize the toolbars
- */
+
+ // Initialize the toolbars
virtual void initToolbars() = 0;
- /**
- * Returns the display settings button
- */
+
+ // Returns the display settings button
CDisplaySettingsButton* displaySettingsButton() const;
- /**
- * Sets the display settings button.
- */
+
+ // Sets the display settings button.
void setDisplaySettingsButton( CDisplaySettingsButton* button );
+
virtual void setupPopupMenu() = 0;
- /**
- * Returns the display widget used by this implementation of CDisplayWindow.
- */
+
+ // Returns the display widget used by this implementation of CDisplayWindow.
virtual CDisplay* displayWidget() const;
- /**
- * Sets the display widget used by this display window.
- */
+
+ // Sets the display widget used by this display window.
virtual void setDisplayWidget( CDisplay* newDisplay );
- /** Returns whether syncs to the active window are allowed at this time for this display window
- * @return boolean value whether sync is allowed
- */
- virtual bool syncAllowed() const {
+ // Returns whether syncs to the active window are allowed at this time for this display window
+ // @return boolean value whether sync is allowed
+ virtual bool syncAllowed() const
+ {
return false;
};
BtActionCollection* actionCollection();
public slots:
- /**
- * Lookup the specified key in the given module. If the module is not chosen withing
- * this display window create a new displaywindow with the right module in it.
- */
+
+ // Lookup the specified key in the given module. If the module is not chosen withing
+ // this display window create a new displaywindow with the right module in it.
virtual void lookupModKey( const QString& module, const QString& key );
- /**
- * Lookup the key in the chosen modules.
- */
+
+ // Lookup the key in the chosen modules.
virtual void lookupKey( const QString& key );
- /**
- * Refresh the settings of this window.
- */
+
+ // Refresh the settings of this window.
virtual void reload(CSwordBackend::SetupChangedReason reason);
protected:
@@ -188,55 +158,48 @@ protected:
CDisplayWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent);
virtual ~CDisplayWindow();
- /**
- * Initializes the intern keyboard actions.
- */
+
+ // Initializes the intern keyboard actions.
virtual void initActions();
- /**
- * Sets the keychooser widget for this display window.
- */
+
+ // Sets the keychooser widget for this display window.
void setKeyChooser( CKeyChooser* ck );
- /**
- * Returns the module chooser bar.
- */
+
+ // Returns the module chooser bar.
CModuleChooserBar* moduleChooserBar() const;
- /**
- * Lookup the given key.
- */
+
+ // Lookup the given key.
virtual void lookupSwordKey( CSwordKey* ) = 0;
- /**
- * Sets the module chooser bar.
- */
+
+ // Sets the module chooser bar.
void setModuleChooserBar( CModuleChooserBar* bar );
- /**
- * Sets the modules.
- */
+
+ // Sets the modules.
void setModules( const QList<CSwordModuleInfo*>& modules );
- /**
- * Initializes the signal / slot connections of this display window.
- */
+
+ // Initializes the signal / slot connections of this display window.
virtual void initConnections() = 0;
- /**
- * Initialize the view of this display window.
- */
+
+ // Initialize the view of this display window.
virtual void initView() = 0;
- /**
- * Returns the installed popup menu.
- */
+
+ // Returns the installed popup menu.
QMenu* popup();
+
virtual void closeEvent(QCloseEvent* e);
protected slots:
virtual void modulesChanged();
- /**
- * Lookup the current key. Used to refresh the display.
- */
+
+ // Lookup the current key. Used to refresh the display.
void lookup();
+
virtual void updatePopupMenu();
void slotSearchInModules();
void printAll();
+
void printAnchorWithText();
diff --git a/src/frontend/displaywindow/clexiconreadwindow.cpp b/src/frontend/displaywindow/clexiconreadwindow.cpp
index 703e40c..8ceb326 100644
--- a/src/frontend/displaywindow/clexiconreadwindow.cpp
+++ b/src/frontend/displaywindow/clexiconreadwindow.cpp
@@ -2,24 +2,19 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-
-
//BibleTime includes
#include "clexiconreadwindow.h"
#include "btactioncollection.h"
-
#include "cmodulechooserbar.h"
#include "cbuttons.h"
#include "bttoolbarpopupaction.h"
-
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordldkey.h"
-
#include "backend/config/cbtconfig.h"
#include "frontend/cexportmanager.h"
#include "frontend/display/cdisplay.h"
@@ -27,7 +22,6 @@
#include "frontend/display/bthtmlreaddisplay.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/keychooser/bthistory.h"
-
#include "util/ctoolclass.h"
#include "util/cresmgr.h"
#include "util/directoryutil.h"
@@ -46,31 +40,43 @@ CLexiconReadWindow::CLexiconReadWindow(QList<CSwordModuleInfo*> moduleList, CMDI
setKey( CSwordKey::createInstance(moduleList.first()) );
}
-CLexiconReadWindow::~CLexiconReadWindow() {}
+CLexiconReadWindow::~CLexiconReadWindow()
+{
+}
void CLexiconReadWindow::insertKeyboardActions( BtActionCollection* const a )
{
qDebug("CLexiconReadWindow::insertKeyboardActions");
- QAction* kaction;
- kaction = new QAction( tr("Next entry"), a);
- kaction->setShortcut(CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
- a->addAction("nextEntry", kaction);
-
- kaction = new QAction( tr("Previous entry"), a);
- kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel);
- a->addAction("previousEntry", kaction);
+ QAction* qaction;
+ qaction = new QAction( tr("Next entry"), a);
+ qaction->setShortcut(CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
+ a->addAction("nextEntry", qaction);
+
+ qaction = new QAction( tr("Previous entry"), a);
+ qaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel);
+ a->addAction("previousEntry", qaction);
- kaction = new QAction(tr("Copy reference only"), a);
- a->addAction("copyReferenceOnly", kaction);
+ qaction = new QAction(tr("Copy reference only"), a);
+ a->addAction("copyReferenceOnly", qaction);
+
+ qaction = new QAction(tr("Save entry as HTML"), a);
+ a->addAction("saveHtml", qaction);
- kaction = new QAction(tr("Copy selected text"), a);
- a->addAction("copySelectedText", kaction);
+ qaction = new QAction(tr("Print reference only"), a);
+ a->addAction("printReferenceOnly", qaction);
- kaction = new QAction(tr("Save entry as HTML"), a);
- a->addAction("saveHtml", kaction);
+ qaction = new QAction(tr("Entry with text"), a);
+ a->addAction("copyEntryWithText", qaction);
- kaction = new QAction(tr("Print reference only"), a);
- a->addAction("printReferenceOnly", kaction);
+ qaction = new QAction(tr("Entry as plain text"), a);
+ a->addAction("saveEntryAsPlain", qaction);
+
+ qaction = new QAction(tr("Entry with text"), a);
+ a->addAction("printEntryWithText", qaction);
+
+ qaction = new QAction( /* QIcon(CResMgr::displaywindows::general::findStrongs::icon), */ tr("Strong's Search"), a);
+ qaction->setShortcut(CResMgr::displaywindows::general::findStrongs::accel);
+ a->addAction(CResMgr::displaywindows::general::findStrongs::actionName, qaction);
}
void CLexiconReadWindow::initActions()
@@ -78,74 +84,69 @@ void CLexiconReadWindow::initActions()
qDebug("CLexiconReadWindow::initActions");
BtActionCollection* ac = actionCollection();
- CLexiconReadWindow::insertKeyboardActions(ac);
CReadWindow::initActions();
+ CLexiconReadWindow::insertKeyboardActions(ac);
m_actions.backInHistory = dynamic_cast<BtToolBarPopupAction*>(
ac->action(CResMgr::displaywindows::general::backInHistory::actionName) );
Q_ASSERT(m_actions.backInHistory);
+ addAction(m_actions.backInHistory);
m_actions.forwardInHistory = dynamic_cast<BtToolBarPopupAction*>(
ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName) );
Q_ASSERT(m_actions.forwardInHistory);
+ addAction(m_actions.forwardInHistory);
- QAction* kaction;
+ QAction* qaction;
- kaction = new QAction(tr("Next entry"), ac );
- kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
- QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) );
- ac->addAction("nextEntry", kaction);
+ qaction = ac->action("nextEntry");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) );
+ addAction(qaction);
- kaction = new QAction(tr("Previous entry"), ac );
- kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel);
- QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) );
- ac->addAction("previousEntry", kaction);
+ qaction = ac->action("previousEntry");
+ QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) );
+ addAction(qaction);
- m_actions.selectAll = qobject_cast<QAction*>(ac->action("selectAll"));
- //TODO: Q_ASSERT(m_actions.selectAll);
+ m_actions.selectAll = ac->action("selectAll");
+ Q_ASSERT(m_actions.selectAll);
- m_actions.findText = qobject_cast<QAction*>(ac->action("findText"));
- //TODO: Q_ASSERT(m_actions.findText);
+ m_actions.findText = ac->action("findText");
+ Q_ASSERT(m_actions.findText);
- m_actions.findStrongs = new QAction(
-// QIcon(CResMgr::displaywindows::general::findStrongs::icon),
- tr("Strong's Search"),
- ac
- );
- m_actions.findStrongs->setShortcut(CResMgr::displaywindows::general::findStrongs::accel);
+ m_actions.findStrongs = ac->action(CResMgr::displaywindows::general::findStrongs::actionName);
QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) );
- ac->addAction(CResMgr::displaywindows::general::findStrongs::actionName, m_actions.findStrongs);
+ addAction(m_actions.findStrongs);
- m_actions.copy.reference = new QAction(tr("Reference only"), ac );
+ m_actions.copy.reference = ac->action("copyReferenceOnly");
QObject::connect(m_actions.copy.reference, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()) );
- ac->addAction("copyReferenceOnly", m_actions.copy.reference);
+ addAction(m_actions.copy.reference);
- m_actions.copy.entry = new QAction(tr("Entry with text"), ac );
+ m_actions.copy.entry = ac->action("copyEntryWithText");
QObject::connect(m_actions.copy.entry, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAll()) );
- ac->addAction("copyEntryWithText", m_actions.copy.entry);
+ addAction(m_actions.copy.entry);
Q_ASSERT(ac->action("copySelectedText"));
- m_actions.copy.selectedText = qobject_cast<QAction*>(ac->action("copySelectedText"));
+ m_actions.copy.selectedText = ac->action("copySelectedText");
m_actions.save.entryAsPlain = new QAction(tr("Entry as plain text"), ac );
QObject::connect(m_actions.save.entryAsPlain, SIGNAL(triggered()), this, SLOT(saveAsPlain()) );
- ac->addAction("saveEntryAsPlain", m_actions.save.entryAsPlain);
+ addAction(m_actions.save.entryAsPlain);
- m_actions.save.entryAsHTML = new QAction(tr("Entry as HTML"), ac );
+ m_actions.save.entryAsHTML = ac->action("saveHtml");
QObject::connect(m_actions.save.entryAsHTML, SIGNAL(triggered()), this, SLOT(saveAsHTML()));
- ac->addAction("saveEntryAsHTML", m_actions.save.entryAsHTML);
+ addAction(m_actions.save.entryAsHTML);
- m_actions.print.reference = new QAction(tr("Reference only"), ac);
+ m_actions.print.reference = ac->action("printReferenceOnly");
QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()));
- ac->addAction("printReferenceOnly", m_actions.print.reference);
+ addAction(m_actions.print.reference);
- m_actions.print.entry = new QAction(tr("Entry with text"), ac);
+ m_actions.print.entry = ac->action("printEntryWithText");
QObject::connect(m_actions.print.entry, SIGNAL(triggered()), this, SLOT(printAll()));
- ac->addAction("printEntryWithText", m_actions.print.entry);
+ addAction(m_actions.print.entry);
// init with the user defined settings
qDebug("call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions");
-// CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
+ CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
}
/** No descriptions */
@@ -273,6 +274,13 @@ void CLexiconReadWindow::updatePopupMenu()
m_actions.print.reference->setEnabled( ((CReadDisplay*)displayWidget())->hasActiveAnchor() );
}
+void CLexiconReadWindow::reload(CSwordBackend::SetupChangedReason reason)
+{
+ CReadWindow::reload(reason);
+
+ CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, actionCollection());
+}
+
/** No descriptions */
void CLexiconReadWindow::nextEntry()
{
@@ -306,7 +314,8 @@ void CLexiconReadWindow::saveRawHTML()
QFile file(savefilename);
BtHtmlReadDisplay* disp = dynamic_cast<BtHtmlReadDisplay*>(displayWidget());
if (disp) {
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ {
qDebug("could not open file");
return;
}
@@ -337,7 +346,8 @@ void CLexiconReadWindow::slotFillBackHistory()
//TODO: take the history list and fill the menu
QListIterator<QAction*> it(keyChooser()->history()->getBackList());
- while (it.hasNext()) {
+ while (it.hasNext())
+ {
menu->addAction(it.next());
}
}
@@ -350,7 +360,8 @@ void CLexiconReadWindow::slotFillForwardHistory()
menu->clear();
//TODO: take the history list and fill the menu using addAction
QListIterator<QAction*> it(keyChooser()->history()->getFwList());
- while (it.hasNext()) {
+ while (it.hasNext())
+ {
menu->addAction(it.next());
}
}
diff --git a/src/frontend/displaywindow/clexiconreadwindow.h b/src/frontend/displaywindow/clexiconreadwindow.h
index cea9096..45e9ceb 100644
--- a/src/frontend/displaywindow/clexiconreadwindow.h
+++ b/src/frontend/displaywindow/clexiconreadwindow.h
@@ -2,13 +2,12 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-
#ifndef CLEXICONREADWINDOW_H
#define CLEXICONREADWINDOW_H
@@ -16,11 +15,8 @@
#include "creadwindow.h"
#include "frontend/keychooser/ckeychooser.h"
class BtToolBarPopupAction;
-
class CSwordKey;
class CSwordLDKey;
-
-class KToolBarPopupAction;
class BtActionCollection;
class QAction;
class QMenu;
@@ -48,6 +44,12 @@ public:
// static void insertKeyboardActions( KAccel* a );
static void insertKeyboardActions( BtActionCollection* const a );
+public slots:
+ /**
+ * Refreshes the content of this display window and the content of the keychooser.
+ */
+ virtual void reload(CSwordBackend::SetupChangedReason reason);
+
protected:
virtual void initActions();
virtual void initToolbars();