summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/dagger/configuredlg.cpp21
-rw-r--r--noncore/apps/dagger/configuredlg.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp
index 0a9317c..535659d 100644
--- a/noncore/apps/dagger/configuredlg.cpp
+++ b/noncore/apps/dagger/configuredlg.cpp
@@ -1,96 +1,107 @@
1/* 1/*
2Dagger - A Bible study program utilizing the Sword library. 2Dagger - A Bible study program utilizing the Sword library.
3Copyright (c) 2004 Dan Williams <drw@handhelds.org> 3Copyright (c) 2004 Dan Williams <drw@handhelds.org>
4 4
5This file is free software; you can redistribute it and/or modify it under 5This file is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software 6the terms of the GNU General Public License as published by the Free Software
7Foundation; either version 2 of the License, or (at your option) any later version. 7Foundation; either version 2 of the License, or (at your option) any later version.
8 8
9This file is distributed in the hope that it will be useful, but WITHOUT ANY 9This file is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 10WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11PARTICULAR PURPOSE. See the GNU General Public License for more details. 11PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this 13You should have received a copy of the GNU General Public License along with this
14file; see the file COPYING. If not, write to the Free Software Foundation, Inc., 14file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
1559 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1559 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 <opie2/ofiledialog.h>
21
22#include <qpe/resource.h>
23
20#include <qlabel.h> 24#include <qlabel.h>
21#include <qlayout.h> 25#include <qlayout.h>
26#include <qpushbutton.h>
22#include <qvbuttongroup.h> 27#include <qvbuttongroup.h>
23#include <qwhatsthis.h> 28#include <qwhatsthis.h>
24 29
25ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, 30ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses,
26 bool disableBlanking, int copyFormat, const QFont *font ) 31 bool disableBlanking, int copyFormat, const QFont *font )
27 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 32 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
28 , m_tabs( this ) 33 , m_tabs( this )
29{ 34{
30 setCaption( tr( "Configure Dagger" ) ); 35 setCaption( tr( "Configure Dagger" ) );
31 36
32 QVBoxLayout *layout = new QVBoxLayout( this ); 37 QVBoxLayout *layout = new QVBoxLayout( this );
33 layout->setMargin( 4 ); 38 layout->setMargin( 4 );
34 layout->addWidget( &m_tabs ); 39 layout->addWidget( &m_tabs );
35 40
36 // General tab 41 // General tab
37 QWidget *widget = new QWidget( this ); 42 QWidget *widget = new QWidget( this );
38 QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); 43 QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 );
39 grid->setRowStretch( 9, 5 ); 44 grid->setRowStretch( 9, 5 );
40 grid->setColStretch( 0, 2 ); 45 grid->setColStretch( 0, 2 );
41 46
42 QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget ); 47 QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget );
43 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 48 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." ) ); 49 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." ) );
45 grid->addMultiCellWidget( label, 0, 0, 0, 1 ); 50 grid->addMultiCellWidget( label, 0, 0, 0, 1 );
46 m_swordPath = new QLineEdit( swordPath, widget ); 51 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." ) ); 52 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." ) );
48 grid->addMultiCellWidget( m_swordPath, 1, 1, 0, 1 ); 53 grid->addWidget( m_swordPath, 1, 0 );
54 QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, widget );
55 btn->setMaximumWidth( btn->height() );
56 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." ) );
57 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) );
58 grid->addWidget( btn, 1, 1 );
59
49 label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); 60 label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget );
50 label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); 61 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." ) ); 62 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." ) );
52 grid->addMultiCellWidget( label, 2, 2, 0, 1 ); 63 grid->addMultiCellWidget( label, 2, 2, 0, 1 );
53 64
54 grid->addRowSpacing( 3, 15 ); 65 grid->addRowSpacing( 3, 15 );
55 66
56 m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); 67 m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget );
57 m_alwaysOpenNew->setChecked( alwaysOpenNew ); 68 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." ) ); 69 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." ) );
59 grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); 70 grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 );
60 71
61 grid->addRowSpacing( 5, 15 ); 72 grid->addRowSpacing( 5, 15 );
62 73
63 label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); 74 label = new QLabel( tr( "Number of verses to display at a time:" ), widget );
64 label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 75 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." ) ); 76 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." ) );
66 grid->addWidget( label, 6, 0 ); 77 grid->addWidget( label, 6, 0 );
67 m_numVerses = new QSpinBox( 1, 20, 1, widget ); 78 m_numVerses = new QSpinBox( 1, 20, 1, widget );
68 m_numVerses->setValue( numVerses ); 79 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." ) ); 80 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." ) );
70 grid->addWidget( m_numVerses, 6, 1 ); 81 grid->addWidget( m_numVerses, 6, 1 );
71 82
72 grid->addRowSpacing( 7, 15 ); 83 grid->addRowSpacing( 7, 15 );
73 84
74 m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget ); 85 m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget );
75 m_disableScreenBlank->setChecked( disableBlanking ); 86 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." ) ); 87 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." ) );
77 grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 ); 88 grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 );
78 89
79 m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) ); 90 m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) );
80 91
81 // Copy tab 92 // Copy tab
82 widget = new QWidget( this ); 93 widget = new QWidget( this );
83 QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) ); 94 QWhatsThis::add( widget, tr( "Select the format used when copying the current verse to the clipboard." ) );
84 layout = new QVBoxLayout( widget ); 95 layout = new QVBoxLayout( widget );
85 layout->setMargin( 4 ); 96 layout->setMargin( 4 );
86 97
87 QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget ); 98 QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget );
88 m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg ); 99 m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg );
89 connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 100 connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
90 m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg ); 101 m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg );
91 connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 102 connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
92 m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg ); 103 m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg );
93 connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 104 connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
94 m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg ); 105 m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg );
95 connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); 106 connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) );
96 layout->addWidget( bg ); 107 layout->addWidget( bg );
@@ -103,48 +114,56 @@ ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwa
103 114
104 layout->addSpacing( 15 ); 115 layout->addSpacing( 15 );
105 116
106 m_copyExample = new QLabel( widget ); 117 m_copyExample = new QLabel( widget );
107 m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); 118 m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
108 layout->addWidget( m_copyExample ); 119 layout->addWidget( m_copyExample );
109 120
110 if ( copyFormat == 0 ) 121 if ( copyFormat == 0 )
111 m_copyTextFull->animateClick(); 122 m_copyTextFull->animateClick();
112 else if ( copyFormat == 1 ) 123 else if ( copyFormat == 1 )
113 m_copyFull->animateClick(); 124 m_copyFull->animateClick();
114 else if ( copyFormat == 2 ) 125 else if ( copyFormat == 2 )
115 m_copyVerse->animateClick(); 126 m_copyVerse->animateClick();
116 else if ( copyFormat == 3 ) 127 else if ( copyFormat == 3 )
117 m_copyKey->animateClick(); 128 m_copyKey->animateClick();
118 129
119 layout->addStretch(); 130 layout->addStretch();
120 131
121 m_tabs.addTab( widget, "copy", tr( "Copy" ) ); 132 m_tabs.addTab( widget, "copy", tr( "Copy" ) );
122 133
123 // Font tab 134 // Font tab
124 m_font = new Opie::Ui::OFontSelector( true, this ); 135 m_font = new Opie::Ui::OFontSelector( true, this );
125 if ( font ) 136 if ( font )
126 m_font->setSelectedFont( *font ); 137 m_font->setSelectedFont( *font );
127 QWhatsThis::add( m_font, tr( "Select the font, style and size used for displaying texts." ) ); 138 QWhatsThis::add( m_font, tr( "Select the font, style and size used for displaying texts." ) );
128 139
129 m_tabs.addTab( m_font, "font", tr( "Font" ) ); 140 m_tabs.addTab( m_font, "font", tr( "Font" ) );
130 141
131 m_tabs.setCurrentTab( tr( "General" ) ); 142 m_tabs.setCurrentTab( tr( "General" ) );
132} 143}
133 144
134void ConfigureDlg::slotCopyFormatSelected() 145void ConfigureDlg::slotCopyFormatSelected()
135{ 146{
136 const QObject *option = sender(); 147 const QObject *option = sender();
137 148
138 QString text = tr( "KJV" ); 149 QString text = tr( "KJV" );
139 QString verse = tr( "In the beginning God created the heaven and the earth." ); 150 QString verse = tr( "In the beginning God created the heaven and the earth." );
140 QString key = tr( "Gen 1:1" ); 151 QString key = tr( "Gen 1:1" );
141 152
142 if ( option == m_copyTextFull && m_copyTextFull->isChecked() ) 153 if ( option == m_copyTextFull && m_copyTextFull->isChecked() )
143 m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) ); 154 m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) );
144 else if ( option == m_copyFull && m_copyFull->isChecked() ) 155 else if ( option == m_copyFull && m_copyFull->isChecked() )
145 m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) ); 156 m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) );
146 else if ( option == m_copyVerse && m_copyVerse->isChecked() ) 157 else if ( option == m_copyVerse && m_copyVerse->isChecked() )
147 m_copyExample->setText( verse ); 158 m_copyExample->setText( verse );
148 else if ( option == m_copyKey && m_copyKey->isChecked() ) 159 else if ( option == m_copyKey && m_copyKey->isChecked() )
149 m_copyExample->setText( key ); 160 m_copyExample->setText( key );
150} 161}
162
163void ConfigureDlg::slotSelectSwordPath()
164{
165 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_swordPath->text() );
166 if ( path.at( path.length() - 1 ) == '/' )
167 path.truncate( path.length() - 1 );
168 m_swordPath->setText( path );
169}
diff --git a/noncore/apps/dagger/configuredlg.h b/noncore/apps/dagger/configuredlg.h
index a91da12..56a4d94 100644
--- a/noncore/apps/dagger/configuredlg.h
+++ b/noncore/apps/dagger/configuredlg.h
@@ -25,51 +25,52 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc.,
25#include <qdialog.h> 25#include <qdialog.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qradiobutton.h> 27#include <qradiobutton.h>
28#include <qspinbox.h> 28#include <qspinbox.h>
29 29
30class QLabel; 30class QLabel;
31 31
32class ConfigureDlg : public QDialog 32class ConfigureDlg : public QDialog
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 ConfigureDlg( QWidget *parent = 0x0, const QString &swordPath = 0x0, bool alwaysOpenNew = true, 37 ConfigureDlg( QWidget *parent = 0x0, const QString &swordPath = 0x0, bool alwaysOpenNew = true,
38 int numVerses = 5, bool disableBlanking = false, int copyFormat = 0, const QFont *font = 0x0 ); 38 int numVerses = 5, bool disableBlanking = false, int copyFormat = 0, const QFont *font = 0x0 );
39 39
40 QString swordPath() { return m_swordPath->text(); } 40 QString swordPath() { return m_swordPath->text(); }
41 bool alwaysOpenNew() { return m_alwaysOpenNew->isChecked(); } 41 bool alwaysOpenNew() { return m_alwaysOpenNew->isChecked(); }
42 int numVerses() { return m_numVerses->value(); } 42 int numVerses() { return m_numVerses->value(); }
43 bool screenBlank() { return m_disableScreenBlank->isChecked(); } 43 bool screenBlank() { return m_disableScreenBlank->isChecked(); }
44 int copyFormat() { if ( m_copyFull->isChecked() ) 44 int copyFormat() { if ( m_copyFull->isChecked() )
45 return 1; 45 return 1;
46 else if ( m_copyVerse->isChecked() ) 46 else if ( m_copyVerse->isChecked() )
47 return 2; 47 return 2;
48 else if ( m_copyKey->isChecked() ) 48 else if ( m_copyKey->isChecked() )
49 return 3; 49 return 3;
50 else 50 else
51 return 0; } 51 return 0; }
52 QFont selectedFont() { return m_font->selectedFont(); } 52 QFont selectedFont() { return m_font->selectedFont(); }
53 53
54private: 54private:
55 Opie::Ui::OTabWidget m_tabs; // Main widget 55 Opie::Ui::OTabWidget m_tabs; // Main widget
56 Opie::Ui::OFontSelector *m_font; // Font selection widget 56 Opie::Ui::OFontSelector *m_font; // Font selection widget
57 57
58 // General tab's UI controls 58 // General tab's UI controls
59 QLineEdit *m_swordPath; // Contains path to Sword modules 59 QLineEdit *m_swordPath; // Contains path to Sword modules
60 QCheckBox *m_alwaysOpenNew; // Indicates whether to always open modules in a new tab 60 QCheckBox *m_alwaysOpenNew; // Indicates whether to always open modules in a new tab
61 QSpinBox *m_numVerses; // Contains number of verses to display for Bible modules 61 QSpinBox *m_numVerses; // Contains number of verses to display for Bible modules
62 QCheckBox *m_disableScreenBlank; // Indicates whether to disable automatic screen blanking 62 QCheckBox *m_disableScreenBlank; // Indicates whether to disable automatic screen blanking
63 63
64 // Copy tab's UI controls 64 // Copy tab's UI controls
65 QRadioButton *m_copyTextFull; // Verse (Text, Book cc:vv) 65 QRadioButton *m_copyTextFull; // Verse (Text, Book cc:vv)
66 QRadioButton *m_copyFull; // Verse (Book cc:vv) 66 QRadioButton *m_copyFull; // Verse (Book cc:vv)
67 QRadioButton *m_copyVerse; // Verse 67 QRadioButton *m_copyVerse; // Verse
68 QRadioButton *m_copyKey; // Book cc:vv 68 QRadioButton *m_copyKey; // Book cc:vv
69 QLabel *m_copyExample; // Text of copy format example 69 QLabel *m_copyExample; // Text of copy format example
70 70
71private slots: 71private slots:
72 void slotCopyFormatSelected(); 72 void slotCopyFormatSelected();
73 void slotSelectSwordPath();
73}; 74};
74 75
75#endif 76#endif