summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/configuredlg.cpp8
-rw-r--r--noncore/apps/dagger/navbar.cpp19
-rw-r--r--noncore/apps/dagger/opentextdlg.cpp4
-rw-r--r--noncore/apps/dagger/searchbar.cpp18
4 files changed, 25 insertions, 24 deletions
diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp
index 42bc6da..791eeb1 100644
--- a/noncore/apps/dagger/configuredlg.cpp
+++ b/noncore/apps/dagger/configuredlg.cpp
@@ -1,120 +1,118 @@
/*
Dagger - A Bible study program utilizing the Sword library.
Copyright (c) 2004 Dan Williams <drw@handhelds.org>
This file is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "configuredlg.h"
#include <opie2/ofiledialog.h>
-
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qvbuttongroup.h>
#include <qwhatsthis.h>
ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses,
bool disableBlanking, int copyFormat, const QFont *font )
: QDialog( parent, QString::null, true, WStyle_ContextHelp )
, m_tabs( this )
{
setCaption( tr( "Configure Dagger" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 4 );
layout->addWidget( &m_tabs );
// General tab
QWidget *widget = new QWidget( this );
QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 );
grid->setRowStretch( 9, 5 );
grid->setColStretch( 0, 2 );
QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget );
label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
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." ) );
grid->addMultiCellWidget( label, 0, 0, 0, 1 );
m_swordPath = new QLineEdit( swordPath, widget );
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." ) );
grid->addWidget( m_swordPath, 1, 0 );
- QPixmap pic;
- pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- QPushButton *btn = new QPushButton( pic, QString::null, widget );
+ QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ),
+ QString::null, widget );
btn->setMaximumWidth( btn->height() );
QWhatsThis::add( btn, tr( "Tap here to select 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." ) );
connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) );
grid->addWidget( btn, 1, 1 );
label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget );
label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak );
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." ) );
grid->addMultiCellWidget( label, 2, 2, 0, 1 );
grid->addRowSpacing( 3, 15 );
m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget );
m_alwaysOpenNew->setChecked( alwaysOpenNew );
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." ) );
grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 );
grid->addRowSpacing( 5, 15 );
label = new QLabel( tr( "Number of verses to display at a time:" ), widget );
label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
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." ) );
grid->addWidget( label, 6, 0 );
m_numVerses = new QSpinBox( 1, 20, 1, widget );
m_numVerses->setValue( numVerses );
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." ) );
grid->addWidget( m_numVerses, 6, 1 );
grid->addRowSpacing( 7, 15 );
m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget );
m_disableScreenBlank->setChecked( disableBlanking );
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." ) );
grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 );
m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) );
// Copy tab
widget = new QWidget( this );
QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) );
layout = new QVBoxLayout( widget );
layout->setMargin( 4 );
QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget );
m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg );
connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg );
connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg );
connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg );
connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
layout->addWidget( bg );
layout->addSpacing( 15 );
label = new QLabel( tr( "Example:" ), widget );
label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
layout->addWidget( label );
layout->addSpacing( 15 );
m_copyExample = new QLabel( widget );
m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
diff --git a/noncore/apps/dagger/navbar.cpp b/noncore/apps/dagger/navbar.cpp
index ac49613..b28c677 100644
--- a/noncore/apps/dagger/navbar.cpp
+++ b/noncore/apps/dagger/navbar.cpp
@@ -1,105 +1,108 @@
/*
Dagger - A Bible study program utilizing the Sword library.
Copyright (c) 2004 Dan Williams <drw@handhelds.org>
This file is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "navbar.h"
#include <opie2/oresource.h>
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qaction.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
-using Opie::Core::OResource;
-
NavBar::NavBar( QMainWindow *parent )
: QToolBar( QString::null, parent, QMainWindow::Top, true )
{
// Initialize UI
- m_actionPrevPage = new QAction( tr( "Previous page" ), OResource::loadPixmap( "fastback", OResource::SmallIcon ),
+ m_actionPrevPage = new QAction( tr( "Previous page" ),
+ Opie::Core::OResource::loadPixmap( "fastback", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
m_actionPrevPage->setWhatsThis( tr( "Tap here to scroll backward one page." ) );
m_actionPrevPage->addTo( this );
connect( m_actionPrevPage, SIGNAL(activated()), this, SIGNAL(prevPage()) );
- m_actionPrevVerse = new QAction( tr( "Previous verse" ), OResource::loadPixmap( "back", OResource::SmallIcon ),
+ m_actionPrevVerse = new QAction( tr( "Previous verse" ),
+ Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
m_actionPrevVerse->setWhatsThis( tr( "Tap here to scroll backward one verse." ) );
m_actionPrevVerse->addTo( this );
connect( m_actionPrevVerse, SIGNAL(activated()), this, SIGNAL(prevVerse()) );
m_key = new QLineEdit( this );
setStretchableWidget( m_key );
QWhatsThis::add( m_key, tr( "Enter location to display here." ) );
connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
- m_actionNextVerse = new QAction( tr( "Next verse" ), OResource::loadPixmap( "forward", OResource::SmallIcon ),
+ m_actionNextVerse = new QAction( tr( "Next verse" ),
+ Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
m_actionNextVerse->setWhatsThis( tr( "Tap here to scroll forward one verse." ) );
m_actionNextVerse->addTo( this );
connect( m_actionNextVerse, SIGNAL(activated()), this, SIGNAL(nextVerse()) );
- m_actionNextPage = new QAction( tr( "Next page" ), OResource::loadPixmap( "fastforward", OResource::SmallIcon ),
- QString::null, 0, this, 0 );
+ m_actionNextPage = new QAction( tr( "Next page" ),
+ Opie::Core::OResource::loadPixmap( "fastforward", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_actionNextPage->setWhatsThis( tr( "Tap here to scroll forward one page." ) );
m_actionNextPage->addTo( this );
connect( m_actionNextPage, SIGNAL(activated()), this, SIGNAL(nextPage()) );
addSeparator();
m_scrollRate = new QSpinBox( 1, 100, 1, this );
m_scrollRate->setMinimumWidth( 35 );
QWhatsThis::add( m_scrollRate, tr( "Adjust auto-scroll rate here. A larger value represents a slower scrolling rate." ) );
connect( m_scrollRate, SIGNAL(valueChanged(int)), this, SIGNAL(scrollRateChanged(int)) );
- m_actionScroll = new QAction( tr( "Auto-scroll" ), OResource::loadPixmap( "dagger/autoscroll", OResource::SmallIcon ),
+ m_actionScroll = new QAction( tr( "Auto-scroll" ),
+ Opie::Core::OResource::loadPixmap( "dagger/autoscroll", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
m_actionScroll->setToggleAction( true );
m_actionScroll->setWhatsThis( tr( "Tap here to start or stop auto-scrolling." ) );
connect( m_actionScroll, SIGNAL(toggled(bool)), this, SIGNAL(autoScroll(bool)) );
m_actionScroll->addTo( this );
if ( parent )
{
installEventFilter( parent );
m_key->installEventFilter( parent );
}
}
void NavBar::navBtnsEnable( bool enabled )
{
m_actionPrevPage->setEnabled( enabled );
m_actionPrevVerse->setEnabled( enabled );
m_actionNextVerse->setEnabled( enabled );
m_actionNextPage->setEnabled( enabled );
m_scrollRate->setEnabled( enabled );
m_actionScroll->setEnabled( enabled );
}
void NavBar::setKey( const QString &newKey )
{
disconnect( m_key, SIGNAL(textChanged(const QString &)), 0, 0 );
m_key->setText( newKey );
connect(m_key, SIGNAL(textChanged(const QString &)), this, SIGNAL(keyChanged(const QString &)) );
}
void NavBar::setAutoScrollRate( int scrollRate )
{
m_scrollRate->setValue( scrollRate );
}
diff --git a/noncore/apps/dagger/opentextdlg.cpp b/noncore/apps/dagger/opentextdlg.cpp
index 8c94a4b..7fd5cde 100644
--- a/noncore/apps/dagger/opentextdlg.cpp
+++ b/noncore/apps/dagger/opentextdlg.cpp
@@ -1,101 +1,101 @@
/*
Dagger - A Bible study program utilizing the Sword library.
Copyright (c) 2004 Dan Williams <drw@handhelds.org>
This file is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "opentextdlg.h"
-#include <qpe/resource.h>
+#include <qpe/applnk.h>
#include <qheader.h>
#include <qlayout.h>
#include <qpixmap.h>
OpenTextDlg::OpenTextDlg( QWidget *parent, sword::SWMgr *swordMgr, QPixmap *bibleIcon,
QPixmap *commentaryIcon, QPixmap *lexiconIcon )
: QDialog( parent, QString::null, true )
, m_textList( this )
{
setCaption( tr( "Open text" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 4 );
layout->addWidget( &m_textList );
m_textList.setRootIsDecorated( true );
- m_textList.addColumn( tr( "Icon" ),35 );
+ m_textList.addColumn( tr( "Icon" ) );
m_textList.addColumn( tr( "Text" ) );
m_textList.header()->hide();
m_textList.setAllColumnsShowFocus( true );
m_textList.setSorting( 1 );
m_commentaries = new QListViewItem( &m_textList, QString::null, tr( "Commentaries" ) );
m_commentaries->setPixmap( 0, *commentaryIcon );
m_textList.insertItem( m_commentaries );
m_lexicons = new QListViewItem( &m_textList, QString::null, tr( "Lexicons/Dictionaries" ) );
m_lexicons->setPixmap( 0, *lexiconIcon );
m_textList.insertItem( m_lexicons );
m_bibles = new QListViewItem( &m_textList, QString::null, tr( "Biblical Texts" ) );
m_bibles->setPixmap( 0, *bibleIcon );
m_textList.insertItem( m_bibles );
connect( &m_textList, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotItemClicked(QListViewItem*)) );
if ( swordMgr )
{
sword::ModMap::iterator it;
QString type;
QPixmap *icon = 0x0;
QListViewItem *parent = 0x0;
for ( it = swordMgr->Modules.begin(); it != swordMgr->Modules.end(); it++ )
{
if ( it->second )
{
type = it->second->Type();
if ( type == "Biblical Texts" )
{
icon = bibleIcon;
parent = m_bibles;
}
else if ( type == "Commentaries" )
{
icon = commentaryIcon;
parent = m_commentaries;
}
else if ( type == "Lexicons / Dictionaries" )
{
icon = lexiconIcon;
parent = m_lexicons;
}
parent->insertItem( new QListViewItem( parent, QString::null, it->first.c_str() ) );
}
}
}
m_textList.sort();
}
void OpenTextDlg::slotItemClicked( QListViewItem *item )
{
if ( item == m_bibles || item == m_lexicons || item == m_commentaries )
{
m_textList.clearSelection();
if ( item->childCount() > 0 )
{
item->setOpen( !item->isOpen() );
}
}
}
diff --git a/noncore/apps/dagger/searchbar.cpp b/noncore/apps/dagger/searchbar.cpp
index b794bfd..b195f67 100644
--- a/noncore/apps/dagger/searchbar.cpp
+++ b/noncore/apps/dagger/searchbar.cpp
@@ -1,140 +1,140 @@
/*
Dagger - A Bible study program utilizing the Sword library.
Copyright (c) 2004 Dan Williams <drw@handhelds.org>
This file is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "searchbar.h"
#include "textwidget.h"
#include <opie2/oresource.h>
#include <opie2/owait.h>
#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
#include <qaction.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
#include <listkey.h>
#include <regex.h>
#include <versekey.h>
-using Opie::Core::OResource;
-
void searchCallback( char /*percent*/, void */*userData*/ )
{
qApp->processEvents();
}
SearchBar::SearchBar( QMainWindow *parent )
: QToolBar( QString::null, parent, QMainWindow::Top, true )
, m_currText( 0x0 )
{
// Initialize UI
m_searchText = new QLineEdit( this );
setStretchableWidget( m_searchText );
QWhatsThis::add( m_searchText, tr( "Enter text to search for here." ) );
connect(m_searchText, SIGNAL(textChanged(const QString &)),
this, SLOT(slotTextChanged(const QString &)) );
- m_actionFind = new QAction( tr( "Find" ), OResource::loadPixmap( "find", OResource::SmallIcon ), QString::null,
- 0, this, 0 );
+ m_actionFind = new QAction( tr( "Find" ),
+ Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_actionFind->setEnabled( false );
m_actionFind->addTo( this );
m_actionFind->setWhatsThis( tr( "Tap here search the current module for the text entered to the left." ) );
connect( m_actionFind, SIGNAL(activated()), this, SLOT(slotFind()) );
addSeparator();
- m_actionPrev = new QAction( tr( "Previous result" ), OResource::loadPixmap( "back", OResource::SmallIcon ),
- QString::null, 0, this, 0 );
+ m_actionPrev = new QAction( tr( "Previous result" ),
+ Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_actionPrev->setEnabled( false );
m_actionPrev->addTo( this );
m_actionPrev->setWhatsThis( tr( "Tap here to view the previous search result." ) );
connect( m_actionPrev, SIGNAL(activated()), this, SLOT(slotPrev()) );
m_resultList = new QComboBox( this );
m_resultList->setEnabled( false );
QWhatsThis::add( m_resultList, tr( "Select the desired search result here." ) );
connect( m_resultList, SIGNAL(activated(const QString &)), this, SIGNAL(sigResultClicked(const QString &)) );
- m_actionNext = new QAction( tr( "Next result" ), OResource::loadPixmap( "forward", OResource::SmallIcon ),
- QString::null, 0, this, 0 );
+ m_actionNext = new QAction( tr( "Next result" ),
+ Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_actionNext->setEnabled( false );
m_actionNext->addTo( this );
m_actionNext->setWhatsThis( tr( "Tap here to view the next search result." ) );
connect( m_actionNext, SIGNAL(activated()), this, SLOT(slotNext()) );
if ( parent )
{
installEventFilter( parent );
// TODO - install for all controls
m_searchText->installEventFilter( parent );
}
}
void SearchBar::setCurrModule( TextWidget *currText )
{
m_actionFind->setEnabled( ( m_searchText->text() != "" ) && currText );
if ( !m_currText || ( currText->getModuleName() != m_currText->getModuleName() ) )
{
m_actionPrev->setEnabled( false );
m_resultList->clear();
m_resultList->setEnabled( false );
m_actionNext->setEnabled( false );
}
m_currText = currText;
}
void SearchBar::slotTextChanged( const QString &newText )
{
m_actionFind->setEnabled( ( newText != "" ) && m_currText );
}
void SearchBar::slotFind()
{
m_resultList->clear();
// Change application title and display Opie wait dialog to indicate search is beginning
QWidget *pWidget = reinterpret_cast<QWidget *>(parent());
QString caption = pWidget->caption();
pWidget->setCaption( "Searching..." );
Opie::Ui::OWait wait( pWidget );
wait.show();
qApp->processEvents();
// Perform search
// TODO - implement search callback function to animate wait cursor
sword::ListKey results = m_currText->getModule()->Search( m_searchText->text().latin1(), 0, REG_ICASE, 0, 0,
&searchCallback );
// Process results
int count = results.Count();
bool found = count > 0;
if ( found )
{
// Populate results combo box
sword::VerseKey key;
for ( int i = 0; i < count; i++ )
{
key.setText( results.GetElement( i )->getText() );
m_resultList->insertItem( key.getShortText() );
}