author | cniehaus <cniehaus> | 2002-09-30 13:05:45 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-30 13:05:45 (UTC) |
commit | b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3 (patch) (side-by-side diff) | |
tree | a5579c7242791b2602a764a781051c7f9a298be1 | |
parent | ece83520d6bf5c481275a3d4a8e792749119fa08 (diff) | |
download | opie-b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3.zip opie-b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3.tar.gz opie-b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3.tar.bz2 |
fixed one typo
I tried to fix the layouting problem but I give up. /me is to lame
-rw-r--r-- | noncore/apps/oxygen/calcdlg.ui | 4 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 3 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 1 |
5 files changed, 15 insertions, 4 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index a8ed170..c817a47 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui @@ -1,173 +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>241</width> + <width>237</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>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>chemical Formula</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>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>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>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>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> </widget> </UI> diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 98d3bd8..82b425e 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp @@ -1,141 +1,149 @@ /*************************************************************************** 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())-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,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,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,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" ) ); +} + +void OxydataWidget::setLayout() +{ +#warning this is not working and I have no idea why! +// DataTable->setColumnWidth ( 0 , this->width()/2 ); +// DataTable->setColumnWidth ( 1 , this->width()/2 ); + DataTable->setColumnWidth ( 0 , 110 ); + DataTable->setColumnWidth ( 1 , 110 ); } 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 ) ); else colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); p->save(); itm->paint( p, colgrp, cr, selected ); p->restore(); } } OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) : QTableItem ( table, et, text ) { } int OxydataQTI::alignment() const { if ( col()%2 ) { return AlignRight | AlignVCenter; }else return AlignLeft | AlignVCenter; }; diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h index a4a3b18..f2eb71d 100644 --- a/noncore/apps/oxygen/dataTable.h +++ b/noncore/apps/oxygen/dataTable.h @@ -1,84 +1,85 @@ /*************************************************************************** * * * 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. * * * **************************************************************************/ #ifndef _DATATABLE_H #define _DATATABLE_H #include <qwidget.h> #include <qtable.h> class QLabel; class OxydataTable; /* * A OxydataWidget shows all known data of an element. It can * be used for both the PSE and the pure Data-Dialog. It is * a simple QHBox with 2 QStrings in it plus a OxydataTable * which contains the rest of the data. * * Author: Carsten Niehaus <cniehaus@handhelds.org> */ class OxydataWidget : public QWidget { Q_OBJECT public: OxydataWidget(QWidget *parent=0); QLabel *left, *middle, *right; + void setLayout(); private: - OxydataTable *DataTable; void setTable() const; + OxydataTable *DataTable; public slots: void setElement( int ); }; /* * A OxydataTable is derived from QTable. I recoded the paintCell to have * different colors in the backgound. Furthermore this widget never has a * grid, thus I removed that code in paintCell. * * Author: Carsten Niehaus <cniehaus@handhelds.org> */ class OxydataTable : public QTable { Q_OBJECT public: OxydataTable( int numRows, int numCols, QWidget *parent = 0, const char *name = 0 ); protected: /* * This method is reimplemented form QTable. It implements the colourisation * of every second row. */ virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); }; /* * A OxydataQTI is a QTableItem which has the ability to set an alignment. * In Oxygen we only have two colums so I can use the simple col()%2. * * Author: Robert Gogolok <robertgogolok@gmx.de> */ class OxydataQTI : public QTableItem { public: OxydataQTI(QTable * table, EditType et, const QString & text ); virtual int alignment() const; }; #endif diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index c7afa32..99c4fd7 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -1,52 +1,53 @@ /*************************************************************************** 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( QString::number( i )+" - "+foo ); } OxydataWidget *oxyDW = new OxydataWidget(this); connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); oxyDW->setElement( 0 ); + oxyDW->setLayout(); qgrid->addWidget( dataCombo, 0,0); qgrid->addWidget( oxyDW , 1,0 ); } diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index ba9b71a..18b41c3 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp @@ -1,175 +1,176 @@ /*************************************************************************** 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 <qlayout.h> #include <qpe/qpeapplication.h> #include <qlist.h> #include "dataTable.h" #include "psewidget.h" #include "oxyframe.h" PSEWidget::PSEWidget() : QWidget() { this->setCaption( tr( "Periodic System" ) ); QVBoxLayout *vlay = new QVBoxLayout( this ); QGridLayout *grid = new QGridLayout( 18,10 ); int h=0, v=0; Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); for( int n = 0 ; n < 118 ; n++ ) { configobj.setGroup( QString::number( n+1 )); position( n+1,h,v ); QList<OxyFrame> PSEframe; PSEframe.append( new OxyFrame( this , QString::number(n) ) ); grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); PSEframe.current()->setMinimumHeight( 11 ); PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); } oxyDW = new OxydataWidget(this); oxyDW->setElement( 0 ); + oxyDW->setLayout(); vlay->addLayout( grid ); vlay->addWidget( oxyDW ); } QColor PSEWidget::PSEColor( QString block ) { QColor c; if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); else if ( block == "d" ) c.setRgb( 200,230,160 ); else if ( block == "p" ) c.setRgb( 238,146,138 ); else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); return c; }; void PSEWidget::slotShowElement(QString number) { oxyDW->setElement( number.toInt() ); }; void PSEWidget::position(int n, int& h, int& v) { //Hydrogen if (n == 1) { h=0; v=0; } //Helium if (n == 2) { h=680; v=0; } //Lithium if (n == 3) { h=0; v=40; } //Beryllium if (n == 4) { h=40; v=40; } //Boron-->Neon or Aluminum --> Argon if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) for (int i = 1; i <= (6-(10-n)); i++) { h=((i*40)+440); v = 40; if (n >= 13) { v=80; h=(h-320); } } //Sodium if (n == 11) { h=0; v=80; } //Magnesium if (n == 12) { h=40; v=80; } //Potassium --> Uuo without La and Ac if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) for (int i = 1; i <= 18; i++) { int f = n; if (n > 18) f = n-18; if (n > 36) f = n-36; if (n > 54) f = n-54; if (n > 71) f = n-68; if (n > 86) f = n-86; if (n > 103) f = n-100; h=((f*40)-40); v = 120; if (n >= 37) v=160; if (n >= 55) v=200; if (n >= 87) v=240; } //Lanthanum --> Lutetium and Actinum --> Lawrencium if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) for (int i = 1; i <= 14; i++) { int f = n; if (n > 56) f = n-55; if (n > 88) f = n-87; h=(f*40); v = 290; if (n >= 89) v=330; } v += 10; } |