TQt4 port kdeedu

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 12 years ago
parent f81a494f39
commit a374efce3a

@ -34,9 +34,10 @@ namespace KDE
class TQTimer;
class artsPlayer : public QObject
class artsPlayer : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
artsPlayer();
~artsPlayer();

@ -144,7 +144,7 @@ void blinken::paintEvent(TQPaintEvent *)
p.setBrush(m_fillColor);
p.drawPie(169, 192, 4, 58, 1440, 2880);
p.drawPie(465, 192, 4, 58, -1440, 2880);
p.setPen(TQPen(Qt::black, 3));
p.setPen(TQPen(TQt::black, 3));
p.fillRect(171, 192, 296, 58, m_fillColor);
p.drawLine(169, 192, 469, 192);
p.drawLine(169, 250, 469, 250);
@ -184,16 +184,16 @@ void blinken::paintEvent(TQPaintEvent *)
if (sizeAux > size) size = sizeAux;
f1.setPointSize(size);
#ifndef WITHOUT_ARTS
area = p.boundingRect(TQRect(), Qt::AlignAuto, sounds);
area = p.boundingRect(TQRect(), TQt::AlignAuto, sounds);
area.moveBy(212, 221 - (area.height() / 2));
p.drawText(area, Qt::AlignCenter, sounds);
p.drawText(area, TQt::AlignCenter, sounds);
m_soundRect = m_soundRect.unite(area);
#endif
if (!m_alwaysUseNonCoolFont)
{
area = p.boundingRect(TQRect(), Qt::AlignAuto, font);
area = p.boundingRect(TQRect(), TQt::AlignAuto, font);
area.moveBy(426 - area.width(), 221 - (area.height() / 2));
p.drawText(area, Qt::AlignCenter, font);
p.drawText(area, TQt::AlignCenter, font);
m_fontRect = m_fontRect.unite(area);
}
@ -227,7 +227,7 @@ void blinken::keyPressEvent(TQKeyEvent *e)
if (i < 4)
{
if (e -> key() == Qt::Key_Escape)
if (e -> key() == TQt::Key_Escape)
{
m_buttons[i] -> setSelected(false);
update();
@ -267,7 +267,7 @@ void blinken::keyReleaseEvent(TQKeyEvent *e)
{
if (e -> isAutoRepeat()) return;
if (e -> state() == Qt::ControlButton && e -> stateAfter() != Qt::ControlButton && (m_game.phase() == blinkenGame::starting || m_game.phase() == blinkenGame::choosingLevel))
if (e -> state() == TQt::ControlButton && e -> stateAfter() != TQt::ControlButton && (m_game.phase() == blinkenGame::starting || m_game.phase() == blinkenGame::choosingLevel))
{
m_showPreferences = !m_showPreferences;
for (int i = 0; i < 4; i++) m_buttons[i] -> setSelected(false);
@ -289,13 +289,13 @@ void blinken::mousePressEvent(TQMouseEvent *e)
hsd->showLevel(1);
m_updateButtonHighlighting = true;
}
else if (m_showPreferences && m_fontRect.contains(e -> pos()) && !m_alwaysUseNonCoolFont)
else if (m_showPreferences && m_fontRect.tqcontains(e -> pos()) && !m_alwaysUseNonCoolFont)
{
blinkenSettings::setCustomFont(!blinkenSettings::customFont());
blinkenSettings::writeConfig();
update();
}
else if (m_showPreferences && m_soundRect.contains(e -> pos()))
else if (m_showPreferences && m_soundRect.tqcontains(e -> pos()))
{
blinkenSettings::setPlaySounds(!blinkenSettings::playSounds());
blinkenSettings::writeConfig();
@ -316,9 +316,9 @@ void blinken::mousePressEvent(TQMouseEvent *e)
else if (m_game.phase() == blinkenGame::choosingLevel)
{
int level = 0;
if (m_levelsRect[1].contains(e -> pos())) level = 1;
else if (m_levelsRect[0].contains(e -> pos())) level = 2;
else if (m_levelsRect[2].contains(e -> pos())) level = 3;
if (m_levelsRect[1].tqcontains(e -> pos())) level = 1;
else if (m_levelsRect[0].tqcontains(e -> pos())) level = 2;
else if (m_levelsRect[2].tqcontains(e -> pos())) level = 3;
if (level)
{
for(int i = 0; i < 3; i++) m_overLevels[i] = false;
@ -639,7 +639,7 @@ void blinken::drawText(TQPainter &p, const TQString &text, const TQPoint &center
if (bold) f.setBold(true);
p.setFont(f);
r = p.boundingRect(TQRect(), Qt::AlignAuto, text);
r = p.boundingRect(TQRect(), TQt::AlignAuto, text);
r = TQRect(0, 0, r.width() + xMargin, r.height() + yMargin);
r.moveBy(center.x() - r.width() / 2, center.y() - r.height() / 2);
@ -652,7 +652,7 @@ void blinken::drawText(TQPainter &p, const TQString &text, const TQPoint &center
if (!highlight) p.setPen(m_fontColor);
else p.setPen(m_fontHighlightColor);
p.drawText(r, Qt::AlignCenter, text);
p.drawText(r, TQt::AlignCenter, text);
if (rect) *rect = r;
p.setFont(oldFont);
@ -665,7 +665,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
m_updateButtonHighlighting = false;
haveToUpdate = false;
if (m_highscoreRect.contains(p))
if (m_highscoreRect.tqcontains(p))
{
if (!m_overHighscore)
{
@ -679,7 +679,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
if (m_menuRect.contains(p))
if (m_menuRect.tqcontains(p))
{
if (!m_overMenu)
{
@ -699,7 +699,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
}
else if (m_overMenu)
{
if (m_aboutKDERect.contains(p))
if (m_aboutKDERect.tqcontains(p))
{
if (!m_overAboutKDE)
{
@ -709,7 +709,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
}
else if (m_aboutBlinkenRect.contains(p))
else if (m_aboutBlinkenRect.tqcontains(p))
{
if (!m_overAboutBlinken)
{
@ -719,7 +719,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
}
else if (m_manualRect.contains(p))
else if (m_manualRect.tqcontains(p))
{
if (!m_overManual)
{
@ -739,7 +739,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
}
}
if (!m_showPreferences && m_centralLettersRect.contains(p))
if (!m_showPreferences && m_centralLettersRect.tqcontains(p))
{
m_overCentralLetters = true;
haveToUpdate = true;
@ -750,7 +750,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
if (m_showPreferences && m_soundRect.contains(p))
if (m_showPreferences && m_soundRect.tqcontains(p))
{
m_overSound = true;
haveToUpdate = true;
@ -761,7 +761,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
if (m_showPreferences && m_fontRect.contains(p) && !m_alwaysUseNonCoolFont)
if (m_showPreferences && m_fontRect.tqcontains(p) && !m_alwaysUseNonCoolFont)
{
m_overFont = true;
haveToUpdate = true;
@ -772,7 +772,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
if (m_counterRect.contains(p))
if (m_counterRect.tqcontains(p))
{
m_overCounter = true;
haveToUpdate = true;
@ -783,7 +783,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
haveToUpdate = true;
}
if (m_quitRect.contains(p))
if (m_quitRect.tqcontains(p))
{
if (!m_overQuit)
{
@ -805,7 +805,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
case blinkenGame::waiting1:
case blinkenGame::learningTheSequence:
case blinkenGame::typingTheSequence:
if (m_centralTextRect.contains(p))
if (m_centralTextRect.tqcontains(p))
{
if (!m_overCentralText)
{
@ -823,7 +823,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p)
case blinkenGame::choosingLevel:
for (int i = 0; i < 3; i++)
{
if (m_levelsRect[i].contains(p))
if (m_levelsRect[i].tqcontains(p))
{
if (!m_overLevels[i])
{

@ -22,9 +22,10 @@ class KHelpMenu;
class button;
class highScoreDialog;
class blinken : public QWidget
class blinken : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
blinken();
~blinken();
@ -73,7 +74,7 @@ Q_OBJECT
// Preferences setting handling
bool m_showPreferences;
// if should update the highlighting after the next repaint
// if should update the highlighting after the next tqrepaint
bool m_updateButtonHighlighting;
// use always the non-cool font?

@ -17,9 +17,10 @@ class TQTimer;
class artsPlayer;
class blinkenGame : public QObject
class blinkenGame : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
blinkenGame();
~blinkenGame();

@ -20,24 +20,24 @@ button::button(blinkenGame::color c) : m_selected(false), m_color(c)
KConfig *kc = kapp->config();
kc->setGroup("General");
TQString cs = getColorString();
TQString pixmap = TQString("images/%1h.png").arg(cs);
TQString pixmap = TQString("images/%1h.png").tqarg(cs);
switch (c)
{
case blinkenGame::blue:
m_key = kc->readNumEntry(cs, Qt::Key_3);
m_key = kc->readNumEntry(cs, TQt::Key_3);
break;
case blinkenGame::yellow:
m_key = kc->readNumEntry(cs, Qt::Key_1);
m_key = kc->readNumEntry(cs, TQt::Key_1);
break;
case blinkenGame::red:
m_key = kc->readNumEntry(cs, Qt::Key_2);
m_key = kc->readNumEntry(cs, TQt::Key_2);
break;
case blinkenGame::green:
m_key = kc->readNumEntry(cs, Qt::Key_4);
m_key = kc->readNumEntry(cs, TQt::Key_4);
break;
default:
@ -115,5 +115,5 @@ TQString button::getColorString() const
}
// never happens
return TQString::null;
return TQString();
}

@ -17,7 +17,7 @@ void counter::paint(TQPainter &p, bool drawScore, int score, bool drawTimer, con
{
p.save();
p.translate(45, 15);
p.setPen(TQPen(Qt::black, 3));
p.setPen(TQPen(TQt::black, 3));
p.setBrush(TQColor(40, 40, 40));
if (drawTimer)
{

@ -24,8 +24,8 @@ int fontUtils::fontSize(TQPainter &p, const TQString &s1, int w, int h)
TQFont f = p.font();
f.setPointSize(size);
p.setFont(f);
aux1 = p.boundingRect(TQRect(), Qt::AlignAuto, s1);
if (aux1.width() > w || aux1.height() > h) size = QMIN(w * size / aux1.width(), h * size / aux1.height());
aux1 = p.boundingRect(TQRect(), TQt::AlignAuto, s1);
if (aux1.width() > w || aux1.height() > h) size = TQMIN(w * size / aux1.width(), h * size / aux1.height());
else done = true;
}

@ -27,20 +27,20 @@ static const int namesFontSize = 25;
/* scoresWidget */
class scoresWidget : public QWidget
class scoresWidget : public TQWidget
{
public:
scoresWidget(TQWidget *parent, const TQValueList< QPair<int, TQString> > &scores);
scoresWidget(TQWidget *tqparent, const TQValueList< TQPair<int, TQString> > &scores);
TQSize calcSize();
protected:
void paintEvent(TQPaintEvent *);
private:
const TQValueList< QPair<int, TQString> > &m_scores;
const TQValueList< TQPair<int, TQString> > &m_scores;
};
scoresWidget::scoresWidget(TQWidget *parent, const TQValueList< QPair<int, TQString> > &scores) : TQWidget(parent, 0, WStaticContents | WNoAutoErase), m_scores(scores)
scoresWidget::scoresWidget(TQWidget *tqparent, const TQValueList< TQPair<int, TQString> > &scores) : TQWidget(tqparent, 0, WStaticContents | WNoAutoErase), m_scores(scores)
{
}
@ -66,7 +66,7 @@ void scoresWidget::paintEvent(TQPaintEvent *)
p.translate(margin, margin);
TQValueList< QPair<int, TQString> >::const_iterator it;
TQValueList< TQPair<int, TQString> >::const_iterator it;
for (it = m_scores.begin(); it != m_scores.end(); ++it)
{
counter::paint(p, !(*it).second.isEmpty(), (*it).first, false, TQColor(), TQColor(), TQColor());
@ -92,11 +92,11 @@ TQSize scoresWidget::calcSize()
for (int i = 0; i < 3; i++)
{
lt = 0;
TQValueList< QPair<int, TQString> >::const_iterator it;
TQValueList< TQPair<int, TQString> >::const_iterator it;
for (it = m_scores.begin(); it != m_scores.end(); ++it)
{
r = p.boundingRect(TQRect(), Qt::AlignAuto, (*it).second);
lt = QMAX(lt, r.width());
r = p.boundingRect(TQRect(), TQt::AlignAuto, (*it).second);
lt = TQMAX(lt, r.width());
}
}
@ -112,20 +112,20 @@ TQSize scoresWidget::calcSize()
/* myTabWidget */
class myTabWidget : public QTabWidget
class myTabWidget : public TQTabWidget
{
public:
myTabWidget(TQWidget *parent) : TQTabWidget(parent) {}
myTabWidget(TQWidget *tqparent) : TQTabWidget(tqparent) {}
TQSize tabBarSizeHint() const
{
return tabBar() -> sizeHint();
return tabBar() -> tqsizeHint();
}
};
/* highScoreDialog */
highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true, i18n("Highscores"), KDialogBase::Close)
highScoreDialog::highScoreDialog(TQWidget *tqparent) : KDialogBase(tqparent, 0, true, i18n("Highscores"), KDialogBase::Close)
{
m_tw = new myTabWidget(this);
setMainWidget(m_tw);
@ -133,10 +133,10 @@ highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true
KConfig *cfg = kapp -> config();
for (int i = 1; i <= 3; i++)
{
cfg -> setGroup(TQString("Level%1").arg(i));
cfg -> setGroup(TQString("Level%1").tqarg(i));
for (int j = 1; j <= 5; j++)
{
m_scores[i-1].append(qMakePair(cfg->readNumEntry(TQString("Score%1").arg(j)), cfg->readEntry(TQString("Name%1").arg(j))));
m_scores[i-1].append(tqMakePair(cfg->readNumEntry(TQString("Score%1").tqarg(j)), cfg->readEntry(TQString("Name%1").tqarg(j))));
}
}
@ -148,7 +148,7 @@ highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true
bool highScoreDialog::scoreGoodEnough(int level, int score)
{
level--;
TQValueList< QPair<int, TQString> >::iterator it, itEnd;
TQValueList< TQPair<int, TQString> >::iterator it, itEnd;
it = m_scores[level].begin();
itEnd = m_scores[level].end();
while (it != itEnd && (*it).first >= score) it++;
@ -159,23 +159,23 @@ bool highScoreDialog::scoreGoodEnough(int level, int score)
void highScoreDialog::addScore(int level, int score, const TQString &name)
{
level--;
TQValueList< QPair<int, TQString> >::iterator it, itEnd;
TQValueList< TQPair<int, TQString> >::iterator it, itEnd;
it = m_scores[level].begin();
itEnd = m_scores[level].end();
while (it != itEnd && (*it).first >= score) it++;
if (it != itEnd)
{
m_scores[level].insert(it, qMakePair(score, name));
m_scores[level].insert(it, tqMakePair(score, name));
m_scores[level].remove(--m_scores[level].end());
KConfig *cfg = kapp -> config();
cfg -> setGroup(TQString("Level%1").arg(level + 1));
cfg -> setGroup(TQString("Level%1").tqarg(level + 1));
int j;
for (it = m_scores[level].begin(), j = 1; it != m_scores[level].end(); ++it, j++)
{
cfg->writeEntry(TQString("Score%1").arg(j), (*it).first);
cfg->writeEntry(TQString("Name%1").arg(j), (*it).second);
cfg->writeEntry(TQString("Score%1").tqarg(j), (*it).first);
cfg->writeEntry(TQString("Name%1").tqarg(j), (*it).second);
}
cfg -> sync();
}

@ -20,13 +20,13 @@ class myTabWidget;
class highScoreDialog : private KDialogBase
{
public:
highScoreDialog(TQWidget *parent);
highScoreDialog(TQWidget *tqparent);
bool scoreGoodEnough(int level, int score);
void addScore(int level, int score, const TQString &name);
void showLevel(int level);
TQValueList< QPair<int, TQString> > m_scores[3];
TQValueList< TQPair<int, TQString> > m_scores[3];
myTabWidget *m_tw;
};

@ -100,7 +100,7 @@ void number::paintDigit(TQPainter &p, int number) const
{
// make gcc happy
const int *n = m_number0;
int shape;
int tqshape;
switch (number)
{
@ -141,31 +141,31 @@ void number::paintDigit(TQPainter &p, int number) const
break;
}
p.setBrush(Qt::red);
p.setPen(Qt::red);
p.setBrush(TQt::red);
p.setPen(TQt::red);
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 4; j++)
{
shape = n[j + i * 4];
if (shape == 0)
tqshape = n[j + i * 4];
if (tqshape == 0)
{
p.fillRect(7 * (j-1), 7 * (i-1), 6, 6, Qt::red);
p.fillRect(7 * (j-1), 7 * (i-1), 6, 6, TQt::red);
}
else if (shape != 5)
else if (tqshape != 5)
{
if (shape == 1) p.translate(7 * (j-1), 7 * (i-1));
else if (shape == 2)
if (tqshape == 1) p.translate(7 * (j-1), 7 * (i-1));
else if (tqshape == 2)
{
p.translate(7 * j - 2, 7 * (i-1));
p.rotate(90);
}
else if (shape == 3)
else if (tqshape == 3)
{
p.translate(7 * j - 2, 7 * i - 2);
p.rotate(180);
}
else if (shape == 4)
else if (tqshape == 4)
{
p.translate(7 * (j-1), 7 * i - 2);
p.rotate(270);
@ -173,19 +173,19 @@ void number::paintDigit(TQPainter &p, int number) const
p.drawPie(0, 0, 11, 11, 90 * 16, 16 * 90);
if (shape == 1) p.translate(-7 * (j-1), -7 * (i-1));
else if (shape == 2)
if (tqshape == 1) p.translate(-7 * (j-1), -7 * (i-1));
else if (tqshape == 2)
{
p.rotate(-90);
p.translate(-(7 * j - 2), -7 * (i-1));
}
else if (shape == 3)
else if (tqshape == 3)
{
p.rotate(-180);
p.translate(-(7 * j - 2), -(7 * i - 2));
}
else if (shape == 4)
else if (tqshape == 4)
{
p.rotate(-270);
p.translate(- (7 * (j-1)), -(7 * i - 2));

@ -19,7 +19,7 @@ Add:
- The menustructure is now more consistent
- One icon has been added
- Make the mainwidget a QScrollView. This make sizehandling easier
- Improved layout of the detailed information dialog
- Improved tqlayout of the detailed information dialog
- Added a widget which shows you a table of the isotopes
- Added EqChem, a chemical equation solver
- Added several glossary-items

@ -1,7 +1,7 @@
Release plan
============
Status: Under discussion
tqStatus: Under discussion
Overview

@ -28,14 +28,14 @@ email : cniehaus@kde.org
#include <tqpixmap.h>
#include <tqrect.h>
DetailedGraphicalOverview::DetailedGraphicalOverview( Element *el, TQWidget *parent, const char *name )
: TQWidget( parent, name )
DetailedGraphicalOverview::DetailedGraphicalOverview( Element *el, TQWidget *tqparent, const char *name )
: TQWidget( tqparent, name )
{
init( el );
}
DetailedGraphicalOverview::DetailedGraphicalOverview( TQWidget *parent, const char *name )
: TQWidget( parent, name )
DetailedGraphicalOverview::DetailedGraphicalOverview( TQWidget *tqparent, const char *name )
: TQWidget( tqparent, name )
{
init( 0L );
}
@ -59,12 +59,12 @@ void DetailedGraphicalOverview::paintEvent( TQPaintEvent* )
TQPainter p;
p.begin( &pm );
p.setBrush(Qt::SolidPattern);
p.setBrush(TQt::SolidPattern);
if ( !m_element )
{
pm.fill( paletteBackgroundColor() );
p.drawText( 0, 0, w, h, Qt::AlignCenter | Qt::WordBreak, i18n( "No element selected" ) );
p.drawText( 0, 0, w, h, TQt::AlignCenter | TQt::WordBreak, i18n( "No element selected" ) );
}
else
{
@ -80,8 +80,8 @@ void DetailedGraphicalOverview::paintEvent( TQPaintEvent* )
p.setBrush( m_element->elementColor() );
p.drawRect( x1 , y1 , x2 , y2 );
p.setBrush( Qt::black );
p.setBrush(Qt::NoBrush);
p.setBrush( TQt::black );
p.setBrush(TQt::NoBrush);
TQFont fA = KGlobalSettings::generalFont();
TQFont fB = KGlobalSettings::generalFont();
@ -126,20 +126,20 @@ void DetailedGraphicalOverview::paintEvent( TQPaintEvent* )
p.setFont( fC );
//Name
p.drawText( 1, 0, w/2, h, Qt::AlignLeft, m_element->elname() );
p.drawText( 1, 0, w/2, h, TQt::AlignLeft, m_element->elname() );
//Oxidationstates
fC.setPointSize( size2 );
p.setFont( fC );
int offsetOx = KalziumUtils::StringHeight( strLocalizedMass , fC, &p );
p.drawText( 1, h-offsetOx, w/2, offsetOx, Qt::AlignLeft, m_element->oxstage() );
p.drawText( 1, h-offsetOx, w/2, offsetOx, TQt::AlignLeft, m_element->oxstage() );
//Mass
fC.setPointSize( size3 );
p.setFont( fC );
int offset = KalziumUtils::StringHeight( strLocalizedMass, fC, &p );
p.drawText( w/2, h-offset, w/2, offset, Qt::AlignRight, strLocalizedMass );
p.drawText( w/2, h-offset, w/2, offset, TQt::AlignRight, strLocalizedMass );
drawBiologicalSymbol( &p );
}
@ -164,9 +164,9 @@ void DetailedGraphicalOverview::drawBiologicalSymbol( TQPainter *p )
if ( m_element->biological() > 0 )
{
const int radius = db + 8;
p->setBrush( Qt::SolidPattern );
p->setBrush( Qt::white );
p->setPen( Qt::black );
p->setBrush( TQt::SolidPattern );
p->setBrush( TQt::white );
p->setPen( TQt::black );
p->drawRoundRect( TQRect( width() - radius,
-radius,
2 * radius,
@ -178,52 +178,52 @@ void DetailedGraphicalOverview::drawBiologicalSymbol( TQPainter *p )
case 0: //nothing
break;
case 1: //red, red
p->setBrush( Qt::red );
p->setBrush(Qt::NoBrush);
p->setPen( Qt::red );
p->setBrush( TQt::red );
p->setBrush(TQt::NoBrush);
p->setPen( TQt::red );
p->drawEllipse( pos_x,pos_y,db,db );
p->setBrush(Qt::SolidPattern);
p->setBrush( Qt::red );
p->setBrush(TQt::SolidPattern);
p->setBrush( TQt::red );
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
case 2: //green, red
p->setBrush( Qt::red );
p->setBrush(Qt::NoBrush);
p->setPen( Qt::red );
p->setBrush( TQt::red );
p->setBrush(TQt::NoBrush);
p->setPen( TQt::red );
p->drawEllipse( pos_x,pos_y,db,db );
p->setBrush(Qt::SolidPattern);
p->setBrush( Qt::green );
p->setPen( Qt::green );
p->setBrush(TQt::SolidPattern);
p->setBrush( TQt::green );
p->setPen( TQt::green );
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
case 3: //green
p->setBrush(Qt::SolidPattern);
p->setBrush( Qt::green );
p->setPen( Qt::green );
p->setBrush(TQt::SolidPattern);
p->setBrush( TQt::green );
p->setPen( TQt::green );
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
case 4: //green, blue
p->setBrush( Qt::blue );
p->setBrush(Qt::NoBrush);
p->setPen( Qt::blue );
p->setBrush( TQt::blue );
p->setBrush(TQt::NoBrush);
p->setPen( TQt::blue );
p->drawEllipse( pos_x,pos_y,db,db );
p->setBrush(Qt::SolidPattern);
p->setBrush( Qt::green );
p->setPen( Qt::green );
p->setBrush(TQt::SolidPattern);
p->setBrush( TQt::green );
p->setPen( TQt::green );
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
case 5: //blue
p->setBrush(Qt::SolidPattern);
p->setBrush( Qt::blue );
p->setPen( Qt::blue );
p->setBrush(TQt::SolidPattern);
p->setBrush( TQt::blue );
p->setPen( TQt::blue );
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
case 6: //blue, blue
p->setBrush( Qt::blue );
p->setBrush(Qt::NoBrush);
p->setPen( Qt::blue );
p->setBrush( TQt::blue );
p->setBrush(TQt::NoBrush);
p->setPen( TQt::blue );
p->drawEllipse( pos_x,pos_y,db,db );
p->setBrush(Qt::SolidPattern);
p->setBrush(TQt::SolidPattern);
p->drawEllipse( pos_x+d_ds, pos_y+d_ds, ds, ds );
break;
}

@ -25,13 +25,14 @@ class Element;
* in one widget like a lot people know it from school
* @author Carsten Niehaus
*/
class DetailedGraphicalOverview : public QWidget
class DetailedGraphicalOverview : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
DetailedGraphicalOverview( Element *el, TQWidget *parent, const char *name=0 );
DetailedGraphicalOverview( TQWidget *parent, const char *name=0 );
DetailedGraphicalOverview( Element *el, TQWidget *tqparent, const char *name=0 );
DetailedGraphicalOverview( TQWidget *tqparent, const char *name=0 );
/**
* sets the elements whose data will be used to @p el

@ -44,8 +44,8 @@
//TODO add bondxx-radius (H-H-distance for example)
DetailedInfoDlg::DetailedInfoDlg( Element *el , TQWidget *parent, const char *name)
: KDialogBase( IconList, name, Help|User1|User2|Close, Close, parent, name,
DetailedInfoDlg::DetailedInfoDlg( Element *el , TQWidget *tqparent, const char *name)
: KDialogBase( IconList, name, Help|User1|User2|Close, Close, tqparent, name,
false, //non modal
false,
KGuiItem(i18n("Next element", "Next"), "1rightarrow"),
@ -66,7 +66,7 @@ DetailedInfoDlg::DetailedInfoDlg( Element *el , TQWidget *parent, const char *na
createContent();
m_actionCollection = new KActionCollection(this);
KStdAction::quit(this, TQT_SLOT(slotClose()), m_actionCollection);
KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(slotClose()), m_actionCollection);
setButtonTip( User2, i18n( "Goes to the previous element" ) );
setButtonTip( User1, i18n( "Goes to the next element" ) );
@ -94,10 +94,10 @@ void DetailedInfoDlg::setElement(Element *element)
KHTMLPart* DetailedInfoDlg::addHTMLTab( const TQString& title, const TQString& icontext, const TQString& iconname )
{
TQFrame *frame = addPage(title, icontext, BarIcon(iconname));
TQVBoxLayout *layout = new TQVBoxLayout( frame );
layout->setMargin( 0 );
KHTMLPart *w = new KHTMLPart( frame, "html-part", frame );
layout->addWidget( w->view() );
TQVBoxLayout *tqlayout = new TQVBoxLayout( frame );
tqlayout->setMargin( 0 );
KHTMLPart *w = new KHTMLPart( frame, "html-part", TQT_TQOBJECT(frame) );
tqlayout->addWidget( w->view() );
return w;
}
@ -122,43 +122,43 @@ TQString DetailedInfoDlg::getHtml(DATATYPE type)
html.append( "<div><table summary=\"header\"><tr><td>" );
html.append( m_element->symbol() );
html.append( "<td><td>" );
html.append( i18n( "Block: %1" ).arg( m_element->block() ) );
html.append( i18n( "Block: %1" ).tqarg( m_element->block() ) );
html.append( "</td></tr></table></div>" );
html.append( "<table summary=\"characteristics\" class=\"characterstics\">");
switch ( type )
{
case CHEMICAL:
html.append( "<tr><td><img src=\"structure.png\" alt=\"icon\"/></td><td>" );
html.append( "<b>" + i18n( "Electronic configuration: %1" ).arg( m_element->parsedOrbits() ) + "</b>" );
html.append( "<b>" + i18n( "Electronic configuration: %1" ).tqarg( m_element->parsedOrbits() ) + "</b>" );
html.append( "</td></tr>" );
html.append( "<tr><td><img src=\"density.png\" alt=\"icon\"/></td><td>" );
html.append( "<b>" + i18n( "Density: %1" ).arg( m_element->adjustUnits( Element::DENSITY ) ) + "</b>" );
html.append( "<b>" + i18n( "Density: %1" ).tqarg( m_element->adjustUnits( Element::DENSITY ) ) + "</b>" );
html.append( "</td></tr>" );
html.append( "<tr><td><img src=\"radius.png\" alt=\"icon\"/></td><td><b>" );
html.append( "<b>" + i18n( "Covalent Radius: %1" ).arg( m_element->adjustRadius( Element::COVALENT ) ) + "</b>" );
html.append( "<b>" + i18n( "Covalent Radius: %1" ).tqarg( m_element->adjustRadius( Element::COVALENT ) ) + "</b>" );
html.append( "</td></tr>" );
if ( m_element->radius(Element::IONIC) > 0.0 )
{
html.append( "<tr><td><img src=\"radius.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "<b>Ionic Radius (Charge): %1</b> (%2)" ).arg( m_element->adjustRadius(Element::IONIC) ).arg( m_element->ioncharge() ) );
html.append( i18n( "<b>Ionic Radius (Charge): %1</b> (%2)" ).tqarg( m_element->adjustRadius(Element::IONIC) ).tqarg( m_element->ioncharge() ) );
html.append( "</td></tr>" );
}
if ( m_element->radius(Element::VDW) > 0.0 )
{
html.append( "<tr><td><img src=\"radius.png\" alt=\"icon\"/></td><td>" );
html.append( "<b>" + i18n( "van der Waals Radius: %1" ).arg( m_element->adjustRadius(Element::VDW) ) + "</b>" );
html.append( "<b>" + i18n( "van der Waals Radius: %1" ).tqarg( m_element->adjustRadius(Element::VDW) ) + "</b>" );
html.append( "</td></tr>" );
}
if ( m_element->radius(Element::ATOMIC) > 0.0 )
{
html.append( "<tr><td><img src=\"radius.png\" alt=\"icon\"/></td><td><b>" );
html.append( "<b>" + i18n( "Atomic Radius: %1" ).arg( m_element->adjustRadius(Element::ATOMIC) ) + "</b>" );
html.append( "<b>" + i18n( "Atomic Radius: %1" ).tqarg( m_element->adjustRadius(Element::ATOMIC) ) + "</b>" );
html.append( "</td></tr>" );
}
html.append( "<tr><td stype=\"text-align:center\"><img src=\"mass.png\" alt=\"icon\"/></td><td>" );
html.append( "<b>" + i18n( "Mass: %1" ).arg( m_element->adjustUnits( Element::MASS ) ) + "</b>" );
html.append( "<b>" + i18n( "Mass: %1" ).tqarg( m_element->adjustUnits( Element::MASS ) ) + "</b>" );
html.append( "</td></tr>" );
if ( !m_element->isotopes().isEmpty() )
{
@ -171,22 +171,22 @@ TQString DetailedInfoDlg::getHtml(DATATYPE type)
html.append( "<tr><td><img src=\"discovery.png\" alt=\"icon\"/></td><td>" );
html.append( m_element->adjustUnits( Element::DATE ) );
if ( !m_element->scientist( ).isEmpty() )
html += "<br />" + i18n("It was discovered by %1").arg(m_element->scientist() );
html += "<br />" + i18n("It was discovered by %1").tqarg(m_element->scientist() );
html.append( "</td></tr>" );
if ( m_element->abundance() > 0 ){
html.append( "<tr><td><img src=\"abundance.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Abundance in crustal rocks: %1 ppm" ).arg( KGlobal::locale()->formatLong( m_element->abundance() ) ) );
html.append( i18n( "Abundance in crustal rocks: %1 ppm" ).tqarg( KGlobal::locale()->formatLong( m_element->abundance() ) ) );
html.append( "</td></tr>" );
}
html.append( "<tr><td><img src=\"mass.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Mean mass: %1 u" ).arg( KalziumUtils::localizedValue( m_element->meanmass(), 6 ) ) );
html.append( i18n( "Mean mass: %1 u" ).tqarg( KalziumUtils::localizedValue( m_element->meanmass(), 6 ) ) );
html.append( "</td></tr>" );
if ( !m_element->nameOrigin().isEmpty() )
{
html.append( "<tr><td><img src=\"book.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Origin of the name: %1" ).arg( m_element->nameOrigin() ) );
html.append( i18n( "Origin of the name: %1" ).tqarg( m_element->nameOrigin() ) );
html.append( "</td></tr>" );
}
if ( m_element->artificial() || m_element->radioactive() )
@ -203,16 +203,16 @@ TQString DetailedInfoDlg::getHtml(DATATYPE type)
break;
case ENERGY:
html.append( "<tr><td><img src=\"meltingpoint.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Melting Point: %1" ).arg( m_element->adjustUnits( Element::MELTINGPOINT ) ) );
html.append( i18n( "Melting Point: %1" ).tqarg( m_element->adjustUnits( Element::MELTINGPOINT ) ) );
html.append( "</td></tr>" );
html.append( "<tr><td><img src=\"boilingpoint.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Boiling Point: %1" ).arg( m_element->adjustUnits( Element::BOILINGPOINT ) ) );
html.append( i18n( "Boiling Point: %1" ).tqarg( m_element->adjustUnits( Element::BOILINGPOINT ) ) );
html.append( "</td></tr>" );
html.append( "<tr><td><img src=\"structure.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Electronegativity: %1" ).arg( m_element->adjustUnits( Element::EN ) ) );
html.append( i18n( "Electronegativity: %1" ).tqarg( m_element->adjustUnits( Element::EN ) ) );
html.append( "</td></tr>" );
html.append( "<tr><td><img src=\"electronaffinity.png\" alt=\"icon\"/></td><td>" );
html.append( i18n( "Electron affinity: %1 " ).arg( m_element->adjustUnits(Element::EA) ) );
html.append( i18n( "Electron affinity: %1 " ).tqarg( m_element->adjustUnits(Element::EA) ) );
html.append( "</td></tr>" );
@ -221,7 +221,7 @@ TQString DetailedInfoDlg::getHtml(DATATYPE type)
{
html.append( "<tr><td><img src=\"ionisation.png\" alt=\"icon\"/></td><td>" );
html.append( i18n("the first variable is a number. The result is for example '1.' or '5.', the second is the value of the ionisation energy",
"%1. Ionization energy: %2" ).arg( TQString::number( i+1 ), m_element->adjustUnits( Element::IE, ionlist[i] ) ) );
"%1. Ionization energy: %2" ).tqarg( TQString::number( i+1 ), m_element->adjustUnits( Element::IE, ionlist[i] ) ) );
html.append( "</td></tr>" );
}
break;
@ -264,13 +264,13 @@ TQString DetailedInfoDlg::isotopeTable()
{
html.append( "<tr><td align=\"right\">" );
if ( ( *it )->weight() > 0.0 )
html.append( i18n( "%1 u" ).arg( KalziumUtils::localizedValue( ( *it )->weight(), 6 ) ) );
// html.append( i18n( "%1 u" ).arg( TQString::number( ( *it )->weight() ) ));
html.append( i18n( "%1 u" ).tqarg( KalziumUtils::localizedValue( ( *it )->weight(), 6 ) ) );
// html.append( i18n( "%1 u" ).tqarg( TQString::number( ( *it )->weight() ) ));
html.append( "</td><td>" );
html.append( TQString::number( ( *it )->neutrons() ) );
html.append( "</td><td>" );
if ( ( *it )->percentage() > 0.0 )
html.append( i18n( "this can for example be '24%'", "%1%" ).arg( KalziumUtils::localizedValue( ( *it )->percentage(), 6 ) ) );
html.append( i18n( "this can for example be '24%'", "%1%" ).tqarg( KalziumUtils::localizedValue( ( *it )->percentage(), 6 ) ) );
html.append( "</td><td>" );
if ( ( *it )->halflife() > 0.0 ) {
html.append( ( *it )->halflifeAsString() );
@ -278,49 +278,49 @@ TQString DetailedInfoDlg::isotopeTable()
html.append( "</td><td>" );
if ( ( *it )->alphapercentage() > 0.0 ){
if ( ( *it )->alphadecay() > 0.0 )
html.append( i18n( "%1 MeV" ).arg( KalziumUtils::localizedValue( ( *it )->alphadecay(), 6 ) ) );
html.append( i18n( " %1" ).arg( TQChar( 945 ) ) );
html.append( i18n( "%1 MeV" ).tqarg( KalziumUtils::localizedValue( ( *it )->alphadecay(), 6 ) ) );
html.append( i18n( " %1" ).tqarg( TQChar( 945 ) ) );
if ( ( *it )->alphapercentage() < 100.0)
html.append( i18n( "(%1%)" ).arg( KalziumUtils::localizedValue( (*it )->alphapercentage(), 6 ) ) );
html.append( i18n( "(%1%)" ).tqarg( KalziumUtils::localizedValue( (*it )->alphapercentage(), 6 ) ) );
if ( ( *it )->betaminuspercentage() > 0.0 || ( *it )->betapluspercentage() > 0.0 || ( *it )->ecpercentage() > 0.0)
html.append( i18n( ", " ) );
}
if ( ( *it )->betaminuspercentage() > 0.0 ){
if ( ( *it )->betaminusdecay() > 0.0 )
html.append( i18n( "%1 MeV" ).arg( KalziumUtils::localizedValue( ( *it )->betaminusdecay(), 6 ) ) );
html.append( i18n( " %1<sup>-</sup>" ).arg( TQChar( 946 ) ) );
html.append( i18n( "%1 MeV" ).tqarg( KalziumUtils::localizedValue( ( *it )->betaminusdecay(), 6 ) ) );
html.append( i18n( " %1<sup>-</sup>" ).tqarg( TQChar( 946 ) ) );
if ( ( *it )->betaminuspercentage() < 100.0)
html.append( i18n( "(%1%)" ).arg( KalziumUtils::localizedValue( ( *it )->betaminuspercentage(), 6 ) ));
html.append( i18n( "(%1%)" ).tqarg( KalziumUtils::localizedValue( ( *it )->betaminuspercentage(), 6 ) ));
if ( ( *it )->betapluspercentage() > 0.0 || ( *it )->ecpercentage() > 0.0 )
html.append( i18n( ", " ) );
}
if ( ( *it )->betapluspercentage() > 0.0 ){
if ( ( *it )->betaplusdecay() > 0.0 )
html.append( i18n( "%1 MeV" ).arg( KalziumUtils::localizedValue( ( *it )->betaplusdecay(), 6 ) ) );
html.append( i18n( " %1<sup>+</sup>" ).arg(TQChar( 946 ) ) );
html.append( i18n( "%1 MeV" ).tqarg( KalziumUtils::localizedValue( ( *it )->betaplusdecay(), 6 ) ) );
html.append( i18n( " %1<sup>+</sup>" ).tqarg(TQChar( 946 ) ) );
if ( ( *it )->betapluspercentage() == ( *it )->ecpercentage() ) {
if ( ( *it )->ecdecay() > 0.0 ) {
html.append( i18n( "%1 MeV" ).arg( KalziumUtils::localizedValue( ( *it )->ecdecay(), 6 ) ) );
html.append( i18n( "%1 MeV" ).tqarg( KalziumUtils::localizedValue( ( *it )->ecdecay(), 6 ) ) );
}
html.append( i18n( "Acronym of Electron Capture"," EC" ) );
}
if ( ( *it )->betapluspercentage() < 100.0)
html.append( i18n( "(%1%)" ).arg( KalziumUtils::localizedValue( ( *it )->betapluspercentage(), 6 ) ) );
html.append( i18n( "(%1%)" ).tqarg( KalziumUtils::localizedValue( ( *it )->betapluspercentage(), 6 ) ) );
html += " ";
}
if ( ( *it )->ecpercentage() > 0.0 && ( *it )->ecpercentage()!=( *it )->betapluspercentage()){
if ( ( *it )->ecdecay() > 0.0 )
html.append( i18n( "%1 MeV" ).arg( KalziumUtils::localizedValue( ( *it )->ecdecay(), 6 ) ) );
html.append( i18n( "%1 MeV" ).tqarg( KalziumUtils::localizedValue( ( *it )->ecdecay(), 6 ) ) );
html.append( i18n( "Acronym of Electron Capture"," EC" ) );
if ( ( *it )->ecpercentage() < 100.0 )
html.append( i18n( "(%1%)" ).arg( KalziumUtils::localizedValue( ( *it )->ecpercentage(), 6 ) ) );
html.append( i18n( "(%1%)" ).tqarg( KalziumUtils::localizedValue( ( *it )->ecpercentage(), 6 ) ) );
}
html.append( "</td><td>" );
html.append( ( *it )->spin() );
html.append( "</td><td>" );
if ( !( *it )->magmoment().isEmpty() ) {
TQString v = KGlobal::locale()->formatNumber( ( *it )->magmoment(), false, 6 );
html.append( i18n( "%1 %2<sub>n</sub>" ).arg( v ).arg( TQChar( 956 ) ) );
html.append( i18n( "%1 %2<sub>n</sub>" ).tqarg( v ).tqarg( TQChar( 956 ) ) );
}
html.append( "</td></tr>" );
@ -379,7 +379,7 @@ void DetailedInfoDlg::reloadContent()
const TQString element_symbol = m_element->symbol();
// updating caption
setCaption( i18n( "For example Carbon (6)" , "%1 (%2)" ).arg( element_name ).arg( m_elementNumber ) );
setCaption( i18n( "For example Carbon (6)" , "%1 (%2)" ).tqarg( element_name ).tqarg( m_elementNumber ) );
// updating overview tab
dTab->setElement( m_element );
@ -389,21 +389,21 @@ void DetailedInfoDlg::reloadContent()
if ( TQFile::exists( picpath ) )
{
TQImage img( picpath, "JPEG" );
img = img.smoothScale ( 400, 400, TQImage::ScaleMin );
img = img.smoothScale ( 400, 400, TQ_ScaleMin );
TQPixmap pic;
pic.convertFromImage( img );
piclabel->setPixmap( pic );
}
else
piclabel->setText( i18n( "No picture of %1 found." ).arg( element_name ) );
piclabel->setText( i18n( "No picture of %1 found." ).tqarg( element_name ) );
// updating atomic model tab
wOrbits->setElementNumber( m_elementNumber );
TQWhatsThis::add( wOrbits,
i18n( "Here you can see the atomic hull of %1. %2 has the configuration %3." )
.arg( m_element->elname() )
.arg( m_element->elname() )
.arg( m_element->parsedOrbits() ) );
.tqarg( m_element->elname() )
.tqarg( m_element->elname() )
.tqarg( m_element->parsedOrbits() ) );
// updating html tabs
fillHTMLTab( m_htmlpages["chemical"], getHtml( CHEMICAL ) );
@ -422,7 +422,7 @@ void DetailedInfoDlg::reloadContent()
}
else
{
m_spectrumLabel->setText( i18n( "No spectrum of %1 found." ).arg( element_name ) );
m_spectrumLabel->setText( i18n( "No spectrum of %1 found." ).tqarg( element_name ) );
m_spectrumStack->raiseWidget( m_spectrumLabel );
}
}

@ -39,9 +39,10 @@ class KHTMLPart;
class DetailedInfoDlg : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
DetailedInfoDlg( Element *el , TQWidget *parent=0, const char *name=0);
DetailedInfoDlg( Element *el , TQWidget *tqparent=0, const char *name=0);
void setElement(Element *el);

@ -68,8 +68,8 @@ TQString Element::parsedOrbits( bool canBeEmpty )
TQString orbits = m_orbits;
TQRegExp rxs("([a-z])([0-9]+)");
TQRegExp rxb("([a-z]{2}) ",false);
orbits.replace(rxs,"\\1<sup>\\2</sup>"); //superscript around electron number
orbits.replace(rxb,"<b>\\1</b> "); //bold around element symbols
orbits.tqreplace(rxs,"\\1<sup>\\2</sup>"); //superscript around electron number
orbits.tqreplace(rxb,"<b>\\1</b> "); //bold around element symbols
return orbits;
}
@ -106,7 +106,7 @@ const TQString Element::adjustRadius( RADIUSTYPE rtype )
if ( val <= 0 )
v = i18n( "Value unknown" );
else
v = i18n( "%1 is a length, eg: 12.3 pm", "%1 pm" ).arg( KalziumUtils::localizedValue( val, 6 ) );
v = i18n( "%1 is a length, eg: 12.3 pm", "%1 pm" ).tqarg( KalziumUtils::localizedValue( val, 6 ) );
return v;
}