summaryrefslogtreecommitdiff
path: root/noncore
authorzecke <zecke>2004-09-10 11:11:23 (UTC)
committer zecke <zecke>2004-09-10 11:11:23 (UTC)
commit532d65f8a45850bfda3c3344a7b165af91e48440 (patch) (unidiff)
treecbda2467001ed9a5be304fa52cabbb797b56ecfe /noncore
parente64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7 (diff)
downloadopie-532d65f8a45850bfda3c3344a7b165af91e48440.zip
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.gz
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.bz2
Add newlines, remove unused local variables, remove unused parameters,
add newlines at the end of file...
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/traninfo.cpp2
-rw-r--r--noncore/apps/confedit/listviewconfdir.cpp4
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp8
-rw-r--r--noncore/apps/opie-bartender/bac.cpp1
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.cpp40
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.cpp2
-rw-r--r--noncore/apps/oxygen/kmolelements.cpp36
9 files changed, 48 insertions, 49 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index 506f567..4833af9 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -203,25 +203,25 @@ int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2
203// --- toString --------------------------------------------------------------- 203// --- toString ---------------------------------------------------------------
204QString TranInfo::toString() 204QString TranInfo::toString()
205{ 205{
206 QString ret; 206 QString ret;
207 ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f", 207 ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f",
208 id(), 208 id(),
209 (const char *)datestr(), 209 (const char *)datestr(),
210 (const char *)number(), 210 (const char *)number(),
211 (const char *)desc(), 211 (const char *)desc(),
212 (withdrawal() ? -1 : 1) * amount(), 212 (withdrawal() ? -1 : 1) * amount(),
213 fee() 213 fee()
214 ); 214 );
215 return(ret); 215 return(ret);
216} 216}
217 217
218 218
219// --- findMostRecentByDesc --------------------------------------------------- 219// --- findMostRecentByDesc ---------------------------------------------------
220TranInfo *TranInfoList::findMostRecentByDesc( const QString &desc ) 220TranInfo *TranInfoList::findMostRecentByDesc( const QString &desc )
221{ 221{
222 for(TranInfo *cur=last(); cur; cur=prev()) { 222 for(TranInfo *cur=last(); cur; cur=prev()) {
223 if( cur->desc()==desc ) 223 if( cur->desc()==desc )
224 return( cur ); 224 return( cur );
225 } 225 }
226 return(NULL); 226 return(NULL);
227} \ No newline at end of file 227}
diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp
index 33bffe1..73eaae3 100644
--- a/noncore/apps/confedit/listviewconfdir.cpp
+++ b/noncore/apps/confedit/listviewconfdir.cpp
@@ -30,36 +30,36 @@ ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const ch
30 readConfFiles(); 30 readConfFiles();
31 31
32 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); 32 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
33} 33}
34 34
35 35
36ListViewConfDir::~ListViewConfDir() 36ListViewConfDir::~ListViewConfDir()
37{ 37{
38} 38}
39 39
40void ListViewConfDir::readConfFiles() 40void ListViewConfDir::readConfFiles()
41{ 41{
42 42
43 confDir.setFilter( QDir::Files | QDir::NoSymLinks ); 43 confDir.setFilter( QDir::Files | QDir::NoSymLinks );
44 confDir.setSorting( QDir::Name ); 44 confDir.setSorting( QDir::Name );
45 confDir.setNameFilter("*.conf"); 45 confDir.setNameFilter("*.conf");
46 const QFileInfoList *list = confDir.entryInfoList(); 46 const QFileInfoList *list = confDir.entryInfoList();
47 QFileInfoListIterator it( *list ); 47 QFileInfoListIterator it( *list );
48 QFileInfo *fi; 48 QFileInfo *fi;
49 49
50 ListViewItemConfFile *fileEntry; 50 ListViewItemConfFile *fileEntry;
51 51
52 while ( (fi=it.current()) ) 52 while ( (fi=it.current()) )
53 { 53 {
54 odebug << "opening: >" << fi->fileName().data() << "<" << oendl; 54 odebug << "opening: >" << fi->fileName().data() << "<" << oendl;
55 fileEntry = new ListViewItemConfFile( fi, this ); 55 fileEntry = new ListViewItemConfFile( fi, this );
56 QListViewItem *dummy = new QListViewItem(fileEntry, "dummy"); 56 (void)new QListViewItem(fileEntry, "dummy");
57 ++it; 57 ++it;
58 } 58 }
59} 59}
60 60
61void ListViewConfDir::expand(QListViewItem *item) 61void ListViewConfDir::expand(QListViewItem *item)
62{ 62{
63 ((ListViewItemConf*)item)->expand(); 63 ((ListViewItemConf*)item)->expand();
64} 64}
65 65
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp
index 0970125..714a154 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.cpp
+++ b/noncore/apps/confedit/listviewitemconfigentry.cpp
@@ -115,36 +115,36 @@ void ListViewItemConfigEntry::remove()
115} 115}
116 116
117void ListViewItemConfigEntry::save(QTextStream *t) 117void ListViewItemConfigEntry::save(QTextStream *t)
118{ 118{
119 QString s; 119 QString s;
120 if (isGroup()) 120 if (isGroup())
121 { 121 {
122 s += "["+_group+"]"; 122 s += "["+_group+"]";
123 _type = Group; 123 _type = Group;
124 }else{ 124 }else{
125 s += _key+" = "+_value; 125 s += _key+" = "+_value;
126 _type = Key; 126 _type = Key;
127 } 127 }
128 s += "\n"; 128 s += "\n";
129 (*t) << s; 129 (*t) << s;
130 _changed = false; 130 _changed = false;
131 for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) 131 for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling())
132 { 132 {
133 ((ListViewItemConfigEntry*)it)->save(t); 133 ((ListViewItemConfigEntry*)it)->save(t);
134 } 134 }
135} 135}
136 136
137void ListViewItemConfigEntry::revert() 137void ListViewItemConfigEntry::revert()
138{ 138{
139 _group = _groupOrig; 139 _group = _groupOrig;
140 _key = _keyOrig; 140 _key = _keyOrig;
141 _value = _valueOrig; 141 _value = _valueOrig;
142 _changed=false; 142 _changed=false;
143 displayText(); 143 displayText();
144} 144}
145 145
146 146
147void ListViewItemConfigEntry::expand() 147void ListViewItemConfigEntry::expand()
148{ 148{
149 149
150} \ No newline at end of file 150}
diff --git a/noncore/apps/opie-bartender/bac.cpp b/noncore/apps/opie-bartender/bac.cpp
index 2e74029..8dc7e88 100644
--- a/noncore/apps/opie-bartender/bac.cpp
+++ b/noncore/apps/opie-bartender/bac.cpp
@@ -113,49 +113,48 @@ BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl
113 LCDNumber1 = new QLCDNumber( this, "LCDNumber1" ); 113 LCDNumber1 = new QLCDNumber( this, "LCDNumber1" );
114 LCDNumber1->setMaximumHeight( 50); 114 LCDNumber1->setMaximumHeight( 50);
115 LCDNumber1->setNumDigits(6); 115 LCDNumber1->setNumDigits(6);
116 LCDNumber1->setSmallDecimalPoint(TRUE); 116 LCDNumber1->setSmallDecimalPoint(TRUE);
117 LCDNumber1->setFrameStyle(QFrame::Box); 117 LCDNumber1->setFrameStyle(QFrame::Box);
118 LCDNumber1->setLineWidth(2); 118 LCDNumber1->setLineWidth(2);
119 LCDNumber1->setSegmentStyle( QLCDNumber::Filled); 119 LCDNumber1->setSegmentStyle( QLCDNumber::Filled);
120 QPalette palette = LCDNumber1->palette(); 120 QPalette palette = LCDNumber1->palette();
121 palette.setColor(QPalette::Normal, QColorGroup::Foreground, Qt::red); 121 palette.setColor(QPalette::Normal, QColorGroup::Foreground, Qt::red);
122 palette.setColor(QPalette::Normal, QColorGroup::Light, Qt::black); 122 palette.setColor(QPalette::Normal, QColorGroup::Light, Qt::black);
123 palette.setColor(QPalette::Normal, QColorGroup::Dark, Qt::darkGreen); 123 palette.setColor(QPalette::Normal, QColorGroup::Dark, Qt::darkGreen);
124 LCDNumber1->setPalette(palette); 124 LCDNumber1->setPalette(palette);
125 125
126 Layout7->addWidget( LCDNumber1 ); 126 Layout7->addWidget( LCDNumber1 );
127 NumberSpinBox->setFocus(); 127 NumberSpinBox->setFocus();
128} 128}
129 129
130BacDialog::~BacDialog() 130BacDialog::~BacDialog()
131{} 131{}
132 132
133void BacDialog::calculate() 133void BacDialog::calculate()
134{ 134{
135 135
136 float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1; 136 float weight,genderDiff, bac, typeDrink=0, drinkOz=0, bodyWater, milliliters, oz, gram, gramsMil, alc, metab, bac1;
137 float weightunitDifference, massunitdiff;
138 QString estBac; 137 QString estBac;
139 138
140 if( GenderComboBox->currentItem()==0) 139 if( GenderComboBox->currentItem()==0)
141 genderDiff = .58; 140 genderDiff = .58;
142 else 141 else
143 genderDiff = .49; 142 genderDiff = .49;
144 143
145 switch(TypeDrinkComboBox->currentItem()) { 144 switch(TypeDrinkComboBox->currentItem()) {
146 case 0: { //beer 145 case 0: { //beer
147 typeDrink = .045; 146 typeDrink = .045;
148 drinkOz = 12; 147 drinkOz = 12;
149 } 148 }
150 break; 149 break;
151 case 1: { 150 case 1: {
152 typeDrink = .2; 151 typeDrink = .2;
153 drinkOz = 4; 152 drinkOz = 4;
154 } 153 }
155 break; 154 break;
156 case 2: { 155 case 2: {
157 typeDrink = .5; 156 typeDrink = .5;
158 drinkOz = 1.5; 157 drinkOz = 1.5;
159 } 158 }
160 break; 159 break;
161 }; 160 };
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 124b6f3..020a116 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -14,49 +14,49 @@
14//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL 14//ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL
15 15
16#include "LibraryDialog.h" 16#include "LibraryDialog.h"
17#include "output.h" 17#include "output.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/qpedialog.h> 22#include <qpe/qpedialog.h>
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24 24
25/* QT */ 25/* QT */
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28//#include <qlayout.h> 28//#include <qlayout.h>
29 29
30/* STD */ 30/* STD */
31#include <unistd.h> 31#include <unistd.h>
32#include <stdio.h> 32#include <stdio.h>
33#include <stdlib.h> 33#include <stdlib.h>
34 34
35/* 35/*
36 * The dialog will by default be modeless, unless you set 'modal' to 36 * The dialog will by default be modeless, unless you set 'modal' to
37 * TRUE to construct a modal dialog. */ 37 * TRUE to construct a modal dialog. */
38LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) 38LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl )
39 : QDialog( parent, name, true/* modal*/, fl ) 39 : QDialog( parent, name, true/* modal*/, fl )
40{ 40{
41 if ( !name ) 41 if ( !name )
42 setName( "LibraryDialog" ); 42 setName( "LibraryDialog" );
43 indexLoaded=false; 43 indexLoaded=false;
44 initDialog(); 44 initDialog();
45 45
46 // this->setMaximumWidth(240); 46 // this->setMaximumWidth(240);
47 47
48 index = "GUTINDEX.ALL"; 48 index = "GUTINDEX.ALL";
49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
50 local_index = local_library + index; 50 local_index = local_library + index;
51 51
52 QString iniFile ; 52 QString iniFile ;
53 iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; 53 iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc";
54 54
55 new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; 55 new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT";
56 56
57 old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; 57 old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL";
58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
59 59
60 // iniFile = local_library+"gutenbrowserrc"; 60 // iniFile = local_library+"gutenbrowserrc";
61 // new_index = local_library + "PGWHOLE.TXT"; 61 // new_index = local_library + "PGWHOLE.TXT";
62 // old_index = local_library + "GUTINDEX.ALL"; 62 // old_index = local_library + "GUTINDEX.ALL";
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
index af14aac..a321952 100644
--- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
@@ -19,49 +19,49 @@
19#include <opie2/odebug.h> 19#include <opie2/odebug.h>
20 20
21/* QT */ 21/* QT */
22#include <qprogressbar.h> 22#include <qprogressbar.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qvaluelist.h> 25#include <qvaluelist.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32 32
33/* STD */ 33/* STD */
34#include <unistd.h> 34#include <unistd.h>
35extern "C" { 35extern "C" {
36#include <ftplib.h> 36#include <ftplib.h>
37} 37}
38 38
39QProgressBar* ProgressBar1; 39QProgressBar* ProgressBar1;
40QPushButton* buttonCancel; 40QPushButton* buttonCancel;
41static netbuf *conn = NULL; 41static netbuf *conn = NULL;
42 42
43static int log_progress(netbuf *ctl, int xfered, void *arg) { 43static int log_progress(netbuf *, int xfered, void *arg) {
44 int fsz = *(int *)arg; 44 int fsz = *(int *)arg;
45 int pct = (xfered * 100) / fsz; 45 int pct = (xfered * 100) / fsz;
46 printf("%3d%%\r", pct); 46 printf("%3d%%\r", pct);
47 fflush(stdout); 47 fflush(stdout);
48 ProgressBar1->setProgress(xfered); 48 ProgressBar1->setProgress(xfered);
49 qApp->processEvents(); 49 qApp->processEvents();
50 50
51 return 1; 51 return 1;
52} 52}
53 53
54NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) 54NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL)
55 : QDialog( parent, name, modal, fl ) 55 : QDialog( parent, name, modal, fl )
56{ 56{
57 57
58 ftp_host = netL[0]; 58 ftp_host = netL[0];
59 networkUrl = strUrl = netL[0]; 59 networkUrl = strUrl = netL[0];
60 60
61 dir = ftp_base_dir = netL[1]; 61 dir = ftp_base_dir = netL[1];
62 localFileName = netL[2]; 62 localFileName = netL[2];
63 s_partialFileName = netL[3]; 63 s_partialFileName = netL[3];
64 64
65 resize(240,120); 65 resize(240,120);
66 66
67 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 67 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
index fa964a6..c6d0fe6 100644
--- a/noncore/apps/opie-gutenbrowser/fontDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
@@ -34,227 +34,227 @@ static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
34 34
35FontDialog::FontDialog( QWidget * parent, const char* name /*, bool modal, WFlags fl */) 35FontDialog::FontDialog( QWidget * parent, const char* name /*, bool modal, WFlags fl */)
36 :/* QDialog*/ QWidget( parent, name /*, modal, fl */) 36 :/* QDialog*/ QWidget( parent, name /*, modal, fl */)
37{ 37{
38 if ( !name ) 38 if ( !name )
39 setName( "FontDialog" ); 39 setName( "FontDialog" );
40 setCaption( tr( "Font Dialog" ) ); 40 setCaption( tr( "Font Dialog" ) );
41 41
42 QGridLayout *layout = new QGridLayout( this ); 42 QGridLayout *layout = new QGridLayout( this );
43 layout->setSpacing(2); 43 layout->setSpacing(2);
44 layout->setMargin(2); 44 layout->setMargin(2);
45 45
46 familyListBox = new QListBox( this, "familyListBox" ); 46 familyListBox = new QListBox( this, "familyListBox" );
47 layout->addMultiCellWidget( familyListBox, 0, 2, 0, 0); 47 layout->addMultiCellWidget( familyListBox, 0, 2, 0, 0);
48 48
49 QBoxLayout * hbox = new QHBoxLayout(this); 49 QBoxLayout * hbox = new QHBoxLayout(this);
50 QBoxLayout * vbox = new QVBoxLayout(this); 50 QBoxLayout * vbox = new QVBoxLayout(this);
51 51
52 styleListBox = new QListBox( this, "styleListBox" ); 52 styleListBox = new QListBox( this, "styleListBox" );
53 vbox->addWidget( styleListBox, 0); 53 vbox->addWidget( styleListBox, 0);
54 54
55 FontTextLabel4 = new QLabel( this, "TextLabel4" ); 55 FontTextLabel4 = new QLabel( this, "TextLabel4" );
56 FontTextLabel4->setText( tr( "Size" ) ); 56 FontTextLabel4->setText( tr( "Size" ) );
57 hbox->addWidget( FontTextLabel4,0); 57 hbox->addWidget( FontTextLabel4,0);
58 58
59 sizeComboBox = new QComboBox( FALSE, this, "SizeCombo"); 59 sizeComboBox = new QComboBox( FALSE, this, "SizeCombo");
60// sizeComboBox->setMaximumWidth(60); 60// sizeComboBox->setMaximumWidth(60);
61 hbox->addWidget( sizeComboBox, 0); 61 hbox->addWidget( sizeComboBox, 0);
62 62
63 vbox->addLayout(hbox,0); 63 vbox->addLayout(hbox,0);
64 layout->addLayout( vbox,0,3); 64 layout->addLayout( vbox,0,3);
65 65
66 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" ); 66 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
67 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) ); 67 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
68 MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth); 68 MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth);
69 69
70 layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3); 70 layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3);
71 71
72 connect(familyListBox,SIGNAL(highlighted(const QString &)),SLOT(familyListBoxSlot(const QString &))); 72 connect(familyListBox,SIGNAL(highlighted(const QString &)),SLOT(familyListBoxSlot(const QString &)));
73 connect(styleListBox,SIGNAL(highlighted(const QString &)),SLOT(styleListBoxSlot(const QString &))); 73 connect(styleListBox,SIGNAL(highlighted(const QString &)),SLOT(styleListBoxSlot(const QString &)));
74 connect(sizeComboBox,SIGNAL(activated(const QString &)),SLOT(sizeComboBoxSlot(const QString &))); 74 connect(sizeComboBox,SIGNAL(activated(const QString &)),SLOT(sizeComboBoxSlot(const QString &)));
75 75
76 populateLists(); 76 populateLists();
77 77
78} 78}
79 79
80FontDialog::~FontDialog() 80FontDialog::~FontDialog()
81{ 81{
82} 82}
83 83
84void FontDialog::familyListBoxSlot(const QString & text) 84void FontDialog::familyListBoxSlot(const QString & text)
85{ 85{
86 int styleInt = styleListBox->currentItem(); 86 int styleInt = styleListBox->currentItem();
87 int sizeInt = sizeComboBox->currentText().toInt(); 87 int sizeInt = sizeComboBox->currentText().toInt();
88 88
89 sizeComboBox->clear(); 89 sizeComboBox->clear();
90 styleListBox->clear(); 90 styleListBox->clear();
91// clearListBoxes(); 91// clearListBoxes();
92 family = text; 92 family = text;
93// odebug << family << oendl; 93// odebug << family << oendl;
94 QStringList styles = fdb.styles( family ); // string list of styles of our current font family 94 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
95 styleListBox->insertStringList( styles); 95 styleListBox->insertStringList( styles);
96 QString dstyle;// = "\t" + style + " ("; 96 QString dstyle;// = "\t" + style + " (";
97 97
98#ifdef BUGGY_SHARP_ZAURUS 98#ifdef BUGGY_SHARP_ZAURUS
99 99
100QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); 100QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
101 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { 101 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
102 dstyle = QString::number( *points ); 102 dstyle = QString::number( *points );
103 odebug << dstyle << oendl; 103 odebug << dstyle << oendl;
104 sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); 104 sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 ));
105 } 105 }
106#else 106#else
107 107
108 for (int i=0; i<nfontsizes; i++) { 108 for (int i=0; i<nfontsizes; i++) {
109 sizeComboBox->insertItem( QString::number(fontsize[i])); 109 sizeComboBox->insertItem( QString::number(fontsize[i]));
110 if(fontsize[i] == sizeInt) { 110 if(fontsize[i] == sizeInt) {
111 sizeComboBox->setCurrentItem(i); 111 sizeComboBox->setCurrentItem(i);
112 } 112 }
113 } 113 }
114#endif 114#endif
115 115
116 if(styleInt == -1 || styleInt > styleListBox->count() ) 116 if(styleInt == -1 || styleInt > static_cast<int>(styleListBox->count()) )
117 styleListBox->setCurrentItem(0); 117 styleListBox->setCurrentItem(0);
118 else 118 else
119 styleListBox->setCurrentItem(styleInt); 119 styleListBox->setCurrentItem(styleInt);
120 120
121 changeText(); 121 changeText();
122} 122}
123 123
124void FontDialog::styleListBoxSlot(const QString &text) 124void FontDialog::styleListBoxSlot(const QString &)
125{ 125{
126 changeText(); 126 changeText();
127} 127}
128 128
129void FontDialog::sizeComboBoxSlot(const QString & text) 129void FontDialog::sizeComboBoxSlot(const QString &)
130{ 130{
131 changeText(); 131 changeText();
132} 132}
133 133
134void FontDialog::populateLists() 134void FontDialog::populateLists()
135{ 135{
136// QFont defaultFont=MultiLineEdit1->font(); 136// QFont defaultFont=MultiLineEdit1->font();
137// QFont defaultFont=Lview->font(); 137// QFont defaultFont=Lview->font();
138// QFontInfo fontInfo(defaultFont); 138// QFontInfo fontInfo(defaultFont);
139 Config config("Gutenbrowser"); 139 Config config("Gutenbrowser");
140 config.setGroup("Font"); 140 config.setGroup("Font");
141 QString familyStr = config.readEntry("Family", "fixed"); 141 QString familyStr = config.readEntry("Family", "fixed");
142 QString styleStr = config.readEntry("Style", "Regular"); 142 QString styleStr = config.readEntry("Style", "Regular");
143 QString sizeStr = config.readEntry("Size", "10"); 143 QString sizeStr = config.readEntry("Size", "10");
144 QString charSetStr = config.readEntry("CharSet", "iso10646-1" ); 144 QString charSetStr = config.readEntry("CharSet", "iso10646-1" );
145 bool ok; 145 bool ok;
146 int i_size = sizeStr.toInt(&ok,10); 146 int i_size = sizeStr.toInt(&ok,10);
147 selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr); 147 selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr);
148// defaultFont.setItalic(TRUE); 148// defaultFont.setItalic(TRUE);
149 families = fdb.families(); 149 families = fdb.families();
150 150
151 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) { 151 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
152 QString family = *f; 152 QString family = *f;
153// if(family == defaultFont.family()) 153// if(family == defaultFont.family())
154// odebug << family << oendl; 154// odebug << family << oendl;
155 familyListBox->insertItem( family); 155 familyListBox->insertItem( family);
156 156
157 if( familyListBox->text(0) == family) { 157 if( familyListBox->text(0) == family) {
158 QStringList styles = fdb.styles( family ); 158 QStringList styles = fdb.styles( family );
159// string list of styles of our current font family 159// string list of styles of our current font family
160 styleListBox->insertStringList( styles); 160 styleListBox->insertStringList( styles);
161 161
162 for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style 162 for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style
163 style = *s; 163 style = *s;
164 QString dstyle;// = "\t" + style + " ("; 164 QString dstyle;// = "\t" + style + " (";
165 if(styleListBox->text(0) == style) { 165 if(styleListBox->text(0) == style) {
166 166
167 QValueList<int> smoothies = fdb.smoothSizes( family, style ); 167 QValueList<int> smoothies = fdb.smoothSizes( family, style );
168 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { 168 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
169 dstyle = QString::number( *points ) + " "; 169 dstyle = QString::number( *points ) + " ";
170 sizeComboBox ->insertItem( dstyle.left( dstyle.length() - 1 )); 170 sizeComboBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
171 } 171 }
172 dstyle = dstyle.left( dstyle.length() - 1 ) + ")"; 172 dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
173 } 173 }
174 } // styles 174 } // styles
175 } 175 }
176 } 176 }
177 for(int i=0;i < familyListBox->count();i++) { 177 for(uint i=0;i < familyListBox->count();i++) {
178 if( familyListBox->text(i) == familyStr) 178 if( familyListBox->text(i) == familyStr)
179 familyListBox->setSelected( i, TRUE); 179 familyListBox->setSelected( i, TRUE);
180 } 180 }
181 181
182 for(int i=0;i < styleListBox->count();i++) { 182 for(uint i=0;i < styleListBox->count();i++) {
183 if( styleListBox->text(i) == styleStr) 183 if( styleListBox->text(i) == styleStr)
184 styleListBox->setSelected( i, TRUE); 184 styleListBox->setSelected( i, TRUE);
185 } 185 }
186 186
187 for (int i=0; i<sizeComboBox->count(); i++) { 187 for (int i=0; i<sizeComboBox->count(); i++) {
188 188
189#ifdef BUGGY_SHARP_ZAURUS 189#ifdef BUGGY_SHARP_ZAURUS
190 if(sizeComboBox->text(i) == sizeStr) 190 if(sizeComboBox->text(i) == sizeStr)
191#else 191#else
192 if(fontsize[i] == i_size) 192 if(fontsize[i] == i_size)
193#endif 193#endif
194 sizeComboBox->setCurrentItem(i); 194 sizeComboBox->setCurrentItem(i);
195 } 195 }
196 changeText(); 196 changeText();
197} 197}
198 198
199void FontDialog::clearListBoxes() { 199void FontDialog::clearListBoxes() {
200 familyListBox->clear(); 200 familyListBox->clear();
201 sizeComboBox->clear(); 201 sizeComboBox->clear();
202 styleListBox->clear(); 202 styleListBox->clear();
203} 203}
204 204
205void FontDialog::changeText() 205void FontDialog::changeText()
206{ 206{
207 if( familyListBox->currentItem() == -1) 207 if( familyListBox->currentItem() == -1)
208 family= familyListBox->text(0); 208 family= familyListBox->text(0);
209 else { 209 else {
210 family = familyListBox->currentText(); 210 family = familyListBox->currentText();
211 } 211 }
212// odebug << "Font family is "+family << oendl; 212// odebug << "Font family is "+family << oendl;
213 if( styleListBox->currentItem() == -1) 213 if( styleListBox->currentItem() == -1)
214 style=styleListBox->text(0); 214 style=styleListBox->text(0);
215 else { 215 else {
216 style = styleListBox->currentText(); 216 style = styleListBox->currentText();
217 } 217 }
218// odebug << "font style is "+style << oendl; 218// odebug << "font style is "+style << oendl;
219 219
220 if( sizeComboBox->currentItem() == -1 ) 220 if( sizeComboBox->currentItem() == -1 )
221 size = sizeComboBox->text(0); 221 size = sizeComboBox->text(0);
222 else { 222 else {
223 size = sizeComboBox->currentText(); 223 size = sizeComboBox->currentText();
224 } 224 }
225 225
226// odebug << "Font size is "+size << oendl; 226// odebug << "Font size is "+size << oendl;
227 bool ok; 227 bool ok;
228 int i_size = size.toInt(&ok,10); 228 int i_size = size.toInt(&ok,10);
229 QStringList charSetList = fdb.charSets(family); 229 QStringList charSetList = fdb.charSets(family);
230// QStringList styles = fdb.styles( family ); // string list of styles of our current font family 230// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
231 QString charSet; 231 QString charSet;
232 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style 232 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
233 charSet = *s; 233 charSet = *s;
234// odebug << charSet << oendl; 234// odebug << charSet << oendl;
235 } 235 }
236 selectedFont = fdb.font(family,style,i_size,charSet); 236 selectedFont = fdb.font(family,style,i_size,charSet);
237 QFontInfo fontInfo( selectedFont); 237 QFontInfo fontInfo( selectedFont);
238// if(fontInfo.italic() ) odebug << "italic" << oendl; 238// if(fontInfo.italic() ) odebug << "italic" << oendl;
239 selectedFont.setWeight(fontInfo.weight() ); 239 selectedFont.setWeight(fontInfo.weight() );
240// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl; 240// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl;
241 Config cfg("Gutenbrowser"); 241 Config cfg("Gutenbrowser");
242 cfg.setGroup("Font"); 242 cfg.setGroup("Font");
243 cfg.writeEntry("Family",family); 243 cfg.writeEntry("Family",family);
244 cfg.writeEntry("Style",style); 244 cfg.writeEntry("Style",style);
245 cfg.writeEntry("Size",size); 245 cfg.writeEntry("Size",size);
246 cfg.writeEntry("CharSet",charSet); 246 cfg.writeEntry("CharSet",charSet);
247 247
248 if(style.find("Italic",0,TRUE) != -1) { 248 if(style.find("Italic",0,TRUE) != -1) {
249 selectedFont = fdb.font(family,"Regular",i_size,charSet); 249 selectedFont = fdb.font(family,"Regular",i_size,charSet);
250 selectedFont.setItalic(TRUE); //ya right 250 selectedFont.setItalic(TRUE); //ya right
251 cfg.writeEntry("Italic","TRUE"); 251 cfg.writeEntry("Italic","TRUE");
252// odebug << "Style is "+styleListBox->currentText() << oendl; 252// odebug << "Style is "+styleListBox->currentText() << oendl;
253 } else 253 } else
254 cfg.writeEntry("Italic","FALSE"); 254 cfg.writeEntry("Italic","FALSE");
255 255
256 MultiLineEdit1->setFont( selectedFont); 256 MultiLineEdit1->setFont( selectedFont);
257 MultiLineEdit1->update(); 257 MultiLineEdit1->update();
258 changedFonts=TRUE; 258 changedFonts=TRUE;
259} 259}
260 260
diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.cpp b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
index e86ca49..ffdc9f0 100644
--- a/noncore/apps/opie-gutenbrowser/helpwindow.cpp
+++ b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
@@ -1,47 +1,47 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of an example program for Qt. This example 6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9 copyright : (C) 2000 -2004 by llornkcor 9 copyright : (C) 2000 -2004 by llornkcor
10 email : ljp@llornkcor.com 10 email : ljp@llornkcor.com
11*****************************************************************************/ 11*****************************************************************************/
12 12
13#include "helpwindow.h" 13#include "helpwindow.h"
14#include <qstatusbar.h> 14#include <qstatusbar.h>
15 15
16#include <qmenubar.h> 16#include <qmenubar.h>
17#include <qtoolbar.h> 17#include <qtoolbar.h>
18#include <qtoolbutton.h> 18#include <qtoolbutton.h>
19#include <qcombobox.h> 19#include <qcombobox.h>
20 20
21#include <ctype.h> 21#include <ctype.h>
22 22
23HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) 23HelpWindow::HelpWindow( const QString& home_, const QString&, QWidget* parent, const char *name )
24 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 24 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
25{ 25{
26 QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 26 QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
27// readHistory(); 27// readHistory();
28// readBookmarks(); 28// readBookmarks();
29 29
30 browser = new QTextBrowser( this ); 30 browser = new QTextBrowser( this );
31 QStringList Strlist; 31 QStringList Strlist;
32 Strlist.append( home_); 32 Strlist.append( home_);
33 browser->mimeSourceFactory()->setFilePath( Strlist ); 33 browser->mimeSourceFactory()->setFilePath( Strlist );
34 34
35 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 35 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
36 36
37 connect(browser,SIGNAL(textChanged()),this,SLOT(textChanged())); 37 connect(browser,SIGNAL(textChanged()),this,SLOT(textChanged()));
38 38
39 setCentralWidget( browser ); 39 setCentralWidget( browser );
40 40
41 if ( !home_.isEmpty() ) 41 if ( !home_.isEmpty() )
42 42
43//////////////////////////////// 43////////////////////////////////
44 browser->setSource( home_ ); 44 browser->setSource( home_ );
45 45
46//////////////////////////////// 46////////////////////////////////
47 connect( browser, SIGNAL( highlighted( const QString&) ), 47 connect( browser, SIGNAL( highlighted( const QString&) ),
diff --git a/noncore/apps/oxygen/kmolelements.cpp b/noncore/apps/oxygen/kmolelements.cpp
index ce8f9c1..e76461b 100644
--- a/noncore/apps/oxygen/kmolelements.cpp
+++ b/noncore/apps/oxygen/kmolelements.cpp
@@ -1,238 +1,238 @@
1/* 1/*
2 * kmolelements.cpp 2 * kmolelements.cpp
3 * 3 *
4 * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> 4 * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com>
5 */ 5 */
6 6
7// classes that store and manipulate chemical formulas represented as 7// classes that store and manipulate chemical formulas represented as
8// lists of elements 8// lists of elements
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include "kmolelements.h" 11#include "kmolelements.h"
12 12
13/** 13/**
14 * A generic chemical entity. Can be an element or a group. 14 * A generic chemical entity. Can be an element or a group.
15 */ 15 */
16SubUnit::SubUnit () {} 16SubUnit::SubUnit () {}
17 17
18SubUnit::~SubUnit () {} 18SubUnit::~SubUnit () {}
19 19
20/** 20/**
21 * Construct a subunit and return a pointer to it. The syntax of LINE is 21 * Construct a subunit and return a pointer to it. The syntax of LINE is
22 * the one used in the element definition file. 22 * the one used in the element definition file.
23 */ 23 */
24SubUnit* SubUnit::makeSubUnit(QString line) { 24SubUnit* SubUnit::makeSubUnit(QString line) {
25 QString name, grpname, weight, coef; 25 QString name, grpname, weight, coef;
26 QTextStream str (line, IO_ReadOnly); 26 QTextStream str (line, IO_ReadOnly);
27 str >> name; 27 str >> name;
28 if (name != "-group") { // not a group - must be represented as Element 28 if (name != "-group") { // not a group - must be represented as Element
29 str >> weight >> ws; 29 str >> weight >> ws;
30 return new Element(name, weight.toDouble()); 30 return new Element(name, weight.toDouble());
31 } 31 }
32 else { 32 else {
33 str >> grpname; 33 str >> grpname;
34 ElementList* els = new ElementList(grpname); // group - make an ElementList 34 ElementList* els = new ElementList(grpname); // group - make an ElementList
35 while (!str.eof()) { 35 while (!str.eof()) {
36 str >> name >> ws; 36 str >> name >> ws;
37 str >> coef >> ws; 37 str >> coef >> ws;
38 els->addElement(name, coef.toDouble()); 38 els->addElement(name, coef.toDouble());
39 } 39 }
40 return els; 40 return els;
41 } 41 }
42} 42}
43 43
44QString SubUnit::getName() const { 44QString SubUnit::getName() const {
45 return QString("None"); 45 return QString("None");
46} 46}
47 47
48/** 48/**
49 * Get the molecular weight of THIS, based on the data from ELSTABLE. 49 * Get the molecular weight of THIS, based on the data from ELSTABLE.
50 */ 50 */
51double SubUnit::getWeight(QDict<SubUnit>* elstable) const { 51double SubUnit::getWeight(QDict<SubUnit>* ) const {
52 return -1; 52 return -1;
53} 53}
54 54
55/** 55/**
56 * A group of elements. 56 * A group of elements.
57 */ 57 */
58ElementList::ElementList () { 58ElementList::ElementList () {
59 elements = new QList<ElementCoef>; 59 elements = new QList<ElementCoef>;
60} 60}
61 61
62ElementList::~ElementList () { 62ElementList::~ElementList () {
63 delete elements; 63 delete elements;
64} 64}
65 65
66 66
67/** 67/**
68 * A group of elements. 68 * A group of elements.
69 */ 69 */
70ElementList::ElementList (QString name) { 70ElementList::ElementList (QString name) {
71 this->name = name; 71 this->name = name;
72 elements = new QList<ElementCoef>; 72 elements = new QList<ElementCoef>;
73} 73}
74 74
75/** 75/**
76 * Write THIS to LINE, in a format suitable for the element definition file. 76 * Write THIS to LINE, in a format suitable for the element definition file.
77 */ 77 */
78void ElementList::writeOut(QString& line) { 78void ElementList::writeOut(QString& line) {
79 QString coef; 79 QString coef;
80 line = "-group " + name; 80 line = "-group " + name;
81 ElementCoef* current = elements->first(); 81 ElementCoef* current = elements->first();
82 while (current != 0) { 82 while (current != 0) {
83 line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10); 83 line += " " + current->name + " " + coef.setNum(current->coef, 'g', 10);
84 // precision set to 10 digits 84 // precision set to 10 digits
85 current = elements->next(); 85 current = elements->next();
86 } 86 }
87} 87}
88 88
89/** 89/**
90 * Get the molecular weight of THIS, based on the data from ELSTABLE. 90 * Get the molecular weight of THIS, based on the data from ELSTABLE.
91 */ 91 */
92double ElementList::getWeight(QDict<SubUnit>* elstable) const { 92double ElementList::getWeight(QDict<SubUnit>* elstable) const {
93 double weight = 0; 93 double weight = 0;
94 ElementCoef* current = elements->first(); 94 ElementCoef* current = elements->first();
95 while (current != 0) { 95 while (current != 0) {
96 SubUnit* e = elstable->find(current->name); 96 SubUnit* e = elstable->find(current->name);
97 if (e != 0) { 97 if (e != 0) {
98 weight += (current->coef) * (e->getWeight(elstable)); 98 weight += (current->coef) * (e->getWeight(elstable));
99 } else return -1; //ERROR 99 } else return -1; //ERROR
100 current = elements->next(); 100 current = elements->next();
101 } 101 }
102 return weight; 102 return weight;
103} 103}
104 104
105/** 105/**
106 * Return a string representing the elemental composition of THIS, as 106 * Return a string representing the elemental composition of THIS, as
107 * a tab-separated element - percentage pairs, separated by newlines. 107 * a tab-separated element - percentage pairs, separated by newlines.
108 */ 108 */
109QString ElementList::getEA(QDict<SubUnit>* elstable, double mw) const { 109QString ElementList::getEA(QDict<SubUnit>* elstable, double mw) const {
110 if (mw == 0) mw = getWeight(elstable); 110 if (mw == 0) mw = getWeight(elstable);
111 QString ea; 111 QString ea;
112 QString temp; 112 QString temp;
113 ElementCoef* current = elements->first(); 113 ElementCoef* current = elements->first();
114 while (current != 0) { 114 while (current != 0) {
115 SubUnit* e = elstable->find(current->name); 115 SubUnit* e = elstable->find(current->name);
116 if (e != 0) { 116 if (e != 0) {
117 double current_percent = 100 * (current->coef) * 117 double current_percent = 100 * (current->coef) *
118 (e->getWeight(elstable)) 118 (e->getWeight(elstable))
119 / mw; 119 / mw;
120 ea += current->name + "\t" + 120 ea += current->name + "\t" +
121 temp.setNum(current_percent) + "\n"; 121 temp.setNum(current_percent) + "\n";
122 } else return QString("ERROR!\n"); //ERROR 122 } else return QString("ERROR!\n"); //ERROR
123 current = elements->next(); 123 current = elements->next();
124 } 124 }
125 return ea; 125 return ea;
126} 126}
127 127
128/** 128/**
129 * Return a string representing THIS as an empirical chemical formula. 129 * Return a string representing THIS as an empirical chemical formula.
130 */ 130 */
131QString ElementList::getEmpFormula() const { 131QString ElementList::getEmpFormula() const {
132 QString ef; 132 QString ef;
133 QString temp; 133 QString temp;
134 ElementCoef* current = elements->first(); 134 ElementCoef* current = elements->first();
135 while (current != 0) { 135 while (current != 0) {
136 ef += current->name + temp.setNum(current->coef); 136 ef += current->name + temp.setNum(current->coef);
137 current = elements->next(); 137 current = elements->next();
138 } 138 }
139 return ef; 139 return ef;
140} 140}
141 141
142/** 142/**
143 * Multiply THIS (i.e. the coefficient of each element) by coef. 143 * Multiply THIS (i.e. the coefficient of each element) by coef.
144 */ 144 */
145void ElementList::multiplyBy(double coef) { 145void ElementList::multiplyBy(double coef) {
146 ElementCoef* current = elements->first(); 146 ElementCoef* current = elements->first();
147 while (current != 0) { 147 while (current != 0) {
148 (current->coef) *= coef; 148 (current->coef) *= coef;
149 current = elements->next(); 149 current = elements->next();
150 } 150 }
151} 151}
152 152
153/** 153/**
154 * Add THIS to ELS. THIS is not modified; ELS is. 154 * Add THIS to ELS. THIS is not modified; ELS is.
155 */ 155 */
156void ElementList::addTo(ElementList& els, double coef) { 156void ElementList::addTo(ElementList& els, double coef) {
157 ElementCoef* current = elements->first(); 157 ElementCoef* current = elements->first();
158 while (current != 0) { 158 while (current != 0) {
159 els.addElement(current->name, (current->coef) * coef); 159 els.addElement(current->name, (current->coef) * coef);
160 current = elements->next(); 160 current = elements->next();
161 } 161 }
162} 162}
163 163
164/** 164/**
165 * Add an element to THIS, with a coefficient COEF. If THIS already contains 165 * Add an element to THIS, with a coefficient COEF. If THIS already contains
166 * an element with the same name, adjust its coefficient only; if not, create 166 * an element with the same name, adjust its coefficient only; if not, create
167 * a new ElementCoef pair and add to THIS. 167 * a new ElementCoef pair and add to THIS.
168 */ 168 */
169void ElementList::addElement(const QString& name, double coef) { 169void ElementList::addElement(const QString& name, double coef) {
170 ElementCoef* current = elements->first(); 170 ElementCoef* current = elements->first();
171 while (current != 0) { 171 while (current != 0) {
172 if (current->name == name) { 172 if (current->name == name) {
173 current->coef += coef; 173 current->coef += coef;
174 return; 174 return;
175 } 175 }
176 current = elements->next(); 176 current = elements->next();
177 } 177 }
178 elements->append(new ElementCoef(name, coef)); 178 elements->append(new ElementCoef(name, coef));
179} 179}
180 180
181/** 181/**
182 * True iff THIS contains element named NAME. 182 * True iff THIS contains element named NAME.
183 */ 183 */
184bool ElementList::contains(const QString& name) { 184bool ElementList::contains(const QString& name) {
185 ElementCoef* current = elements->first(); 185 ElementCoef* current = elements->first();
186 while (current != 0) { 186 while (current != 0) {
187 if (current->name == name) 187 if (current->name == name)
188 return true; 188 return true;
189 current = elements->next(); 189 current = elements->next();
190 } 190 }
191 return false; 191 return false;
192} 192}
193 193
194bool ElementList::isEmpty() { 194bool ElementList::isEmpty() {
195 return elements->isEmpty(); 195 return elements->isEmpty();
196} 196}
197 197
198QString ElementList::getName() const { 198QString ElementList::getName() const {
199 return name; 199 return name;
200} 200}
201 201
202/** 202/**
203 * A chemical element. 203 * A chemical element.
204 */ 204 */
205Element::Element(const QString& n, double w) 205Element::Element(const QString& n, double w)
206 : weight(w), name(n) { } 206 : weight(w), name(n) { }
207 207
208 208
209Element::~Element() { 209Element::~Element() {
210} 210}
211 211
212 212
213/** 213/**
214 * Write THIS to LINE, in a format suitable for the element definition file. 214 * Write THIS to LINE, in a format suitable for the element definition file.
215 */ 215 */
216void Element::writeOut(QString& line) { 216void Element::writeOut(QString& line) {
217 line.setNum(weight); 217 line.setNum(weight);
218 line = name + " " + line; 218 line = name + " " + line;
219} 219}
220 220
221double Element::getWeight(QDict<SubUnit>* elstable) const { 221double Element::getWeight(QDict<SubUnit>* ) const {
222 return weight; 222 return weight;
223} 223}
224 224
225void Element::addTo(ElementList& els, double coef) { 225void Element::addTo(ElementList& els, double coef) {
226 els.addElement(name, coef); 226 els.addElement(name, coef);
227} 227}
228 228
229QString Element::getName() const { 229QString Element::getName() const {
230 return name; 230 return name;
231} 231}
232 232
233/** 233/**
234 * An element - coefficient pair. Used to represent elements within an 234 * An element - coefficient pair. Used to represent elements within an
235 * element list. 235 * element list.
236 */ 236 */
237ElementCoef::ElementCoef(const QString& n, double c) : name(n), coef(c) {} 237ElementCoef::ElementCoef(const QString& n, double c) : name(n), coef(c) {}
238 238