summaryrefslogtreecommitdiff
authordrw <drw>2002-11-02 21:45:56 (UTC)
committer drw <drw>2002-11-02 21:45:56 (UTC)
commit2dc81c48428222533e5479947d9ad318e464bafa (patch) (unidiff)
tree2e3570d18f3574c49ffc8aaf287bac4822ff3a11
parent5e1893923a9ddf1e2bd3e8f9c0dd264d86b8d98d (diff)
downloadopie-2dc81c48428222533e5479947d9ad318e464bafa.zip
opie-2dc81c48428222533e5479947d9ad318e464bafa.tar.gz
opie-2dc81c48428222533e5479947d9ad318e464bafa.tar.bz2
Implementing charting...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp122
-rw-r--r--noncore/apps/checkbook/checkbook.h11
-rw-r--r--noncore/apps/checkbook/graph.cpp85
-rw-r--r--noncore/apps/checkbook/graph.h9
-rw-r--r--noncore/apps/checkbook/graphinfo.cpp45
-rw-r--r--noncore/apps/checkbook/graphinfo.h8
6 files changed, 241 insertions, 39 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 20b42b5..77c1f57 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -1,512 +1,596 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "checkbook.h" 29#include "checkbook.h"
30#include "transaction.h" 30#include "transaction.h"
31#include "graph.h" 31#include "graph.h"
32#include "graphinfo.h" 32#include "graphinfo.h"
33 33
34#include <opie/otabwidget.h> 34#include <opie/otabwidget.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qpemessagebox.h> 37#include <qpe/qpemessagebox.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qcombobox.h> 40#include <qcombobox.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45#include <qlistview.h> 45#include <qlistview.h>
46#include <qmultilineedit.h> 46#include <qmultilineedit.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qwhatsthis.h> 48#include <qwhatsthis.h>
49#include <qwidget.h> 49#include <qwidget.h>
50 50
51Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) 51Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol )
52 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 52 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
53{ 53{
54 name = n; 54 name = n;
55 filename = fd; 55 filename = fd;
56 filename.append( name ); 56 filename.append( name );
57 filename.append( ".qcb" ); 57 filename.append( ".qcb" );
58 filedir = fd; 58 filedir = fd;
59 currencySymbol = symbol; 59 currencySymbol = symbol;
60 currBalance = 0.0; 60 currBalance = 0.0;
61 61
62 if ( name != "" ) 62 if ( name != "" )
63 { 63 {
64 QString tempstr = name; 64 QString tempstr = name;
65 tempstr.append( " - " ); 65 tempstr.append( " - " );
66 tempstr.append( tr( "Checkbook" ) ); 66 tempstr.append( tr( "Checkbook" ) );
67 setCaption( tempstr ); 67 setCaption( tempstr );
68 } 68 }
69 else 69 else
70 { 70 {
71 setCaption( tr( "New checkbook" ) ); 71 setCaption( tr( "New checkbook" ) );
72 } 72 }
73 73
74 // Setup layout to make everything pretty 74 // Setup layout to make everything pretty
75 QVBoxLayout *layout = new QVBoxLayout( this ); 75 QVBoxLayout *layout = new QVBoxLayout( this );
76 layout->setMargin( 2 ); 76 layout->setMargin( 2 );
77 layout->setSpacing( 4 ); 77 layout->setSpacing( 4 );
78 78
79 // Setup tabs for all info 79 // Setup tabs for all info
80 mainWidget = new OTabWidget( this ); 80 mainWidget = new OTabWidget( this );
81 layout->addWidget( mainWidget ); 81 layout->addWidget( mainWidget );
82 82
83 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); 83 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
84 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); 84 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
85 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); 85 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
86 mainWidget->setCurrentTab( tr( "Info" ) ); 86 mainWidget->setCurrentTab( tr( "Info" ) );
87 87
88 // Load checkbook information 88 // Load checkbook information
89 loadCheckbook(); 89 loadCheckbook();
90} 90}
91 91
92Checkbook::~Checkbook() 92Checkbook::~Checkbook()
93{ 93{
94} 94}
95 95
96const QString &Checkbook::getName() 96const QString &Checkbook::getName()
97{ 97{
98 return( name ); 98 return( name );
99} 99}
100 100
101QWidget *Checkbook::initInfo() 101QWidget *Checkbook::initInfo()
102{ 102{
103 QWidget *control = new QWidget( mainWidget ); 103 QWidget *control = new QWidget( mainWidget );
104 104
105 QVBoxLayout *vb = new QVBoxLayout( control ); 105 QVBoxLayout *vb = new QVBoxLayout( control );
106 106
107 QScrollView *sv = new QScrollView( control ); 107 QScrollView *sv = new QScrollView( control );
108 vb->addWidget( sv, 0, 0 ); 108 vb->addWidget( sv, 0, 0 );
109 sv->setResizePolicy( QScrollView::AutoOneFit ); 109 sv->setResizePolicy( QScrollView::AutoOneFit );
110 sv->setFrameStyle( QFrame::NoFrame ); 110 sv->setFrameStyle( QFrame::NoFrame );
111 111
112 QWidget *container = new QWidget( sv->viewport() ); 112 QWidget *container = new QWidget( sv->viewport() );
113 sv->addChild( container ); 113 sv->addChild( container );
114 114
115 QGridLayout *layout = new QGridLayout( container ); 115 QGridLayout *layout = new QGridLayout( container );
116 layout->setSpacing( 2 ); 116 layout->setSpacing( 2 );
117 layout->setMargin( 4 ); 117 layout->setMargin( 4 );
118 118
119 // Account name 119 // Account name
120 QLabel *label = new QLabel( tr( "Name:" ), container ); 120 QLabel *label = new QLabel( tr( "Name:" ), container );
121 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); 121 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
122 layout->addWidget( label, 0, 0 ); 122 layout->addWidget( label, 0, 0 );
123 nameEdit = new QLineEdit( container ); 123 nameEdit = new QLineEdit( container );
124 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); 124 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
125 connect( nameEdit, SIGNAL( textChanged( const QString & ) ), 125 connect( nameEdit, SIGNAL( textChanged( const QString & ) ),
126 this, SLOT( slotNameChanged( const QString & ) ) ); 126 this, SLOT( slotNameChanged( const QString & ) ) );
127 layout->addWidget( nameEdit, 0, 1 ); 127 layout->addWidget( nameEdit, 0, 1 );
128 128
129 // Type of account 129 // Type of account
130 label = new QLabel( tr( "Type:" ), container ); 130 label = new QLabel( tr( "Type:" ), container );
131 QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); 131 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
132 layout->addWidget( label, 1, 0 ); 132 layout->addWidget( label, 1, 0 );
133 typeList = new QComboBox( container ); 133 typeList = new QComboBox( container );
134 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); 134 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
135 typeList->insertItem( tr( "Savings" ) ); // 0 135 typeList->insertItem( tr( "Savings" ) ); // 0
136 typeList->insertItem( tr( "Checking" ) ); // 1 136 typeList->insertItem( tr( "Checking" ) ); // 1
137 typeList->insertItem( tr( "CD" ) ); // 2 137 typeList->insertItem( tr( "CD" ) ); // 2
138 typeList->insertItem( tr( "Money market" ) );// 3 138 typeList->insertItem( tr( "Money market" ) );// 3
139 typeList->insertItem( tr( "Mutual fund" ) );// 4 139 typeList->insertItem( tr( "Mutual fund" ) );// 4
140 typeList->insertItem( tr( "Other" ) ); // 5 140 typeList->insertItem( tr( "Other" ) ); // 5
141 layout->addWidget( typeList, 1, 1 ); 141 layout->addWidget( typeList, 1, 1 );
142 142
143 // Bank/institution name 143 // Bank/institution name
144 label = new QLabel( tr( "Bank:" ), container ); 144 label = new QLabel( tr( "Bank:" ), container );
145 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); 145 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
146 layout->addWidget( label, 2, 0 ); 146 layout->addWidget( label, 2, 0 );
147 bankEdit = new QLineEdit( container ); 147 bankEdit = new QLineEdit( container );
148 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); 148 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
149 layout->addWidget( bankEdit, 2, 1 ); 149 layout->addWidget( bankEdit, 2, 1 );
150 150
151 // Account number 151 // Account number
152 label = new QLabel( tr( "Account number:" ), container ); 152 label = new QLabel( tr( "Account number:" ), container );
153 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); 153 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
154 layout->addWidget( label, 3, 0 ); 154 layout->addWidget( label, 3, 0 );
155 acctNumEdit = new QLineEdit( container ); 155 acctNumEdit = new QLineEdit( container );
156 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); 156 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
157 layout->addWidget( acctNumEdit, 3, 1 ); 157 layout->addWidget( acctNumEdit, 3, 1 );
158 158
159 // PIN number 159 // PIN number
160 label = new QLabel( tr( "PIN number:" ), container ); 160 label = new QLabel( tr( "PIN number:" ), container );
161 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); 161 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
162 layout->addWidget( label, 4, 0 ); 162 layout->addWidget( label, 4, 0 );
163 pinNumEdit = new QLineEdit( container ); 163 pinNumEdit = new QLineEdit( container );
164 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); 164 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
165 layout->addWidget( pinNumEdit, 4, 1 ); 165 layout->addWidget( pinNumEdit, 4, 1 );
166 166
167 // Starting balance 167 // Starting balance
168 label = new QLabel( tr( "Starting balance:" ), container ); 168 label = new QLabel( tr( "Starting balance:" ), container );
169 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); 169 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
170 layout->addWidget( label, 5, 0 ); 170 layout->addWidget( label, 5, 0 );
171 balanceEdit = new QLineEdit( container ); 171 balanceEdit = new QLineEdit( container );
172 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); 172 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
173 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), 173 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ),
174 this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); 174 this, SLOT( slotStartingBalanceChanged( const QString & ) ) );
175 layout->addWidget( balanceEdit, 5, 1 ); 175 layout->addWidget( balanceEdit, 5, 1 );
176 176
177 // Notes 177 // Notes
178 label = new QLabel( tr( "Notes:" ), container ); 178 label = new QLabel( tr( "Notes:" ), container );
179 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); 179 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
180 layout->addWidget( label, 6, 0 ); 180 layout->addWidget( label, 6, 0 );
181 notesEdit = new QMultiLineEdit( container ); 181 notesEdit = new QMultiLineEdit( container );
182 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); 182 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
183 notesEdit->setMaximumHeight( 85 ); 183 notesEdit->setMaximumHeight( 85 );
184 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); 184 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 );
185 185
186 return control; 186 return control;
187} 187}
188 188
189QWidget *Checkbook::initTransactions() 189QWidget *Checkbook::initTransactions()
190{ 190{
191 QWidget *control = new QWidget( mainWidget ); 191 QWidget *control = new QWidget( mainWidget );
192 192
193 QGridLayout *layout = new QGridLayout( control ); 193 QGridLayout *layout = new QGridLayout( control );
194 layout->setSpacing( 2 ); 194 layout->setSpacing( 2 );
195 layout->setMargin( 4 ); 195 layout->setMargin( 4 );
196 196
197 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), 197 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ),
198 control ); 198 control );
199 QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); 199 QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) );
200 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); 200 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 );
201 201
202 tranTable = new QListView( control ); 202 tranTable = new QListView( control );
203 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); 203 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) );
204 tranTable->addColumn( tr( "ID" ) ); 204 tranTable->addColumn( tr( "ID" ) );
205 tranTable->addColumn( tr( "Date" ) ); 205 tranTable->addColumn( tr( "Date" ) );
206 tranTable->addColumn( tr( "Description" ) ); 206 tranTable->addColumn( tr( "Description" ) );
207 int colnum = tranTable->addColumn( tr( "Amount" ) ); 207 int colnum = tranTable->addColumn( tr( "Amount" ) );
208 tranTable->setColumnAlignment( colnum, Qt::AlignRight ); 208 tranTable->setColumnAlignment( colnum, Qt::AlignRight );
209 tranTable->setAllColumnsShowFocus( TRUE ); 209 tranTable->setAllColumnsShowFocus( TRUE );
210 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 210 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
211 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 211 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
212 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 212 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
213 this, SLOT( slotEditTran() ) ); 213 this, SLOT( slotEditTran() ) );
214 214
215 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 215 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
216 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 216 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
217 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 217 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
218 layout->addWidget( btn, 2, 0 ); 218 layout->addWidget( btn, 2, 0 );
219 219
220 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); 220 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
221 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 221 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
222 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); 222 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
223 layout->addWidget( btn, 2, 1 ); 223 layout->addWidget( btn, 2, 1 );
224 224
225 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); 225 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
226 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 226 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
227 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); 227 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
228 layout->addWidget( btn, 2, 2 ); 228 layout->addWidget( btn, 2, 2 );
229 229
230 return( control ); 230 return( control );
231} 231}
232 232
233QWidget *Checkbook::initCharts() 233QWidget *Checkbook::initCharts()
234{ 234{
235 graphInfo = 0x0;
236
235 QWidget *control = new QWidget( mainWidget ); 237 QWidget *control = new QWidget( mainWidget );
236 238
237 QGridLayout *layout = new QGridLayout( control ); 239 QGridLayout *layout = new QGridLayout( control );
238 layout->setSpacing( 2 ); 240 layout->setSpacing( 2 );
239 layout->setMargin( 4 ); 241 layout->setMargin( 4 );
240 242
241/* 243 graphWidget = new Graph( control );
242 QLabel *label = new QLabel( control ); 244 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) );
243 label->setText( tr( "Graph type:" ) ); 245 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 );
244 layout->addWidget( label, 0, 0 ); 246
245 graphList = new QComboBox( control ); 247 graphList = new QComboBox( control );
246 graphList->insertItem( tr( "By category" ) ); 248 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) );
247 graphList->insertItem( tr( "..." ) ); 249 graphList->insertItem( tr( "Account balance" ) );
248 graphList->insertItem( tr( "..." ) ); 250 graphList->insertItem( tr( "Withdrawals by category" ) );
249 layout->addWidget( graphList, 0, 1 ); 251 graphList->insertItem( tr( "Deposits by category" ) );
250*/
251 252
252 GraphInfo* info = new GraphInfo( GraphInfo::BarChart, 0x0, tr( "Graph Title" ), 253 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 );
253 tr( "X-Axis" ), tr( "Y-Axis" ) );
254 graphWidget = new Graph( control, info );
255 QWhatsThis::add( graphWidget, tr( "Charting is not implemented yet." ) );
256 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 );
257 254
258 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); 255 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
259 QWhatsThis::add( btn, tr( "Click here to draw the chart." ) ); 256 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) );
260 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); 257 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
261 layout->addWidget( btn, 1, 1 ); 258 layout->addWidget( btn, 1, 2 );
262 259
263 return control; 260 return control;
264} 261}
265 262
266void Checkbook::loadCheckbook() 263void Checkbook::loadCheckbook()
267{ 264{
268 transactions.clear(); 265 transactions.clear();
269 266
270 Config config(filename, Config::File); 267 Config config(filename, Config::File);
271 268
272 // Load info 269 // Load info
273 config.setGroup( "Account" ); 270 config.setGroup( "Account" );
274 nameEdit->setText( name ); 271 nameEdit->setText( name );
275 QString temptext = config.readEntry( "Type" ); 272 QString temptext = config.readEntry( "Type" );
276 int i = typeList->count(); 273 int i = typeList->count();
277 while ( i > 0 ) 274 while ( i > 0 )
278 { 275 {
279 i--; 276 i--;
280 typeList->setCurrentItem( i ); 277 typeList->setCurrentItem( i );
281 if ( typeList->currentText() == temptext ) 278 if ( typeList->currentText() == temptext )
282 { 279 {
283 break; 280 break;
284 } 281 }
285 } 282 }
286 bankEdit->setText( config.readEntry( "Bank", "" ) ); 283 bankEdit->setText( config.readEntry( "Bank", "" ) );
287 acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); 284 acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) );
288 pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); 285 pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) );
289 balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); 286 balanceEdit->setText( config.readEntry( "Balance", "0.0" ) );
290 notesEdit->setText( config.readEntry( "Notes", "" ) ); 287 notesEdit->setText( config.readEntry( "Notes", "" ) );
291 288
292 bool ok; 289 bool ok;
293 currBalance = balanceEdit->text().toFloat( &ok ); 290 currBalance = balanceEdit->text().toFloat( &ok );
294 startBalance = currBalance; 291 startBalance = currBalance;
295 292
296 // Load transactions 293 // Load transactions
297 TranInfo *tran; 294 TranInfo *tran;
298 QString trandesc = ""; 295 QString trandesc = "";
299 float amount; 296 float amount;
300 QString stramount; 297 QString stramount;
301 for ( int i = 1; trandesc != QString::null; i++ ) 298 for ( int i = 1; trandesc != QString::null; i++ )
302 { 299 {
303 tran = new TranInfo( config, i ); 300 tran = new TranInfo( config, i );
304 trandesc = tran->desc(); 301 trandesc = tran->desc();
305 if ( trandesc != QString::null ) 302 if ( trandesc != QString::null )
306 { 303 {
307 currBalance -= tran->fee(); 304 currBalance -= tran->fee();
308 amount = tran->amount(); 305 amount = tran->amount();
309 if ( tran->withdrawal() ) 306 if ( tran->withdrawal() )
310 { 307 {
311 amount *= -1; 308 amount *= -1;
312 } 309 }
313 currBalance += amount; 310 currBalance += amount;
314 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 311 stramount.sprintf( "%c%.2f", currencySymbol, amount );
315 312
316 // Add to transaction list 313 // Add to transaction list
317 transactions.append( tran ); 314 transactions.append( tran );
318 315
319 // Add to transaction table 316 // Add to transaction table
320 ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(), 317 ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(),
321 trandesc, stramount ); 318 trandesc, stramount );
322 } 319 }
323 else 320 else
324 { 321 {
325 delete tran; 322 delete tran;
326 } 323 }
327 } 324 }
328 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 325 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
329 326
330 highTranNum = transactions.count(); 327 highTranNum = transactions.count();
331} 328}
332 329
333void Checkbook::adjustBalance( float amount ) 330void Checkbook::adjustBalance( float amount )
334{ 331{
335 currBalance += amount; 332 currBalance += amount;
336 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 333 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
337 334
338} 335}
339 336
340TranInfo *Checkbook::findTranByID( int id ) 337TranInfo *Checkbook::findTranByID( int id )
341{ 338{
342 TranInfo *traninfo = transactions.first(); 339 TranInfo *traninfo = transactions.first();
343 while ( traninfo && traninfo->id() != id ) 340 while ( traninfo && traninfo->id() != id )
344 { 341 {
345 traninfo = transactions.next(); 342 traninfo = transactions.next();
346 } 343 }
347 return( traninfo ); 344 return( traninfo );
348} 345}
349 346
350void Checkbook::accept() 347void Checkbook::accept()
351{ 348{
352 QFile f( filename ); 349 QFile f( filename );
353 if ( f.exists() ) 350 if ( f.exists() )
354 { 351 {
355 f.remove(); 352 f.remove();
356 } 353 }
357 354
358 Config *config = new Config(filename, Config::File); 355 Config *config = new Config(filename, Config::File);
359 356
360 // Save info 357 // Save info
361 config->setGroup( "Account" ); 358 config->setGroup( "Account" );
362 config->writeEntry( "Type", typeList->currentText() ); 359 config->writeEntry( "Type", typeList->currentText() );
363 config->writeEntry( "Bank", bankEdit->text() ); 360 config->writeEntry( "Bank", bankEdit->text() );
364 config->writeEntryCrypt( "Number", acctNumEdit->text() ); 361 config->writeEntryCrypt( "Number", acctNumEdit->text() );
365 config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); 362 config->writeEntryCrypt( "PINNumber", pinNumEdit->text() );
366 config->writeEntry( "Balance", balanceEdit->text() ); 363 config->writeEntry( "Balance", balanceEdit->text() );
367 config->writeEntry( "Notes", notesEdit->text() ); 364 config->writeEntry( "Notes", notesEdit->text() );
368 365
369 // Save transactions 366 // Save transactions
370 TranInfo *tran = transactions.first();
371 int i = 1; 367 int i = 1;
372 while ( tran ) 368 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() )
373 { 369 {
374 tran->write( config, i ); 370 tran->write( config, i );
375 tran = transactions.next();
376 i++; 371 i++;
377 } 372 }
378 config->write(); 373 config->write();
379 374
380 QDialog::accept(); 375 QDialog::accept();
381} 376}
382 377
383void Checkbook::slotNameChanged( const QString &newname ) 378void Checkbook::slotNameChanged( const QString &newname )
384{ 379{
385 name = newname; 380 name = newname;
386 filename = filedir; 381 filename = filedir;
387 filename.append( newname ); 382 filename.append( newname );
388 filename.append( ".qcb" ); 383 filename.append( ".qcb" );
389 QString tempstr = name; 384 QString tempstr = name;
390 tempstr.append( " - " ); 385 tempstr.append( " - " );
391 tempstr.append( tr( "Checkbook" ) ); 386 tempstr.append( tr( "Checkbook" ) );
392 setCaption( tempstr ); 387 setCaption( tempstr );
393} 388}
394 389
395void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) 390void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
396{ 391{
397 currBalance -= startBalance; 392 currBalance -= startBalance;
398 bool ok; 393 bool ok;
399 startBalance = newbalance.toFloat( &ok ); 394 startBalance = newbalance.toFloat( &ok );
400 adjustBalance( startBalance ); 395 adjustBalance( startBalance );
401} 396}
402 397
403void Checkbook::slotNewTran() 398void Checkbook::slotNewTran()
404{ 399{
405 highTranNum++; 400 highTranNum++;
406 TranInfo *traninfo = new TranInfo( highTranNum ); 401 TranInfo *traninfo = new TranInfo( highTranNum );
407 402
408 Transaction *currtran = new Transaction( this, name, 403 Transaction *currtran = new Transaction( this, name,
409 traninfo, 404 traninfo,
410 currencySymbol ); 405 currencySymbol );
411 currtran->showMaximized(); 406 currtran->showMaximized();
412 if ( currtran->exec() == QDialog::Accepted ) 407 if ( currtran->exec() == QDialog::Accepted )
413 { 408 {
414 float amount = traninfo->amount(); 409 float amount = traninfo->amount();
415 if ( traninfo->withdrawal() ) 410 if ( traninfo->withdrawal() )
416 { 411 {
417 amount *= -1; 412 amount *= -1;
418 } 413 }
419 QString stramount; 414 QString stramount;
420 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 415 stramount.sprintf( "%c%.2f", currencySymbol, amount );
421 416
422 // Add to transaction list 417 // Add to transaction list
423 transactions.append( traninfo ); 418 transactions.append( traninfo );
424 419
425 // Add to transaction table 420 // Add to transaction table
426 ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), 421 ( void ) new QListViewItem( tranTable, QString::number( highTranNum ),
427 traninfo->datestr(), traninfo->desc(), stramount ); 422 traninfo->datestr(), traninfo->desc(), stramount );
428 423
429 adjustBalance( amount ); 424 adjustBalance( amount );
430 } 425 }
431 else 426 else
432 { 427 {
433 highTranNum--; 428 highTranNum--;
434 delete traninfo; 429 delete traninfo;
435 } 430 }
436} 431}
437 432
438void Checkbook::slotEditTran() 433void Checkbook::slotEditTran()
439{ 434{
440 bool ok; 435 bool ok;
441 QListViewItem *curritem = tranTable->currentItem(); 436 QListViewItem *curritem = tranTable->currentItem();
442 if ( !curritem ) 437 if ( !curritem )
443 { 438 {
444 return; 439 return;
445 } 440 }
446 441
447 int tranid = curritem->text( 0 ).toInt( &ok ); 442 int tranid = curritem->text( 0 ).toInt( &ok );
448 TranInfo *traninfo = findTranByID( tranid ); 443 TranInfo *traninfo = findTranByID( tranid );
449 float origamt = traninfo->amount(); 444 float origamt = traninfo->amount();
450 if ( traninfo->withdrawal() ) 445 if ( traninfo->withdrawal() )
451 { 446 {
452 origamt *= -1; 447 origamt *= -1;
453 } 448 }
454 449
455 Transaction *currtran = new Transaction( this, name, 450 Transaction *currtran = new Transaction( this, name,
456 traninfo, 451 traninfo,
457 currencySymbol ); 452 currencySymbol );
458 currtran->showMaximized(); 453 currtran->showMaximized();
459 if ( currtran->exec() == QDialog::Accepted ) 454 if ( currtran->exec() == QDialog::Accepted )
460 { 455 {
461 curritem->setText( 1, traninfo->datestr() ); 456 curritem->setText( 1, traninfo->datestr() );
462 457
463 curritem->setText( 2, traninfo->desc() ); 458 curritem->setText( 2, traninfo->desc() );
464 459
465 float amount = traninfo->amount(); 460 float amount = traninfo->amount();
466 if ( traninfo->withdrawal() ) 461 if ( traninfo->withdrawal() )
467 { 462 {
468 amount *= -1; 463 amount *= -1;
469 } 464 }
470 adjustBalance( origamt * -1 ); 465 adjustBalance( origamt * -1 );
471 adjustBalance( amount ); 466 adjustBalance( amount );
472 QString stramount; 467 QString stramount;
473 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 468 stramount.sprintf( "%c%.2f", currencySymbol, amount );
474 curritem->setText( 3, stramount ); 469 curritem->setText( 3, stramount );
475 470
476 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 471 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
477 472
478 delete currtran; 473 delete currtran;
479 } 474 }
480} 475}
481 476
482void Checkbook::slotDeleteTran() 477void Checkbook::slotDeleteTran()
483{ 478{
484 QListViewItem *curritem = tranTable->currentItem(); 479 QListViewItem *curritem = tranTable->currentItem();
485 if ( !curritem ) 480 if ( !curritem )
486 { 481 {
487 return; 482 return;
488 } 483 }
489 484
490 bool ok; 485 bool ok;
491 int tranid = curritem->text( 0 ).toInt( &ok ); 486 int tranid = curritem->text( 0 ).toInt( &ok );
492 TranInfo *traninfo = findTranByID( tranid ); 487 TranInfo *traninfo = findTranByID( tranid );
493 488
494 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) 489 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
495 { 490 {
496 float amount = traninfo->amount(); 491 float amount = traninfo->amount();
497 if ( traninfo->withdrawal() ) 492 if ( traninfo->withdrawal() )
498 { 493 {
499 amount *= -1; 494 amount *= -1;
500 } 495 }
501 496
502 transactions.remove( traninfo ); 497 transactions.remove( traninfo );
503 delete traninfo; 498 delete traninfo;
504 delete curritem; 499 delete curritem;
505 500
506 adjustBalance( amount * -1 ); 501 adjustBalance( amount * -1 );
507 } 502 }
508} 503}
509 504
510void Checkbook::slotDrawGraph() 505void Checkbook::slotDrawGraph()
511{ 506{
507 if ( graphInfo )
508 {
509 delete graphInfo;
510 }
511
512 switch ( graphList->currentItem() )
513 {
514 case 0 : drawBalanceChart();
515 break;
516 case 1 : drawCategoryChart( TRUE );
517 break;
518 case 2 : drawCategoryChart( FALSE );
519 break;
520 };
521
522 graphWidget->setGraphInfo( graphInfo );
523 graphWidget->drawGraph( TRUE );
524}
525
526void Checkbook::drawBalanceChart()
527{
528 DataPointList *list = new DataPointList();
529
530 float balance = startBalance;
531 float amount;
532 QString label;
533 int i = 0;
534 int count = transactions.count();
535
536 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() )
537 {
538 i++;
539 balance -= tran->fee();
540 amount = tran->amount();
541 if ( tran->withdrawal() )
542 {
543 amount *= -1;
544 }
545 balance += amount;
546 if ( i == 1 || i == count / 2 || i == count )
547 {
548 label = tran->datestr();
549 }
550 else
551 {
552 label = "";
553 }
554 list->append( new DataPointInfo( label, balance ) );
555 }
556
557 graphInfo = new GraphInfo( GraphInfo::BarChart, list );
558}
559
560void Checkbook::drawCategoryChart( bool withdrawals )
561{
562 DataPointList *list = new DataPointList();
563
564 TranInfo *tran = transactions.first();
565 if ( tran->withdrawal() == withdrawals )
566 {
567 list->append( new DataPointInfo( tran->category(), tran->amount() ) );
568 }
569 tran = transactions.next();
570
571 DataPointInfo *cat;
572 for ( ; tran; tran = transactions.next() )
573 {
574 if ( tran->withdrawal() == withdrawals )
575 {
576 // Find category in list
577 for ( cat = list->first(); cat; cat = list->next() )
578 {
579 if ( cat->label() == tran->category() )
580 {
581 break;
582 }
583 }
584 if ( cat && cat->label() == tran->category() )
585 { // Found category, add to transaction to category total
586 cat->addToValue( tran->amount() );
587 }
588 else
589 { // Didn't find category, add category to list
590 list->append( new DataPointInfo( tran->category(), tran->amount() ) );
591 }
592 }
593 }
594
595 graphInfo = new GraphInfo( GraphInfo::PieChart, list );
512} 596}
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index 01f1115..287788a 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -1,103 +1,108 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef CHECKBOOK_H 29#ifndef CHECKBOOK_H
30#define CHECKBOOK_H 30#define CHECKBOOK_H
31 31
32#include "traninfo.h" 32#include "traninfo.h"
33 33
34#include <qdialog.h> 34#include <qdialog.h>
35 35
36class OTabWidget; 36class OTabWidget;
37 37
38class Graph; 38class Graph;
39class GraphInfo;
39class QComboBox; 40class QComboBox;
40class QLabel; 41class QLabel;
41class QLineEdit; 42class QLineEdit;
42class QListView; 43class QListView;
43class QMultiLineEdit; 44class QMultiLineEdit;
44class QString; 45class QString;
45 46
46class Checkbook : public QDialog 47class Checkbook : public QDialog
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49 50
50 public: 51 public:
51 Checkbook( QWidget * = 0x0, const QString & = 0x0, const QString & = 0x0, char = '$' ); 52 Checkbook( QWidget * = 0x0, const QString & = 0x0, const QString & = 0x0, char = '$' );
52 ~Checkbook(); 53 ~Checkbook();
53 54
54 const QString &getName(); 55 const QString &getName();
55 56
56 private: 57 private:
57 TranInfoList transactions; 58 TranInfoList transactions;
58 QString name; 59 QString name;
59 QString filename; 60 QString filename;
60 QString filedir; 61 QString filedir;
61 char currencySymbol; 62 char currencySymbol;
62 int highTranNum; 63 int highTranNum;
63 64
64 OTabWidget *mainWidget; 65 OTabWidget *mainWidget;
65 void loadCheckbook(); 66 void loadCheckbook();
66 void adjustBalance( float ); 67 void adjustBalance( float );
67 TranInfo *findTranByID( int ); 68 TranInfo *findTranByID( int );
68 69
69 // Info tab 70 // Info tab
70 QWidget *initInfo(); 71 QWidget *initInfo();
71 QLineEdit *nameEdit; 72 QLineEdit *nameEdit;
72 QComboBox *typeList; 73 QComboBox *typeList;
73 QLineEdit *bankEdit; 74 QLineEdit *bankEdit;
74 QLineEdit *acctNumEdit; 75 QLineEdit *acctNumEdit;
75 QLineEdit *pinNumEdit; 76 QLineEdit *pinNumEdit;
76 QLineEdit *balanceEdit; 77 QLineEdit *balanceEdit;
77 QMultiLineEdit *notesEdit; 78 QMultiLineEdit *notesEdit;
78 float startBalance; 79 float startBalance;
79 80
80 // Transactions tab 81 // Transactions tab
81 QWidget *initTransactions(); 82 QWidget *initTransactions();
82 QListView *tranTable; 83 QListView *tranTable;
83 QLabel *balanceLabel; 84 QLabel *balanceLabel;
84 float currBalance; 85 float currBalance;
85 86
86 // Charts tab 87 // Charts tab
87 QWidget *initCharts(); 88 QWidget *initCharts();
88 //QComboBox *graphList; 89 GraphInfo *graphInfo;
89 Graph *graphWidget; 90 QComboBox *graphList;
91 Graph *graphWidget;
92
93 void drawBalanceChart();
94 void drawCategoryChart( bool = TRUE );
90 95
91 protected slots: 96 protected slots:
92 void accept(); 97 void accept();
93 98
94 private slots: 99 private slots:
95 void slotNameChanged( const QString & ); 100 void slotNameChanged( const QString & );
96 void slotStartingBalanceChanged( const QString & ); 101 void slotStartingBalanceChanged( const QString & );
97 void slotNewTran(); 102 void slotNewTran();
98 void slotEditTran(); 103 void slotEditTran();
99 void slotDeleteTran(); 104 void slotDeleteTran();
100 void slotDrawGraph(); 105 void slotDrawGraph();
101}; 106};
102 107
103#endif 108#endif
diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp
index bae92da..a0d8b78 100644
--- a/noncore/apps/checkbook/graph.cpp
+++ b/noncore/apps/checkbook/graph.cpp
@@ -1,112 +1,179 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "graph.h" 29#include "graph.h"
30#include "graphinfo.h" 30#include "graphinfo.h"
31 31
32#include <qcolor.h>
33#include <qfontmetrics.h>
32#include <qpainter.h> 34#include <qpainter.h>
33 35
34Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) 36Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags )
35 : QWidget( parent, name, flags ) 37 : QWidget( parent, name, flags )
36{ 38{
37 setBackgroundMode( QWidget::PaletteBase );
38
39 data = d; 39 data = d;
40 40
41 graph.setOptimization( QPixmap::BestOptim ); 41 graph.setOptimization( QPixmap::BestOptim );
42} 42}
43 43
44void Graph::setGraphInfo( GraphInfo *d ) 44void Graph::setGraphInfo( GraphInfo *d )
45{ 45{
46 data = d; 46 data = d;
47} 47}
48 48
49void Graph::drawGraph( bool regen ) 49void Graph::drawGraph( bool regen )
50{ 50{
51 if ( regen ) 51 if ( regen )
52 { 52 {
53 initGraph(); 53 initGraph();
54 } 54 }
55 QPainter p( this ); 55 QPainter p( this );
56 p.drawPixmap( 0, 0, graph ); 56 p.drawPixmap( 0, 0, graph );
57} 57}
58 58
59void Graph::paintEvent( QPaintEvent * ) 59void Graph::paintEvent( QPaintEvent * )
60{ 60{
61 drawGraph( FALSE ); 61 drawGraph( FALSE );
62} 62}
63 63
64void Graph::resizeEvent( QResizeEvent * ) 64void Graph::resizeEvent( QResizeEvent * )
65{ 65{
66 drawGraph( TRUE ); 66 drawGraph( TRUE );
67} 67}
68 68
69void Graph::initGraph() 69void Graph::initGraph()
70{ 70{
71 graph.resize( width(), height() ); 71 graph.resize( width(), height() );
72 graph.fill( QColor( 255, 255, 255 ) ); 72 graph.fill( QColor( 255, 255, 255 ) );
73 73
74 if ( !data ) 74 if ( !data )
75 { 75 {
76 return; 76 return;
77 } 77 }
78 78
79 // Any common stuff here (titles, ???) 79 // Any common stuff here (titles, ???)
80 80
81 switch ( data->graphType() ) 81 switch ( data->graphType() )
82 { 82 {
83 case GraphInfo::BarChart : 83 case GraphInfo::BarChart :
84 { 84 {
85 drawBarChart(); 85 drawBarChart( width(), height(), data->maxValue() );
86 } 86 }
87 break; 87 break;
88 case GraphInfo::LineChart : 88 case GraphInfo::LineChart :
89 { 89 {
90 drawLineChart(); 90 //drawLineChart( p, s, min, max );
91 } 91 }
92 break; 92 break;
93 case GraphInfo::PieChart : 93 case GraphInfo::PieChart :
94 { 94 {
95 drawPieChart(); 95 drawPieChart( width(), height(), data->totalValue() );
96 } 96 }
97 }; 97 };
98} 98}
99 99
100void Graph::drawBarChart() 100void Graph::drawBarChart( int width, int height, float max )
101{ 101{
102 //Find max value in GraphInfo->dataPoints() - make function in GraphInfo!!! 102 QPainter p( &graph );
103
104 // Try to set the font size smaller for text
105 QFont f = font();
106 f.setPointSize( 8 );
107 p.setFont( f );
108
109 int x = 0;
110 int i = 0;
111 int n = data->numberDataPoints();
112 QFontMetrics fm=fontMetrics();
113 int fh = fm.height();
114 int fw;
115
116 QColor c( 0, 0, 255);
117 p.setBrush( c );
118
119 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
120 {
121 int bw = ( width - width / 4 - x ) / ( n - i );
122 int bh = int( ( height - height / 4 - 1 ) * dp->value() / max );
123 p.drawRect( width / 8 + x, height - height / 8 - 1 - bh, bw, bh );
124 fw = fm.width( dp->label() );
125 p.drawText( width / 8 + x - fw / 2 + bw / 2, height - height / 8, fw,
126 fh + height / 8, AlignTop | AlignHCenter, dp->label() );
127 // WordBreak | AlignTop | AlignHCenter, dp->label() );
128 i++;
129 x += bw;
130 }
103} 131}
104 132
105void Graph::drawLineChart() 133void Graph::drawLineChart( int width, int height, float max )
106{ 134{
107} 135}
108 136
109void Graph::drawPieChart() 137void Graph::drawPieChart( int width, int height, float sum )
110{ 138{
139 QPainter p( &graph );
140
141 // Try to set the font size smaller for text
142 QFont f = font();
143 f.setPointSize( 8 );
144 p.setFont( f );
145
146 int n = data->numberDataPoints();
147
148 int apos = -90 * 16;
149
150 int xd = width - width / 5;
151 int yd = height - height / 5;
152
153 int i = 0;
154
155 QColor c;
156
157 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
158 {
159 c.setHsv( ( i *255) / n, 255, 255 );
160 p.setBrush( c );
161
162 int a = int( ( dp->value() * 360.0 ) / sum * 16.0 + 0.5 );
163 p.drawPie( width/10, height/10, xd, yd, -apos, -a );
164 apos += a;
165 i++;
166 }
167
168 double apos2 = -90 * 3.14159 / 180;
169 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
170 {
171 double a = dp->value() *360 / sum * 3.14159 / 180;
172 int x = int( cos( apos2 + a/2 ) * width * 5/16 + width/2 + 0.5 );
173 int y = int( sin( apos2 + a/2 ) * height * 5/16 + height/2 + 0.5 );
174 p.drawText( x - width/8, y - height/8, width/4, height/4, WordBreak | AlignCenter,
175 dp->label() );
176 apos2 += a;
177 }
111} 178}
112 179
diff --git a/noncore/apps/checkbook/graph.h b/noncore/apps/checkbook/graph.h
index 7379be7..40b23cd 100644
--- a/noncore/apps/checkbook/graph.h
+++ b/noncore/apps/checkbook/graph.h
@@ -1,63 +1,64 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef GRAPH_H 29#ifndef GRAPH_H
30#define GRAPH_H 30#define GRAPH_H
31 31
32#include <qpixmap.h> 32#include <qpixmap.h>
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35class GraphInfo; 35class GraphInfo;
36class QPainter;
36 37
37class Graph : public QWidget 38class Graph : public QWidget
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41 public: 42 public:
42 Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 ); 43 Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 );
43 44
44 void setGraphInfo( GraphInfo * ); 45 void setGraphInfo( GraphInfo * );
45 46
46 void drawGraph( bool = FALSE ); 47 void drawGraph( bool = FALSE );
47 48
48 protected: 49 protected:
49 void paintEvent( QPaintEvent * ); 50 void paintEvent( QPaintEvent * );
50 void resizeEvent( QResizeEvent * ); 51 void resizeEvent( QResizeEvent * );
51 52
52 private: 53 private:
53 GraphInfo *data; 54 GraphInfo *data;
54 55
55 QPixmap graph; 56 QPixmap graph;
56 57
57 void initGraph(); 58 void initGraph();
58 void drawBarChart(); 59 void drawBarChart( int, int, float );
59 void drawLineChart(); 60 void drawLineChart( int, int, float );
60 void drawPieChart(); 61 void drawPieChart( int, int, float );
61}; 62};
62 63
63#endif 64#endif
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp
index 7b06bdb..ec6a465 100644
--- a/noncore/apps/checkbook/graphinfo.cpp
+++ b/noncore/apps/checkbook/graphinfo.cpp
@@ -1,84 +1,123 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "graphinfo.h" 29#include "graphinfo.h"
30 30
31GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title, 31GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title,
32 const QString &xtitle, const QString &ytitle ) 32 const QString &xtitle, const QString &ytitle )
33{ 33{
34 t = type; 34 t = type;
35 d = data; 35 d = data;
36 gt = title; 36 gt = title;
37 xt = xtitle; 37 xt = xtitle;
38 yt = ytitle; 38 yt = ytitle;
39} 39}
40 40
41GraphInfo::~GraphInfo()
42{
43 if ( d )
44 {
45 for ( DataPointInfo *data = d->first(); data; data = d->next() )
46 {
47 delete data;
48 }
49 }
50}
51
41GraphInfo::GraphType GraphInfo::graphType() 52GraphInfo::GraphType GraphInfo::graphType()
42{ 53{
43 return t; 54 return t;
44} 55}
45 56
46void GraphInfo::setGraphType( GraphType type ) 57void GraphInfo::setGraphType( GraphType type )
47{ 58{
48 t = type; 59 t = type;
49} 60}
50 61
51DataPointList *GraphInfo::dataPoints() 62DataPointList *GraphInfo::dataPoints()
52{ 63{
53 return d; 64 return d;
54} 65}
55 66
56void GraphInfo::setDataPoints( DataPointList *data ) 67void GraphInfo::setDataPoints( DataPointList *data )
57{ 68{
58 d = data; 69 d = data;
59} 70}
60 71
61float GraphInfo::maxValue() 72DataPointInfo *GraphInfo::firstDataPoint()
62{ 73{
63 float max; 74 return( d->first() );
75}
64 76
77DataPointInfo *GraphInfo::nextDataPoint()
78{
79 return( d->next() );
80}
81
82int GraphInfo::numberDataPoints()
83{
84 return( d->count() );
85}
86
87float GraphInfo::maxValue()
88{
89 float max = 0.0;
90 for ( DataPointInfo *data = d->first(); data; data = d->next() )
91 {
92 if ( data->value() > max )
93 {
94 max = data->value();
95 }
96 }
97 return max;
65} 98}
66 99
67float GraphInfo::minValue() 100float GraphInfo::totalValue()
68{ 101{
102 float sum = 0.0;
103 for ( DataPointInfo *data = d->first(); data; data = d->next() )
104 {
105 sum += data->value();
106 }
107 return sum;
69} 108}
70 109
71void GraphInfo::setGraphTitle( const QString &title ) 110void GraphInfo::setGraphTitle( const QString &title )
72{ 111{
73 gt = title; 112 gt = title;
74} 113}
75 114
76void GraphInfo::setXAxisTitle( const QString &xtitle ) 115void GraphInfo::setXAxisTitle( const QString &xtitle )
77{ 116{
78 xt = xtitle; 117 xt = xtitle;
79} 118}
80 119
81void GraphInfo::setYAxisTitle( const QString &ytitle ) 120void GraphInfo::setYAxisTitle( const QString &ytitle )
82{ 121{
83 yt = ytitle; 122 yt = ytitle;
84} 123}
diff --git a/noncore/apps/checkbook/graphinfo.h b/noncore/apps/checkbook/graphinfo.h
index 4ad1dc9..620da74 100644
--- a/noncore/apps/checkbook/graphinfo.h
+++ b/noncore/apps/checkbook/graphinfo.h
@@ -1,82 +1,88 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef GRAPHINFO_H 29#ifndef GRAPHINFO_H
30#define GRAPHINFO_H 30#define GRAPHINFO_H
31 31
32#include <qlist.h> 32#include <qlist.h>
33#include <qstringlist.h> 33#include <qstringlist.h>
34 34
35class DataPointInfo 35class DataPointInfo
36{ 36{
37 public: 37 public:
38 DataPointInfo() 38 DataPointInfo()
39 : l( 0x0 ), v( 0.0 ) {} 39 : l( 0x0 ), v( 0.0 ) {}
40 DataPointInfo( const QString &label, float value ) 40 DataPointInfo( const QString &label, float value )
41 : l( label ), v( value ) {} 41 : l( label ), v( value ) {}
42 42
43 const QString &label() { return l; } 43 const QString &label() { return l; }
44 float value() { return v; } 44 float value() { return v; }
45
46 void addToValue( float value ) { v += value; }
45 47
46 private: 48 private:
47 QString l; 49 QString l;
48 float v; 50 float v;
49}; 51};
50 52
51typedef QList<DataPointInfo> DataPointList; 53typedef QList<DataPointInfo> DataPointList;
52 54
53class GraphInfo 55class GraphInfo
54{ 56{
55 public: 57 public:
56 enum GraphType { BarChart, LineChart, PieChart }; 58 enum GraphType { BarChart, LineChart, PieChart };
57 59
58 GraphInfo( GraphType = BarChart, DataPointList * = 0x0, 60 GraphInfo( GraphType = BarChart, DataPointList * = 0x0,
59 const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 ); 61 const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 );
62 ~GraphInfo();
60 63
61 GraphInfo::GraphType graphType(); 64 GraphInfo::GraphType graphType();
62 void setGraphType( GraphType ); 65 void setGraphType( GraphType );
63 66
64 DataPointList *dataPoints(); 67 DataPointList *dataPoints();
65 void setDataPoints( DataPointList * ); 68 void setDataPoints( DataPointList * );
69 DataPointInfo *firstDataPoint();
70 DataPointInfo *nextDataPoint();
71 int numberDataPoints();
66 72
67 float maxValue(); 73 float maxValue();
68 float minValue(); 74 float totalValue();
69 75
70 void setGraphTitle( const QString & ); 76 void setGraphTitle( const QString & );
71 void setXAxisTitle( const QString & ); 77 void setXAxisTitle( const QString & );
72 void setYAxisTitle( const QString & ); 78 void setYAxisTitle( const QString & );
73 79
74 private: 80 private:
75 GraphType t; 81 GraphType t;
76 DataPointList *d; 82 DataPointList *d;
77 QString gt; 83 QString gt;
78 QString xt; 84 QString xt;
79 QString yt; 85 QString yt;
80}; 86};
81 87
82#endif 88#endif