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 /noncore/apps | |
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 | 20 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 53 |
9 files changed, 32 insertions, 82 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 @@ -58,5 +58,5 @@ void OxydataWidget::setElement( int el ) } -void OxydataWidget::setTable() +void OxydataWidget::setTable() const { DataTable->setText( 0,0, tr( "Weight:" ) ); 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 @@ -38,5 +38,5 @@ class OxydataWidget : public QWidget private: OxydataTable *DataTable; - void setTable(); + void setTable() const; public slots: 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 @@ -19,5 +19,5 @@ 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 @@ -14,11 +14,12 @@ 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 @@ -23,6 +23,11 @@ class OxyFrame : public QFrame void mousePressEvent( QMouseEvent *); + QString N; + signals: - void clicked(); + /* + * this signal emits the name ( the elemen-number ) + */ + void num(QString); }; 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 @@ -21,8 +21,6 @@ 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() ) ); @@ -36,5 +34,5 @@ Oxygen::Oxygen() -void Oxygen::close() +void Oxygen::close() const { QApplication::exit(); @@ -43,10 +41,10 @@ void Oxygen::close() //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(); @@ -54,7 +52,5 @@ void Oxygen::slotData(){ }; -void Oxygen::slotSettings(){ }; - -void Oxygen::slotPSE(){ +void Oxygen::slotPSE() const{ PSEWidget *pse = new PSEWidget(); pse->showMaximized(); 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 @@ -20,8 +20,7 @@ class Oxygen : public QMainWindow 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 @@ -10,7 +10,5 @@ #include <qpe/config.h> #include <qlayout.h> -#include <qlabel.h> #include <qlist.h> -#include <qvbox.h> #include "dataTable.h" #include "psewidget.h" @@ -18,12 +16,7 @@ -/*Element::Element( const QString &name ) -{ -}*/ - - PSEWidget::PSEWidget() : QWidget() { - this->setCaption( "Periodic System" ); + this->setCaption( tr( "Periodic System" ) ); QVBoxLayout *vlay = new QVBoxLayout( this ); @@ -35,11 +28,11 @@ PSEWidget::PSEWidget() : QWidget() position( n+1,h,v ); QList<OxyFrame> PSEframe; - PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); + 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 ); @@ -48,5 +41,8 @@ PSEWidget::PSEWidget() : QWidget() } -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 @@ -14,53 +14,5 @@ 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 @@ -71,4 +23,5 @@ class PSEWidget : public QWidget PSEWidget(); QGridLayout *bottom_grid; + OxydataWidget *oxyDW; private: @@ -78,5 +31,5 @@ class PSEWidget : public QWidget public slots: - void slotShowElement(); + void slotShowElement(QString); }; |