00001 /* 00002 Dagger - A Bible study program utilizing the Sword library. 00003 Copyright (c) 2004 Dan Williams <drw@handhelds.org> 00004 00005 This file is free software; you can redistribute it and/or modify it under 00006 the terms of the GNU General Public License as published by the Free Software 00007 Foundation; either version 2 of the License, or (at your option) any later version. 00008 00009 This file is distributed in the hope that it will be useful, but WITHOUT ANY 00010 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00011 PARTICULAR PURPOSE. See the GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with this 00014 file; see the file COPYING. If not, write to the Free Software Foundation, Inc., 00015 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 */ 00017 00018 #ifndef MAINWINDOW_H 00019 #define MAINWINDOW_H 00020 00021 #include "swordoptionlist.h" 00022 00023 #include <opie2/otabwidget.h> 00024 00025 #include <qpe/config.h> 00026 00027 #include <qmainwindow.h> 00028 #include <qtimer.h> 00029 00030 #include <swmgr.h> 00031 00032 class QAction; 00033 class QMenuBar; 00034 class QPixmap; 00035 class QToolBar; 00036 00037 class NavBar; 00038 class SearchBar; 00039 00040 class MainWindow : public QMainWindow 00041 { 00042 Q_OBJECT 00043 00044 public: 00045 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 00046 ~MainWindow(); 00047 00048 static QString appName() { return QString::fromLatin1( "dagger" ); }; 00049 00050 protected: 00051 bool eventFilter( QObject *obj, QEvent *event ); 00052 00053 private: 00054 sword::SWMgr *m_swordMgr; // Sword library module manager 00055 Config m_config; // Application configuration 00056 00057 // Configuration items 00058 QString m_modulePath; // Directory where sword modules are located 00059 bool m_alwaysOpenNew; // Whether or not open modules as new window/tab (or re-use existing) 00060 int m_numVerses; // Number of verses to display at a time for Bible modules 00061 bool m_disableScreenBlank; // Whether or not to disable automatic screen blanking 00062 int m_copyFormat; // Format used when copying 00063 QFont m_textFont; // Font used for module text 00064 00065 // UI components 00066 QToolBar *m_barDock; // Main toolbar which contains menu and all other toolbars 00067 QMenuBar *m_menuBar; // Application menu bar 00068 QPopupMenu *m_bookmarkMenu; // Pointer to bookmark menu 00069 NavBar *m_navToolbar; // Text navigation toolbar 00070 SearchBar *m_searchToolbar; // Text search toolbar 00071 Opie::Ui::OTabWidget m_tabs; // Main widget in which all texts, notes, etc. will be displayed 00072 00073 // Other visual items 00074 QPixmap *m_bibleIcon; // Icon used for bible modules 00075 QPixmap *m_commentaryIcon; // Icon used for commentary modules 00076 QPixmap *m_lexiconIcon; // Icon used for lexicon modules 00077 00078 QTimer m_autoScrollTimer; // Timer for auto-scrolling of bible texts 00079 00080 // Menubar/toolbar actions 00081 SwordOptionList m_actionSwordOpts; // List of actions for sword options 00082 // (e.g. footnotes, Strong's numbers, etc.) 00083 QAction *m_actionTextClose; // Action for closing currently opened module 00084 QAction *m_actionEditCopy; // Action for copying text from current module 00085 QAction *m_actionBookmarkAdd; // Action for adding a bookmark 00086 QAction *m_actionBookmarkRemove; // Action for removing a bookmark 00087 QAction *m_actionViewNavToolbar; // Action for displaying/hiding the navigation toolbar 00088 QAction *m_actionViewSearchToolbar; // Action for displaying/hiding the search toolbar 00089 00090 void initUI(); 00091 void openModule( const QString &modulename, const QString &key = 0x0 ); 00092 int findBookmark( const QString &bookmark ); 00093 void enableScreenBlanking( bool enable ); 00094 00095 private slots: 00096 void initConfig(); 00097 00098 void slotTextDisplayed( QWidget *textWidget ); 00099 00100 // Menubar/toolbar action slots 00101 void slotTextOpen(); 00102 void slotTextClose(); 00103 void slotTextInstall(); 00104 void slotEditCopy(); 00105 void slotEditConfigure(); 00106 void slotBookmarkAdd(); 00107 void slotBookmarkRemove(); 00108 void slotBookmarkSelected(); 00109 void slotViewSwordOption( bool enabled ); 00110 void slotViewNavToolbar( bool enabled ); 00111 void slotViewSearchToolbar( bool enabled ); 00112 00113 // Navigation toolbar slots 00114 void slotNavPrevPage(); 00115 void slotNavPrevVerse(); 00116 void slotNavKeyChanged( const QString &newKey ); 00117 void slotNavNextVerse(); 00118 void slotNavNextPage(); 00119 void slotNavAutoScroll( bool enabled ); 00120 void slotNavScrollRateChanged( int newRate ); 00121 00122 // Search toolbar slots 00123 void slotSearchResultClicked( const QString &key ); 00124 00125 // Text widget slots 00126 void slotTextRefClicked( const QString &ref ); 00127 00128 signals: 00129 void sigNumVersesChanged( int numVerses ); 00130 void sigFontChanged( const QFont *newFont ); 00131 void sigOptionChanged(); 00132 }; 00133 00134 #endif
1.4.2