author | drw <drw> | 2004-05-27 14:35:16 (UTC) |
---|---|---|
committer | drw <drw> | 2004-05-27 14:35:16 (UTC) |
commit | 26d09a968a56e0d779e12e0f281c1a0f2b8b541f (patch) (unidiff) | |
tree | 1452bf6217d85da369e1e7bdfb0d0aeedd47129c | |
parent | d643ab62b5d08afba2e5d0c1440cf21666e75286 (diff) | |
download | opie-26d09a968a56e0d779e12e0f281c1a0f2b8b541f.zip opie-26d09a968a56e0d779e12e0f281c1a0f2b8b541f.tar.gz opie-26d09a968a56e0d779e12e0f281c1a0f2b8b541f.tar.bz2 |
Added QWhatsThis help text
-rw-r--r-- | noncore/apps/dagger/configuredlg.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/dagger/navbar.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/dagger/searchbar.cpp | 6 |
3 files changed, 28 insertions, 3 deletions
diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp index e4dd60f..0a9317c 100644 --- a/noncore/apps/dagger/configuredlg.cpp +++ b/noncore/apps/dagger/configuredlg.cpp | |||
@@ -1,139 +1,150 @@ | |||
1 | /* | 1 | /* |
2 | Dagger - A Bible study program utilizing the Sword library. | 2 | Dagger - A Bible study program utilizing the Sword library. |
3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> | 3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> |
4 | 4 | ||
5 | This file is free software; you can redistribute it and/or modify it under | 5 | 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 "configuredlg.h" | 18 | #include "configuredlg.h" |
19 | 19 | ||
20 | #include <qvbuttongroup.h> | ||
21 | #include <qlabel.h> | 20 | #include <qlabel.h> |
22 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qvbuttongroup.h> | ||
23 | #include <qwhatsthis.h> | ||
23 | 24 | ||
24 | ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, | 25 | ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, |
25 | bool disableBlanking, int copyFormat, const QFont *font ) | 26 | bool disableBlanking, int copyFormat, const QFont *font ) |
26 | : QDialog( parent, QString::null, true ) | 27 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
27 | , m_tabs( this ) | 28 | , m_tabs( this ) |
28 | { | 29 | { |
29 | setCaption( tr( "Configure Dagger" ) ); | 30 | setCaption( tr( "Configure Dagger" ) ); |
30 | 31 | ||
31 | QVBoxLayout *layout = new QVBoxLayout( this ); | 32 | QVBoxLayout *layout = new QVBoxLayout( this ); |
32 | layout->setMargin( 4 ); | 33 | layout->setMargin( 4 ); |
33 | layout->addWidget( &m_tabs ); | 34 | layout->addWidget( &m_tabs ); |
34 | 35 | ||
35 | // General tab | 36 | // General tab |
36 | QWidget *widget = new QWidget( this ); | 37 | QWidget *widget = new QWidget( this ); |
37 | QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); | 38 | QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); |
38 | grid->setRowStretch( 9, 5 ); | 39 | grid->setRowStretch( 9, 5 ); |
39 | grid->setColStretch( 0, 2 ); | 40 | grid->setColStretch( 0, 2 ); |
40 | 41 | ||
41 | QLabel *label = new QLabel( tr( "Path where Sword modules are located:" ), widget ); | 42 | QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget ); |
42 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | 43 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); |
44 | QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); | ||
43 | grid->addMultiCellWidget( label, 0, 0, 0, 1 ); | 45 | grid->addMultiCellWidget( label, 0, 0, 0, 1 ); |
44 | m_swordPath = new QLineEdit( swordPath, widget ); | 46 | m_swordPath = new QLineEdit( swordPath, widget ); |
47 | QWhatsThis::add( m_swordPath, tr( "Enter the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); | ||
45 | grid->addMultiCellWidget( m_swordPath, 1, 1, 0, 1 ); | 48 | grid->addMultiCellWidget( m_swordPath, 1, 1, 0, 1 ); |
46 | label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); | 49 | label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); |
47 | label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); | 50 | label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); |
51 | QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); | ||
48 | grid->addMultiCellWidget( label, 2, 2, 0, 1 ); | 52 | grid->addMultiCellWidget( label, 2, 2, 0, 1 ); |
49 | 53 | ||
50 | grid->addRowSpacing( 3, 15 ); | 54 | grid->addRowSpacing( 3, 15 ); |
51 | 55 | ||
52 | m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); | 56 | m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); |
53 | m_alwaysOpenNew->setChecked( alwaysOpenNew ); | 57 | m_alwaysOpenNew->setChecked( alwaysOpenNew ); |
58 | QWhatsThis::add( m_alwaysOpenNew, tr( "Tap here to always open texts in a new window. If this option is not selected, only one copy of a Sword text will be opened." ) ); | ||
54 | grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); | 59 | grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); |
55 | 60 | ||
56 | grid->addRowSpacing( 5, 15 ); | 61 | grid->addRowSpacing( 5, 15 ); |
57 | 62 | ||
58 | label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); | 63 | label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); |
59 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | 64 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); |
65 | QWhatsThis::add( label, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) ); | ||
60 | grid->addWidget( label, 6, 0 ); | 66 | grid->addWidget( label, 6, 0 ); |
61 | m_numVerses = new QSpinBox( 1, 20, 1, widget ); | 67 | m_numVerses = new QSpinBox( 1, 20, 1, widget ); |
62 | m_numVerses->setValue( numVerses ); | 68 | m_numVerses->setValue( numVerses ); |
69 | QWhatsThis::add( m_numVerses, tr( "Enter the number of verses to display at a time. This also affects how far the scroll to previous/next page buttons on the Navigation bar scroll." ) ); | ||
63 | grid->addWidget( m_numVerses, 6, 1 ); | 70 | grid->addWidget( m_numVerses, 6, 1 ); |
64 | 71 | ||
65 | grid->addRowSpacing( 7, 15 ); | 72 | grid->addRowSpacing( 7, 15 ); |
66 | 73 | ||
67 | m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget ); | 74 | m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget ); |
68 | m_disableScreenBlank->setChecked( disableBlanking ); | 75 | m_disableScreenBlank->setChecked( disableBlanking ); |
76 | QWhatsThis::add( m_disableScreenBlank, tr( "Tap here to disable Opie's automatic power management feature which will dim and turn off the screen after a specified time. This will only be effective while Dagger is running." ) ); | ||
69 | grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 ); | 77 | grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 ); |
70 | 78 | ||
71 | m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) ); | 79 | m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) ); |
72 | 80 | ||
73 | // Copy tab | 81 | // Copy tab |
74 | widget = new QWidget( this ); | 82 | widget = new QWidget( this ); |
83 | QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) ); | ||
75 | layout = new QVBoxLayout( widget ); | 84 | layout = new QVBoxLayout( widget ); |
76 | layout->setMargin( 4 ); | 85 | layout->setMargin( 4 ); |
77 | 86 | ||
78 | QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget ); | 87 | QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget ); |
79 | m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg ); | 88 | m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg ); |
80 | connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | 89 | connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); |
81 | m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg ); | 90 | m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg ); |
82 | connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | 91 | connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); |
83 | m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg ); | 92 | m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg ); |
84 | connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | 93 | connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); |
85 | m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg ); | 94 | m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg ); |
86 | connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | 95 | connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); |
87 | layout->addWidget( bg ); | 96 | layout->addWidget( bg ); |
88 | 97 | ||
89 | layout->addSpacing( 15 ); | 98 | layout->addSpacing( 15 ); |
90 | 99 | ||
91 | label = new QLabel( tr( "Example:" ), widget ); | 100 | label = new QLabel( tr( "Example:" ), widget ); |
92 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | 101 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); |
93 | layout->addWidget( label ); | 102 | layout->addWidget( label ); |
94 | 103 | ||
95 | layout->addSpacing( 15 ); | 104 | layout->addSpacing( 15 ); |
96 | 105 | ||
97 | m_copyExample = new QLabel( widget ); | 106 | m_copyExample = new QLabel( widget ); |
98 | m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | 107 | m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); |
99 | layout->addWidget( m_copyExample ); | 108 | layout->addWidget( m_copyExample ); |
100 | 109 | ||
101 | if ( copyFormat == 0 ) | 110 | if ( copyFormat == 0 ) |
102 | m_copyTextFull->animateClick(); | 111 | m_copyTextFull->animateClick(); |
103 | else if ( copyFormat == 1 ) | 112 | else if ( copyFormat == 1 ) |
104 | m_copyFull->animateClick(); | 113 | m_copyFull->animateClick(); |
105 | else if ( copyFormat == 2 ) | 114 | else if ( copyFormat == 2 ) |
106 | m_copyVerse->animateClick(); | 115 | m_copyVerse->animateClick(); |
107 | else if ( copyFormat == 3 ) | 116 | else if ( copyFormat == 3 ) |
108 | m_copyKey->animateClick(); | 117 | m_copyKey->animateClick(); |
109 | 118 | ||
110 | layout->addStretch(); | 119 | layout->addStretch(); |
111 | 120 | ||
112 | m_tabs.addTab( widget, "copy", tr( "Copy" ) ); | 121 | m_tabs.addTab( widget, "copy", tr( "Copy" ) ); |
113 | 122 | ||
114 | // Font tab | 123 | // Font tab |
115 | m_font = new Opie::Ui::OFontSelector( true, this ); | 124 | m_font = new Opie::Ui::OFontSelector( true, this ); |
116 | if ( font ) | 125 | if ( font ) |
117 | m_font->setSelectedFont( *font ); | 126 | m_font->setSelectedFont( *font ); |
127 | QWhatsThis::add( m_font, tr( "Select the font, style and size used for displaying texts." ) ); | ||
128 | |||
118 | m_tabs.addTab( m_font, "font", tr( "Font" ) ); | 129 | m_tabs.addTab( m_font, "font", tr( "Font" ) ); |
119 | 130 | ||
120 | m_tabs.setCurrentTab( tr( "General" ) ); | 131 | m_tabs.setCurrentTab( tr( "General" ) ); |
121 | } | 132 | } |
122 | 133 | ||
123 | void ConfigureDlg::slotCopyFormatSelected() | 134 | void ConfigureDlg::slotCopyFormatSelected() |
124 | { | 135 | { |
125 | const QObject *option = sender(); | 136 | const QObject *option = sender(); |
126 | 137 | ||
127 | QString text = tr( "KJV" ); | 138 | QString text = tr( "KJV" ); |
128 | QString verse = tr( "In the beginning God created the heaven and the earth." ); | 139 | QString verse = tr( "In the beginning God created the heaven and the earth." ); |
129 | QString key = tr( "Gen 1:1" ); | 140 | QString key = tr( "Gen 1:1" ); |
130 | 141 | ||
131 | if ( option == m_copyTextFull && m_copyTextFull->isChecked() ) | 142 | if ( option == m_copyTextFull && m_copyTextFull->isChecked() ) |
132 | m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) ); | 143 | m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) ); |
133 | else if ( option == m_copyFull && m_copyFull->isChecked() ) | 144 | else if ( option == m_copyFull && m_copyFull->isChecked() ) |
134 | m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) ); | 145 | m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) ); |
135 | else if ( option == m_copyVerse && m_copyVerse->isChecked() ) | 146 | else if ( option == m_copyVerse && m_copyVerse->isChecked() ) |
136 | m_copyExample->setText( verse ); | 147 | m_copyExample->setText( verse ); |
137 | else if ( option == m_copyKey && m_copyKey->isChecked() ) | 148 | else if ( option == m_copyKey && m_copyKey->isChecked() ) |
138 | m_copyExample->setText( key ); | 149 | m_copyExample->setText( key ); |
139 | } | 150 | } |
diff --git a/noncore/apps/dagger/navbar.cpp b/noncore/apps/dagger/navbar.cpp index 212dc36..97761f7 100644 --- a/noncore/apps/dagger/navbar.cpp +++ b/noncore/apps/dagger/navbar.cpp | |||
@@ -1,93 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | Dagger - A Bible study program utilizing the Sword library. | 2 | Dagger - A Bible study program utilizing the Sword library. |
3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> | 3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> |
4 | 4 | ||
5 | This file is free software; you can redistribute it and/or modify it under | 5 | 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 | #include <qwhatsthis.h> | ||
25 | 26 | ||
26 | NavBar::NavBar( QMainWindow *parent ) | 27 | NavBar::NavBar( QMainWindow *parent ) |
27 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) | 28 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) |
28 | { | 29 | { |
29 | // Initialize UI | 30 | // Initialize UI |
30 | m_actionPrevPage = new QAction( tr( "Previous page" ), Resource::loadPixmap( "fastback" ), | 31 | m_actionPrevPage = new QAction( tr( "Previous page" ), Resource::loadPixmap( "fastback" ), |
31 | QString::null, 0, this, 0 ); | 32 | QString::null, 0, this, 0 ); |
33 | m_actionPrevPage->setWhatsThis( tr( "Tap here to scroll backward one page." ) ); | ||
32 | m_actionPrevPage->addTo( this ); | 34 | m_actionPrevPage->addTo( this ); |
33 | connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) ); | 35 | connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) ); |
34 | 36 | ||
35 | m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ), | 37 | m_actionPrevVerse = new QAction( tr( "Previous verse" ), Resource::loadPixmap( "back" ), |
36 | QString::null, 0, this, 0 ); | 38 | QString::null, 0, this, 0 ); |
39 | m_actionPrevVerse->setWhatsThis( tr( "Tap here to scroll backward one verse." ) ); | ||
37 | m_actionPrevVerse->addTo( this ); | 40 | m_actionPrevVerse->addTo( this ); |
38 | connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); | 41 | connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) ); |
39 | 42 | ||
40 | m_key = new QLineEdit( this ); | 43 | m_key = new QLineEdit( this ); |
41 | setStretchableWidget( m_key ); | 44 | setStretchableWidget( m_key ); |
45 | QWhatsThis::add( m_key, tr( "Enter location to display here." ) ); | ||
42 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); | 46 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); |
43 | 47 | ||
44 | m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ), | 48 | m_actionNextVerse = new QAction( tr( "Next verse" ), Resource::loadPixmap( "forward" ), |
45 | QString::null, 0, this, 0 ); | 49 | QString::null, 0, this, 0 ); |
50 | m_actionNextVerse->setWhatsThis( tr( "Tap here to scroll forward one verse." ) ); | ||
46 | m_actionNextVerse->addTo( this ); | 51 | m_actionNextVerse->addTo( this ); |
47 | connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); | 52 | connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) ); |
48 | 53 | ||
49 | m_actionNextPage = new QAction( tr( "Next page" ), Resource::loadPixmap( "fastforward" ), | 54 | m_actionNextPage = new QAction( tr( "Next page" ), Resource::loadPixmap( "fastforward" ), |
50 | QString::null, 0, this, 0 ); | 55 | QString::null, 0, this, 0 ); |
56 | m_actionNextPage->setWhatsThis( tr( "Tap here to scroll forward one page." ) ); | ||
51 | m_actionNextPage->addTo( this ); | 57 | m_actionNextPage->addTo( this ); |
52 | connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) ); | 58 | connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) ); |
53 | 59 | ||
54 | addSeparator(); | 60 | addSeparator(); |
55 | 61 | ||
56 | m_scrollRate = new QSpinBox( 1, 100, 1, this ); | 62 | m_scrollRate = new QSpinBox( 1, 100, 1, this ); |
57 | m_scrollRate->setMinimumWidth( 35 ); | 63 | m_scrollRate->setMinimumWidth( 35 ); |
64 | QWhatsThis::add( m_scrollRate, tr( "Adjust auto-scroll rate here. A larger value represents a slower scrolling rate." ) ); | ||
58 | connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); | 65 | connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) ); |
59 | 66 | ||
60 | m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ), | 67 | m_actionScroll = new QAction( tr( "Auto-scroll" ), Resource::loadPixmap( "dagger/autoscroll" ), |
61 | QString::null, 0, this, 0 ); | 68 | QString::null, 0, this, 0 ); |
62 | m_actionScroll->setToggleAction( true ); | 69 | m_actionScroll->setToggleAction( true ); |
70 | m_actionScroll->setWhatsThis( tr( "Tap here to start or stop auto-scrolling." ) ); | ||
63 | connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); | 71 | connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) ); |
64 | m_actionScroll->addTo( this ); | 72 | m_actionScroll->addTo( this ); |
65 | 73 | ||
66 | if ( parent ) | 74 | if ( parent ) |
67 | { | 75 | { |
68 | installEventFilter( parent ); | 76 | installEventFilter( parent ); |
69 | m_key->installEventFilter( parent ); | 77 | m_key->installEventFilter( parent ); |
70 | } | 78 | } |
71 | } | 79 | } |
72 | 80 | ||
73 | void NavBar::navBtnsEnable( bool enabled ) | 81 | void NavBar::navBtnsEnable( bool enabled ) |
74 | { | 82 | { |
75 | m_actionPrevPage->setEnabled( enabled ); | 83 | m_actionPrevPage->setEnabled( enabled ); |
76 | m_actionPrevVerse->setEnabled( enabled ); | 84 | m_actionPrevVerse->setEnabled( enabled ); |
77 | m_actionNextVerse->setEnabled( enabled ); | 85 | m_actionNextVerse->setEnabled( enabled ); |
78 | m_actionNextPage->setEnabled( enabled ); | 86 | m_actionNextPage->setEnabled( enabled ); |
79 | m_scrollRate->setEnabled( enabled ); | 87 | m_scrollRate->setEnabled( enabled ); |
80 | m_actionScroll->setEnabled( enabled ); | 88 | m_actionScroll->setEnabled( enabled ); |
81 | } | 89 | } |
82 | 90 | ||
83 | void NavBar::setKey( const QString &newKey ) | 91 | void NavBar::setKey( const QString &newKey ) |
84 | { | 92 | { |
85 | disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); | 93 | disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 ); |
86 | m_key->setText( newKey ); | 94 | m_key->setText( newKey ); |
87 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); | 95 | connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) ); |
88 | } | 96 | } |
89 | 97 | ||
90 | void NavBar::setAutoScrollRate( int scrollRate ) | 98 | void NavBar::setAutoScrollRate( int scrollRate ) |
91 | { | 99 | { |
92 | m_scrollRate->setValue( scrollRate ); | 100 | m_scrollRate->setValue( scrollRate ); |
93 | } | 101 | } |
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp index ff434dd..9953e8f 100644 --- a/noncore/apps/dagger/searchbar.cpp +++ b/noncore/apps/dagger/searchbar.cpp | |||
@@ -1,173 +1,179 @@ | |||
1 | /* | 1 | /* |
2 | Dagger - A Bible study program utilizing the Sword library. | 2 | Dagger - A Bible study program utilizing the Sword library. |
3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> | 3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> |
4 | 4 | ||
5 | This file is free software; you can redistribute it and/or modify it under | 5 | 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 "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 | #include <qwhatsthis.h> | ||
29 | 30 | ||
30 | #include <listkey.h> | 31 | #include <listkey.h> |
31 | #include <regex.h> | 32 | #include <regex.h> |
32 | #include <versekey.h> | 33 | #include <versekey.h> |
33 | 34 | ||
34 | void searchCallback( char /*percent*/, void */*userData*/ ) | 35 | void searchCallback( char /*percent*/, void */*userData*/ ) |
35 | { | 36 | { |
36 | qApp->processEvents(); | 37 | qApp->processEvents(); |
37 | } | 38 | } |
38 | 39 | ||
39 | SearchBar::SearchBar( QMainWindow *parent ) | 40 | SearchBar::SearchBar( QMainWindow *parent ) |
40 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) | 41 | : QToolBar( QString::null, parent, QMainWindow::Top, true ) |
41 | , m_currText( 0x0 ) | 42 | , m_currText( 0x0 ) |
42 | { | 43 | { |
43 | // Initialize UI | 44 | // Initialize UI |
44 | m_searchText = new QLineEdit( this ); | 45 | m_searchText = new QLineEdit( this ); |
45 | setStretchableWidget( m_searchText ); | 46 | setStretchableWidget( m_searchText ); |
47 | QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) ); | ||
46 | connect(m_searchText, SIGNAL(textChanged(const QString &)), | 48 | connect(m_searchText, SIGNAL(textChanged(const QString &)), |
47 | this, SLOT(slotTextChanged(const QString &)) ); | 49 | this, SLOT(slotTextChanged(const QString &)) ); |
48 | 50 | ||
49 | m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, | 51 | m_actionFind = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, |
50 | 0, this, 0 ); | 52 | 0, this, 0 ); |
51 | m_actionFind->setEnabled( false ); | 53 | m_actionFind->setEnabled( false ); |
52 | m_actionFind->addTo( this ); | 54 | m_actionFind->addTo( this ); |
55 | m_actionFind->setWhatsThis( tr( "Tap here search the current module for the text entered to the left." ) ); | ||
53 | connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); | 56 | connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) ); |
54 | 57 | ||
55 | addSeparator(); | 58 | addSeparator(); |
56 | 59 | ||
57 | m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ), | 60 | m_actionPrev = new QAction( tr( "Previous result" ), Resource::loadPixmap( "back" ), |
58 | QString::null, 0, this, 0 ); | 61 | QString::null, 0, this, 0 ); |
59 | m_actionPrev->setEnabled( false ); | 62 | m_actionPrev->setEnabled( false ); |
60 | m_actionPrev->addTo( this ); | 63 | m_actionPrev->addTo( this ); |
64 | m_actionPrev->setWhatsThis( tr( "Tap here to view the previous search result." ) ); | ||
61 | connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); | 65 | connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) ); |
62 | 66 | ||
63 | m_resultList = new QComboBox( this ); | 67 | m_resultList = new QComboBox( this ); |
64 | m_resultList->setEnabled( false ); | 68 | m_resultList->setEnabled( false ); |
69 | QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) ); | ||
65 | connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) ); | 70 | connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) ); |
66 | 71 | ||
67 | m_actionNext = new QAction( tr( "Next result" ), Resource::loadPixmap( "forward" ), | 72 | m_actionNext = new QAction( tr( "Next result" ), Resource::loadPixmap( "forward" ), |
68 | QString::null, 0, this, 0 ); | 73 | QString::null, 0, this, 0 ); |
69 | m_actionNext->setEnabled( false ); | 74 | m_actionNext->setEnabled( false ); |
70 | m_actionNext->addTo( this ); | 75 | m_actionNext->addTo( this ); |
76 | m_actionNext->setWhatsThis( tr( "Tap here to view the next search result." ) ); | ||
71 | connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) ); | 77 | connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) ); |
72 | 78 | ||
73 | if ( parent ) | 79 | if ( parent ) |
74 | { | 80 | { |
75 | installEventFilter( parent ); | 81 | installEventFilter( parent ); |
76 | // TODO - install for all controls | 82 | // TODO - install for all controls |
77 | m_searchText->installEventFilter( parent ); | 83 | m_searchText->installEventFilter( parent ); |
78 | } | 84 | } |
79 | } | 85 | } |
80 | 86 | ||
81 | void SearchBar::setCurrModule( TextWidget *currText ) | 87 | void SearchBar::setCurrModule( TextWidget *currText ) |
82 | { | 88 | { |
83 | m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText ); | 89 | m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText ); |
84 | 90 | ||
85 | if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) ) | 91 | if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) ) |
86 | { | 92 | { |
87 | m_actionPrev->setEnabled( false ); | 93 | m_actionPrev->setEnabled( false ); |
88 | m_resultList->clear(); | 94 | m_resultList->clear(); |
89 | m_resultList->setEnabled( false ); | 95 | m_resultList->setEnabled( false ); |
90 | m_actionNext->setEnabled( false ); | 96 | m_actionNext->setEnabled( false ); |
91 | } | 97 | } |
92 | 98 | ||
93 | m_currText = currText; | 99 | m_currText = currText; |
94 | } | 100 | } |
95 | 101 | ||
96 | void SearchBar::slotTextChanged( const QString &newText ) | 102 | void SearchBar::slotTextChanged( const QString &newText ) |
97 | { | 103 | { |
98 | m_actionFind->setEnabled( ( newText != "" ) && m_currText ); | 104 | m_actionFind->setEnabled( ( newText != "" ) && m_currText ); |
99 | } | 105 | } |
100 | 106 | ||
101 | void SearchBar::slotFind() | 107 | void SearchBar::slotFind() |
102 | { | 108 | { |
103 | m_resultList->clear(); | 109 | m_resultList->clear(); |
104 | 110 | ||
105 | // Change application title and display Opie wait dialog to indicate search is beginning | 111 | // Change application title and display Opie wait dialog to indicate search is beginning |
106 | QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); | 112 | QWidget *pWidget = reinterpret_cast<QWidget *>(parent()); |
107 | QString caption = pWidget->caption(); | 113 | QString caption = pWidget->caption(); |
108 | pWidget->setCaption( "Searching..." ); | 114 | pWidget->setCaption( "Searching..." ); |
109 | 115 | ||
110 | Opie::Ui::OWait wait( pWidget ); | 116 | Opie::Ui::OWait wait( pWidget ); |
111 | wait.show(); | 117 | wait.show(); |
112 | qApp->processEvents(); | 118 | qApp->processEvents(); |
113 | 119 | ||
114 | // Perform search | 120 | // Perform search |
115 | // TODO - implement search callback function to animate wait cursor | 121 | // TODO - implement search callback function to animate wait cursor |
116 | sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0, | 122 | sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0, |
117 | &searchCallback ); | 123 | &searchCallback ); |
118 | 124 | ||
119 | // Process results | 125 | // Process results |
120 | int count = results.Count(); | 126 | int count = results.Count(); |
121 | bool found = count > 0; | 127 | bool found = count > 0; |
122 | if ( found ) | 128 | if ( found ) |
123 | { | 129 | { |
124 | // Populate results combo box | 130 | // Populate results combo box |
125 | sword::VerseKey key; | 131 | sword::VerseKey key; |
126 | for ( int i = 0; i < count; i++ ) | 132 | for ( int i = 0; i < count; i++ ) |
127 | { | 133 | { |
128 | key.setText( results.GetElement( i )->getText() ); | 134 | key.setText( results.GetElement( i )->getText() ); |
129 | m_resultList->insertItem( key.getShortText() ); | 135 | m_resultList->insertItem( key.getShortText() ); |
130 | } | 136 | } |
131 | 137 | ||
132 | // Goto first result in list | 138 | // Goto first result in list |
133 | m_resultList->setCurrentItem( 0 ); | 139 | m_resultList->setCurrentItem( 0 ); |
134 | emit sigResultClicked( m_resultList->currentText() ); | 140 | emit sigResultClicked( m_resultList->currentText() ); |
135 | } | 141 | } |
136 | else | 142 | else |
137 | { | 143 | { |
138 | // Reset application title | 144 | // Reset application title |
139 | pWidget->setCaption( caption ); | 145 | pWidget->setCaption( caption ); |
140 | } | 146 | } |
141 | 147 | ||
142 | // UI clean-up | 148 | // UI clean-up |
143 | wait.hide(); | 149 | wait.hide(); |
144 | 150 | ||
145 | m_actionPrev->setEnabled( false ); | 151 | m_actionPrev->setEnabled( false ); |
146 | m_resultList->setEnabled( found ); | 152 | m_resultList->setEnabled( found ); |
147 | m_actionNext->setEnabled( count > 1 ); | 153 | m_actionNext->setEnabled( count > 1 ); |
148 | } | 154 | } |
149 | 155 | ||
150 | void SearchBar::slotPrev() | 156 | void SearchBar::slotPrev() |
151 | { | 157 | { |
152 | int item = m_resultList->currentItem() - 1; | 158 | int item = m_resultList->currentItem() - 1; |
153 | m_resultList->setCurrentItem( item ); | 159 | m_resultList->setCurrentItem( item ); |
154 | emit sigResultClicked( m_resultList->currentText() ); | 160 | emit sigResultClicked( m_resultList->currentText() ); |
155 | 161 | ||
156 | m_actionPrev->setEnabled( item > 0 ); | 162 | m_actionPrev->setEnabled( item > 0 ); |
157 | m_actionNext->setEnabled( item < m_resultList->count() - 1 ); | 163 | m_actionNext->setEnabled( item < m_resultList->count() - 1 ); |
158 | } | 164 | } |
159 | 165 | ||
160 | void SearchBar::slotNext() | 166 | void SearchBar::slotNext() |
161 | { | 167 | { |
162 | int item = m_resultList->currentItem() + 1; | 168 | int item = m_resultList->currentItem() + 1; |
163 | m_resultList->setCurrentItem( item ); | 169 | m_resultList->setCurrentItem( item ); |
164 | emit sigResultClicked( m_resultList->currentText() ); | 170 | emit sigResultClicked( m_resultList->currentText() ); |
165 | 171 | ||
166 | m_actionPrev->setEnabled( true ); | 172 | m_actionPrev->setEnabled( true ); |
167 | m_actionNext->setEnabled( item < m_resultList->count() - 1 ); | 173 | m_actionNext->setEnabled( item < m_resultList->count() - 1 ); |
168 | } | 174 | } |
169 | 175 | ||
170 | void SearchBar::slotCloseBtn() | 176 | void SearchBar::slotCloseBtn() |
171 | { | 177 | { |
172 | hide(); | 178 | hide(); |
173 | } | 179 | } |