-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 225 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 2 |
4 files changed, 124 insertions, 117 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 661eb5a..951788b 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -27,8 +27,11 @@ | |||
27 | 27 | ||
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | 29 | ||
30 | OxydataWidget::OxydataWidget(QWidget *parent, const char *name, QStringList *list ) : QWidget( parent,name ) | 30 | OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ) |
31 | { | 31 | { |
32 | names = list; | ||
33 | QStringList::ConstIterator it = names.at(10); | ||
34 | qDebug( *it ); | ||
32 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 35 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
33 | 36 | ||
34 | QHBox *hbox = new QHBox( this ); | 37 | QHBox *hbox = new QHBox( this ); |
@@ -53,12 +56,14 @@ OxydataWidget::OxydataWidget(QWidget *parent, const char *name, QStringList *lis | |||
53 | 56 | ||
54 | void OxydataWidget::setElement( int el ) | 57 | void OxydataWidget::setElement( int el ) |
55 | { | 58 | { |
59 | QStringList::ConstIterator it = names.at(el+1); | ||
60 | qDebug( *it ); | ||
56 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 61 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
57 | 62 | ||
58 | configobj.setGroup( QString::number( el+1 )); | 63 | configobj.setGroup( QString::number( el+1 )); |
59 | 64 | ||
60 | left->setText( configobj.readEntry( "Symbol" ) ); | 65 | left->setText( configobj.readEntry( "Symbol" ) ); |
61 | middle->setText( configobj.readEntry( "Name" ) ); | 66 | middle->setText( *it ); |
62 | right->setText( QString::number( el+1 ) ); | 67 | right->setText( QString::number( el+1 ) ); |
63 | 68 | ||
64 | 69 | ||
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h index a8c9b6e..8be78a9 100644 --- a/noncore/apps/oxygen/dataTable.h +++ b/noncore/apps/oxygen/dataTable.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | class QLabel; | 17 | class QLabel; |
18 | class OxydataTable; | 18 | class OxydataTable; |
19 | //class QStringList; | 19 | class QStringList; |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * A OxydataWidget shows all known data of an element. It can | 22 | * A OxydataWidget shows all known data of an element. It can |
@@ -32,10 +32,11 @@ class OxydataWidget : public QWidget | |||
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | OxydataWidget(QWidget *parent=0, const char *name=0, QStringList *list =0 ); | 35 | OxydataWidget(QWidget *parent=0, const char *name=0, const QStringList &list =0 ); |
36 | 36 | ||
37 | QLabel *left, *middle, *right; | 37 | QLabel *left, *middle, *right; |
38 | void setLayout(); | 38 | void setLayout(); |
39 | QStringList names; | ||
39 | 40 | ||
40 | private: | 41 | private: |
41 | void setTable() const; | 42 | void setTable() const; |
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 68c025f..e28ee4d 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -28,7 +28,8 @@ | |||
28 | 28 | ||
29 | dataWidgetUI::dataWidgetUI() : QWidget() | 29 | dataWidgetUI::dataWidgetUI() : QWidget() |
30 | { | 30 | { |
31 | names = newQStringList(); | 31 | |
32 | names = 0; | ||
32 | loadNames(); | 33 | loadNames(); |
33 | 34 | ||
34 | this->setCaption( tr( "Chemical Data" )); | 35 | this->setCaption( tr( "Chemical Data" )); |
@@ -38,11 +39,11 @@ dataWidgetUI::dataWidgetUI() : QWidget() | |||
38 | 39 | ||
39 | //read in all names of the 118 elements | 40 | //read in all names of the 118 elements |
40 | int i = 0; | 41 | int i = 0; |
41 | for ( QStringList::Iterator it = names->begin() ; it != names->end() ; ++it,i++) | 42 | for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++) |
42 | { | 43 | { |
43 | dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); | 44 | dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); |
44 | } | 45 | } |
45 | 46 | ||
46 | OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); | 47 | OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); |
47 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | 48 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); |
48 | oxyDW->setElement( 0 ); | 49 | oxyDW->setElement( 0 ); |
@@ -54,114 +55,114 @@ dataWidgetUI::dataWidgetUI() : QWidget() | |||
54 | 55 | ||
55 | void dataWidgetUI::loadNames() | 56 | void dataWidgetUI::loadNames() |
56 | { | 57 | { |
57 | names->append( tr("Hydrogen") ); | 58 | names.append( tr("Hydrogen") ); |
58 | names->append( tr("Helium") ); | 59 | names.append( tr("Helium") ); |
59 | names->append( tr("Lithium") ); | 60 | names.append( tr("Lithium") ); |
60 | names->append( tr("Beryllium") ); | 61 | names.append( tr("Beryllium") ); |
61 | names->append( tr("Boron") ); | 62 | names.append( tr("Boron") ); |
62 | names->append( tr("Carbon") ); | 63 | names.append( tr("Carbon") ); |
63 | names->append( tr("Nitrogen") ); | 64 | names.append( tr("Nitrogen") ); |
64 | names->append( tr("Oxygen") ); | 65 | names.append( tr("Oxygen") ); |
65 | names->append( tr("Fluorine") ); | 66 | names.append( tr("Fluorine") ); |
66 | names->append( tr("Neon") ); | 67 | names.append( tr("Neon") ); |
67 | names->append( tr("Sodium") ); | 68 | names.append( tr("Sodium") ); |
68 | names->append( tr("Magnesium") ); | 69 | names.append( tr("Magnesium") ); |
69 | names->append( tr("Aluminum") ); | 70 | names.append( tr("Aluminum") ); |
70 | names->append( tr("Silicon") ); | 71 | names.append( tr("Silicon") ); |
71 | names->append( tr("Phosphorus") ); | 72 | names.append( tr("Phosphorus") ); |
72 | names->append( tr("Sulfur") ); | 73 | names.append( tr("Sulfur") ); |
73 | names->append( tr("Chlorine") ); | 74 | names.append( tr("Chlorine") ); |
74 | names->append( tr("Argon") ); | 75 | names.append( tr("Argon") ); |
75 | names->append( tr("Potassium") ); | 76 | names.append( tr("Potassium") ); |
76 | names->append( tr("Calcium") ); | 77 | names.append( tr("Calcium") ); |
77 | names->append( tr("Scandium") ); | 78 | names.append( tr("Scandium") ); |
78 | names->append( tr("Titanium") ); | 79 | names.append( tr("Titanium") ); |
79 | names->append( tr("Vanadium") ); | 80 | names.append( tr("Vanadium") ); |
80 | names->append( tr("Chromium") ); | 81 | names.append( tr("Chromium") ); |
81 | names->append( tr("Manganese") ); | 82 | names.append( tr("Manganese") ); |
82 | names->append( tr("Iron") ); | 83 | names.append( tr("Iron") ); |
83 | names->append( tr("Cobalt") ); | 84 | names.append( tr("Cobalt") ); |
84 | names->append( tr("Nickel") ); | 85 | names.append( tr("Nickel") ); |
85 | names->append( tr("Copper") ); | 86 | names.append( tr("Copper") ); |
86 | names->append( tr("Zinc") ); | 87 | names.append( tr("Zinc") ); |
87 | names->append( tr("Gallium") ); | 88 | names.append( tr("Gallium") ); |
88 | names->append( tr("Germanium") ); | 89 | names.append( tr("Germanium") ); |
89 | names->append( tr("Arsenic") ); | 90 | names.append( tr("Arsenic") ); |
90 | names->append( tr("Selenium") ); | 91 | names.append( tr("Selenium") ); |
91 | names->append( tr("Bromine") ); | 92 | names.append( tr("Bromine") ); |
92 | names->append( tr("Krypton") ); | 93 | names.append( tr("Krypton") ); |
93 | names->append( tr("Rubidium") ); | 94 | names.append( tr("Rubidium") ); |
94 | names->append( tr("Strontium") ); | 95 | names.append( tr("Strontium") ); |
95 | names->append( tr("Yttrium") ); | 96 | names.append( tr("Yttrium") ); |
96 | names->append( tr("Zirconium") ); | 97 | names.append( tr("Zirconium") ); |
97 | names->append( tr("Niobium") ); | 98 | names.append( tr("Niobium") ); |
98 | names->append( tr("Molybdenum") ); | 99 | names.append( tr("Molybdenum") ); |
99 | names->append( tr("Technetium") ); | 100 | names.append( tr("Technetium") ); |
100 | names->append( tr("Ruthenium") ); | 101 | names.append( tr("Ruthenium") ); |
101 | names->append( tr("Rhodium") ); | 102 | names.append( tr("Rhodium") ); |
102 | names->append( tr("Palladium") ); | 103 | names.append( tr("Palladium") ); |
103 | names->append( tr("Silver") ); | 104 | names.append( tr("Silver") ); |
104 | names->append( tr("Cadmium") ); | 105 | names.append( tr("Cadmium") ); |
105 | names->append( tr("Indium") ); | 106 | names.append( tr("Indium") ); |
106 | names->append( tr("Tin") ); | 107 | names.append( tr("Tin") ); |
107 | names->append( tr("Antimony") ); | 108 | names.append( tr("Antimony") ); |
108 | names->append( tr("Tellurium") ); | 109 | names.append( tr("Tellurium") ); |
109 | names->append( tr("Iodine") ); | 110 | names.append( tr("Iodine") ); |
110 | names->append( tr("Xenon") ); | 111 | names.append( tr("Xenon") ); |
111 | names->append( tr("Cesium") ); | 112 | names.append( tr("Cesium") ); |
112 | names->append( tr("Barium") ); | 113 | names.append( tr("Barium") ); |
113 | names->append( tr("Lanthanum") ); | 114 | names.append( tr("Lanthanum") ); |
114 | names->append( tr("Cerium") ); | 115 | names.append( tr("Cerium") ); |
115 | names->append( tr("Praseodymium") ); | 116 | names.append( tr("Praseodymium") ); |
116 | names->append( tr("Neodymium") ); | 117 | names.append( tr("Neodymium") ); |
117 | names->append( tr("Promethium") ); | 118 | names.append( tr("Promethium") ); |
118 | names->append( tr("Samarium") ); | 119 | names.append( tr("Samarium") ); |
119 | names->append( tr("Europium") ); | 120 | names.append( tr("Europium") ); |
120 | names->append( tr("Gadolinium") ); | 121 | names.append( tr("Gadolinium") ); |
121 | names->append( tr("Terbium") ); | 122 | names.append( tr("Terbium") ); |
122 | names->append( tr("Dysprosium") ); | 123 | names.append( tr("Dysprosium") ); |
123 | names->append( tr("Holmium") ); | 124 | names.append( tr("Holmium") ); |
124 | names->append( tr("Erbium") ); | 125 | names.append( tr("Erbium") ); |
125 | names->append( tr("Thulium") ); | 126 | names.append( tr("Thulium") ); |
126 | names->append( tr("Ytterbium") ); | 127 | names.append( tr("Ytterbium") ); |
127 | names->append( tr("Lutetium") ); | 128 | names.append( tr("Lutetium") ); |
128 | names->append( tr("Hafnium") ); | 129 | names.append( tr("Hafnium") ); |
129 | names->append( tr("Tantalum") ); | 130 | names.append( tr("Tantalum") ); |
130 | names->append( tr("Tungsten") ); | 131 | names.append( tr("Tungsten") ); |
131 | names->append( tr("Rhenium") ); | 132 | names.append( tr("Rhenium") ); |
132 | names->append( tr("Osmium") ); | 133 | names.append( tr("Osmium") ); |
133 | names->append( tr("Iridium") ); | 134 | names.append( tr("Iridium") ); |
134 | names->append( tr("Platinum") ); | 135 | names.append( tr("Platinum") ); |
135 | names->append( tr("Gold") ); | 136 | names.append( tr("Gold") ); |
136 | names->append( tr("Mercury") ); | 137 | names.append( tr("Mercury") ); |
137 | names->append( tr("Thallium") ); | 138 | names.append( tr("Thallium") ); |
138 | names->append( tr("Lead") ); | 139 | names.append( tr("Lead") ); |
139 | names->append( tr("Bismuth") ); | 140 | names.append( tr("Bismuth") ); |
140 | names->append( tr("Polonium") ); | 141 | names.append( tr("Polonium") ); |
141 | names->append( tr("Astatine") ); | 142 | names.append( tr("Astatine") ); |
142 | names->append( tr("Radon") ); | 143 | names.append( tr("Radon") ); |
143 | names->append( tr("Francium") ); | 144 | names.append( tr("Francium") ); |
144 | names->append( tr("Radium") ); | 145 | names.append( tr("Radium") ); |
145 | names->append( tr("Actinium") ); | 146 | names.append( tr("Actinium") ); |
146 | names->append( tr("Thorium") ); | 147 | names.append( tr("Thorium") ); |
147 | names->append( tr("Protactinium") ); | 148 | names.append( tr("Protactinium") ); |
148 | names->append( tr("Uranium") ); | 149 | names.append( tr("Uranium") ); |
149 | names->append( tr("Neptunium") ); | 150 | names.append( tr("Neptunium") ); |
150 | names->append( tr("Plutonium") ); | 151 | names.append( tr("Plutonium") ); |
151 | names->append( tr("Americium") ); | 152 | names.append( tr("Americium") ); |
152 | names->append( tr("Curium") ); | 153 | names.append( tr("Curium") ); |
153 | names->append( tr("Berkelium") ); | 154 | names.append( tr("Berkelium") ); |
154 | names->append( tr("Californium") ); | 155 | names.append( tr("Californium") ); |
155 | names->append( tr("Einsteinium") ); | 156 | names.append( tr("Einsteinium") ); |
156 | names->append( tr("Fermium") ); | 157 | names.append( tr("Fermium") ); |
157 | names->append( tr("Mendelevium") ); | 158 | names.append( tr("Mendelevium") ); |
158 | names->append( tr("Nobelium") ); | 159 | names.append( tr("Nobelium") ); |
159 | names->append( tr("Lawrencium") ); | 160 | names.append( tr("Lawrencium") ); |
160 | names->append( tr("Rutherfordium") ); | 161 | names.append( tr("Rutherfordium") ); |
161 | names->append( tr("Dubnium") ); | 162 | names.append( tr("Dubnium") ); |
162 | names->append( tr("Seaborgium") ); | 163 | names.append( tr("Seaborgium") ); |
163 | names->append( tr("Bohrium") ); | 164 | names.append( tr("Bohrium") ); |
164 | names->append( tr("Hassium") ); | 165 | names.append( tr("Hassium") ); |
165 | names->append( tr("Meitnerium") ); | 166 | names.append( tr("Meitnerium") ); |
166 | } | 167 | } |
167 | 168 | ||
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h index 154f4be..a2b48fa 100644 --- a/noncore/apps/oxygen/datawidgetui.h +++ b/noncore/apps/oxygen/datawidgetui.h | |||
@@ -34,7 +34,7 @@ class dataWidgetUI : public QWidget | |||
34 | 34 | ||
35 | public: | 35 | public: |
36 | dataWidgetUI(); | 36 | dataWidgetUI(); |
37 | QStringList *names; | 37 | QStringList names; |
38 | 38 | ||
39 | private: | 39 | private: |
40 | OxydataTable *DataTable; | 40 | OxydataTable *DataTable; |