author | drw <drw> | 2004-04-22 14:30:24 (UTC) |
---|---|---|
committer | drw <drw> | 2004-04-22 14:30:24 (UTC) |
commit | 00977d309bc991ffb4a84216881b53432c6d0b47 (patch) (unidiff) | |
tree | 7888656814ad09fb8930c198caadc56561687918 | |
parent | 162c71d6528515ea4b28520e9708c8ce9ca7fba2 (diff) | |
download | opie-00977d309bc991ffb4a84216881b53432c6d0b47.zip opie-00977d309bc991ffb4a84216881b53432c6d0b47.tar.gz opie-00977d309bc991ffb4a84216881b53432c6d0b47.tar.bz2 |
Fixed disabling of screen blanking, implemented prev/next page scrolling and fixed search OWait useage
-rw-r--r-- | noncore/apps/dagger/ChangeLog | 7 | ||||
-rw-r--r-- | noncore/apps/dagger/README | 2 | ||||
-rw-r--r-- | noncore/apps/dagger/TODO | 6 | ||||
-rw-r--r-- | noncore/apps/dagger/mainwindow.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/dagger/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/apps/dagger/navbar.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/dagger/navbar.h | 8 | ||||
-rw-r--r-- | noncore/apps/dagger/opie-dagger.control | 4 | ||||
-rw-r--r-- | noncore/apps/dagger/searchbar.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/dagger/textwidget.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/dagger/textwidget.h | 4 |
11 files changed, 50 insertions, 34 deletions
diff --git a/noncore/apps/dagger/ChangeLog b/noncore/apps/dagger/ChangeLog index feb9a19..108419e 100644 --- a/noncore/apps/dagger/ChangeLog +++ b/noncore/apps/dagger/ChangeLog | |||
@@ -1,4 +1,11 @@ | |||
1 | 2004-04-22 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Released version 0.9.1 | ||
4 | * Fixed the disabling of screen blanking | ||
5 | * Implement previous/next page scrolling | ||
6 | * Animate search OWait | ||
7 | |||
1 | 2004-04-06 Dan Williams <drw@handhelds.org> | 8 | 2004-04-06 Dan Williams <drw@handhelds.org> |
2 | 9 | ||
3 | * Released version 0.9.0 | 10 | * Released version 0.9.0 |
4 | * Initial check-in of new application | 11 | * Initial check-in of new application |
diff --git a/noncore/apps/dagger/README b/noncore/apps/dagger/README index 4a4bb61..00e9eed 100644 --- a/noncore/apps/dagger/README +++ b/noncore/apps/dagger/README | |||
@@ -1,29 +1,29 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Dagger | 3 | /* Opie - Dagger |
4 | /* =============== | 4 | /* =============== |
5 | /* Version 0.9.0 | 5 | /* Version 0.9.1 |
6 | /* | 6 | /* |
7 | /* A Bible study/reader application | 7 | /* A Bible study/reader application |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | --------------------------------------------- | 11 | --------------------------------------------- |
12 | Release Notes for Opie-Dagger - April, 2004 | 12 | Release Notes for Opie-Dagger - April, 2004 |
13 | --------------------------------------------- | 13 | --------------------------------------------- |
14 | 14 | ||
15 | ====================== | 15 | ====================== |
16 | = To-do = | 16 | = To-do = |
17 | ====================== | 17 | ====================== |
18 | 18 | ||
19 | - See $OPIEDIR/noncore/apps/dagger/TODO for more info. | 19 | - See $OPIEDIR/noncore/apps/dagger/TODO for more info. |
20 | 20 | ||
21 | ====================== | 21 | ====================== |
22 | = Build = | 22 | = Build = |
23 | ====================== | 23 | ====================== |
24 | 24 | ||
25 | In order to build opie-dagger, libsword needs to be present on | 25 | In order to build opie-dagger, libsword needs to be present on |
26 | the build system along with the appropriate headers. | 26 | the build system along with the appropriate headers. |
27 | 27 | ||
28 | - libsword source (best to use version 1.5.x or greater): | 28 | - libsword source (best to use version 1.5.x or greater): |
29 | - http://www.crosswire.org/sword/ | 29 | - http://www.crosswire.org/sword/ |
diff --git a/noncore/apps/dagger/TODO b/noncore/apps/dagger/TODO index 2548dd3..1530bd6 100644 --- a/noncore/apps/dagger/TODO +++ b/noncore/apps/dagger/TODO | |||
@@ -1,27 +1,25 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Dagger | 3 | /* Opie - Dagger |
4 | /* =============== | 4 | /* =============== |
5 | /* Version 0.9.0 | 5 | /* Version 0.9.1 |
6 | /* | 6 | /* |
7 | /* A Bible study/reader application | 7 | /* A Bible study/reader application |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | ------------------------------------ | 11 | ------------------------------------ |
12 | To-do for Opie-Dagger - April, 2004 | 12 | To-do for Opie-Dagger - April, 2004 |
13 | ------------------------------------ | 13 | ------------------------------------ |
14 | 14 | ||
15 | ====================== | 15 | ====================== |
16 | = Current release = | 16 | = Current release = |
17 | ====================== | 17 | ====================== |
18 | 18 | ||
19 | 1. Implement search function callback to animate OWait dialog | 19 | 1. Implement module installation |
20 | 2. Implement previous/next page scrolling | ||
21 | 3. Fix disablement of screen blanking | ||
22 | 20 | ||
23 | ====================== | 21 | ====================== |
24 | = Future releases = | 22 | = Future releases = |
25 | ====================== | 23 | ====================== |
26 | 24 | ||
27 | 1. Margin notes \ No newline at end of file | 25 | 1. Margin notes \ No newline at end of file |
diff --git a/noncore/apps/dagger/mainwindow.cpp b/noncore/apps/dagger/mainwindow.cpp index ace8f36..b2e00e8 100644 --- a/noncore/apps/dagger/mainwindow.cpp +++ b/noncore/apps/dagger/mainwindow.cpp | |||
@@ -52,48 +52,51 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | |||
52 | 52 | ||
53 | // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.) | 53 | // Retrieve list of available Sword module options (e.g. footnotes, Strong's numbers, etc.) |
54 | sword::OptionsList swordOpts = m_swordMgr->getGlobalOptions(); | 54 | sword::OptionsList swordOpts = m_swordMgr->getGlobalOptions(); |
55 | for ( sword::OptionsList::iterator it = swordOpts.begin(); it != swordOpts.end(); it++ ) | 55 | for ( sword::OptionsList::iterator it = swordOpts.begin(); it != swordOpts.end(); it++ ) |
56 | m_actionSwordOpts.append( new QAction( (*it).c_str(), QString::null, 0, this, 0 ) ); | 56 | m_actionSwordOpts.append( new QAction( (*it).c_str(), QString::null, 0, this, 0 ) ); |
57 | m_actionSwordOpts.sort(); | 57 | m_actionSwordOpts.sort(); |
58 | 58 | ||
59 | // Initialize user interface | 59 | // Initialize user interface |
60 | setCaption( tr( "Dagger" ) ); | 60 | setCaption( tr( "Dagger" ) ); |
61 | initUI(); | 61 | initUI(); |
62 | 62 | ||
63 | connect( &m_tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT( slotTextDisplayed(QWidget *)) ); | 63 | connect( &m_tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT( slotTextDisplayed(QWidget *)) ); |
64 | connect( &m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotNavNextVerse()) ); | 64 | connect( &m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotNavNextVerse()) ); |
65 | 65 | ||
66 | m_bibleIcon = new QPixmap( Resource::loadPixmap( "dagger/bibletext" ) ); | 66 | m_bibleIcon = new QPixmap( Resource::loadPixmap( "dagger/bibletext" ) ); |
67 | m_commentaryIcon = new QPixmap( Resource::loadPixmap( "dagger/commentary" ) ); | 67 | m_commentaryIcon = new QPixmap( Resource::loadPixmap( "dagger/commentary" ) ); |
68 | m_lexiconIcon = new QPixmap( Resource::loadPixmap( "dagger/lexicon" ) ); | 68 | m_lexiconIcon = new QPixmap( Resource::loadPixmap( "dagger/lexicon" ) ); |
69 | 69 | ||
70 | // Load initial configuration | 70 | // Load initial configuration |
71 | QTimer::singleShot( 100, this, SLOT( initConfig() ) ); | 71 | QTimer::singleShot( 100, this, SLOT( initConfig() ) ); |
72 | } | 72 | } |
73 | 73 | ||
74 | MainWindow::~MainWindow() | 74 | MainWindow::~MainWindow() |
75 | { | 75 | { |
76 | // Re-enable screen blanking if it was disabled | ||
77 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
78 | |||
76 | // Save Sword options | 79 | // Save Sword options |
77 | m_config.setGroup( "Sword" ); | 80 | m_config.setGroup( "Sword" ); |
78 | m_config.writeEntry( "ModPath", m_modulePath ); | 81 | m_config.writeEntry( "ModPath", m_modulePath ); |
79 | 82 | ||
80 | for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) | 83 | for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) |
81 | m_config.writeEntry( a->text(), a->isOn() ); | 84 | m_config.writeEntry( a->text(), a->isOn() ); |
82 | 85 | ||
83 | // Save configuration options | 86 | // Save configuration options |
84 | m_config.setGroup( "Config" ); | 87 | m_config.setGroup( "Config" ); |
85 | m_config.writeEntry( "AlwaysOpenNew", m_alwaysOpenNew ); | 88 | m_config.writeEntry( "AlwaysOpenNew", m_alwaysOpenNew ); |
86 | m_config.writeEntry( "AutoScroll", m_navToolbar->autoScrollRate() ); | 89 | m_config.writeEntry( "AutoScroll", m_navToolbar->autoScrollRate() ); |
87 | m_config.writeEntry( "DisableScreenBlanking", m_disableScreenBlank ); | 90 | m_config.writeEntry( "DisableScreenBlanking", m_disableScreenBlank ); |
88 | m_config.writeEntry( "CopyFormat", m_copyFormat ); | 91 | m_config.writeEntry( "CopyFormat", m_copyFormat ); |
89 | m_config.writeEntry( "NavBar", m_actionViewNavToolbar->isOn() ); | 92 | m_config.writeEntry( "NavBar", m_actionViewNavToolbar->isOn() ); |
90 | m_config.writeEntry( "NumVerses", m_numVerses ); | 93 | m_config.writeEntry( "NumVerses", m_numVerses ); |
91 | m_config.writeEntry( "SearchBar", m_actionViewSearchToolbar->isOn() ); | 94 | m_config.writeEntry( "SearchBar", m_actionViewSearchToolbar->isOn() ); |
92 | 95 | ||
93 | // Save text font | 96 | // Save text font |
94 | m_config.setGroup( "Font"); | 97 | m_config.setGroup( "Font"); |
95 | m_config.writeEntry( "Family", m_textFont.family() ); | 98 | m_config.writeEntry( "Family", m_textFont.family() ); |
96 | m_config.writeEntry( "Italic", m_textFont.italic() ); | 99 | m_config.writeEntry( "Italic", m_textFont.italic() ); |
97 | m_config.writeEntry( "Size", m_textFont.pointSize() ); | 100 | m_config.writeEntry( "Size", m_textFont.pointSize() ); |
98 | m_config.writeEntry( "Weight", m_textFont.weight() ); | 101 | m_config.writeEntry( "Weight", m_textFont.weight() ); |
99 | 102 | ||
@@ -148,53 +151,53 @@ bool MainWindow::eventFilter( QObject *obj, QEvent *event ) | |||
148 | { | 151 | { |
149 | slotNavNextVerse(); | 152 | slotNavNextVerse(); |
150 | return true; | 153 | return true; |
151 | } | 154 | } |
152 | } | 155 | } |
153 | 156 | ||
154 | return QWidget::eventFilter( obj, event ); | 157 | return QWidget::eventFilter( obj, event ); |
155 | } | 158 | } |
156 | 159 | ||
157 | void MainWindow::initUI() | 160 | void MainWindow::initUI() |
158 | { | 161 | { |
159 | setCentralWidget( &m_tabs ); | 162 | setCentralWidget( &m_tabs ); |
160 | m_tabs.installEventFilter( this ); | 163 | m_tabs.installEventFilter( this ); |
161 | 164 | ||
162 | setToolBarsMovable( false ); | 165 | setToolBarsMovable( false ); |
163 | m_barDock = new QToolBar( this ); | 166 | m_barDock = new QToolBar( this ); |
164 | m_barDock->setHorizontalStretchable( true ); | 167 | m_barDock->setHorizontalStretchable( true ); |
165 | 168 | ||
166 | m_menuBar = new QMenuBar( m_barDock ); | 169 | m_menuBar = new QMenuBar( m_barDock ); |
167 | m_menuBar->setMargin( 0 ); | 170 | m_menuBar->setMargin( 0 ); |
168 | 171 | ||
169 | // Allocate toolbars | 172 | // Allocate toolbars |
170 | m_navToolbar = new NavBar( this ); | 173 | m_navToolbar = new NavBar( this ); |
171 | m_navToolbar->navBtnsEnable( false ); | 174 | m_navToolbar->navBtnsEnable( false ); |
172 | connect( m_navToolbar, SIGNAL(prevChapter()), this, SLOT(slotNavPrevChapter()) ); | 175 | connect( m_navToolbar, SIGNAL(prevPage()), this, SLOT(slotNavPrevPage()) ); |
173 | connect( m_navToolbar, SIGNAL(prevVerse()), this, SLOT(slotNavPrevVerse()) ); | 176 | connect( m_navToolbar, SIGNAL(prevVerse()), this, SLOT(slotNavPrevVerse()) ); |
174 | connect( m_navToolbar, SIGNAL(keyChanged(const QString &)), this, SLOT(slotNavKeyChanged(const QString &)) ); | 177 | connect( m_navToolbar, SIGNAL(keyChanged(const QString &)), this, SLOT(slotNavKeyChanged(const QString &)) ); |
175 | connect( m_navToolbar, SIGNAL(nextVerse()), this, SLOT(slotNavNextVerse()) ); | 178 | connect( m_navToolbar, SIGNAL(nextVerse()), this, SLOT(slotNavNextVerse()) ); |
176 | connect( m_navToolbar, SIGNAL(nextChapter()), this, SLOT(slotNavNextChapter()) ); | 179 | connect( m_navToolbar, SIGNAL(nextPage()), this, SLOT(slotNavNextPage()) ); |
177 | connect( m_navToolbar, SIGNAL(autoScroll(bool)), this, SLOT(slotNavAutoScroll(bool)) ); | 180 | connect( m_navToolbar, SIGNAL(autoScroll(bool)), this, SLOT(slotNavAutoScroll(bool)) ); |
178 | connect( m_navToolbar, SIGNAL(scrollRateChanged(int)), this, SLOT(slotNavScrollRateChanged(int)) ); | 181 | connect( m_navToolbar, SIGNAL(scrollRateChanged(int)), this, SLOT(slotNavScrollRateChanged(int)) ); |
179 | 182 | ||
180 | m_searchToolbar = new SearchBar( this ); | 183 | m_searchToolbar = new SearchBar( this ); |
181 | connect( m_searchToolbar, SIGNAL(sigResultClicked(const QString &)), this, SLOT(slotSearchResultClicked(const QString &)) ); | 184 | connect( m_searchToolbar, SIGNAL(sigResultClicked(const QString &)), this, SLOT(slotSearchResultClicked(const QString &)) ); |
182 | 185 | ||
183 | // Text menu | 186 | // Text menu |
184 | QPopupMenu *popup = new QPopupMenu( this ); | 187 | QPopupMenu *popup = new QPopupMenu( this ); |
185 | 188 | ||
186 | QAction *a = new QAction( tr( "Open..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 189 | QAction *a = new QAction( tr( "Open..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); |
187 | connect( a, SIGNAL(activated()), this, SLOT(slotTextOpen()) ); | 190 | connect( a, SIGNAL(activated()), this, SLOT(slotTextOpen()) ); |
188 | a->addTo( popup ); | 191 | a->addTo( popup ); |
189 | 192 | ||
190 | m_actionTextClose = new QAction( tr( "Close" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 193 | m_actionTextClose = new QAction( tr( "Close" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
191 | connect( m_actionTextClose, SIGNAL(activated()), this, SLOT(slotTextClose()) ); | 194 | connect( m_actionTextClose, SIGNAL(activated()), this, SLOT(slotTextClose()) ); |
192 | m_actionTextClose->addTo( popup ); | 195 | m_actionTextClose->addTo( popup ); |
193 | 196 | ||
194 | popup->insertSeparator(); | 197 | popup->insertSeparator(); |
195 | 198 | ||
196 | // TODO - need to implent | 199 | // TODO - need to implent |
197 | a = new QAction( tr( "Install..." ), Resource::loadPixmap( "install" ), QString::null, 0, this, 0 ); | 200 | a = new QAction( tr( "Install..." ), Resource::loadPixmap( "install" ), QString::null, 0, this, 0 ); |
198 | a->setEnabled( false ); | 201 | a->setEnabled( false ); |
199 | connect( a, SIGNAL(activated()), this, SLOT(slotTextInstall()) ); | 202 | connect( a, SIGNAL(activated()), this, SLOT(slotTextInstall()) ); |
200 | a->addTo( popup ); | 203 | a->addTo( popup ); |
@@ -311,49 +314,49 @@ void MainWindow::openModule( const QString &modulename, const QString &key ) | |||
311 | 314 | ||
312 | // Set key if one is present | 315 | // Set key if one is present |
313 | if ( !key.isNull() ) | 316 | if ( !key.isNull() ) |
314 | tw->setKey( key ); | 317 | tw->setKey( key ); |
315 | } | 318 | } |
316 | } | 319 | } |
317 | } | 320 | } |
318 | 321 | ||
319 | int MainWindow::findBookmark( const QString &bookmark ) | 322 | int MainWindow::findBookmark( const QString &bookmark ) |
320 | { | 323 | { |
321 | int index = 3; | 324 | int index = 3; |
322 | int id = m_bookmarkMenu->idAt( index ); | 325 | int id = m_bookmarkMenu->idAt( index ); |
323 | while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) ) | 326 | while ( ( id != -1 ) && ( m_bookmarkMenu->text( id ) != bookmark ) ) |
324 | { | 327 | { |
325 | ++index; | 328 | ++index; |
326 | id = m_bookmarkMenu->idAt( index ); | 329 | id = m_bookmarkMenu->idAt( index ); |
327 | } | 330 | } |
328 | 331 | ||
329 | return id; | 332 | return id; |
330 | } | 333 | } |
331 | 334 | ||
332 | void MainWindow::enableScreenBlanking( bool enable ) | 335 | void MainWindow::enableScreenBlanking( bool enable ) |
333 | { | 336 | { |
334 | enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable | 337 | enable ? QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable |
335 | : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 338 | : QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
336 | } | 339 | } |
337 | 340 | ||
338 | void MainWindow::initConfig() | 341 | void MainWindow::initConfig() |
339 | { | 342 | { |
340 | bool show; | 343 | bool show; |
341 | 344 | ||
342 | m_config.setGroup( "Sword" ); | 345 | m_config.setGroup( "Sword" ); |
343 | for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) | 346 | for ( QAction *a = m_actionSwordOpts.first(); a; a = m_actionSwordOpts.next() ) |
344 | { | 347 | { |
345 | show = m_config.readBoolEntry( a->text(), false ); | 348 | show = m_config.readBoolEntry( a->text(), false ); |
346 | a->setOn( show ); | 349 | a->setOn( show ); |
347 | m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" ); | 350 | m_swordMgr->setGlobalOption ( a->text(), show ? "On" : "Off" ); |
348 | } | 351 | } |
349 | 352 | ||
350 | // Display/hide toolbars based on last run | 353 | // Display/hide toolbars based on last run |
351 | m_config.setGroup( "Config" ); | 354 | m_config.setGroup( "Config" ); |
352 | 355 | ||
353 | m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false ); | 356 | m_alwaysOpenNew = m_config.readBoolEntry( "AlwaysOpenNew", false ); |
354 | m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) ); | 357 | m_navToolbar->setAutoScrollRate( m_config.readNumEntry( "AutoScroll", 50 ) ); |
355 | m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false ); | 358 | m_disableScreenBlank = m_config.readBoolEntry( "DisableScreenBlanking", false ); |
356 | enableScreenBlanking( !m_disableScreenBlank ); | 359 | enableScreenBlanking( !m_disableScreenBlank ); |
357 | m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 ); | 360 | m_copyFormat = m_config.readNumEntry( "CopyFormat", 0 ); |
358 | 361 | ||
359 | show = m_config.readBoolEntry( "NavBar", false ); | 362 | show = m_config.readBoolEntry( "NavBar", false ); |
@@ -576,100 +579,100 @@ void MainWindow::slotBookmarkSelected() | |||
576 | openModule( module, key ); | 579 | openModule( module, key ); |
577 | } | 580 | } |
578 | } | 581 | } |
579 | 582 | ||
580 | void MainWindow::slotViewSwordOption( bool enabled ) | 583 | void MainWindow::slotViewSwordOption( bool enabled ) |
581 | { | 584 | { |
582 | const QAction *action = reinterpret_cast<const QAction*>(sender()); | 585 | const QAction *action = reinterpret_cast<const QAction*>(sender()); |
583 | m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" ); | 586 | m_swordMgr->setGlobalOption ( action->text(), enabled ? "On" : "Off" ); |
584 | 587 | ||
585 | emit sigOptionChanged(); | 588 | emit sigOptionChanged(); |
586 | } | 589 | } |
587 | 590 | ||
588 | void MainWindow::slotViewNavToolbar( bool enabled ) | 591 | void MainWindow::slotViewNavToolbar( bool enabled ) |
589 | { | 592 | { |
590 | enabled ? m_navToolbar->show() | 593 | enabled ? m_navToolbar->show() |
591 | : m_navToolbar->hide(); | 594 | : m_navToolbar->hide(); |
592 | } | 595 | } |
593 | 596 | ||
594 | void MainWindow::slotViewSearchToolbar( bool enabled ) | 597 | void MainWindow::slotViewSearchToolbar( bool enabled ) |
595 | { | 598 | { |
596 | enabled ? m_searchToolbar->show() | 599 | enabled ? m_searchToolbar->show() |
597 | : m_searchToolbar->hide(); | 600 | : m_searchToolbar->hide(); |
598 | } | 601 | } |
599 | 602 | ||
600 | void MainWindow::slotNavPrevChapter() | 603 | void MainWindow::slotNavPrevPage() |
601 | { | 604 | { |
602 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 605 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
603 | if ( text ) | 606 | if ( text ) |
604 | { | 607 | { |
605 | text->prevChapter(); | 608 | text->prevPage(); |
606 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 609 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
607 | m_navToolbar->setKey( text->getAbbrevKey() ); | 610 | m_navToolbar->setKey( text->getAbbrevKey() ); |
608 | } | 611 | } |
609 | } | 612 | } |
610 | 613 | ||
611 | void MainWindow::slotNavPrevVerse() | 614 | void MainWindow::slotNavPrevVerse() |
612 | { | 615 | { |
613 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 616 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
614 | if ( text ) | 617 | if ( text ) |
615 | { | 618 | { |
616 | text->prevVerse(); | 619 | text->prevVerse(); |
617 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 620 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
618 | m_navToolbar->setKey( text->getAbbrevKey() ); | 621 | m_navToolbar->setKey( text->getAbbrevKey() ); |
619 | } | 622 | } |
620 | } | 623 | } |
621 | 624 | ||
622 | void MainWindow::slotNavKeyChanged( const QString &newKey ) | 625 | void MainWindow::slotNavKeyChanged( const QString &newKey ) |
623 | { | 626 | { |
624 | QString key = newKey; | 627 | QString key = newKey; |
625 | key.replace( QRegExp( "[-=.]" ), ":" ); | 628 | key.replace( QRegExp( "[-=.]" ), ":" ); |
626 | 629 | ||
627 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 630 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
628 | if ( text ) | 631 | if ( text ) |
629 | { | 632 | { |
630 | text->setKey( key ); | 633 | text->setKey( key ); |
631 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 634 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
632 | } | 635 | } |
633 | } | 636 | } |
634 | 637 | ||
635 | void MainWindow::slotNavNextVerse() | 638 | void MainWindow::slotNavNextVerse() |
636 | { | 639 | { |
637 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 640 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
638 | if ( text ) | 641 | if ( text ) |
639 | { | 642 | { |
640 | text->nextVerse(); | 643 | text->nextVerse(); |
641 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 644 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
642 | m_navToolbar->setKey( text->getAbbrevKey() ); | 645 | m_navToolbar->setKey( text->getAbbrevKey() ); |
643 | } | 646 | } |
644 | } | 647 | } |
645 | 648 | ||
646 | void MainWindow::slotNavNextChapter() | 649 | void MainWindow::slotNavNextPage() |
647 | { | 650 | { |
648 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); | 651 | TextWidget *text = reinterpret_cast<TextWidget *>(m_tabs.currentWidget()); |
649 | if ( text ) | 652 | if ( text ) |
650 | { | 653 | { |
651 | text->nextChapter(); | 654 | text->nextPage(); |
652 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); | 655 | setCaption( QString( "%1 - Dagger" ).arg( text->getFullKey() ) ); |
653 | m_navToolbar->setKey( text->getAbbrevKey() ); | 656 | m_navToolbar->setKey( text->getAbbrevKey() ); |
654 | } | 657 | } |
655 | } | 658 | } |
656 | 659 | ||
657 | void MainWindow::slotNavAutoScroll( bool enabled ) | 660 | void MainWindow::slotNavAutoScroll( bool enabled ) |
658 | { | 661 | { |
659 | m_autoScrollTimer.stop(); | 662 | m_autoScrollTimer.stop(); |
660 | 663 | ||
661 | if ( enabled ) | 664 | if ( enabled ) |
662 | m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 ); | 665 | m_autoScrollTimer.start( m_navToolbar->autoScrollRate() * 100 ); |
663 | } | 666 | } |
664 | 667 | ||
665 | void MainWindow::slotNavScrollRateChanged( int newRate ) | 668 | void MainWindow::slotNavScrollRateChanged( int newRate ) |
666 | { | 669 | { |
667 | if ( m_autoScrollTimer.isActive() ) | 670 | if ( m_autoScrollTimer.isActive() ) |
668 | { | 671 | { |
669 | m_autoScrollTimer.stop(); | 672 | m_autoScrollTimer.stop(); |
670 | m_autoScrollTimer.start( newRate * 100 ); | 673 | m_autoScrollTimer.start( newRate * 100 ); |
671 | } | 674 | } |
672 | } | 675 | } |
673 | 676 | ||
674 | void MainWindow::slotSearchResultClicked( const QString &key ) | 677 | void MainWindow::slotSearchResultClicked( const QString &key ) |
675 | { | 678 | { |
diff --git a/noncore/apps/dagger/mainwindow.h b/noncore/apps/dagger/mainwindow.h index 0c7f3c8..b114e33 100644 --- a/noncore/apps/dagger/mainwindow.h +++ b/noncore/apps/dagger/mainwindow.h | |||
@@ -90,45 +90,45 @@ private: | |||
90 | void initUI(); | 90 | void initUI(); |
91 | void openModule( const QString &modulename, const QString &key = 0x0 ); | 91 | void openModule( const QString &modulename, const QString &key = 0x0 ); |
92 | int findBookmark( const QString &bookmark ); | 92 | int findBookmark( const QString &bookmark ); |
93 | void enableScreenBlanking( bool enable ); | 93 | void enableScreenBlanking( bool enable ); |
94 | 94 | ||
95 | private slots: | 95 | private slots: |
96 | void initConfig(); | 96 | void initConfig(); |
97 | 97 | ||
98 | void slotTextDisplayed( QWidget *textWidget ); | 98 | void slotTextDisplayed( QWidget *textWidget ); |
99 | 99 | ||
100 | // Menubar/toolbar action slots | 100 | // Menubar/toolbar action slots |
101 | void slotTextOpen(); | 101 | void slotTextOpen(); |
102 | void slotTextClose(); | 102 | void slotTextClose(); |
103 | void slotTextInstall(); | 103 | void slotTextInstall(); |
104 | void slotEditCopy(); | 104 | void slotEditCopy(); |
105 | void slotEditConfigure(); | 105 | void slotEditConfigure(); |
106 | void slotBookmarkAdd(); | 106 | void slotBookmarkAdd(); |
107 | void slotBookmarkRemove(); | 107 | void slotBookmarkRemove(); |
108 | void slotBookmarkSelected(); | 108 | void slotBookmarkSelected(); |
109 | void slotViewSwordOption( bool enabled ); | 109 | void slotViewSwordOption( bool enabled ); |
110 | void slotViewNavToolbar( bool enabled ); | 110 | void slotViewNavToolbar( bool enabled ); |
111 | void slotViewSearchToolbar( bool enabled ); | 111 | void slotViewSearchToolbar( bool enabled ); |
112 | 112 | ||
113 | // Navigation toolbar slots | 113 | // Navigation toolbar slots |
114 | void slotNavPrevChapter(); | 114 | void slotNavPrevPage(); |
115 | void slotNavPrevVerse(); | 115 | void slotNavPrevVerse(); |
116 | void slotNavKeyChanged( const QString &newKey ); | 116 | void slotNavKeyChanged( const QString &newKey ); |
117 | void slotNavNextVerse(); | 117 | void slotNavNextVerse(); |
118 | void slotNavNextChapter(); | 118 | void slotNavNextPage(); |
119 | void slotNavAutoScroll( bool enabled ); | 119 | void slotNavAutoScroll( bool enabled ); |
120 | void slotNavScrollRateChanged( int newRate ); | 120 | void slotNavScrollRateChanged( int newRate ); |
121 | 121 | ||
122 | // Search toolbar slots | 122 | // Search toolbar slots |
123 | void slotSearchResultClicked( const QString &key ); | 123 | void slotSearchResultClicked( const QString &key ); |
124 | 124 | ||
125 | // Text widget slots | 125 | // Text widget slots |
126 | void slotTextRefClicked( const QString &ref ); | 126 | void slotTextRefClicked( const QString &ref ); |
127 | 127 | ||
128 | signals: | 128 | signals: |
129 | void sigNumVersesChanged( int numVerses ); | 129 | void sigNumVersesChanged( int numVerses ); |
130 | void sigFontChanged( const QFont *newFont ); | 130 | void sigFontChanged( const QFont *newFont ); |
131 | void sigOptionChanged(); | 131 | void sigOptionChanged(); |
132 | }; | 132 | }; |
133 | 133 | ||
134 | #endif | 134 | #endif |
diff --git a/noncore/apps/dagger/navbar.cpp b/noncore/apps/dagger/navbar.cpp index 4781af0..212dc36 100644 --- a/noncore/apps/dagger/navbar.cpp +++ b/noncore/apps/dagger/navbar.cpp | |||
@@ -6,88 +6,88 @@ This file is free software; you can redistribute it and/or modify it under | |||
6 | the terms of the GNU General Public License as published by the Free Software | 6 | the terms of the GNU General Public License as published by the Free Software |
7 | Foundation; either version 2 of the License, or (at your option) any later version. | 7 | Foundation; either version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This file is distributed in the hope that it will be useful, but WITHOUT ANY | 9 | This file is distributed in the hope that it will be useful, but WITHOUT ANY |
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this | 13 | You should have received a copy of the GNU General Public License along with this |
14 | file; see the file COPYING. If not, write to the Free Software Foundation, Inc., | 14 | file; see the file COPYING. If not, write to the Free Software Foundation, Inc., |
15 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 15 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "navbar.h" | 18 | #include "navbar.h" |
19 | 19 | ||
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qaction.h> | 23 | #include <qaction.h> |
24 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
25 | 25 | ||
26 | NavBar::NavBar( QMainWindow *parent ) | 26 | NavBar::NavBar( QMainWindow *parent ) |
27 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) | 27 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) |
28 | { | 28 | { |
29 | // Initialize UI | 29 | // Initialize UI |
30 | m_actionPrevChapter = new QAction( tr( "Previous chapter" ), Resource::loadPixmap( "fastback" ), | 30 | m_actionPrevPage = new QAction( tr( "Previous page" ), Resource::loadPixmap( "fastback" ), |
31 | QString::null, 0, this, 0 ); | 31 | QString::null, 0, this, 0 ); |
32 | m_actionPrevChapter->addTo( this ); | 32 | m_actionPrevPage->addTo( this ); |
33 | connect( m_actionPrevChapter, SIGNAL(activated()), this, SIGNAL(prevChapter()) ); | 33 | connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) ); |
34 | 34 | ||
35 | m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ), | 35 | m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ), |
36 | QString::null, 0, this, 0 ); | 36 | QString::null, 0, this, 0 ); |
37 | m_actionPrevVerse->addTo( this ); | 37 | m_actionPrevVerse->addTo( this ); |
38 | connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); | 38 | connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); |
39 | 39 | ||
40 | m_key = new QLineEdit( this ); | 40 | m_key = new QLineEdit( this ); |
41 | setStretchableWidget( m_key ); | 41 | setStretchableWidget( m_key ); |
42 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); | 42 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); |
43 | 43 | ||
44 | m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ), | 44 | m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ), |
45 | QString::null, 0, this, 0 ); | 45 | QString::null, 0, this, 0 ); |
46 | m_actionNextVerse->addTo( this ); | 46 | m_actionNextVerse->addTo( this ); |
47 | connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); | 47 | connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); |
48 | 48 | ||
49 | m_actionNextChapter = new QAction( tr( "Next chapter" ), Resource::loadPixmap( "fastforward" ), | 49 | m_actionNextPage = new QAction( tr( "Next page" ), Resource::loadPixmap( "fastforward" ), |
50 | QString::null, 0, this, 0 ); | 50 | QString::null, 0, this, 0 ); |
51 | m_actionNextChapter->addTo( this ); | 51 | m_actionNextPage->addTo( this ); |
52 | connect( m_actionNextChapter, SIGNAL(activated()), this, SIGNAL(nextChapter()) ); | 52 | connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) ); |
53 | 53 | ||
54 | addSeparator(); | 54 | addSeparator(); |
55 | 55 | ||
56 | m_scrollRate = new QSpinBox( 1, 100, 1, this ); | 56 | m_scrollRate = new QSpinBox( 1, 100, 1, this ); |
57 | m_scrollRate->setMinimumWidth( 35 ); | 57 | m_scrollRate->setMinimumWidth( 35 ); |
58 | connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); | 58 | connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); |
59 | 59 | ||
60 | m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ), | 60 | m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ), |
61 | QString::null, 0, this, 0 ); | 61 | QString::null, 0, this, 0 ); |
62 | m_actionScroll->setToggleAction( true ); | 62 | m_actionScroll->setToggleAction( true ); |
63 | connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); | 63 | connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); |
64 | m_actionScroll->addTo( this ); | 64 | m_actionScroll->addTo( this ); |
65 | 65 | ||
66 | if ( parent ) | 66 | if ( parent ) |
67 | { | 67 | { |
68 | installEventFilter( parent ); | 68 | installEventFilter( parent ); |
69 | m_key->installEventFilter( parent ); | 69 | m_key->installEventFilter( parent ); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | void NavBar::navBtnsEnable( bool enabled ) | 73 | void NavBar::navBtnsEnable( bool enabled ) |
74 | { | 74 | { |
75 | m_actionPrevChapter->setEnabled( enabled ); | 75 | m_actionPrevPage->setEnabled( enabled ); |
76 | m_actionPrevVerse->setEnabled( enabled ); | 76 | m_actionPrevVerse->setEnabled( enabled ); |
77 | m_actionNextVerse->setEnabled( enabled ); | 77 | m_actionNextVerse->setEnabled( enabled ); |
78 | m_actionNextChapter->setEnabled( enabled ); | 78 | m_actionNextPage->setEnabled( enabled ); |
79 | m_scrollRate->setEnabled( enabled ); | 79 | m_scrollRate->setEnabled( enabled ); |
80 | m_actionScroll->setEnabled( enabled ); | 80 | m_actionScroll->setEnabled( enabled ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void NavBar::setKey( const QString &newKey ) | 83 | void NavBar::setKey( const QString &newKey ) |
84 | { | 84 | { |
85 | disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); | 85 | disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); |
86 | m_key->setText( newKey ); | 86 | m_key->setText( newKey ); |
87 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); | 87 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); |
88 | } | 88 | } |
89 | 89 | ||
90 | void NavBar::setAutoScrollRate( int scrollRate ) | 90 | void NavBar::setAutoScrollRate( int scrollRate ) |
91 | { | 91 | { |
92 | m_scrollRate->setValue( scrollRate ); | 92 | m_scrollRate->setValue( scrollRate ); |
93 | } | 93 | } |
diff --git a/noncore/apps/dagger/navbar.h b/noncore/apps/dagger/navbar.h index a37d6ff..0df2bf0 100644 --- a/noncore/apps/dagger/navbar.h +++ b/noncore/apps/dagger/navbar.h | |||
@@ -16,43 +16,43 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc., | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifndef NAVBAR_H | 18 | #ifndef NAVBAR_H |
19 | #define NAVBAR_H | 19 | #define NAVBAR_H |
20 | 20 | ||
21 | #include <qspinbox.h> | 21 | #include <qspinbox.h> |
22 | #include <qtoolbar.h> | 22 | #include <qtoolbar.h> |
23 | 23 | ||
24 | class QAction; | 24 | class QAction; |
25 | class QLineEdit; | 25 | class QLineEdit; |
26 | 26 | ||
27 | class NavBar : public QToolBar | 27 | class NavBar : public QToolBar |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | NavBar( QMainWindow *parent = 0x0 ); | 32 | NavBar( QMainWindow *parent = 0x0 ); |
33 | 33 | ||
34 | void navBtnsEnable( bool enabled ); | 34 | void navBtnsEnable( bool enabled ); |
35 | void setKey( const QString &newKey ); | 35 | void setKey( const QString &newKey ); |
36 | void setAutoScrollRate( int scrollRate ); | 36 | void setAutoScrollRate( int scrollRate ); |
37 | const int autoScrollRate() { return m_scrollRate->value(); } | 37 | const int autoScrollRate() { return m_scrollRate->value(); } |
38 | 38 | ||
39 | private: | 39 | private: |
40 | QAction *m_actionPrevChapter; // Action for going back 1 chapter | 40 | QAction *m_actionPrevPage; // Action for going back 1 page |
41 | QAction *m_actionPrevVerse; // Action for going back 1 verse | 41 | QAction *m_actionPrevVerse; // Action for going back 1 verse |
42 | QLineEdit *m_key; // Edit box to enter key to goto | 42 | QLineEdit *m_key; // Edit box to enter key to goto |
43 | QAction *m_actionNextVerse; // Action for going forward 1 verse | 43 | QAction *m_actionNextVerse; // Action for going forward 1 verse |
44 | QAction *m_actionNextChapter; // Action for going forward 1 chapter | 44 | QAction *m_actionNextPage; // Action for going forward 1 page |
45 | QSpinBox *m_scrollRate; // Spin box to adjust rate of auto-scrolling | 45 | QSpinBox *m_scrollRate; // Spin box to adjust rate of auto-scrolling |
46 | QAction *m_actionScroll; // Action to start/stop auto-scrolling | 46 | QAction *m_actionScroll; // Action to start/stop auto-scrolling |
47 | 47 | ||
48 | signals: | 48 | signals: |
49 | void prevChapter(); | 49 | void prevPage(); |
50 | void prevVerse(); | 50 | void prevVerse(); |
51 | void keyChanged( const QString &newKey ); | 51 | void keyChanged( const QString &newKey ); |
52 | void nextVerse(); | 52 | void nextVerse(); |
53 | void nextChapter(); | 53 | void nextPage(); |
54 | void autoScroll( bool enabled ); | 54 | void autoScroll( bool enabled ); |
55 | void scrollRateChanged( int newRate ); | 55 | void scrollRateChanged( int newRate ); |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/noncore/apps/dagger/opie-dagger.control b/noncore/apps/dagger/opie-dagger.control index c401f03..4ded1f2 100644 --- a/noncore/apps/dagger/opie-dagger.control +++ b/noncore/apps/dagger/opie-dagger.control | |||
@@ -1,11 +1,9 @@ | |||
1 | Package: opie-dagger | 1 | Package: opie-dagger |
2 | Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop | 2 | Files: plugins/application/libdagger.so* bin/dagger pics/dagger apps/Applications/dagger.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Depends: task-opie-minimal, libopiecore2, libopieui2 | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
6 | Replaces: dagger | ||
7 | Architecture: arm | 6 | Architecture: arm |
8 | Source: http://draknor.net/dagger/ | ||
9 | Maintainer: Dan Williams (drw@handhelds.org) | 7 | Maintainer: Dan Williams (drw@handhelds.org) |
10 | Description: A Bible study program utilizing the Sword library. | 8 | Description: A Bible study program utilizing the Sword library. |
11 | Version: 0.9.0 | 9 | Version: 0.9.1$EXTRAVERSION |
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp index 747d696..ff434dd 100644 --- a/noncore/apps/dagger/searchbar.cpp +++ b/noncore/apps/dagger/searchbar.cpp | |||
@@ -10,48 +10,53 @@ This file is distributed in the hope that it will be useful, but WITHOUT ANY | |||
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this | 13 | You should have received a copy of the GNU General Public License along with this |
14 | file; see the file COPYING. If not, write to the Free Software Foundation, Inc., | 14 | file; see the file COPYING. If not, write to the Free Software Foundation, Inc., |
15 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 15 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "searchbar.h" | 18 | #include "searchbar.h" |
19 | #include "textwidget.h" | 19 | #include "textwidget.h" |
20 | 20 | ||
21 | #include <opie2/owait.h> | 21 | #include <opie2/owait.h> |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | 25 | ||
26 | #include <qaction.h> | 26 | #include <qaction.h> |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | 29 | ||
30 | #include <listkey.h> | 30 | #include <listkey.h> |
31 | #include <regex.h> | 31 | #include <regex.h> |
32 | #include <versekey.h> | 32 | #include <versekey.h> |
33 | 33 | ||
34 | void searchCallback( char /*percent*/, void */*userData*/ ) | ||
35 | { | ||
36 | qApp->processEvents(); | ||
37 | } | ||
38 | |||
34 | SearchBar::SearchBar( QMainWindow *parent ) | 39 | SearchBar::SearchBar( QMainWindow *parent ) |
35 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) | 40 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) |
36 | , m_currText( 0x0 ) | 41 | , m_currText( 0x0 ) |
37 | { | 42 | { |
38 | // Initialize UI | 43 | // Initialize UI |
39 | m_searchText = new QLineEdit( this ); | 44 | m_searchText = new QLineEdit( this ); |
40 | setStretchableWidget( m_searchText ); | 45 | setStretchableWidget( m_searchText ); |
41 | connect(m_searchText, SIGNAL(textChanged(const QString &)), | 46 | connect(m_searchText, SIGNAL(textChanged(const QString &)), |
42 | this, SLOT(slotTextChanged(const QString &)) ); | 47 | this, SLOT(slotTextChanged(const QString &)) ); |
43 | 48 | ||
44 | m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, | 49 | m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, |
45 | 0, this, 0 ); | 50 | 0, this, 0 ); |
46 | m_actionFind->setEnabled( false ); | 51 | m_actionFind->setEnabled( false ); |
47 | m_actionFind->addTo( this ); | 52 | m_actionFind->addTo( this ); |
48 | connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); | 53 | connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); |
49 | 54 | ||
50 | addSeparator(); | 55 | addSeparator(); |
51 | 56 | ||
52 | m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ), | 57 | m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ), |
53 | QString::null, 0, this, 0 ); | 58 | QString::null, 0, this, 0 ); |
54 | m_actionPrev->setEnabled( false ); | 59 | m_actionPrev->setEnabled( false ); |
55 | m_actionPrev->addTo( this ); | 60 | m_actionPrev->addTo( this ); |
56 | connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); | 61 | connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); |
57 | 62 | ||
@@ -87,49 +92,50 @@ void SearchBar::setCurrModule( TextWidget *currText ) | |||
87 | 92 | ||
88 | m_currText = currText; | 93 | m_currText = currText; |
89 | } | 94 | } |
90 | 95 | ||
91 | void SearchBar::slotTextChanged( const QString &newText ) | 96 | void SearchBar::slotTextChanged( const QString &newText ) |
92 | { | 97 | { |
93 | m_actionFind->setEnabled( ( newText != "" ) && m_currText ); | 98 | m_actionFind->setEnabled( ( newText != "" ) && m_currText ); |
94 | } | 99 | } |
95 | 100 | ||
96 | void SearchBar::slotFind() | 101 | void SearchBar::slotFind() |
97 | { | 102 | { |
98 | m_resultList->clear(); | 103 | m_resultList->clear(); |
99 | 104 | ||
100 | // Change application title and display Opie wait dialog to indicate search is beginning | 105 | // Change application title and display Opie wait dialog to indicate search is beginning |
101 | QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); | 106 | QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); |
102 | QString caption = pWidget->caption(); | 107 | QString caption = pWidget->caption(); |
103 | pWidget->setCaption( "Searching..." ); | 108 | pWidget->setCaption( "Searching..." ); |
104 | 109 | ||
105 | Opie::Ui::OWait wait( pWidget ); | 110 | Opie::Ui::OWait wait( pWidget ); |
106 | wait.show(); | 111 | wait.show(); |
107 | qApp->processEvents(); | 112 | qApp->processEvents(); |
108 | 113 | ||
109 | // Perform search | 114 | // Perform search |
110 | // TODO - implement search callback function to animate wait cursor | 115 | // TODO - implement search callback function to animate wait cursor |
111 | sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), REG_ICASE, 0 ); | 116 | sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0, |
117 | &searchCallback ); | ||
112 | 118 | ||
113 | // Process results | 119 | // Process results |
114 | int count = results.Count(); | 120 | int count = results.Count(); |
115 | bool found = count > 0; | 121 | bool found = count > 0; |
116 | if ( found ) | 122 | if ( found ) |
117 | { | 123 | { |
118 | // Populate results combo box | 124 | // Populate results combo box |
119 | sword::VerseKey key; | 125 | sword::VerseKey key; |
120 | for ( int i = 0; i < count; i++ ) | 126 | for ( int i = 0; i < count; i++ ) |
121 | { | 127 | { |
122 | key.setText( results.GetElement( i )->getText() ); | 128 | key.setText( results.GetElement( i )->getText() ); |
123 | m_resultList->insertItem( key.getShortText() ); | 129 | m_resultList->insertItem( key.getShortText() ); |
124 | } | 130 | } |
125 | 131 | ||
126 | // Goto first result in list | 132 | // Goto first result in list |
127 | m_resultList->setCurrentItem( 0 ); | 133 | m_resultList->setCurrentItem( 0 ); |
128 | emit sigResultClicked( m_resultList->currentText() ); | 134 | emit sigResultClicked( m_resultList->currentText() ); |
129 | } | 135 | } |
130 | else | 136 | else |
131 | { | 137 | { |
132 | // Reset application title | 138 | // Reset application title |
133 | pWidget->setCaption( caption ); | 139 | pWidget->setCaption( caption ); |
134 | } | 140 | } |
135 | 141 | ||
diff --git a/noncore/apps/dagger/textwidget.cpp b/noncore/apps/dagger/textwidget.cpp index 8ff620d..9f7de66 100644 --- a/noncore/apps/dagger/textwidget.cpp +++ b/noncore/apps/dagger/textwidget.cpp | |||
@@ -57,72 +57,76 @@ TextWidget::TextWidget( QWidget *parent, sword::SWModule *module, int numVerses, | |||
57 | // this, SLOT(slotReferenceClicked(const QString&)) ); | 57 | // this, SLOT(slotReferenceClicked(const QString&)) ); |
58 | //connect( parent, SIGNAL( strongsNumbers( bool ) ), this, SLOT( slotStrongsNumbers( bool ) ) ); | 58 | //connect( parent, SIGNAL( strongsNumbers( bool ) ), this, SLOT( slotStrongsNumbers( bool ) ) ); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | { | 61 | { |
62 | m_key = new sword::SWKey( "" ); | 62 | m_key = new sword::SWKey( "" ); |
63 | } | 63 | } |
64 | m_module->SetKey( m_key ); | 64 | m_module->SetKey( m_key ); |
65 | setText(); | 65 | setText(); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | TextWidget::~TextWidget() | 69 | TextWidget::~TextWidget() |
70 | { | 70 | { |
71 | // TODO - why does this cause a SIGSEV??? | 71 | // TODO - why does this cause a SIGSEV??? |
72 | //delete m_key; | 72 | //delete m_key; |
73 | } | 73 | } |
74 | 74 | ||
75 | QString TextWidget::getCurrVerse() | 75 | QString TextWidget::getCurrVerse() |
76 | { | 76 | { |
77 | m_module->SetKey( m_key->getText() ); | 77 | m_module->SetKey( m_key->getText() ); |
78 | return ( QString ) m_module->StripText(); | 78 | return ( QString ) m_module->StripText(); |
79 | } | 79 | } |
80 | 80 | ||
81 | void TextWidget::prevChapter() | 81 | void TextWidget::prevPage() |
82 | { | 82 | { |
83 | (*m_key) -= m_numVerses; | ||
84 | setText(); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | void TextWidget::prevVerse() | 87 | void TextWidget::prevVerse() |
86 | { | 88 | { |
87 | (*m_key)--; | 89 | (*m_key)--; |
88 | setText(); | 90 | setText(); |
89 | } | 91 | } |
90 | 92 | ||
91 | void TextWidget::setKey( const QString &newKey ) | 93 | void TextWidget::setKey( const QString &newKey ) |
92 | { | 94 | { |
93 | m_key->setText( newKey.latin1() ); | 95 | m_key->setText( newKey.latin1() ); |
94 | setText(); | 96 | setText(); |
95 | } | 97 | } |
96 | 98 | ||
97 | void TextWidget::nextVerse() | 99 | void TextWidget::nextVerse() |
98 | { | 100 | { |
99 | (*m_key)++; | 101 | (*m_key)++; |
100 | setText(); | 102 | setText(); |
101 | } | 103 | } |
102 | 104 | ||
103 | void TextWidget::nextChapter() | 105 | void TextWidget::nextPage() |
104 | { | 106 | { |
107 | (*m_key) += m_numVerses; | ||
108 | setText(); | ||
105 | } | 109 | } |
106 | 110 | ||
107 | void TextWidget::slotNumVersesChanged( int numVerses ) | 111 | void TextWidget::slotNumVersesChanged( int numVerses ) |
108 | { | 112 | { |
109 | m_numVerses = numVerses; | 113 | m_numVerses = numVerses; |
110 | setText(); | 114 | setText(); |
111 | } | 115 | } |
112 | 116 | ||
113 | void TextWidget::slotFontChanged( const QFont *newFont ) | 117 | void TextWidget::slotFontChanged( const QFont *newFont ) |
114 | { | 118 | { |
115 | setFont( *newFont ); | 119 | setFont( *newFont ); |
116 | // TODO - shouldn't have to reset text, but couldn't get repaint() to work | 120 | // TODO - shouldn't have to reset text, but couldn't get repaint() to work |
117 | setText(); | 121 | setText(); |
118 | } | 122 | } |
119 | 123 | ||
120 | void TextWidget::slotOptionChanged() | 124 | void TextWidget::slotOptionChanged() |
121 | { | 125 | { |
122 | setText(); | 126 | setText(); |
123 | } | 127 | } |
124 | 128 | ||
125 | void TextWidget::setText() | 129 | void TextWidget::setText() |
126 | { | 130 | { |
127 | if ( m_key->Error() ) | 131 | if ( m_key->Error() ) |
128 | return; | 132 | return; |
diff --git a/noncore/apps/dagger/textwidget.h b/noncore/apps/dagger/textwidget.h index 647eae9..f78ef69 100644 --- a/noncore/apps/dagger/textwidget.h +++ b/noncore/apps/dagger/textwidget.h | |||
@@ -21,53 +21,53 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc., | |||
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | 22 | ||
23 | #include <swkey.h> | 23 | #include <swkey.h> |
24 | #include <swmodule.h> | 24 | #include <swmodule.h> |
25 | 25 | ||
26 | class QTextBrowser; | 26 | class QTextBrowser; |
27 | 27 | ||
28 | class TextWidget : public QWidget | 28 | class TextWidget : public QWidget |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | TextWidget( QWidget *parent = 0x0, sword::SWModule *module = 0x0, int numVerses = 5, | 33 | TextWidget( QWidget *parent = 0x0, sword::SWModule *module = 0x0, int numVerses = 5, |
34 | const QFont *font = 0x0 ); | 34 | const QFont *font = 0x0 ); |
35 | ~TextWidget(); | 35 | ~TextWidget(); |
36 | 36 | ||
37 | const QString &getFullKey() { return m_fullKey; } | 37 | const QString &getFullKey() { return m_fullKey; } |
38 | const QString &getAbbrevKey() { return m_abbrevKey; } | 38 | const QString &getAbbrevKey() { return m_abbrevKey; } |
39 | QString getModuleName() { return QString( m_module->Name() ); } | 39 | QString getModuleName() { return QString( m_module->Name() ); } |
40 | sword::SWModule *getModule() { return m_module; } | 40 | sword::SWModule *getModule() { return m_module; } |
41 | QString getCurrVerse(); | 41 | QString getCurrVerse(); |
42 | 42 | ||
43 | bool isBibleText() const { return m_isBibleText; } | 43 | bool isBibleText() const { return m_isBibleText; } |
44 | 44 | ||
45 | void prevChapter(); | 45 | void prevPage(); |
46 | void prevVerse(); | 46 | void prevVerse(); |
47 | void setKey( const QString &newKey ); | 47 | void setKey( const QString &newKey ); |
48 | void nextVerse(); | 48 | void nextVerse(); |
49 | void nextChapter(); | 49 | void nextPage(); |
50 | 50 | ||
51 | public slots: | 51 | public slots: |
52 | void slotNumVersesChanged( int numVerses ); | 52 | void slotNumVersesChanged( int numVerses ); |
53 | void slotFontChanged( const QFont *newFont ); | 53 | void slotFontChanged( const QFont *newFont ); |
54 | void slotOptionChanged(); | 54 | void slotOptionChanged(); |
55 | 55 | ||
56 | private: | 56 | private: |
57 | sword::SWModule *m_module; // Sword module to display in this widget | 57 | sword::SWModule *m_module; // Sword module to display in this widget |
58 | sword::SWKey *m_key; // Current module key | 58 | sword::SWKey *m_key; // Current module key |
59 | bool m_isBibleText; // Indicates whether module is a Bible or not | 59 | bool m_isBibleText; // Indicates whether module is a Bible or not |
60 | 60 | ||
61 | QTextBrowser *m_textView; // Displays module's text | 61 | QTextBrowser *m_textView; // Displays module's text |
62 | QString m_fullKey; // Contains full key text in format 'key (module)' | 62 | QString m_fullKey; // Contains full key text in format 'key (module)' |
63 | QString m_abbrevKey; // Contains abbreviated key text | 63 | QString m_abbrevKey; // Contains abbreviated key text |
64 | 64 | ||
65 | int m_numVerses; // Number of verses to display at a time for Bible modules | 65 | int m_numVerses; // Number of verses to display at a time for Bible modules |
66 | 66 | ||
67 | void setText(); | 67 | void setText(); |
68 | 68 | ||
69 | signals: | 69 | signals: |
70 | void sigRefClicked( const QString &ref ); | 70 | void sigRefClicked( const QString &ref ); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #endif | 73 | #endif |