author | cniehaus <cniehaus> | 2002-09-19 20:47:36 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-19 20:47:36 (UTC) |
commit | 65ba4e3610c94ba1de71a41dd6bf69662555e206 (patch) (side-by-side diff) | |
tree | 696c3d7317a3c5a13f14160d9281fe4e889cf5bc | |
parent | f4162d2283ebf0327645e0ac66b539cf87565d0b (diff) | |
download | opie-65ba4e3610c94ba1de71a41dd6bf69662555e206.zip opie-65ba4e3610c94ba1de71a41dd6bf69662555e206.tar.gz opie-65ba4e3610c94ba1de71a41dd6bf69662555e206.tar.bz2 |
* codecleanup
* adding some const
* if you click on a "element" you will now really get the information
* removed obsolete class
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 7 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.h | 9 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 53 |
9 files changed, 31 insertions, 81 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 7516b06..870ac56 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp @@ -57,7 +57,7 @@ void OxydataWidget::setElement( int el ) DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); } -void OxydataWidget::setTable() +void OxydataWidget::setTable() const { DataTable->setText( 0,0, tr( "Weight:" ) ); DataTable->setText( 1,0, tr( "Block" )) ; diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h index bdcaa99..ccc4300 100644 --- a/noncore/apps/oxygen/dataTable.h +++ b/noncore/apps/oxygen/dataTable.h @@ -37,7 +37,7 @@ class OxydataWidget : public QWidget private: OxydataTable *DataTable; - void setTable(); + void setTable() const; public slots: void setElement( int ); diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 8188515..2e99c0b 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -18,7 +18,7 @@ dataWidgetUI::dataWidgetUI() : QWidget() { - this->setCaption("Chemical Data"); + this->setCaption( tr( "Chemical Data" )); QGridLayout *qgrid = new QGridLayout( this, 2,1 ); diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index d459d2b..2d7fc84 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp @@ -13,12 +13,13 @@ OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) { + N = name; this->setFrameStyle( QFrame::Panel ); this->setLineWidth( 2 ); this->setFrameShadow( QFrame::Raised ); - this->setBackgroundColor( QColor( cyan ) ); + this->setBackgroundColor( QColor( green ) ); } void OxyFrame::mousePressEvent ( QMouseEvent * e ){ - emit clicked(); + emit num( N ); }; diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h index 6ff9e27..a19f13c 100644 --- a/noncore/apps/oxygen/oxyframe.h +++ b/noncore/apps/oxygen/oxyframe.h @@ -22,8 +22,13 @@ class OxyFrame : public QFrame void mousePressEvent( QMouseEvent *); + QString N; + signals: - void clicked(); + /* + * this signal emits the name ( the elemen-number ) + */ + void num(QString); }; #endif diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index 2574841..4e293c7 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp @@ -20,10 +20,8 @@ Oxygen::Oxygen() : QMainWindow() { - this->setCaption( "Oxygen" ); + this->setCaption( tr( "Oxygen" ) ); vbox = new QVBox( this ); - QPushButton *setButton = new QPushButton( "Settings", vbox ); - connect ( setButton, SIGNAL( clicked() ), this, SLOT( slotSettings() ) ); QPushButton *dataButton = new QPushButton( "Data", vbox ); connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) ); QPushButton *calcButton = new QPushButton( "Calculations", vbox ); @@ -35,27 +33,25 @@ Oxygen::Oxygen() } -void Oxygen::close() +void Oxygen::close() const { QApplication::exit(); } //SLOTS -void Oxygen::slotCalculations(){ +void Oxygen::slotCalculations() const{ calcDlgUI *CalcDlgUI = new calcDlgUI(); CalcDlgUI->show(); }; -void Oxygen::slotData(){ +void Oxygen::slotData() const{ dataWidgetUI *DataWidgetUI = new dataWidgetUI(); DataWidgetUI->showMaximized(); DataWidgetUI->show(); }; -void Oxygen::slotSettings(){ }; - -void Oxygen::slotPSE(){ +void Oxygen::slotPSE() const{ PSEWidget *pse = new PSEWidget(); pse->showMaximized(); pse->show(); diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h index 71914eb..2a10666 100644 --- a/noncore/apps/oxygen/oxygen.h +++ b/noncore/apps/oxygen/oxygen.h @@ -19,9 +19,8 @@ class Oxygen : public QMainWindow Oxygen(); QVBox *vbox; private slots: - void slotCalculations(); - void slotSettings(); - void slotData(); - void slotPSE(); - void close(); + void slotCalculations() const; + void slotData() const; + void slotPSE() const; + void close() const; }; diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index 506e0cb..f7725e3 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp @@ -9,22 +9,15 @@ #include <qpe/config.h> #include <qlayout.h> -#include <qlabel.h> #include <qlist.h> -#include <qvbox.h> #include "dataTable.h" #include "psewidget.h" #include "oxyframe.h" -/*Element::Element( const QString &name ) -{ -}*/ - - PSEWidget::PSEWidget() : QWidget() { - this->setCaption( "Periodic System" ); + this->setCaption( tr( "Periodic System" ) ); QVBoxLayout *vlay = new QVBoxLayout( this ); @@ -37,17 +30,20 @@ PSEWidget::PSEWidget() : QWidget() PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); PSEframe.current()->setMinimumHeight( 11 ); - connect( PSEframe.current(), SIGNAL( clicked() ), this, SLOT( slotShowElement() )); + connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); } - OxydataWidget *oxyDW = new OxydataWidget(this); + oxyDW = new OxydataWidget(this); oxyDW->setElement( 1 ); vlay->addLayout( grid ); vlay->addWidget( oxyDW ); } -void PSEWidget::slotShowElement(){ qDebug( "ja genau" );}; +void PSEWidget::slotShowElement(QString number) +{ + oxyDW->setElement( number.toInt() ); +}; void PSEWidget::position(int n, int& h, int& v) { diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h index 2a1e85c..a7a8603 100644 --- a/noncore/apps/oxygen/psewidget.h +++ b/noncore/apps/oxygen/psewidget.h @@ -13,55 +13,7 @@ #include <qwidget.h> class QGridLayout; - -class Element -{ - public: - Element(const QString &elnum); - ~Element(); - - void setName( QString c){ name = c;}; - void setWeight( QString c){ weight = c;}; - void setDensityName( QString c){density = c;}; - void setGroup( QString c){group = c;}; - void setIE( QString c){ie = c;}; - void setNum( QString c){num = c;}; - void setAZ( QString c){az = c;}; - void setDate( QString c){date = c;}; - void setEN( QString c){en = c;}; - void setMP( QString c){mp = c;}; - void setBP( QString c){bp = c;}; - void setAR( QString c){ar = c;}; - - QString elname() const{ return name; }; - QString elweight() const{ return weight; }; - QString eldensity() const{ return density; }; - QString elgroup() const{ return group; }; - QString elie() const{ return ie; }; - QString elnum() const{ return num; }; - QString elaz() const{ return az; }; - QString eldate() const{ return date; }; - QString elen() const{ return en; }; - QString elmp() const{ return mp; }; - QString elbp() const{ return bp; }; - QString elar() const{ return ar; }; - - private: - QString name, // The name of the element - weight, // weight - density, // density - group, // group - ie, // ionisationenergie - num, // number ( e.g. Carbon is 6 ) - az, // state of aggregation - date, // date of discovery - en, // electronegativity - mp, // meltingpoint - bp, // boilingpoint - ar; // atomic radius -}; - -class QGridLayout; +class OxydataWidget; class PSEWidget : public QWidget { @@ -70,6 +22,7 @@ class PSEWidget : public QWidget public: PSEWidget(); QGridLayout *bottom_grid; + OxydataWidget *oxyDW; private: QGridLayout *maingrid; @@ -77,7 +30,7 @@ class PSEWidget : public QWidget void position( int, int&, int& ); public slots: - void slotShowElement(); + void slotShowElement(QString); }; |