diff options
Diffstat (limited to 'src/frontend/displaywindow/cdisplaywindow.h')
-rw-r--r-- | src/frontend/displaywindow/cdisplaywindow.h | 120 |
1 files changed, 86 insertions, 34 deletions
diff --git a/src/frontend/displaywindow/cdisplaywindow.h b/src/frontend/displaywindow/cdisplaywindow.h index b23d856..c54aab0 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-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. * **********/ @@ -11,10 +11,10 @@ #define CDISPLAYWINDOW_H #include <QMainWindow> -#include "util/cpointers.h" #include <QStringList> #include "backend/managers/cswordbackend.h" +#include "btglobal.h" #include "frontend/profile/cprofilewindow.h" @@ -23,29 +23,30 @@ class CDisplay; class BtDisplaySettingsButton; class CKeyChooser; class CMDIArea; -//class CModuleChooserBar; class BtModuleChooserBar; -class CReadWindow; class CSwordModuleInfo; -class CWriteWindow; class QCloseEvent; class QMenu; class QToolBar; - -/** The base class for all display windows of BibleTime. +class BTHistory; +class BibleTime; + +/** The base class for all display windows of BibleTime. + * + * Inherits QMainWindow. + * + * Inherited by CReadWindow and CWriteWindow. + * * @author The BibleTime team */ -class CDisplayWindow : public QMainWindow, public CPointers { +class CDisplayWindow : public QMainWindow { Q_OBJECT public: - enum WriteWindowType { - HTMLWindow = 1, - PlainTextWindow = 2 - }; /** Insert the keyboard accelerators of this window into the given actioncollection.*/ static void insertKeyboardActions( BtActionCollection* const a ); + /** Returns pointer to the mdi area object.*/ inline CMDIArea *mdi() const { return m_mdi; } @@ -54,7 +55,7 @@ class CDisplayWindow : public QMainWindow, public CPointers { const QString windowCaption(); /** Returns the used modules as a pointer list.*/ - QList<CSwordModuleInfo*> modules(); + const QList<const CSwordModuleInfo*> modules() const; /** Returns the used modules as a string list. */ inline const QStringList &getModuleList() const { @@ -64,16 +65,16 @@ class CDisplayWindow : public QMainWindow, public CPointers { /** 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.*/ + /** Load the settings the given CProfileWindow object into this window.*/ virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow ) = 0; /** Returns the display options used by this display window. */ - inline const CSwordBackend::DisplayOptions &displayOptions() const { + inline const DisplayOptions &displayOptions() const { return m_displayOptions; } /** Returns the filter options used by this window. */ - inline const CSwordBackend::FilterOptions &filterOptions() const { + inline const FilterOptions &filterOptions() const { return m_filterOptions; } @@ -88,6 +89,9 @@ class CDisplayWindow : public QMainWindow, public CPointers { /** Returns true if the window may be closed.*/ virtual bool queryClose(); + /** Returns history for this window */ + BTHistory* history(); + /** Returns the keychooser widget of this display window. */ inline CKeyChooser *keyChooser() const { return m_keyChooser; @@ -114,6 +118,9 @@ class CDisplayWindow : public QMainWindow, public CPointers { /** Sets and inits the properties of the tool buttons toolbar.*/ void setButtonsToolBar( QToolBar* bar ); + /** Sets and inits the properties of the format toolbar.*/ + void setFormatToolBar( QToolBar* bar ); + /** Returns the main navigation toolbar. */ inline QToolBar *mainToolBar() const { return m_mainToolBar; @@ -124,14 +131,14 @@ class CDisplayWindow : public QMainWindow, public CPointers { return m_buttonsToolBar; } + /** Returns the format toolbar. */ + inline QToolBar *formatToolBar() const { + return m_formatToolBar; + } + /** Initialize the toolbars.*/ virtual void initToolbars() = 0; - /** Returns the display settings button. */ - inline BtDisplaySettingsButton *displaySettingsButton() const { - return m_displaySettingsButton; - } - /** Sets the display settings button.*/ void setDisplaySettingsButton( BtDisplaySettingsButton* button ); @@ -154,6 +161,15 @@ class CDisplayWindow : public QMainWindow, public CPointers { return false; }; + /** + * Return pointer to the BibleTime main window + */ + BibleTime* btMainWindow(); + /** + * Called when this window is activated + */ + void windowActivated(); + inline BtActionCollection *actionCollection() const { return m_actionCollection; } @@ -167,6 +183,23 @@ class CDisplayWindow : public QMainWindow, public CPointers { void sigModuleRemoved(int index); /** The module list of window changed but backend list didn't.*/ void sigModuleListChanged(); + + /** + Signal emitted when display options are changed. + */ + void sigDisplayOptionsChanged(const DisplayOptions &displayOptions); + + /** + Signal emitted when display options are changed. + */ + void sigFilterOptionsChanged(const FilterOptions &filterOptions); + + /** signal for change of modules */ + void sigModulesChanged(const QList<const CSwordModuleInfo*> &modules); + + /** signal for sword key change */ + void sigKeyChanged(CSwordKey* key); + public slots: /** Receives a signal telling that a module should be added.*/ void slotAddModule(int index, QString module); @@ -188,6 +221,7 @@ class CDisplayWindow : public QMainWindow, public CPointers { void slotShowNavigator(bool show); void slotShowToolButtons(bool show); void slotShowModuleChooser(bool show); + void slotShowFormatToolBar(bool show); void slotShowHeader(bool show); protected: @@ -197,13 +231,17 @@ class CDisplayWindow : public QMainWindow, public CPointers { CDisplayWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent); virtual ~CDisplayWindow(); - /** Returns the display options used by this display window. */ - inline CSwordBackend::DisplayOptions &displayOptions() { + /** + \returns the display options used by this display window. + */ + inline DisplayOptions &displayOptions() { return m_displayOptions; } - /** Returns the filter options used by this window. */ - inline CSwordBackend::FilterOptions &filterOptions() { + /** + \returns the filter options used by this window. + */ + inline FilterOptions &filterOptions() { return m_filterOptions; } @@ -242,18 +280,31 @@ class CDisplayWindow : public QMainWindow, public CPointers { /** Returns the installed RMB popup menu.*/ QMenu* popup(); + /** Called to add actions to mainWindow toolbars */ + virtual void setupMainWindowToolBars() = 0; + virtual void closeEvent(QCloseEvent* e); + void setToolBarsHidden(); + void clearMainWindowToolBars(); + protected slots: - /** Sets the new filter options of this window.*/ - void setFilterOptions(const CSwordBackend::FilterOptions &filterOptions); + /** + Sets the new filter options of this window. + */ + void setFilterOptions(const FilterOptions &filterOptions); - /** Sets the new display options for this window.*/ - void setDisplayOptions(const CSwordBackend::DisplayOptions &displayOptions); + /** + Sets the new display options for this window. + */ + void setDisplayOptions(const DisplayOptions &displayOptions); virtual void modulesChanged(); - /** Lookup the current key. Used to refresh the display.*/ + /** + Lookup the current key. Used to refresh the display. This also needs to be called + after programmatically changing filter/display options. + */ void lookup(); virtual void updatePopupMenu(); @@ -270,22 +321,23 @@ class CDisplayWindow : public QMainWindow, public CPointers { BtActionCollection* m_actionCollection; CMDIArea* m_mdi; - //we may only cache the module names bacause after a backend relaod the pointers are invalid! + //we may only cache the module names bacause after a backend reload the pointers are invalid! QStringList m_modules; - CSwordBackend::FilterOptions m_filterOptions; - CSwordBackend::DisplayOptions m_displayOptions; + FilterOptions m_filterOptions; + DisplayOptions m_displayOptions; - BtDisplaySettingsButton* m_displaySettingsButton; CKeyChooser* m_keyChooser; CSwordKey* m_swordKey; bool m_isReady; BtModuleChooserBar* m_moduleChooserBar; QToolBar* m_mainToolBar; QToolBar* m_buttonsToolBar; + QToolBar* m_formatToolBar; QToolBar* m_headerBar; QMenu* m_popupMenu; CDisplay* m_displayWidget; + BTHistory* m_history; }; #endif |