author | drw <drw> | 2004-04-06 16:00:07 (UTC) |
---|---|---|
committer | drw <drw> | 2004-04-06 16:00:07 (UTC) |
commit | 76406c20db58f6007539db80e0f7b27e7cc3e83f (patch) (unidiff) | |
tree | 0f19911a7ec644bb40e0e4650b312ddccffb5ad3 /noncore/apps/dagger/configuredlg.cpp | |
parent | 31a82304d62ab4943c0926c35cce552e2164eaf4 (diff) | |
download | opie-76406c20db58f6007539db80e0f7b27e7cc3e83f.zip opie-76406c20db58f6007539db80e0f7b27e7cc3e83f.tar.gz opie-76406c20db58f6007539db80e0f7b27e7cc3e83f.tar.bz2 |
New Bible reader app
Diffstat (limited to 'noncore/apps/dagger/configuredlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/dagger/configuredlg.cpp | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp new file mode 100644 index 0000000..e4dd60f --- a/dev/null +++ b/noncore/apps/dagger/configuredlg.cpp | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | Dagger - A Bible study program utilizing the Sword library. | ||
3 | Copyright (c) 2004 Dan Williams <drw@handhelds.org> | ||
4 | |||
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 | ||
7 | Foundation; either version 2 of the License, or (at your option) any later version. | ||
8 | |||
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 | ||
11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
12 | |||
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., | ||
15 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
16 | */ | ||
17 | |||
18 | #include "configuredlg.h" | ||
19 | |||
20 | #include <qvbuttongroup.h> | ||
21 | #include <qlabel.h> | ||
22 | #include <qlayout.h> | ||
23 | |||
24 | ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, | ||
25 | bool disableBlanking, int copyFormat, const QFont *font ) | ||
26 | : QDialog( parent, QString::null, true ) | ||
27 | , m_tabs( this ) | ||
28 | { | ||
29 | setCaption( tr( "Configure Dagger" ) ); | ||
30 | |||
31 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
32 | layout->setMargin( 4 ); | ||
33 | layout->addWidget( &m_tabs ); | ||
34 | |||
35 | // General tab | ||
36 | QWidget *widget = new QWidget( this ); | ||
37 | QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); | ||
38 | grid->setRowStretch( 9, 5 ); | ||
39 | grid->setColStretch( 0, 2 ); | ||
40 | |||
41 | QLabel *label = new QLabel( tr( "Path where Sword modules are located:" ), widget ); | ||
42 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | ||
43 | grid->addMultiCellWidget( label, 0, 0, 0, 1 ); | ||
44 | m_swordPath = new QLineEdit( swordPath, widget ); | ||
45 | 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 ); | ||
47 | label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); | ||
48 | grid->addMultiCellWidget( label, 2, 2, 0, 1 ); | ||
49 | |||
50 | grid->addRowSpacing( 3, 15 ); | ||
51 | |||
52 | m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); | ||
53 | m_alwaysOpenNew->setChecked( alwaysOpenNew ); | ||
54 | grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); | ||
55 | |||
56 | grid->addRowSpacing( 5, 15 ); | ||
57 | |||
58 | label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); | ||
59 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | ||
60 | grid->addWidget( label, 6, 0 ); | ||
61 | m_numVerses = new QSpinBox( 1, 20, 1, widget ); | ||
62 | m_numVerses->setValue( numVerses ); | ||
63 | grid->addWidget( m_numVerses, 6, 1 ); | ||
64 | |||
65 | grid->addRowSpacing( 7, 15 ); | ||
66 | |||
67 | m_disableScreenBlank = new QCheckBox( tr( "Disable automatic screen power-down?" ), widget ); | ||
68 | m_disableScreenBlank->setChecked( disableBlanking ); | ||
69 | grid->addMultiCellWidget( m_disableScreenBlank, 8, 8, 0, 1 ); | ||
70 | |||
71 | m_tabs.addTab( widget, "SettingsIcon", tr( "General" ) ); | ||
72 | |||
73 | // Copy tab | ||
74 | widget = new QWidget( this ); | ||
75 | layout = new QVBoxLayout( widget ); | ||
76 | layout->setMargin( 4 ); | ||
77 | |||
78 | QVButtonGroup *bg = new QVButtonGroup( tr( "Select copy format" ), widget ); | ||
79 | m_copyTextFull = new QRadioButton( tr( "\"Verse (Book cc:vv, text)\"" ), bg ); | ||
80 | connect( m_copyTextFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | ||
81 | m_copyFull = new QRadioButton( tr( "\"Verse (Book cc:vv)\"" ), bg ); | ||
82 | connect( m_copyFull, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | ||
83 | m_copyVerse = new QRadioButton( tr( "\"Verse\"" ), bg ); | ||
84 | connect( m_copyVerse, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | ||
85 | m_copyKey = new QRadioButton( tr( "\"Book cc:vv\"" ), bg ); | ||
86 | connect( m_copyKey, SIGNAL(clicked()), this, SLOT(slotCopyFormatSelected()) ); | ||
87 | layout->addWidget( bg ); | ||
88 | |||
89 | layout->addSpacing( 15 ); | ||
90 | |||
91 | label = new QLabel( tr( "Example:" ), widget ); | ||
92 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | ||
93 | layout->addWidget( label ); | ||
94 | |||
95 | layout->addSpacing( 15 ); | ||
96 | |||
97 | m_copyExample = new QLabel( widget ); | ||
98 | m_copyExample->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | ||
99 | layout->addWidget( m_copyExample ); | ||
100 | |||
101 | if ( copyFormat == 0 ) | ||
102 | m_copyTextFull->animateClick(); | ||
103 | else if ( copyFormat == 1 ) | ||
104 | m_copyFull->animateClick(); | ||
105 | else if ( copyFormat == 2 ) | ||
106 | m_copyVerse->animateClick(); | ||
107 | else if ( copyFormat == 3 ) | ||
108 | m_copyKey->animateClick(); | ||
109 | |||
110 | layout->addStretch(); | ||
111 | |||
112 | m_tabs.addTab( widget, "copy", tr( "Copy" ) ); | ||
113 | |||
114 | // Font tab | ||
115 | m_font = new Opie::Ui::OFontSelector( true, this ); | ||
116 | if ( font ) | ||
117 | m_font->setSelectedFont( *font ); | ||
118 | m_tabs.addTab( m_font, "font", tr( "Font" ) ); | ||
119 | |||
120 | m_tabs.setCurrentTab( tr( "General" ) ); | ||
121 | } | ||
122 | |||
123 | void ConfigureDlg::slotCopyFormatSelected() | ||
124 | { | ||
125 | const QObject *option = sender(); | ||
126 | |||
127 | QString text = tr( "KJV" ); | ||
128 | QString verse = tr( "In the beginning God created the heaven and the earth." ); | ||
129 | QString key = tr( "Gen 1:1" ); | ||
130 | |||
131 | if ( option == m_copyTextFull && m_copyTextFull->isChecked() ) | ||
132 | m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) ); | ||
133 | else if ( option == m_copyFull && m_copyFull->isChecked() ) | ||
134 | m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) ); | ||
135 | else if ( option == m_copyVerse && m_copyVerse->isChecked() ) | ||
136 | m_copyExample->setText( verse ); | ||
137 | else if ( option == m_copyKey && m_copyKey->isChecked() ) | ||
138 | m_copyExample->setText( key ); | ||
139 | } | ||