-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 @@ -48,25 +48,25 @@ void OxydataWidget::setElement( int el ) DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); 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" )) ; 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" ) ); } 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 @@ -28,25 +28,25 @@ class OxydataTable; class OxydataWidget : public QWidget { Q_OBJECT public: OxydataWidget(QWidget *parent=0); QLabel *left, *middle, *right; private: OxydataTable *DataTable; - void setTable(); + void setTable() const; 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> */ 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 @@ -9,25 +9,25 @@ #include "datawidgetui.h" #include <qpe/config.h> #include <qstring.h> #include <qcombobox.h> #include <qlayout.h> #include <qhbox.h> #include <qlabel.h> dataWidgetUI::dataWidgetUI() : QWidget() { - this->setCaption("Chemical Data"); + this->setCaption( tr( "Chemical Data" )); QGridLayout *qgrid = new QGridLayout( this, 2,1 ); dataCombo = new QComboBox( this ); OxydataWidget *oxyDW = new OxydataWidget(this); oxyDW->setElement( 1 ); qgrid->addWidget( dataCombo, 0,0); qgrid->addWidget( oxyDW , 1,0 ); connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); Config configobj( "oxygendata" ); 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 @@ -4,21 +4,22 @@ * 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 <qpe/config.h> #include "oxyframe.h" 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 @@ -13,17 +13,22 @@ #include <qframe.h> class OxyFrame : public QFrame { Q_OBJECT public: OxyFrame( QWidget *parent=0, const char *name=0); 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 @@ -11,53 +11,49 @@ #include <qlabel.h> #include <qapplication.h> #include <qpushbutton.h> #include <qvbox.h> #include "calcdlg.h" #include "calcdlgui.h" #include "datawidgetui.h" #include "psewidget.h" 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 ); connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); QPushButton *pseButton = new QPushButton( "PSE", vbox ); connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); setCentralWidget( vbox ); } -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 @@ -10,18 +10,17 @@ #include <qmainwindow.h> class QVBox; class Oxygen : public QMainWindow { Q_OBJECT public: 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 @@ -1,62 +1,58 @@ /*************************************************************************** * * * 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 <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 ); QGridLayout *grid = new QGridLayout( 18,10 ); int h=0, v=0; for( int n = 0 ; n < 118 ; n++ ) { 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 ); 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) { //Hydrogen if (n == 1) { h=0; v=0; } //Helium if (n == 2) 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 @@ -4,81 +4,34 @@ * 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 _PSEWIDGET_H #define _PSEWIDGET_H #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 { Q_OBJECT public: PSEWidget(); QGridLayout *bottom_grid; + OxydataWidget *oxyDW; private: QGridLayout *maingrid; void position( int, int&, int& ); public slots: - void slotShowElement(); + void slotShowElement(QString); }; #endif |