summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp4
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp8
-rw-r--r--noncore/apps/oxygen/psewidget.cpp15
-rw-r--r--noncore/apps/oxygen/psewidget.h1
4 files changed, 22 insertions, 6 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index 870ac56..70b5a6a 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -47,56 +47,56 @@ void OxydataWidget::setElement( int el )
right->setText( QString::number( el+1 ) );
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() 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, numRows, parent, name)
{
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( cyan ) );
+ colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
else
- colgrp.setColor( QColorGroup::Base, QColor( white ) );
+ colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
p->save();
itm->paint( p, colgrp, cr, selected );
p->restore();
}
}
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index 2d7fc84..a5f262e 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -1,25 +1,25 @@
/***************************************************************************
* *
* 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 <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( green ) );
+ this->setFrameStyle( QFrame::Box );
+ this->setLineWidth( 0 );
+ this->setMidLineWidth( 1 );
+ this->setFrameShadow( QFrame::Sunken );
}
void OxyFrame::mousePressEvent ( QMouseEvent * e ){
emit num( N );
};
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index f7725e3..78e54d5 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,90 +1,105 @@
/***************************************************************************
* *
* 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 <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( "oxygendata" );
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( 1 );
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);
}
}
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index a7a8603..f69eeb3 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -1,37 +1,38 @@
/***************************************************************************
* *
* 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 OxydataWidget;
class PSEWidget : public QWidget
{
Q_OBJECT
public:
PSEWidget();
QGridLayout *bottom_grid;
OxydataWidget *oxyDW;
private:
QGridLayout *maingrid;
void position( int, int&, int& );
+ QColor PSEColor( QString );
public slots:
void slotShowElement(QString);
};
#endif