TQt4 port knutclient

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knutclient@1238881 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent aea4882f3b
commit 968af1d235

@ -26,20 +26,20 @@
#include <stdio.h>
#include <math.h>
#include <qpainter.h>
#include <qframe.h>
#include <qfontmetrics.h>
#include <qfont.h>
#include <qbitmap.h>
#include <qpaintdevice.h>
#include <qcolor.h>
#include <tqpainter.h>
#include <tqframe.h>
#include <tqfontmetrics.h>
#include <tqfont.h>
#include <tqbitmap.h>
#include <tqpaintdevice.h>
#include <tqcolor.h>
#include <kapp.h>
KNutAnalog::KNutAnalog( QWidget *parent, const char *name, int bottomLimit, int topLimit, int typeOfView, int countOfParts, int countOfSubParts, QColor pointerColor, QColor scaleColor, QColor textColor, QFont *analogFonts, int qualityOfPointer, bool makeBG )
: QFrame( parent, name ), m_bottomLimit(bottomLimit), m_topLimit(topLimit), m_typeOfView(typeOfView), m_countOfParts(countOfParts), m_countOfSubParts(countOfSubParts), m_pointerColor(pointerColor), m_scaleColor(scaleColor) ,m_textColor(textColor) {
KNutAnalog::KNutAnalog( TQWidget *tqparent, const char *name, int bottomLimit, int topLimit, int typeOfView, int countOfParts, int countOfSubParts, TQColor pointerColor, TQColor scaleColor, TQColor textColor, TQFont *analogFonts, int qualityOfPointer, bool makeBG )
: TQFrame( tqparent, name ), m_bottomLimit(bottomLimit), m_topLimit(topLimit), m_typeOfView(typeOfView), m_countOfParts(countOfParts), m_countOfSubParts(countOfSubParts), m_pointerColor(pointerColor), m_scaleColor(scaleColor) ,m_textColor(textColor) {
if ( qualityOfPointer==0) {
@ -112,18 +112,18 @@ KNutAnalog::KNutAnalog( QWidget *parent, const char *name, int bottomLimit, int
m_countOfColorParts = 0;
setMinimumSize( AnalogWidth, AnalogWidth );
setMaximumSize( AnalogWidth, AnalogWidth );
setFrameStyle( QFrame::Box | QFrame::Raised );
setFrameStyle( TQFrame::Box | TQFrame::Raised );
setLineWidth( 2 );
m_backgroudLayerBig = new QPixmap( (AnalogWidth-8) * 3,(AnalogWidth-8)*3 );
m_backgroudLayerBig = new TQPixmap( (AnalogWidth-8) * 3,(AnalogWidth-8)*3 );
m_scaleLayerBig = new QPixmap ( (AnalogWidth-8)*3, (AnalogWidth-8)*3 ); //
m_scaleLayerSmall = new QPixmap ( (AnalogWidth-8), (AnalogWidth-8)); //
m_scaleLayerBig = new TQPixmap ( (AnalogWidth-8)*3, (AnalogWidth-8)*3 ); //
m_scaleLayerSmall = new TQPixmap ( (AnalogWidth-8), (AnalogWidth-8)); //
m_wholeLayer = new QPixmap ( AnalogWidth-8, AnalogWidth-8 ); //
m_wholeLayer = new TQPixmap ( AnalogWidth-8, AnalogWidth-8 ); //
m_pointerLayerBig = new QPixmap ( (AnalogWidth-8)*3, (AnalogWidth-8)*3 ); //
m_pointerLayerSmall = new QPixmap ( (AnalogWidth-8), (AnalogWidth-8)); //
m_pointerLayerBig = new TQPixmap ( (AnalogWidth-8)*3, (AnalogWidth-8)*3 ); //
m_pointerLayerSmall = new TQPixmap ( (AnalogWidth-8), (AnalogWidth-8)); //
setDefaultArcColor(false); // sets standard registers // nastavime standartni registry
@ -153,42 +153,42 @@ void KNutAnalog::makeBackground (bool run) {
paintBackGround();
m_showBackGround = true;
if (run) {
repaint();
tqrepaint();
}
}
void KNutAnalog::setText (QString inscription, QString text_up, bool run) {
void KNutAnalog::setText (TQString inscription, TQString text_up, bool run) {
m_inscription=inscription;
AnMJ=text_up;
if (run) {
paintBackGround();
m_showBackGround = true;
repaint();
tqrepaint();
}
}
void KNutAnalog::setDefaultArcColor(bool run) {
m_arcColors[0] = Qt::white;
m_arcColors[1] = Qt::green;
m_arcColors[2] = Qt::yellow;
m_arcColors[3] = Qt::red;
m_arcColors[4] = Qt::blue;
m_arcColors[5] = Qt::cyan;
m_arcColors[6] = Qt::magenta;
m_arcColors[7] = Qt::gray;
m_arcColors[8] = Qt::black;
m_arcColors[0] = TQt::white;
m_arcColors[1] = TQt::green;
m_arcColors[2] = TQt::yellow;
m_arcColors[3] = TQt::red;
m_arcColors[4] = TQt::blue;
m_arcColors[5] = TQt::cyan;
m_arcColors[6] = TQt::magenta;
m_arcColors[7] = TQt::gray;
m_arcColors[8] = TQt::black;
if (run) {
paintBackGround();
m_showBackGround=true;
repaint();
tqrepaint();
}
}
void KNutAnalog::setArcColor(int reg, QColor color ) {
void KNutAnalog::setArcColor(int reg, TQColor color ) {
if ((reg > -1) && (reg < 9)) m_arcColors[reg] = color;
}
@ -204,7 +204,7 @@ void KNutAnalog::addArc (double startOfCircle, double endOfCircle, int regColor,
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
@ -215,7 +215,7 @@ void KNutAnalog::delArc (bool run) {
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
@ -230,7 +230,7 @@ void KNutAnalog::setRange (int Astart, int Aend , bool run) {
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
@ -242,34 +242,34 @@ void KNutAnalog::setMember (int Count, bool run) {
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
void KNutAnalog::setPointerColor (QColor pointerColor, bool run ) {
void KNutAnalog::setPointerColor (TQColor pointerColor, bool run ) {
m_pointerColor = pointerColor;
paintPointer();
m_showPointer = true;
if (run) {
repaint ();
tqrepaint ();
}
}
void KNutAnalog::repaintPointer ( bool run ) {
void KNutAnalog::tqrepaintPointer ( bool run ) {
paintPointer();
m_showPointer = true;
if (run) {
repaint ();
tqrepaint ();
}
}
void KNutAnalog::setFontColor (QColor fontColor, bool run ) {
void KNutAnalog::setFontColor (TQColor fontColor, bool run ) {
m_textColor = fontColor;
// paintBackGround();
@ -277,18 +277,18 @@ void KNutAnalog::setFontColor (QColor fontColor, bool run ) {
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
void KNutAnalog::setScaleColor (QColor scaleColor, bool run) {
void KNutAnalog::setScaleColor (TQColor scaleColor, bool run) {
m_scaleColor = scaleColor;
if (run) {
paintBackGround();
m_showBackGround = true;
repaint ();
tqrepaint ();
}
}
@ -307,7 +307,7 @@ void KNutAnalog::setDigitalProcesing (int qualityOfPointer, bool run ) {
}
paintPointer();
m_showPointer = true; // pri jakemkoliv prekresleni prekreslime rucicku
if (run) repaint ();
if (run) tqrepaint ();
}
@ -320,7 +320,7 @@ void KNutAnalog::setPointer (double pointerValue, bool run ) {
if (run) {
// paintPointer();
m_showPointer = true; // pri jakemkoliv prekresleni prekreslime rucicku
repaint ();
tqrepaint ();
}
}
}
@ -329,51 +329,51 @@ void KNutAnalog::setPointer (double pointerValue, bool run ) {
//************** PUBLIC SLOTS **********************************
void KNutAnalog::slotSetScaleFont(QFont newScaleFont){
void KNutAnalog::slotSetScaleFont(TQFont newScaleFont){
m_scaleFont = newScaleFont;
paintBackGround();
m_showBackGround=true;
repaint();
tqrepaint();
}
void KNutAnalog::slotSetTextFont(QFont newTextFont){
void KNutAnalog::slotSetTextFont(TQFont newTextFont){
m_textFont = newTextFont;
paintBackGround();
paintPointer(); // repaint values if pointer
paintPointer(); // tqrepaint values if pointer
m_showBackGround=true;
m_showPointer=true;
repaint();
tqrepaint();
}
void KNutAnalog::slotSetAllFont(QFont newAllFont){
void KNutAnalog::slotSetAllFont(TQFont newAllFont){
m_scaleFont = newAllFont;
m_textFont = newAllFont;
paintBackGround();
paintPointer(); // repaint values if pointer
paintPointer(); // tqrepaint values if pointer
m_showBackGround=true;
m_showPointer=true;
repaint();
tqrepaint();
}
void KNutAnalog::repaintAll (void) {
void KNutAnalog::tqrepaintAll (void) {
paintBackGround();
m_showBackGround = true;
m_showPointer = true;
repaint ();
tqrepaint ();
}
//************** protected ****************************
void KNutAnalog::resizeEvent( QResizeEvent * ) {
void KNutAnalog::resizeEvent( TQResizeEvent * ) {
}
void KNutAnalog::paintEvent( QPaintEvent *e ) {
void KNutAnalog::paintEvent( TQPaintEvent *e ) {
if (isVisible()) {
QFrame::paintEvent(e);
TQFrame::paintEvent(e);
if ((m_showBackGround) || (m_showPointer)) { // novou kompletni vrstvu sestavime jen pokud doslo ke zmene
bitBlt( m_wholeLayer, 0, 0, m_scaleLayerSmall, 0, 0, m_widthOfBackGround, m_widthOfBackGround, CopyROP); //nakopirujeme vrstvu
bitBlt( m_wholeLayer, 0, 0, m_pointerLayerSmall, 0, 0, m_widthOfBackGround, m_widthOfBackGround, AndROP ); //nakopirujeme rucicku
@ -388,8 +388,8 @@ void KNutAnalog::paintEvent( QPaintEvent *e ) {
//***************private ************************
void KNutAnalog::paintBackGround ( void ) {
QPainter paint;
QImage myImage; //big image
TQPainter paint;
TQImage myImage; //big image
//qDebug ("KNutAnalog::paintBackGround");
@ -427,9 +427,9 @@ void KNutAnalog::paintPointer ( void ) {
void KNutAnalog::paintPointerSlowly ( double position, int centerX , int centerY, int widthOfCircle) {
QPainter paint;
TQPainter paint;
QImage myImage; //big image
TQImage myImage; //big image
double angle;
int lengthOfPointer = widthOfCircle / 2 - 12;
@ -440,13 +440,13 @@ void KNutAnalog::paintPointerSlowly ( double position, int centerX , int centerY
// painting of pointer
angle = ((m_angleOfViewer/(m_topLimit-m_bottomLimit))*(position-m_bottomLimit))*((-1)*m_direction)+m_startAngle;
m_pointerLayerBig->fill( Qt::white ); //color if beckground
m_pointerLayerBig->fill( TQt::white ); //color if beckground
paint.begin( m_pointerLayerBig ); // paints of pointer
paint.setBackgroundMode(Qt::TransparentMode);
paint.setBrush( m_pointerColor ); // sets color
paint.setPen ( m_pointerColor );
QPointArray pts;
TQPointArray pts;
// k posuvu a k otoceni pouziva funkce paintu
// for rotate and translate uses functions of paint
paint.translate (centerX, centerY);
@ -471,13 +471,13 @@ void KNutAnalog::paintPointerSlowly ( double position, int centerX , int centerY
void KNutAnalog::paintPointerFastly (double position) {
QPainter paint;
TQPainter paint;
double uhel;
int delka = m_widthOfScale / 2 - 4;
//m_pointerMutex.lock();
m_pointerLayerSmall->fill( Qt::white ); //background color
m_pointerLayerSmall->fill( TQt::white ); //background color
paint.begin( m_pointerLayerSmall ); // kreslime na plochu rucicky
paint.setBackgroundMode(Qt::TransparentMode);
paintValueOfPointer ( &paint, m_valueOfPointer);
@ -492,7 +492,7 @@ void KNutAnalog::paintPointerFastly (double position) {
paint.setBrush( m_pointerColor ); // nastavime barvu
paint.setPen ( m_pointerColor );
QPointArray pts;
TQPointArray pts;
// for translate a rotate uses functions of paint // k posuvu a k otoceni pouziva funkce paintu
paint.translate (m_centerX, m_centerY);
paint.rotate(-uhel);
@ -505,7 +505,7 @@ void KNutAnalog::paintPointerFastly (double position) {
void KNutAnalog::paintPartOfCircle ( QPainter *paint, int centerX , int centerY, int widthOfCircle ) {
void KNutAnalog::paintPartOfCircle ( TQPainter *paint, int centerX , int centerY, int widthOfCircle ) {
double Astart, Aend;
// pocitani uhlu
@ -540,7 +540,7 @@ void KNutAnalog::paintPartOfCircle ( QPainter *paint, int centerX , int centerY,
void KNutAnalog::paintScale ( QPainter *paint , int centerX , int centerY, int widthOfCircle) {
void KNutAnalog::paintScale ( TQPainter *paint , int centerX , int centerY, int widthOfCircle) {
int bottomMax = widthOfCircle/2 - 29;
int bottom = widthOfCircle/2 -17 ;
@ -571,28 +571,28 @@ void KNutAnalog::paintScale ( QPainter *paint , int centerX , int centerY, int w
void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const QRgb colorOfBG, speedOfAAlias speed, int typeOfView) {
void KNutAnalog::makeAntialiasing (TQImage* bigImage, TQPixmap* smallPixmap, const TQRgb colorOfBG, speedOfAAlias speed, int typeOfView) {
ulong imageRed, imageGreen, imageBlue;
QRgb imageRgb;
QImage* smallImage;
TQRgb imageRgb;
TQImage* smallImage;
bool computeAverage;
ulong sumOfRed, sumOfGreen, sumOfBlue;
if (speed == slow) {
sumOfRed = (qRed ( colorOfBG ))*9;
sumOfGreen = (qGreen ( colorOfBG ))*9;
sumOfBlue = (qBlue ( colorOfBG ))*9;
sumOfRed = (tqRed ( colorOfBG ))*9;
sumOfGreen = (tqGreen ( colorOfBG ))*9;
sumOfBlue = (tqBlue ( colorOfBG ))*9;
}
else {
sumOfRed = (qRed ( colorOfBG ))*16;
sumOfGreen = (qGreen ( colorOfBG ))*16;
sumOfBlue = (qBlue ( colorOfBG ))*16;
sumOfRed = (tqRed ( colorOfBG ))*16;
sumOfGreen = (tqGreen ( colorOfBG ))*16;
sumOfBlue = (tqBlue ( colorOfBG ))*16;
}
int smallImageWidth=bigImage->width()/3;
int smallImageHeight=bigImage->height()/3;
smallImage = new QImage(smallImageWidth,smallImageHeight, bigImage->depth());
smallImage = new TQImage(smallImageWidth,smallImageHeight, bigImage->depth());
// imageRgb = bigImage->pixel(1,1);
@ -630,9 +630,9 @@ void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const
for (int xi = 0 ; xi < 3; xi ++) {
for (int yi = 0 ; yi < 3; yi ++) {
imageRgb = bigImage->pixel(x*3+xi,y*3+yi);
imageRed += qRed ( imageRgb );
imageGreen += qGreen ( imageRgb );
imageBlue += qBlue ( imageRgb );
imageRed += tqRed ( imageRgb );
imageGreen += tqGreen ( imageRgb );
imageBlue += tqBlue ( imageRgb );
}
}
if (((imageRed == sumOfRed) && (imageGreen == sumOfGreen) && (imageBlue == sumOfBlue))) {
@ -642,7 +642,7 @@ void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const
imageRed = imageRed / 9;
imageGreen = imageGreen/9;
imageBlue = imageBlue/9;
smallImage->setPixel (x,y,qRgb(imageRed,imageGreen,imageBlue));
smallImage->setPixel (x,y,tqRgb(imageRed,imageGreen,imageBlue));
}
}
else {
@ -656,22 +656,22 @@ void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const
for (int yi = 0 ; yi < 3; yi ++) {
if ((xi == 1) && (yi == 1)) { // center of 3x3 area
imageRgb = bigImage->pixel(x*3+xi,y*3+yi);
imageRed += qRed ( imageRgb )*4;
imageGreen += qGreen ( imageRgb )*4;
imageBlue += qBlue ( imageRgb )*4;
imageRed += tqRed ( imageRgb )*4;
imageGreen += tqGreen ( imageRgb )*4;
imageBlue += tqBlue ( imageRgb )*4;
}
else {
if ((xi == 1) || (yi == 1)) {
imageRgb = bigImage->pixel(x*3+xi,y*3+yi);
imageRed += qRed ( imageRgb )*2;
imageGreen += qGreen ( imageRgb )*2;
imageBlue += qBlue ( imageRgb )*2;
imageRed += tqRed ( imageRgb )*2;
imageGreen += tqGreen ( imageRgb )*2;
imageBlue += tqBlue ( imageRgb )*2;
}
else {
imageRgb = bigImage->pixel(x*3+xi,y*3+yi);
imageRed += qRed ( imageRgb );
imageGreen += qGreen ( imageRgb );
imageBlue += qBlue ( imageRgb );
imageRed += tqRed ( imageRgb );
imageGreen += tqGreen ( imageRgb );
imageBlue += tqBlue ( imageRgb );
}
}
}
@ -683,7 +683,7 @@ void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const
imageRed = imageRed >> 4;
imageGreen = imageGreen >> 4;
imageBlue = imageBlue >> 4;
smallImage->setPixel (x,y,qRgb(imageRed,imageGreen,imageBlue));
smallImage->setPixel (x,y,tqRgb(imageRed,imageGreen,imageBlue));
}
}
else {
@ -697,23 +697,23 @@ void KNutAnalog::makeAntialiasing (QImage* bigImage, QPixmap* smallPixmap, const
}
void KNutAnalog::makeMotionBlur (QImage* image, const QRgb colorOfBG, int typeOfView) {
void KNutAnalog::makeMotionBlur (TQImage* image, const TQRgb colorOfBG, int typeOfView) {
ulong imageRed, imageGreen, imageBlue;
QRgb imageRgb;
QImage *layerImageBlur;
TQRgb imageRgb;
TQImage *layerImageBlur;
bool computeAverage;
int startHeight, stopHeight;
ulong sumOfRed, sumOfGreen, sumOfBlue;
sumOfRed = (qRed ( colorOfBG ))*9;
sumOfGreen = (qGreen ( colorOfBG ))*9;
sumOfBlue = (qBlue ( colorOfBG ))*9;
sumOfRed = (tqRed ( colorOfBG ))*9;
sumOfGreen = (tqGreen ( colorOfBG ))*9;
sumOfBlue = (tqBlue ( colorOfBG ))*9;
int imageWidth=image->width();
int imageHeight=image->height();
layerImageBlur = new QImage(*image);
layerImageBlur = new TQImage(*image);
layerImageBlur->detach(); //costructor makes swallow copy, have to use detach
@ -770,9 +770,9 @@ void KNutAnalog::makeMotionBlur (QImage* image, const QRgb colorOfBG, int typeOf
for (int xi = -1 ; xi < 2; xi ++) {
for (int yi = -1 ; yi < 2; yi ++) {
imageRgb = layerImageBlur->pixel(x+xi,y+yi);
imageRed += qRed ( imageRgb );
imageGreen += qGreen ( imageRgb );
imageBlue += qBlue ( imageRgb );
imageRed += tqRed ( imageRgb );
imageGreen += tqGreen ( imageRgb );
imageBlue += tqBlue ( imageRgb );
}
}
@ -780,7 +780,7 @@ void KNutAnalog::makeMotionBlur (QImage* image, const QRgb colorOfBG, int typeOf
imageRed = (int)(imageRed / 9);
imageGreen = (int)(imageGreen/9);
imageBlue = (int)(imageBlue/9);
image->setPixel (x,y,qRgb(imageRed,imageGreen,imageBlue));
image->setPixel (x,y,tqRgb(imageRed,imageGreen,imageBlue));
}
}
}
@ -793,7 +793,7 @@ void KNutAnalog::makeMotionBlur (QImage* image, const QRgb colorOfBG, int typeOf
void KNutAnalog::paintScaleNumbers ( QPainter *paint ) {
void KNutAnalog::paintScaleNumbers ( TQPainter *paint ) {
//paintig of scaleNumbers
int poz_x, poz_y, r_vyska, r_sirka;
@ -803,11 +803,11 @@ void KNutAnalog::paintScaleNumbers ( QPainter *paint ) {
int smer_st = -m_direction;
paint->save(); // ulozime
QString cislo;
TQString cislo;
paint->setPen(m_textColor);
paint->setFont(m_scaleFont);
QFontMetrics fm = paint->fontMetrics();
TQFontMetrics fm = paint->fontMetrics();
r_vyska = ((fm.ascent()) / 2);
posun = ((double)(m_topLimit-m_bottomLimit))/m_countOfParts;
for (int i=0; i<=(m_countOfParts);i++) {
@ -823,13 +823,13 @@ void KNutAnalog::paintScaleNumbers ( QPainter *paint ) {
}
void KNutAnalog::paintText ( QPainter *paint ) {
QString nadpis1;
QString nadpis2;
void KNutAnalog::paintText ( TQPainter *paint ) {
TQString nadpis1;
TQString nadpis2;
int index;
if (m_inscription.length() >1) {
if ((index = m_inscription.find(" ")) != -1) {
if ((index = m_inscription.tqfind(" ")) != -1) {
// mezera nalezena space found
nadpis1 = m_inscription.left(index);
nadpis2 = m_inscription.mid(index+1,(uint)(m_inscription.length() - index - 1));
@ -838,7 +838,7 @@ void KNutAnalog::paintText ( QPainter *paint ) {
paint->setPen(m_textColor);
paint->setFont(m_textFont);
QFontMetrics fm = paint->fontMetrics();
TQFontMetrics fm = paint->fontMetrics();
int r_vyska = fm.height()/ 2;
switch (m_typeOfView) {
// kruznice - kreslime dve radky nad sebou cemtrovane
@ -871,9 +871,9 @@ void KNutAnalog::paintText ( QPainter *paint ) {
void KNutAnalog::paintValueOfPointer ( QPainter *p, double value) {
void KNutAnalog::paintValueOfPointer ( TQPainter *p, double value) {
QString cislo;
TQString cislo;
cislo.sprintf( "%5.1f",value);
cislo=cislo.stripWhiteSpace();
@ -886,7 +886,7 @@ void KNutAnalog::paintValueOfPointer ( QPainter *p, double value) {
p->setPen(m_textColor);
p->setFont(m_textFont);
QFontMetrics fm = p->fontMetrics();
TQFontMetrics fm = p->fontMetrics();
int r_vyska = fm.height()/ 2;

@ -20,15 +20,15 @@
#ifndef KNUTANALOG_H
#define KNUTANALOG_H
#include <qframe.h>
#include <tqframe.h>
#include <qpixmap.h> // po odladeni smazat
#include <qimage.h>
#include <qmutex.h>
#include <tqpixmap.h> // po odladeni smazat
#include <tqimage.h>
#include <tqmutex.h>
class QPainter;
class QFont;
class TQPainter;
class TQFont;
enum speedOfAAlias { none,fast,slow};
@ -41,8 +41,9 @@ enum speedOfAAlias { none,fast,slow};
* @version 0.1
*/
class KNutAnalog : public QFrame {
class KNutAnalog : public TQFrame {
Q_OBJECT
TQ_OBJECT
public:
@ -59,14 +60,14 @@ public:
*
* When you need paint or repainr panel you have to call functiin reapaint
* other functions calls this function theirself, when run = true
* Pokud je potreba vykreslit nebo prekreslit panel je nutno zavolat funkci repaint,
* Pokud je potreba vykreslit nebo prekreslit panel je nutno zavolat funkci tqrepaint,
* ostatni funkce ji zavolaji sami pokud je run = TRUE.
*
* @param bottomLimit Is bottom value of scale..
* @param topLimit is end value of scale.
* @param typeOfView determine type view of scale 1- circle 2- right part of circle, 3 - top part of circle
* @param countOfParts determine count of big parts (parents parts) of scale.
* @param countOfSubParts determine count small parts (children parts) id scale, evere big part include e few small part.
* @param countOfParts determine count of big parts (tqparents parts) of scale.
* @param countOfSubParts determine count small parts (tqchildren parts) id scale, evere big part include e few small part.
* @param pointerColor determine color of pointer.
* @param scaleColor determine color of scale.
* @param textColor determine color of text.
@ -74,7 +75,7 @@ public:
* @param qualityOfPainter determine quality painting of pointer- 0 nothing. 1 fast antialiasing, 2 slow antialiasing, 3 blur motion + fast antialiasing, 4 blur motion + slow antialiasing
* @since 0.3
**/
KNutAnalog(QWidget *parent = 0, const char *name = 0, int Astart = 0, int topLimit = 100, int typeOfView = 1, int countOfParts = 5, int countOfSubParts = 0, QColor pointerColor = Qt::black, QColor m_scaleColor = Qt::black, QColor textColor = Qt::black, QFont *analogFonts = 0, int qualityOfPointer = 4, bool makeBG = false );
KNutAnalog(TQWidget *tqparent = 0, const char *name = 0, int Astart = 0, int topLimit = 100, int typeOfView = 1, int countOfParts = 5, int countOfSubParts = 0, TQColor pointerColor = TQt::black, TQColor m_scaleColor = TQt::black, TQColor textColor = TQt::black, TQFont *analogFonts = 0, int qualityOfPointer = 4, bool makeBG = false );
/**
* Destruktor
@ -90,19 +91,19 @@ public:
* @param m_inscription determinuje inscription , bottom text , usually.
* @param m_inscription Udava nadpis, "dolni" text, obvykle co je mereno.
* @param text_up Udava mernou jednotku "horni" text, obvykle merna jednotka.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
**/
void setText (QString m_inscription, QString text_up, bool run=false);
void setText (TQString m_inscription, TQString text_up, bool run=false);
/**
* Makes background of analog panel.
* Vytvori pozadi analogoveho panelu.
*
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.2
@ -114,12 +115,12 @@ public:
* Repaint pointer of analog panel.
* Prekresli rucicku analogoveho panelu.
*
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.2
**/
void repaintPointer ( bool run );
void tqrepaintPointer ( bool run );
@ -128,7 +129,7 @@ public:
* Sets nine basic color for circle in scale
*
* @param run = TRUE provede okamzite prekresleni panelu.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
*
* @since 0.1
**/
@ -144,7 +145,7 @@ public:
*
* @since 0.1
**/
void setArcColor(int reg, QColor color );
void setArcColor(int reg, TQColor color );
@ -157,7 +158,7 @@ public:
* @param startOfCircle Urcuje zazatek mezikruzi.
* @param endOfCircle Urcuje konec mezikruzi.
* @param color Urcuje barvu.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.2
@ -170,7 +171,7 @@ public:
* Clear colors of scale
* Zrusi vybarveni stupnice.
*
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
@ -185,7 +186,7 @@ public:
*
* @param Astart Urcuje pocatecni hodnotu stupnice.
* @param AEND Urcuje koncovou hodnotu stupnice.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.2
@ -198,7 +199,7 @@ public:
*
* @param Count Determine number of parts of pointer..
* @param Count Urcuje pocet casti stupnice.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
@ -211,11 +212,11 @@ public:
*
* @param pointerColor determine color of pointer.
* @param pointerColor Urcuje barvu rucicky.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
* @since 0.2
*/
void setPointerColor (QColor pointerColor, bool run=false);
void setPointerColor (TQColor pointerColor, bool run=false);
/**
* sets color of text;
@ -223,12 +224,12 @@ public:
*
* @param fontColor determine color of font.
* @param fontColor urcuje barvu fontu.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
*/
void setFontColor (QColor fontColor, bool run=false );
void setFontColor (TQColor fontColor, bool run=false );
@ -238,19 +239,19 @@ public:
*
* @param scaleColor determine color if scale.
* @param scaleColor urcuje barvu stupnice.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
*/
void setScaleColor (QColor scaleColor, bool run=false);
void setScaleColor (TQColor scaleColor, bool run=false);
/**
* Sets type of digital processing of pointer. 0 nothing. 1 fast antialiasing, 2 slow antialiasing, 3 blur motion + fast antialiasing, 4 blur motion + slow antialiasing.
*
* @param qualityOfPointer determine quality of pointer's digital procesing
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
@ -264,7 +265,7 @@ public:
* Posune rucicku na hodnotu pointerValue.
*
* @param pointerValue Urcuje hodnotu na jakou bude nastavena rucicka.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param run = TRUE provede okamzite prekresleni panelu.
*
* @since 0.1
@ -292,7 +293,7 @@ public:
*
* @since 0.1
*/
void slotSetScaleFont(QFont newScaleFont);
void slotSetScaleFont(TQFont newScaleFont);
/**
@ -303,7 +304,7 @@ public:
*
* @since 0.1
*/
void slotSetTextFont(QFont newTextFont);
void slotSetTextFont(TQFont newTextFont);
/**
@ -313,23 +314,23 @@ public:
*
* @since 0.1
*/
void slotSetAllFont(QFont newAllFont);
void slotSetAllFont(TQFont newAllFont);
/**
* Repaint layer of backgroud and layer of pointer,
* all panel will be repainted
* all panel will be tqrepainted
* Da povel k prekreseni urovne pozadi a urovne rucicky.
* To znamena, ze bude prekreslen kompletne cely panel.
*
* @since 0.1
*/
void repaintAll (void);
void tqrepaintAll (void);
protected:
virtual void resizeEvent( QResizeEvent * );
virtual void paintEvent( QPaintEvent * );
virtual void resizeEvent( TQResizeEvent * );
virtual void paintEvent( TQPaintEvent * );
private:
@ -360,42 +361,42 @@ public:
/**
* @internal
*/
void paintPartOfCircle ( QPainter *paint, int centerX , int centerY, int widthOfCircle );
void paintPartOfCircle ( TQPainter *paint, int centerX , int centerY, int widthOfCircle );
/**
* @internal
*/
void paintScale ( QPainter *paint , int centerX , int centerY, int widthOfCircle);
void paintScale ( TQPainter *paint , int centerX , int centerY, int widthOfCircle);
/**
* @internal
*/
void makeAntialiasing (QImage* myImage, QPixmap* smallPixmap, const QRgb colorOfBG, speedOfAAlias speed = slow , int typeOfView = 0);
void makeAntialiasing (TQImage* myImage, TQPixmap* smallPixmap, const TQRgb colorOfBG, speedOfAAlias speed = slow , int typeOfView = 0);
/**
* @internal
*/
void makeMotionBlur (QImage* myImage, const QRgb colorOfBG, int typeOfView = 0);
void makeMotionBlur (TQImage* myImage, const TQRgb colorOfBG, int typeOfView = 0);
/**
* @internal
*/
void paintScaleNumbers ( QPainter *paint );
void paintScaleNumbers ( TQPainter *paint );
/**
* @internal
*/
void paintText ( QPainter *paint );
void paintText ( TQPainter *paint );
/**
* @internal
*/
void paintValueOfPointer ( QPainter *p, double value);
void paintValueOfPointer ( TQPainter *p, double value);
@ -410,11 +411,11 @@ public:
int m_typeOfView; // udava typ meraku
int m_countOfParts; // pocet policek na stupnici
int m_countOfSubParts; // pocet dilku v policku na stupnici
QColor m_pointerColor, m_scaleColor, m_textColor; // colors of pointer, text and scale
TQColor m_pointerColor, m_scaleColor, m_textColor; // colors of pointer, text and scale
QColor m_arcColors[9];
QString m_inscription;
QString AnMJ;
TQColor m_arcColors[9];
TQString m_inscription;
TQString AnMJ;
int m_countOfColorParts; // count of color parts on scale
double m_valueOfPointer; // position of pointer;
double m_angleOfViewer, m_startAngle; //pocatecni_uhel;
@ -428,24 +429,24 @@ public:
speedOfAAlias m_speedOfAAlias;
bool m_makeBlurMotion;
QFont m_scaleFont;
QFont m_textFont;
TQFont m_scaleFont;
TQFont m_textFont;
QPixmap *m_wholeLayer;
TQPixmap *m_wholeLayer;
QPixmap *m_backgroudLayerBig;
TQPixmap *m_backgroudLayerBig;
QPixmap *m_scaleLayerBig;
QPixmap *m_scaleLayerSmall;
TQPixmap *m_scaleLayerBig;
TQPixmap *m_scaleLayerSmall;
QPixmap *m_pointerLayerBig;
QPixmap *m_pointerLayerSmall;
TQPixmap *m_pointerLayerBig;
TQPixmap *m_pointerLayerSmall;
extentOfDyeDef m_extentOfDye[5];
QMutex m_pointerMutex;
TQMutex m_pointerMutex;
};

@ -23,8 +23,8 @@
#include "knutrwvar.h"
#include "knutclient.h"
#include <qdatetime.h>
#include <qmutex.h>
#include <tqdatetime.h>
#include <tqmutex.h>
#include <kconfig.h>
#include <ksimpleconfig.h>
@ -47,20 +47,20 @@
extern const char *nameUpsVars1[];
extern const char *nameUpsVars2[];
KNutClient::KNutClient(bool noDock, QObject* parent, const char *name) : QObject(parent, name) {
KNutClient::KNutClient(bool noDock, TQObject* tqparent, const char *name) : TQObject(tqparent, name) {
upsRecords = new KNutUpsData();
analogRecords = new KNutVarData();
m_upsTimer = new QTimer (this);
connect( m_upsTimer, SIGNAL(timeout()), SLOT(slotTimeout()) );
m_upsTimer = new TQTimer (this);
connect( m_upsTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()) );
m_reconnectTimer = new QTimer(this);
connect( m_reconnectTimer, SIGNAL(timeout()), SLOT(slotReconnectTimeout()) );
m_reconnectTimer = new TQTimer(this);
connect( m_reconnectTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotReconnectTimeout()) );
// data for combo
m_listKNutEvent = new QStringList();
m_listKNutEvent = new TQStringList();
// init and load of configuration
initVars();
@ -71,16 +71,16 @@ KNutClient::KNutClient(bool noDock, QObject* parent, const char *name) : QObject
m_myDock = new KNutDock(&m_mainUpsInfo,&settingData,upsRecords);
m_myDock->show();
connect(m_myDock, SIGNAL(endApplication()), this, SLOT(slotExitApplication()));
connect(m_myDock, SIGNAL(activeMainWindow()), this, SLOT(slotActiveMainWindow()));
connect(m_myDock, SIGNAL(minimize()), this, SLOT(closeMainWindow()));
connect(m_myDock, SIGNAL(UPSChanged(QString)), this, SLOT(slotSetNewUPS (QString)));
connect(m_myDock, TQT_SIGNAL(endApplication()), this, TQT_SLOT(slotExitApplication()));
connect(m_myDock, TQT_SIGNAL(activeMainWindow()), this, TQT_SLOT(slotActiveMainWindow()));
connect(m_myDock, TQT_SIGNAL(minimize()), this, TQT_SLOT(closeMainWindow()));
connect(m_myDock, TQT_SIGNAL(UPSChanged(TQString)), this, TQT_SLOT(slotSetNewUPS (TQString)));
connect(m_myDock, SIGNAL(preferences()),this, SLOT(slotPreferenceUps()));
connect(m_myDock, SIGNAL(printUPSVars()),this, SLOT(slotPrintUPSVars()));
connect(m_myDock, SIGNAL(instComms()),this, SLOT(slotInstComms()));
connect(m_myDock, SIGNAL(RWVars()),this, SLOT(slotRWVars()));
connect(m_myDock, SIGNAL(makeRefreshConnection()),this, SLOT(slotRefreshConnection()));
connect(m_myDock, TQT_SIGNAL(preferences()),this, TQT_SLOT(slotPreferenceUps()));
connect(m_myDock, TQT_SIGNAL(printUPSVars()),this, TQT_SLOT(slotPrintUPSVars()));
connect(m_myDock, TQT_SIGNAL(instComms()),this, TQT_SLOT(slotInstComms()));
connect(m_myDock, TQT_SIGNAL(RWVars()),this, TQT_SLOT(slotRWVars()));
connect(m_myDock, TQT_SIGNAL(makeRefreshConnection()),this, TQT_SLOT(slotRefreshConnection()));
}
addEventString(i18n("Ready."));
@ -90,7 +90,7 @@ KNutClient::KNutClient(bool noDock, QObject* parent, const char *name) : QObject
// sets data for selected item
setActiveUpsInfo(m_mainUpsInfo.record.name);
// sets mainUpsInfo.oldState to const value KNutNet::initStatus
// sets mainUpsInfo.oldState to const value KNutNet::inittqStatus
m_mainUpsInfo.oldState=KNutNet::initState;
@ -99,11 +99,11 @@ KNutClient::KNutClient(bool noDock, QObject* parent, const char *name) : QObject
m_mainUpsInfo.upsNet = new KNutNet( m_mainUpsInfo.record.upsAddress, m_mainUpsInfo.record.upsName, m_mainUpsInfo.record.port,5,200);
connect(m_mainUpsInfo.upsNet, SIGNAL(firstConnection(void)),this, SLOT(slotFirstConnection(void)));
connect(m_mainUpsInfo.upsNet, SIGNAL(connectionError(int)),this, SLOT(slotErrorConnection(int)));
connect(m_mainUpsInfo.upsNet, SIGNAL(connectionClosed(void )),this, SLOT(slotConnectionClosed(void)));
connect(m_mainUpsInfo.upsNet, SIGNAL(tryFirstConnection(int )),this, SLOT(slotTryFirstConnection(int)));
connect(m_mainUpsInfo.upsNet, SIGNAL(tryRepeatFirstConnection(int )),this, SLOT(slotTryReepatFirstConnection( int )));
connect(m_mainUpsInfo.upsNet, TQT_SIGNAL(firstConnection(void)),this, TQT_SLOT(slotFirstConnection(void)));
connect(m_mainUpsInfo.upsNet, TQT_SIGNAL(connectionError(int)),this, TQT_SLOT(slotErrorConnection(int)));
connect(m_mainUpsInfo.upsNet, TQT_SIGNAL(connectionClosed(void )),this, TQT_SLOT(slotConnectionClosed(void)));
connect(m_mainUpsInfo.upsNet, TQT_SIGNAL(tryFirstConnection(int )),this, TQT_SLOT(slotTryFirstConnection(int)));
connect(m_mainUpsInfo.upsNet, TQT_SIGNAL(tryRepeatFirstConnection(int )),this, TQT_SLOT(slotTryReepatFirstConnection( int )));
// state of connection to usbd, this isn't state of knutnet
@ -112,7 +112,7 @@ KNutClient::KNutClient(bool noDock, QObject* parent, const char *name) : QObject
// }
// else mainUpsInfo.upsDriverState=knc::notConnected;
// repaints the dock
// tqrepaints the dock
if (m_myDock) m_myDock->clearDockValues();
if (settingData.useMainWindow == KNutVarData::mw_yes || noDock ||
@ -154,8 +154,8 @@ void KNutClient::slotTryFirstConnection (int maxCount) {
//qDebug ("KNutClient::slotTryFirstConnection");
//knutNet begin the first test of connection (connectToHost will be made after emiting signal tryFirstConnection )
// repaints icon
if (m_myDock) m_myDock->repaintDock(true);
// tqrepaints icon
if (m_myDock) m_myDock->tqrepaintDock(true);
if (mainWindow) mainWindow->startConnectPB(maxCount);
}
@ -206,7 +206,7 @@ void KNutClient::slotFirstConnection (void) {
else
m_mainUpsInfo.upsDriverState=knc::error;
if (m_myDock) m_myDock->repaintDock(true);
if (m_myDock) m_myDock->tqrepaintDock(true);
addEventString (KNutVarData::errorToText(m_mainUpsInfo.netError),m_mainUpsInfo.record.name);
// KNutVarData::showError (mainUpsInfo.netError);
if ((m_myMessMan)) m_myMessMan->addMessage(KNutVarData::errorToText(m_mainUpsInfo.netError),knc::errorLevel,true);
@ -247,10 +247,10 @@ void KNutClient::slotFirstConnection (void) {
if (mainWindow) setActiveUpsVars(true);
else setActiveUpsVars(false);
// repaints main window and dock immediately
// tqrepaints main window and dock immediately
if (mainWindow) mainWindow->showUpsData();
// if (myDock) myDock->repaintDock(mainUpsInfo.netError,true); // dock is repainting always
if (m_myDock) m_myDock->repaintDock(true); // dock is repainting always
// if (myDock) myDock->tqrepaintDock(mainUpsInfo.netError,true); // dock is tqrepainting always
if (m_myDock) m_myDock->tqrepaintDock(true); // dock is tqrepainting always
m_panelsAreZeroing=false; // analog panels isn't setting to zero
}
@ -274,14 +274,14 @@ void KNutClient::slotErrorConnection (int error) {
m_mainUpsInfo.upsDriverState=knc::notConnected;
else
m_mainUpsInfo.upsDriverState=knc::error;
if (m_myDock) m_myDock->repaintDock(true);
if (m_myDock) m_myDock->tqrepaintDock(true);
if (m_mainUpsInfo.reconnecting) {
//qDebug ("KNutClient::slotErrorConnection (2)");
m_mainUpsInfo.reconnectCount++;
if (m_mainUpsInfo.reconnectCount > countNextConnDelay) m_mainUpsInfo.reconnectCount = countNextConnDelay;
addEventString(i18n("The connection failed. The next connection will make after %1 sec.").arg(nextConnDelay[m_mainUpsInfo.reconnectCount-1]),m_mainUpsInfo.record.name);
addEventString(i18n("The connection failed. The next connection will make after %1 sec.").tqarg(nextConnDelay[m_mainUpsInfo.reconnectCount-1]),m_mainUpsInfo.record.name);
m_reconnectTimer->start( nextConnDelay[m_mainUpsInfo.reconnectCount-1]*1000, TRUE ); // starts reconnect timer again
}
else {
@ -331,9 +331,9 @@ void KNutClient::initVars (void) {
void KNutClient::loadConfiguration ( void ) {
QString groupName;
TQString groupName;
KNutUpsData::upsRecordDef upsData; // structure includes informations about UPS // struktura obsahuje udaje o UPS
QFont appFont = kapp->font(); // systemovy font pri startu
TQFont appFont = kapp->font(); // systemovy font pri startu
kapp->config()->setGroup ("");
settingData.areYouSure=kapp->config()->readBoolEntry("AreYouSure",FALSE);
@ -389,19 +389,19 @@ void KNutClient::initVars (void) {
for (int i = 0; i < upsCount; i++) {
groupName.sprintf ("UPS %d",i);
kapp->config()->setGroup (groupName);
if ((upsData.name = kapp->config()->readEntry ("Name")) != QChar::null) {
if ((upsData.name = kapp->config()->readEntry ("Name")) != TQChar::null) {
// record exist, we will go next part
//if ActiveUps is empty, we use name of first ups from ups list
if ((m_mainUpsInfo.record.name.isEmpty()) && (!(upsData.name.isEmpty())))
m_mainUpsInfo.record.name = upsData.name;
upsData.upsName = kapp->config()->readEntry ("UpsName","");
if (((upsData.upsAddress = kapp->config()->readEntry ("UpsAddress")) != QChar::null)
|| (( upsData.upsAddress == QChar::null) && (upsData.upsName != QChar::null ))) {
if (((upsData.upsAddress = kapp->config()->readEntry ("UpsAddress")) != TQChar::null)
|| (( upsData.upsAddress == TQChar::null) && (upsData.upsName != TQChar::null ))) {
// only for backwards compatibility with older release then 0.7
if (upsData.upsAddress.isEmpty()) {
int charPos;
if ((charPos=upsData.upsName.find('@')) == -1) {
if ((charPos=upsData.upsName.tqfind('@')) == -1) {
upsData.upsAddress=upsData.upsName;
upsData.upsName="";
}
@ -430,8 +430,8 @@ void KNutClient::initVars (void) {
}
void KNutClient::saveConfiguration ( bool all ) {
QString groupName;
QString codeName;
TQString groupName;
TQString codeName;
KNutUpsData::upsRecordDef upsData; // struktura obsahuje udaje o UPS // structure includes information about UPS
int upsCount = upsRecords->getCount();
@ -450,7 +450,7 @@ void KNutClient::saveConfiguration ( bool all ) {
upsRecords->get(0,upsData);
kapp->config()->writeEntry ("ActiveUps",upsData.name);
}
else kapp->config()->writeEntry ("ActiveUps",(QString)m_mainUpsInfo.record.name); //
else kapp->config()->writeEntry ("ActiveUps",(TQString)m_mainUpsInfo.record.name); //
if (all) {
kapp->config()->writeEntry ("AnalogFontColor",settingData.analogFontColor);
@ -513,13 +513,13 @@ void KNutClient::saveConfiguration ( bool all ) {
}
bool KNutClient::commitData (QSessionManager&) {
bool KNutClient::commitData (TQSessionManager&) {
saveConfiguration(false);
return true;
}
bool KNutClient::saveState (QSessionManager&) {
bool KNutClient::saveState (TQSessionManager&) {
saveConfiguration(false);
return true;
@ -602,7 +602,7 @@ void KNutClient::upsDeactivate (void) {
// this function isn't interuptable function
// upsDeactivateMutex.lock();
QMutexLocker upsDeactivateLocker( &m_upsDeactivateMutex );
TQMutexLocker upsDeactivateLocker( &m_upsDeactivateMutex );
m_mainUpsInfo.upsNet->close(); // close connection
// state of connection to usbd, this isn't state of knutnet
m_mainUpsInfo.upsDriverState=knc::notConnected;
@ -653,7 +653,7 @@ void KNutClient::setActiveXFerVars (bool activate) {
}
}
void KNutClient::setActiveUpsInfo (QString name) {
void KNutClient::setActiveUpsInfo (TQString name) {
//presuneme jmena z databaze ups-ek - je nahrana z config. souboru
KNutUpsData::upsRecordDef* upsRecordPointer;
@ -709,14 +709,14 @@ void KNutClient::getUpsData (void) {
}
void KNutClient::addEventString (const QString text, const QString UPSAddress) {
void KNutClient::addEventString (const TQString text, const TQString UPSAddress) {
if (mainWindow)
mainWindow->addComboStatusItem (text,UPSAddress);
else
{
QString dateTime(QDate::currentDate().toString());
dateTime +=" " + QTime::currentTime().toString();
TQString dateTime(TQDate::tqcurrentDate().toString());
dateTime +=" " + TQTime::currentTime().toString();
if (UPSAddress.isEmpty()) m_listKNutEvent->append(dateTime+" "+text);
else m_listKNutEvent->append(dateTime+" "+UPSAddress+" : "+text);
if (m_listKNutEvent->count() > knc::maxCountKNutEvent) m_listKNutEvent->remove(m_listKNutEvent->begin());
@ -744,8 +744,8 @@ void KNutClient::slotTimeout (void) {
getUpsData();
if (!m_mainUpsInfo.errorUpsData) { // no error
if (mainWindow) {
mainWindow->repaintPanel();
mainWindow->repaintAnalogs();
mainWindow->tqrepaintPanel();
mainWindow->tqrepaintAnalogs();
}
m_panelsAreZeroing=false;
showStatusEvent();
@ -755,7 +755,7 @@ void KNutClient::slotTimeout (void) {
m_panelsAreZeroing=true;
if (m_myDock) m_myDock->clearDockValues();
}
if (m_myDock) m_myDock->repaintDock();
if (m_myDock) m_myDock->tqrepaintDock();
m_upsTimer->start( m_mainUpsInfo.record.delay, TRUE ); // nastartujem znovu
}
@ -791,7 +791,7 @@ void KNutClient::showStatusEvent(void) {
//qDebug ("KNutClient::showStatusEvent");
int myState = m_mainUpsInfo.upsNet->readStatus();
int myState = m_mainUpsInfo.upsNet->readtqStatus();
if (myState != m_mainUpsInfo.oldState) {
if ((myState & KNutNet::OFF) != (m_mainUpsInfo.oldState & KNutNet::OFF)) {
@ -876,7 +876,7 @@ void KNutClient::showStatusEvent(void) {
}
}
void KNutClient::slotSetNewUPS (QString name) {
void KNutClient::slotSetNewUPS (TQString name) {
m_mainUpsInfo.reconnecting =false;
m_reconnectTimer->stop();
@ -925,7 +925,7 @@ void KNutClient::slotSetNewUPS (QString name) {
void KNutClient::slotPreferenceUps (void) {
KNutPrefDlg* prefDlg = new KNutPrefDlg ( upsRecords, analogRecords, &settingData, m_mainUpsInfo.record.name ); // aktivujeme dialog pro preference
connect (prefDlg,SIGNAL(signalChangeConfig(unsigned int)),this,SLOT(slotSetConfig(unsigned int)));
connect (prefDlg,TQT_SIGNAL(signalChangeConfig(unsigned int)),this,TQT_SLOT(slotSetConfig(unsigned int)));
prefDlg->exec();
delete prefDlg;
}
@ -951,7 +951,7 @@ void KNutClient::slotSetConfig (unsigned int changeSetting) {
if (m_mainUpsInfo.record.name == "") {
// the first record was added, because the first UPS is active UPS always
QString name = upsRecords->getName(0);
TQString name = upsRecords->getName(0);
addEventString(i18n("Switched"),name);
m_mainUpsInfo.record.name=name;
m_mainUpsInfo.errorUpsData=false;
@ -978,7 +978,7 @@ void KNutClient::slotSetConfig (unsigned int changeSetting) {
// showUpsData je nutno udelat take proto ze se mohl zmenit vyber meraku
// if (mainWindow) mainWindow->showUpsData();
if (mainWindow) mainWindow->cleanPanels();
// if (myDock) myDock->repaintDock(mainUpsInfo.netError);
// if (myDock) myDock->tqrepaintDock(mainUpsInfo.netError);
if (m_myDock) m_myDock->clearDockValues();
m_mainUpsInfo.upsNet->newUPS(m_mainUpsInfo.record.upsAddress,m_mainUpsInfo.record.upsName, m_mainUpsInfo.record.port);
@ -1065,7 +1065,7 @@ void KNutClient::slotRWVars(void) {
if (!m_mainUpsInfo.errorUpsData) {
if (m_mainUpsInfo.upsNet->readNumberVars (KNutNet::RWVars)) {
KNutRWVar *windowRWVars = new KNutRWVar(&m_mainUpsInfo.name,&m_mainUpsInfo.password,m_mainUpsInfo.record.userName,m_mainUpsInfo.record.password,m_mainUpsInfo.upsNet);
connect (windowRWVars,SIGNAL(signalChangeRWVars(QString)),this,SLOT(slotChangeRWVars(QString)));
connect (windowRWVars,TQT_SIGNAL(signalChangeRWVars(TQString)),this,TQT_SLOT(slotChangeRWVars(TQString)));
if (windowRWVars->upsOk()) windowRWVars->exec();
delete windowRWVars;
}
@ -1096,7 +1096,7 @@ void KNutClient::slotRefreshConnection(void) {
if (m_myDock) {
m_myDock->clearDockValues();
// myDock->initImage();
// myDock->repaint();
// myDock->tqrepaint();
}
if (mainWindow) {
mainWindow->cleanPanels();
@ -1125,7 +1125,7 @@ void KNutClient::slotRefreshConnection(void) {
}
void KNutClient::slotChangeRWVars( QString ) {
void KNutClient::slotChangeRWVars( TQString ) {
// informace ze doslo k uspesne zmene promene
// vzhledem k asynchronimu zpracovani muze upsd vratit tuto hodnotu az za nejakou dobu
// nevim zda bude potreba
@ -1152,19 +1152,19 @@ void KNutClient::exitMainWindow (void) {
void KNutClient::makeMainWindow (void) {
mainWindow = new KNutMainWindow(m_listKNutEvent ,&m_mainUpsInfo, &settingData, upsRecords, analogRecords);
connect(mainWindow, SIGNAL(UPSChanged (QString)), this, SLOT(slotSetNewUPS (QString)));
connect(mainWindow, SIGNAL(preferenceUps()),this, SLOT(slotPreferenceUps()));
connect(mainWindow, SIGNAL(showUPSVars()),this, SLOT(slotPrintUPSVars()));
connect(mainWindow, SIGNAL(makeInstComms()),this, SLOT(slotInstComms()));
connect(mainWindow, SIGNAL(makeRWVars()),this, SLOT(slotRWVars()));
connect(mainWindow, SIGNAL(makeRefreshConnection()),this, SLOT(slotRefreshConnection()));
connect(mainWindow, SIGNAL(saveConf()),this, SLOT(slotSaveConf()));
connect(mainWindow, TQT_SIGNAL(UPSChanged (TQString)), this, TQT_SLOT(slotSetNewUPS (TQString)));
connect(mainWindow, TQT_SIGNAL(preferenceUps()),this, TQT_SLOT(slotPreferenceUps()));
connect(mainWindow, TQT_SIGNAL(showUPSVars()),this, TQT_SLOT(slotPrintUPSVars()));
connect(mainWindow, TQT_SIGNAL(makeInstComms()),this, TQT_SLOT(slotInstComms()));
connect(mainWindow, TQT_SIGNAL(makeRWVars()),this, TQT_SLOT(slotRWVars()));
connect(mainWindow, TQT_SIGNAL(makeRefreshConnection()),this, TQT_SLOT(slotRefreshConnection()));
connect(mainWindow, TQT_SIGNAL(saveConf()),this, TQT_SLOT(slotSaveConf()));
connect(mainWindow, SIGNAL(endApplication()), this, SLOT(slotExitApplication()));
connect(mainWindow, SIGNAL(destroyed()), this, SLOT(exitMainWindow()));
connect(mainWindow, TQT_SIGNAL(endApplication()), this, TQT_SLOT(slotExitApplication()));
connect(mainWindow, TQT_SIGNAL(destroyed()), this, TQT_SLOT(exitMainWindow()));
}
@ -1179,7 +1179,7 @@ void KNutClient::slotActiveMainWindow (void) {
setActiveUpsVars(true);
getUpsData();
makeMainWindow();
if (m_myDock) m_myDock->repaintDock(m_mainUpsInfo.netError);
if (m_myDock) m_myDock->tqrepaintDock(m_mainUpsInfo.netError);
m_upsTimer->start( 1, TRUE ); // nastartujem znovu
// 1 proto aby se zpracovali pripadne udalosti o zruseni spojeni
}
@ -1189,7 +1189,7 @@ void KNutClient::slotActiveMainWindow (void) {
// getValues error=0 a doslo by vypsani data ok.
makeMainWindow();
if (!m_mainUpsInfo.errorUpsData) {
if (m_myDock) m_myDock->repaintDock(m_mainUpsInfo.netError);
if (m_myDock) m_myDock->tqrepaintDock(m_mainUpsInfo.netError);
}
}
}
@ -1206,7 +1206,7 @@ void KNutClient::slotSaveConf (void) {
void KNutClient::closeMainWindow (void) {
if (mainWindow) {
if (m_myDock) m_myDock->repaintDock(m_mainUpsInfo.netError);
if (m_myDock) m_myDock->tqrepaintDock(m_mainUpsInfo.netError);
m_upsTimer->stop();
mainWindow->close();
mainWindow=0;
@ -1220,7 +1220,7 @@ void KNutClient::slotExitApplication(void) {
m_upsTimer->stop();
if (mainWindow) {
// odpojime protoze exitMainWindow by byl vykonan az po zkonceni procedury;
disconnect(mainWindow, SIGNAL(destroyed()), this, SLOT(exitMainWindow()));
disconnect(mainWindow, TQT_SIGNAL(destroyed()), this, TQT_SLOT(exitMainWindow()));
delete mainWindow;
mainWindow = 0;
}

@ -33,20 +33,21 @@
#include <kapplication.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qstringlist.h>
#include <qmutex.h>
#include <tqwidget.h>
#include <tqtimer.h>
#include <tqstringlist.h>
#include <tqmutex.h>
const int countNextConnDelay = 10;
const int nextConnDelay[] = {
5, 5, 20, 30, 60, 60, 120, 300, 600, 900 };
class KNutClient : public QObject, public KSessionManaged {
class KNutClient : public TQObject, public KSessionManaged {
Q_OBJECT
TQ_OBJECT
public:
KNutClient(bool noDock = false, QObject* parent=0,const char* name=0);
KNutClient(bool noDock = false, TQObject* tqparent=0,const char* name=0);
~KNutClient();
private slots:
@ -54,7 +55,7 @@ class KNutClient : public QObject, public KSessionManaged {
void slotReconnectTimeout (void);
void slotSetNewUPS (QString name);
void slotSetNewUPS (TQString name);
void slotPreferenceUps(void);
@ -63,7 +64,7 @@ class KNutClient : public QObject, public KSessionManaged {
void slotPrintUPSVars(void);
void slotInstComms(void);
void slotRWVars(void);
void slotChangeRWVars( QString );
void slotChangeRWVars( TQString );
void slotSaveConf (void);
@ -73,7 +74,7 @@ class KNutClient : public QObject, public KSessionManaged {
/**
*
* Calls function for repainting of icon in dock.
* Calls function for tqrepainting of icon in dock.
* Vola funkci pro prekresleni icony v doku.
*
* @since 0.1
@ -84,7 +85,7 @@ class KNutClient : public QObject, public KSessionManaged {
/**
* This function is called when program repeats other connection;
* Calls function for repainting of icon in dock.
* Calls function for tqrepainting of icon in dock.
* Tata funkce je volana, kdyz program opakuje pokus o pripojeni.
* Vola funkci pro prekresleni icony v doku.
*
@ -95,7 +96,7 @@ class KNutClient : public QObject, public KSessionManaged {
/**
* Nastavi hodnoty po prvem pripojeni na UPS, zavola prekresleni docku a nastartuje timer
* Sets values after the first conection to UPS ,calls to repaint of dock and starts timer
* Sets values after the first conection to UPS ,calls to tqrepaint of dock and starts timer
*
* @since 0.2
**/
@ -133,8 +134,8 @@ class KNutClient : public QObject, public KSessionManaged {
void exitMainWindow (void);
void slotActiveMainWindow (void);
virtual bool commitData (QSessionManager&);
virtual bool saveState (QSessionManager&);
virtual bool commitData (TQSessionManager&);
virtual bool saveState (TQSessionManager&);
private:
@ -165,9 +166,9 @@ class KNutClient : public QObject, public KSessionManaged {
void getUpsData (void);
void setActiveUpsInfo (QString name);
void setActiveUpsInfo (TQString name);
void addEventString (const QString text, const QString UPSAddress = QString::null);
void addEventString (const TQString text, const TQString UPSAddress = TQString());
void showStatusEvent(void);
@ -190,10 +191,10 @@ class KNutClient : public QObject, public KSessionManaged {
KNutUpsData* upsRecords;
KNutVarData* analogRecords;
QTimer* m_upsTimer;
QTimer* m_reconnectTimer;
TQTimer* m_upsTimer;
TQTimer* m_reconnectTimer;
QStringList* m_listKNutEvent;
TQStringList* m_listKNutEvent;
bool m_panelsAreZeroing; // indikuje zda je panel nulovany // use if analog panels is setting to zero
// kod posledni chyby spojeni zjistene v timeoutu
@ -203,8 +204,8 @@ class KNutClient : public QObject, public KSessionManaged {
KNutMessageManager* m_myMessMan;
// mutex for reconnect, only one reconnect at a time
QMutex m_reconnectMutex;
QMutex m_upsDeactivateMutex;
TQMutex m_reconnectMutex;
TQMutex m_upsDeactivateMutex;
};
#endif

@ -25,11 +25,11 @@
#include <kaboutapplication.h>
#include <kmessagebox.h>
#include <qpainter.h>
#include <qtooltip.h>
#include <qpixmap.h>
#include <qbitmap.h>
#include <qstring.h>
#include <tqpainter.h>
#include <tqtooltip.h>
#include <tqpixmap.h>
#include <tqbitmap.h>
#include <tqstring.h>
#include <math.h>
@ -42,7 +42,7 @@
#define ICON_SIZE 22
KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutUpsData* upsRecords){
QString valueName;
TQString valueName;
m_settingData = settingData;
m_upsRecords = upsRecords;
@ -76,13 +76,13 @@ KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingD
m_statusLayer = 0;
m_runtimeLayer = 0;
m_loadLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
m_chargeLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
m_mainLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
m_loadLayer = new TQPixmap(ICON_SIZE,ICON_SIZE);
m_chargeLayer = new TQPixmap(ICON_SIZE,ICON_SIZE);
m_mainLayer = new TQPixmap(ICON_SIZE,ICON_SIZE);
initImage();
changeKIcon(); // this function calls function repaintIcon
changeKIcon(); // this function calls function tqrepaintIcon
}
@ -100,9 +100,9 @@ KNutDock::~KNutDock(){
delete m_menu;
}
void KNutDock::resizeEvent ( QResizeEvent * ){
void KNutDock::resizeEvent ( TQResizeEvent * ){
initImage();
changeKIcon(); // this function calls function repaintIcon
changeKIcon(); // this function calls function tqrepaintIcon
}
void KNutDock::changeUps (void) {
@ -117,7 +117,7 @@ void KNutDock::clearDockValues(void){
initImage(); // paints standart icon
clearValues();
repaintDock(true);
tqrepaintDock(true);
}
@ -133,7 +133,7 @@ void KNutDock::changeKIBColor(void) {
if (!m_settingData->customKIconColor) m_myBGColor = backgroundColor;
else m_myBGColor = m_settingData->kIconBackgroundColor; // uses defined color
repaintDock(true);
tqrepaintDock(true);
}
void KNutDock::changeKIcon (void) {
@ -143,16 +143,16 @@ void KNutDock::changeKIcon (void) {
if (m_mainLayer) {
delete m_mainLayer;
m_mainLayer=new QPixmap(ICON_SIZE,ICON_SIZE);
m_mainLayer=new TQPixmap(ICON_SIZE,ICON_SIZE);
}
if (!m_statusLayer) {
m_statusLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
m_statusLayer = new TQPixmap(ICON_SIZE,ICON_SIZE);
}
if (!m_runtimeLayer) {
m_runtimeLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
m_runtimeLayer = new TQPixmap(ICON_SIZE,ICON_SIZE);
}
paintStatus(m_statusValue);
painttqStatus(m_statusValue);
paintRuntime(m_runtimeValue, m_statusValue);
}
else { // picture Icon
@ -166,7 +166,7 @@ void KNutDock::changeKIcon (void) {
m_statusWarningValue = m_statusValue & (KNutNet::CAL | KNutNet::TRIM | KNutNet::BOOST
| KNutNet::OVER | KNutNet::RB);
repaintDock(true);
tqrepaintDock(true);
}
void KNutDock::initImage(void) {
@ -181,21 +181,21 @@ void KNutDock::setNewUPS(void) {
}
void KNutDock::repaintDock (const bool always) {
QString nutStringVar;
void KNutDock::tqrepaintDock (const bool always) {
TQString nutStringVar;
int myRuntimeValue;
int myUpsLoadValue;
int myStatusValue;
int myStatusBatValue;
int myBatteryChargeValue;
bool repaintNow = false;
// value repaintNow is seted when some ups values are changed
bool tqrepaintNow = false;
// value tqrepaintNow is seted when some ups values are changed
bool okFloat;
QString valueName;
QPainter paint;
TQString valueName;
TQPainter paint;
if (m_activeUpsInfo->upsNet == 0) { repaint(); return;}
if (m_activeUpsInfo->upsNet == 0) { tqrepaint(); return;}
m_dataOkOld=m_dataOk;
@ -206,7 +206,7 @@ void KNutDock::repaintDock (const bool always) {
if (!m_activeUpsInfo->upsNet->existName(m_activeUpsInfo->runtimeVar)) {
nutStringVar = m_activeUpsInfo->upsNet->readStringVar(m_activeUpsInfo->runtimeVar);
//std::cout << "KNutDock::repaintDock RUNTIME " << nutStringVar << std::endl;
//std::cout << "KNutDock::tqrepaintDock RUNTIME " << nutStringVar << std::endl;
if (nutStringVar.isEmpty()) myRuntimeValue=knc::numberVarError;
else {
myRuntimeValue = (int)nutStringVar.toFloat(&okFloat);
@ -215,7 +215,7 @@ void KNutDock::repaintDock (const bool always) {
}
else myRuntimeValue = knc::numberVarError;
myStatusValue = m_activeUpsInfo->upsNet->readStatus();
myStatusValue = m_activeUpsInfo->upsNet->readtqStatus();
switch (m_typeOfIcon) {
@ -223,19 +223,19 @@ void KNutDock::repaintDock (const bool always) {
// *********STATUS****************
if (myStatusValue !=m_statusValue ) {
m_statusValue = myStatusValue;
paintStatus(m_statusValue);
repaintNow = true;
painttqStatus(m_statusValue);
tqrepaintNow = true;
}
// **********RUNTIME***********
myStatusBatValue = myStatusValue & KNutNet::OB; // OB = UPS runs on battery
if ((myRuntimeValue != m_runtimeValue) || (myStatusBatValue != m_statusBatValue)) {
// when runtime is changed or flags OB is changed we must repaint icons
// when runtime is changed or flags OB is changed we must tqrepaint icons
// when OB is changed same items in icon will change color
m_runtimeValue = myRuntimeValue; // runtime is old value of runtime, one is defined like global value of class
m_statusBatValue = myStatusBatValue;
paintRuntime(m_runtimeValue, m_statusValue);
repaintNow = true;
tqrepaintNow = true;
}
break;
@ -245,13 +245,13 @@ void KNutDock::repaintDock (const bool always) {
m_statusValue = myStatusValue;
m_statusWarningValue = myStatusValue & (KNutNet::CAL | KNutNet::TRIM | KNutNet::BOOST
| KNutNet::OVER | KNutNet::RB);
repaintNow = true;
tqrepaintNow = true;
}
// **********RUNTIME***********
if (myRuntimeValue != m_runtimeValue) {
m_runtimeValue = myRuntimeValue;
repaintNow = true;
tqrepaintNow = true;
}
break;
} ///////////////////// end of models
@ -274,7 +274,7 @@ void KNutDock::repaintDock (const bool always) {
if (myUpsLoadValue != m_upsLoadValue) {
m_upsLoadValue = myUpsLoadValue;
if (m_typeOfIcon == generalKI) paintLoad(m_upsLoadValue);
repaintNow = true;
tqrepaintNow = true;
}
// *********BATTERY CHARGE****************
@ -293,11 +293,11 @@ void KNutDock::repaintDock (const bool always) {
if (myBatteryChargeValue != m_batteryChargeValue) {
m_batteryChargeValue = myBatteryChargeValue;
if (m_typeOfIcon == generalKI)paintCharge(m_batteryChargeValue);
repaintNow = true;
tqrepaintNow = true;
}
// ************* End of values********************
if (repaintNow || always || (m_dataOk != m_dataOkOld)) {
if (tqrepaintNow || always || (m_dataOk != m_dataOkOld)) {
switch (m_typeOfIcon) {
@ -313,7 +313,7 @@ void KNutDock::repaintDock (const bool always) {
// if (m_statusValue & KNutNet::OL) bitBlt (m_mainLayer,0,0,m_loadLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP); // icon of UPS
if (m_statusValue & KNutNet::OL) { // ONLINE - icon of UPS
int myLoad;
QPainter paint;
TQPainter paint;
copyBlt (m_mainLayer,0,0,&m_upsPix,0,0,ICON_SIZE,ICON_SIZE); // icon of UPS
paint.begin(m_mainLayer);
@ -323,35 +323,35 @@ void KNutDock::repaintDock (const bool always) {
if (m_upsLoadValue != knc::numberVarError) {
if (myLoad > 12) myLoad=12;
if (myLoad > 10) myLoad++; // preskocime rysku pro 100 %
if (myLoad < 9) paint.setPen(QColor(0,192,0)); //green
if (myLoad < 9) paint.setPen(TQColor(0,192,0)); //green
else {
if (myLoad < 11) paint.setPen(QColor(255,255,0)); //yellow
else paint.setPen(QColor(255,0,0));//red
if (myLoad < 11) paint.setPen(TQColor(255,255,0)); //yellow
else paint.setPen(TQColor(255,0,0));//red
}
for (int i = 19; i < 22; i++) paint.drawLine(i,13,i,13-myLoad +1);
if (myLoad < 13) {
paint.setPen(QColor(168,220,255));
paint.setPen(TQColor(168,220,255));
for (int i = 20; i < 23; i++ ) paint.drawLine(i,1,i,13-myLoad);
}
}
paint.setPen(QColor(Qt::black)); // line for 100 % load
paint.setPen(TQColor(TQt::black)); // line for 100 % load
paint.drawLine(19,3,22,3);
if (!m_statusWarningValue) paintOKPoint(paint);
else paintErrorPoint(paint);
paint.end();
}
else {
QPainter paint;
TQPainter paint;
copyBlt (m_mainLayer,0,0,&m_battPix,0,0,ICON_SIZE,ICON_SIZE); // icon of Battery
paint.begin(m_mainLayer);
if (m_batteryChargeValue != knc::numberVarError) {
if (m_batteryChargeValue < 40) paint.setPen(Qt::red);
else paint.setPen(Qt::black);
if (m_batteryChargeValue < 40) paint.setPen(Qt::red);
if (m_batteryChargeValue < 40) paint.setPen(TQt::red);
else paint.setPen(TQt::black);
if (m_batteryChargeValue < 40) paint.setPen(TQt::red);
else {
if (m_batteryChargeValue < 50) paint.setPen(Qt::yellow);
else paint.setPen(Qt::green);
if (m_batteryChargeValue < 50) paint.setPen(TQt::yellow);
else paint.setPen(TQt::green);
}
int delka = abs((16*m_batteryChargeValue)/100);
delka += abs((delka-1)/4) -1;
@ -390,18 +390,18 @@ void KNutDock::repaintDock (const bool always) {
}
}
}
repaint();
tqrepaint();
}
void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad ) {
QString text;
QString manufacturer = "";
QString upsModel = "";
QString serial = "";
QString firmware = "";
TQString text;
TQString manufacturer = "";
TQString upsModel = "";
TQString serial = "";
TQString firmware = "";
int myNetErr = 0;
int min = abs(runtime/60);
@ -428,7 +428,7 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad
text = i18n("Name")+" : "+m_activeUpsInfo->record.name + "\n"
+i18n("UPS name")+" : "+m_activeUpsInfo->record.upsName + "\n"
+i18n("UPS address")+" : "+m_activeUpsInfo->record.upsAddress +"\n"
+i18n("Status : ");
+i18n("tqStatus : ");
if (status == -1) {
text += i18n("Connection doesn't exist.");
@ -449,22 +449,22 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad
}
if (status & KNutNet::LB) {
text += "\n" + i18n("Status : ") + i18n("UPS Battery is low");
text += "\n" + i18n("tqStatus : ") + i18n("UPS Battery is low");
}
if (status & KNutNet::RB) {
text += "\n" + i18n("Status : ") + i18n("Replace battery");
text += "\n" + i18n("tqStatus : ") + i18n("Replace battery");
}
if (status & KNutNet::CAL) {
text += "\n" + i18n("Status : ") + i18n("UPS is performing calibration");
text += "\n" + i18n("tqStatus : ") + i18n("UPS is performing calibration");
}
if (status & KNutNet::OVER) {
text += "\n" + i18n("Status : ") + i18n("UPS is Overload");
text += "\n" + i18n("tqStatus : ") + i18n("UPS is Overload");
}
if (status & KNutNet::TRIM) {
text += "\n" + i18n("Status : ") + i18n("UPS is trimming voltage");
text += "\n" + i18n("tqStatus : ") + i18n("UPS is trimming voltage");
}
if (status & KNutNet::BOOST) {
text += "\n" + i18n("Status : ")+ i18n("UPS is boosting voltage");
text += "\n" + i18n("tqStatus : ")+ i18n("UPS is boosting voltage");
}
@ -483,21 +483,21 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad
if (m_toolTipFlags & TTRun) {
if (runtime != knc::numberVarError)
text += "\n" + i18n("Runtime") + i18n(" : %1:%2 min").arg(min).arg(sec);
text += "\n" + i18n("Runtime") + i18n(" : %1:%2 min").tqarg(min).tqarg(sec);
}
if (m_toolTipFlags & TTCharge) {
if (batteryCharge != knc::numberVarError)
text += "\n" + i18n("Battery Charge") + QString(" : %1 %").arg(batteryCharge);
text += "\n" + i18n("Battery Charge") + TQString(" : %1 %").tqarg(batteryCharge);
}
if (m_toolTipFlags & TTLoad) {
if (upsLoad != knc::numberVarError)
text += "\n" + i18n("UPS Load") + QString(" : %1 %").arg(upsLoad);
text += "\n" + i18n("UPS Load") + TQString(" : %1 %").tqarg(upsLoad);
}
QToolTip::remove(this);
QToolTip::add(this,text);
TQToolTip::remove(this);
TQToolTip::add(this,text);
}
@ -564,36 +564,36 @@ void KNutDock::slotRefreshConnection(void) {
//------------------------------------------
void KNutDock::mousePressEvent(QMouseEvent *e) {
void KNutDock::mousePressEvent(TQMouseEvent *e) {
//qDebug("KNutDock::mousePressEvent");
if( e->button()==LeftButton ) emit activeMainWindow();
if( e->button()==RightButton ) m_menu->popup(e->globalPos());
if( e->button()==Qt::LeftButton ) emit activeMainWindow();
if( e->button()==Qt::RightButton ) m_menu->popup(e->globalPos());
}
void KNutDock::paintEvent (QPaintEvent *e) {
void KNutDock::paintEvent (TQPaintEvent *e) {
KSystemTray::paintEvent(e);
if ((m_activeUpsInfo->upsNet->getState() == KNutNet::Connected) and
(m_statusValue != KNutNet::NS)) { // When driver isn't connected, getState is connected and m_statusValue is NS // NONE STATUS
if (m_typeOfIcon == pictureKI) {
QPainter painter(this);
TQPainter painter(this);
// painter.begin();
if (m_statusValue & KNutNet::OL) { // ONLINE - icon of UPS
painter.setPen(Qt::black);
painter.setPen(TQt::black);
paintNumbers (m_upsLoadValue, (width()/-11), ((float) width()/(float) 1.46666666667), &painter, ((float) width()/(float) 22) );
}
else { // OFFLINE icon of battery
if (m_batteryChargeValue != knc::numberVarError) {
if (m_batteryChargeValue < 40) painter.setPen(Qt::red);
else painter.setPen(Qt::black);
if (m_batteryChargeValue < 40) painter.setPen(TQt::red);
else painter.setPen(TQt::black);
paintNumbers(m_batteryChargeValue,(width()/-11),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22));
}
else {
painter.setPen(Qt::black);
painter.setPen(TQt::black);
paintDash (((float) width()/(float) 7.33333333333),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22));
paintDash (((float) width()/(float) 2.75),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22));
}
@ -626,9 +626,9 @@ void KNutDock::createUpsMenu(void) {
int n = m_upsRecords->getCount();
for (int i =0; i < n; i++) {
if (m_activeUpsInfo->record.name == m_upsRecords->getName(i))
m_upsServerMenu->insertItem(kapp->miniIcon(),m_upsRecords->getName(i), this, SLOT(slotUpsName(int)),0,101+i);
m_upsServerMenu->insertItem(kapp->miniIcon(),m_upsRecords->getName(i), this, TQT_SLOT(slotUpsName(int)),0,101+i);
else
m_upsServerMenu->insertItem(m_upsRecords->getName(i), this, SLOT(slotUpsName(int)),0,101+i);
m_upsServerMenu->insertItem(m_upsRecords->getName(i), this, TQT_SLOT(slotUpsName(int)),0,101+i);
}
}
@ -642,37 +642,37 @@ void KNutDock::createMainMenu(void) {
m_menu->insertSeparator();
m_menu->insertItem("UPS",m_upsServerMenu);
m_menu->insertSeparator();
m_menu->insertItem(i18n("&Showing UPS variables and commands"), this, SLOT(slotPrintUPSVars()));
m_menu->insertItem(i18n("&Running instant commands"), this, SLOT(slotInstComms()));
m_menu->insertItem(i18n("Setting R&W variables"), this, SLOT(slotRWVars()));
m_menu->insertItem(i18n("&Showing UPS variables and commands"), this, TQT_SLOT(slotPrintUPSVars()));
m_menu->insertItem(i18n("&Running instant commands"), this, TQT_SLOT(slotInstComms()));
m_menu->insertItem(i18n("Setting R&W variables"), this, TQT_SLOT(slotRWVars()));
m_menu->insertSeparator();
m_menu->insertItem(SmallIcon("reload"),i18n("Reconnect"), this, SLOT(slotRefreshConnection()));
m_menu->insertItem(SmallIcon("reload"),i18n("Reconnect"), this, TQT_SLOT(slotRefreshConnection()));
m_menu->insertSeparator();
m_menu->insertItem(SmallIcon("configure"),i18n("&Preferences"), this, SLOT(slotPreferences()));
m_menu->insertItem(SmallIcon("configure"),i18n("&Preferences"), this, TQT_SLOT(slotPreferences()));
m_menu->insertSeparator();
m_menu->insertItem(kapp->miniIcon(),i18n("&About KNutClient"), this, SLOT(slotShowMyAbout()));
m_menu->insertItem(kapp->miniIcon(),i18n("&About KNutClient"), this, TQT_SLOT(slotShowMyAbout()));
m_menu->insertSeparator();
m_menu->insertItem(i18n("&Minimize"), this, SLOT(slotMinimize()));
m_menu->insertItem(i18n("&Minimize"), this, TQT_SLOT(slotMinimize()));
m_menu->insertSeparator();
m_menu->insertItem (SmallIcon("exit"),i18n("&Exit"),this ,SLOT(slotExitApplication()));
m_menu->insertItem (SmallIcon("exit"),i18n("&Exit"),this ,TQT_SLOT(slotExitApplication()));
}
void KNutDock::paintCharge (int charge ) {
QPainter paint;
TQPainter paint;
m_chargeLayer->fill(Qt::white);
m_chargeLayer->fill(TQt::white);
paint.begin(m_chargeLayer);
if (charge > 199) charge = 199;
if (m_typeOfIcon == generalKI) {
if (charge != knc::numberVarError) {
if (charge < 40) paint.setPen(Qt::red);
else paint.setPen(Qt::black);
if (charge < 40) paint.setPen(TQt::red);
else paint.setPen(TQt::black);
paintNumbers(charge,8,2,&paint, 1);
}
else {
paint.setPen(Qt::black);
paint.setPen(TQt::black);
paintDash (13,2,&paint, 1);
paintDash (18,2,&paint, 1);
}
@ -680,14 +680,14 @@ void KNutDock::paintCharge (int charge ) {
else {
// picture version
if (charge != knc::numberVarError) {
if (charge < 40) paint.setPen(Qt::red);
else paint.setPen(Qt::black);
if (charge < 40) paint.setPen(TQt::red);
else paint.setPen(TQt::black);
paintNumbers(charge,-2,16,&paint, 1);
if (charge < 40) paint.setPen(Qt::red);
if (charge < 40) paint.setPen(TQt::red);
else {
if (charge < 50) paint.setPen(Qt::yellow);
else paint.setPen(Qt::green);
if (charge < 50) paint.setPen(TQt::yellow);
else paint.setPen(TQt::green);
}
int delka = abs((16*charge)/100);
delka += abs((delka-1)/4) -1;
@ -696,7 +696,7 @@ void KNutDock::paintCharge (int charge ) {
paint.drawLine (2,9,2+delka,9);
}
else {
paint.setPen(Qt::black);
paint.setPen(TQt::black);
paintDash (3,16,&paint, 1);
paintDash (8,16,&paint, 1);
}
@ -706,10 +706,10 @@ void KNutDock::paintCharge (int charge ) {
}
void KNutDock::paintErrorPoint ( QPainter& paint ) {
void KNutDock::paintErrorPoint ( TQPainter& paint ) {
paint.setPen(QColor(0,0,255));
paint.setPen(QColor(255,0,0));
paint.setPen(TQColor(0,0,255));
paint.setPen(TQColor(255,0,0));
paint.drawLine(19,18,21,18);
paint.drawLine(19,19,21,19);
@ -717,54 +717,54 @@ void KNutDock::paintErrorPoint ( QPainter& paint ) {
}
void KNutDock::paintOKPoint (QPainter& paint ) {
void KNutDock::paintOKPoint (TQPainter& paint ) {
paint.setPen(QColor(0,255,0));
paint.setPen(TQColor(0,255,0));
paint.drawLine(19,18,21,18);
paint.drawLine(19,19,21,19);
paint.drawLine(19,20,21,20);
}
void KNutDock::paintStatus (int status ) {
QPainter paint;
void KNutDock::painttqStatus (int status ) {
TQPainter paint;
int lastPos = 0;
m_statusLayer->fill(Qt::white);
m_statusLayer->fill(TQt::white);
paint.begin(m_statusLayer);
if (status & KNutNet::OL) {
paint.setPen(Qt::black);
paint.setPen(TQt::black);
paintChar (1,2,'P',&paint);
}
else {
if (status & KNutNet::OB) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (1,2,'B',&paint);
}
}
if (status & KNutNet::LB) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (6,2,'L',&paint);
}
if ((lastPos <2) && (status & KNutNet::RB)) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (6,2,'R',&paint);
lastPos++;
}
if ((lastPos <2) && (status & KNutNet::BOOST)) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (6,2,'B',&paint);
lastPos++;
}
if ((lastPos <2) && (status & KNutNet::TRIM)) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (6,2,'T',&paint);
lastPos++;
}
if ((lastPos <2) && (status & KNutNet::CAL)) {
paint.setPen(Qt::red);
paint.setPen(TQt::red);
paintChar (6,2,'C',&paint);
lastPos++;
}
@ -772,15 +772,15 @@ void KNutDock::paintStatus (int status ) {
}
void KNutDock::paintRuntime (int runtime, int status ) {
QPainter paint;
TQPainter paint;
m_runtimeLayer->fill(Qt::white);
m_runtimeLayer->fill(TQt::white);
paint.begin(m_runtimeLayer);
if (status & KNutNet::OB)
paint.setPen(Qt::red);
paint.setPen(TQt::red);
else
paint.setPen(Qt::black);
paint.setPen(TQt::black);
if (runtime != knc::numberVarError) {
int min = abs(runtime/60);
@ -803,11 +803,11 @@ void KNutDock::paintRuntime (int runtime, int status ) {
}
void KNutDock::paintLoad (int load ) {
QPainter paint;
TQPainter paint;
int myLoad;
// if (m_typeOfIcon != generalKI) bitBlt (m_loadLayer,0,0,m_upsLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
m_loadLayer->fill(Qt::white);
m_loadLayer->fill(TQt::white);
paint.begin(m_loadLayer);
if (load == knc::numberVarError) myLoad=0;
else myLoad = abs(load/10);
@ -815,16 +815,16 @@ void KNutDock::paintLoad (int load ) {
if (m_typeOfIcon == generalKI) {
if (load != knc::numberVarError) {
if (myLoad > 11) myLoad=11;
if (myLoad < 9) paint.setPen(Qt::green);
if (myLoad < 9) paint.setPen(TQt::green);
else {
if (myLoad < 11) paint.setPen(Qt::yellow);
else paint.setPen(Qt::red);
if (myLoad < 11) paint.setPen(TQt::yellow);
else paint.setPen(TQt::red);
}
paint.setPen(Qt::green.light(60));
paint.setPen(TQt::green.light(60));
for (int i = 0; i < myLoad; i++) {
paint.drawLine((i*2)+1,19,(i*2)+1,21);
}
paint.setPen(Qt::cyan.light(150));
paint.setPen(TQt::cyan.light(150));
for (int i = myLoad; i < 11; i++) {
paint.drawLine((i*2)+1,19,(i*2)+1,21);
}
@ -837,7 +837,7 @@ void KNutDock::paintLoad (int load ) {
void KNutDock::paintNumbers (int numbers, int x, int y, QPainter* p, float sizeMult ) {
void KNutDock::paintNumbers (int numbers, int x, int y, TQPainter* p, float sizeMult ) {
bool first = false;
if (numbers > 199) numbers = 199;
@ -857,26 +857,26 @@ void KNutDock::paintNumbers (int numbers, int x, int y, QPainter* p, float sizeM
}
else {
p->setPen(Qt::black);
p->setPen(TQt::black);
paintDash (((float) x+(5*sizeMult)),y,p,sizeMult);
paintDash (((float) x+(10*sizeMult)),y,p,sizeMult);
}
}
void KNutDock::paintDash (int x, int y, QPainter *p, float sizeMult) {
QPen oldPen = p->pen();
QPen newPen;
void KNutDock::paintDash (int x, int y, TQPainter *p, float sizeMult) {
TQPen oldPen = p->pen();
TQPen newPen;
newPen.setWidth(((float) (oldPen.width()+1)*sizeMult)-1);
p->setPen(newPen);
p->drawLine(x,((float) y+(3*sizeMult)),((float) x+(3*sizeMult)),((float) y+(3*sizeMult)));
p->setPen(oldPen);
}
void KNutDock::paintNumber (int x, int y, int number, QPainter *p, float sizeMult) {
void KNutDock::paintNumber (int x, int y, int number, TQPainter *p, float sizeMult) {
// x and y are left top corner
QPen oldPen = p->pen();
QPen newPen;
TQPen oldPen = p->pen();
TQPen newPen;
newPen.setWidth(((float) (oldPen.width()+1)*sizeMult)-1);
p->setPen(newPen);
@ -938,7 +938,7 @@ void KNutDock::paintNumber (int x, int y, int number, QPainter *p, float sizeMul
}
void KNutDock::paintChar (int x, int y, char LCDChar, QPainter *p) {
void KNutDock::paintChar (int x, int y, char LCDChar, TQPainter *p) {
// x and y are left up corner
switch (LCDChar) {
case 'L':

@ -26,12 +26,12 @@
#include <ksystemtray.h>
#include <kpopupmenu.h>
#include <qobject.h>
#include <tqobject.h>
class QString;
class QPixmap;
class QColor;
class TQString;
class TQPixmap;
class TQColor;
/**
* This class makes icons in dock.
@ -43,6 +43,7 @@ class QColor;
*/
class KNutDock : public KSystemTray {
Q_OBJECT
TQ_OBJECT
public:
enum KNTDconst { DefaultToolTipFlags = 0x398};
@ -137,16 +138,16 @@ class KNutDock : public KSystemTray {
void changeToolTip(void);
/**
* Provede nove zpracovani dat a jejich nakresli iconu docku, interni repaint je volan vzdy.
* Provede nove zpracovani dat a jejich nakresli iconu docku, interni tqrepaint je volan vzdy.
* Tato funkce take vola funkci ToolTip.
* Makes new processing of data and paints icons of dock, internal repaint is colled always.
* Makes new processing of data and paints icons of dock, internal tqrepaint is colled always.
* This function calls function ToolTips too.
* @param always Kdyz je true prorovede vykresleni vzdy, kde je false provede vykresleni jen kdyz je zmenena nejaka hodnota UPS.
* @param always When param is true, icon is made always, is one is false icon is makeing when same UPS's value is changed.
*
* @since 0.4
**/
void repaintDock ( const bool always = false);
void tqrepaintDock ( const bool always = false);
@ -236,12 +237,12 @@ class KNutDock : public KSystemTray {
*
* @since 0.1
**/
void UPSChanged(QString name);
void UPSChanged(TQString name);
protected slots:
virtual void mousePressEvent(QMouseEvent *e);
virtual void mousePressEvent(TQMouseEvent *e);
/**
* @internal
@ -372,7 +373,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.2
**/
void paintNumbers (int numbers, int x, int y, QPainter* p, float sizeMult ); //x,y levy horni roh cisla 1
void paintNumbers (int numbers, int x, int y, TQPainter* p, float sizeMult ); //x,y levy horni roh cisla 1
/**
* @internal
@ -385,7 +386,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.1
**/
void paintNumber (int x, int y, int number, QPainter *p, float sizeMult);
void paintNumber (int x, int y, int number, TQPainter *p, float sizeMult);
/**
* @internal
@ -398,7 +399,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.1
**/
void paintChar (int x, int y, char LCDChar, QPainter *p);
void paintChar (int x, int y, char LCDChar, TQPainter *p);
/**
@ -410,7 +411,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.1
**/
void paintDash (int x, int y, QPainter *p, float sizeMult);
void paintDash (int x, int y, TQPainter *p, float sizeMult);
/**
@ -442,15 +443,15 @@ class KNutDock : public KSystemTray {
/**
* @internal
* Paints layer for UPS Status, only for type general
* Vykresli vrstvu pro UPS Status.
* Paints layer for UPS tqStatus, only for type general
* Vykresli vrstvu pro UPS tqStatus.
*
* @since 0.2
**/
void paintStatus (int status );
void painttqStatus (int status );
void paintEvent (QPaintEvent *);
void paintEvent (TQPaintEvent *);
/**
* @internal
@ -460,7 +461,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.3
**/
void paintErrorPoint ( QPainter& paint );
void paintErrorPoint ( TQPainter& paint );
/**
* @internal
@ -470,7 +471,7 @@ class KNutDock : public KSystemTray {
*
* @since 0.3
**/
void paintOKPoint ( QPainter& paint );
void paintOKPoint ( TQPainter& paint );
/**
* @internal
@ -481,31 +482,31 @@ class KNutDock : public KSystemTray {
**/
void clearValues(void);
void resizeEvent ( QResizeEvent * );
void resizeEvent ( TQResizeEvent * );
KNutUpsData* m_upsRecords;
KNutVarData::SettingDataDef* m_settingData; // v teto strukture jsou ulozeny promene ktere nastavuji konfiguraci
KNutVarData::upsInfoDef* m_activeUpsInfo; // values for selected ups
QPixmap m_mainPix;
QPixmap m_errorPix;
QPixmap m_connectPix;
QPixmap m_upsPix;
QPixmap m_battPix;
TQPixmap m_mainPix;
TQPixmap m_errorPix;
TQPixmap m_connectPix;
TQPixmap m_upsPix;
TQPixmap m_battPix;
QPixmap m_mainLayer1;
TQPixmap m_mainLayer1;
QColor backgroundColor;
TQColor backgroundColor;
KPopupMenu* m_menu;
KPopupMenu* m_upsServerMenu;
QPixmap *m_statusLayer;
QPixmap *m_runtimeLayer;
QPixmap *m_loadLayer;
QPixmap *m_chargeLayer;
QPixmap *m_mainLayer;
TQPixmap *m_statusLayer;
TQPixmap *m_runtimeLayer;
TQPixmap *m_loadLayer;
TQPixmap *m_chargeLayer;
TQPixmap *m_mainLayer;
int m_runtimeValue;
int m_upsLoadValue;
@ -519,7 +520,7 @@ class KNutDock : public KSystemTray {
upsConnection m_dataOkOld;
int m_typeOfIcon;
QColor m_myBGColor;
TQColor m_myBGColor;
unsigned int m_toolTipFlags;
};

@ -23,32 +23,32 @@
#include <klocale.h>
#include <kapp.h>
#include <qtooltip.h>
#include <qstring.h>
#include <qpaintdevice.h>
#include <qlayout.h>
#include <qlcdnumber.h>
//#include <qframe.h>
#include <qlabel.h>
#include <qcolor.h>
#include <qfont.h>
#include <qpalette.h>
#include <qgroupbox.h>
#include <tqtooltip.h>
#include <tqstring.h>
#include <tqpaintdevice.h>
#include <tqlayout.h>
#include <tqlcdnumber.h>
//#include <tqframe.h>
#include <tqlabel.h>
#include <tqcolor.h>
#include <tqfont.h>
#include <tqpalette.h>
#include <tqgroupbox.h>
#include <math.h>
KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, const unsigned int flags, QFont* const panelFonts, const char *name) : QFrame( parent, name ), m_panelFlags(flags) {
KNutFrontPanel::KNutFrontPanel( TQPalette* const paletteIn, TQWidget *tqparent, const unsigned int flags, TQFont* const panelFonts, const char *name) : TQFrame( tqparent, name ), m_panelFlags(flags) {
m_myPalette = paletteIn->copy(); // makes deep copy of palette
m_upsOkColor = Qt::green;
m_upsErrorColor = Qt::red;
m_upsBackColor = Qt::white; //backgroundColor();
m_helpColor = Qt::black;
m_myPalette = TQPalette(*paletteIn); // makes deep copy of palette
m_upsOkColor = TQt::green;
m_upsErrorColor = TQt::red;
m_upsBackColor = TQt::white; //backgroundColor();
m_helpColor = TQt::black;
m_typeOfLCDColor=true;
m_LCDNumber1 = 0;
setFrameStyle( QFrame::Box | QFrame::Raised );
setFrameStyle( TQFrame::Box | TQFrame::Raised );
setLineWidth( 2 );
if (panelFonts == 0) {
@ -62,28 +62,28 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_panelBoldFont.setBold (TRUE);
m_panelFont.setBold (FALSE); // sets no bold
m_mainLayout = new QVBoxLayout(this);
m_mainLayout = new TQVBoxLayout(this);
m_mainLayout->setMargin ( 10 );
m_mainLayout->setSpacing ( 10 );
// layer for bulbs
m_bulbsGroupBox = new QGroupBox(this);
m_bulbsGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_bulbsGroupBox);
m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
// m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
// m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_bulbsGroupBox->setLineWidth(2);
QVBoxLayout* bulbsLayout = new QVBoxLayout(m_bulbsGroupBox);
TQVBoxLayout* bulbsLayout = new TQVBoxLayout(m_bulbsGroupBox);
bulbsLayout->setMargin( 5 );
m_textLabel1 = new QLabel( i18n("UPS On line"),m_bulbsGroupBox);
m_textLabel1 = new TQLabel( i18n("UPS On line"),m_bulbsGroupBox);
m_frameOL = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOL->setMaximumSize(30,30);
m_frameOL->setMinimumSize(25,25);
QToolTip::add(m_textLabel1,m_textLabel1->text());
TQToolTip::add(m_textLabel1,m_textLabel1->text());
QHBoxLayout* OLLayout = new QHBoxLayout(bulbsLayout);
TQHBoxLayout* OLLayout = new TQHBoxLayout(bulbsLayout);
OLLayout->addWidget(m_textLabel1);
OLLayout->addSpacing(10);
OLLayout->addWidget(m_frameOL);
@ -92,13 +92,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
OLLayout->setStretchFactor(m_frameOL,5);
m_textLabel2 = new QLabel( i18n("UPS On battery"), m_bulbsGroupBox);
m_textLabel2 = new TQLabel( i18n("UPS On battery"), m_bulbsGroupBox);
m_frameOB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOB->setMaximumSize(30,30);
m_frameOB->setMinimumSize(25,25);
QToolTip::add(m_textLabel2,m_textLabel2->text());
TQToolTip::add(m_textLabel2,m_textLabel2->text());
QHBoxLayout* OBLayout = new QHBoxLayout(bulbsLayout);
TQHBoxLayout* OBLayout = new TQHBoxLayout(bulbsLayout);
OBLayout->addWidget(m_textLabel2);
OBLayout->addSpacing(10);
OBLayout->addWidget(m_frameOB);
@ -107,13 +107,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
OBLayout->setStretchFactor(m_frameOB,5);
m_textLabel3 = new QLabel( i18n("UPS Overload"), m_bulbsGroupBox);
m_textLabel3 = new TQLabel( i18n("UPS Overload"), m_bulbsGroupBox);
m_frameOVER = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOVER->setMaximumSize(30,30);
m_frameOVER->setMinimumSize(25,25);
QToolTip::add(m_textLabel3,m_textLabel3->text());
TQToolTip::add(m_textLabel3,m_textLabel3->text());
m_OLayout = new QHBoxLayout(bulbsLayout);
m_OLayout = new TQHBoxLayout(bulbsLayout);
m_OLayout->addWidget(m_textLabel3);
m_OLayout->addSpacing(10);
m_OLayout->addWidget(m_frameOVER);
@ -121,13 +121,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_OLayout->setStretchFactor(m_textLabel3,20);
m_OLayout->setStretchFactor(m_frameOVER,5);
m_textLabel4 = new QLabel( i18n("UPS Battery low"), m_bulbsGroupBox);
m_textLabel4 = new TQLabel( i18n("UPS Battery low"), m_bulbsGroupBox);
m_frameLB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameLB->setMaximumSize(30,30);
m_frameLB->setMinimumSize(25,25);
QToolTip::add(m_textLabel4,m_textLabel4->text());
TQToolTip::add(m_textLabel4,m_textLabel4->text());
m_LBLayout = new QHBoxLayout(bulbsLayout);
m_LBLayout = new TQHBoxLayout(bulbsLayout);
m_LBLayout->addWidget(m_textLabel4);
m_LBLayout->addSpacing(10);
m_LBLayout->addWidget(m_frameLB);
@ -135,13 +135,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_LBLayout->setStretchFactor(m_textLabel4,20);
m_LBLayout->setStretchFactor(m_frameLB,5);
m_textLabel5 = new QLabel( i18n("Replace battery"), m_bulbsGroupBox);
m_textLabel5 = new TQLabel( i18n("Replace battery"), m_bulbsGroupBox);
m_frameRB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameRB->setMaximumSize(30,30);
m_frameRB->setMinimumSize(25,25);
QToolTip::add(m_textLabel5,m_textLabel5->text());
TQToolTip::add(m_textLabel5,m_textLabel5->text());
m_RBLayout = new QHBoxLayout(bulbsLayout);
m_RBLayout = new TQHBoxLayout(bulbsLayout);
m_RBLayout->addWidget(m_textLabel5);
m_RBLayout->addSpacing(10);
m_RBLayout->addWidget(m_frameRB);
@ -149,13 +149,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_RBLayout->setStretchFactor(m_textLabel5,20);
m_RBLayout->setStretchFactor(m_frameRB,5);
m_textLabel6 = new QLabel( i18n("UPS calibration"), m_bulbsGroupBox);
m_textLabel6 = new TQLabel( i18n("UPS calibration"), m_bulbsGroupBox);
m_frameCAL = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameCAL->setMaximumSize(30,30);
m_frameCAL->setMinimumSize(25,25);
QToolTip::add(m_textLabel6,m_textLabel6->text());
TQToolTip::add(m_textLabel6,m_textLabel6->text());
m_CALLayout = new QHBoxLayout(bulbsLayout);
m_CALLayout = new TQHBoxLayout(bulbsLayout);
m_CALLayout->addWidget(m_textLabel6);
m_CALLayout->addSpacing(10);
m_CALLayout->addWidget(m_frameCAL);
@ -164,81 +164,81 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_CALLayout->setStretchFactor(m_frameCAL,5);
m_messGroupBox = new QGroupBox(this);
m_messGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_messGroupBox);
m_messGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
// m_messGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
m_messGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
// m_messGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_messGroupBox->setLineWidth(2);
QVBoxLayout* messLayout = new QVBoxLayout(m_messGroupBox);
TQVBoxLayout* messLayout = new TQVBoxLayout(m_messGroupBox);
messLayout->setMargin( 3 );
m_textLabel7 = new QLabel( "", m_messGroupBox);
QToolTip::add(m_textLabel7,m_textLabel7->text());
m_manufacModelLayout = new QHBoxLayout(messLayout);
m_textLabel7 = new TQLabel( "", m_messGroupBox);
TQToolTip::add(m_textLabel7,m_textLabel7->text());
m_manufacModelLayout = new TQHBoxLayout(messLayout);
m_manufacModelLayout->addWidget(m_textLabel7);
m_manufacModelLayout->setMargin ( 3 );
m_textLabelManufac = new QLabel( i18n("Manufac. : "), m_messGroupBox);
m_textLabel8 = new QLabel( "", m_messGroupBox);
QToolTip::add(m_textLabelManufac,m_textLabelManufac->text());
m_textLabelManufac = new TQLabel( i18n("Manufac. : "), m_messGroupBox);
m_textLabel8 = new TQLabel( "", m_messGroupBox);
TQToolTip::add(m_textLabelManufac,m_textLabelManufac->text());
m_manufacLayout = new QHBoxLayout(messLayout);
m_manufacLayout = new TQHBoxLayout(messLayout);
m_manufacLayout->addWidget(m_textLabelManufac);
m_manufacLayout->addWidget(m_textLabel8);
m_manufacLayout->addStretch(20);
m_manufacLayout->setMargin ( 3 );
m_textLabelName = new QLabel( i18n("Name")+" : ", m_messGroupBox);
m_textLabel9 = new QLabel( "", m_messGroupBox);
QToolTip::add(m_textLabelName,m_textLabelName->text());
m_textLabelName = new TQLabel( i18n("Name")+" : ", m_messGroupBox);
m_textLabel9 = new TQLabel( "", m_messGroupBox);
TQToolTip::add(m_textLabelName,m_textLabelName->text());
m_nameLayout = new QHBoxLayout(messLayout);
m_nameLayout = new TQHBoxLayout(messLayout);
m_nameLayout->addWidget(m_textLabelName);
m_nameLayout->addWidget(m_textLabel9);
m_nameLayout->addStretch(20);
m_nameLayout->setMargin ( 3 );
m_textLabelSerial = new QLabel( i18n("Serial : "), m_messGroupBox);
m_textLabel10 = new QLabel( "", m_messGroupBox);
QToolTip::add(m_textLabelSerial,m_textLabelSerial->text());
m_textLabelSerial = new TQLabel( i18n("Serial : "), m_messGroupBox);
m_textLabel10 = new TQLabel( "", m_messGroupBox);
TQToolTip::add(m_textLabelSerial,m_textLabelSerial->text());
m_serialLayout = new QHBoxLayout(messLayout);
m_serialLayout = new TQHBoxLayout(messLayout);
m_serialLayout->addWidget(m_textLabelSerial);
m_serialLayout->addWidget(m_textLabel10);
m_serialLayout->addStretch(20);
m_serialLayout->setMargin ( 3 );
m_textLabelFirm = new QLabel( i18n("Firm. rev. : "), m_messGroupBox);
m_textLabel11 = new QLabel( "", m_messGroupBox);
QToolTip::add(m_textLabelFirm,m_textLabelFirm->text());
m_textLabelFirm = new TQLabel( i18n("Firm. rev. : "), m_messGroupBox);
m_textLabel11 = new TQLabel( "", m_messGroupBox);
TQToolTip::add(m_textLabelFirm,m_textLabelFirm->text());
m_firmLayout = new QHBoxLayout(messLayout);
m_firmLayout = new TQHBoxLayout(messLayout);
m_firmLayout->addWidget(m_textLabelFirm);
m_firmLayout->addWidget(m_textLabel11);
m_firmLayout->addStretch(20);
m_firmLayout->setMargin ( 3 );
m_valGroupBox = new QGroupBox(this);
m_valGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_valGroupBox);
m_valGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
// m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
m_valGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
// m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_valGroupBox->setLineWidth(2);
QVBoxLayout* valLayout = new QVBoxLayout(m_valGroupBox);
TQVBoxLayout* valLayout = new TQVBoxLayout(m_valGroupBox);
valLayout->setMargin( 3 );
m_textLabelRun = new QLabel( i18n("Runtime")+" : ", m_valGroupBox);
QToolTip::add(m_textLabelRun,m_textLabelRun->text());
m_textLabelRun = new TQLabel( i18n("Runtime")+" : ", m_valGroupBox);
TQToolTip::add(m_textLabelRun,m_textLabelRun->text());
m_LCDNumber1 = new QLCDNumber (5,m_valGroupBox);
m_LCDNumber1->setSegmentStyle (QLCDNumber::Flat);
m_LCDNumber1->setFrameStyle( QFrame::NoFrame );
m_LCDNumber1 = new TQLCDNumber (5,m_valGroupBox);
m_LCDNumber1->setSegmentStyle (TQLCDNumber::Flat);
m_LCDNumber1->setFrameStyle( TQFrame::NoFrame );
m_LCDNumber1->setMinimumSize(50,20);
m_runLayout = new QHBoxLayout(valLayout);
m_runLayout = new TQHBoxLayout(valLayout);
m_runLayout->addWidget(m_textLabelRun);
m_runLayout->addStretch(20);
m_runLayout->addWidget(m_LCDNumber1);
@ -404,34 +404,34 @@ unsigned int KNutFrontPanel::getPanelFlags( void) { return m_panelFlags; }
void KNutFrontPanel::setPanelFlags(const int upsPanelFlags) { m_panelFlags = upsPanelFlags; }
void KNutFrontPanel::setAllNameUps(const QString panelUpsAllName ){
void KNutFrontPanel::setAllNameUps(const TQString panelUpsAllName ){
m_textLabel7->setText(panelUpsAllName);
QToolTip::remove(m_textLabel7);
QToolTip::add(m_textLabel7,panelUpsAllName);
TQToolTip::remove(m_textLabel7);
TQToolTip::add(m_textLabel7,panelUpsAllName);
}
void KNutFrontPanel::setMFRUps(const QString panelUpsFRM ){
void KNutFrontPanel::setMFRUps(const TQString panelUpsFRM ){
m_textLabel8->setText(panelUpsFRM);
QToolTip::remove(m_textLabelManufac);
QToolTip::add(m_textLabelManufac,m_textLabelManufac->text()+panelUpsFRM);
TQToolTip::remove(m_textLabelManufac);
TQToolTip::add(m_textLabelManufac,m_textLabelManufac->text()+panelUpsFRM);
}
void KNutFrontPanel::setNameUps(const QString panelUpsName ){
void KNutFrontPanel::setNameUps(const TQString panelUpsName ){
m_textLabel9->setText(panelUpsName);
QToolTip::remove(m_textLabelName);
QToolTip::add(m_textLabelName,m_textLabelName->text()+panelUpsName);
TQToolTip::remove(m_textLabelName);
TQToolTip::add(m_textLabelName,m_textLabelName->text()+panelUpsName);
}
void KNutFrontPanel::setSerialUps(const QString panelUpsSerial ){
void KNutFrontPanel::setSerialUps(const TQString panelUpsSerial ){
m_textLabel10->setText(panelUpsSerial);
QToolTip::remove(m_textLabelSerial);
QToolTip::add(m_textLabelSerial,m_textLabelSerial->text()+panelUpsSerial);
TQToolTip::remove(m_textLabelSerial);
TQToolTip::add(m_textLabelSerial,m_textLabelSerial->text()+panelUpsSerial);
}
void KNutFrontPanel::setFirmRevUps(const QString upsPanelFormRev ){
void KNutFrontPanel::setFirmRevUps(const TQString upsPanelFormRev ){
m_textLabel11->setText(upsPanelFormRev);
QToolTip::remove(m_textLabelFirm);
QToolTip::add(m_textLabelFirm,m_textLabelFirm->text()+upsPanelFormRev);
TQToolTip::remove(m_textLabelFirm);
TQToolTip::add(m_textLabelFirm,m_textLabelFirm->text()+upsPanelFormRev);
}
@ -460,12 +460,12 @@ void KNutFrontPanel::cleanPanel(void) {
}
void KNutFrontPanel::setRuntime(const int runtime) {
QString runtimeString;
TQString runtimeString;
if (runtime != knc::numberVarError) {
int min = (int)floor(runtime/60);
int sec = runtime - (min*60);
runtimeString=QString("%1:%2").arg(min,2).arg(sec,2);
runtimeString=TQString("%1:%2").tqarg(min,2).tqarg(sec,2);
if (runtimeString[3] == ' ') runtimeString[3]='0';
}
else runtimeString="-:--";
@ -556,7 +556,7 @@ void KNutFrontPanel::setPanel(const int panelBulbs) {
/*********************************************************************************************/
void KNutFrontPanel::slotSetPanelFont(QFont newPanelFont) {
void KNutFrontPanel::slotSetPanelFont(TQFont newPanelFont) {
m_panelFont = newPanelFont; // nastavime font
m_panelBoldFont = newPanelFont; // pozdeji zmenime
@ -580,20 +580,20 @@ void KNutFrontPanel::setLCDPalette (void) {
m_LCDPaletteOk = m_myPalette;
m_LCDPaletteErr = m_myPalette;
//Nastavime barvu pro OK system je online
QColorGroup activeColorGroup = m_LCDPaletteOk.active();
activeColorGroup.setColor( QColorGroup::Foreground, green);
TQColorGroup activeColorGroup = m_LCDPaletteOk.active();
activeColorGroup.setColor( TQColorGroup::Foreground, green);
m_LCDPaletteOk.setActive(activeColorGroup);
m_LCDPaletteOk.setInactive(activeColorGroup);
//Nastavime Barvu pro Error - System neni online
activeColorGroup = m_LCDPaletteErr.active();
activeColorGroup.setColor( QColorGroup::Foreground, red);
activeColorGroup.setColor( TQColorGroup::Foreground, red);
m_LCDPaletteErr.setActive(activeColorGroup);
m_LCDPaletteErr.setInactive(activeColorGroup);
}
void KNutFrontPanel::setPalette (const QPalette & p){
void KNutFrontPanel::setPalette (const TQPalette & p){
m_myPalette = p;
setAllPalettes();
@ -601,10 +601,10 @@ void KNutFrontPanel::setPalette (const QPalette & p){
void KNutFrontPanel::setAllPalettes (void){
QColor myColor;
TQColor myColor;
QFrame::setPalette (m_myPalette);
//QColorGroup myColorGroup = myPalette.active();
TQFrame::setPalette (m_myPalette);
//TQColorGroup myColorGroup = myPalette.active();
// LCDPaletteOk = myPalette;
// LCDPaletteErr = myPalette;
@ -615,7 +615,7 @@ void KNutFrontPanel::setAllPalettes (void){
m_frameOL->setPalette(m_bulbsPalette);
// we must correct feature of KLed, KLed repaint background when color of item (function KLed::setColor()) is changed only
// we must correct feature of KLed, KLed tqrepaint background when color of item (function KLed::setColor()) is changed only
// when we change palette backround only, KLed ignore this change
myColor = m_frameOL->color();

@ -20,7 +20,7 @@
#include <kled.h>
#include <qframe.h>
#include <tqframe.h>
/**
@ -28,14 +28,14 @@
*/
class QFont;
class QPalette;
class QColor;
class QLCDNumber;
class QLabel;
class QVBoxLayout;
class QHBoxLayout;
class QGroupBox;
class TQFont;
class TQPalette;
class TQColor;
class TQLCDNumber;
class TQLabel;
class TQVBoxLayout;
class TQHBoxLayout;
class TQGroupBox;
/**
@ -47,8 +47,9 @@ class QGroupBox;
* @short Main panel
* @version 0.7.0
*/
class KNutFrontPanel : public QFrame {
class KNutFrontPanel : public TQFrame {
Q_OBJECT
TQ_OBJECT
public:
@ -86,7 +87,7 @@ enum panelBulb {
* @param panelFonts Odkaz na fonts ktery se ma pouzit pro vykreslovani, pokud je = 0 (nula) pouzije se systemovy font pri aplikaci.
* @since 0.8
*/
KNutFrontPanel( QPalette* const paletteIn, QWidget *parent = 0, const unsigned int flags = DefaultPanelFlags, QFont* const panelFonts = 0L ,const char *name = 0);
KNutFrontPanel( TQPalette* const paletteIn, TQWidget *tqparent = 0, const unsigned int flags = DefaultPanelFlags, TQFont* const panelFonts = 0L ,const char *name = 0);
/**
* Destruktor
@ -142,7 +143,7 @@ enum panelBulb {
*
* @since 0.2
*/
void setAllNameUps(const QString panelUpsAllName);
void setAllNameUps(const TQString panelUpsAllName);
/**
* Shows name of UPS on panel.
@ -153,7 +154,7 @@ void setAllNameUps(const QString panelUpsAllName);
*
* @since 0.3
*/
void setNameUps(const QString panelUpsName );
void setNameUps(const TQString panelUpsName );
/**
* Zobrazi na panelu jmeno vyrobce UPS-ky.
@ -164,7 +165,7 @@ void setAllNameUps(const QString panelUpsAllName);
*
* @since 0.2
*/
void setMFRUps(const QString panelUpsFRM );
void setMFRUps(const TQString panelUpsFRM );
/**
* Shows serial number of UPS on panel.
@ -175,7 +176,7 @@ void setAllNameUps(const QString panelUpsAllName);
*
* @since 0.2
*/
void setSerialUps(const QString panelUpsSerial );
void setSerialUps(const TQString panelUpsSerial );
/**
* Zobrazi na panelu verzi firmwaru cislo UPS-ky.
@ -184,7 +185,7 @@ void setAllNameUps(const QString panelUpsAllName);
*
* @since 0.2
*/
void setFirmRevUps(const QString upsPanelFormRev );
void setFirmRevUps(const TQString upsPanelFormRev );
/**
* Offs bulbs on panel. / Cleans panel.
@ -218,14 +219,14 @@ void setAllNameUps(const QString panelUpsAllName);
/**
* Sets palette.
* Nastavi paletu (palette). Predefinovana funkce from QWidget.
* Nastavi paletu (palette). Predefinovana funkce from TQWidget.
*
* @param Palette which mail panel is painted.
* @param Paleta kterou ma byt vykreslen hlavni panel
*
* @since 0.1
*/
void setPalette (const QPalette & );
void setPalette (const TQPalette & );
public slots:
@ -237,7 +238,7 @@ void setAllNameUps(const QString panelUpsAllName);
*
* @since 0.2
*/
void slotSetPanelFont(QFont newPanelFont);
void slotSetPanelFont(TQFont newPanelFont);
private:
@ -269,23 +270,23 @@ void setAllNameUps(const QString panelUpsAllName);
void changePanelFont (void);
QLabel* m_textLabel1;
QLabel* m_textLabel2;
QLabel* m_textLabel3;
QLabel* m_textLabel4;
QLabel* m_textLabel5;
QLabel* m_textLabel6;
QLabel* m_textLabel7;
QLabel* m_textLabel8;
QLabel* m_textLabel9;
QLabel* m_textLabel10;
QLabel* m_textLabel11;
TQLabel* m_textLabel1;
TQLabel* m_textLabel2;
TQLabel* m_textLabel3;
TQLabel* m_textLabel4;
TQLabel* m_textLabel5;
TQLabel* m_textLabel6;
TQLabel* m_textLabel7;
TQLabel* m_textLabel8;
TQLabel* m_textLabel9;
TQLabel* m_textLabel10;
TQLabel* m_textLabel11;
QLabel* m_textLabelManufac;
QLabel* m_textLabelName;
QLabel* m_textLabelSerial;
QLabel* m_textLabelFirm;
QLabel* m_textLabelRun;
TQLabel* m_textLabelManufac;
TQLabel* m_textLabelName;
TQLabel* m_textLabelSerial;
TQLabel* m_textLabelFirm;
TQLabel* m_textLabelRun;
KLed* m_frameOL;
@ -295,38 +296,38 @@ void setAllNameUps(const QString panelUpsAllName);
KLed* m_frameRB;
KLed* m_frameCAL;
QLCDNumber* m_LCDNumber1;
QPalette m_LCDPaletteOk, m_LCDPaletteErr;
QPalette m_bulbsPalette;
TQLCDNumber* m_LCDNumber1;
TQPalette m_LCDPaletteOk, m_LCDPaletteErr;
TQPalette m_bulbsPalette;
QColor m_upsOkColor, m_upsErrorColor, m_upsBackColor, m_helpColor;
TQColor m_upsOkColor, m_upsErrorColor, m_upsBackColor, m_helpColor;
QFont m_panelFont; // font pro header
QFont m_panelBoldFont; // font for date
TQFont m_panelFont; // font pro header
TQFont m_panelBoldFont; // font for date
unsigned int m_panelFlags; // selects which of rows will be shown/ urcuji ktera radka bude rozsvicena 1 OL, 2 OB, 3 OVER, 4 RB, CAL 5 ...
QPalette m_myPalette;
TQPalette m_myPalette;
QGroupBox* m_bulbsGroupBox;
QGroupBox* m_messGroupBox;
QGroupBox* m_valGroupBox;
TQGroupBox* m_bulbsGroupBox;
TQGroupBox* m_messGroupBox;
TQGroupBox* m_valGroupBox;
bool m_typeOfLCDColor;
QVBoxLayout* m_mainLayout;
QHBoxLayout* m_OLayout;
QHBoxLayout* m_LBLayout;
QHBoxLayout* m_RBLayout;
QHBoxLayout* m_CALLayout;
QHBoxLayout* m_manufacModelLayout;
QHBoxLayout* m_manufacLayout;
QHBoxLayout* m_nameLayout;
QHBoxLayout* m_serialLayout;
QHBoxLayout* m_firmLayout;
QHBoxLayout* m_runLayout;
TQVBoxLayout* m_mainLayout;
TQHBoxLayout* m_OLayout;
TQHBoxLayout* m_LBLayout;
TQHBoxLayout* m_RBLayout;
TQHBoxLayout* m_CALLayout;
TQHBoxLayout* m_manufacModelLayout;
TQHBoxLayout* m_manufacLayout;
TQHBoxLayout* m_nameLayout;
TQHBoxLayout* m_serialLayout;
TQHBoxLayout* m_firmLayout;
TQHBoxLayout* m_runLayout;
};
#endif

@ -23,14 +23,14 @@
#include <kmessagebox.h>
#include <qlayout.h>
#include <qframe.h>
#include <qlabel.h>
#include <qstring.h>
#include <tqlayout.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <tqstring.h>
KNutInstComms::KNutInstComms(QString* userName, QString* userPassword, const QString uName, const QString password, KNutNet* const upsNet, QWidget* parent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("Instant commands"),Ok|Cancel,Ok, parent, name, modal, true), m_upsNet(upsNet),m_oldUserName(userName), m_oldUserPassword(userPassword) {
KNutInstComms::KNutInstComms(TQString* userName, TQString* userPassword, const TQString uName, const TQString password, KNutNet* const upsNet, TQWidget* tqparent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("Instant commands"),Ok|Cancel,Ok, tqparent, name, modal, true), m_upsNet(upsNet),m_oldUserName(userName), m_oldUserPassword(userPassword) {
upsICommDef upsIComm;
@ -40,18 +40,18 @@ KNutInstComms::KNutInstComms(QString* userName, QString* userPassword, const QSt
}
else {
m_upsConnectOk=true;
QFrame *page = plainPage();
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
QLabel *label1 = new QLabel (i18n("RUN INSTANT COMMAND"),page,"label1");
label1->setAlignment(Qt::AlignHCenter);
TQFrame *page = plainPage();
TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );
TQLabel *label1 = new TQLabel (i18n("RUN INSTANT COMMAND"),page,"label1");
label1->tqsetAlignment(TQt::AlignHCenter);
topLayout->addWidget(label1);
QLabel *label2 = new QLabel (i18n("Command:"),page,"label2");
TQLabel *label2 = new TQLabel (i18n("Command:"),page,"label2");
m_instCommBox = new KComboBox(page,"instcommbox");
QGridLayout *passLayout = new QGridLayout (3,2,5,"passLayout");
QLabel *labelName = new QLabel (i18n("User name:"),page,"labelName");
QLabel *labelPassword = new QLabel (i18n("Password:"),page,"labelPassword");
TQGridLayout *passLayout = new TQGridLayout (3,2,5,"passLayout");
TQLabel *labelName = new TQLabel (i18n("User name:"),page,"labelName");
TQLabel *labelPassword = new TQLabel (i18n("Password:"),page,"labelPassword");
m_lineEditName = new KLineEdit( page, "LineEditName" );
m_lineEditPassword = new KLineEdit( page, "LineEditName" );
if (((*m_oldUserName) == "") && ((*m_oldUserPassword) == "")) {
@ -71,7 +71,7 @@ KNutInstComms::KNutInstComms(QString* userName, QString* userPassword, const QSt
// lineEditPassword->setDisabled(true);
// }
m_lineEditPassword->setEchoMode(QLineEdit::Password);
m_lineEditPassword->setEchoMode(TQLineEdit::Password);
topLayout->addLayout(passLayout);

@ -26,7 +26,7 @@
#include <klocale.h>
class QString;
class TQString;
/**
@ -53,7 +53,7 @@ public:
*
* @since 0.4
**/
KNutInstComms(QString* userName, QString* userPassword, const QString uName, const QString password, KNutNet* const upsNet, QWidget* parent = 0, const char* name = 0, bool const modal = TRUE);
KNutInstComms(TQString* userName, TQString* userPassword, const TQString uName, const TQString password, KNutNet* const upsNet, TQWidget* tqparent = 0, const char* name = 0, bool const modal = TRUE);
/**
* Destruktor
@ -89,8 +89,8 @@ private:
KNutNet* m_upsNet;
bool m_upsConnectOk;
QString* m_oldUserName;
QString* m_oldUserPassword;
TQString* m_oldUserName;
TQString* m_oldUserPassword;
};

@ -28,19 +28,19 @@
#include <kprogress.h>
#include <qfont.h>
#include <qpalette.h>
#include <qbrush.h>
#include <qcolor.h>
#include <qstring.h>
#include <qscrollview.h>
#include <qlayout.h>
#include <qiconset.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qlabel.h>
#include <qsplitter.h>
//#include <qprogressbar.h>
#include <tqfont.h>
#include <tqpalette.h>
#include <tqbrush.h>
#include <tqcolor.h>
#include <tqstring.h>
#include <tqscrollview.h>
#include <tqlayout.h>
#include <tqiconset.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqlabel.h>
#include <tqsplitter.h>
//#include <tqprogressbar.h>
@ -60,7 +60,7 @@ const char *descrOfConnection = I18N_NOOP("test of conection from 5");
KNutMainWindow::KNutMainWindow(QStringList *tListKNutEvent, KNutVarData::upsInfoDef* tActiveUpsInfo, KNutVarData::SettingDataDef* tSettingData, KNutUpsData* tUpsRecords, KNutVarData* tAnalogRecords, QWidget* parent, const char *name) : KMainWindow(parent, name),
KNutMainWindow::KNutMainWindow(TQStringList *tListKNutEvent, KNutVarData::upsInfoDef* tActiveUpsInfo, KNutVarData::SettingDataDef* tSettingData, KNutUpsData* tUpsRecords, KNutVarData* tAnalogRecords, TQWidget* tqparent, const char *name) : KMainWindow(tqparent, name),
m_listKNutEvent(tListKNutEvent), m_activeUpsInfo(tActiveUpsInfo),m_settingData (tSettingData),
m_upsRecords(tUpsRecords), m_analogRecords (tAnalogRecords) {
@ -87,41 +87,41 @@ KNutMainWindow::KNutMainWindow(QStringList *tListKNutEvent, KNutVarData::upsInfo
//sets palette for analog panels
// nastavime paletu pro analogove panely
if (m_settingData->customBAnalogColor) {
m_aPanelPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->aPanelBackgroundColor);
m_aPanelPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->aPanelBackgroundColor);
m_aPanelPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->aPanelBackgroundColor);
m_aPanelPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->aPanelBackgroundColor);
}
if (m_settingData->customBColor) {
m_areaPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mainBackgroundColor);
}
// makes main area // Vytvorime hlavni plochu
m_area = new QLabel (this);
m_area = new TQLabel (this);
setCentralWidget (m_area);
QHBoxLayout* mainLayout = new QHBoxLayout(m_area);
m_mainSplit = new QSplitter(Qt::Horizontal,m_area);
TQHBoxLayout* mainLayout = new TQHBoxLayout(m_area);
m_mainSplit = new TQSplitter(Qt::Horizontal,m_area);
m_mainSplit->setOpaqueResize(true);
mainLayout->addWidget(m_mainSplit);
if (m_settingData->customBPanelColor) {
m_mPanelPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
}
QScrollView* panelSV = new QScrollView(m_mainSplit,"panelSV");
TQScrollView* panelSV = new TQScrollView(m_mainSplit,"panelSV");
if (m_settingData->customFont)
m_frontPanel = new KNutFrontPanel (&m_mPanelPalette,m_mainSplit,m_settingData->panelFlags,&(m_settingData->mPanelFont),"FrontPanel");
else
m_frontPanel = new KNutFrontPanel (&m_mPanelPalette,m_mainSplit,m_settingData->panelFlags,&(m_settingData->systemFont),"FrontPanel");
panelSV->addChild(m_frontPanel);
panelSV->setResizePolicy ( QScrollView::AutoOneFit ) ;
m_mainSplit->setResizeMode (panelSV,QSplitter::FollowSizeHint);
panelSV->setResizePolicy ( TQScrollView::AutoOneFit ) ;
m_mainSplit->setResizeMode (panelSV,TQSplitter::FollowSizeHint);
m_panelMeter = new KNutPanelMeter(m_aPanelPalette,m_activeUpsInfo,m_settingData,m_analogRecords,m_mainSplit);
m_mainSplit->setResizeMode (m_panelMeter,QSplitter::Stretch );
m_mainSplit->setResizeMode (m_panelMeter,TQSplitter::Stretch );
m_area->setPalette(m_areaPalette);
m_panelMeter->setPalette(m_areaPalette);
@ -146,12 +146,12 @@ KNutMainWindow::KNutMainWindow(QStringList *tListKNutEvent, KNutVarData::upsInfo
void KNutMainWindow::addComboStatusItem (const QString text, const QString name) {
void KNutMainWindow::addComboStatusItem (const TQString text, const TQString name) {
if (m_infoCombo->count() >= (int)knc::maxCountKNutEvent) m_infoCombo->removeItem(0);
if (m_listKNutEvent->count() > knc::maxCountKNutEvent) m_listKNutEvent->remove(m_listKNutEvent->begin());
QString dateTime(QDate::currentDate().toString());
dateTime +=" " + QTime::currentTime().toString();
TQString dateTime(TQDate::tqcurrentDate().toString());
dateTime +=" " + TQTime::currentTime().toString();
if (name.isEmpty()) {
m_infoCombo->insertItem(dateTime+" "+text);
m_listKNutEvent->append(dateTime+" "+text);
@ -182,10 +182,10 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
//qDebug ("KNutMainWindow::setConfig");
KNutVarData::VarStrucDef analogMemberData;
bool repaintVoltagePanels = false;
bool repaintFrequencyPanels = false;
bool repaintAllPanels = false;
bool repaintOAPanels = false;
bool tqrepaintVoltagePanels = false;
bool tqrepaintFrequencyPanels = false;
bool tqrepaintAllPanels = false;
bool tqrepaintOAPanels = false;
// Main Setting
@ -195,23 +195,23 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
if (!m_settingData->customBColor) { // nastavime barvu pozadi podle systemu
m_area->setPalette (m_mainPalette); // we set background color based on system
m_panelMeter->setPalette (m_mainPalette);
repaint();
tqrepaint();
}
else {
m_areaPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mainBackgroundColor);
m_area->setPalette (m_areaPalette);
m_panelMeter->setPalette (m_areaPalette);
repaint();
tqrepaint();
}
}
else {
if (changeSetting & KNutPrefDlg::ChangeMBColor ) {
m_areaPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mainBackgroundColor);
m_areaPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mainBackgroundColor);
m_area->setPalette (m_areaPalette);
m_panelMeter->setPalette (m_areaPalette);
repaint();
tqrepaint();
}
}
@ -236,8 +236,8 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
m_analogRecords->setFrequency(50);
}
m_analogRecords->setXfer(m_lowXfer,m_highXfer);
repaintVoltagePanels = true;
repaintFrequencyPanels = true;
tqrepaintVoltagePanels = true;
tqrepaintFrequencyPanels = true;
}
}
else {
@ -246,12 +246,12 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
if ((changeSetting & KNutPrefDlg::ChangeVoltage) || ((changeSetting & KNutPrefDlg::ChangeXFer))) {
// byla aktivovana zmena napeti nebo zmena xfer a zaroven ho ups podporuje
m_analogRecords->setVoltage(m_settingData->inputVoltage);
repaintVoltagePanels=true;
tqrepaintVoltagePanels=true;
}
if ((changeSetting & KNutPrefDlg::ChangeFrequency) || ((changeSetting & KNutPrefDlg::ChangeXFer))) {
// byla aktivovana zmena napeti nebo zmena xfer a zaroven ho ups podporuje
m_analogRecords->setFrequency(m_settingData->inputFrequency);
repaintFrequencyPanels=true;
tqrepaintFrequencyPanels=true;
}
}
}
@ -265,14 +265,14 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
if ((changeSetting & KNutPrefDlg::ChangeCustomAPanelBColor) || // barva panelu je zmenena, panel color is changed
(changeSetting & KNutPrefDlg::ChangeAPBColor)) {
if (m_settingData->customBAnalogColor) {
m_aPanelPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->aPanelBackgroundColor);
m_aPanelPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->aPanelBackgroundColor);
repaintAllPanels=true;
m_aPanelPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->aPanelBackgroundColor);
m_aPanelPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->aPanelBackgroundColor);
tqrepaintAllPanels=true;
m_panelMeter->setAnalogBG(m_aPanelPalette);
}
else {
m_aPanelPalette = m_mainPalette;
repaintAllPanels=true;
tqrepaintAllPanels=true;
m_panelMeter->setAnalogBG(m_aPanelPalette);
}
}
@ -280,17 +280,17 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
if ((changeSetting & KNutPrefDlg::ChangeCustomAPanelOColor) || // je provedena zmena barvy panelu
(changeSetting & KNutPrefDlg::ChangeAPOColor)) {
if (m_settingData->customOAnalogColor) {
repaintAllPanels=true;
repaintOAPanels=true;
tqrepaintAllPanels=true;
tqrepaintOAPanels=true;
}
else {
repaintAllPanels=true;
repaintOAPanels=true;
tqrepaintAllPanels=true;
tqrepaintOAPanels=true;
}
}
// regeneration of panel uses for setting Main and setting Analog
// pregenerovani panelu slozi pro setting Main a setting Analog
m_panelMeter->repaintAnalogPanels (repaintFrequencyPanels, repaintVoltagePanels, repaintAllPanels);
m_panelMeter->tqrepaintAnalogPanels (tqrepaintFrequencyPanels, tqrepaintVoltagePanels, tqrepaintAllPanels);
if (m_activeUpsInfo->record.name != "") {
m_panelMeter->setSize();
@ -311,15 +311,15 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
m_frontPanel->setPalette (m_mainPalette);
}
else {
m_mPanelPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_frontPanel->setPalette (m_mPanelPalette);
}
}
else {
if (changeSetting & KNutPrefDlg::ChangeMPBColor ) {
m_mPanelPalette.setColor(QPalette::Active,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(QPalette::Inactive,QColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Active,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_mPanelPalette.setColor(TQPalette::Inactive,TQColorGroup::Background,m_settingData->mPanelBackgroundColor);
m_frontPanel->setPalette (m_mPanelPalette);
}
}
@ -335,7 +335,7 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
// Font panel setting
if (changeSetting & KNutPrefDlg::ChangeAnalogFont ) {
QFont newAnalogFont;
TQFont newAnalogFont;
if (m_settingData->customFont) {
newAnalogFont=m_settingData->aPanelFont;
}
@ -346,7 +346,7 @@ void KNutMainWindow::setConfig (unsigned int changeSetting) {
m_panelMeter->slotSetPanelsFont(newAnalogFont);
}
if (changeSetting & KNutPrefDlg::ChangePanelFont ) {
QFont newPanelFont;
TQFont newPanelFont;
if (m_settingData->customFont) {
m_frontPanel->slotSetPanelFont(m_settingData->mPanelFont);
}
@ -367,9 +367,9 @@ void KNutMainWindow::showUpsData (void) {
if ((m_activeUpsInfo->upsNet != 0L) && (!m_activeUpsInfo->netError) &&
(m_activeUpsInfo->upsDriverState == knc::connected)) {
int runtimeVal;
QString nutStringVar;
TQString nutStringVar;
bool okFloat;
// activeUpsInfo->oldStatus=KNutNet::initStatus;
// activeUpsInfo->oldtqStatus=KNutNet::inittqStatus;
// Nastaveni nemenych dat jsou precteny pouze jednou, predpoklada se jejich nemenost
// setting of unchange data, ones are reading only one.
@ -388,7 +388,7 @@ void KNutMainWindow::showUpsData (void) {
m_firmrev = m_activeUpsInfo->upsNet->readStringVar("ups.firmware");
break;
}
QString allUpsName = m_manufacturer + " " + m_upsModel;
TQString allUpsName = m_manufacturer + " " + m_upsModel;
m_frontPanel->setAllNameUps (allUpsName);
m_frontPanel->setMFRUps (m_manufacturer);
m_frontPanel->setNameUps (m_upsModel);
@ -414,9 +414,9 @@ void KNutMainWindow::showUpsData (void) {
m_existLowHighXfer = true;
}
}
int upsStatus=0;
if ((upsStatus = m_activeUpsInfo->upsNet->readStatus ()) != -1)
m_frontPanel->setPanel(upsStatus);
int upstqStatus=0;
if ((upstqStatus = m_activeUpsInfo->upsNet->readtqStatus ()) != -1)
m_frontPanel->setPanel(upstqStatus);
if ( !m_activeUpsInfo->upsNet->existName(m_activeUpsInfo->runtimeVar)) {
nutStringVar = m_activeUpsInfo->upsNet->readStringVar(m_activeUpsInfo->runtimeVar);
@ -451,14 +451,14 @@ void KNutMainWindow::showUpsData (void) {
//qDebug ("KNutMainWindow::showUpsData 1");
m_panelMeter->activateAnalogs(); // makes panel and makes background of panel
repaintAnalogs(false);
tqrepaintAnalogs(false);
//qDebug ("KNutMainWindow::showUpsData 2");
m_panelMeter->setSize(true);
//qDebug ("KNutMainWindow::showUpsData 3");
m_mainSplit->refresh();
// doesn't repaint analog pointers, because pointers will be repainted twice
// doesn't tqrepaint analog pointers, because pointers will be tqrepainted twice
//qDebug ("KNutMainWindow::showUpsData 4");
// repaintAnalogs(false); // don't make this
// tqrepaintAnalogs(false); // don't make this
//qDebug ("KNutMainWindow::showUpsData 5");
}
else {
@ -479,12 +479,12 @@ void KNutMainWindow::hideUpsData (void) {
m_frontPanel->cleanPanel();
}
void KNutMainWindow::setCombo (QString name) {
void KNutMainWindow::setCombo (TQString name) {
if (toolBar(0)->getCombo(1)->currentText() != name) toolBar(0)->getCombo(1)->setCurrentText(name);
}
void KNutMainWindow::repaintPanel (void) {
QString nutStringVar;
void KNutMainWindow::tqrepaintPanel (void) {
TQString nutStringVar;
if (m_activeUpsInfo->upsNet == 0) return;
if (!m_activeUpsInfo->upsNet->existName(m_activeUpsInfo->runtimeVar)) {
@ -494,23 +494,23 @@ void KNutMainWindow::repaintPanel (void) {
}
else m_frontPanel->setRuntime(knc::numberVarError);
// precteme status a nastavime zarovky panelu
int status = m_activeUpsInfo->upsNet->readStatus();
int status = m_activeUpsInfo->upsNet->readtqStatus();
m_frontPanel->setPanel(status);
}
/// je volan vzdy po timeoutu
/// this function is called after timeout always
void KNutMainWindow::repaintAnalogs ( bool run ) {
//qDebug ("KNutMainWindow::repaintAnalogs");
void KNutMainWindow::tqrepaintAnalogs ( bool run ) {
//qDebug ("KNutMainWindow::tqrepaintAnalogs");
QString nutStringVar;
TQString nutStringVar;
float numVar;
bool newRange = false;
if ((m_settingData->lowHighXfer) && (m_existLowHighXfer)) {
QString nutStringVar;
TQString nutStringVar;
nutStringVar = m_activeUpsInfo->upsNet->readStringVar(m_activeUpsInfo->lowxferVar);
if (! nutStringVar.isEmpty()) {
@ -528,7 +528,7 @@ void KNutMainWindow::repaintAnalogs ( bool run ) {
}
}
//qDebug ("KNutMainWindow::repaintAnalogs 1");
//qDebug ("KNutMainWindow::tqrepaintAnalogs 1");
for (int i=0; i< knc::NumberOfVars; i++) {
if (m_activeUpsInfo->record.upsVarCode[i] != 0) { // jistota pokud by nam to nekde propadlo
@ -540,17 +540,17 @@ void KNutMainWindow::repaintAnalogs ( bool run ) {
nutStringVar = m_activeUpsInfo->upsNet->readStringVar ((char *)nameUpsVars2[m_activeUpsInfo->record.upsVarCode[i]]);
break;
}
//qDebug ("KNutMainWindow::repaintAnalogs 2 ");
//qDebug ("KNutMainWindow::tqrepaintAnalogs 2 ");
if (nutStringVar.isEmpty()) numVar=0;
else numVar = nutStringVar.toFloat();
m_panelMeter->repaintScaleAnalogPanel (i, numVar);
if (newRange) m_panelMeter->repaintAnalogPanels (true, true, false); //freq volt
m_panelMeter->repaintAnalogPointer(i,numVar,run);
m_panelMeter->tqrepaintScaleAnalogPanel (i, numVar);
if (newRange) m_panelMeter->tqrepaintAnalogPanels (true, true, false); //freq volt
m_panelMeter->tqrepaintAnalogPointer(i,numVar,run);
}
} // end for
//qDebug ("KNutMainWindow::repaintAnalogs 3 ");
//qDebug ("KNutMainWindow::tqrepaintAnalogs 3 ");
}
@ -588,7 +588,7 @@ void KNutMainWindow::hideConnectPB ( void ) {
/*********************************************************************************************/
//this SLOT is for older KDE only
//this TQT_SLOT is for older KDE only
void KNutMainWindow::slotShowToolBar(void) {
if(toolBar("mainToolBar")->isVisible()) toolBar("mainToolBar")->hide();
@ -639,12 +639,12 @@ void KNutMainWindow::slotRefreshConnection(void) {
}
void KNutMainWindow::slotChangeRWVars ( QString ) {
void KNutMainWindow::slotChangeRWVars ( TQString ) {
}
void KNutMainWindow::closeEvent( QCloseEvent *e ){
void KNutMainWindow::closeEvent( TQCloseEvent *e ){
m_settingData->activatedMainWindow=false; //information about state of mainWindow
e->accept();
@ -669,7 +669,7 @@ void KNutMainWindow::slotCloseKnutClient (void) {
void KNutMainWindow::slotChangeUPS (const QString &name) {
void KNutMainWindow::slotChangeUPS (const TQString &name) {
emit UPSChanged (name);
}
@ -691,7 +691,7 @@ void KNutMainWindow::initStatusBar ( void ) {
// sets main message if statusbar
// nastavime hlavni hlaseni v statusbaru
// QString progressString("%v ");// += descrOfConnection;
// TQString progressString("%v ");// += descrOfConnection;
// progressString.append(descrOfConnection);
m_progressFormatString.append("%v ");
@ -713,22 +713,22 @@ void KNutMainWindow::initStatusBar ( void ) {
void KNutMainWindow::initStatusBarMessage ( void ) {
// loads data into comboBox
QStringList::iterator it;
TQStringList::iterator it;
for ( it = m_listKNutEvent->begin(); it != m_listKNutEvent->end(); ++it ) {
m_infoCombo->insertItem((*it));
}
statusBar()-> setItemAlignment(0,Qt::AlignHCenter|Qt::AlignVCenter);
statusBar()-> setItemAlignment(0,TQt::AlignHCenter|TQt::AlignVCenter);
m_infoCombo->setCurrentItem(m_infoCombo->count()-1);
}
void KNutMainWindow::initToolBar ( void ) {
QLabel *upsNazev = new QLabel ("UPS : ",toolBar("mainToolBar"));
TQLabel *upsNazev = new TQLabel ("UPS : ",toolBar("mainToolBar"));
// upsNazev is connected on toolBaar, dosn't need to call desctructor
toolBar ("mainToolBar")->insertWidget (0,upsNazev->sizeHint().width(),upsNazev);
toolBar ("mainToolBar")->insertCombo("",1,false, SIGNAL (activated (const QString &)),this,SLOT (slotChangeUPS (const QString &)));
toolBar ("mainToolBar")->insertWidget (0,upsNazev->tqsizeHint().width(),upsNazev);
toolBar ("mainToolBar")->insertCombo("",1,false, TQT_SIGNAL (activated (const TQString &)),TQT_TQOBJECT(this), TQT_SLOT (slotChangeUPS (const TQString &)));
// bude se pouze vybirat-------------------^^^
KComboBox *combo = toolBar("mainToolBar")->getCombo(1);
combo->clear();
@ -741,16 +741,16 @@ void KNutMainWindow::initToolBar ( void ) {
void KNutMainWindow::initAction ( void ) {
// KAction and KStdAction must be to make before command createGUI, function initToolBar is runed after create GUI
m_quit = KStdAction::quit (this, SLOT (slotCloseKnutClient()), actionCollection());
m_quit = KStdAction::quit (TQT_TQOBJECT(this), TQT_SLOT (slotCloseKnutClient()), actionCollection());
m_quit->setStatusText(i18n("Quits the application"));
m_preferencesUps = KStdAction::preferences (this, SLOT (slotPreferencesUps()), actionCollection(),"options_configure");
new KAction(i18n("&Showing UPS variables and commands"),0,this,SLOT(slotPrintUPSVars()),actionCollection(),"printupsvars");
new KAction(i18n("&Running instant commands"),0,this,SLOT(slotInstComms()),actionCollection(),"instcomms");
new KAction(i18n("Setting R&W variables"),0,this,SLOT(slotRWVars()),actionCollection(),"rwvars");
m_preferencesUps = KStdAction::preferences (TQT_TQOBJECT(this), TQT_SLOT (slotPreferencesUps()), actionCollection(),"options_configure");
new KAction(i18n("&Showing UPS variables and commands"),0,TQT_TQOBJECT(this), TQT_SLOT(slotPrintUPSVars()),actionCollection(),"printupsvars");
new KAction(i18n("&Running instant commands"),0,TQT_TQOBJECT(this), TQT_SLOT(slotInstComms()),actionCollection(),"instcomms");
new KAction(i18n("Setting R&W variables"),0,TQT_TQOBJECT(this), TQT_SLOT(slotRWVars()),actionCollection(),"rwvars");
///////////////////
// KStdAction::showToolbar (this, SLOT (slotShowToolBar()), actionCollection());
// KStdAction::showToolbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowToolBar()), actionCollection());
// setStandardToolBarMenuEnabled(true); since KDE version 3.1
// since version 3.1
@ -760,25 +760,25 @@ void KNutMainWindow::initAction ( void ) {
#if KDE_VERSION_MINOR >= 1
setStandardToolBarMenuEnabled(true);
#else
KStdAction::showToolbar (this, SLOT (slotShowToolBar()), actionCollection());
KStdAction::showToolbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowToolBar()), actionCollection());
#endif
#else
KStdAction::showToolbar (this, SLOT (slotShowToolBar()), actionCollection());
KStdAction::showToolbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowToolBar()), actionCollection());
#endif
#else
KStdAction::showToolbar (this, SLOT (slotShowToolBar()), actionCollection());
KStdAction::showToolbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowToolBar()), actionCollection());
#endif
#else
KStdAction::showToolbar (this, SLOT (slotShowToolBar()), actionCollection());
KStdAction::showToolbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowToolBar()), actionCollection());
#endif
KStdAction::showStatusbar (this, SLOT (slotShowStatusBar()), actionCollection());
KStdAction::showStatusbar (TQT_TQOBJECT(this), TQT_SLOT (slotShowStatusBar()), actionCollection());
m_descriptionAction = new KToggleAction(i18n("&Using descriptions"),0,this,SLOT(slotDescription()),actionCollection(),"use_description");
m_descriptionAction = new KToggleAction(i18n("&Using descriptions"),0,TQT_TQOBJECT(this), TQT_SLOT(slotDescription()),actionCollection(),"use_description");
KStdAction::keyBindings( this, SLOT(slotConfigureKeys()),actionCollection());
new KAction (i18n("Reconnect"),"reload",Key_F5,this,SLOT(slotRefreshConnection()),actionCollection(),"reconnect");
KStdAction::keyBindings( TQT_TQOBJECT(this), TQT_SLOT(slotConfigureKeys()),actionCollection());
new KAction (i18n("Reconnect"),"reload",Key_F5,TQT_TQOBJECT(this), TQT_SLOT(slotRefreshConnection()),actionCollection(),"reconnect");
}
void KNutMainWindow::initVars ( void ) {

@ -37,18 +37,18 @@
//#include <kprogress.h>
#include <qwidget.h>
#include <qdatetime.h>
//#include <qprogressbar.h>
#include <tqwidget.h>
#include <tqdatetime.h>
//#include <tqprogressbar.h>
class QString;
class QStringList;
class QLabel;
class QPalette;
class QSplitter;
class TQString;
class TQStringList;
class TQLabel;
class TQPalette;
class TQSplitter;
class KProgress;
//class QProgressBar;
//class TQProgressBar;
/**
@ -61,24 +61,25 @@ class KProgress;
*/
class KNutMainWindow : public KMainWindow {
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor - makes main window.
* Konstruktor - vytvori hlavni okno.
*
* @param tListKNutEvent pointer on QStringList contain text information about events (drop connection, switch ..)
* @param tListKNutEvent pointer on TQStringList contain text information about events (drop connection, switch ..)
* @param tActiveUpsInfo pointer on data about active UPS
* @param tSettingData pointer on basic data of program (background color, intercircle, pointers...,fonts..)
* @param tAnalogRecords pointer in class which works with data about UPS
* @param tListKNutEvent ukazatel na QStringList obsahuje textove udaje o udalostech (ztrata spojeni, prepnuti atd.)
* @param tListKNutEvent ukazatel na TQStringList obsahuje textove udaje o udalostech (ztrata spojeni, prepnuti atd.)
* @param tActiveUpsInfo ukazatel na data o aktivni UPS
* @param tSettingData ukazatel na zakladni data programu (barvy pozadi, mezikruzi, rucicky ... ,fonty atd )
* @param tAnalogRecords ukazatel na tridu ktera pracuje s daty o upsekach
*
* @since 0.3.1
**/
KNutMainWindow(QStringList* tListKNutEvent, KNutVarData::upsInfoDef* tActiveUpsInfo, KNutVarData::SettingDataDef* tSettingData, KNutUpsData* tUpsRecords, KNutVarData* tAnalogRecords, QWidget* parent=0,const char *name=0);
KNutMainWindow(TQStringList* tListKNutEvent, KNutVarData::upsInfoDef* tActiveUpsInfo, KNutVarData::SettingDataDef* tSettingData, KNutUpsData* tUpsRecords, KNutVarData* tAnalogRecords, TQWidget* tqparent=0,const char *name=0);
/**
* Destructor
@ -93,23 +94,23 @@ class KNutMainWindow : public KMainWindow {
*
* @since 0.1.2
**/
void repaintPanel(void);
void tqrepaintPanel(void);
/**
* Repaints analog panels based on their status.
* Prekresli analogove panely na zaklade jejich stavu.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
*
* @since 0.3.1
**/
void repaintAnalogs ( bool run = true);
void tqrepaintAnalogs ( bool run = true);
/**
* Da prikaz k prekresleni analogovych panelu, hlavniho panelu a nastavi jejich hodnoty na
* zaklade XFer hodnot.
* Give command to repaint analog panels, main panel and sets their values based on XFer values
* @param run = TRUE makes immediately repaint of analog panels
* Give command to tqrepaint analog panels, main panel and sets their values based on XFer values
* @param run = TRUE makes immediately tqrepaint of analog panels
*
* @since 0.3.1
**/
@ -127,7 +128,7 @@ class KNutMainWindow : public KMainWindow {
*
* @since 0.1
**/
void addComboStatusItem (const QString text, const QString name = QString::null);
void addComboStatusItem (const TQString text, const TQString name = TQString());
/**
* Rebuilds main panel based on value changeSetting.
@ -151,7 +152,7 @@ class KNutMainWindow : public KMainWindow {
*
* @since 0.1
**/
void setCombo(QString name);
void setCombo(TQString name);
/**
* Nastavi vsechny panely na nulovo hodnotu
@ -207,7 +208,7 @@ class KNutMainWindow : public KMainWindow {
*
* @since 0.1
**/
void UPSChanged (QString);
void UPSChanged (TQString);
/**
* This signal is emited when request for viewing preferences window was ordered from menu.
@ -270,7 +271,7 @@ class KNutMainWindow : public KMainWindow {
void endApplication();
protected:
void closeEvent( QCloseEvent *e );
void closeEvent( TQCloseEvent *e );
@ -282,9 +283,9 @@ class KNutMainWindow : public KMainWindow {
void slotPrintUPSVars(void);
void slotInstComms(void);
void slotRWVars(void);
void slotChangeRWVars ( QString );
void slotChangeRWVars ( TQString );
void slotCloseKnutClient (void);
void slotChangeUPS (const QString &name);
void slotChangeUPS (const TQString &name);
void slotConfigureKeys(void);
void slotRefreshConnection(void);
@ -307,7 +308,7 @@ class KNutMainWindow : public KMainWindow {
/************** private vars **************************/
// Nazvy promenych UPS cislovany jsou od 0 do 10 "NONE", "UTILITY", "BATTPCT", "UPSTEMP", "ACFREQ", "LOADPCT", "AMBTEMP", "AMBHUMID", "BATTVOLT", "OUTVOLT", "CURRENT"
QStringList* m_listKNutEvent;
TQStringList* m_listKNutEvent;
KNutVarData::upsInfoDef* m_activeUpsInfo; // values for selected ups / hodnoty pro vybrane ups
KNutVarData::SettingDataDef* m_settingData; // v teto strukture jsou ulozeny promene ktere nastavuji konfiguraci
KNutUpsData* m_upsRecords;
@ -319,27 +320,27 @@ class KNutMainWindow : public KMainWindow {
KToggleAction *m_descriptionAction;
QLabel* m_area; // main arrea, on its will server main panel and analog panels
TQLabel* m_area; // main arrea, on its will server main panel and analog panels
// hlavni plocha na ni umistime panel a analogove ukazatele
QSplitter* m_mainSplit;
TQSplitter* m_mainSplit;
KNutFrontPanel* m_frontPanel;
// nactene hodnoty promenych UPS, tyto promene se ctou jen jednou
// readly values of UPS's variables, these varieables is read only once
QString m_manufacturer, m_upsModel, m_serial, m_firmrev;
TQString m_manufacturer, m_upsModel, m_serial, m_firmrev;
bool m_existLowHighXfer;
float m_lowXfer, m_highXfer;
QPalette m_mainPalette, m_areaPalette, m_mPanelPalette, m_aPanelPalette;
TQPalette m_mainPalette, m_areaPalette, m_mPanelPalette, m_aPanelPalette;
// Combo a pomocne struktury pro dolni radku
// Combo a potqmocne struktury pro dolni radku
// Combo and help structures for bottom line.
KComboBox *m_infoCombo;
KNutPanelMeter* m_panelMeter;
KProgress* m_connectProggresBar;
QString m_progressFormatString;
TQString m_progressFormatString;
};
#endif

@ -19,14 +19,14 @@
#include <kglobal.h>
#include <kiconloader.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qtimer.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqframe.h>
#include <tqpixmap.h>
#include <tqtimer.h>
KNutMessage::KNutMessage(const QString messageText, const typeOfMessage type, const long int timeValidity, QWidget *parent, const char *name) : KDialogBase(Plain, "Messages",Ok,Ok, parent, name, false, false) {
KNutMessage::KNutMessage(const TQString messageText, const typeOfMessage type, const long int timeValidity, TQWidget *tqparent, const char *name) : KDialogBase(Plain, "Messages",Ok,Ok, tqparent, name, false, false) {
setCaption("KNutClient");
@ -45,25 +45,25 @@ KNutMessage::KNutMessage(const QString messageText, const typeOfMessage type, co
break;
}
QFrame *page = plainPage();
TQFrame *page = plainPage();
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint(), "setTopLayout" );
QHBoxLayout *setMessageLayout = new QHBoxLayout( setTopLayout, spacingHint(), "setMessageLayout" );
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint(), "setTopLayout" );
TQHBoxLayout *setMessageLayout = new TQHBoxLayout( setTopLayout, spacingHint(), "setMessageLayout" );
QLabel* picture = new QLabel (page);
QLabel* text = new QLabel (messageText,page);
TQLabel* picture = new TQLabel (page);
TQLabel* text = new TQLabel (messageText,page);
picture->setPixmap(m_ret);
setMessageLayout->addWidget(picture);
setMessageLayout->addWidget(text);
if (timeValidity > 0 ) {
m_messageTimer = new QTimer(this);
m_messageTimer = new TQTimer(this);
if (timeValidity > maxTime)
m_messageTimer->start(maxTime*1000);
else
m_messageTimer->start(timeValidity*1000);
connect (m_messageTimer,SIGNAL(timeout()),this,SLOT(timeout()));
connect (m_messageTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(timeout()));
disableResize();
}
}
@ -85,7 +85,7 @@ void KNutMessage::slotOk (void) {
emit endMessage();
}
void KNutMessage::moveEvent ( QMoveEvent * e) {
void KNutMessage::moveEvent ( TQMoveEvent * e) {
KDialogBase::moveEvent (e);
emit messageMoved(x(),y());

@ -20,8 +20,8 @@
#include <kdialogbase.h>
//#include <qpixmap.h>
//#include <qtimer.h>
//#include <tqpixmap.h>
//#include <tqtimer.h>
/**
@ -29,8 +29,8 @@
*/
class QTimer;
class QPixmap;
class TQTimer;
class TQPixmap;
/**
* Tato trida zobrazi okno zpravy v modeless rezimu.
@ -42,6 +42,7 @@ class QPixmap;
*/
class KNutMessage : public KDialogBase {
Q_OBJECT
TQ_OBJECT
public:
enum typeOfMessage {
@ -63,7 +64,7 @@ enum typeOfMessage {
* @param timeValidity maximalni doba zobrazeni okna, je-li rovna nule je neomezena.
* @since 0.2
*/
KNutMessage(const QString messageText, const typeOfMessage type=infoMess, const long int timeValidity=0, QWidget *parent=0, const char *name=0);
KNutMessage(const TQString messageText, const typeOfMessage type=infoMess, const long int timeValidity=0, TQWidget *tqparent=0, const char *name=0);
/**
* Destruktor.
@ -114,11 +115,11 @@ private:
// max rime for message window is 3600 sec or 60 min
static const int maxTime = 3600;
QPixmap m_ret;
QTimer* m_messageTimer;
TQPixmap m_ret;
TQTimer* m_messageTimer;
protected:
void moveEvent ( QMoveEvent * e);
void moveEvent ( TQMoveEvent * e);
};

@ -16,9 +16,9 @@
***************************************************************************/
#include "knutmessagemanager.h"
#include <qstring.h>
#include <tqstring.h>
KNutMessageManager::KNutMessageManager( QObject *parent, const char *name) : QObject (parent, name) {
KNutMessageManager::KNutMessageManager( TQObject *tqparent, const char *name) : TQObject (tqparent, name) {
//qDebug("KNutMessageManager::KNutMessageManager");
@ -39,16 +39,16 @@ KNutMessageManager::~KNutMessageManager(){
void KNutMessageManager::deleteMessage (void) {
if (m_myMess) {
disconnect (m_myMess,SIGNAL(finished()),this,SLOT(slotFinishedMessage()));
disconnect (m_myMess,SIGNAL(endMessage()),this,SLOT(slotEndMessage()));
disconnect (m_myMess,SIGNAL(messageMoved(int,int)),this,SLOT(slotMessageMoved(int,int)));
disconnect (m_myMess,TQT_SIGNAL(finished()),this,TQT_SLOT(slotFinishedMessage()));
disconnect (m_myMess,TQT_SIGNAL(endMessage()),this,TQT_SLOT(slotEndMessage()));
disconnect (m_myMess,TQT_SIGNAL(messageMoved(int,int)),this,TQT_SLOT(slotMessageMoved(int,int)));
m_myMess->hide();
delete m_myMess;
m_myMess = 0;
}
}
void KNutMessageManager::addMessage (QString text, knc::LevelOfMessage messageLevel, bool useInfoIcon, bool useShortTimeOfValidity) {
void KNutMessageManager::addMessage (TQString text, knc::LevelOfMessage messageLevel, bool useInfoIcon, bool useShortTimeOfValidity) {
long int timeOfMessageValidity;
if (useShortTimeOfValidity) timeOfMessageValidity = ShortTimeOfValidity;
@ -82,18 +82,18 @@ long int timeOfMessageValidity;
}
m_myMess->show();
connect (m_myMess,SIGNAL(finished()),this,SLOT(slotFinishedMessage()));
connect (m_myMess,SIGNAL(endMessage()),this,SLOT(slotEndMessage()));
connect (m_myMess,SIGNAL(messageMoved(int,int)),this,SLOT(slotMessageMoved(int,int)));
connect (m_myMess,TQT_SIGNAL(finished()),this,TQT_SLOT(slotFinishedMessage()));
connect (m_myMess,TQT_SIGNAL(endMessage()),this,TQT_SLOT(slotEndMessage()));
connect (m_myMess,TQT_SIGNAL(messageMoved(int,int)),this,TQT_SLOT(slotMessageMoved(int,int)));
}
void KNutMessageManager::slotFinishedMessage (void) {
if (m_myMess) {
disconnect (m_myMess,SIGNAL(finished()),this,SLOT(slotFinishedMessage()));
disconnect (m_myMess,SIGNAL(endMessage()),this,SLOT(slotEndMessage()));
disconnect (m_myMess,SIGNAL(messageMoved(int,int)),this,SLOT(slotMessageMoved(int,int)));
disconnect (m_myMess,TQT_SIGNAL(finished()),this,TQT_SLOT(slotFinishedMessage()));
disconnect (m_myMess,TQT_SIGNAL(endMessage()),this,TQT_SLOT(slotEndMessage()));
disconnect (m_myMess,TQT_SIGNAL(messageMoved(int,int)),this,TQT_SLOT(slotMessageMoved(int,int)));
m_myMess->hide();
m_myMess->deleteLater();
m_myMess=0;

@ -20,7 +20,7 @@
#include "knutmessage.h"
#include <qobject.h>
#include <tqobject.h>
/**
*@author Daniel Prynych
@ -33,12 +33,12 @@ enum LevelOfMessage {
lowWarningLevel, // OVER,
warningLevel, // OB ..
errorLevel, // connection error
criticalLevel // Status BL, OFF
criticalLevel // tqStatus BL, OFF
};
}
class QString;
class TQString;
/**
* Tato trida slouzi pro ovladani vyskakovacich oken (pop-up)
@ -48,15 +48,16 @@ class QString;
* @short window message manager
* @version 0.1
*/
class KNutMessageManager : public QObject {
class KNutMessageManager : public TQObject {
Q_OBJECT
TQ_OBJECT
public:
/**
* Konstruktor - vytvori instanci tridy.
*
* @since 0.1
*/
KNutMessageManager( QObject *parent=0, const char *name=0);
KNutMessageManager( TQObject *tqparent=0, const char *name=0);
/**
* Destruktor.
@ -77,7 +78,7 @@ class KNutMessageManager : public QObject {
*
* @since 0.2
**/
void addMessage (QString text, knc::LevelOfMessage messageLevel = knc::infoLevel, bool useInfoIcon = false, bool useShortTimeOfValidity = false);
void addMessage (TQString text, knc::LevelOfMessage messageLevel = knc::infoLevel, bool useInfoIcon = false, bool useShortTimeOfValidity = false);
/**

@ -17,10 +17,10 @@
#include "knutnet.h"
#include <qtextstream.h>
#include <qstring.h>
#include <qcstring.h>
#include <qtimer.h>
#include <tqtextstream.h>
#include <tqstring.h>
#include <tqcstring.h>
#include <tqtimer.h>
#include <unistd.h> // for function sleep
@ -31,12 +31,12 @@
/****** CONSTS ***********/
//const Q_ULONG rBufferLen = 1024;
//const TQ_ULONG rBufferLen = 1024;
KNutNet::KNutNet (const QString upsAddress, const QString upsName, const unsigned short port, unsigned int countRepeat, const unsigned int delay)
: QObject(), m_upsAddress(upsAddress), m_upsName(upsName), m_countRepeat(countRepeat), m_port(port), m_delay(delay) {
KNutNet::KNutNet (const TQString upsAddress, const TQString upsName, const unsigned short port, unsigned int countRepeat, const unsigned int delay)
: TQObject(), m_upsAddress(upsAddress), m_upsName(upsName), m_countRepeat(countRepeat), m_port(port), m_delay(delay) {
//qDebug ("KNutNet::KNutNet");
@ -52,22 +52,22 @@ KNutNet::KNutNet (const QString upsAddress, const QString upsName, const unsigne
m_description = false; // popis neni natazen - description is not loaded
m_unConnectTimer = new QTimer( this );
connect( m_unConnectTimer, SIGNAL(timeout()), this, SLOT(slotTimerReconnect()) );
m_unConnectTimer = new TQTimer( this );
connect( m_unConnectTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimerReconnect()) );
m_error = NoError;
m_commandSocket = new QSocket( this );
connect( m_commandSocket, SIGNAL( hostFound()),this, SLOT( slotHostFound()));
connect( m_commandSocket, SIGNAL( connected()),this,SLOT( slotConnected()));
connect( m_commandSocket, SIGNAL( connectionClosed()),this, SLOT( slotConnectionClosed()));
connect( m_commandSocket, SIGNAL( error(int)),this, SLOT( slotConnectionError(int)));
m_commandSocket = new TQSocket( this );
connect( m_commandSocket, TQT_SIGNAL( hostFound()),this, TQT_SLOT( slotHostFound()));
connect( m_commandSocket, TQT_SIGNAL( connected()),this,TQT_SLOT( slotConnected()));
connect( m_commandSocket, TQT_SIGNAL( connectionClosed()),this, TQT_SLOT( slotConnectionClosed()));
connect( m_commandSocket, TQT_SIGNAL( error(int)),this, TQT_SLOT( slotConnectionError(int)));
}
KNutNet::~KNutNet(){
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
close(); // close connetion when is existed
while (m_state == Closing ) {
@ -79,8 +79,8 @@ KNutNet::~KNutNet(){
void KNutNet::close (void) {
// std::cout << "--KNutNet::close" << std::endl;
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
m_unConnectTimer->stop();
deleteVars();
@ -96,8 +96,8 @@ void KNutNet::close (void) {
m_commandSocket->clearPendingData (); // data in output buffer will be errased
m_commandSocket->close(); // closes the socket
if ( m_commandSocket->state() == QSocket::Closing ) {
connect( m_commandSocket, SIGNAL(delayedCloseFinished()),this,SLOT(slotClosed()) );
if ( m_commandSocket->state() == TQSocket::Closing ) {
connect( m_commandSocket, TQT_SIGNAL(delayedCloseFinished()),this,TQT_SLOT(slotClosed()) );
}
else {
slotClosed();
@ -107,15 +107,15 @@ void KNutNet::close (void) {
void KNutNet::slotClosed (void) {
disconnect( m_commandSocket,SIGNAL(delayedCloseFinished()),this, SLOT(slotClosed()) );
disconnect( m_commandSocket,TQT_SIGNAL(delayedCloseFinished()),this, TQT_SLOT(slotClosed()) );
m_state = Idle;
}
void KNutNet::open (void) {
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
if ((m_state == Connected) || (m_state == Connecting)) close(); // close connetion when is existed
else {
@ -124,7 +124,7 @@ void KNutNet::open (void) {
}
}
if (m_upsAddress != "") {
if ( m_commandSocket->state() != QSocket::Connecting ) {
if ( m_commandSocket->state() != TQSocket::Connecting ) {
m_firstConnect=true;
m_numberConnection=0;
m_state = HostLookup;
@ -136,7 +136,7 @@ void KNutNet::open (void) {
}
void KNutNet::newUPS (const QString upsAddress, const QString upsName, const unsigned short port) {
void KNutNet::newUPS (const TQString upsAddress, const TQString upsName, const unsigned short port) {
if ((m_state == Connected) || (m_state == Connecting)) {
close();
@ -201,7 +201,7 @@ int KNutNet::getUpsVars ( void) {
default:
return 0;
}
if ( readStatus() != KNutNet::WAIT) return returnValue;
if ( readtqStatus() != KNutNet::WAIT) return returnValue;
countWaitRevision--;
if (countWaitRevision) sleep (2);
}
@ -256,11 +256,11 @@ int KNutNet::getDescription (bool always) {
}
int KNutNet::instantCommand (const QString command, const QString userName, const QString password, const bool onlyCommand) {
int KNutNet::instantCommand (const TQString command, const TQString userName, const TQString password, const bool onlyCommand) {
m_error=0; // vynulujeme chyby
if (m_state == Connected) {
QString outBuffer;
TQString outBuffer;
// funkce sendComm sama mastavi promenou error
if (onlyCommand) {
@ -301,11 +301,11 @@ int KNutNet::instantCommand (const QString command, const QString userName, cons
}
int KNutNet::setVariable (const QString variable, const QString value, const QString userName, const QString password, const bool onlyVariable) {
int KNutNet::setVariable (const TQString variable, const TQString value, const TQString userName, const TQString password, const bool onlyVariable) {
m_error=0; // vynulujeme chyby
if (m_state == Connected) {
QString outBuffer;
QString setCommand;
TQString outBuffer;
TQString setCommand;
switch (m_nutProtocol) {
case 1: setCommand = "SET";
@ -387,10 +387,10 @@ int KNutNet::readIComm (const int seqNumber, upsICommDef& upsIComm) {
}
int KNutNet::readVars (const QString name, struct upsVarDef& allVar) {
int KNutNet::readVars (const TQString name, struct upsVarDef& allVar) {
m_error =0;
if (m_state == Connected) {
QValueVector<upsVarDef>::const_iterator it;
TQValueVector<upsVarDef>::const_iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsVarName == name) {
allVar = (*it);
@ -408,7 +408,7 @@ int KNutNet::readVars (const QString name, struct upsVarDef& allVar) {
m_error =0;
if (m_state == Connected) {
int n = 1;
QValueVector<upsVarDef>::const_iterator it;
TQValueVector<upsVarDef>::const_iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((typVar== AllVars) || ((typVar==ROVars) && ((*it).upsVarType)) ||
@ -427,11 +427,11 @@ int KNutNet::readVars (const QString name, struct upsVarDef& allVar) {
}
QString KNutNet::readStringVar (const QString name) {
TQString KNutNet::readStringVar (const TQString name) {
m_error =0;
if (m_state == Connected) {
QValueVector<upsVarDef>::const_iterator it;
TQValueVector<upsVarDef>::const_iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsVarName == name) return (*it).upsValue;
}
@ -442,18 +442,18 @@ QString KNutNet::readStringVar (const QString name) {
}
QString KNutNet::readEnumValueVar (const QString name, const int valueNumber) {
TQString KNutNet::readEnumValueVar (const TQString name, const int valueNumber) {
m_error =0;
if (m_state == Connected) {
// #if defined (KDE_VERSION_MAJOR)
// #if KDE_VERSION_MAJOR >= 3
QValueVector<upsVarDef>::const_iterator it;
TQValueVector<upsVarDef>::const_iterator it;
// #else
// QValueList<upsVar>::ConstIterator it;
// TQValueList<upsVar>::ConstIterator it;
// #endif
// #else
// QValueList<upsVar>::ConstIterator it;
// TQValueList<upsVar>::ConstIterator it;
// #endif
@ -474,19 +474,19 @@ QString KNutNet::readEnumValueVar (const QString name, const int valueNumber) {
}
int KNutNet::readStatus(void) {
int KNutNet::readtqStatus(void) {
m_error=0;
return m_upsStatusVar;
}
int KNutNet::setActivate ( const QString name ) {
int KNutNet::setActivate ( const TQString name ) {
return activate (name,true);
}
int KNutNet::unSetActivate ( const QString name ) {
int KNutNet::unSetActivate ( const TQString name ) {
return activate (name,false);
}
@ -496,11 +496,11 @@ int KNutNet::unSetActivateAll ( void ) {
}
int KNutNet::existName ( const QString name ) {
int KNutNet::existName ( const TQString name ) {
m_error =0;
if (m_state == Connected) {
QValueVector<upsVarDef>::const_iterator it;
TQValueVector<upsVarDef>::const_iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsVarName == name) return 0;
}
@ -518,8 +518,8 @@ int KNutNet::existName ( const QString name ) {
int KNutNet::version (int countRepeat, const int delay) {
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
m_error =0;
do {
@ -528,12 +528,12 @@ int KNutNet::version (int countRepeat, const int delay) {
outBuffer=outBuffer.stripWhiteSpace ();
if (outBuffer.length() > 0) {
outBuffer = outBuffer.mid(outBuffer.find("upsd")+4);
int n = outBuffer.find(".");
outBuffer = outBuffer.mid(outBuffer.tqfind("upsd")+4);
int n = outBuffer.tqfind(".");
if (n > 0) {
QString firstNumber= outBuffer.left(n);
QString secondNumber= outBuffer.mid(n+1);
int n = secondNumber.find(".");
TQString firstNumber= outBuffer.left(n);
TQString secondNumber= outBuffer.mid(n+1);
int n = secondNumber.tqfind(".");
if (n > 0) {
bool ok;
secondNumber = secondNumber.left(n);
@ -567,20 +567,20 @@ int KNutNet::version (int countRepeat, const int delay) {
int KNutNet::getFirstUpsName (QString& firstUpsName) {
QCString inBuffer;
QString outBuffer;
QString varOutBuffer;
int KNutNet::getFirstUpsName (TQString& firstUpsName) {
TQCString inBuffer;
TQString outBuffer;
TQString varOutBuffer;
int lenString;
m_error=0;
inBuffer = "LIST UPS\n";
if (!(m_error=getUpsData (inBuffer,outBuffer,"END LIST UPS"))) {
QString inLine, upsNameRet, varName, value;
TQString inLine, upsNameRet, varName, value;
int key, typeValue;
bool beginList = false;
QTextIStream varInputStream(&outBuffer);
TQTextIStream varInputStream(&outBuffer);
while (!(inLine = varInputStream.readLine()).isNull()) {
key = parseLine (inLine, upsNameRet, varName, value, typeValue, lenString);
switch (key) {
@ -612,9 +612,9 @@ int KNutNet::getFirstUpsName (QString& firstUpsName) {
int KNutNet::setKey (const QString line) {
int KNutNet::setKey (const TQString line) {
QString myLine=line.stripWhiteSpace();
TQString myLine=line.stripWhiteSpace();
if (myLine == "OK") return OK;
if (myLine == "ERR") return ERR;
if (myLine == "BEGIN") return BEGIN;
@ -633,16 +633,16 @@ int KNutNet::setKey (const QString line) {
return NONE;
}
QString KNutNet::parseValue (const QString line) {
TQString KNutNet::parseValue (const TQString line) {
if (line.isEmpty()) return "";
if (line[0] != "\"") {
if ((m_posChar=line.find(' ')) == -1) return line;
if ((m_posChar=line.tqfind(' ')) == -1) return line;
else return line.left(m_posChar+1);
}
else {
int len = line.length();
QString outString = "";
TQString outString = "";
for (int i=1; i < len; i++) {
if ( line[i] == "\\") {
if ((i+1) <len) {
@ -665,18 +665,18 @@ QString KNutNet::parseValue (const QString line) {
return "";
}
int KNutNet::parseTypeValue (QString line, int& lenString ) {
int KNutNet::parseTypeValue (TQString line, int& lenString ) {
int ret=0;
QString word;
TQString word;
lenString = 0;
if (line.isEmpty()) return 0;
QTextIStream inputStream(&line);
TQTextIStream inputStream(&line);
while (!inputStream.atEnd()) {
inputStream >> word;
if (word == "RW") ret += RW_FLAG;
if (word == "ENUM") ret += ENUM_FLAG;
if (word.find("STRING:") != -1) {
if (word.tqfind("STRING:") != -1) {
word = word.mid(7);
ret += STRING_FLAG;
lenString = word.toInt();
@ -686,9 +686,9 @@ int KNutNet::parseTypeValue (QString line, int& lenString ) {
}
int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QString& value, int& typeValue, int& lenString) {
int KNutNet::parseLine(TQString& line, TQString& upsName ,TQString& varName, TQString& value, int& typeValue, int& lenString) {
int posChar;
QString word1, word2, word3;
TQString word1, word2, word3;
int key1, key2, key3;
line = line.stripWhiteSpace();
@ -700,7 +700,7 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
if (line.isEmpty()) return NONE;
if ((posChar=line.find(' ')) == -1) {
if ((posChar=line.tqfind(' ')) == -1) {
if (setKey(line) == OK) return OK;
else return NONE;
}
@ -718,7 +718,7 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
value = parseValue(line);
return key1;
default:
if ((posChar=line.find(' ')) == -1) return NONE;
if ((posChar=line.tqfind(' ')) == -1) return NONE;
word2 = line.left(posChar);
key2 = setKey( word2);
line = line.mid(posChar+1);
@ -740,7 +740,7 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
return key1;
}
if ((posChar=line.find(' ')) == -1) return NONE;
if ((posChar=line.tqfind(' ')) == -1) return NONE;
word3 = line.left(posChar);
key3 = setKey( word3);
@ -787,7 +787,7 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
return BEGIN_LIST_CMD;
}
if (key3 == ENUM) {
if ((posChar=line.find(' ')) == -1) return NONE;
if ((posChar=line.tqfind(' ')) == -1) return NONE;
upsName = line.left(posChar);
line=line.mid(posChar+1);
varName = line.stripWhiteSpace();
@ -809,7 +809,7 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
return END_LIST_CMD;
}
if (key3 == ENUM) {
if ((posChar=line.find(' ')) == -1) return NONE;
if ((posChar=line.tqfind(' ')) == -1) return NONE;
upsName = line.left(posChar);
line=line.mid(posChar+1);
varName = line.stripWhiteSpace();
@ -824,25 +824,25 @@ int KNutNet::parseLine(QString& line, QString& upsName ,QString& varName, QStrin
}
int KNutNet::newDescription (const QCString inBuffer, QString& upsDescription) {
QString outBuffer;
int KNutNet::newDescription (const TQCString inBuffer, TQString& upsDescription) {
TQString outBuffer;
if (!(m_error=getUpsData (inBuffer,outBuffer))) {
outBuffer=outBuffer.stripWhiteSpace ();
QString word1, word2, word3;
TQString word1, word2, word3;
if ((m_posChar = outBuffer.find(' ')) == -1)
if ((m_posChar = outBuffer.tqfind(' ')) == -1)
word1 = outBuffer;
else {
word1 = outBuffer.left(m_posChar);
word2 = outBuffer.mid(m_posChar+1);
}
if (word1 == "DESC") {
if ((m_posChar = word2.find('\"')) == -1) word3="";
if ((m_posChar = word2.tqfind('\"')) == -1) word3="";
else
{
word3 = word2.mid(m_posChar+1);
if ((m_posChar = word3.find('\"')) != -1) word3=word3.left(m_posChar);
if ((m_posChar = word3.tqfind('\"')) != -1) word3=word3.left(m_posChar);
}
if (!word3.isEmpty()) upsDescription=word3;
}
@ -857,9 +857,9 @@ int KNutNet::newDescription (const QCString inBuffer, QString& upsDescription)
void KNutNet::cleanConnecting (void) {
Q_ULONG rMaxLen;
QCString recvBuffer(rBufferLen);
Q_LONG lengthInputData;
TQ_ULONG rMaxLen;
TQCString recvBuffer(rBufferLen);
TQ_LONG lengthInputData;
int n = 0;
while (m_commandSocket->bytesAvailable() > 0) {
@ -876,15 +876,15 @@ void KNutNet::cleanConnecting (void) {
}
int KNutNet::getUpsData (const QCString sBuffer, QString& rBuffer, const QCString endString) {
int KNutNet::getUpsData (const TQCString sBuffer, TQString& rBuffer, const TQCString endString) {
//rbufferLen a sbufferLen are maximal value of buffers
QCString recvBuffer(rBufferLen);
Q_LONG lengthInputData;
Q_ULONG dataAvailable;
TQCString recvBuffer(rBufferLen);
TQ_LONG lengthInputData;
TQ_ULONG dataAvailable;
QMutexLocker getUpsDataLocker( &m_getUpsDataMutex );
TQMutexLocker getUpsDataLocker( &m_getUpsDataMutex );
cleanConnecting();
// first we clean input TCP buffer
@ -911,8 +911,8 @@ int KNutNet::getUpsData (const QCString sBuffer, QString& rBuffer, const QCStrin
// recvBuffer[lengthInputData]='\0';
//Problem is that
//for 64bit environment is Q_LONG defined like _int64 and
//for other environments is Q_LONG defined like long
//for 64bit environment is TQ_LONG defined like _int64 and
//for other environments is TQ_LONG defined like long
@ -920,14 +920,14 @@ int KNutNet::getUpsData (const QCString sBuffer, QString& rBuffer, const QCStrin
rBuffer.append(recvBuffer.data()); // adds reading data to main input buffer
if (endString.isEmpty()) endRecv = false;
else {
if (recvBuffer.findRev(endString) == -1) {
if (recvBuffer.tqfindRev(endString.data()) == -1) {
//doesn't find right end of input data
if (m_commandSocket->bytesAvailable() == 0) m_commandSocket->waitForMore(1000);
if (m_commandSocket->bytesAvailable() > 0) endRecv=true; // makes other cyckle og while
else endRecv=false;
}
//finds right end of input data
else endRecv = false; // we have found what we want to find
else endRecv = false; // we have found what we want to tqfind
}
} while (endRecv);
return 0; // all is OK
@ -935,8 +935,8 @@ int KNutNet::getUpsData (const QCString sBuffer, QString& rBuffer, const QCStrin
void KNutNet::setRWVars (const QString varName, const bool valueType, const int varMax, QValueVector<QString>* enumValues) {
QValueVector<upsVarDef>::iterator it;
void KNutNet::setRWVars (const TQString varName, const bool valueType, const int varMax, TQValueVector<TQString>* enumValues) {
TQValueVector<upsVarDef>::iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsVarName == varName) {
@ -949,7 +949,7 @@ int KNutNet::getUpsData (const QCString sBuffer, QString& rBuffer, const QCStrin
}
}
void KNutNet::upsSetType (struct upsVarDef& upsVar, const QString name, const QString value) {
void KNutNet::upsSetType (struct upsVarDef& upsVar, const TQString name, const TQString value) {
if (((m_nutVariables = 2) && (name == "STATUS")) || ((m_nutVariables = 2) && (name == "ups.status")))
upsVar.upsVarActivate=true;
@ -968,12 +968,12 @@ void KNutNet::upsSetType (struct upsVarDef& upsVar, const QString name, const QS
void KNutNet::deleteVars (void) {
// #if defined (KDE_VERSION_MAJOR)
// #if KDE_VERSION_MAJOR >= 3
QValueVector<upsVarDef>::iterator it;
TQValueVector<upsVarDef>::iterator it;
// #else
// QValueList<upsVar>::Iterator it;
// TQValueList<upsVar>::Iterator it;
// #endif
// #else
// QValueList<upsVar>::Iterator it;
// TQValueList<upsVar>::Iterator it;
// #endif
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsEnumValues != 0) {
@ -985,10 +985,10 @@ void KNutNet::deleteVars (void) {
m_listIComms.clear();
}
void KNutNet::genStatusFlags (QString value) {
void KNutNet::genStatusFlags (TQString value) {
m_upsStatusVar = 0;
QTextIStream inputStream(&value);
QString word;
TQTextIStream inputStream(&value);
TQString word;
while (!inputStream.atEnd()) {
inputStream >> word;
if (word == "OFF") m_upsStatusVar +=OFF;
@ -1016,11 +1016,11 @@ void KNutNet::genStatusFlags (QString value) {
int KNutNet::getDescription1 (bool always) {
if (always || (! m_description)) {
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
QValueVector<upsVarDef>::iterator itv;
QValueVector<upsICommDef>::iterator itc;
TQValueVector<upsVarDef>::iterator itv;
TQValueVector<upsICommDef>::iterator itc;
for (itv = m_listVars.begin(); itv != m_listVars.end(); itv++) {
//nacteme promenou
inBuffer = "VARDESC " + (*itv).upsVarName + "\n";
@ -1050,16 +1050,16 @@ int KNutNet::getDescription1 (bool always) {
int KNutNet::getDescription2 (bool always) {
if (always || (! m_description)) {
QCString inBuffer;
QString outBuffer;
QString upsNameRet;
QString varName;
QString value;
TQCString inBuffer;
TQString outBuffer;
TQString upsNameRet;
TQString varName;
TQString value;
int typeValue;
int lenString;
QValueVector<upsVarDef>::iterator itv;
QValueVector<upsICommDef>::iterator itc;
TQValueVector<upsVarDef>::iterator itv;
TQValueVector<upsICommDef>::iterator itc;
for (itv = m_listVars.begin(); itv != m_listVars.end(); itv++) {
//nacteme promenou
inBuffer = "GET DESC " + m_upsName + " " + (*itv).upsVarName+"\n";
@ -1127,9 +1127,9 @@ int KNutNet::getDescription2 (bool always) {
int KNutNet::getUpsVars1 ( void) {
// getUpsVars nacte promene a jejich typ
// vraci kod chyby nebo 0 pokud je vse v poradku
QCString inBuffer;
QString outBuffer;
QString varOutBuffer;
TQCString inBuffer;
TQString outBuffer;
TQString varOutBuffer;
upsVarDef upsVar;
upsICommDef upsIComm;
@ -1145,8 +1145,8 @@ int KNutNet::getUpsVars1 ( void) {
outBuffer=outBuffer.stripWhiteSpace ();
if (outBuffer.length() > 0) {
// precteme data
QTextIStream inputStream(&outBuffer);
QString word;
TQTextIStream inputStream(&outBuffer);
TQString word;
int count =1 ;
while (!inputStream.atEnd()) {
inputStream >> word;
@ -1193,8 +1193,8 @@ int KNutNet::getUpsVars1 ( void) {
outBuffer=outBuffer.stripWhiteSpace();
if (!outBuffer.isEmpty()) {
// precteme data
QTextIStream inputStream(&outBuffer);
QString word;
TQTextIStream inputStream(&outBuffer);
TQString word;
int count =1 ;
bool valueType;
int varMax;
@ -1229,8 +1229,8 @@ int KNutNet::getUpsVars1 ( void) {
if (!(m_error=getUpsData (inBuffer,varOutBuffer))) {
varOutBuffer=varOutBuffer.stripWhiteSpace();
if ( !outBuffer.isEmpty() ) {
QTextIStream varInputStream(&varOutBuffer);
QString word1, word2, word3;
TQTextIStream varInputStream(&varOutBuffer);
TQString word1, word2, word3;
varInputStream >> word1;
varInputStream >> word2;
varInputStream >> word3;
@ -1267,7 +1267,7 @@ int KNutNet::getUpsVars1 ( void) {
else return m_error;
// ********** ENUM / STRING ******************
QValueVector<QString>* enumString=0;
TQValueVector<TQString>* enumString=0;
if (!valueType) {
// nacteme enum hodnoty
inBuffer="ENUM ";
@ -1281,26 +1281,26 @@ int KNutNet::getUpsVars1 ( void) {
if (!(m_error=getUpsData (inBuffer,varOutBuffer,"END\n"))) {
// varOutBuffer.stripWhiteSpace(); nemuze provest protoze bychom si odstranili konce radek
if (!varOutBuffer.isEmpty()) {
QString inLine, word1, word2;
QTextIStream varInputStream(&varOutBuffer);
TQString inLine, word1, word2;
TQTextIStream varInputStream(&varOutBuffer);
int inCountLine=1;
while (!(inLine = varInputStream.readLine()).isNull()) {
inLine=inLine.stripWhiteSpace();
if ((m_posChar=inLine.find(' ')) == -1) word1=inLine;
if ((m_posChar=inLine.tqfind(' ')) == -1) word1=inLine;
else {
word1=inLine.left(m_posChar);
inLine = inLine.mid(m_posChar+1);
}
if (word1.isEmpty()) { m_error = UnknownFormat; return m_error; }
if (inCountLine == 1) {
if ((m_posChar=inLine.find(' ')) == -1) word2=inLine;
if ((m_posChar=inLine.tqfind(' ')) == -1) word2=inLine;
else word2=inLine.left(m_posChar);
if (word1 =="ENUM") {
if (word2 != word) { m_error = UnknownFormat; return m_error; }
varMax=0;
inCountLine++;
enumString = new QValueVector<QString>;
enumString = new TQValueVector<TQString>;
enumString->clear();
}
else {
@ -1313,10 +1313,10 @@ int KNutNet::getUpsVars1 ( void) {
else {
if (word1 == "END") break;
if (word1 != "OPTION") { m_error = UnknownFormat; return m_error; }
if ((m_posChar = inLine.find('\"')) == -1) word2 = "";
if ((m_posChar = inLine.tqfind('\"')) == -1) word2 = "";
else {
word2 = inLine.mid(m_posChar+1);
if ((m_posChar=word2.find('\"')) != -1) word2 = word2.left(m_posChar);
if ((m_posChar=word2.tqfind('\"')) != -1) word2 = word2.left(m_posChar);
}
enumString->push_back(word2);
varMax++;
@ -1352,8 +1352,8 @@ int KNutNet::getUpsVars1 ( void) {
outBuffer=outBuffer.stripWhiteSpace ();
if ( !outBuffer.isEmpty() ) {
// precteme data
QTextIStream inputStream(&outBuffer);
QString word;
TQTextIStream inputStream(&outBuffer);
TQString word;
int count =1 ;
while (!inputStream.atEnd()) {
inputStream >> word;
@ -1392,9 +1392,9 @@ int KNutNet::getUpsVars1 ( void) {
int KNutNet::getUpsVars2 ( void) {
QCString inBuffer;
QString outBuffer;
QString varOutBuffer;
TQCString inBuffer;
TQString outBuffer;
TQString varOutBuffer;
upsVarDef upsVar;
upsICommDef upsIComm;
int key;
@ -1402,12 +1402,12 @@ int KNutNet::getUpsVars2 ( void) {
int lenString;
int varMax=0;
QValueVector<QString>* enumString=0;
TQValueVector<TQString>* enumString=0;
inBuffer = "LIST VAR " + m_upsName + "\n";
if (!(m_error=getUpsData (inBuffer,outBuffer,"END LIST VAR"))) {
QString inLine, upsNameRet, varName, varNameRet, value;
TQString inLine, upsNameRet, varName, varNameRet, value;
bool beginList = false;
QTextIStream varInputStream(&outBuffer);
TQTextIStream varInputStream(&outBuffer);
while (!(inLine = varInputStream.readLine()).isNull()) {
key = parseLine (inLine, upsNameRet, varName, value, typeValue, lenString);
@ -1434,14 +1434,14 @@ int KNutNet::getUpsVars2 ( void) {
inBuffer = "LIST ENUM " + m_upsName + " " + varName +"\n";
if (!(m_error=getUpsData (inBuffer,varOutBuffer,"END LIST ENUM"))) {
bool beginEnumList = false;
QTextIStream varInputStream(&varOutBuffer);
TQTextIStream varInputStream(&varOutBuffer);
while (!(inLine = varInputStream.readLine()).isNull()) {
key = parseLine (inLine, upsNameRet, varName, value, typeValue, lenString);
switch (key) {
case BEGIN_LIST_ENUM:
beginEnumList = true;
varMax=0;
enumString = new QValueVector<QString>;
enumString = new TQValueVector<TQString>;
enumString->clear();
upsVar.upsEnumValues=enumString;
break;
@ -1503,12 +1503,12 @@ int KNutNet::getUpsVars2 ( void) {
inBuffer = "LIST CMD " + m_upsName + "\n";
if (!(m_error=getUpsData (inBuffer,outBuffer,"END LIST CMD"))) {
QString inLine, upsNameRet, varName, value;
TQString inLine, upsNameRet, varName, value;
int key, typeValue;
bool beginList = false;
//std::cout << "CMD Buffer " << outBuffer << std::endl;
QTextIStream varInputStream(&outBuffer);
TQTextIStream varInputStream(&outBuffer);
while (!(inLine = varInputStream.readLine()).isNull()) {
key = parseLine (inLine, upsNameRet, varName, value, typeValue, lenString);
//std::cout << "CMD Line " << inLine << std::endl;
@ -1545,10 +1545,10 @@ int KNutNet::getUpsVars2 ( void) {
int KNutNet::getUpsValues1 (const bool allVars ) {// allVars = true vse; allVars = false jen activate
QString endChar;
QCString inBuffer;
QString outBuffer;
QValueVector<upsVarDef>::iterator it;
TQString endChar;
TQCString inBuffer;
TQString outBuffer;
TQValueVector<upsVarDef>::iterator it;
// Nacte hodnotu promenych
// reads value of variables
@ -1582,8 +1582,8 @@ int KNutNet::getUpsValues1 (const bool allVars ) {// allVars = true vse; allVars
emit getVarDesc (m_numberVars, numberVar);
if ( !outBuffer.isEmpty() ) {
QTextIStream inputStream(&outBuffer);
QString word1, word2, word3 ;
TQTextIStream inputStream(&outBuffer);
TQString word1, word2, word3 ;
inputStream >> word1;
inputStream >> word2;
if (inputStream.atEnd()) { // neexistuje treti cast VALUE
@ -1604,7 +1604,7 @@ int KNutNet::getUpsValues1 (const bool allVars ) {// allVars = true vse; allVars
if (word1 == "ANS") {
// answer - odpoved
// odstranime pripadne jmeno upsky
if ((m_posChar = word2.find('@')) != -1) word2 = word2.left(m_posChar);
if ((m_posChar = word2.tqfind('@')) != -1) word2 = word2.left(m_posChar);
if ( word2 != (*it).upsVarName ) {
m_error=UnknownAnswer;
return m_error;// neni to odpoved na spravnou promennou
@ -1643,16 +1643,16 @@ int KNutNet::getUpsValues1 (const bool allVars ) {// allVars = true vse; allVars
int KNutNet::getUpsValues2 (const bool allVars ) {// allVars = true vse; allVars = false jen activate
QString varName;
QString upsNameRet;
QString value;
TQString varName;
TQString upsNameRet;
TQString value;
int typeValue;
int lenString;
// reads value of variables
QCString inBuffer;
QString outBuffer;
QValueVector<upsVarDef>::iterator it;
TQCString inBuffer;
TQString outBuffer;
TQValueVector<upsVarDef>::iterator it;
emit getVarDesc (m_numberVars, 0);
int numberVar = 0;
@ -1704,11 +1704,11 @@ int KNutNet::getUpsValues2 (const bool allVars ) {// allVars = true vse; allVars
}
int KNutNet::sendComm (const QString command, const QString arg1, const QString arg2, const bool useUpsName) {
int KNutNet::sendComm (const TQString command, const TQString arg1, const TQString arg2, const bool useUpsName) {
int localError;
// nenastavi promenou error ale nenuluje ji
QCString inBuffer;
QString outBuffer;
TQCString inBuffer;
TQString outBuffer;
switch (m_nutProtocol) {
case 1:
@ -1728,8 +1728,8 @@ int KNutNet::sendComm (const QString command, const QString arg1, const QString
if (!(localError=getUpsData (inBuffer,outBuffer))) {
outBuffer=outBuffer.stripWhiteSpace();
QTextIStream inputStream(&outBuffer);
QString word1, word2;
TQTextIStream inputStream(&outBuffer);
TQString word1, word2;
inputStream >> word1;
inputStream >> word2;
if (word1.isEmpty()) return UnknownAnswer; // zadna odpoved
@ -1744,10 +1744,10 @@ int KNutNet::sendComm (const QString command, const QString arg1, const QString
}
int KNutNet::activate ( const QString name, const bool setActivate ) {
int KNutNet::activate ( const TQString name, const bool setActivate ) {
m_error =0;
if (m_state == Connected) {
QValueVector<upsVarDef>::iterator it;
TQValueVector<upsVarDef>::iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
if ((*it).upsVarName == name) {
(*it).upsVarActivate = setActivate;
@ -1763,7 +1763,7 @@ int KNutNet::activate ( const QString name, const bool setActivate ) {
int KNutNet::activateAll ( const bool setActivate ) {
m_error =0;
if (m_state == Connected) {
QValueVector<upsVarDef>::iterator it;
TQValueVector<upsVarDef>::iterator it;
for (it = m_listVars.begin(); it != m_listVars.end(); it++) {
(*it).upsVarActivate = setActivate;
}
@ -1773,12 +1773,12 @@ int KNutNet::activateAll ( const bool setActivate ) {
}
int KNutNet::upsTranslateError (const QString string) {
int KNutNet::upsTranslateError (const TQString string) {
if (string == "VAR-NOT-SUPPORTED") return VarNotSupported;
if (string == "VAR-UNKNOWN") return VarUnknown;
if (string == "ACCESS-DENIED") return AccessDenied;
if (string == "PASSWORD-REQUIRED") return PasswordRequired;
if (string == "PASSWORD-RETQUIRED") return PasswordRequired;
if (string == "PASSWORD-INCORRECT") return PasswordIncorrect;
if (string == "UNKNOWN-UPS") return UnknownUps;
if (string == "ALREADY-LOGGED_IN") return AlreadyLoggedIn;
@ -1807,7 +1807,7 @@ int KNutNet::upsTranslateError (const QString string) {
return UnknownErr;
}
int KNutNet::upsOldTranslateError (const QString string) {
int KNutNet::upsOldTranslateError (const TQString string) {
if (string == "NOT-SUPPORTED") return VarNotSupported;
if (string == "UNKNOWN") return VarUnknown;
if (string == "DATA-STALE") return DataStale;
@ -1823,13 +1823,13 @@ void KNutNet::slotConnectionError(int error) {
m_state = ConnectError;
m_unConnectTimer->stop();
if (error == QSocket::ErrHostNotFound) {
if (error == TQSocket::ErrHostNotFound) {
error = NoSuchHost;
emit connectionError(error);
return;
}
//connection was refused // no connection
if ((error == QSocket::ErrConnectionRefused) && (m_commandSocket->state()==QSocket::Idle)) {
if ((error == TQSocket::ErrConnectionRefused) && (m_commandSocket->state()==TQSocket::Idle)) {
if (m_firstConnect) {
if (m_numberConnection < m_countRepeat) {
m_numberConnection++;
@ -1852,15 +1852,15 @@ void KNutNet::slotConnectionError(int error) {
}
return;
}
if (error == QSocket::ErrConnectionRefused) {
if (error == TQSocket::ErrConnectionRefused) {
error = ConnectionRefused;
// std::cout << "--KNutNet::connection error ErrConnectionRefused " << QSocket::Idle << " - " << error << std::endl;
// std::cout << "--KNutNet::connection error ErrConnectionRefused " << TQSocket::Idle << " - " << error << std::endl;
emit connectionError(error);
return;
}
if (error == QSocket::ErrSocketRead) {
if (error == TQSocket::ErrSocketRead) {
error = SocketReadErr;
// std::cout << "--KNutNet::connection error QSocket::ErrSocketRead " << error << std::endl;
// std::cout << "--KNutNet::connection error TQSocket::ErrSocketRead " << error << std::endl;
emit connectionError(error);
return;
}
@ -1875,7 +1875,7 @@ void KNutNet::slotConnected(void) {
m_error=NutProtocolVarErr;
m_state = Closing;
m_commandSocket->close();
while (m_commandSocket->state() == QSocket::Closing) {
while (m_commandSocket->state() == TQSocket::Closing) {
sleep (100);
}
m_state = ConnectError;
@ -1888,7 +1888,7 @@ void KNutNet::slotConnected(void) {
// upsd server doesn't support any ups
m_state = Closing;
m_commandSocket->close();
while (m_commandSocket->state() == QSocket::Closing) {
while (m_commandSocket->state() == TQSocket::Closing) {
sleep (100);
}
m_state = ConnectError;
@ -1927,12 +1927,12 @@ void KNutNet::slotTimerReconnect(void) {
// std::cout << "--KNutNet::slotTimerReconnect" << std::endl;
m_unConnectTimer->stop();
if (m_commandSocket->state()==QSocket::Idle) {
//std::cout << "--KNutNet::slotTimerReconnect QSOcket::Idle" << std::endl;
if (m_commandSocket->state()==TQSocket::Idle) {
//std::cout << "--KNutNet::slotTimerReconnect TQSOcket::Idle" << std::endl;
emit tryRepeatFirstConnection(m_numberConnection);
// std::cout << "KNutNet::emit-tryRepeatFirstConnection" << std::endl;
m_state=Connecting;
if ( m_commandSocket->state() != QSocket::Connecting )
if ( m_commandSocket->state() != TQSocket::Connecting )
m_commandSocket->connectToHost(m_upsAddress,m_port);
}
}

@ -23,38 +23,38 @@
//#include <kapplication.h>
#include <kapp.h>
#include <qobject.h>
#include <qsocket.h>
#include <qsocketdevice.h>
#include <qnetworkprotocol.h>
#include <qmutex.h>
#include <tqobject.h>
#include <tqsocket.h>
#include <tqsocketdevice.h>
#include <tqnetworkprotocol.h>
#include <tqmutex.h>
#include <qvaluevector.h>
#include <tqvaluevector.h>
struct upsVarDef {
QString upsVarName;
TQString upsVarName;
bool upsVarActivate;
bool upsVarType; // typ true(1) RO - false (0) RW (muzeme menit)
bool upsValueType; // typ true(1) char - false (0) enum (vyctova)
// ma vyznam jen pro RW promenne
int upsVarMax; // udave max delku string promenne nebo pocet moznosti pro enum promennou
// ma vyznam jen pro RW promenne
QString upsValue; // hodnota promene
QString upsDescription; // informace o promene
QValueVector<QString>* upsEnumValues;
TQString upsValue; // hodnota promene
TQString upsDescription; // informace o promene
TQValueVector<TQString>* upsEnumValues;
};
struct upsICommDef {
QString upsCommName;
QString upsDescription;
TQString upsCommName;
TQString upsDescription;
};
class QString;
class QCString;
class QSocket;
class QTimer;
class TQString;
class TQCString;
class TQSocket;
class TQTimer;
/**
@ -77,8 +77,9 @@ class QTimer;
* @short Communication with UPS - Komunikace s UPS
* @version 0.7
*/
class KNutNet : public QObject {
class KNutNet : public TQObject {
Q_OBJECT
TQ_OBJECT
public:
enum NetState {Idle, HostLookup, Connecting, Connected, ConnectError,Closing };
@ -144,7 +145,7 @@ public:
// this not error
NoListVars}; //upsd doesn't return list of variables, variable for STATUS has got value WAIT
enum typeOfStatus {
enum typeOftqStatus {
NS = 0, // - NONE status of UPS wasn't read
OFF = 1, // - UPS is off (not supplying power)
OL = 2, // - UPS is online (supplying power from the line/mains)
@ -218,7 +219,7 @@ public:
*
* @since 0.7.5
**/
KNutNet (const QString upsAddress, const QString upsName="", const unsigned short port=3493, unsigned int countRepeat =0, const unsigned int delay = 200);
KNutNet (const TQString upsAddress, const TQString upsName="", const unsigned short port=3493, unsigned int countRepeat =0, const unsigned int delay = 200);
/**
* @since 0.5
@ -233,7 +234,7 @@ public:
*
* @since 0.1
**/
void newUPS (const QString upsAddress, const QString upsName, const unsigned short port=3493);
void newUPS (const TQString upsAddress, const TQString upsName, const unsigned short port=3493);
/**
@ -365,7 +366,7 @@ bool switchedToTCP ( void );
*
* @since 0.7
**/
int instantCommand (const QString command, const QString userName, const QString password, const bool onlyCommand = false);
int instantCommand (const TQString command, const TQString userName, const TQString password, const bool onlyCommand = false);
/**
@ -381,7 +382,7 @@ bool switchedToTCP ( void );
*
* @since 0.7
**/
int setVariable (const QString variable, const QString value, const QString userName, const QString password, const bool onlyVariable = false);
int setVariable (const TQString variable, const TQString value, const TQString userName, const TQString password, const bool onlyVariable = false);
@ -428,7 +429,7 @@ bool switchedToTCP ( void );
*
* @since 0.6
**/
int readVars (const QString name, struct upsVarDef& allVar);
int readVars (const TQString name, struct upsVarDef& allVar);
/**
@ -451,7 +452,7 @@ bool switchedToTCP ( void );
*
* @since 0.6.1
**/
QString readStringVar (const QString name);
TQString readStringVar (const TQString name);
/**
* Nacte jednu z hodnot vyctove promenne.
@ -464,7 +465,7 @@ bool switchedToTCP ( void );
*
* @since 0.6.1
**/
QString readEnumValueVar (const QString name, const int valueNumber);
TQString readEnumValueVar (const TQString name, const int valueNumber);
/**
@ -480,7 +481,7 @@ bool switchedToTCP ( void );
*
* @since 0.5
**/
int readStatus(void);
int readtqStatus(void);
/**
@ -491,7 +492,7 @@ int readStatus(void);
*
* @since 0.6
**/
int setActivate ( const QString name );
int setActivate ( const TQString name );
/**
* Zrusi nastaveni priznaku aktivity.
@ -501,7 +502,7 @@ int readStatus(void);
*
* @since 0.6
**/
int unSetActivate ( const QString name );
int unSetActivate ( const TQString name );
/**
* Zrusi nastaveni priznaku aktivity pro VSECHNY promene.
@ -523,7 +524,7 @@ int readStatus(void);
*
* @since 0.6
**/
int existName ( const QString name );
int existName ( const TQString name );
/********* Consts ****************/
@ -617,9 +618,9 @@ void cleanConnecting (void);
*
* @since 0.1
**/
int setKey (const QString line);
int setKey (const TQString line);
QString parseValue (const QString line);
TQString parseValue (const TQString line);
/**
* Parsuje typ promenne (RW ENUM STRING).
@ -630,7 +631,7 @@ QString parseValue (const QString line);
*
* @since 0.1.1
**/
int parseTypeValue (QString line, int& lenString );
int parseTypeValue (TQString line, int& lenString );
@ -641,7 +642,7 @@ int parseTypeValue (QString line, int& lenString );
*
* @since 0.1
**/
int parseLine(QString& line, QString& upsName ,QString& varName, QString& value, int& typeValue, int& lenString);
int parseLine(TQString& line, TQString& upsName ,TQString& varName, TQString& value, int& typeValue, int& lenString);
@ -677,7 +678,7 @@ int parseLine(QString& line, QString& upsName ,QString& varName, QString& value,
*
* @since 0.1
**/
int getFirstUpsName (QString& firstUpsName);
int getFirstUpsName (TQString& firstUpsName);
/**
@ -746,22 +747,22 @@ int getFirstUpsName (QString& firstUpsName);
* Nenastavuje promenou error.
* Doesn't set variable error
*/
int getUpsData (const QCString sbuffer, QString& rbuffer, const QCString endString=0);
int getUpsData (const TQCString sbuffer, TQString& rbuffer, const TQCString endString=0);
/**
* @internal
*/
void setRWVars (const QString varName, const bool valueType, const int varMax, QValueVector<QString>* enumValues);
void setRWVars (const TQString varName, const bool valueType, const int varMax, TQValueVector<TQString>* enumValues);
/**
* @internal
*/
void upsSetType (struct upsVarDef& upsVar, const QString name, const QString value = "");
void upsSetType (struct upsVarDef& upsVar, const TQString name, const TQString value = "");
/**
* @internal
*/
int upsTranslateError (const QString string);
int upsTranslateError (const TQString string);
/**
@ -772,26 +773,26 @@ void upsSetType (struct upsVarDef& upsVar, const QString name, const QString val
/**
* @internal
*/
int upsOldTranslateError (const QString string);
int upsOldTranslateError (const TQString string);
/**
* @internal
* Pro qt mensi nez 3.0.0 nemuze byt value const
*/
void genStatusFlags (QString value);
void genStatusFlags (TQString value);
/**
* @internal
* Nenastavuje promenou error.
*/
int sendComm (const QString command, const QString arg1, const QString arg2, const bool useUpsName=false);
int sendComm (const TQString command, const TQString arg1, const TQString arg2, const bool useUpsName=false);
/**
* @internal
*/
int activate ( const QString name, const bool setActivate );
int activate ( const TQString name, const bool setActivate );
/**
@ -803,7 +804,7 @@ void upsSetType (struct upsVarDef& upsVar, const QString name, const QString val
/**
* @internal
*/
int newDescription (const QCString inBuffer, QString& upsDescription);
int newDescription (const TQCString inBuffer, TQString& upsDescription);
private slots:
void slotConnectionError(int error);
@ -823,15 +824,15 @@ private:
/******* CONST ********/
static const Q_ULONG rBufferLen = 1024;
static const TQ_ULONG rBufferLen = 1024;
QSocket *m_commandSocket;
QTimer* m_unConnectTimer;
TQSocket *m_commandSocket;
TQTimer* m_unConnectTimer;
/****** VARS *************/
QString m_upsAddress;
QString m_upsName;
TQString m_upsAddress;
TQString m_upsName;
unsigned int m_countRepeat;
unsigned short m_port;
@ -855,12 +856,12 @@ private:
bool m_switchToTCP;
QMutex m_getUpsDataMutex;
TQMutex m_getUpsDataMutex;
QValueVector<upsVarDef> m_listVars;
QValueVector<upsICommDef> m_listIComms;
TQValueVector<upsVarDef> m_listVars;
TQValueVector<upsICommDef> m_listIComms;
/********* Pomocne promenne ***********/
/********* Potqmocne promenne ***********/
int m_posChar;
};

@ -21,52 +21,52 @@
#include <kmessagebox.h>
#include <kactionselector.h>
#include <qstring.h>
#include <qlayout.h>
#include <qframe.h>
#include <qlabel.h>
#include <qgroupbox.h>
//#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qlistbox.h>
#include <tqstring.h>
#include <tqlayout.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <tqgroupbox.h>
//#include <tqradiobutton.h>
#include <tqbuttongroup.h>
#include <tqcheckbox.h>
#include <tqlistbox.h>
//#include <iostream>
KNutNewUpsDlg::KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const analogData, const bool add, QWidget* parent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("New Ups"),Help|Ok|Cancel,Ok, parent, name, modal, true ), addMember(add), m_myUpsData(upsData) {
KNutNewUpsDlg::KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const analogData, const bool add, TQWidget* tqparent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("New Ups"),Help|Ok|Cancel,Ok, tqparent, name, modal, true ), addMember(add), m_myUpsData(upsData) {
setName( "KupsNewUpsDlg" );
QFrame *page =plainPage();
QVBoxLayout *mainLayout = new QVBoxLayout( page, 0, spacingHint(), "mainLayout" );
QHBoxLayout *dataLayout = new QHBoxLayout(mainLayout, spacingHint(),"dataLayout");
TQFrame *page =plainPage();
TQVBoxLayout *mainLayout = new TQVBoxLayout( page, 0, spacingHint(), "mainLayout" );
TQHBoxLayout *dataLayout = new TQHBoxLayout(mainLayout, spacingHint(),"dataLayout");
QGroupBox *hostBox = new QGroupBox (page,"hostBox");
QGridLayout *hostLayout = new QGridLayout (hostBox, 5, 2, spacingHint () );
hostBox->setFrameStyle(QFrame::NoFrame);
TQGroupBox *hostBox = new TQGroupBox (page,"hostBox");
TQGridLayout *hostLayout = new TQGridLayout (hostBox, 5, 2, spacingHint () );
hostBox->setFrameStyle(TQFrame::NoFrame);
dataLayout->addWidget(hostBox);
QHBoxLayout *portLayout = new QHBoxLayout(-1,"portLayout");
TQHBoxLayout *portLayout = new TQHBoxLayout(-1,"portLayout");
hostLayout->addLayout(portLayout,4,1);
QHBoxLayout *loginLayout = new QHBoxLayout(-1,"loginLayout");
TQHBoxLayout *loginLayout = new TQHBoxLayout(-1,"loginLayout");
hostLayout->addLayout(loginLayout,5,1);
QGroupBox* GroupBox2 = new QGroupBox( page, "GroupBox2" );
TQGroupBox* GroupBox2 = new TQGroupBox( page, "GroupBox2" );
QVBoxLayout *vActionSelectorLayout = new QVBoxLayout( GroupBox2, 0, spacingHint(), "VActionLayout" );
TQVBoxLayout *vActionSelectorLayout = new TQVBoxLayout( GroupBox2, 0, spacingHint(), "VActionLayout" );
vActionSelectorLayout->addSpacing(fontMetrics().lineSpacing());
QHBoxLayout *hActionSelectorLayout = new QHBoxLayout( vActionSelectorLayout, spacingHint(), "HActionLayout" );
TQHBoxLayout *hActionSelectorLayout = new TQHBoxLayout( vActionSelectorLayout, spacingHint(), "HActionLayout" );
vActionSelectorLayout->addSpacing(10);
QLabel* TextLabel1 = new QLabel( i18n("Name")+":",hostBox, "TextLabel1" );
TQLabel* TextLabel1 = new TQLabel( i18n("Name")+":",hostBox, "TextLabel1" );
hostLayout->addWidget (TextLabel1,1,0);
m_lineEdit1 = new KLineEdit( hostBox, "LineEdit1" );
m_lineEdit1->setEnabled( add );
@ -74,46 +74,46 @@ KNutNewUpsDlg::KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const ana
// when makes adding name isn;t activated
hostLayout->addWidget (m_lineEdit1,1,1);
QLabel* TextLabel2 = new QLabel(i18n("UPS address")+":", hostBox, "TextLabel2" );
TQLabel* TextLabel2 = new TQLabel(i18n("UPS address")+":", hostBox, "TextLabel2" );
hostLayout->addWidget (TextLabel2,2,0);
m_lineEdit2 = new KLineEdit( hostBox, "LineEdit2" );
hostLayout->addWidget (m_lineEdit2,2,1);
// Name of UPS
QLabel* TextLabel7 = new QLabel(i18n("UPS name")+":", hostBox, "TextLabel7" );
TQLabel* TextLabel7 = new TQLabel(i18n("UPS name")+":", hostBox, "TextLabel7" );
hostLayout->addWidget (TextLabel7,3,0);
m_lineEdit7 = new KLineEdit( hostBox, "LineEdit7" );
hostLayout->addWidget (m_lineEdit7,3,1);
QLabel* TextLabel3 = new QLabel(i18n("Delay (ms):"), hostBox, "TextLabel3" );
TQLabel* TextLabel3 = new TQLabel(i18n("Delay (ms):"), hostBox, "TextLabel3" );
hostLayout->addWidget (TextLabel3,4,0);
m_lineEdit3 = new KLineEdit( hostBox, "LineEdit3" );
m_lineEdit3->setText("5000");
portLayout->addWidget(m_lineEdit3);
portLayout->addSpacing(10);
QLabel* TextLabel4 = new QLabel(i18n("Port:"), hostBox, "TextLabel4" );
TQLabel* TextLabel4 = new TQLabel(i18n("Port:"), hostBox, "TextLabel4" );
m_lineEdit4 = new KLineEdit( hostBox, "LineEdit4" );
m_lineEdit4->setText(QString("%1").arg(knc::DefaultPort));
m_lineEdit4->setText(TQString("%1").tqarg(knc::DefaultPort));
portLayout->addWidget(TextLabel4);
portLayout->addWidget(m_lineEdit4);
QLabel* TextLabel5 = new QLabel(i18n("User name:"), hostBox, "TextLabel5" );
TQLabel* TextLabel5 = new TQLabel(i18n("User name:"), hostBox, "TextLabel5" );
hostLayout->addWidget (TextLabel5,5,0);
m_lineEdit5 = new KLineEdit( hostBox, "LineEdit5" );
m_lineEdit5->setText("");
loginLayout->addWidget(m_lineEdit5);
loginLayout->addSpacing(10);
QLabel* TextLabel6 = new QLabel(i18n("Password:"), hostBox, "TextLabel6" );
TQLabel* TextLabel6 = new TQLabel(i18n("Password:"), hostBox, "TextLabel6" );
m_lineEdit6 = new KLineEdit( hostBox, "LineEdit6" );
m_lineEdit6->setEchoMode(QLineEdit::Password);
m_lineEdit6->setEchoMode(TQLineEdit::Password);
m_lineEdit6->setText("");
loginLayout->addWidget(TextLabel6);
loginLayout->addWidget(m_lineEdit6);
m_savePassword = new QCheckBox (i18n("Store NUT password in configuration file"),page,"savePassword");
m_savePassword = new TQCheckBox (i18n("Store NUT password in configuration file"),page,"savePassword");
mainLayout->addWidget(m_savePassword);
mainLayout->addWidget(GroupBox2);
@ -133,7 +133,7 @@ KNutNewUpsDlg::KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const ana
GroupBox2->setTitle( i18n( "UPS Variables" ));
QListBox* aListBox = m_upsValueSelector->availableListBox();
TQListBox* aListBox = m_upsValueSelector->availableListBox();
for (int i=1; i < knc::NumberOfTypes; i++) { //values 0 is None, this values isn't showing
new KNutUpsBoxItem (aListBox,analogData->getNameAnalogData(i),i);
}
@ -164,7 +164,7 @@ while (availableItem != 0) {
//remove item from left list
if (availableItem != 0) {
QListBox* sListBox = m_upsValueSelector->selectedListBox();
TQListBox* sListBox = m_upsValueSelector->selectedListBox();
new KNutUpsBoxItem (sListBox,availableItem->text(),codeUpsVar);
m_upsValueSelector->availableListBox()->removeItem(m_upsValueSelector->availableListBox()->index(availableItem));
@ -190,7 +190,7 @@ void KNutNewUpsDlg::putData (const KNutUpsData::upsRecordDef upsRecord ) {
m_lineEdit1->setText(upsRecord.name);
m_lineEdit2->setText(upsRecord.upsAddress);
m_lineEdit7->setText(upsRecord.upsName);
QString delay, port;
TQString delay, port;
delay.setNum(upsRecord.delay);
m_lineEdit3->setText(delay);
port.setNum(upsRecord.port);

@ -27,13 +27,13 @@
#include <kpushbutton.h>
#include <kactionselector.h>
#include <qlistbox.h>
#include <tqlistbox.h>
class QLabel;
class QGroupBox;
class QButtonGroup;
class QCheckBox;
class TQLabel;
class TQGroupBox;
class TQButtonGroup;
class TQCheckBox;
/**
* This class is dialog for makeing or correting informations about UPS.
@ -48,6 +48,7 @@ class QCheckBox;
class KNutNewUpsDlg : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
@ -66,7 +67,7 @@ public:
*
* @since 0.7
**/
KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const analogData, const bool add = TRUE, QWidget* parent = 0, const char* name = 0, const bool modal = TRUE);
KNutNewUpsDlg (KNutUpsData* const upsData, KNutVarData* const analogData, const bool add = TRUE, TQWidget* tqparent = 0, const char* name = 0, const bool modal = TRUE);
/**
* @since 0.3
@ -119,19 +120,19 @@ private:
*
* @version 0.1
*/
class KNutUpsBoxItem : public QListBoxText
class KNutUpsBoxItem : public TQListBoxText
{
private:
int m_ordVarCode;
public:
KNutUpsBoxItem ( QListBox* listbox, const QString & text=QString::null, const int ordVarCode = 0 ) :
QListBoxText (listbox, text), m_ordVarCode (ordVarCode) {};
KNutUpsBoxItem ( QListBox* listbox, const QString & text, QListBoxItem *after, const int ordVarCode = 0 ) :
QListBoxText (listbox, text, after), m_ordVarCode (ordVarCode) {};
KNutUpsBoxItem ( TQListBox* listbox, const TQString & text=TQString(), const int ordVarCode = 0 ) :
TQListBoxText (listbox, text), m_ordVarCode (ordVarCode) {};
KNutUpsBoxItem ( TQListBox* listbox, const TQString & text, TQListBoxItem *after, const int ordVarCode = 0 ) :
TQListBoxText (listbox, text, after), m_ordVarCode (ordVarCode) {};
int getVarCode (void) const {return m_ordVarCode;};
void putGetCode (const int ordVarCode) {m_ordVarCode = ordVarCode;};
// QString text () const {return QListBoxItem::text();};
// TQString text () const {return TQListBoxItem::text();};
};
@ -151,7 +152,7 @@ private:
KLineEdit* m_lineEdit6;
KLineEdit* m_lineEdit7;
QCheckBox* m_savePassword;
TQCheckBox* m_savePassword;
KActionSelector* m_upsValueSelector;

@ -19,9 +19,9 @@
#include <kdebug.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qfont.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqfont.h>
#include <math.h>
@ -35,16 +35,16 @@ extern const char *nameUpsVars1[];
extern const char *nameUpsVars2[];
KNutPanelMeter::KNutPanelMeter(QPalette aPanelPalette, KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutVarData* analogRecords, QWidget *parent, const char *name ) : QScrollView(parent,name,Qt::WResizeNoErase|Qt::WStaticContents) {
KNutPanelMeter::KNutPanelMeter(TQPalette aPanelPalette, KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutVarData* analogRecords, TQWidget *tqparent, const char *name ) : TQScrollView(tqparent,name,TQt::WResizeNoErase|TQt::WStaticContents) {
m_settingData = settingData;
m_activeUpsInfo = activeUpsInfo;
m_analogRecords = analogRecords;
m_aPanelPalette = aPanelPalette;
m_analogArea = new QLabel(this->viewport());
m_analogArea = new TQLabel(this->viewport());
addChild(m_analogArea);
setResizePolicy ( QScrollView::AutoOneFit ) ;
setResizePolicy ( TQScrollView::AutoOneFit ) ;
////NUTNO PAK UPRAVIT ACTIVATE A DEAKTIVATE ANALOGS
@ -114,7 +114,7 @@ void KNutPanelMeter::activateAnalogs (void) {
m_analogPanels->scaleEnd[i]=analogMemberData.end;
m_analogPanels->scaleStart[i]=analogMemberData.start;
QColor analogFingerColor, analogScaleColor, analogFontColor;
TQColor analogFingerColor, analogScaleColor, analogFontColor;
if (m_settingData->customOAnalogColor) {
analogFingerColor = m_settingData->analogFingerColor;
analogScaleColor = m_settingData->analogScaleColor;
@ -154,9 +154,9 @@ void KNutPanelMeter::activateAnalogs (void) {
}
//qDebug ( "KNutPanelMeter::activateAnalogs 1" );
m_analogArea->repaint(); //repaint all analog panels, background was made already
m_analogArea->tqrepaint(); //tqrepaint all analog panels, background was made already
//qDebug ("KNutPanelMeter::activateAnalogs - end");
// analogSV->resizeContents(sizeHint().width(),sizeHint().height());
// analogSV->resizeContents(tqsizeHint().width(),tqsizeHint().height());
}
@ -189,10 +189,10 @@ void KNutPanelMeter::setSize (bool showPanels) {
m_analogArea->setMinimumSize (m_widthArea,m_heightArea);
adjustSize();
resizeContents(m_widthArea,m_heightArea);
repaint();
tqrepaint();
}
void KNutPanelMeter::repaintScaleAnalogPanel (int panelNumber, float value) {
void KNutPanelMeter::tqrepaintScaleAnalogPanel (int panelNumber, float value) {
if (m_analogPanels->upsAnalogs[panelNumber] != 0L){
switch (m_activeUpsInfo->record.upsVarCode[panelNumber]) {
@ -229,7 +229,7 @@ void KNutPanelMeter::repaintScaleAnalogPanel (int panelNumber, float value) {
m_analogPanels->upsAnalogs[panelNumber]->setPointer(value); // jistota pokud by nam to nekde propadlo
m_analogPanels->upsAnalogs[panelNumber]->hide();// schovame analogovy panel hides analog panel
m_analogPanels->upsAnalogs[panelNumber]->setRange (m_analogPanels->scaleStart[panelNumber],m_analogPanels->scaleEnd[panelNumber]);
m_analogPanels->upsAnalogs[panelNumber]->repaint(); // prekreslime , repaints panel
m_analogPanels->upsAnalogs[panelNumber]->tqrepaint(); // prekreslime , tqrepaints panel
m_analogPanels->upsAnalogs[panelNumber]->show(); //zobrazime merak shows analog panel
}
}
@ -241,14 +241,14 @@ void KNutPanelMeter::repaintScaleAnalogPanel (int panelNumber, float value) {
void KNutPanelMeter::repaintAnalogPointer (int panelNumber, float value, bool run) {
void KNutPanelMeter::tqrepaintAnalogPointer (int panelNumber, float value, bool run) {
if (m_analogPanels->upsAnalogs[panelNumber] != 0L)
m_analogPanels->upsAnalogs[panelNumber]->setPointer (value,run); // nastavi hodnotu rucicky
}
void KNutPanelMeter::setAnalogBG(QPalette aPanelPalette) {
void KNutPanelMeter::setAnalogBG(TQPalette aPanelPalette) {
m_aPanelPalette = aPanelPalette;
for (int i=0; i< knc::NumberOfVars; i++) {
@ -269,7 +269,7 @@ void KNutPanelMeter::changeAnalogPanelsDigProcessing (void) {
}
void KNutPanelMeter::repaintAnalogPanels (bool repaintFrequencyPanels, bool repaintVoltagePanels, bool repaintAllPanels) {
void KNutPanelMeter::tqrepaintAnalogPanels (bool tqrepaintFrequencyPanels, bool tqrepaintVoltagePanels, bool tqrepaintAllPanels) {
KNutVarData::VarStrucDef analogMemberData;
@ -281,10 +281,10 @@ KNutVarData::VarStrucDef analogMemberData;
//if upsAnalogs[x] is set to zero, this upsAnalog is not used
// record.upsVarCode contain list of code of analog meter
// 0 is code for none analog meter, 1 for Input Voltage, 2 for Battery Charge,
if (((m_activeUpsInfo->record.upsVarCode[i] == knc::VarAcfreq) && (repaintFrequencyPanels)) ||
((m_activeUpsInfo->record.upsVarCode[i] == knc::VarOutFreq) && (repaintFrequencyPanels)) ||
if (((m_activeUpsInfo->record.upsVarCode[i] == knc::VarAcfreq) && (tqrepaintFrequencyPanels)) ||
((m_activeUpsInfo->record.upsVarCode[i] == knc::VarOutFreq) && (tqrepaintFrequencyPanels)) ||
(((m_activeUpsInfo->record.upsVarCode[i] == knc::VarUtility) ||
(m_activeUpsInfo->record.upsVarCode[i] == knc::VarOutVolt)) && (repaintVoltagePanels))) {
(m_activeUpsInfo->record.upsVarCode[i] == knc::VarOutVolt)) && (tqrepaintVoltagePanels))) {
analogMemberData=m_analogRecords->getData (m_activeUpsInfo->record.upsVarCode[i]); // nacteme data
@ -297,12 +297,12 @@ KNutVarData::VarStrucDef analogMemberData;
} // end if (!
}// end for (int i=0
m_analogPanels->upsAnalogs[i]->makeBackground(false); // repaints analog meter
m_analogPanels->upsAnalogs[i]->repaintPointer(false); // repaints analog meter
m_analogPanels->upsAnalogs[i]->repaint(); // repaints analog meter
m_analogPanels->upsAnalogs[i]->makeBackground(false); // tqrepaints analog meter
m_analogPanels->upsAnalogs[i]->tqrepaintPointer(false); // tqrepaints analog meter
m_analogPanels->upsAnalogs[i]->tqrepaint(); // tqrepaints analog meter
m_analogPanels->upsAnalogs[i]->show(); // shows analog meter
} // end if (((activeUpsInfo
if (repaintAllPanels) {
if (tqrepaintAllPanels) {
if (m_settingData->customOAnalogColor) {
m_analogPanels->upsAnalogs[i]->setPointerColor(m_settingData->analogFingerColor);
m_analogPanels->upsAnalogs[i]->setArcColor(1,m_settingData->analogOKColor);
@ -317,7 +317,7 @@ KNutVarData::VarStrucDef analogMemberData;
m_analogPanels->upsAnalogs[i]->setScaleColor (DEFAULT_SCALE_COLOR);
m_analogPanels->upsAnalogs[i]->setFontColor (DEFAULT_FONT_COLOR);
}
m_analogPanels->upsAnalogs[i]->repaintAll();
m_analogPanels->upsAnalogs[i]->tqrepaintAll();
}
}
} // end for
@ -334,13 +334,13 @@ void KNutPanelMeter::zeroingPanels (void) {
QSize KNutPanelMeter::sizeHint (void){
TQSize KNutPanelMeter::tqsizeHint (void){
return QSize(m_widthArea,m_heightArea);
return TQSize(m_widthArea,m_heightArea);
}
void KNutPanelMeter::slotSetPanelsFont(QFont newFont) {
void KNutPanelMeter::slotSetPanelsFont(TQFont newFont) {
for (int i=0; i< knc::NumberOfVars; i++) {
if ((m_activeUpsInfo->record.upsVarCode[i]) && (m_analogPanels->upsAnalogs[i])) {

@ -22,18 +22,19 @@
#include "knutvardata.h"
//#include <qwidget.h>
#include <qscrollview.h>
//#include <tqwidget.h>
#include <tqscrollview.h>
class QLabel;
class QFont;
class TQLabel;
class TQFont;
/**
*@author Daniel Prynych
*/
class KNutPanelMeter : public QScrollView {
class KNutPanelMeter : public TQScrollView {
Q_OBJECT
TQ_OBJECT
public:
/**
@ -46,7 +47,7 @@ public:
*
* @since 0.2
**/
KNutPanelMeter(QPalette aPanelPalette, KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutVarData* analogRecords, QWidget *parent=0, const char *name=0);
KNutPanelMeter(TQPalette aPanelPalette, KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutVarData* analogRecords, TQWidget *tqparent=0, const char *name=0);
/**
* Destruktor
@ -89,7 +90,7 @@ public:
*
* @since 0.1
**/
void repaintScaleAnalogPanel (int panelNumber, float value);
void tqrepaintScaleAnalogPanel (int panelNumber, float value);
/**
* Paints pointer for selected analog panel
@ -97,14 +98,14 @@ public:
*
* @param panelNumber is number of analog panel.
* @param value is value of settimg amalog panel.
* @param run = TRUE makes immediately repaint of panel
* @param run = TRUE makes immediately tqrepaint of panel
* @param panelNumber je cislo analogoveho panelu.
* @param value je hodnota na kterou je panel nastaven.
* @param run = TRUE provede okamzite prekresleni
*
* @since 0.2
**/
void repaintAnalogPointer (int panelNumber, float value, bool run = true);
void tqrepaintAnalogPointer (int panelNumber, float value, bool run = true);
/**
@ -113,13 +114,13 @@ public:
* Prekresli a prebarvi analogove panely.
* Prekresuje rozsah panelu pro frekvenci a nepeti na zaklade soucasneho nastaveni.
*
* @param repaintFrequencyPanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni frequency.
* @param repaintVoltagePanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni a vystupni napeti.
* @param repaintAllPanels urcuje ze ma prebarvit vsechny prvky panelu.
* @param tqrepaintFrequencyPanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni frequency.
* @param tqrepaintVoltagePanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni a vystupni napeti.
* @param tqrepaintAllPanels urcuje ze ma prebarvit vsechny prvky panelu.
*
* @since 0.1
**/
void repaintAnalogPanels (bool repaintFrequencyPanels, bool repaintVoltagePanels, bool repaintAllPanels);
void tqrepaintAnalogPanels (bool tqrepaintFrequencyPanels, bool tqrepaintVoltagePanels, bool tqrepaintAllPanels);
@ -127,7 +128,7 @@ public:
/**
* Changes type of digital processing of pointer and repaints it.
* Changes type of digital processing of pointer and tqrepaints it.
* Zmeni zpusob digitalniho zpracovani rucucky a prekresli ji
*
* @since 0.1
@ -151,7 +152,7 @@ public:
*
* @since 0.1
**/
void setAnalogBG(QPalette aPanelPalette);
void setAnalogBG(TQPalette aPanelPalette);
@ -160,7 +161,7 @@ public:
*
* @since 0.1
**/
virtual QSize sizeHint (void);
virtual TQSize tqsizeHint (void);
public slots:
@ -170,7 +171,7 @@ public slots:
*
* @since 0.1
**/
void slotSetPanelsFont(QFont newFont);
void slotSetPanelsFont(TQFont newFont);
private:
@ -192,7 +193,7 @@ private:
/*********** private vars *******************/
QLabel* m_analogArea;
TQLabel* m_analogArea;
analogPanelRecordsDef* m_analogPanels;
@ -201,7 +202,7 @@ private:
KNutVarData* m_analogRecords;
QPalette m_aPanelPalette;
TQPalette m_aPanelPalette;
int m_widthArea;
int m_heightArea;

@ -22,14 +22,14 @@
#include <kiconloader.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qfont.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <tqlayout.h>
#include <tqgroupbox.h>
#include <tqbuttongroup.h>
#include <tqradiobutton.h>
#include <tqfont.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqspinbox.h>
#include <stdio.h>
@ -41,8 +41,8 @@
KNutPrefDlg::KNutPrefDlg(KNutUpsData* const upsData, KNutVarData* const analogData, KNutVarData::SettingDataDef* const settingData,
const QString upsName, QWidget* parent, const char* name, const bool modal)
:KDialogBase(IconList, i18n("Preferences"),Help|Default|Apply|Ok|Cancel,Ok, parent, name, modal, true),
const TQString upsName, TQWidget* tqparent, const char* name, const bool modal)
:KDialogBase(IconList, i18n("Preferences"),Help|Default|Apply|Ok|Cancel,Ok, tqparent, name, modal, true),
m_activeUpsName (upsName), m_myUpsData(upsData), m_myAnalogData(analogData), m_settingData(settingData) {
setName( "UpsMemberDlg" );
@ -210,7 +210,7 @@ void KNutPrefDlg::slotNewUps () {
// pridame data do okenka
m_listBox2->insertItem(upsRecord.name);
// pokud pridame prvni prekreslime hlavni okno
// when adds the first sameone, will repaint window
// when adds the first sameone, will tqrepaint window
m_checked = true;
if (m_myUpsData->getCount() ==1 ) m_checkedActiveUps = true;
}
@ -505,38 +505,38 @@ void KNutPrefDlg::initSetting () {
m_mSetPix = UserIcon ("knc_mset");
QFrame *page = addPage( i18n("Setting"),i18n("Main Setting"),m_mSetPix);
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
TQFrame *page = addPage( i18n("Setting"),i18n("Main Setting"),m_mSetPix);
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
QGroupBox *dataBox = new QGroupBox (page ,"dataBox");
QGridLayout *dataLayout = new QGridLayout (dataBox,5,2,spacingHint());
dataBox->setFrameStyle(QFrame::NoFrame);
TQGroupBox *dataBox = new TQGroupBox (page ,"dataBox");
TQGridLayout *dataLayout = new TQGridLayout (dataBox,5,2,spacingHint());
dataBox->setFrameStyle(TQFrame::NoFrame);
setTopLayout->addWidget(dataBox);
QButtonGroup *VFGroup = new QButtonGroup(i18n("Voltage/Frequency"),page,"VFGroup");
QGridLayout *setVoltFreqLayout = new QGridLayout (VFGroup, 4 , 2,spacingHint () );
TQButtonGroup *VFGroup = new TQButtonGroup(i18n("Voltage/Frequency"),page,"VFGroup");
TQGridLayout *setVoltFreqLayout = new TQGridLayout (VFGroup, 4 , 2,spacingHint () );
m_xfer = new QCheckBox (i18n("&Use High-Low XFER"),VFGroup,"m_xfer");
m_xfer = new TQCheckBox (i18n("&Use High-Low XFER"),VFGroup,"m_xfer");
QLabel *initSettingLabel1 = new QLabel(i18n("Number of columns :"),dataBox,"label1");
m_numberOfColumns = new QSpinBox(knc::MinCols,knc::MaxCols,1,dataBox);
TQLabel *initSettingLabel1 = new TQLabel(i18n("Number of columns :"),dataBox,"label1");
m_numberOfColumns = new TQSpinBox(knc::MinCols,knc::MaxCols,1,dataBox);
QLabel *initSettingLabel2 = new QLabel(i18n("Use custom background color"),dataBox,"label2");
m_checkBoxCbc = new QCheckBox ("",dataBox,"checboxcbc");
TQLabel *initSettingLabel2 = new TQLabel(i18n("Use custom background color"),dataBox,"label2");
m_checkBoxCbc = new TQCheckBox ("",dataBox,"checboxcbc");
m_mainBackgroundColorLabel = new QLabel(i18n("Color of background :"),dataBox,"label3");
m_mainBackgroundColorLabel = new TQLabel(i18n("Color of background :"),dataBox,"label3");
m_BGButton = new KColorButton (dataBox);
m_BGButton->setColor (m_settingData->mainBackgroundColor);
QLabel *initSettingLabel4 = new QLabel(i18n("Use dialog \"Are you sure\""),dataBox,"m_areYouSureLabel");
m_checkBoxAys = new QCheckBox ("",dataBox,"checboxays");
TQLabel *initSettingLabel4 = new TQLabel(i18n("Use dialog \"Are you sure\""),dataBox,"m_areYouSureLabel");
m_checkBoxAys = new TQCheckBox ("",dataBox,"checboxays");
QLabel *initSettingLabel5 = new QLabel(i18n("Use Main window when program is started"),dataBox,"initSettingLabel5");
// m_checkBoxMW = new QCheckBox ("",dataBox,"checboxmv");
TQLabel *initSettingLabel5 = new TQLabel(i18n("Use Main window when program is started"),dataBox,"initSettingLabel5");
// m_checkBoxMW = new TQCheckBox ("",dataBox,"checboxmv");
QLabel *initSettingLabel6 = new QLabel(i18n("Show message window, when program reports error"),dataBox,"initSettingLabel6");
m_checkBoxMesW = new QCheckBox ("",dataBox,"checboxer");
TQLabel *initSettingLabel6 = new TQLabel(i18n("Show message window, when program reports error"),dataBox,"initSettingLabel6");
m_checkBoxMesW = new TQCheckBox ("",dataBox,"checboxer");
m_comboBoxMainWindow = new KComboBox (dataBox);
m_comboBoxMainWindow->insertItem (i18n("Yes"));
m_comboBoxMainWindow->insertItem (i18n("No"));
@ -544,17 +544,17 @@ void KNutPrefDlg::initSetting () {
m_voltageGroup = new QButtonGroup(i18n("Nominal Input Voltage"),VFGroup,"voltageGroup");
QGridLayout *voltLayout = new QGridLayout (m_voltageGroup, 3 , 1,spacingHint () );
m_voltageGroup = new TQButtonGroup(i18n("Nominal Input Voltage"),VFGroup,"voltageGroup");
TQGridLayout *voltLayout = new TQGridLayout (m_voltageGroup, 3 , 1,spacingHint () );
m_vRadioButton1 = new QRadioButton(i18n("&230 V"), m_voltageGroup, "vRadioButton1" );
m_vRadioButton2 = new QRadioButton(i18n("&120 V"), m_voltageGroup, "vRadioButton2" );
m_vRadioButton1 = new TQRadioButton(i18n("&230 V"), m_voltageGroup, "vRadioButton1" );
m_vRadioButton2 = new TQRadioButton(i18n("&120 V"), m_voltageGroup, "vRadioButton2" );
m_frequencyGroup = new QButtonGroup(i18n("Nominal Input Frequency"),VFGroup,"frequencyGroup");
QGridLayout *freqLayout = new QGridLayout (m_frequencyGroup, 3 , 1,spacingHint () );
m_frequencyGroup = new TQButtonGroup(i18n("Nominal Input Frequency"),VFGroup,"frequencyGroup");
TQGridLayout *freqLayout = new TQGridLayout (m_frequencyGroup, 3 , 1,spacingHint () );
m_fRadioButton1 = new QRadioButton(i18n("&50 Hz"), m_frequencyGroup, "fRadioButton1" );
m_fRadioButton2 = new QRadioButton(i18n("&60 Hz"), m_frequencyGroup, "fRadioButton2" );
m_fRadioButton1 = new TQRadioButton(i18n("&50 Hz"), m_frequencyGroup, "fRadioButton1" );
m_fRadioButton2 = new TQRadioButton(i18n("&60 Hz"), m_frequencyGroup, "fRadioButton2" );
dataLayout->addWidget (initSettingLabel1,0,0);
dataLayout->addWidget (m_numberOfColumns,0,1);
@ -612,105 +612,105 @@ void KNutPrefDlg::initSetting () {
m_xfer->setChecked(m_settingData->lowHighXfer);
m_voltageGroup->setEnabled(!m_settingData->lowHighXfer);
m_frequencyGroup->setEnabled(!m_settingData->lowHighXfer);
connect (m_xfer,SIGNAL(toggled(bool)),this,SLOT(slotEnableVoltage(bool)));
connect (m_xfer,SIGNAL(toggled(bool)),this,SLOT(slotEnableFrequency(bool)));
connect (m_xfer,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableVoltage(bool)));
connect (m_xfer,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableFrequency(bool)));
m_checkBoxCbc->setChecked(m_settingData->customBColor);
m_BGButton->setColor(m_settingData->mainBackgroundColor);
m_BGButton->setEnabled(m_settingData->customBColor);
m_mainBackgroundColorLabel->setEnabled(m_settingData->customBColor);
connect (m_checkBoxCbc,SIGNAL(toggled(bool)),this,SLOT(slotUseCustomBColor(bool)));
connect (m_checkBoxCbc,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBColor(bool)));
}
void KNutPrefDlg::initUps () {
m_upsesPix = UserIcon ("knc_upses");
QFrame *page = addPage( i18n("UPS"),i18n("UPS Setting"),m_upsesPix);
QHBoxLayout *upsTopLayout = new QHBoxLayout( page, 0, spacingHint (),"upsTopLayout" );
TQFrame *page = addPage( i18n("UPS"),i18n("UPS Setting"),m_upsesPix);
TQHBoxLayout *upsTopLayout = new TQHBoxLayout( page, 0, spacingHint (),"upsTopLayout" );
// makes box for names of UPS's / Vytvorime box pro jmena UPS-ek
m_listBox2 = new KListBox( page, "ListBox2" );
m_listBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, m_listBox2->sizePolicy().hasHeightForWidth() ) );
m_listBox2->setFrameShape( QListBox::StyledPanel );
m_listBox2->setFrameShadow( QListBox::Sunken );
m_listBox2->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, m_listBox2->sizePolicy().hasHeightForWidth() ) );
m_listBox2->setFrameShape( TQListBox::StyledPanel );
m_listBox2->setFrameShadow( TQListBox::Sunken );
m_listBox2->setMinimumSize (100,100);
// sets listbox
for (int i=0; i < m_myUpsData->getCount (); i++) m_listBox2->insertItem (m_myUpsData->getName(i));
//includes listbox into horizontal layout on the first place
//includes listbox into horizontal tqlayout on the first place
upsTopLayout->addWidget( m_listBox2, 20 );
// makes vertical layout and includes it in horizontal layout into the second place
QVBoxLayout *upsLayout = new QVBoxLayout( upsTopLayout, spacingHint (),"upsLayout" );
// makes vertical tqlayout and includes it in horizontal tqlayout into the second place
TQVBoxLayout *upsLayout = new TQVBoxLayout( upsTopLayout, spacingHint (),"upsLayout" );
// vytvorime tlacitka
KPushButton *newButton = new KPushButton (i18n("&Add"),page);
KPushButton *editButton = new KPushButton (i18n("&Edit"),page);
KPushButton *deleteButton = new KPushButton (i18n("&Delete"),page);
// includes buttons into layout / vlozime tlacitka do layoutu
// includes buttons into tqlayout / vlozime tlacitka do tqlayoutu
upsLayout->addWidget( newButton );
upsLayout->addWidget( editButton );
upsLayout->addWidget( deleteButton );
upsLayout->addStretch( 10 );
connect (newButton,SIGNAL(clicked()),this,SLOT(slotNewUps()));
connect (editButton,SIGNAL(clicked()),this,SLOT(slotEditUps()));
connect (deleteButton,SIGNAL(clicked()),this,SLOT(slotDeleteUps()));
connect (m_listBox2,SIGNAL(doubleClicked(QListBoxItem*, const QPoint&)),this,SLOT(slotEditUps()));
connect (newButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotNewUps()));
connect (editButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotEditUps()));
connect (deleteButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotDeleteUps()));
connect (m_listBox2,TQT_SIGNAL(doubleClicked(TQListBoxItem*, const TQPoint&)),this,TQT_SLOT(slotEditUps()));
}
void KNutPrefDlg::initDock () {
m_dockPix = UserIcon ("knc_dock");
QFrame *page = addPage( i18n("Dock bar"),i18n("Docking Setting"),m_dockPix);
TQFrame *page = addPage( i18n("Dock bar"),i18n("Docking Setting"),m_dockPix);
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
QButtonGroup *typeGroup = new QButtonGroup(i18n("Type of dock's showing"),page,"typeGroup");
QGridLayout *typeLayout = new QGridLayout (typeGroup,2,2,spacingHint());
TQButtonGroup *typeGroup = new TQButtonGroup(i18n("Type of dock's showing"),page,"typeGroup");
TQGridLayout *typeLayout = new TQGridLayout (typeGroup,2,2,spacingHint());
setTopLayout->addWidget(typeGroup);
QGroupBox *infoBox = new QGroupBox (i18n("Items of tooltip"),page ,"infoBox");
QGridLayout *infoLayout = new QGridLayout (infoBox,8,1,spacingHint());
TQGroupBox *infoBox = new TQGroupBox (i18n("Items of tooltip"),page ,"infoBox");
TQGridLayout *infoLayout = new TQGridLayout (infoBox,8,1,spacingHint());
setTopLayout->addWidget(infoBox);
QGridLayout *colorLayout = new QGridLayout (10,1,spacingHint(),"colorLayout");
TQGridLayout *colorLayout = new TQGridLayout (10,1,spacingHint(),"colorLayout");
setTopLayout->addLayout(colorLayout);
m_iconRadioButton1 = new QRadioButton(i18n("&Picture"), typeGroup, "iconRadioButton1" );
m_iconRadioButton2 = new QRadioButton(i18n("&General"), typeGroup, "iconRadioButton2" );
m_iconRadioButton1 = new TQRadioButton(i18n("&Picture"), typeGroup, "iconRadioButton1" );
m_iconRadioButton2 = new TQRadioButton(i18n("&General"), typeGroup, "iconRadioButton2" );
m_checkBoxTTMFR = new QCheckBox (i18n("M&anufacturer"),infoBox);
m_checkBoxTTMFR = new TQCheckBox (i18n("M&anufacturer"),infoBox);
m_checkBoxTTMFR->setChecked((m_settingData->toolTipFlags) & KNutDock::TTMFR);
m_checkBoxTTModel = new QCheckBox (i18n("M&odel"),infoBox);
m_checkBoxTTModel = new TQCheckBox (i18n("M&odel"),infoBox);
m_checkBoxTTModel->setChecked((m_settingData->toolTipFlags) & KNutDock::TTModel);
m_checkBoxTTSerial = new QCheckBox (i18n("&Serial"),infoBox);
m_checkBoxTTSerial = new TQCheckBox (i18n("&Serial"),infoBox);
m_checkBoxTTSerial->setChecked((m_settingData->toolTipFlags) & KNutDock::TTSerial);
m_checkBoxTTFirm = new QCheckBox (i18n("&Firm. rev."),infoBox);
m_checkBoxTTFirm = new TQCheckBox (i18n("&Firm. rev."),infoBox);
m_checkBoxTTFirm->setChecked((m_settingData->toolTipFlags) & KNutDock::TTFirm);
m_checkBoxTTRun = new QCheckBox (i18n("&Runtime"),infoBox);
m_checkBoxTTRun = new TQCheckBox (i18n("&Runtime"),infoBox);
m_checkBoxTTRun->setChecked((m_settingData->toolTipFlags) & KNutDock::TTRun);
m_checkBoxTTCharge = new QCheckBox (i18n("&Battery Charge"),infoBox);
m_checkBoxTTCharge = new TQCheckBox (i18n("&Battery Charge"),infoBox);
m_checkBoxTTCharge->setChecked((m_settingData->toolTipFlags) & KNutDock::TTCharge);
m_checkBoxTTLoad = new QCheckBox (i18n("&UPS Load"),infoBox);
m_checkBoxTTLoad = new TQCheckBox (i18n("&UPS Load"),infoBox);
m_checkBoxTTLoad->setChecked((m_settingData->toolTipFlags) & KNutDock::TTLoad);
m_iconDockLabel = new QLabel(i18n("Use custom icon's background color"),page,"label1");
m_checkBoxCbi = new QCheckBox ("",page,"checboxcbpc");
m_iconDockLabel = new TQLabel(i18n("Use custom icon's background color"),page,"label1");
m_checkBoxCbi = new TQCheckBox ("",page,"checboxcbpc");
m_dockBackgroundColorLabel = new QLabel(i18n("Color of icon's background :"),page,"label12");
m_dockBackgroundColorLabel = new TQLabel(i18n("Color of icon's background :"),page,"label12");
m_BGIButton = new KColorButton (page);
typeLayout->addRowSpacing (0 ,fontMetrics().lineSpacing() );
@ -755,8 +755,8 @@ void KNutPrefDlg::initDock () {
setTopLayout->addStretch( 20 );
connect (m_checkBoxCbi,SIGNAL(toggled(bool)),this,SLOT(slotUseCustomBIconColor(bool)));
connect (m_iconRadioButton1,SIGNAL(toggled(bool)),this,SLOT(slotSetPictureKI(bool)));
connect (m_checkBoxCbi,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBIconColor(bool)));
connect (m_iconRadioButton1,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotSetPictureKI(bool)));
}
@ -765,57 +765,57 @@ void KNutPrefDlg::initPanel () {
m_panelPix = UserIcon ("knc_panel");
// QFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),DesktopIcon("panel_settings"));
QFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),m_panelPix);
// TQFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),DesktopIcon("panel_settings"));
TQFrame *page = addPage( i18n("Panel"),i18n("Panel Setting"),m_panelPix);
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
QGroupBox *infoBox = new QGroupBox (page ,"infoBox");
QGridLayout *infoLayout = new QGridLayout (infoBox,10,1,spacingHint());
TQGroupBox *infoBox = new TQGroupBox (page ,"infoBox");
TQGridLayout *infoLayout = new TQGridLayout (infoBox,10,1,spacingHint());
setTopLayout->addWidget(infoBox);
QGridLayout *colorLayout = new QGridLayout (10,1,spacingHint(),"colorLayout");
TQGridLayout *colorLayout = new TQGridLayout (10,1,spacingHint(),"colorLayout");
setTopLayout->addLayout(colorLayout);
// vytvorime widgety - Nazev Zatrhavaci box
//makes widgets - name checkbox
m_checkBoxOver = new QCheckBox (i18n("UPS &Overload"),infoBox);
m_checkBoxOver = new TQCheckBox (i18n("UPS &Overload"),infoBox);
m_checkBoxOver->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBOver);
m_checkBoxBL = new QCheckBox (i18n("UPS &Battery low"),infoBox);
m_checkBoxBL = new TQCheckBox (i18n("UPS &Battery low"),infoBox);
m_checkBoxBL->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBBattLow);
m_checkBoxRB = new QCheckBox (i18n("R&eplace battery"),infoBox);
m_checkBoxRB = new TQCheckBox (i18n("R&eplace battery"),infoBox);
m_checkBoxRB->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBRepBatt);
m_checkBoxCal = new QCheckBox (i18n("Ups &calibration"),infoBox);
m_checkBoxCal = new TQCheckBox (i18n("Ups &calibration"),infoBox);
m_checkBoxCal->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBCal);
m_checkBoxMFRM = new QCheckBox (i18n("&Manufac. + Model"),infoBox);
m_checkBoxMFRM = new TQCheckBox (i18n("&Manufac. + Model"),infoBox);
m_checkBoxMFRM->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBMFRMod);
m_checkBoxMFR = new QCheckBox (i18n("M&anufacturer"),infoBox);
m_checkBoxMFR = new TQCheckBox (i18n("M&anufacturer"),infoBox);
m_checkBoxMFR->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBMFR);
m_checkBoxModel = new QCheckBox (i18n("M&odel"),infoBox);
m_checkBoxModel = new TQCheckBox (i18n("M&odel"),infoBox);
m_checkBoxModel->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBModel);
m_checkBoxSerial = new QCheckBox (i18n("&Serial"),infoBox);
m_checkBoxSerial = new TQCheckBox (i18n("&Serial"),infoBox);
m_checkBoxSerial->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBSerial);
m_checkBoxFirm = new QCheckBox (i18n("&Firm. rev."),infoBox);
m_checkBoxFirm = new TQCheckBox (i18n("&Firm. rev."),infoBox);
m_checkBoxFirm->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBFirm);
m_checkBoxRun = new QCheckBox (i18n("&Runtime"),infoBox);
m_checkBoxRun = new TQCheckBox (i18n("&Runtime"),infoBox);
m_checkBoxRun->setChecked((m_settingData->panelFlags) & KNutFrontPanel::PBRun);
QLabel *initPanelLabel1 = new QLabel(i18n("Use custom background color"),page,"label1");
m_checkBoxCbpc = new QCheckBox ("",page,"checboxcbpc");
TQLabel *initPanelLabel1 = new TQLabel(i18n("Use custom background color"),page,"label1");
m_checkBoxCbpc = new TQCheckBox ("",page,"checboxcbpc");
m_panelBackgroundColorLabel = new QLabel(i18n("Color of background :"),page,"m_panelBackgroundColorLabel");
m_panelBackgroundColorLabel = new TQLabel(i18n("Color of background :"),page,"m_panelBackgroundColorLabel");
m_BGPButton = new KColorButton (page);
// includes widgets
@ -842,20 +842,20 @@ void KNutPrefDlg::initPanel () {
m_BGPButton->setEnabled(m_settingData->customBPanelColor);
m_panelBackgroundColorLabel->setEnabled(m_settingData->customBPanelColor);
m_panelBackgroundColorLabel->setEnabled(m_settingData->customBPanelColor);
connect (m_checkBoxCbpc,SIGNAL(toggled(bool)),this,SLOT(slotUseCustomBPanelColor(bool)));
connect (m_checkBoxCbpc,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBPanelColor(bool)));
}
void KNutPrefDlg::initFonts () {
QFrame *page = addPage( i18n("Fonts"),i18n("Setting Fonts"),DesktopIcon("fonts"));
TQFrame *page = addPage( i18n("Fonts"),i18n("Setting Fonts"),DesktopIcon("fonts"));
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
QHBoxLayout *setSysLayout = new QHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
QHBoxLayout *setTypeLayout = new QHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
QHBoxLayout *setFontLayout = new QHBoxLayout( setTopLayout, spacingHint (), "setFontLayout" );
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
TQHBoxLayout *setSysLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
TQHBoxLayout *setTypeLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setTypeLayout" );
TQHBoxLayout *setFontLayout = new TQHBoxLayout( setTopLayout, spacingHint (), "setFontLayout" );
m_customFont = new QCheckBox (i18n("&Use custom font"),page);
m_customFont = new TQCheckBox (i18n("&Use custom font"),page);
setSysLayout->addWidget ( m_customFont ,10);
setSysLayout->addStretch( 10 );
@ -878,39 +878,39 @@ void KNutPrefDlg::initFonts () {
m_settingFont = MAIN_PANEL_FONT; // sets font for Main Panel / nastavujeme font pro Main Panel
m_fontWidget->setFont(m_mPanelFont);
m_fontWidget->setEnabled(m_settingData->customFont);
connect (panelFonts,SIGNAL(activated(int)),this,SLOT(slotChangeSettingFont(int)));
connect (m_customFont,SIGNAL(toggled(bool)),m_fontWidget,SLOT(setEnabled(bool)));
connect (panelFonts,TQT_SIGNAL(activated(int)),this,TQT_SLOT(slotChangeSettingFont(int)));
connect (m_customFont,TQT_SIGNAL(toggled(bool)),m_fontWidget,TQT_SLOT(setEnabled(bool)));
}
void KNutPrefDlg::initAnalog () {
m_analogPix = UserIcon ("knc_analog");
QFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),m_analogPix);
// QFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),DesktopIcon("ksysguard"));
QVBoxLayout *setTopLayout = new QVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
QGridLayout *setColorLayout = new QGridLayout( 9,2, spacingHint(),"setColorLayout");
TQFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),m_analogPix);
// TQFrame *page = addPage( i18n("Analog"),i18n("Setting Analog panel"),DesktopIcon("ksysguard"));
TQVBoxLayout *setTopLayout = new TQVBoxLayout( page, 10, spacingHint (), "setTopLayout" );
TQGridLayout *setColorLayout = new TQGridLayout( 9,2, spacingHint(),"setColorLayout");
setTopLayout->addLayout(setColorLayout);
setTopLayout->addStretch( 20 );
QLabel *initAnalogLabel1 = new QLabel(i18n("Use custom background color"),page,"initAnalogLabel1");
m_checkBoxCbac = new QCheckBox ("",page,"checboxcbac");
m_analogBackgroundColorLabel = new QLabel(i18n("Color of background :"),page,"m_backgroundColorLabel");
TQLabel *initAnalogLabel1 = new TQLabel(i18n("Use custom background color"),page,"initAnalogLabel1");
m_checkBoxCbac = new TQCheckBox ("",page,"checboxcbac");
m_analogBackgroundColorLabel = new TQLabel(i18n("Color of background :"),page,"m_backgroundColorLabel");
m_BGAButton = new KColorButton (page);
QLabel *initAnalogLabel12 = new QLabel(i18n("Use custom other colors"),page,"label12");
m_checkBoxCoac = new QCheckBox ("",page,"checboxcoac");
m_analogPointerColorLabel = new QLabel(i18n("Color of pointer :"),page,"m_analogPointerColorLabel");
TQLabel *initAnalogLabel12 = new TQLabel(i18n("Use custom other colors"),page,"label12");
m_checkBoxCoac = new TQCheckBox ("",page,"checboxcoac");
m_analogPointerColorLabel = new TQLabel(i18n("Color of pointer :"),page,"m_analogPointerColorLabel");
m_AFingerButton = new KColorButton (page);
m_analogOKColorLabel = new QLabel(i18n("Color of OK range :"),page,"label7");
m_analogOKColorLabel = new TQLabel(i18n("Color of OK range :"),page,"label7");
m_AOKButton = new KColorButton (page);
m_analogWarningColorLabel = new QLabel(i18n("Color of warning range :"),page,"label8");
m_analogWarningColorLabel = new TQLabel(i18n("Color of warning range :"),page,"label8");
m_AWarnningButton = new KColorButton (page);
m_analogErrorColorLabel= new QLabel(i18n("Color of error range :"),page,"label9");
m_analogErrorColorLabel= new TQLabel(i18n("Color of error range :"),page,"label9");
m_AErrorButton = new KColorButton (page);
m_analogScaleColorLabel = new QLabel(i18n("Color of scale :"),page,"label10");
m_analogScaleColorLabel = new TQLabel(i18n("Color of scale :"),page,"label10");
m_AScaleButton = new KColorButton (page);
m_analogFontColorLabel = new QLabel(i18n("Color of font :"),page,"label11");
m_analogFontColorLabel = new TQLabel(i18n("Color of font :"),page,"label11");
m_AFontButton = new KColorButton (page);
m_digitalProcessingLabel = new QLabel(i18n("Digital processing of pointers :"),page,"label12");
m_digitalProcessingLabel = new TQLabel(i18n("Digital processing of pointers :"),page,"label12");
m_digitalProcesingOfPointers = new KComboBox (page);
@ -970,8 +970,8 @@ void KNutPrefDlg::initAnalog () {
m_digitalProcesingOfPointers->setCurrentItem(m_settingData->typeDigitalProcessing);
connect (m_checkBoxCbac,SIGNAL(toggled(bool)),this,SLOT(slotUseCustomBAnalogColor(bool)));
connect (m_checkBoxCoac,SIGNAL(toggled(bool)),this,SLOT(slotUseCustomOAnalogColor(bool)));
connect (m_checkBoxCbac,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomBAnalogColor(bool)));
connect (m_checkBoxCoac,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotUseCustomOAnalogColor(bool)));
}

@ -32,13 +32,13 @@
#include <kcolorbtn.h>
#include <kcombobox.h>
#include <qwidget.h>
#include <tqwidget.h>
class QLabel;
class QFont;
class QCheckBox;
class QRadioButton;
class QSpinBox;
class TQLabel;
class TQFont;
class TQCheckBox;
class TQRadioButton;
class TQSpinBox;
/**
@ -55,6 +55,7 @@ class QSpinBox;
class KNutPrefDlg : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
enum changePref {
@ -114,7 +115,7 @@ enum changePref {
*
* @since 0.5
**/
KNutPrefDlg(KNutUpsData* const upsData, KNutVarData* const analogData, KNutVarData::SettingDataDef* const settingData, const QString upsName, QWidget* parent = 0, const char* name = 0, const bool modal = true);
KNutPrefDlg(KNutUpsData* const upsData, KNutVarData* const analogData, KNutVarData::SettingDataDef* const settingData, const TQString upsName, TQWidget* tqparent = 0, const char* name = 0, const bool modal = true);
/**
* @since 0.3
@ -263,7 +264,7 @@ void slotUseCustomBIconColor(bool enable);
// Private values
QString m_activeUpsName; // name of UPS which is active
TQString m_activeUpsName; // name of UPS which is active
KNutUpsData* m_myUpsData;
KNutVarData* m_myAnalogData;
KNutVarData::SettingDataDef* m_settingData;
@ -274,56 +275,56 @@ void slotUseCustomBIconColor(bool enable);
bool m_checked; //it's settted when, definition(parameters) of UPS were chaged // nastaveno kdyz doslo k zmene v definici UPS
bool m_checkedActiveUps; //it's setted when, parameters of active UPS were changed // nastaveno pokud doslo ke zmene na aktivni UPS
QSpinBox *m_numberOfColumns;
TQSpinBox *m_numberOfColumns;
KColorButton *m_BGButton;
QCheckBox *m_checkBoxCbc;
QCheckBox *m_checkBoxAys;
// QCheckBox *m_checkBoxMW;
QCheckBox *m_checkBoxMesW;
TQCheckBox *m_checkBoxCbc;
TQCheckBox *m_checkBoxAys;
// TQCheckBox *m_checkBoxMW;
TQCheckBox *m_checkBoxMesW;
KComboBox *m_comboBoxMainWindow;
QCheckBox *m_xfer;
QCheckBox *m_checkBoxOver;
QCheckBox *m_checkBoxBL;
QCheckBox *m_checkBoxRB;
QCheckBox *m_checkBoxCal;
QCheckBox *m_checkBoxMFRM;
QCheckBox *m_checkBoxMFR;
QCheckBox *m_checkBoxModel;
QCheckBox *m_checkBoxSerial;
QCheckBox *m_checkBoxFirm;
QCheckBox *m_checkBoxRun;
QCheckBox *m_checkBoxCbpc;
QCheckBox* m_checkBoxCbac;
QCheckBox* m_checkBoxCoac;
QCheckBox *m_checkBoxCbi;
QCheckBox *m_checkBoxTTMFR;
QCheckBox *m_checkBoxTTModel;
QCheckBox *m_checkBoxTTSerial;
QCheckBox *m_checkBoxTTFirm;
QCheckBox *m_checkBoxTTRun;
QCheckBox *m_checkBoxTTCharge;
QCheckBox *m_checkBoxTTLoad;
QLabel *m_panelBackgroundColorLabel;
QLabel *m_mainBackgroundColorLabel;
QLabel *m_analogBackgroundColorLabel;
QLabel *m_dockBackgroundColorLabel;
QLabel *m_analogPointerColorLabel;
QLabel *m_analogOKColorLabel;
QLabel *m_analogWarningColorLabel;
QLabel *m_analogErrorColorLabel;
QLabel *m_analogScaleColorLabel;
QLabel *m_analogFontColorLabel;
QLabel *m_digitalProcessingLabel;
QLabel *m_iconDockLabel;
QRadioButton *m_vRadioButton1;
QRadioButton *m_vRadioButton2;
QRadioButton *m_fRadioButton1;
QRadioButton *m_fRadioButton2;
QRadioButton *m_iconRadioButton1;
QRadioButton *m_iconRadioButton2;
TQCheckBox *m_xfer;
TQCheckBox *m_checkBoxOver;
TQCheckBox *m_checkBoxBL;
TQCheckBox *m_checkBoxRB;
TQCheckBox *m_checkBoxCal;
TQCheckBox *m_checkBoxMFRM;
TQCheckBox *m_checkBoxMFR;
TQCheckBox *m_checkBoxModel;
TQCheckBox *m_checkBoxSerial;
TQCheckBox *m_checkBoxFirm;
TQCheckBox *m_checkBoxRun;
TQCheckBox *m_checkBoxCbpc;
TQCheckBox* m_checkBoxCbac;
TQCheckBox* m_checkBoxCoac;
TQCheckBox *m_checkBoxCbi;
TQCheckBox *m_checkBoxTTMFR;
TQCheckBox *m_checkBoxTTModel;
TQCheckBox *m_checkBoxTTSerial;
TQCheckBox *m_checkBoxTTFirm;
TQCheckBox *m_checkBoxTTRun;
TQCheckBox *m_checkBoxTTCharge;
TQCheckBox *m_checkBoxTTLoad;
TQLabel *m_panelBackgroundColorLabel;
TQLabel *m_mainBackgroundColorLabel;
TQLabel *m_analogBackgroundColorLabel;
TQLabel *m_dockBackgroundColorLabel;
TQLabel *m_analogPointerColorLabel;
TQLabel *m_analogOKColorLabel;
TQLabel *m_analogWarningColorLabel;
TQLabel *m_analogErrorColorLabel;
TQLabel *m_analogScaleColorLabel;
TQLabel *m_analogFontColorLabel;
TQLabel *m_digitalProcessingLabel;
TQLabel *m_iconDockLabel;
TQRadioButton *m_vRadioButton1;
TQRadioButton *m_vRadioButton2;
TQRadioButton *m_fRadioButton1;
TQRadioButton *m_fRadioButton2;
TQRadioButton *m_iconRadioButton1;
TQRadioButton *m_iconRadioButton2;
KColorButton *m_BGPButton;
KColorButton* m_BGAButton;
@ -337,22 +338,22 @@ void slotUseCustomBIconColor(bool enable);
KComboBox* m_digitalProcesingOfPointers;
QButtonGroup *m_voltageGroup;
QButtonGroup *m_frequencyGroup;
TQButtonGroup *m_voltageGroup;
TQButtonGroup *m_frequencyGroup;
QCheckBox* m_customFont; // User's font
TQCheckBox* m_customFont; // User's font
KFontChooser *m_fontWidget;
QFont m_aPanelFont; // Analog panel font
QFont m_mPanelFont; // Main panel font
TQFont m_aPanelFont; // Analog panel font
TQFont m_mPanelFont; // Main panel font
int m_settingFont; // which font is setted (selected)
QPixmap m_panelPix;
QPixmap m_mSetPix;
QPixmap m_upsesPix;
QPixmap m_analogPix;
QPixmap m_dockPix;
TQPixmap m_panelPix;
TQPixmap m_mSetPix;
TQPixmap m_upsesPix;
TQPixmap m_analogPix;
TQPixmap m_dockPix;
};

@ -22,13 +22,13 @@
#include <kglobal.h>
#include <kiconloader.h>
#include <qgroupbox.h>
#include <qscrollview.h>
#include <qtooltip.h>
#include <qlabel.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qstring.h>
#include <tqgroupbox.h>
#include <tqscrollview.h>
#include <tqtooltip.h>
#include <tqlabel.h>
#include <tqframe.h>
#include <tqpixmap.h>
#include <tqstring.h>
@ -37,8 +37,8 @@
// od verze 0.6.0 nebudeme vytvaret vlastni spojeni
KNutPrintUpsVar::KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescription, QWidget* parent, const char* name, const bool modal )
: KDialogBase(Plain, i18n("Variables"),User1|Cancel,Ok, parent, name, modal, true), myUpsNet(upsNet){
KNutPrintUpsVar::KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescription, TQWidget* tqparent, const char* name, const bool modal )
: KDialogBase(Plain, i18n("Variables"),User1|Cancel,Ok, tqparent, name, modal, true), myUpsNet(upsNet){
upsVarDef upsVar;
upsICommDef upsIComm;
@ -67,7 +67,7 @@ KNutPrintUpsVar::KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescriptio
dirPixmap=loader->loadIcon ("folder_open",KIcon::Small,16);
page = plainPage();
QHBoxLayout* upsVarsMainLayout = new QHBoxLayout(page);
TQHBoxLayout* upsVarsMainLayout = new TQHBoxLayout(page);
table = new KListView(page);
table->setRootIsDecorated(true);
@ -135,7 +135,7 @@ KNutPrintUpsVar::KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescriptio
}
}
connect (this,SIGNAL(user1Clicked()),this,SLOT(slotReloadVars()));
connect (this,TQT_SIGNAL(user1Clicked()),this,TQT_SLOT(slotReloadVars()));
} // end else
}
@ -155,7 +155,7 @@ void KNutPrintUpsVar::slotReloadVars (void) {
KNutVarData::showError (myUpsNet->getError());
else {
QValueVector<dataVar>::const_iterator it;
TQValueVector<dataVar>::const_iterator it;
for (it = dataList.begin(); it != dataList.end(); it++) {
myUpsNet->readVars((*it).myName, upsVar);
(*it).myValue->setText (1, upsVar.upsValue);
@ -163,15 +163,15 @@ void KNutPrintUpsVar::slotReloadVars (void) {
}
}
KListViewItem* KNutPrintUpsVar::addListItem (KListViewItem* table, QString varName, QString value) {
KListViewItem* KNutPrintUpsVar::addListItem (KListViewItem* table, TQString varName, TQString value) {
KListViewItem* myListItem;
KListViewItem* helpListItem;
QString left;
TQString left;
int n;
myListItem = table;
do {
n = varName.find(".");
n = varName.tqfind(".");
if (n > 0) {
left = varName.left(n);
varName = varName.mid(n+1);
@ -192,7 +192,7 @@ void KNutPrintUpsVar::slotReloadVars (void) {
}
KListViewItem* KNutPrintUpsVar::existListItem (KListViewItem* listItem, QString name) {
KListViewItem* KNutPrintUpsVar::existListItem (KListViewItem* listItem, TQString name) {
KListViewItem* myItem;
if (!(myItem = (KListViewItem *)listItem->firstChild())) return 0l;

@ -30,17 +30,17 @@
#include <klistview.h>
#include <qvariant.h>
#include <qlayout.h>
#include <qvaluelist.h>
#include <tqvariant.h>
#include <tqlayout.h>
#include <tqvaluelist.h>
#include <qvaluevector.h>
#include <tqvaluevector.h>
class QLabel;
class QPixmap;
class QFramel;
class QString;
class TQLabel;
class TQPixmap;
class TQFramel;
class TQString;
/**
*@author Daniel Prynych
@ -57,6 +57,7 @@ class QString;
class KNutPrintUpsVar : public KDialogBase {
Q_OBJECT
TQ_OBJECT
public:
/**
@ -70,7 +71,7 @@ public:
*
* since 0.3.1
**/
KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescription, QWidget* parent = 0, const char* name = 0, const bool modal = true);
KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescription, TQWidget* tqparent = 0, const char* name = 0, const bool modal = true);
/**
* @since 0.1
@ -101,18 +102,18 @@ protected:
KPushButton* reloadButton;
struct dataVar {
QString myName;
TQString myName;
KListViewItem* myValue;
};
QValueVector<dataVar> dataList;
TQValueVector<dataVar> dataList;
KListViewItem* ROVarsList;
KListViewItem* RWVarsList;
KListViewItem* ICommList;
QFrame *page;
TQFrame *page;
KListView* table;
QPixmap dirPixmap;
TQPixmap dirPixmap;
bool upsConnectOk;
@ -132,7 +133,7 @@ protected:
*
* @since 0.2.1
**/
KListViewItem* addListItem (KListViewItem* table, QString varName, QString value);
KListViewItem* addListItem (KListViewItem* table, TQString varName, TQString value);
/**
* @internal
@ -143,7 +144,7 @@ protected:
*
* @since 0.2
**/
KListViewItem* existListItem (KListViewItem* listItem, QString name);
KListViewItem* existListItem (KListViewItem* listItem, TQString name);
protected slots:

@ -28,16 +28,16 @@
#include <klocale.h>
#include <qframe.h>
#include <qlabel.h>
#include <qstring.h>
#include <qlayout.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <tqstring.h>
#include <tqlayout.h>
//#include <iostream>
KNutRWVar::KNutRWVar(QString* userName, QString* userPassword, const QString uName, const QString password, KNutNet* const initUpsNet, QWidget* parent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("RW variables"),Ok|Cancel|Default,Ok, parent, name, modal, true), m_upsNet(initUpsNet){
KNutRWVar::KNutRWVar(TQString* userName, TQString* userPassword, const TQString uName, const TQString password, KNutNet* const initUpsNet, TQWidget* tqparent, const char* name, const bool modal)
: KDialogBase(Plain, i18n("RW variables"),Ok|Cancel|Default,Ok, tqparent, name, modal, true), m_upsNet(initUpsNet){
upsVarDef upsVar;
// int error;
@ -51,24 +51,24 @@ KNutRWVar::KNutRWVar(QString* userName, QString* userPassword, const QString uNa
m_oldUserPassword = userPassword;
m_upsConnectOk = true;
QFrame *page = plainPage();
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
QLabel *label1 = new QLabel (i18n("SET RW VARIABLE"),page,"label1");
label1->setAlignment(Qt::AlignHCenter);
TQFrame *page = plainPage();
TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );
TQLabel *label1 = new TQLabel (i18n("SET RW VARIABLE"),page,"label1");
label1->tqsetAlignment(TQt::AlignHCenter);
topLayout->addWidget(label1);
QLabel *label2 = new QLabel (i18n("Variable:"),page,"label2");
TQLabel *label2 = new TQLabel (i18n("Variable:"),page,"label2");
m_rWVarBox = new KComboBox(page,"rwvarbox");
QLabel *label3 = new QLabel (i18n("Value:"),page,"label2");
TQLabel *label3 = new TQLabel (i18n("Value:"),page,"label2");
m_valueVarBox = new KComboBox(page,"valuevarbox");
m_valueVarLine = new KLineEdit(page,"valuevarLine");
m_valueVarLine->hide();
m_passLayout = new QGridLayout (4,2,5,"passLayout");
QLabel *labelName = new QLabel (i18n("User name:"),page,"labelName");
QLabel *labelPassword = new QLabel (i18n("Password:"),page,"labelPassword");
m_passLayout = new TQGridLayout (4,2,5,"passLayout");
TQLabel *labelName = new TQLabel (i18n("User name:"),page,"labelName");
TQLabel *labelPassword = new TQLabel (i18n("Password:"),page,"labelPassword");
m_lineEditName = new KLineEdit( page, "LineEditName" );
m_lineEditPassword = new KLineEdit( page, "LineEditName" );
@ -87,7 +87,7 @@ KNutRWVar::KNutRWVar(QString* userName, QString* userPassword, const QString uNa
m_lineEditPassword->setDisabled(true);
}
m_lineEditPassword->setEchoMode(QLineEdit::Password);
m_lineEditPassword->setEchoMode(TQLineEdit::Password);
topLayout->addLayout(m_passLayout);
@ -116,11 +116,11 @@ KNutRWVar::KNutRWVar(QString* userName, QString* userPassword, const QString uNa
m_valueVarLine->show();
m_upsValueType=true;
}
connect (m_rWVarBox,SIGNAL(activated(int)),this,SLOT(slotChangeVar(int)));
connect (m_rWVarBox,TQT_SIGNAL(activated(int)),this,TQT_SLOT(slotChangeVar(int)));
}
}
int KNutRWVar::findItem(const KComboBox *myBox, const QString text) {
int KNutRWVar::findItem(const KComboBox *myBox, const TQString text) {
int n;
if ((n=myBox->count())) {
@ -135,7 +135,7 @@ void KNutRWVar::slotDefault () {
upsVarDef upsVar;
int error;
QString varName = m_rWVarBox->currentText();
TQString varName = m_rWVarBox->currentText();
if (!( error = m_upsNet->readVars(varName,upsVar))) {
if (upsVar.upsValueType) m_valueVarLine->setText(upsVar.upsValue);
else m_valueVarBox->setCurrentItem(upsVar.upsValue);
@ -147,7 +147,7 @@ void KNutRWVar::slotDefault () {
void KNutRWVar::slotChangeVar(int item) {
upsVarDef upsVar;
QString varName = m_rWVarBox->text(item);
TQString varName = m_rWVarBox->text(item);
int error = m_upsNet->readVars(varName,upsVar);
m_upsValueType=upsVar.upsValueType;
if (error || (upsVar.upsValueType)) {
@ -180,7 +180,7 @@ bool KNutRWVar::upsOk (void) { return m_upsConnectOk; }
void KNutRWVar::slotOk() {
QString value;
TQString value;
int error =0;
if (m_upsValueType) value=m_valueVarLine->text();
else value=m_valueVarBox->currentText();
@ -191,7 +191,7 @@ void KNutRWVar::slotOk() {
if (!(error = m_upsNet->setVariable(m_rWVarBox->currentText(), value, m_lineEditName->text(),m_lineEditPassword->text(),false))) {
// vzhledem k asynchronimu spracovani asi zbytecne
// myUpsNet->getUpsValues(true);
emit signalChangeRWVars(m_rWVarBox->currentText());//emits command for loading of variable and repaint of panel
emit signalChangeRWVars(m_rWVarBox->currentText());//emits command for loading of variable and tqrepaint of panel
(*m_oldUserName) = m_lineEditName->text();
(*m_oldUserPassword) = m_lineEditPassword->text();
@ -204,7 +204,7 @@ void KNutRWVar::slotOk() {
// next line isn't needed, maybe
// vzhledem k asynchronimu spracovani asi zbytecne
// myUpsNet->getUpsValues(true);
emit signalChangeRWVars(m_rWVarBox->currentText()); //emits command for loading of variable and repaint of panel
emit signalChangeRWVars(m_rWVarBox->currentText()); //emits command for loading of variable and tqrepaint of panel
accept();
}
}

@ -26,8 +26,8 @@
#include <kcombobox.h>
class QString;
class QGridLayout;
class TQString;
class TQGridLayout;
/**
* This class is graphics interface for changes of RW variables.
@ -39,6 +39,7 @@ class QGridLayout;
*/
class KNutRWVar : public KDialogBase {
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor - makes window for change of RW variable.
@ -55,7 +56,7 @@ class KNutRWVar : public KDialogBase {
* @param initUpsNet Je odkaz na instanci tridy KNutNet.
* @since 0.2
**/
KNutRWVar(QString* userName, QString* userPassword, const QString uName, const QString password, KNutNet* const initUpsNet, QWidget* parent = 0, const char* name = 0, const bool modal = TRUE);
KNutRWVar(TQString* userName, TQString* userPassword, const TQString uName, const TQString password, KNutNet* const initUpsNet, TQWidget* tqparent = 0, const char* name = 0, const bool modal = TRUE);
/**
* Destructor
@ -107,7 +108,7 @@ class KNutRWVar : public KDialogBase {
* Najde pozadovanou polozku v boxu.
* Ve verzi qt > 3.0.0 neni potreba.
*/
int findItem(const KComboBox *myBox ,const QString text);
int findItem(const KComboBox *myBox ,const TQString text);
signals:
/**
@ -117,7 +118,7 @@ int findItem(const KComboBox *myBox ,const QString text);
*
* @since 0.1
**/
void signalChangeRWVars (QString varName);
void signalChangeRWVars (TQString varName);
private:
@ -127,12 +128,12 @@ int findItem(const KComboBox *myBox ,const QString text);
KComboBox *m_rWVarBox;
KComboBox *m_valueVarBox;
KLineEdit *m_valueVarLine;
QGridLayout *m_passLayout;
TQGridLayout *m_passLayout;
bool m_upsValueType;
bool m_upsConnectOk;
QString* m_oldUserName;
QString* m_oldUserPassword;
TQString* m_oldUserName;
TQString* m_oldUserPassword;
};

@ -18,7 +18,7 @@
#include "knutupsdata.h"
#include "knutvardata.h"
#include <qstring.h>
#include <tqstring.h>
KNutUpsData::KNutUpsData() {
@ -47,7 +47,7 @@ void KNutUpsData::get (const int index, upsRecordDef& upsRecord ) {
if ((index > -1 ) && (index < m_countUpsRecords)) upsRecord=m_listRecords[index];
}
QString KNutUpsData::getName (const int index) {
TQString KNutUpsData::getName (const int index) {
if ((index > -1 ) && (index < m_countUpsRecords)) return m_listRecords[index].name;
else return 0L;
}
@ -55,7 +55,7 @@ QString KNutUpsData::getName (const int index) {
void KNutUpsData::deleteName (const int index) {
if ((index > -1 ) && (index < m_countUpsRecords)) {
QValueList<upsRecordDef>::Iterator it = m_listRecords.begin();
TQValueList<upsRecordDef>::Iterator it = m_listRecords.begin();
for (int i =0; i < index; i++) it++;
m_listRecords.remove(it);
m_countUpsRecords--;
@ -66,8 +66,8 @@ void KNutUpsData::deleteName (const int index) {
int KNutUpsData::getCount ( void ) { return m_countUpsRecords; }
KNutUpsData::upsRecordDef* KNutUpsData::findName (const QString name) {
QValueList<upsRecordDef>::Iterator it;
KNutUpsData::upsRecordDef* KNutUpsData::findName (const TQString name) {
TQValueList<upsRecordDef>::Iterator it;
for (it = m_listRecords.begin(); it != m_listRecords.end(); it++) {
if ((*it).name == name) {
return &(*it); // vratime adresu

@ -21,10 +21,10 @@
#include "knutconst.h"
#include "knutanalog.h"
#include <qstring.h>
#include <qvaluelist.h>
#include <tqstring.h>
#include <tqvaluelist.h>
class QString;
class TQString;
/**
*@author Daniel Prynych
@ -48,13 +48,13 @@ public:
struct upsRecordDef { //include information about one UPS
QString name; // name
QString upsName; // name of UPSky <> mojeups
QString upsAddress; // address of UPS <> muj.pc.cz
TQString name; // name
TQString upsName; // name of UPSky <> mojeups
TQString upsAddress; // address of UPS <> muj.pc.cz
long delay; // time between read date from UPS
unsigned short port; // port for connecting server
QString userName;
QString password;
TQString userName;
TQString password;
bool savePassword; //save password into configuration
int upsVarCode[knc::NumberOfVars];
};
@ -118,7 +118,7 @@ struct upsRecordDef { //include information about one UPS
* @param index Udava poradove cislo zaznamu.
* @since 0.3
**/
QString getName (const int index);
TQString getName (const int index);
/**
* Deletes record;
@ -147,14 +147,14 @@ struct upsRecordDef { //include information about one UPS
* @param name Je jmeno zaznamu.
* @since 0.3
**/
upsRecordDef* findName (const QString name);
upsRecordDef* findName (const TQString name);
private:
int m_countUpsRecords;
QValueList<upsRecordDef> m_listRecords;
TQValueList<upsRecordDef> m_listRecords;
};

@ -21,7 +21,7 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <qcolor.h>
#include <tqcolor.h>
//#include <iostream>
@ -55,7 +55,7 @@ KNutVarData::KNutVarData(){
m_upsVarNameAnalog[12] = i18n("Battery Temperature");
m_upsVarNameAnalog[13] = i18n("Battery Current");
static const QString upsVarNameUnit[] = {"", "V", "%", "C", "Hz", "%", "C", "%", "V", "V", "A","Hz","C", "A"};
static const TQString upsVarNameUnit[] = {"", "V", "%", "C", "Hz", "%", "C", "%", "V", "V", "A","Hz","C", "A"};
static const int upsVarType[] = {0,3,2,1,1,2,1,1,3,3,2,1,1,2}; //typ panelu
static const int upsVarItem[] = {5,4,5,5,6,6,5,5,5,4,5,6,5,5}; // pocet velkych policek na stupnici
static const int upsVarInItem[] = {0,3,0,0,4,0,0,0,0,3,5,4,0,5}; // pocet malych policek ve velkem policku na stupnici
@ -132,7 +132,7 @@ KNutVarData::VarStrucDef KNutVarData::getData (const int seqNumber) const {
QString KNutVarData::getNameAnalogData (const int seqNumber) {
TQString KNutVarData::getNameAnalogData (const int seqNumber) {
if ((seqNumber >= 0) && (seqNumber < knc::NumberOfTypes))
return m_upsVarNameAnalog[seqNumber];
else
@ -178,7 +178,7 @@ void KNutVarData::setXfer (const float lowXfer, const float highXfer) {
}
const QString KNutVarData::errorToText (const int error) {
const TQString KNutVarData::errorToText (const int error) {
switch (error) {

@ -23,14 +23,14 @@
/* GLOBAL DEFINE */
/*******************************/
#define DEFAULT_BG_COLOR Qt::lightGray
#define DEFAULT_FINGER_COLOR Qt::black
#define DEFAULT_OK_COLOR Qt::green
#define DEFAULT_WARNNING_COLOR Qt::yellow
#define DEFAULT_ERROR_COLOR Qt::red
#define DEFAULT_SCALE_COLOR Qt::black
#define DEFAULT_FONT_COLOR Qt::black
#define DEFAULT_KICON_COLOR Qt::white
#define DEFAULT_BG_COLOR TQt::lightGray
#define DEFAULT_FINGER_COLOR TQt::black
#define DEFAULT_OK_COLOR TQt::green
#define DEFAULT_WARNNING_COLOR TQt::yellow
#define DEFAULT_ERROR_COLOR TQt::red
#define DEFAULT_SCALE_COLOR TQt::black
#define DEFAULT_FONT_COLOR TQt::black
#define DEFAULT_KICON_COLOR TQt::white
#include <klocale.h>
@ -38,9 +38,9 @@
#include "knutupsdata.h"
#include "knutconst.h"
#include <qcolor.h>
#include <qfont.h>
#include <qstring.h>
#include <tqcolor.h>
#include <tqfont.h>
#include <tqstring.h>
// const char *nameUpsVars1[] = {
@ -68,9 +68,9 @@
* @version 0.4
**/
class QString;
class QColor;
class QFont;
class TQString;
class TQColor;
class TQFont;
class KNutVarData {
@ -94,15 +94,15 @@ struct SettingDataDef {
int y;
int width;
int height;
QColor mainBackgroundColor;
QColor mPanelBackgroundColor;
QColor aPanelBackgroundColor;
QColor analogFingerColor;
QColor analogOKColor;
QColor analogWarnningColor;
QColor analogErrorColor;
QColor analogScaleColor;
QColor analogFontColor;
TQColor mainBackgroundColor;
TQColor mPanelBackgroundColor;
TQColor aPanelBackgroundColor;
TQColor analogFingerColor;
TQColor analogOKColor;
TQColor analogWarnningColor;
TQColor analogErrorColor;
TQColor analogScaleColor;
TQColor analogFontColor;
unsigned int panelFlags;
int inputVoltage;
int inputFrequency;
@ -114,14 +114,14 @@ struct SettingDataDef {
bool customBPanelColor;
bool customBAnalogColor;
bool customOAnalogColor;
QFont mPanelFont; // main panel font
QFont aPanelFont; // analog panel font
QFont systemFont; // system font
TQFont mPanelFont; // main panel font
TQFont aPanelFont; // analog panel font
TQFont systemFont; // system font
bool customFont; // use custom font
bool useDescription;
unsigned int toolTipFlags;
bool customKIconColor;
QColor kIconBackgroundColor;
TQColor kIconBackgroundColor;
int typeOfKIcon;
int typeDigitalProcessing;
bool activatedMainWindow;
@ -135,22 +135,22 @@ struct upsInfoDef{ //include generally informations about active (selected) UPS
// state of connection to usbd, this isn't state of knutnet
knc::upsDriverConnection upsDriverState; // defined in knutconst.h
int oldState; // code of lost state of UPS kod posledniho stavu UPS
QString name;
QString password;
TQString name;
TQString password;
int nutVariables;
int nutProtocol;
QString runtimeVar;
QString lowxferVar;
QString highxferVar;
QString statusVar;
QString upsLoadVar;
TQString runtimeVar;
TQString lowxferVar;
TQString highxferVar;
TQString statusVar;
TQString upsLoadVar;
bool reconnecting; // is true when program is in reconnecting stage
int reconnectCount;
};
struct VarStrucDef {
QString nameAnalog; // jmeno promene v meraku napr. UPS Load
QString nameUnit; // merna jednotka napr %
TQString nameAnalog; // jmeno promene v meraku napr. UPS Load
TQString nameUnit; // merna jednotka napr %
int typeAnalog; //typ meraku
int numberItem; //pocet casti stupnice neni v souvislosti barvou
int numberInItem; //pocet casti stupnice uvnitr dilku stupnice
@ -223,7 +223,7 @@ void setXfer (const float lowXfer, const float highXfer);
* @param seqNumber Kod typu merakuss.
* @since 0.1
**/
QString getNameAnalogData (const int seqNumber);
TQString getNameAnalogData (const int seqNumber);
/**
@ -231,7 +231,7 @@ QString getNameAnalogData (const int seqNumber);
*
* @since 0.2
**/
static const QString errorToText (const int error);
static const TQString errorToText (const int error);
/**
@ -255,7 +255,7 @@ private:
static const int F50HZ = 0;
static const int F60HZ = 1;
QString m_upsVarNameAnalog[ knc::NumberOfTypes ];//array of strings - includes name of analog meters
TQString m_upsVarNameAnalog[ knc::NumberOfTypes ];//array of strings - includes name of analog meters
};
#endif

Loading…
Cancel
Save