-rw-r--r-- | noncore/apps/oxygen/calcdlg.ui | 29 | ||||
-rw-r--r-- | noncore/apps/oxygen/calcdlgui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 3 |
5 files changed, 20 insertions, 31 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index 2d30164..a8ed170 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui @@ -1,180 +1,173 @@ <!DOCTYPE UI><UI> <class>CalcDlg</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>CalcDlg</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>245</width> + <width>241</width> <height>318</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form1</string> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>TabWidget3</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>240</width> <height>320</height> </rect> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> - <string>Tab 1</string> + <string>Molecular Weight</string> </attribute> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout6</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>230</width> <height>290</height> </rect> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>text</name> - <string>TextLabel2</string> + <string>chemical Formula</string> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>formula</cstring> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout3</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>calculate</cstring> </property> <property stdset="1"> <name>text</name> - <string>PushButton3</string> + <string>Calculate</string> </property> </widget> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>clear_fields</cstring> </property> <property stdset="1"> <name>text</name> - <string>PushButton4</string> + <string>Clear</string> </property> </widget> </hbox> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> - <string>TextLabel3</string> + <string>Molecular Weight (u):</string> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>result</cstring> </property> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> - <string>TextLabel1</string> + <string>Elemental Composition (%):</string> </property> </widget> <widget> <class>QMultiLineEdit</class> <property stdset="1"> <name>name</name> <cstring>anal_display</cstring> </property> + <property stdset="1"> + <name>readOnly</name> + <bool>true</bool> + </property> </widget> </vbox> </widget> </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Tab 2</string> - </attribute> - </widget> </widget> </widget> </UI> diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index ca3a9f2..f8dfde5 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp @@ -1,64 +1,64 @@ /*************************************************************************** application: : Oxygen begin : September 2002 copyright : ( C ) 2002 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "oxygen.h" #include "calcdlgui.h" #include "kmolcalc.h" #include <qlineedit.h> #include <qmultilineedit.h> #include <qpushbutton.h> calcDlgUI::calcDlgUI() : CalcDlg() { kmolcalc = new KMolCalc; connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); result->setReadOnly( true ); } void calcDlgUI::calc() { QString compound( formula->text() ); if ( compound.isEmpty() ) { clear(); return; } QString errors( kmolcalc->readFormula( compound ) ); QString mw, ea; double weight = kmolcalc->getWeight(); if ( errors == "OK" ) { mw.setNum( weight ); ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); } else { mw = "???"; - ea = tr( "ERROR: \n" ) + errors + "\n"; + ea = tr( "ERROR: \n" ).arg( errors )+ "\n"; } result->setText( mw ); anal_display->setText( ea ); } /** * * Clear all text entry / result fields. * */ void calcDlgUI::clear() { formula->clear(); result->clear(); anal_display->clear(); } diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 20c2985..98d3bd8 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp @@ -1,121 +1,120 @@ /*************************************************************************** application: : Oxygen begin : September 2002 copyright : ( C ) 2002 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include <qpe/config.h> #include "dataTable.h" #include <qwidget.h> #include <qhbox.h> #include <qlabel.h> #include <qfont.h> #include <qlayout.h> #include <qpe/qpeapplication.h> OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) { QGridLayout *qgrid = new QGridLayout( this, 2,1 ); QHBox *hbox = new QHBox( this ); left = new QLabel( hbox ); middle = new QLabel( hbox ); right = new QLabel( hbox ); right->setAlignment( AlignRight ); middle->setAlignment( AlignHCenter ); QFont bf; bf.setBold( true ); bf.setPointSize( bf.pointSize()+2 ); middle->setFont( bf ); DataTable = new OxydataTable( 9,2, this ); - DataTable->setColumnWidth ( 1 , ( parent->width()) ); - DataTable->setColumnWidth ( 0 , ( parent->width()) ); + //DataTable->setColumnWidth ( 1 , ( parent->width())-10 ); setTable(); qgrid->addWidget( hbox,0,0 ); qgrid->addWidget( DataTable,1,0 ); } void OxydataWidget::setElement( int el ) { Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); configobj.setGroup( QString::number( el+1 )); left->setText( configobj.readEntry( "Symbol" ) ); middle->setText( configobj.readEntry( "Name" ) ); right->setText( QString::number( el+1 ) ); - DataTable->setText( 0,1,( configobj.readEntry( "Weight" ) )+" u" ); + DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); - DataTable->setText( 3,1,( configobj.readEntry( "EN" ) )+" J" ); - DataTable->setText( 4,1,configobj.readEntry( "AR" )+" nm" ) ; - DataTable->setText( 5,1,configobj.readEntry( "IE" )+" J" ); + DataTable->setText( 3,1,tr( "%1 J").arg( configobj.readEntry( "EN" ) ) ); + DataTable->setText( 4,1,tr( "%1 nm" ).arg( configobj.readEntry( "AR" ) ) ) ; + DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); - DataTable->setText( 7,1,configobj.readEntry( "BP" )+" K" ); - DataTable->setText( 8,1,configobj.readEntry( "MP" )+" K" ); + DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); + DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); } void OxydataWidget::setTable() const { DataTable->setText( 0,0, tr( "Weight:" ) ); DataTable->setText( 1,0, tr( "Block" )) ; DataTable->setText( 2,0, tr( "Group" )) ; DataTable->setText( 3,0, tr( "Electronegativity" )) ; DataTable->setText( 4,0, tr( "Atomic radius" )) ; DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; DataTable->setText( 6,0, tr( "Density" )) ; DataTable->setText( 7,0, tr( "Boilingpoint" ) ); DataTable->setText( 8,0, tr( "Meltingpoint" ) ); } OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, const char *name) : QTable(numRows, numCols,parent, name) { for (int zeile = 0; zeile < numRows; zeile++) for ( int spalte = 0; spalte < numCols; spalte++ ) { OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); setItem(zeile, spalte, (QTableItem*)testus); } this->setShowGrid( false ); this->setHScrollBarMode(QScrollView::AlwaysOff); this->horizontalHeader()->hide(); this->verticalHeader()->hide(); this->setTopMargin( 0 ); this->setLeftMargin( 0 ); } void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) { if ( cr.width() == 0 || cr.height() == 0 ) return; selected = FALSE; QTableItem *itm = item( row, col ); QColorGroup colgrp = colorGroup(); if ( itm ) { if ( row%2 ) colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 44cc43d..c7afa32 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -1,52 +1,52 @@ /*************************************************************************** application: : Oxygen begin : September 2002 copyright : ( C ) 2002 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "datawidgetui.h" #include "dataTable.h" #include <qpe/config.h> #include <qstring.h> #include <qcombobox.h> #include <qlayout.h> #include <qhbox.h> #include <qlabel.h> #include <qpe/qpeapplication.h> dataWidgetUI::dataWidgetUI() : QWidget() { this->setCaption( tr( "Chemical Data" )); QGridLayout *qgrid = new QGridLayout( this, 2,1 ); dataCombo = new QComboBox( this ); //read in all names of the 118 elements Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); for ( int i = 1 ; i < 119 ; i++ ) { configobj.setGroup( QString::number( i ) ); QString foo = configobj.readEntry( "Name" ); - dataCombo->insertItem( foo ); + dataCombo->insertItem( QString::number( i )+" - "+foo ); } OxydataWidget *oxyDW = new OxydataWidget(this); connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); oxyDW->setElement( 0 ); qgrid->addWidget( dataCombo, 0,0); qgrid->addWidget( oxyDW , 1,0 ); } diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index bc99d89..a16bc77 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp @@ -1,42 +1,39 @@ /*************************************************************************** application: : Oxygen begin : September 2002 copyright : ( C ) 2002 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "oxygen.h" -#include <qlabel.h> #include <qapplication.h> -#include <qpushbutton.h> -#include <qvbox.h> #include <qtabwidget.h> #include "calcdlg.h" #include "calcdlgui.h" #include "datawidgetui.h" #include "psewidget.h" Oxygen::Oxygen() : QMainWindow() { PSEWidget *pse = new PSEWidget(); calcDlgUI *CalcDlgUI = new calcDlgUI(); dataWidgetUI *DataWidgetUI = new dataWidgetUI(); this->setCaption( tr( "Oxygen" ) ); QTabWidget *tabw = new QTabWidget( this , "qtab" ); tabw->addTab( pse, tr( "PSE" )); tabw->addTab( DataWidgetUI , tr( "Data" ) ); tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); setCentralWidget( tabw ); } |