TQt4 port kima

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kima@1239290 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent da7847adb4
commit 383adc2838

@ -19,9 +19,9 @@
***************************************************************************/
#include "cpufreqd.h"
#include <qdir.h>
#include <qkeysequence.h>
#include <qstringlist.h>
#include <tqdir.h>
#include <tqkeysequence.h>
#include <tqstringlist.h>
#include <klocale.h>
#define CHUNK_SIZE 4096
@ -35,22 +35,22 @@
*/
CPUFreqd::CPUFreqd() {
m_menu = new QPopupMenu();
QObject::connect(m_menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
m_menu = new TQPopupMenu();
TQObject::connect(m_menu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(updateMenu()));
m_dynamic = new QAction(i18n("Select dynamically"), QKeySequence(), this);
QObject::connect(m_dynamic, SIGNAL(activated()), this, SLOT(setDynamic()));
m_dynamic = new TQAction(i18n("Select dynamically"), TQKeySequence(), this);
TQObject::connect(m_dynamic, TQT_SIGNAL(activated()), this, TQT_SLOT(setDynamic()));
m_dynamic->setToggleAction(true);
m_dynamic->setOn(true);
m_items = new QActionGroup(this);
m_items = new TQActionGroup(this);
m_items->setExclusive(true);
m_actions = new QPtrList<QAction>();
m_actions = new TQPtrList<TQAction>();
m_actions->setAutoDelete(true);
m_mapper = new QSignalMapper(this);
QObject::connect(m_mapper, SIGNAL(mapped(int)), this, SLOT(setProfile(int)));
m_mapper = new TQSignalMapper(this);
TQObject::connect(m_mapper, TQT_SIGNAL(mapped(int)), this, TQT_SLOT(setProfile(int)));
}
CPUFreqd::~CPUFreqd() {
@ -60,9 +60,9 @@ bool CPUFreqd::enabled() const {
return m_conn.available();
}
QValueVector<CPUFreqdProfile> & CPUFreqd::getProfiles(bool reconnect) {
TQValueVector<CPUFreqdProfile> & CPUFreqd::getProfiles(bool reconnect) {
char chunk[CHUNK_SIZE];
QString buffer;
TQString buffer;
if (!m_profiles.empty())
m_profiles.clear();
@ -84,8 +84,8 @@ QValueVector<CPUFreqdProfile> & CPUFreqd::getProfiles(bool reconnect) {
buffer.append(chunk);
}
QStringList profiles = QStringList::split("\n", buffer);
for (QStringList::Iterator it = profiles.begin(); it != profiles.end(); it++)
TQStringList profiles = TQStringList::split("\n", buffer);
for (TQStringList::Iterator it = profiles.begin(); it != profiles.end(); it++)
m_profiles.push_back( CPUFreqdProfile(*it) );
m_conn.close();
@ -93,12 +93,12 @@ QValueVector<CPUFreqdProfile> & CPUFreqd::getProfiles(bool reconnect) {
return m_profiles;
}
QPopupMenu* CPUFreqd::menu() {
TQPopupMenu* CPUFreqd::menu() {
return m_menu;
}
void CPUFreqd::updateMenu() {
QAction *cur;
TQAction *cur;
m_menu->clear();
m_actions->clear();
@ -110,8 +110,8 @@ void CPUFreqd::updateMenu() {
for (unsigned int i = 0; i < m_profiles.count(); i++)
if (m_profiles[i].isValid()) {
cur = new QAction(m_profiles[i].name(), QKeySequence(), m_items);
QObject::connect(cur, SIGNAL(activated()), m_mapper, SLOT(map()));
cur = new TQAction(m_profiles[i].name(), TQKeySequence(), m_items);
TQObject::connect(cur, TQT_SIGNAL(activated()), m_mapper, TQT_SLOT(map()));
cur->setToggleAction(true);
cur->setOn(m_profiles[i].active());

@ -22,25 +22,26 @@
#include "cpufreqdconnection.h"
#include "cpufreqdprofile.h"
#include <qaction.h>
#include <qobject.h>
#include <qpopupmenu.h>
#include <qstring.h>
#include <qsignalmapper.h>
#include <qvaluevector.h>
#include <qptrlist.h>
#include <tqaction.h>
#include <tqobject.h>
#include <tqpopupmenu.h>
#include <tqstring.h>
#include <tqsignalmapper.h>
#include <tqvaluevector.h>
#include <tqptrlist.h>
#include <stdint.h>
class CPUFreqd: public QObject {
class CPUFreqd: public TQObject {
Q_OBJECT
TQ_OBJECT
public:
CPUFreqd();
virtual ~CPUFreqd();
bool enabled() const;
QValueVector<CPUFreqdProfile> & getProfiles(bool reconnect = false);
QPopupMenu* menu();
TQValueVector<CPUFreqdProfile> & getProfiles(bool reconnect = false);
TQPopupMenu* menu();
public slots:
void setManual();
@ -49,12 +50,12 @@ class CPUFreqd: public QObject {
private:
CPUFreqdConnection m_conn;
QValueVector<CPUFreqdProfile> m_profiles;
QPopupMenu *m_menu;
QSignalMapper *m_mapper;
QAction* m_dynamic;
QActionGroup* m_items;
QPtrList<QAction>* m_actions;
TQValueVector<CPUFreqdProfile> m_profiles;
TQPopupMenu *m_menu;
TQSignalMapper *m_mapper;
TQAction* m_dynamic;
TQActionGroup* m_items;
TQPtrList<TQAction>* m_actions;
void setMode(uint32_t mode);

@ -20,7 +20,7 @@
#include "cpufreqdconnection.h"
#include <qdir.h>
#include <tqdir.h>
#include <fcntl.h>
#include <stdlib.h>
@ -36,7 +36,7 @@
* Hrvoje Zeba <hrvoje@boo.mi2.hr>
*
* Format:
* it is an uint32_t used as bitmask
* it is an uint32_t used as bittqmask
*
* 31-16 15-0
* <command> <arguments>
@ -110,8 +110,8 @@ bool CPUFreqdConnection::available() const {
}
bool CPUFreqdConnection::lookup() {
QString candidate;
QDir tmp("/tmp", "cpufreqd-*", QDir::Time, QDir::Dirs);
TQString candidate;
TQDir tmp("/tmp", "cpufreqd-*", TQDir::Time, TQDir::Dirs);
if (tmp.count())
candidate = "/tmp/" + tmp[0] + "/cpufreqd";

@ -20,7 +20,7 @@
#ifndef CPUFREQDCONNECTION_H
#define CPUFREQDCONNECTION_H
#include <qstring.h>
#include <tqstring.h>
#include <stdint.h>
/* Excerpt from cpufreqd_remote.h (cpufreqd-2.0.0)
@ -29,7 +29,7 @@
* Hrvoje Zeba <hrvoje@boo.mi2.hr>
*
* Format:
* it is an uint32_t used as bitmask
* it is an uint32_t used as bittqmask
*
* 31-16 15-0
* <command> <arguments>
@ -62,7 +62,7 @@ class CPUFreqdConnection{
bool lookup();
private:
QString m_socket;
TQString m_socket;
int m_fd;
};

@ -19,15 +19,15 @@
***************************************************************************/
#include "cpufreqdprofile.h"
#include <qstringlist.h>
#include <tqstringlist.h>
/**
* This class encapsulates cpufreqd profile data: name, frequencies and governors
*@author: Valentine Sinitsyn (Valentine.Sinitsyn@usu.ru)
*/
CPUFreqdProfile::CPUFreqdProfile(QString & descr) {
QStringList fields = QStringList::split("/", descr);
CPUFreqdProfile::CPUFreqdProfile(TQString & descr) {
TQStringList fields = TQStringList::split("/", descr);
//@fixme: if name contains a slash, the results will be incorrect
if (fields.count() == 5) {
@ -50,7 +50,7 @@ bool CPUFreqdProfile::active() const {
return (m_active == 1);
}
const QString & CPUFreqdProfile::name() const {
const TQString & CPUFreqdProfile::name() const {
return m_name;
}
@ -62,6 +62,6 @@ int CPUFreqdProfile::maxfreq() const {
return m_maxfreq;
}
const QString & CPUFreqdProfile::policy() const {
const TQString & CPUFreqdProfile::policy() const {
return m_policy;
}

@ -20,29 +20,29 @@
#ifndef CPUFREQDPROFILE_H
#define CPUFREQDPROFILE_H
#include <qstring.h>
#include <tqstring.h>
class CPUFreqdProfile {
public:
CPUFreqdProfile() {};
CPUFreqdProfile(QString & descr);
CPUFreqdProfile(TQString & descr);
virtual ~CPUFreqdProfile();
bool isValid() const;
bool active() const;
const QString & name() const;
const TQString & name() const;
int minfreq() const;
int maxfreq() const;
const QString & policy() const;
const TQString & policy() const;
private:
int m_active;
QString m_name;
TQString m_name;
int m_id;
int m_minfreq;
int m_maxfreq;
QString m_policy;
TQString m_policy;
};
#endif

@ -21,26 +21,26 @@
#include "sources/source.h"
//#include "kdebug.h"
//#include <qlabel.h> // debugging
//#include <tqlabel.h> // debugging
class FlowLayoutIterator :public QGLayoutIterator{
class FlowLayoutIterator :public TQGLayoutIterator{
public:
FlowLayoutIterator( QPtrList<QLayoutItem>* layoutItems ):
FlowLayoutIterator( TQPtrList<TQLayoutItem>* tqlayoutItems ):
index(0),
mLayoutItems(layoutItems){
mLayoutItems(tqlayoutItems){
}
uint count() const;
QLayoutItem* current();
QLayoutItem* next();
QLayoutItem* takeCurrent();
TQLayoutItem* current();
TQLayoutItem* next();
TQLayoutItem* takeCurrent();
private:
int index;
QPtrList<QLayoutItem>* mLayoutItems;
TQPtrList<TQLayoutItem>* mLayoutItems;
};
QLayoutItem* FlowLayoutIterator::current(){
TQLayoutItem* FlowLayoutIterator::current(){
return index < int(mLayoutItems->count()) ? mLayoutItems->at(index) : 0;
/*if(index < int(mLayoutItems->count())){
QLayoutItem* item = mLayoutItems->at(index);
TQLayoutItem* item = mLayoutItems->at(index);
kdDebug() << "FlowLayoutIterator::current(index " << index << ") returns: " << item << endl;
return item;
}else{
@ -48,15 +48,15 @@ QLayoutItem* FlowLayoutIterator::current(){
return 0;
}*/
}
QLayoutItem* FlowLayoutIterator::next(){
TQLayoutItem* FlowLayoutIterator::next(){
index++;
//kdDebug() << "FlowLayoutIterator::next, index: " << index << endl;
return current();
}
QLayoutItem* FlowLayoutIterator::takeCurrent(){
TQLayoutItem* FlowLayoutIterator::takeCurrent(){
return index < int(mLayoutItems->count()) ? mLayoutItems->take(index) : 0;
/*if(index < int(mLayoutItems->count())){
QLayoutItem* item = mLayoutItems->take(index);
TQLayoutItem* item = mLayoutItems->take(index);
kdDebug() << "FlowLayoutIterator::takeCurrent(index " << index << ") returns: " << item << endl;
return item;
}else{
@ -67,16 +67,16 @@ QLayoutItem* FlowLayoutIterator::takeCurrent(){
}
FlowLayout::FlowLayout( QWidget* parent, Qt::Orientation orientation, int border, int space, const char* name )
: QLayout( parent, border, space, name ),
FlowLayout::FlowLayout( TQWidget* tqparent, Qt::Orientation orientation, int border, int space, const char* name )
: TQLayout( tqparent, border, space, name ),
mOrientation(orientation), mLastItem(NULL){
}
FlowLayout::FlowLayout( QLayout* parent, Qt::Orientation orientation, int space, const char* name )
: QLayout( parent, space, name ),
FlowLayout::FlowLayout( TQLayout* tqparent, Qt::Orientation orientation, int space, const char* name )
: TQLayout( tqparent, space, name ),
mOrientation(orientation), mLastItem(NULL){
}
FlowLayout::FlowLayout( Qt::Orientation orientation, int space, const char* name )
: QLayout( space, name ),
: TQLayout( space, name ),
mOrientation(orientation), mLastItem(NULL){
}
@ -87,22 +87,22 @@ FlowLayout::~FlowLayout(){
int FlowLayout::heightForWidth( int w ) const{
FlowLayout* mthis = (FlowLayout*)this;
int h = mthis->doLayout( QRect(0,0,w,0), TRUE );
int h = mthis->doLayout( TQRect(0,0,w,0), TRUE );
return h;
}
int FlowLayout::widthForHeight( int h ) const{
FlowLayout* mthis = (FlowLayout*)this;
int w = mthis->doLayout( QRect(0,0,0,h), TRUE );
int w = mthis->doLayout( TQRect(0,0,0,h), TRUE );
return w;
}
void FlowLayout::addItem(QLayoutItem* item){
//kdDebug() << "FlowLayout::addItem: " << (static_cast<QLabel*>(item->widget()))->text() << ", width: " << item->widget()->width() << ", height: " << item->widget()->height()<< endl;
//kdDebug() << "FlowLayout::addItem: " << (static_cast<TQLabel*>(item->widget()))->text() << ", width: " << item->widget()->width() << ", height: " << item->widget()->height()<< endl;
// we are indirectly called from addSource. this
// is a hint for addSource, to let it know which item
// was added.
mLastItem = item;
mLastItem = TQT_TQLAYOUTITEM(item);
}
void FlowLayout::addSource(Source* src){
@ -113,23 +113,23 @@ void FlowLayout::addSource(Source* src){
// step back until we find an item which has a
// smaller position stored in its config. then, we found
// the right position for the new item.
QLayoutItem * qli = mLayoutItems.last();
TQLayoutItem * qli = mLayoutItems.last();
while(qli && mSources[qli]->getPosition() > src->getPosition())
qli = mLayoutItems.prev();
mLayoutItems.insert(mLayoutItems.at()+1, mLastItem);
}
void FlowLayout::remove(QWidget* widget){
//kdDebug() << "FlowLayout::remove: " << (static_cast<QLabel*>(widget))->text() << endl;
void FlowLayout::remove(TQWidget* widget){
//kdDebug() << "FlowLayout::remove: " << (static_cast<TQLabel*>(widget))->text() << endl;
widget->hide();
QPtrListIterator<QLayoutItem> it(mLayoutItems);
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
while(it.current() != NULL) {
if(it.current()->widget() == widget) {
mSources.erase(it.current());
mLayoutItems.remove(it.current());
// removes and deletes only the QLayoutItem
// (QWidgetItem)
QLayout::remove(widget);
// removes and deletes only the TQLayoutItem
// (TQWidgetItem)
TQLayout::remove(widget);
break;
}
++it;
@ -140,9 +140,9 @@ uint FlowLayout::count(){
return mLayoutItems.count();
}
bool FlowLayout::moveItem(const QLayoutItem* which, const QLayoutItem* relate, DIRECTION direction){
int newPos = mLayoutItems.findRef(relate);
int oldPos = mLayoutItems.findRef(which);
bool FlowLayout::moveItem(const TQLayoutItem* which, const TQLayoutItem* relate, DIRECTION direction){
int newPos = mLayoutItems.tqfindRef(relate);
int oldPos = mLayoutItems.tqfindRef(which);
// check whether the widget is already at a correct position
if(oldPos+1 == newPos && direction == ABOVE || oldPos-1 == newPos && direction == BELOW)
@ -156,7 +156,7 @@ bool FlowLayout::moveItem(const QLayoutItem* which, const QLayoutItem* relate, D
newPos += direction;
// actually reinsert the item
mLayoutItems.insert(newPos, which);
activate(); // relayout
activate(); // retqlayout
// kdDebug() << "oldPos: " << oldPos << ", newPos: " << newPos << endl;
return true;
}
@ -164,7 +164,7 @@ bool FlowLayout::moveItem(const QLayoutItem* which, const QLayoutItem* relate, D
void FlowLayout::updatePositions(KConfig * inKConfig){
//kdDebug() << "updating all positions..." << endl;
int pos = 0;
QPtrListIterator<QLayoutItem> it(mLayoutItems);
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
while(it.current() != NULL) {
mSources[it.current()]->setPosition(pos, inKConfig);
++it;
@ -181,35 +181,41 @@ bool FlowLayout::hasWidthForHeight() const{
return mOrientation == Qt::Horizontal;
}
QSize FlowLayout::sizeHint() const{
//return minimumSize();
QSize size(0,0);
QPtrListIterator<QLayoutItem> it(mLayoutItems);
QLayoutItem *o;
TQSize FlowLayout::tqsizeHint() const{
//return tqminimumSize();
TQSize size(0,0);
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
TQLayoutItem *o;
while((o=it.current()) != 0){
++it;
size = size.expandedTo( o->sizeHint() );
size = size.expandedTo( o->tqsizeHint() );
}
return size;
}
QSize FlowLayout::minimumSize() const{
QSize size(0,0);
QPtrListIterator<QLayoutItem> it(mLayoutItems);
QLayoutItem *o;
TQSize FlowLayout::tqminimumSize() const{
TQSize size(0,0);
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
TQLayoutItem *o;
while((o=it.current()) != 0){
++it;
size = size.expandedTo(o->minimumSize());
size = size.expandedTo(o->tqminimumSize());
}
return size;
}
QSizePolicy::ExpandData FlowLayout::expanding() const{
return QSizePolicy::NoDirection;
TQSizePolicy::ExpandData FlowLayout::expanding() const{
return TQ_SPNoDirection;
}
QLayoutIterator FlowLayout::iterator(){
return QLayoutIterator(new FlowLayoutIterator(&mLayoutItems));
TQLayoutIterator FlowLayout::iterator(){
// [FIXME]
#ifdef USE_QT4
#warning [FIXME] ContainerAreaLayout iterators may not function correctly under Qt4
return TQLayoutIterator( this ); // [FIXME]
#else // USE_QT4
return TQLayoutIterator(new FlowLayoutIterator(&mLayoutItems));
#endif // USE_QT4
}
Qt::Orientation FlowLayout::getOrientation() const{
@ -220,92 +226,122 @@ void FlowLayout::setOrientation(Qt::Orientation orientation){
mOrientation = orientation;
}
void FlowLayout::setGeometry( const QRect& rect ){
QLayout::setGeometry( rect );
void FlowLayout::setGeometry( const TQRect& rect ){
TQLayout::setGeometry( rect );
doLayout( rect );
}
int FlowLayout::doLayout( const QRect& rect, bool testonly ){
int FlowLayout::doLayout( const TQRect& rect, bool testonly ){
if(mOrientation == Qt::Horizontal)
return doLayoutHorizontal(rect, testonly);
else
return doLayoutVertical(rect, testonly);
}
int FlowLayout::doLayoutHorizontal( const QRect& rect, bool testOnly ){
int FlowLayout::doLayoutHorizontal( const TQRect& rect, bool testOnly ){
//kdDebug() << "spacing: " << spacing() << endl;
int x = rect.x();
int y = rect.y();
int width = 0; // width of this column so far
int height = 0; // height of this column so far
QPtrListIterator<QLayoutItem> it(mLayoutItems);
QLayoutItem* layoutItem;
QPtrList<QLayoutItem> column; // stores the items of one column
while((layoutItem = it.current()) != 0){
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
TQLayoutItem* tqlayoutItem;
TQPtrList<TQLayoutItem> column; // stores the items of one column
while((tqlayoutItem = it.current()) != 0){
++it;
//int nextY = y + layoutItem->sizeHint().height() + spacing(); // next y
int nextY = y + layoutItem->sizeHint().height(); // next y
//int nextY = y + tqlayoutItem->tqsizeHint().height() + spacing(); // next y
int nextY = y + tqlayoutItem->tqsizeHint().height(); // next y
//if( nextY - spacing() > rect.bottom() && width > 0 ) {
if( nextY > rect.bottom() && width > 0 ) {
// next column
y = rect.y(); // reset y
x = x + width + spacing(); // new x
//nextY = y + layoutItem->sizeHint().height() + spacing(); // next y with changed y
nextY = y + layoutItem->sizeHint().height(); // next y with changed y
//nextY = y + tqlayoutItem->tqsizeHint().height() + spacing(); // next y with changed y
nextY = y + tqlayoutItem->tqsizeHint().height(); // next y with changed y
width = 0; // reset width for the next column
}
if(!testOnly){
layoutItem->setGeometry( QRect( QPoint( x, y ), layoutItem->sizeHint() ) );
column.append(layoutItem);
height += layoutItem->sizeHint().height(); // add the height of the current item to the column height
if( it.current() == 0 || nextY + it.current()->sizeHint().height() > rect.bottom() ){ // test it it's the last item (of this column)
tqlayoutItem->setGeometry( TQRect( TQPoint( x, y ), tqlayoutItem->tqsizeHint() ) );
column.append(tqlayoutItem);
height += tqlayoutItem->tqsizeHint().height(); // add the height of the current item to the column height
if( it.current() == 0 || nextY + it.current()->tqsizeHint().height() > rect.bottom() ){ // test it it's the last item (of this column)
// calculate real needed width
int rWidth = 0;
for(QLayoutItem* item = column.first(); item; item = column.next()){
rWidth = QMAX( rWidth, item->widget()->sizeHint().width() );
for(TQLayoutItem* item = column.first(); item; item = column.next()){
rWidth = TQMAX( rWidth, item->widget()->tqsizeHint().width() );
}
// relayout the items of the former column
// retqlayout the items of the former column
int space = (rect.height() - height) / (column.count() + 1);
int i = 0; // counts the items of this column
for(QLayoutItem* item = column.first(); item; item = column.next()){
QRect r = item->geometry();
item->setGeometry( QRect(r.left(), r.top() + ((++i) * space), rWidth, r.height()) );
for(TQLayoutItem* item = column.first(); item; item = column.next()){
TQRect r = item->tqgeometry();
item->setGeometry( TQRect(r.left(), r.top() + ((++i) * space), rWidth, r.height()) );
}
column.clear(); // remove the items of the former column
height = 0; // reset height for the next column
}
}
y = nextY;
width = QMAX( width, layoutItem->sizeHint().width() );
width = TQMAX( width, tqlayoutItem->tqsizeHint().width() );
}
return x + width - rect.x(); // width
}
int FlowLayout::doLayoutVertical( const QRect& rect, bool testOnly ){
int FlowLayout::doLayoutVertical( const TQRect& rect, bool testOnly ){
int x = rect.x();
int y = rect.y();
int height = 0; // height of this line so far
QPtrListIterator<QLayoutItem> it(mLayoutItems);
QLayoutItem* layoutItem;
while((layoutItem = it.current() ) != 0){
TQPtrListIterator<TQLayoutItem> it(mLayoutItems);
TQLayoutItem* tqlayoutItem;
while((tqlayoutItem = it.current() ) != 0){
++it;
//int nextX = x + layoutItem->sizeHint().width() + spacing();
int nextX = x + layoutItem->sizeHint().width();
//int nextX = x + tqlayoutItem->tqsizeHint().width() + spacing();
int nextX = x + tqlayoutItem->tqsizeHint().width();
if(nextX - spacing() > rect.right() && height > 0) {
// next line
x = rect.x(); // reset x
//y = y + height + spacing(); // new y
y = y + height; // new y
//nextX = x + layoutItem->sizeHint().width() + spacing(); // next x
nextX = x + layoutItem->sizeHint().width(); // next x
//nextX = x + tqlayoutItem->tqsizeHint().width() + spacing(); // next x
nextX = x + tqlayoutItem->tqsizeHint().width(); // next x
height = 0; // reset height for the next line
}
const int itemHeight = layoutItem->sizeHint().height();
const int itemHeight = tqlayoutItem->tqsizeHint().height();
if(!testOnly)
layoutItem->setGeometry(QRect(x, y, rect.right(), itemHeight));
tqlayoutItem->setGeometry(TQRect(x, y, rect.right(), itemHeight));
x = nextX;
height = QMAX(height, itemHeight);
height = TQMAX(height, itemHeight);
}
return y + height - rect.y(); // height
}
#ifdef USE_QT4
/*!
\reimp
*/
int FlowLayout::count() const {
return mLayoutItems.count();
}
/*!
\reimp
*/
TQLayoutItem* FlowLayout::itemAt(int index) const {
return index >= 0 && index < mLayoutItems.count() ? (const_cast<TQPtrList<TQLayoutItem>&>(mLayoutItems).tqat(index)) : 0;
}
/*!
\reimp
*/
TQLayoutItem* FlowLayout::takeAt(int index) {
if (index < 0 || index >= mLayoutItems.count())
return 0;
TQLayoutItem *item = mLayoutItems.tqat(index);
mLayoutItems.remove(mLayoutItems.tqat(index));
delete item;
invalidate();
return item;
}
#endif // USE_QT4

@ -20,14 +20,15 @@
#ifndef FLOWLAYOUT_H
#define FLOWLAYOUT_H
#include <qlayout.h>
#include <qptrlist.h>
#include <tqlayout.h>
#include <tqptrlist.h>
class Source;
class KConfig;
class FlowLayout : public QLayout{
Q_OBJECT //macro which activates signals and slots (moc)
class FlowLayout : public TQLayout{
Q_OBJECT
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* the direction for moveItem
@ -36,8 +37,8 @@ public:
ABOVE = 0,
BELOW = 1
};
FlowLayout( QWidget* parent, Qt::Orientation orientation=Qt::Horizontal, int border=0, int space=-1, const char* name=0 );
FlowLayout( QLayout* parent, Qt::Orientation orientation=Qt::Horizontal, int space=-1, const char* name=0 );
FlowLayout( TQWidget* tqparent, Qt::Orientation orientation=Qt::Horizontal, int border=0, int space=-1, const char* name=0 );
FlowLayout( TQLayout* tqparent, Qt::Orientation orientation=Qt::Horizontal, int space=-1, const char* name=0 );
FlowLayout( Qt::Orientation=Qt::Horizontal, int space=-1, const char* name=0 );
virtual ~FlowLayout();
/**
@ -46,9 +47,9 @@ public:
void updatePositions(KConfig * inKConfig);
void addItem(QLayoutItem* item);
void addSource(Source* src);
void remove(QWidget* widget);
void remove(TQWidget* widget);
/**
* Returns the number of items in the layout
* Returns the number of items in the tqlayout
*/
uint count();
/**
@ -56,30 +57,35 @@ public:
* \param dir ABOVE if above, BENEATH if beneath
* \return the new Position or -1 if no real move was made
*/
bool moveItem(const QLayoutItem* which, const QLayoutItem* relate, DIRECTION direction);
bool moveItem(const TQLayoutItem* which, const TQLayoutItem* relate, DIRECTION direction);
bool hasHeightForWidth() const;
int heightForWidth(int w) const;
bool hasWidthForHeight() const;
int widthForHeight(int h) const;
QSize sizeHint() const;
QSize minimumSize() const;
QLayoutIterator iterator();
QSizePolicy::ExpandData expanding() const;
TQSize tqsizeHint() const;
TQSize tqminimumSize() const;
TQLayoutIterator iterator();
TQSizePolicy::ExpandData expanding() const;
Qt::Orientation getOrientation() const;
#ifdef USE_QT4
QLAYOUT_REQUIRED_METHOD_DECLARATIONS
#endif // USE_QT4
public slots:
void setOrientation(Qt::Orientation orientation);
protected:
void setGeometry(const QRect&);
void setGeometry(const TQRect&);
private:
int doLayout( const QRect&, bool testOnly = FALSE );
int doLayoutHorizontal( const QRect&, bool testOnly );
int doLayoutVertical( const QRect&, bool testOnly );
int doLayout( const TQRect&, bool testOnly = FALSE );
int doLayoutHorizontal( const TQRect&, bool testOnly );
int doLayoutVertical( const TQRect&, bool testOnly );
Qt::Orientation mOrientation;
QPtrList<QLayoutItem> mLayoutItems;
// this is the connection between a layout item and its source.
QMap<QLayoutItem*, Source*> mSources;
QLayoutItem* mLastItem; // the item that was last added
TQPtrList<TQLayoutItem> mLayoutItems;
// this is the connection between a tqlayout item and its source.
TQMap<TQLayoutItem*, Source*> mSources;
TQLayoutItem* mLastItem; // the item that was last added
};
#endif

@ -20,17 +20,17 @@
#include <list>
// Qt
#include <qlabel.h>
#include <qfile.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qtextedit.h>
#include <qtimer.h>
#include <qcursor.h>
// TQt
#include <tqlabel.h>
#include <tqfile.h>
#include <tqspinbox.h>
#include <tqcombobox.h>
#include <tqtextedit.h>
#include <tqtimer.h>
#include <tqcursor.h>
#include <klistview.h>
#include <qlistview.h>
#include <qwidgetstack.h>
#include <tqlistview.h>
#include <tqwidgetstack.h>
// KDE
#include <kmessagebox.h>
@ -73,7 +73,7 @@
//#include "kdebug.h"
extern "C" {
KPanelApplet* init( QWidget* inParent, const QString& inConfigFile) {
KPanelApplet* init( TQWidget* inParent, const TQString& inConfigFile) {
KGlobal::locale()->insertCatalogue("kima");
return new Kima(inConfigFile, KPanelApplet::Normal,
//KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
@ -82,9 +82,9 @@ extern "C" {
}
}
Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inParent, const char* inName):
Kima::Kima(const TQString& inConfigFile, Type inType, int inActions, TQWidget* inParent, const char* inName):
KPanelApplet(inConfigFile, inType, inActions, inParent, inName),
QToolTip(this),
TQToolTip(this),
mCachedWFH(0),
mCachedHeight(0),
mDraggedSourceItem(NULL){
@ -99,7 +99,7 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
// automatically delete pointers
mSources.setAutoDelete(TRUE);
// create layout
// create tqlayout
mLayout = new FlowLayout(this, orientation() );
mLayout->setSpacing(8);
@ -122,7 +122,7 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
addSources(BatterySrc::createInstances(this));
QPtrListIterator<Source> itSync(mSources);
TQPtrListIterator<Source> itSync(mSources);
Source* source;
while((source = itSync.current()) != 0){
++itSync;
@ -140,16 +140,16 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
KActionCollection* actionCollection = new KActionCollection(this, "actionCollection", kapp);
KAction* action = KStdAction::preferences(this, SLOT(preferences()), actionCollection);
KAction* action = KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(preferences()), actionCollection);
action->setText(i18n("&Preferences"));
action->plug(mMenu);
action = KStdAction::aboutApp(this, SLOT(about()), actionCollection);
action = KStdAction::aboutApp(TQT_TQOBJECT(this), TQT_SLOT(about()), actionCollection);
action->setText(i18n("&About Kima"));
action->plug(mMenu);
//menu->insertSeparator();
//KStdAction::quit( kapp, SLOT( quit() ), actionCollection )->plug( menu );
//KStdAction::quit( kapp, TQT_SLOT( quit() ), actionCollection )->plug( menu );
}
Kima::~Kima() {
@ -222,12 +222,12 @@ void Kima::preferences() {
//setup the dialog
//mPrefsDlg->setFixedSize(mPrefs->size());
mPrefsDlg->setMainWidget(mPrefs); //embed the uic generated class into the kde dialog
connect(mPrefsDlg, SIGNAL(applyClicked()), this, SLOT(savePreferences()));
connect(mPrefsDlg, SIGNAL(okClicked()), this, SLOT(savePreferences()));
connect(mPrefsDlg, SIGNAL(cancelClicked()), this, SLOT(cancelPreferences()));
connect(mPrefsDlg, TQT_SIGNAL(applyClicked()), TQT_TQOBJECT(this), TQT_SLOT(savePreferences()));
connect(mPrefsDlg, TQT_SIGNAL(okClicked()), TQT_TQOBJECT(this), TQT_SLOT(savePreferences()));
connect(mPrefsDlg, TQT_SIGNAL(cancelClicked()), TQT_TQOBJECT(this), TQT_SLOT(cancelPreferences()));
// create new list items and the widgetStack widgets
QPtrListIterator<Source> it(mSources);
TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@ -237,9 +237,9 @@ void Kima::preferences() {
// create the SourceListItem to switch and to enable/disable the widgetstack item (the source)
// and connect the apply/ok signals to the item, so it can change it's text to a potentially
// new source name.
SourceListItem * item = new SourceListItem(source, mPrefs->sourceListView, QCheckListItem::CheckBox);
connect(mPrefsDlg, SIGNAL(applyClicked()), item, SLOT(updateText()));
connect(mPrefsDlg, SIGNAL(okClicked()), item, SLOT(updateText()));
SourceListItem * item = new SourceListItem(source, mPrefs->sourceListView, TQCheckListItem::CheckBox);
connect(mPrefsDlg, TQT_SIGNAL(applyClicked()), item, TQT_SLOT(updateText()));
connect(mPrefsDlg, TQT_SIGNAL(okClicked()), item, TQT_SLOT(updateText()));
}
if(mPrefs->sourceListView->firstChild()){
@ -247,11 +247,11 @@ void Kima::preferences() {
raiseSourcePrefsWidget(mPrefs->sourceListView->firstChild()); // raise that item
}
connect(mPrefs->sourceListView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(raiseSourcePrefsWidget(QListViewItem*)));
connect(mPrefs->sourceListView, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_TQOBJECT(this), TQT_SLOT(raiseSourcePrefsWidget(TQListViewItem*)));
}
// update prefs gui
QPtrListIterator<Source> srcIt(mSources);
TQPtrListIterator<Source> srcIt(mSources);
Source* source;
while((source = srcIt.current()) != 0){
++srcIt;
@ -259,8 +259,8 @@ void Kima::preferences() {
}
// update the sourcelist checkbox
QPtrList<QListViewItem> lst;
QListViewItemIterator lvIt(mPrefs->sourceListView);
TQPtrList<TQListViewItem> lst;
TQListViewItemIterator lvIt(mPrefs->sourceListView);
while(lvIt.current()){
SourceListItem* sli = static_cast<SourceListItem*>(lvIt.current());
sli->setOn(sli->getSource()->isEnabled());
@ -271,13 +271,13 @@ void Kima::preferences() {
mPrefsDlg->show();
}
void Kima::raiseSourcePrefsWidget(QListViewItem* inListViewItem){
void Kima::raiseSourcePrefsWidget(TQListViewItem* inListViewItem){
mPrefs->widgetStack->raiseWidget(static_cast<SourceListItem*>(inListViewItem)->getSource()->getPrefs());
}
void Kima::cancelPreferences(){
// update prefs gui
QPtrListIterator<Source> it(mSources);
TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@ -287,7 +287,7 @@ void Kima::cancelPreferences(){
void Kima::savePreferences(){
// save prefs
QPtrListIterator<Source> it(mSources);
TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@ -311,7 +311,7 @@ int Kima::widthForHeight(int inHeight) const{
mCachedHeight = inHeight;
mCachedWFH = 0;
}
mCachedWFH = QMAX(mLayout->widthForHeight(inHeight), mCachedWFH);
mCachedWFH = TQMAX(mLayout->widthForHeight(inHeight), mCachedWFH);
return mCachedWFH;
}
@ -319,22 +319,22 @@ int Kima::heightForWidth(int inWidth) const{
//kdDebug() << "heightForWidth: " << width << endl;
mLayout->setOrientation(Qt::Vertical);
return mLayout->heightForWidth(inWidth);
//return sizeHint().height();
//return tqsizeHint().height();
}
void Kima::mousePressEvent(QMouseEvent* inEvent ){
if(inEvent->button() == QMouseEvent::RightButton){
void Kima::mousePressEvent(TQMouseEvent* inEvent ){
if(inEvent->button() == Qt::RightButton){
mMenu->popup( inEvent->globalPos() );
if(mDraggedSourceItem)
mDraggedSourceItem->widget()->unsetCursor(); // unset drag cursor
}
else if(inEvent->button() == QMouseEvent::LeftButton){
QLayoutIterator it = mLayout->iterator();
else if(inEvent->button() == Qt::LeftButton){
TQLayoutIterator it = mLayout->iterator();
while(it.current()){
QWidget * c = it.current()->widget();
if(c->rect().contains(c->mapFromGlobal(inEvent->globalPos()))){
TQWidget * c = it.current()->widget();
if(TQT_TQRECT_OBJECT(c->rect()).tqcontains(c->mapFromGlobal(inEvent->globalPos()))){
mDraggedSourceItem = it.current(); // remenber the clicked source
c->setCursor(Qt::SizeAllCursor); // set drag cursor
c->setCursor(TQt::SizeAllCursor); // set drag cursor
mDragFactor = (c->rect().height()/2.0) / (double)c->mapFromGlobal(inEvent->globalPos()).y();
break;
}
@ -343,8 +343,8 @@ void Kima::mousePressEvent(QMouseEvent* inEvent ){
}
}
void Kima::mouseReleaseEvent(QMouseEvent* inEvent){
//if(inEvent->button() == QMouseEvent::LeftButton && mDraggedSourceItem){
void Kima::mouseReleaseEvent(TQMouseEvent* inEvent){
//if(inEvent->button() == TQMouseEvent::LeftButton && mDraggedSourceItem){
if(mDraggedSourceItem){
mCachedWFH = 0; // reset cached witdh for height to force recalculation of the applets width
mDraggedSourceItem->widget()->unsetCursor(); // unset drag cursor
@ -352,19 +352,19 @@ void Kima::mouseReleaseEvent(QMouseEvent* inEvent){
}
}
void Kima::mouseMoveEvent( QMouseEvent* inEvent ) {
void Kima::mouseMoveEvent( TQMouseEvent* inEvent ) {
if(!mDraggedSourceItem)
return;
QLayoutIterator it = mLayout->iterator();
TQLayoutIterator it = mLayout->iterator();
while(it.current()){
QWidget * c = it.current()->widget();
if(c->rect().contains(c->mapFromGlobal(inEvent->globalPos()))){
TQWidget * c = it.current()->widget();
if(TQT_TQRECT_OBJECT(c->rect()).tqcontains(c->mapFromGlobal(inEvent->globalPos()))){
if(it.current() == mDraggedSourceItem)
break;
// we are over a source-widget.
// move the dragged widget above / below that
// widget, depending where the cursor is.
QRect crect = c->rect();
TQRect crect = c->rect();
double relPos = c->mapFromGlobal(inEvent->globalPos()).y() * mDragFactor;
if(mLayout->moveItem(mDraggedSourceItem, it.current(), crect.height()/2.0 > relPos ? FlowLayout::ABOVE : FlowLayout::BELOW)){
mLayout->updatePositions(mKConfig);
@ -377,19 +377,19 @@ void Kima::mouseMoveEvent( QMouseEvent* inEvent ) {
++it;
}
// outside kima?
if(!rect().contains(mapToParent(inEvent->pos())))
mDraggedSourceItem->widget()->setCursor(Qt::ForbiddenCursor);
if(!TQT_TQRECT_OBJECT(rect()).tqcontains(mapToParent(inEvent->pos())))
mDraggedSourceItem->widget()->setCursor(TQt::ForbiddenCursor);
else
mDraggedSourceItem->widget()->setCursor(Qt::SizeAllCursor);
mDraggedSourceItem->widget()->setCursor(TQt::SizeAllCursor);
}
void Kima::paintEvent(QPaintEvent* inEvent){
void Kima::paintEvent(TQPaintEvent* inEvent){
KPanelApplet::paintEvent(inEvent);
updateSourceWidgets();
}
void Kima::updateSourceWidgets(){
// repaint the source widgets
// tqrepaint the source widgets
for(Source* source = mSources.first(); source; source = mSources.next())
if(source->showOnApplet())
source->getWidget()->update();
@ -406,19 +406,19 @@ void Kima::registerSource(Source* source) {
// this call also emits enabledChanged
source->loadPrefs(mKConfig);
// add the source to the layout if necessary
// add the source to the tqlayout if necessary
displaySource(source->isEnabled() && source->showOnApplet(), source);
// connection to add and remove sources from mLayout
connect(source, SIGNAL(displaySource(bool, Source*)), this, SLOT(displaySource(bool, Source*)));
connect(source, TQT_SIGNAL(displaySource(bool, Source*)), TQT_TQOBJECT(this), TQT_SLOT(displaySource(bool, Source*)));
}
void Kima::maybeTip(const QPoint& inPos){
if(!rect().contains(inPos))
void Kima::maybeTip(const TQPoint& inPos){
if(!TQT_TQRECT_OBJECT(rect()).tqcontains(inPos))
return;
QString text = "<b>" + i18n("Sources:") + "</b><br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
TQString text = "<b>" + i18n("Sources:") + "</b><br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
QPtrListIterator<Source> it(mSources);
TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;

@ -28,30 +28,30 @@
#include "sources/source.h"
#include "cpufreqd/cpufreqd.h"
// Qt
#include <qtooltip.h>
#include <qfont.h>
#include <qcolor.h>
#include <qptrlist.h>
#include <qlabel.h>
// TQt
#include <tqtooltip.h>
#include <tqfont.h>
#include <tqcolor.h>
#include <tqptrlist.h>
#include <tqlabel.h>
// Forward Declarations
class FlowLayout;
class KAboutApplication;
class KPopupMenu;
class KSelectAction;
class QMouseEvent;
class TQMouseEvent;
class KDialogBase;
class Prefs;
class QListViewItem;
class TQListViewItem;
class KConfig;
class QLayoutItem;
class TQLayoutItem;
/**
@author Ken Werner
*/
class Kima : public KPanelApplet, QToolTip {
Q_OBJECT //macro which activates signals and slots (moc)
class Kima : public KPanelApplet, TQToolTip {
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
@ -60,11 +60,11 @@ public:
* @param configFile The configFile handed over in the factory function.
* @param Type The applet @ref type().
* @param actions Standard RMB menu actions supported by the applet (see @ref action() ).
* @param parent The pointer to the parent widget handed over in the factory function.
* @param name A Qt object name for your applet.
* @param tqparent The pointer to the tqparent widget handed over in the factory function.
* @param name A TQt object name for your applet.
**/
Kima(const QString& inConfigFile, Type inType = Normal, int inActions = 0,
QWidget* inParent = 0, const char* inName = 0);
Kima(const TQString& inConfigFile, Type inType = Normal, int inActions = 0,
TQWidget* inParent = 0, const char* inName = 0);
/** destructor */
virtual ~Kima();
@ -151,19 +151,19 @@ public slots:
/**
* raises the preferences widgets of the given list item
*/
void raiseSourcePrefsWidget(QListViewItem* inListViewItem);
void raiseSourcePrefsWidget(TQListViewItem* inListViewItem);
/**
* adds or removes the given source from the display (layout) of the kicker applet
* adds or removes the given source from the display (tqlayout) of the kicker applet
*/
void displaySource(bool inDisplay, Source* inSource);
protected:
void paintEvent(QPaintEvent* inEvent);
void mousePressEvent(QMouseEvent* inEvent);
void mouseMoveEvent(QMouseEvent* inEvent);
void mouseReleaseEvent(QMouseEvent* inEvent);
void maybeTip(const QPoint& inPos);
void paintEvent(TQPaintEvent* inEvent);
void mousePressEvent(TQMouseEvent* inEvent);
void mouseMoveEvent(TQMouseEvent* inEvent);
void mouseReleaseEvent(TQMouseEvent* inEvent);
void maybeTip(const TQPoint& inPos);
void registerSource(Source* source);
protected slots:
@ -179,7 +179,7 @@ private:
* Searches for the Source that has inWidget
* Returns the found Soucre, otherwise NULL
*/
Source* findSource(QWidget* inWidget);
Source* findSource(TQWidget* inWidget);
/**
* Searches for the Source that has inPosition
* Returns the found Soucre, otherwise NULL
@ -198,13 +198,13 @@ private:
/**
* stores sources
*/
QPtrList<Source> mSources;
TQPtrList<Source> mSources;
/**
* points to the source which is currently
* dragged, otherwise NULL
*/
QLayoutItem* mDraggedSourceItem;
TQLayoutItem* mDraggedSourceItem;
/**
* 'drag' threshold multiplier

@ -11,28 +11,28 @@
#include "prefs.h"
#include <qvariant.h>
#include <qsplitter.h>
#include <qheader.h>
#include <tqvariant.h>
#include <tqsplitter.h>
#include <tqheader.h>
#include <klistview.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <tqwidgetstack.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
/*
* Constructs a Prefs as a child of 'parent', with the
* Constructs a Prefs as a child of 'tqparent', with the
* name 'name' and widget flags set to 'f'.
*/
Prefs::Prefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
Prefs::Prefs( TQWidget* tqparent, const char* name, WFlags fl )
: TQWidget( tqparent, name, fl )
{
if ( !name )
setName( "Prefs" );
PrefsLayout = new QVBoxLayout( this, 0, 6, "PrefsLayout");
PrefsLayout = new TQVBoxLayout( this, 0, 6, "PrefsLayout");
splitter3 = new QSplitter( this, "splitter3" );
splitter3->setOrientation( QSplitter::Horizontal );
splitter3 = new TQSplitter( this, "splitter3" );
splitter3->setOrientation( TQSplitter::Horizontal );
sourceListView = new KListView( splitter3, "sourceListView" );
sourceListView->addColumn( tr2i18n( "Source" ) );
@ -40,13 +40,13 @@ Prefs::Prefs( QWidget* parent, const char* name, WFlags fl )
sourceListView->header()->setResizeEnabled( FALSE, sourceListView->header()->count() - 1 );
sourceListView->setResizeMode( KListView::AllColumns );
widgetStack = new QWidgetStack( splitter3, "widgetStack" );
widgetStack = new TQWidgetStack( splitter3, "widgetStack" );
WStackPage = new QWidget( widgetStack, "WStackPage" );
WStackPage = new TQWidget( widgetStack, "WStackPage" );
widgetStack->addWidget( WStackPage, 0 );
PrefsLayout->addWidget( splitter3 );
languageChange();
resize( QSize(340, 73).expandedTo(minimumSizeHint()) );
resize( TQSize(340, 73).expandedTo(tqminimumSizeHint()) );
clearWState( WState_Polished );
}
@ -55,7 +55,7 @@ Prefs::Prefs( QWidget* parent, const char* name, WFlags fl )
*/
Prefs::~Prefs()
{
// no need to delete child widgets, Qt does it all for us
// no need to delete child widgets, TQt does it all for us
}
/*

@ -1,7 +1,7 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>Prefs</class>
<author>Ken Werner</author>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>Prefs</cstring>
</property>
@ -23,7 +23,7 @@
<property name="margin">
<number>0</number>
</property>
<widget class="QSplitter">
<widget class="TQSplitter">
<property name="name">
<cstring>splitter3</cstring>
</property>
@ -49,11 +49,11 @@
<enum>AllColumns</enum>
</property>
</widget>
<widget class="QWidgetStack">
<widget class="TQWidgetStack">
<property name="name">
<cstring>widgetStack</cstring>
</property>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
@ -65,7 +65,7 @@
</widget>
</vbox>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>klistview.h</includehint>
</includehints>

@ -19,47 +19,47 @@
***************************************************************************/
#include "sourcelistitem.h"
#include <qcheckbox.h>
#include <tqcheckbox.h>
//#include <kdebug.h>
SourceListItem::SourceListItem(Source* inSource, QCheckListItem* inParent, Type tt):
QCheckListItem(inParent, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQCheckListItem* inParent, Type tt):
TQCheckListItem(inParent, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QCheckListItem* inParent, QListViewItem* after, Type tt):
QCheckListItem(inParent, after, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQCheckListItem* inParent, TQListViewItem* after, Type tt):
TQCheckListItem(inParent, after, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListViewItem* inParent, Type tt):
QCheckListItem(inParent, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQListViewItem* inParent, Type tt):
TQCheckListItem(inParent, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListViewItem* inParent, QListViewItem* after, Type tt):
QCheckListItem(inParent, after, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQListViewItem* inParent, TQListViewItem* after, Type tt):
TQCheckListItem(inParent, after, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListView* inParent, Type tt):
QCheckListItem(inParent, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQListView* inParent, Type tt):
TQCheckListItem(inParent, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListView* inParent, QListViewItem* after, Type tt):
QCheckListItem(inParent, after, inSource->getName(), tt){
SourceListItem::SourceListItem(Source* inSource, TQListView* inParent, TQListViewItem* after, Type tt):
TQCheckListItem(inParent, after, inSource->getName(), tt){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListViewItem* inParent, const QPixmap& p):
QCheckListItem(inParent, inSource->getName(), p){
SourceListItem::SourceListItem(Source* inSource, TQListViewItem* inParent, const TQPixmap& p):
TQCheckListItem(inParent, inSource->getName(), p){
mSource = inSource;
initItem();
}
SourceListItem::SourceListItem(Source* inSource, QListView* inParent, const QPixmap& p):
QCheckListItem(inParent, inSource->getName(), p){
SourceListItem::SourceListItem(Source* inSource, TQListView* inParent, const TQPixmap& p):
TQCheckListItem(inParent, inSource->getName(), p){
mSource = inSource;
initItem();
}
@ -71,7 +71,7 @@ void SourceListItem::initItem(){
//setText(1, mSource->getName());
//item->setText(2, source->getDescription());
connect(mSource, SIGNAL(enabledChanged(bool, Source*)), this, SLOT(setEnabled(bool)));
connect(mSource, TQT_SIGNAL(enabledChanged(bool, Source*)), this, TQT_SLOT(setEnabled(bool)));
setOn(mSource->isEnabled());
}
@ -83,7 +83,7 @@ Source* SourceListItem::getSource(){
return mSource;
}
void SourceListItem::setName(const QString& inName){
void SourceListItem::setName(const TQString& inName){
setText(1, inName);
}
@ -92,6 +92,6 @@ void SourceListItem::setEnabled(bool inEnabled){
}
void SourceListItem::stateChange(bool inOn){
QCheckListItem::stateChange(inOn);
TQCheckListItem::stateChange(inOn);
setEnabled(inOn);
}

@ -21,28 +21,28 @@
#ifndef SOURCELISTITEM_H
#define SOURCELISTITEM_H
#include <qlistview.h>
#include <qobject.h>
#include <tqlistview.h>
#include <tqobject.h>
#include <sources/source.h>
/**
* SourceListItem
* @author Ken Werner
*/
class SourceListItem : public QObject, public QCheckListItem {
Q_OBJECT //macro which activates signals and slots (moc)
class SourceListItem : public TQObject, public TQCheckListItem {
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source
*/
SourceListItem(Source* inSource, QCheckListItem* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QCheckListItem* inParent, QListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QListViewItem* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QListViewItem* v, QListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QListView* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QListView* inParent, QListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, QListViewItem* inParent, const QPixmap& p );
SourceListItem(Source* inSource, QListView* inParent, const QPixmap& p );
SourceListItem(Source* inSource, TQCheckListItem* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQCheckListItem* inParent, TQListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQListViewItem* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQListViewItem* v, TQListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQListView* inParent, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQListView* inParent, TQListViewItem* after, Type tt = RadioButtonController );
SourceListItem(Source* inSource, TQListViewItem* inParent, const TQPixmap& p );
SourceListItem(Source* inSource, TQListView* inParent, const TQPixmap& p );
virtual ~SourceListItem();
@ -65,7 +65,7 @@ public slots:
/**
* Sets the Name of this source
*/
void setName(const QString& inName);
void setName(const TQString& inName);
/**
* updates the text of the item

@ -19,15 +19,15 @@
***************************************************************************/
#include "acpithermalsrc.h"
#include <qtextstream.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqdir.h>
#include <klocale.h>
ACPIThermalSrc::ACPIThermalSrc(QWidget* inParent, const QFile& inSourceFile):
ACPIThermalSrc::ACPIThermalSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
mID = mSourceFile.name().section('/', -2, -2, QString::SectionSkipEmpty);
mID = mSourceFile.name().section('/', -2, -2, TQString::SectionSkipEmpty);
mName = mID;
mDescription = i18n("This source is provided by the Linux ACPI Thermal Zone driver.");
}
@ -35,15 +35,15 @@ ACPIThermalSrc::ACPIThermalSrc(QWidget* inParent, const QFile& inSourceFile):
ACPIThermalSrc::~ACPIThermalSrc(){
}
std::list<Source*>ACPIThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>ACPIThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QDir d( "/proc/acpi/thermal_zone" );
TQDir d( "/proc/acpi/thermal_zone" );
if( d.exists() ){
d.setFilter( QDir::Dirs | QDir::NoSymLinks );
d.setSorting( QDir::Name);
d.setFilter( TQDir::Dirs | TQDir::NoSymLinks );
d.setSorting( TQDir::Name);
for( unsigned int i = 0; i < d.count(); i++ ){
if((d[i] != ".") && (d[i] != "..")){
QFile acpiFile(d.canonicalPath() + "/" + d[i] + "/temperature");
TQFile acpiFile(d.canonicalPath() + "/" + d[i] + "/temperature");
list.push_back(new ACPIThermalSrc(inParent, acpiFile));
}
}
@ -51,10 +51,10 @@ std::list<Source*>ACPIThermalSrc::createInstances(QWidget* inParent){
return list;
}
QString ACPIThermalSrc::fetchValue() {
QString s = "n/a";
TQString ACPIThermalSrc::fetchValue() {
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream(&mSourceFile);
TQTextStream textStream(&mSourceFile);
s = textStream.readLine();
mSourceFile.close();
s = s.remove("temperature:").stripWhiteSpace();

@ -22,7 +22,7 @@
#define ACPITHERMALSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -31,30 +31,30 @@
* @author Ken Werner
*/
class ACPIThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
ACPIThermalSrc(QWidget* inParent, const QFile& inSourceFile);
ACPIThermalSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~ACPIThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -33,7 +33,7 @@
} \
} while(0)
BatterySrc::BatterySrc(QWidget* inParent, QString inUDI):
BatterySrc::BatterySrc(TQWidget* inParent, TQString inUDI):
LabelSource(inParent),
mTrigger(this, 5000),
mUDI(inUDI),
@ -70,7 +70,7 @@ BatterySrc::~BatterySrc(){
}
}
std::list<Source*>BatterySrc::createInstances(QWidget* inParent){
std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
LibHalContext* libHalContext;
@ -117,8 +117,8 @@ std::list<Source*>BatterySrc::createInstances(QWidget* inParent){
return list;
}
QString BatterySrc::fetchValue() {
QString s = "n/a";
TQString BatterySrc::fetchValue() {
TQString s = "n/a";
if(mLibHalContext != NULL){
int last_full = 0;
int current = 0;
@ -135,7 +135,7 @@ QString BatterySrc::fetchValue() {
dbus_error_free(&mDBusError);
return s;
}
s = QString::number(qRound((current * 100.0) / last_full)) + " %";
s = TQString::number(tqRound((current * 100.0) / last_full)) + " %";
}
return s;
}

@ -22,8 +22,8 @@
#define BATTERYSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <qstring.h>
#include <tqfile.h>
#include <tqstring.h>
#include <list>
#include <hal/libhal.h>
@ -32,24 +32,24 @@
* @author Ken Werner
*/
class BatterySrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source
*/
BatterySrc(QWidget* inParent, QString inUDI);
BatterySrc(TQWidget* inParent, TQString inUDI);
virtual ~BatterySrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
@ -60,7 +60,7 @@ private:
/**
* The hal udi of that battery source
*/
QString mUDI;
TQString mUDI;
/**
* The local hal context

@ -19,11 +19,11 @@
***************************************************************************/
#include "cpuinfofreqsrc.h"
#include <qtextstream.h>
#include <qfile.h>
#include <tqtextstream.h>
#include <tqfile.h>
#include <klocale.h>
CpuinfoFreqSrc::CpuinfoFreqSrc(QWidget* inParent, const QFile& inSourceFile):
CpuinfoFreqSrc::CpuinfoFreqSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
@ -35,16 +35,16 @@ CpuinfoFreqSrc::CpuinfoFreqSrc(QWidget* inParent, const QFile& inSourceFile):
CpuinfoFreqSrc::~CpuinfoFreqSrc(){
}
std::list<Source*>CpuinfoFreqSrc::createInstances(QWidget* inParent){
std::list<Source*>CpuinfoFreqSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile cpuinfoFreqFile( "/proc/cpuinfo" );
TQFile cpuinfoFreqFile( "/proc/cpuinfo" );
if(cpuinfoFreqFile.open(IO_ReadOnly))
list.push_back(new CpuinfoFreqSrc(inParent, cpuinfoFreqFile));
return list;
}
QString CpuinfoFreqSrc::fetchValue(){
QString s = "n/a";
TQString CpuinfoFreqSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
while( mSourceFile.readLine( s, 64 ) != -1 )
if( s.startsWith( "cpu MHz") )

@ -22,37 +22,37 @@
#define CPUINFOFREQSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
* CpuinfoFreqSrc reads temperature values from /proc/cpuinfo
*/
class CpuinfoFreqSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
CpuinfoFreqSrc(QWidget* inParent, const QFile& inSourceFile);
CpuinfoFreqSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~CpuinfoFreqSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -20,50 +20,50 @@
#include "hddtempsrc.h"
#include <qsocketdevice.h>
#include <qhostaddress.h>
#include <qcstring.h>
#include <tqsocketdevice.h>
#include <tqhostaddress.h>
#include <tqcstring.h>
#include <klocale.h>
//#include <kdebug.h>
const Q_ULONG HDDTempSrc::BUFFERSIZE = 128;
const Q_UINT32 HDDTempSrc::ADDRESS = (127<<24)|1;
const Q_UINT16 HDDTempSrc::PORT = 7634;
const TQ_ULONG HDDTempSrc::BUFFERSIZE = 128;
const TQ_UINT32 HDDTempSrc::ADDRESS = (127<<24)|1;
const TQ_UINT16 HDDTempSrc::PORT = 7634;
HDDTempSrc::HDDTempSrc(QWidget* inParent, uint inIndex, const QString& inDevice, const QString& inModelName):
HDDTempSrc::HDDTempSrc(TQWidget* inParent, uint inIndex, const TQString& inDevice, const TQString& inModelName):
LabelSource(inParent),
mIndex(inIndex),
mTrigger(this){
mID = "HDDTemp" + QString().setNum(inIndex);
mID = "HDDTemp" + TQString().setNum(inIndex);
mName = mID;
mDescription = i18n("This source is provided by hddtemp. (%1, %2)").arg(inDevice).arg(inModelName);
mDescription = i18n("This source is provided by hddtemp. (%1, %2)").tqarg(inDevice).tqarg(inModelName);
}
HDDTempSrc::~HDDTempSrc(){
}
std::list<Source*>HDDTempSrc::createInstances(QWidget* inParent){
std::list<Source*>HDDTempSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QSocketDevice sd;
TQSocketDevice sd;
sd.setBlocking(true);
if(sd.connect((ADDRESS), PORT)){
//kdDebug() << "hddtemp is availalble" << endl;
QCString tmp(0);
Q_LONG numBytes = 0;
Q_LONG numTotalBytes = 0;
TQCString tmp(0);
TQ_LONG numBytes = 0;
TQ_LONG numTotalBytes = 0;
do{
tmp.resize(numTotalBytes+BUFFERSIZE);
numBytes = sd.readBlock(tmp.data()+numTotalBytes, BUFFERSIZE);
// numBytes could be -1 too in case of an error!
numTotalBytes += QMAX(numBytes, 0);
numTotalBytes += TQMAX(numBytes, 0);
}while(numBytes>0);
sd.close();
tmp.resize(numTotalBytes+1);
//kdDebug() << "following data was read: " << tmp << endl;
// split the string
QStringList sl = QStringList::split(tmp[0], tmp);
TQStringList sl = TQStringList::split(tmp[0], tmp);
// create the sources
if(sl.size() > 0 && sl.size()%4 == 0){
for(uint i = 0; i < sl.size(); i += 4)
@ -74,23 +74,23 @@ std::list<Source*>HDDTempSrc::createInstances(QWidget* inParent){
return list;
}
QString HDDTempSrc::fetchValue(){
QString s = "n/a";
QSocketDevice sd;
TQString HDDTempSrc::fetchValue(){
TQString s = "n/a";
TQSocketDevice sd;
sd.setBlocking(true);
if(sd.connect((ADDRESS), PORT)){
QCString tmp(0);
Q_LONG numBytes = 0;
Q_LONG numTotalBytes = 0;
TQCString tmp(0);
TQ_LONG numBytes = 0;
TQ_LONG numTotalBytes = 0;
do{
tmp.resize(numTotalBytes+BUFFERSIZE);
numBytes = sd.readBlock(tmp.data()+numTotalBytes, BUFFERSIZE);
// numBytes could be -1 too in case of an error!
numTotalBytes += QMAX(numBytes, 0);
numTotalBytes += TQMAX(numBytes, 0);
}while(numBytes>0);
sd.close();
tmp.resize(numTotalBytes+1);
QStringList sl = QStringList::split(tmp[0], tmp);
TQStringList sl = TQStringList::split(tmp[0], tmp);
if(sl.size() > 0 && sl.size()%4 == 0){
s = formatTemperature(sl[mIndex*4+2]);
}

@ -28,40 +28,40 @@
* HDDTempSrc reads temperature of your harddisk provided by hddtemp
*/
class HDDTempSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
/**
* defines how many bytes are read at once from the network
*/
static const Q_ULONG BUFFERSIZE;
static const TQ_ULONG BUFFERSIZE;
/**
* defines the address
*/
static const Q_UINT32 ADDRESS;
static const TQ_UINT32 ADDRESS;
/**
* defines the port
*/
static const Q_UINT16 PORT;
static const TQ_UINT16 PORT;
public:
/**
* Creates a new Source from the given File
*/
HDDTempSrc(QWidget* inParent, uint inIndex, const QString& inDevice, const QString& inModelName);
HDDTempSrc(TQWidget* inParent, uint inIndex, const TQString& inDevice, const TQString& inModelName);
virtual ~HDDTempSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
uint mIndex;

@ -19,29 +19,29 @@
***************************************************************************/
#include "hwmonfansrc.h"
#include <qtextstream.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqdir.h>
#include <klocale.h>
HwMonFanSrc::HwMonFanSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex):
HwMonFanSrc::HwMonFanSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this, 3000){
//mName = "HwMon " + inSourceFile.name()[inSourceFile.name().length() - 7];
mID = "hwmonFan" + QString::number(inIndex);
mID = "hwmonFan" + TQString::number(inIndex);
mName = mID;
mDescription = i18n("This fan source is provided by hwmon. (%1)").arg(inSourceFile.name());
mDescription = i18n("This fan source is provided by hwmon. (%1)").tqarg(inSourceFile.name());
}
HwMonFanSrc::~HwMonFanSrc(){
}
std::list<Source*>HwMonFanSrc::createInstances(QWidget* inParent){
std::list<Source*>HwMonFanSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
// /sys/class/hwmon/hwmon*/device/fan*_input
QDir d("/sys/class/hwmon/");
QDir subd;
QString device = "/device";
TQDir d("/sys/class/hwmon/");
TQDir subd;
TQString device = "/device";
// check the i2c interface if hwmon isn't available
// /sys/bus/i2c/devices/*/fan*_input
if(!d.exists()){
@ -51,19 +51,19 @@ std::list<Source*>HwMonFanSrc::createInstances(QWidget* inParent){
if(d.exists()){
unsigned int index = 1;
d.setFilter(QDir::Dirs);
d.setSorting(QDir::Name);
d.setFilter(TQDir::Dirs);
d.setSorting(TQDir::Name);
for(unsigned int i = 0; i < d.count(); i++ ){
if((d[i] != ".") && (d[i] != "..")){
subd = d.canonicalPath() + "/" + d[i] + device;
subd.setFilter(QDir::Files);
subd.setSorting(QDir::Name);
subd.setFilter(TQDir::Files);
subd.setSorting(TQDir::Name);
for ( unsigned int j = 0; j < subd.count(); j++ ){
if((subd[j] != ".") && (subd[j] != "..") && (QDir::match(subd.canonicalPath() + "/fan*_input", subd.canonicalPath() + "/" + subd[j]))){
QFile f(subd.canonicalPath() + "/" + subd[j]);
if((subd[j] != ".") && (subd[j] != "..") && (TQDir::match(subd.canonicalPath() + "/fan*_input", subd.canonicalPath() + "/" + subd[j]))){
TQFile f(subd.canonicalPath() + "/" + subd[j]);
if(f.open(IO_ReadOnly)){
QTextStream textStream( &f );
QString s = textStream.readLine();
TQTextStream textStream( &f );
TQString s = textStream.readLine();
f.close();
if(!s.startsWith("-")){
list.push_back(new HwMonFanSrc(inParent, f, index));
@ -78,10 +78,10 @@ std::list<Source*>HwMonFanSrc::createInstances(QWidget* inParent){
return list;
}
QString HwMonFanSrc::fetchValue(){
QString s = "n/a";
TQString HwMonFanSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine().stripWhiteSpace();
mSourceFile.close();
s.append(" rpm");

@ -22,7 +22,7 @@
#define HWMONFANSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -32,30 +32,30 @@
* see /usr/src/linux/Documentation/hwmon/sysfs-interface
*/
class HwMonFanSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
HwMonFanSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex);
HwMonFanSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex);
virtual ~HwMonFanSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,29 +19,29 @@
***************************************************************************/
#include "hwmonthermalsrc.h"
#include <qtextstream.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqdir.h>
#include <klocale.h>
HwMonThermalSrc::HwMonThermalSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex):
HwMonThermalSrc::HwMonThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this, 3000){
//mName = "HwMon " + inSourceFile.name()[inSourceFile.name().length() - 7];
mID = "hwmon" + QString::number(inIndex);
mID = "hwmon" + TQString::number(inIndex);
mName = mID;
mDescription = i18n("This thermal source is provided by hwmon. (%1)").arg(inSourceFile.name());
mDescription = i18n("This thermal source is provided by hwmon. (%1)").tqarg(inSourceFile.name());
}
HwMonThermalSrc::~HwMonThermalSrc(){
}
std::list<Source*>HwMonThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>HwMonThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
// /sys/class/hwmon/*/device/temp*_input
QDir d("/sys/class/hwmon/");
QDir subd;
QString device = "/device";
TQDir d("/sys/class/hwmon/");
TQDir subd;
TQString device = "/device";
// check the i2c interface if hwmon isn't available
// /sys/bus/i2c/devices/*/temp*_input
if(!d.exists()){
@ -51,19 +51,19 @@ std::list<Source*>HwMonThermalSrc::createInstances(QWidget* inParent){
if(d.exists()){
unsigned int index = 1;
d.setFilter(QDir::Dirs);
d.setSorting(QDir::Name);
d.setFilter(TQDir::Dirs);
d.setSorting(TQDir::Name);
for(unsigned int i = 0; i < d.count(); i++ ){
if((d[i] != ".") && (d[i] != "..")){
subd = d.canonicalPath() + "/" + d[i] + device;
subd.setFilter(QDir::Files);
subd.setSorting(QDir::Name);
subd.setFilter(TQDir::Files);
subd.setSorting(TQDir::Name);
for(unsigned int j = 0; j < subd.count(); j++){
if((subd[j] != ".") && (subd[j] != "..") && (QDir::match(subd.canonicalPath() + "/temp*_input", subd.canonicalPath() + "/" + subd[j]))){
QFile f(subd.canonicalPath() + "/" + subd[j]);
if((subd[j] != ".") && (subd[j] != "..") && (TQDir::match(subd.canonicalPath() + "/temp*_input", subd.canonicalPath() + "/" + subd[j]))){
TQFile f(subd.canonicalPath() + "/" + subd[j]);
if(f.open(IO_ReadOnly)){
QTextStream textStream( &f );
QString s = textStream.readLine();
TQTextStream textStream( &f );
TQString s = textStream.readLine();
f.close();
if(!s.startsWith("-")){
list.push_back(new HwMonThermalSrc(inParent, f, index));
@ -78,10 +78,10 @@ std::list<Source*>HwMonThermalSrc::createInstances(QWidget* inParent){
return list;
}
QString HwMonThermalSrc::fetchValue(){
QString s = "n/a";
TQString HwMonThermalSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine();
mSourceFile.close();
s = s.stripWhiteSpace();

@ -22,7 +22,7 @@
#define HWMONTHERMALSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -32,30 +32,30 @@
* see /usr/src/linux/Documentation/hwmon/sysfs-interface
*/
class HwMonThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
HwMonThermalSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex);
HwMonThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex);
virtual ~HwMonThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,11 +19,11 @@
***************************************************************************/
#include "i8ksrc.h"
#include <qtextstream.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqdir.h>
#include <klocale.h>
I8kSrc::I8kSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex):
I8kSrc::I8kSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex):
LabelSource(inParent),
mIndex(inIndex),
mSourceFile(inSourceFile.name()),
@ -36,14 +36,14 @@ I8kSrc::I8kSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inInde
I8kSrc::~I8kSrc(){
}
std::list<Source*>I8kSrc::createInstances(QWidget* inParent){
std::list<Source*>I8kSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile i8kFile("/proc/i8k");
TQFile i8kFile("/proc/i8k");
if(i8kFile.open(IO_ReadOnly)){
QTextStream textStream(&i8kFile);
QString s = textStream.readLine();
TQTextStream textStream(&i8kFile);
TQString s = textStream.readLine();
i8kFile.close();
QStringList entries = QStringList::split(' ', s);
TQStringList entries = TQStringList::split(' ', s);
if(entries.size() && entries[0] == "1.0"){ // support for version 1.0
// CPU temp
if(entries.size() >= 4 && !entries[3].startsWith("-"))
@ -58,13 +58,13 @@ std::list<Source*>I8kSrc::createInstances(QWidget* inParent){
}
return list;
}
QString I8kSrc::fetchValue(){
QString s = "n/a";
TQString I8kSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream(&mSourceFile);
TQTextStream textStream(&mSourceFile);
s = textStream.readLine();
mSourceFile.close();
s = s.section(' ', mIndex, mIndex, QString::SectionSkipEmpty).stripWhiteSpace();
s = s.section(' ', mIndex, mIndex, TQString::SectionSkipEmpty).stripWhiteSpace();
switch(mIndex){
case 3: // CPU temperature (Celsius)
s = formatTemperature(s);
@ -72,7 +72,7 @@ QString I8kSrc::fetchValue(){
case 6: // left fan rpm
case 7: // right fan rpm
if(s.length() > 1)
s.truncate(s.length() - 1); //s = QString::number(s.toInt()/10);
s.truncate(s.length() - 1); //s = TQString::number(s.toInt()/10);
s.append(" rpm");
break;
default:
@ -82,7 +82,7 @@ QString I8kSrc::fetchValue(){
return s;
}
QString I8kSrc::index2Name(unsigned int inIndex){
TQString I8kSrc::index2Name(unsigned int inIndex){
switch(inIndex){
case 0: // /proc/i8k format version
return "i8k Format Version";
@ -93,19 +93,19 @@ QString I8kSrc::index2Name(unsigned int inIndex){
case 3: // CPU temperature (Celsius)
return "CPU";
case 4: // left fan status
return "left Fan Status";
return "left Fan tqStatus";
case 5: // right fan status
return "right Fan Status";
return "right Fan tqStatus";
case 6: // left fan rpm
return "left Fan";
case 7: // right fan rpm
return "right Fan";
case 8: // ac status
return "AC Status";
return "AC tqStatus";
case 9: // buttons status
return "Button Status";
return "Button tqStatus";
default:
return "unknown" + QString().setNum(inIndex);
return "unknown" + TQString().setNum(inIndex);
}
}

@ -22,7 +22,7 @@
#define I8KSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -30,30 +30,30 @@
* which is provided by the i8k kernel module.
*/
class I8kSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
I8kSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex);
I8kSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex);
virtual ~I8kSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* Returns the name (such as CPU, GPU, ...) of the sensor according to a given index
*/
static QString index2Name(unsigned int inIndex);
static TQString index2Name(unsigned int inIndex);
/**
* the index of the source in /proc/acpi/ibm/thermal
@ -63,7 +63,7 @@ private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,11 +19,11 @@
***************************************************************************/
#include "ibmacpifansrc.h"
#include <qtextstream.h>
#include <qfile.h>
#include <tqtextstream.h>
#include <tqfile.h>
#include <klocale.h>
IBMACPIFanSrc::IBMACPIFanSrc(QWidget* inParent, const QFile& inSourceFile):
IBMACPIFanSrc::IBMACPIFanSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
@ -35,16 +35,16 @@ IBMACPIFanSrc::IBMACPIFanSrc(QWidget* inParent, const QFile& inSourceFile):
IBMACPIFanSrc::~IBMACPIFanSrc(){
}
std::list<Source*>IBMACPIFanSrc::createInstances(QWidget* inParent){
std::list<Source*>IBMACPIFanSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile ibmFile( "/proc/acpi/ibm/fan" );
TQFile ibmFile( "/proc/acpi/ibm/fan" );
if(ibmFile.open(IO_ReadOnly))
list.push_back(new IBMACPIFanSrc(inParent, ibmFile));
return list;
}
QString IBMACPIFanSrc::fetchValue(){
QString s = "n/a";
TQString IBMACPIFanSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
while( mSourceFile.readLine( s, 64 ) != -1 )
if(s.startsWith("speed:"))

@ -22,7 +22,7 @@
#define IBMACPIFANSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -30,30 +30,30 @@
* which is provided by the ibm-acpi kernel module.
*/
class IBMACPIFanSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File and index
*/
IBMACPIFanSrc(QWidget* inParent, const QFile& inSourceFile);
IBMACPIFanSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~IBMACPIFanSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,13 +19,13 @@
***************************************************************************/
#include "ibmacpithermalsrc.h"
#include <qtextstream.h>
#include <qfile.h>
#include <tqtextstream.h>
#include <tqfile.h>
#include <klocale.h>
//#include "hal/libhal.h"
// hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.product
IBMACPIThermalSrc::IBMACPIThermalSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex):
IBMACPIThermalSrc::IBMACPIThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex):
LabelSource(inParent),
mIndex(inIndex),
mSourceFile(inSourceFile.name()),
@ -39,15 +39,15 @@ IBMACPIThermalSrc::IBMACPIThermalSrc(QWidget* inParent, const QFile& inSourceFil
IBMACPIThermalSrc::~IBMACPIThermalSrc(){
}
std::list<Source*>IBMACPIThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>IBMACPIThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile ibmFile( "/proc/acpi/ibm/thermal" );
TQFile ibmFile( "/proc/acpi/ibm/thermal" );
if(ibmFile.open(IO_ReadOnly)){
QTextStream textStream( &ibmFile );
QString s = textStream.readLine();
TQTextStream textStream( &ibmFile );
TQString s = textStream.readLine();
ibmFile.close();
s = s.remove("temperatures:");
QStringList entries = QStringList::split(' ' ,s);
TQStringList entries = TQStringList::split(' ' ,s);
for ( unsigned int i = 0; i < entries.size(); i++ ){
if(!entries[i].startsWith("-") && !entries[i].startsWith("0"))
list.push_back(new IBMACPIThermalSrc(inParent, ibmFile, i));
@ -56,19 +56,19 @@ std::list<Source*>IBMACPIThermalSrc::createInstances(QWidget* inParent){
return list;
}
QString IBMACPIThermalSrc::fetchValue(){
QString s = "n/a";
TQString IBMACPIThermalSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine();
mSourceFile.close();
s = s.section(':', 1, 1).section(' ', mIndex, mIndex, QString::SectionSkipEmpty).stripWhiteSpace();
s = s.section(':', 1, 1).section(' ', mIndex, mIndex, TQString::SectionSkipEmpty).stripWhiteSpace();
s = formatTemperature(s);
}
return s;
}
QString IBMACPIThermalSrc::index2Name(unsigned int inIndex){
TQString IBMACPIThermalSrc::index2Name(unsigned int inIndex){
switch(inIndex){
case 0:
return "CPU";
@ -83,6 +83,6 @@ QString IBMACPIThermalSrc::index2Name(unsigned int inIndex){
case 6:
return "Battery2";
default:
return "ibmacpi" + QString().setNum(inIndex);
return "ibmacpi" + TQString().setNum(inIndex);
}
}

@ -22,7 +22,7 @@
#define IBMACPITHERMALSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -30,30 +30,30 @@
* which is provided by the ibm-acpi kernel module.
*/
class IBMACPIThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File and index
*/
IBMACPIThermalSrc(QWidget* inParent, const QFile& inSourceFile, unsigned int inIndex);
IBMACPIThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, unsigned int inIndex);
virtual ~IBMACPIThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* Returns the name (such as CPU, GPU, ...) of the sensor according to a given index
*/
static QString index2Name(unsigned int inIndex);
static TQString index2Name(unsigned int inIndex);
/**
* the index of the source in /proc/acpi/ibm/thermal
@ -63,7 +63,7 @@ private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,15 +19,15 @@
***************************************************************************/
#include "ibmhdaps.h"
#include <qtextstream.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqdir.h>
#include <klocale.h>
IBMHDAPSSrc::IBMHDAPSSrc(QWidget* inParent, const QFile& inSourceFile):
IBMHDAPSSrc::IBMHDAPSSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
mID = "HDAPS" + mSourceFile.name().section( '/', -1, -1, QString::SectionSkipEmpty ).remove("temp");
mID = "HDAPS" + mSourceFile.name().section( '/', -1, -1, TQString::SectionSkipEmpty ).remove("temp");
mName = mID;
mDescription = i18n("This thermal source is provided by the IBM HDAPS driver.");
}
@ -35,15 +35,15 @@ IBMHDAPSSrc::IBMHDAPSSrc(QWidget* inParent, const QFile& inSourceFile):
IBMHDAPSSrc::~IBMHDAPSSrc(){
}
std::list<Source*>IBMHDAPSSrc::createInstances(QWidget* inParent){
std::list<Source*>IBMHDAPSSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QDir hdapsDir( "/sys/bus/platform/drivers/hdaps/hdaps" );
TQDir hdapsDir( "/sys/bus/platform/drivers/hdaps/hdaps" );
if ( hdapsDir.exists() ){
hdapsDir.setFilter( QDir::Files | QDir::NoSymLinks );
hdapsDir.setSorting( QDir::Name);
hdapsDir.setFilter( TQDir::Files | TQDir::NoSymLinks );
hdapsDir.setSorting( TQDir::Name);
for ( unsigned int i = 0; i < hdapsDir.count(); i++ ){
if(hdapsDir[i].startsWith("temp")){
QFile hdapsFile(hdapsDir.canonicalPath() + "/" + hdapsDir[i]);
TQFile hdapsFile(hdapsDir.canonicalPath() + "/" + hdapsDir[i]);
list.push_back(new IBMHDAPSSrc(inParent, hdapsFile));
}
}
@ -51,10 +51,10 @@ std::list<Source*>IBMHDAPSSrc::createInstances(QWidget* inParent){
return list;
}
QString IBMHDAPSSrc::fetchValue(){
QString s = "n/a";
TQString IBMHDAPSSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine().stripWhiteSpace();
mSourceFile.close();
s = formatTemperature(s);

@ -22,7 +22,7 @@
#define IBMHDAPSSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -32,30 +32,30 @@
* @author Ken Werner
*/
class IBMHDAPSSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
IBMHDAPSSrc(QWidget* inParent, const QFile& inSourceFile);
IBMHDAPSSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~IBMHDAPSSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -20,10 +20,10 @@
***************************************************************************/
#include "ibookg4thermalsrc.h"
#include <qtextstream.h>
#include <tqtextstream.h>
#include <klocale.h>
IbookG4ThermalSrc::IbookG4ThermalSrc(QWidget* inParent, const QFile& inSourceFile, const QString& inName):
IbookG4ThermalSrc::IbookG4ThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, const TQString& inName):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
@ -35,25 +35,25 @@ IbookG4ThermalSrc::IbookG4ThermalSrc(QWidget* inParent, const QFile& inSourceFil
IbookG4ThermalSrc::~IbookG4ThermalSrc(){
}
std::list<Source*>IbookG4ThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>IbookG4ThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile ibookCPUFile("/sys/devices/temperatures/sensor1_temperature");
TQFile ibookCPUFile("/sys/devices/temperatures/sensor1_temperature");
if(ibookCPUFile.open(IO_ReadOnly)){
list.push_back(new IbookG4ThermalSrc(inParent, ibookCPUFile, QString("CPU")));
list.push_back(new IbookG4ThermalSrc(inParent, ibookCPUFile, TQString("CPU")));
ibookCPUFile.close();
}
QFile ibookGPUFile("/sys/devices/temperatures/sensor2_temperature");
TQFile ibookGPUFile("/sys/devices/temperatures/sensor2_temperature");
if(ibookGPUFile.open(IO_ReadOnly)){
list.push_back(new IbookG4ThermalSrc(inParent, ibookGPUFile, QString("GPU")));
list.push_back(new IbookG4ThermalSrc(inParent, ibookGPUFile, TQString("GPU")));
ibookGPUFile.close();
}
return list;
}
QString IbookG4ThermalSrc::fetchValue(){
QString s = "n/a";
TQString IbookG4ThermalSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine().stripWhiteSpace();
mSourceFile.close();
s= formatTemperature(s);

@ -23,7 +23,7 @@
#define IBOOKG4THERMALSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -33,30 +33,30 @@
* It may work on other Apple machines as well (please let me know)
*/
class IbookG4ThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
IbookG4ThermalSrc(QWidget* inParent, const QFile& inSourceFile, const QString& inName);
IbookG4ThermalSrc(TQWidget* inParent, const TQFile& inSourceFile, const TQString& inName);
virtual ~IbookG4ThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,16 +19,16 @@
***************************************************************************/
#include "labelsource.h"
#include <qlabel.h>
#include <tqlabel.h>
#include <kcolorbutton.h>
#include <kfontrequester.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <tqcombobox.h>
#include <tqcheckbox.h>
#include <klocale.h>
//#include "kdebug.h"
LabelSource::LabelSource(QWidget* inParent):
LabelSource::LabelSource(TQWidget* inParent):
TriggeredSource(inParent),
mParent(inParent),
mLabelSourcePrefs(NULL){
@ -37,21 +37,21 @@ LabelSource::LabelSource(QWidget* inParent):
LabelSource::~LabelSource(){
}
QWidget* LabelSource::getWidget(){
TQWidget* LabelSource::getWidget(){
//kdDebug() << "LabelSource::getWidget called: " << mID << endl;
return mLabel;
}
void LabelSource::createSubPrefs(QWidget* inParent){
void LabelSource::createSubPrefs(TQWidget* inParent){
if(!mLabelSourcePrefs){
mLabelSourcePrefs = new LabelSourcePrefs(inParent, "labelsourceprefsui");
// disable nameCheckBox if taskbarCheckBox is disabled
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->colorLabel, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->colorButton, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->fontLabel, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->fontRequester, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->alignmentLabel, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mLabelSourcePrefs->alignmentComboBox, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->colorLabel, TQT_SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->colorButton, TQT_SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->fontLabel, TQT_SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->fontRequester, TQT_SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->tqalignmentLabel, TQT_SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mLabelSourcePrefs->tqalignmentComboBox, TQT_SLOT(setEnabled(bool)));
addPrefs(mLabelSourcePrefs);
}
}
@ -60,16 +60,16 @@ void LabelSource::updatePrefsGUI(){
TriggeredSource::updatePrefsGUI(); // update prefs of the super class
mLabelSourcePrefs->colorButton->setColor(mLabel->paletteForegroundColor());
mLabelSourcePrefs->fontRequester->setFont(mLabel->font());
switch (mLabel->alignment()) {
case Qt::AlignCenter:
mLabelSourcePrefs->alignmentComboBox->setCurrentItem(1);
switch (mLabel->tqalignment()) {
case TQt::AlignCenter:
mLabelSourcePrefs->tqalignmentComboBox->setCurrentItem(1);
break;
case Qt::AlignRight:
mLabelSourcePrefs->alignmentComboBox->setCurrentItem(2);
case TQt::AlignRight:
mLabelSourcePrefs->tqalignmentComboBox->setCurrentItem(2);
break;
default: // Qt::AlignLeft
default: // TQt::AlignLeft
break;
mLabelSourcePrefs->alignmentComboBox->setCurrentItem(0);
mLabelSourcePrefs->tqalignmentComboBox->setCurrentItem(0);
}
}
@ -80,22 +80,22 @@ void LabelSource::setPrefsWidgetsEnabled(bool isEnabled, bool isShownOnApplet){
mLabelSourcePrefs->colorButton->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->fontLabel->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->fontRequester->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->alignmentLabel->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->alignmentComboBox->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->tqalignmentLabel->setEnabled(isEnabled && isShownOnApplet);
mLabelSourcePrefs->tqalignmentComboBox->setEnabled(isEnabled && isShownOnApplet);
}
void LabelSource::applyPrefs(){
TriggeredSource::applyPrefs(); // call apply prefs of the super class
mLabel->setPaletteForegroundColor(mLabelSourcePrefs->colorButton->color());
mLabel->setFont(mLabelSourcePrefs->fontRequester->font());
int alignID = mLabelSourcePrefs->alignmentComboBox->currentItem();
Qt::AlignmentFlags align = Qt::AlignCenter;
int alignID = mLabelSourcePrefs->tqalignmentComboBox->currentItem();
TQt::AlignmentFlags align = TQt::AlignCenter;
if(alignID == 0){
align = Qt::AlignLeft;
align = TQt::AlignLeft;
}else if(alignID == 2){
align = Qt::AlignRight;
align = TQt::AlignRight;
}
mLabel->setAlignment(align);
mLabel->tqsetAlignment(align);
updateLabel(mValue);
}
@ -103,22 +103,22 @@ void LabelSource::savePrefs(KConfig* inKConfig){
TriggeredSource::savePrefs(inKConfig);
inKConfig->writeEntry(mID + "_color", mLabelSourcePrefs->colorButton->color());
inKConfig->writeEntry(mID + "_font", mLabelSourcePrefs->fontRequester->font());
inKConfig->writeEntry(mID + "_align", mLabel->alignment());
inKConfig->writeEntry(mID + "_align", mLabel->tqalignment());
}
void LabelSource::loadPrefs(KConfig* inKConfig){
TriggeredSource::loadPrefs(inKConfig);
QColor color = inKConfig->readColorEntry(mID + "_color");
TQColor color = inKConfig->readColorEntry(mID + "_color");
if(!color.isValid())
color.setRgb(0,0,0);
mLabel->setPaletteForegroundColor(color);
mLabel->setFont(inKConfig->readFontEntry(mID + "_font"));
mLabel->setAlignment(inKConfig->readNumEntry(mID + "_align"));
mLabel->tqsetAlignment(inKConfig->readNumEntry(mID + "_align"));
}
void LabelSource::updateLabel(const QString& inValue){
void LabelSource::updateLabel(const TQString& inValue){
// update the label text
QString text = (getName().isEmpty() || !showName()) ? inValue : getName() + ": " + inValue;
TQString text = (getName().isEmpty() || !showName()) ? inValue : getName() + ": " + inValue;
//kdDebug() << "updateLabel " << getName() << ", value: " << text << endl;
//if(mLabel->text() != text)
mLabel->setText(text);
@ -127,7 +127,7 @@ void LabelSource::updateLabel(const QString& inValue){
void LabelSource::realizeWidget(){
Source::realizeWidget();
// the prefs dialog is created in the addPrefs method
mLabel = new QLabel(i18n("n/a"), mParent);
mLabel->setTextFormat(Qt::PlainText);
connect(this, SIGNAL(valueUpdated(const QString&)), this, SLOT(updateLabel(const QString&)));
mLabel = new TQLabel(i18n("n/a"), mParent);
mLabel->setTextFormat(TQt::PlainText);
connect(this, TQT_SIGNAL(valueUpdated(const TQString&)), this, TQT_SLOT(updateLabel(const TQString&)));
}

@ -24,26 +24,26 @@
#include "triggeredsource.h"
#include "labelsourcePrefs.h"
class QLabel;
class TQLabel;
/**
* LabelSource displays its value on a configurable QLabel
* LabelSource displays its value on a configurable TQLabel
* @author Ken Werner
*/
class LabelSource : public TriggeredSource{
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new DefaultSource from the given File
*/
LabelSource(QWidget* inParent);
LabelSource(TQWidget* inParent);
virtual ~LabelSource();
/**
* Returns the Label of this source that is displayed in the kicker
*/
QWidget* getWidget();
TQWidget* getWidget();
/**
* fills the prefs gui with appropriate values
@ -51,7 +51,7 @@ public:
virtual void updatePrefsGUI();
/**
* realizes the widget. that means, create the QLabel.
* realizes the widget. that means, create the TQLabel.
*/
virtual void realizeWidget();
@ -59,7 +59,7 @@ protected slots:
/**
* updates the label
*/
virtual void updateLabel(const QString& inValue);
virtual void updateLabel(const TQString& inValue);
/**
* Applies the prefs
@ -86,17 +86,17 @@ protected:
/**
* Allows subclasses adding their own preferences using the addPrefs method
*/
virtual void createSubPrefs(QWidget* inParent);
virtual void createSubPrefs(TQWidget* inParent);
/**
* Displays the content of that source
*/
QLabel* mLabel;
TQLabel* mLabel;
/**
* the parent of the label we are going to create
* the tqparent of the label we are going to create
*/
QWidget* mParent;
TQWidget* mParent;
private:
/**

@ -11,72 +11,72 @@
#include "labelsourcePrefs.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qframe.h>
#include <qlabel.h>
#include <tqvariant.h>
#include <tqpushbutton.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <kcolorbutton.h>
#include <kfontrequester.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <tqcombobox.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
/*
* Constructs a LabelSourcePrefs as a child of 'parent', with the
* Constructs a LabelSourcePrefs as a child of 'tqparent', with the
* name 'name' and widget flags set to 'f'.
*/
LabelSourcePrefs::LabelSourcePrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
LabelSourcePrefs::LabelSourcePrefs( TQWidget* tqparent, const char* name, WFlags fl )
: TQWidget( tqparent, name, fl )
{
if ( !name )
setName( "LabelSourcePrefs" );
LabelSourcePrefsLayout = new QVBoxLayout( this, 0, 6, "LabelSourcePrefsLayout");
LabelSourcePrefsLayout = new TQVBoxLayout( this, 0, 6, "LabelSourcePrefsLayout");
defaultSourcePrefsFrame = new QFrame( this, "defaultSourcePrefsFrame" );
defaultSourcePrefsFrame->setFrameShape( QFrame::NoFrame );
defaultSourcePrefsFrame->setFrameShadow( QFrame::Plain );
defaultSourcePrefsFrameLayout = new QVBoxLayout( defaultSourcePrefsFrame, 0, 6, "defaultSourcePrefsFrameLayout");
defaultSourcePrefsFrame = new TQFrame( this, "defaultSourcePrefsFrame" );
defaultSourcePrefsFrame->setFrameShape( TQFrame::NoFrame );
defaultSourcePrefsFrame->setFrameShadow( TQFrame::Plain );
defaultSourcePrefsFrameLayout = new TQVBoxLayout( defaultSourcePrefsFrame, 0, 6, "defaultSourcePrefsFrameLayout");
taskbartitleLabel = new QLabel( defaultSourcePrefsFrame, "taskbartitleLabel" );
QFont taskbartitleLabel_font( taskbartitleLabel->font() );
taskbartitleLabel = new TQLabel( defaultSourcePrefsFrame, "taskbartitleLabel" );
TQFont taskbartitleLabel_font( taskbartitleLabel->font() );
taskbartitleLabel_font.setBold( TRUE );
taskbartitleLabel->setFont( taskbartitleLabel_font );
defaultSourcePrefsFrameLayout->addWidget( taskbartitleLabel );
layout13 = new QHBoxLayout( 0, 0, 6, "layout13");
tqlayout13 = new TQHBoxLayout( 0, 0, 6, "tqlayout13");
colorLabel = new QLabel( defaultSourcePrefsFrame, "colorLabel" );
layout13->addWidget( colorLabel );
colorLabel = new TQLabel( defaultSourcePrefsFrame, "colorLabel" );
tqlayout13->addWidget( colorLabel );
colorButton = new KColorButton( defaultSourcePrefsFrame, "colorButton" );
layout13->addWidget( colorButton );
spacer1 = new QSpacerItem( 350, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout13->addItem( spacer1 );
defaultSourcePrefsFrameLayout->addLayout( layout13 );
tqlayout13->addWidget( colorButton );
spacer1 = new TQSpacerItem( 350, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
tqlayout13->addItem( spacer1 );
defaultSourcePrefsFrameLayout->addLayout( tqlayout13 );
layout17 = new QHBoxLayout( 0, 0, 6, "layout17");
tqlayout17 = new TQHBoxLayout( 0, 0, 6, "tqlayout17");
fontLabel = new QLabel( defaultSourcePrefsFrame, "fontLabel" );
layout17->addWidget( fontLabel );
fontLabel = new TQLabel( defaultSourcePrefsFrame, "fontLabel" );
tqlayout17->addWidget( fontLabel );
fontRequester = new KFontRequester( defaultSourcePrefsFrame, "fontRequester" );
layout17->addWidget( fontRequester );
defaultSourcePrefsFrameLayout->addLayout( layout17 );
tqlayout17->addWidget( fontRequester );
defaultSourcePrefsFrameLayout->addLayout( tqlayout17 );
layout18 = new QHBoxLayout( 0, 0, 6, "layout18");
tqlayout18 = new TQHBoxLayout( 0, 0, 6, "tqlayout18");
alignmentLabel = new QLabel( defaultSourcePrefsFrame, "alignmentLabel" );
layout18->addWidget( alignmentLabel );
tqalignmentLabel = new TQLabel( defaultSourcePrefsFrame, "tqalignmentLabel" );
tqlayout18->addWidget( tqalignmentLabel );
alignmentComboBox = new QComboBox( FALSE, defaultSourcePrefsFrame, "alignmentComboBox" );
layout18->addWidget( alignmentComboBox );
spacer2 = new QSpacerItem( 350, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout18->addItem( spacer2 );
defaultSourcePrefsFrameLayout->addLayout( layout18 );
tqalignmentComboBox = new TQComboBox( FALSE, defaultSourcePrefsFrame, "tqalignmentComboBox" );
tqlayout18->addWidget( tqalignmentComboBox );
spacer2 = new TQSpacerItem( 350, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
tqlayout18->addItem( spacer2 );
defaultSourcePrefsFrameLayout->addLayout( tqlayout18 );
LabelSourcePrefsLayout->addWidget( defaultSourcePrefsFrame );
languageChange();
resize( QSize(299, 135).expandedTo(minimumSizeHint()) );
resize( TQSize(299, 135).expandedTo(tqminimumSizeHint()) );
clearWState( WState_Polished );
}
@ -85,7 +85,7 @@ LabelSourcePrefs::LabelSourcePrefs( QWidget* parent, const char* name, WFlags fl
*/
LabelSourcePrefs::~LabelSourcePrefs()
{
// no need to delete child widgets, Qt does it all for us
// no need to delete child widgets, TQt does it all for us
}
/*
@ -98,13 +98,13 @@ void LabelSourcePrefs::languageChange()
taskbartitleLabel->setText( tr2i18n( "<br>\n"
"Taskbar visual settings" ) );
colorLabel->setText( tr2i18n( "Foreground color:" ) );
colorButton->setText( QString::null );
colorButton->setText( TQString() );
fontLabel->setText( tr2i18n( "Font:" ) );
alignmentLabel->setText( tr2i18n( "Alignment:" ) );
alignmentComboBox->clear();
alignmentComboBox->insertItem( tr2i18n( "Left" ) );
alignmentComboBox->insertItem( tr2i18n( "Center" ) );
alignmentComboBox->insertItem( tr2i18n( "Right" ) );
tqalignmentLabel->setText( tr2i18n( "Alignment:" ) );
tqalignmentComboBox->clear();
tqalignmentComboBox->insertItem( tr2i18n( "Left" ) );
tqalignmentComboBox->insertItem( tr2i18n( "Center" ) );
tqalignmentComboBox->insertItem( tr2i18n( "Right" ) );
}
#include "labelsourcePrefs.moc"

@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>LabelSourcePrefs</class>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>LabelSourcePrefs</cstring>
</property>
@ -22,7 +22,7 @@
<property name="margin">
<number>0</number>
</property>
<widget class="QFrame">
<widget class="TQFrame">
<property name="name">
<cstring>defaultSourcePrefsFrame</cstring>
</property>
@ -39,7 +39,7 @@
<property name="margin">
<number>0</number>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>taskbartitleLabel</cstring>
</property>
@ -53,15 +53,15 @@
Taskbar visual settings</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout13</cstring>
<cstring>tqlayout13</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>colorLabel</cstring>
</property>
@ -87,7 +87,7 @@ Taskbar visual settings</string>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>350</width>
<height>20</height>
@ -96,15 +96,15 @@ Taskbar visual settings</string>
</spacer>
</hbox>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout17</cstring>
<cstring>tqlayout17</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>fontLabel</cstring>
</property>
@ -119,23 +119,23 @@ Taskbar visual settings</string>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout18</cstring>
<cstring>tqlayout18</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>alignmentLabel</cstring>
<cstring>tqalignmentLabel</cstring>
</property>
<property name="text">
<string>Alignment:</string>
</property>
</widget>
<widget class="QComboBox">
<widget class="TQComboBox">
<item>
<property name="text">
<string>Left</string>
@ -152,7 +152,7 @@ Taskbar visual settings</string>
</property>
</item>
<property name="name">
<cstring>alignmentComboBox</cstring>
<cstring>tqalignmentComboBox</cstring>
</property>
</widget>
<spacer>
@ -165,7 +165,7 @@ Taskbar visual settings</string>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>350</width>
<height>20</height>
@ -178,7 +178,7 @@ Taskbar visual settings</string>
</widget>
</vbox>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kcolorbutton.h</includehint>
<includehint>kfontrequester.h</includehint>

@ -19,39 +19,39 @@
***************************************************************************/
#include "nvidiathermalsrc.h"
#include <qstringlist.h>
#include <qregexp.h>
#include <tqstringlist.h>
#include <tqregexp.h>
#include <klocale.h>
#include <kdebug.h>
#ifndef HAVE_NVCONTROL
#include <kprocio.h>
#else
#include <qpaintdevice.h> // for the Device* pointer
#include <tqpaintdevice.h> // for the Device* pointer
// include the NVCtrl include stuff
#include <X11/Xlib.h>
#include <fixx11h.h> // needed for Qt, to include X11 header
#include <fixx11h.h> // needed for TQt, to include X11 header
extern "C" {
#include <NVCtrlLib.h>
}
#endif
#ifndef HAVE_NVCONTROL
NVidiaThermalSrc::NVidiaThermalSrc(QWidget* inParent, const QString& inID, const QString& inName):
NVidiaThermalSrc::NVidiaThermalSrc(TQWidget* inParent, const TQString& inID, const TQString& inName):
LabelSource(inParent), mProcess(0) {
#else
NVidiaThermalSrc::NVidiaThermalSrc(QWidget* inParent, const QString& inID, const QString& inName, unsigned int attrib):
NVidiaThermalSrc::NVidiaThermalSrc(TQWidget* inParent, const TQString& inID, const TQString& inName, unsigned int attrib):
LabelSource(inParent), mAttrib(attrib) {
#endif
mID = inID;
mName = inName;
mDescription = i18n("This source is provided by the nVidia GPU card driver tools");
mRefreshTimer = new QTimer(this, "default refresh handler" );
mRefreshTimer = new TQTimer(this, "default refresh handler" );
// connect the timer
connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(fetchValue()));
connect(this, SIGNAL(enabledChanged(bool, Source*)), this, SLOT(enable(bool)));
connect(mRefreshTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(fetchValue()));
connect(this, TQT_SIGNAL(enabledChanged(bool, Source*)), this, TQT_SLOT(enable(bool)));
}
NVidiaThermalSrc::~NVidiaThermalSrc(){
@ -60,7 +60,7 @@ NVidiaThermalSrc::~NVidiaThermalSrc(){
#endif
}
std::list<Source*>NVidiaThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>NVidiaThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
#ifndef HAVE_NVCONTROL
// see if the path contains nvidia-settings. if yes,
@ -77,18 +77,18 @@ std::list<Source*>NVidiaThermalSrc::createInstances(QWidget* inParent){
return list;
// now see what it printed...
QString ln;
QString pout;
TQString ln;
TQString pout;
while(proc.readln(ln) != -1)
pout+= ln + '\n';
if(pout.contains("Attribute 'GPUCoreTemp'"))
if(pout.tqcontains("Attribute 'GPUCoreTemp'"))
list.push_back(new NVidiaThermalSrc(inParent, "GPUCoreTemp", "NVidiaCore"));
if(pout.contains("Attribute 'GPUAmbientTemp'"))
if(pout.tqcontains("Attribute 'GPUAmbientTemp'"))
list.push_back(new NVidiaThermalSrc(inParent, "GPUAmbientTemp", "NVidiaAmbient"));
#else
int evt_base = 0, err_base = 0, temp;
Display * dpy = QPaintDevice::x11AppDisplay();
Display * dpy = TQPaintDevice::x11AppDisplay();
// do we have the XNVCtrl extension loaded?
if(!XNVCTRLQueryExtension(dpy, &evt_base, &err_base))
@ -122,14 +122,14 @@ void NVidiaThermalSrc::enable(bool inEnable){
void NVidiaThermalSrc::evaluateStdout(){
#ifndef HAVE_NVCONTROL
QString val = i18n("n/a");
TQString val = i18n("n/a");
// now see what it printed...
QString ln;
QString pout;
TQString ln;
TQString pout;
while(mProcess->readln(ln) != -1)
pout+= ln + '\n';
QRegExp regexp("Attribute\\s'" + mID + "'.*(\\d+)\\.");
TQRegExp regexp("Attribute\\s'" + mID + "'.*(\\d+)\\.");
if(regexp.search(pout) != -1)
val = formatTemperature(regexp.cap(1));
mValue = val;
@ -144,13 +144,13 @@ void NVidiaThermalSrc::evaluateStdout(){
#ifndef HAVE_NVCONTROL
void NVidiaThermalSrc::createProcess() {
mProcess = new KProcIO;
connect(mProcess, SIGNAL(processExited(KProcess*)), this, SLOT(evaluateStdout()));
connect(mProcess, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(evaluateStdout()));
*mProcess << "nvidia-settings" << "-n"
<< "-q" << mID;
}
#endif
QString NVidiaThermalSrc::fetchValue(){
TQString NVidiaThermalSrc::fetchValue(){
#ifndef HAVE_NVCONTROL
if(!mProcess) {
createProcess();
@ -163,9 +163,9 @@ QString NVidiaThermalSrc::fetchValue(){
return getValue();
#else
int temp;
Display * dpy = QPaintDevice::x11AppDisplay();
Display * dpy = TQPaintDevice::x11AppDisplay();
if(XNVCTRLQueryAttribute (dpy, 0, 0, mAttrib, &temp))
mValue = formatTemperature(QString::number(temp));
mValue = formatTemperature(TQString::number(temp));
else
mValue = "n/a";
emit valueUpdated(mValue); // calls updateLabel(mValue) of LabelSource

@ -24,7 +24,7 @@
#include <config.h>
#include "labelsource.h"
#include <list>
#include <qtimer.h>
#include <tqtimer.h>
class KProcIO;
/**
@ -32,27 +32,27 @@ class KProcIO;
* @author Ken Werner
*/
class NVidiaThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
#ifndef HAVE_NVCONTROL
NVidiaThermalSrc(QWidget* inParent, const QString& inID, const QString& inName);
NVidiaThermalSrc(TQWidget* inParent, const TQString& inID, const TQString& inName);
#else
NVidiaThermalSrc(QWidget* inParent, const QString& inID, const QString& inName, unsigned int attrib);
NVidiaThermalSrc(TQWidget* inParent, const TQString& inID, const TQString& inName, unsigned int attrib);
#endif
virtual ~NVidiaThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* runs the nvidia-settings command
*/
virtual QString fetchValue();
virtual TQString fetchValue();
protected slots:
/**
@ -75,7 +75,7 @@ private:
/**
* The refresh timer
*/
QTimer* mRefreshTimer;
TQTimer* mRefreshTimer;
private slots:
/**

@ -19,11 +19,11 @@
***************************************************************************/
#include "omnibookthermalsrc.h"
#include <qtextstream.h>
#include <qfile.h>
#include <tqtextstream.h>
#include <tqfile.h>
#include <klocale.h>
OmnibookThermalSrc::OmnibookThermalSrc(QWidget* inParent, const QFile& inSourceFile):
OmnibookThermalSrc::OmnibookThermalSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
@ -35,22 +35,22 @@ OmnibookThermalSrc::OmnibookThermalSrc(QWidget* inParent, const QFile& inSourceF
OmnibookThermalSrc::~OmnibookThermalSrc(){
}
std::list<Source*>OmnibookThermalSrc::createInstances(QWidget* inParent){
std::list<Source*>OmnibookThermalSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile omiFile( "/proc/omnibook/temperature" );
TQFile omiFile( "/proc/omnibook/temperature" );
if(omiFile.open(IO_ReadOnly)){
list.push_back(new OmnibookThermalSrc(inParent, omiFile));
}
return list;
}
QString OmnibookThermalSrc::fetchValue(){
QString s = "n/a";
TQString OmnibookThermalSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream( &mSourceFile );
TQTextStream textStream( &mSourceFile );
s = textStream.readLine();
mSourceFile.close();
s = s.section(':',-1,-1, QString::SectionSkipEmpty).stripWhiteSpace();
s = s.section(':',-1,-1, TQString::SectionSkipEmpty).stripWhiteSpace();
s = formatTemperature(s.left(s.length()-1));
}
return s;

@ -22,7 +22,7 @@
#define OMNIBOOKTHERMALSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -30,30 +30,30 @@
* which is provided by the omnibook kernel module.
*/
class OmnibookThermalSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
OmnibookThermalSrc(QWidget* inParent, const QFile& inSourceFile);
OmnibookThermalSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~OmnibookThermalSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -20,16 +20,16 @@
#include "source.h"
#include <math.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <tqlayout.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <klocale.h>
#include <kglobal.h>
//#include "kdebug.h"
Source::Source(QWidget* inParent):
Source::Source(TQWidget* inParent):
mID(""),
mPosition(0),
mName(""),
@ -46,7 +46,7 @@ Source::Source(QWidget* inParent):
Source::~Source(){
}
const QString& Source::getID() const{
const TQString& Source::getID() const{
return mID;
}
@ -60,11 +60,11 @@ void Source::setPosition(int inPosition, KConfig* inKConfig){
inKConfig->writeEntry(mID + "_position", mPosition);
}
const QString& Source::getName() const{
const TQString& Source::getName() const{
return mName;
}
const QString& Source::getDescription() const{
const TQString& Source::getDescription() const{
return mDescription;
}
@ -96,18 +96,18 @@ void Source::setMaybeEnabled(bool inMaybeEnabled){
}
}
QWidget* Source::createPrefs(QWidget* inParent){
TQWidget* Source::createPrefs(TQWidget* inParent){
if(!mSourcePrefs){
mSourcePrefs = new SourcePrefs(inParent, "sourceprefsui");
// disable nameCheckBox if taskbarCheckBox is disabled
connect(mSourcePrefs->taskbarCheckBox, SIGNAL(toggled(bool)), mSourcePrefs->nameCheckBox, SLOT(setEnabled(bool)));
connect(mSourcePrefs->taskbarCheckBox, TQT_SIGNAL(toggled(bool)), mSourcePrefs->nameCheckBox, TQT_SLOT(setEnabled(bool)));
// add prefs widgets from sub classes
createSubPrefs(mSourcePrefs);
// add bottom vspacer
mSourcePrefs->layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding) );
mSourcePrefs->tqlayout()->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding) );
updatePrefsGUI(); // fill the prefs gui
}
@ -138,9 +138,9 @@ void Source::setPrefsWidgetsEnabled(bool isEnabled, bool isShownOnApplet){
mSourcePrefs->tooltipCheckBox->setEnabled(isEnabled);
}
void Source::addPrefs(QWidget* inParent){
void Source::addPrefs(TQWidget* inParent){
if(inParent != NULL)
mSourcePrefs->layout()->add(inParent);
mSourcePrefs->tqlayout()->add(inParent);
}
void Source::applyPrefs(){
@ -194,27 +194,27 @@ void Source::loadPrefs(KConfig* inKConfig){
}
// utility methods
QString Source::formatTemperature(const QString& temp) const {
TQString Source::formatTemperature(const TQString& temp) const {
if(mIsMetric) {
return temp + QString::fromUtf8(" °C");
return temp + TQString::fromUtf8(" °C");
} else {
return QString::number(celsiusToFahrenheit(temp.toInt())).append(QString::fromUtf8(" °F"));
return TQString::number(celsiusToFahrenheit(temp.toInt())).append(TQString::fromUtf8(" °F"));
}
}
QString Source::KHzinHumanReadable( uint value ) const{
TQString Source::KHzinHumanReadable( uint value ) const{
if( value >= 1000000 )
return QString::number( round(value/1000000.0, 1) ) + " GHz";
return TQString::number( round(value/1000000.0, 1) ) + " GHz";
else if( value >= 1000 )
return QString::number( round(value/1000.0, -1) ) + " MHz";
return TQString::number( round(value/1000.0, -1) ) + " MHz";
else
return QString::number( value ) + " KHz";
return TQString::number( value ) + " KHz";
}
double Source::round(double inValue, int inDigits) const{
return floor(inValue * pow( 10, inDigits) + 0.5) * pow(10, -inDigits);
}
int Source::celsiusToFahrenheit(int inCelsius) const{
return qRound(1.8 * inCelsius + 32);
return tqRound(1.8 * inCelsius + 32);
}
void Source::realizeWidget(){

@ -20,51 +20,52 @@
#ifndef SOURCE_H
#define SOURCE_H
#include <qstring.h>
#include <tqstring.h>
#include "sourceprefs.h"
#include <kconfig.h>
// Forward Declarationss
class QVBoxLayout;
class TQVBoxLayout;
/**
* This abstract Source is the super class of all sources and provides just the basics.
* @author Ken Werner
*/
class Source : public QObject {
Q_OBJECT //macro which activates signals and slots (moc)
class Source : public TQObject {
Q_OBJECT
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source
*/
Source(QWidget* inParent);
Source(TQWidget* inParent);
virtual ~Source();
/**
* Returns the internal Name of this source
*/
const QString& getID() const;
const TQString& getID() const;
/**
* Returns the position of this source in the layout
* Returns the position of this source in the tqlayout
*/
int getPosition() const;
/**
* Sets the position of this source in the layout
* Sets the position of this source in the tqlayout
*/
void setPosition(int inPosition, KConfig* inKConfig);
/**
* Returns the Name of this source
*/
const QString& getName() const;
const TQString& getName() const;
/**
* Returns the Description of this source
*/
const QString& getDescription() const;
const TQString& getDescription() const;
/**
* Returns true if this source is currently enabled otherwise false
@ -89,17 +90,17 @@ public:
/**
* Returns the widget of this source that is displayed in the kicker
*/
virtual QWidget* getWidget() = 0;
virtual TQWidget* getWidget() = 0;
/**
* Returns the formatted value of this source
*/
virtual QString getValue() const = 0;
virtual TQString getValue() const = 0;
/**
* Creates the preference panel of this source and calls createSubPrefs
*/
virtual QWidget* createPrefs(QWidget* inParent);
virtual TQWidget* createPrefs(TQWidget* inParent);
/**
* returnes the preference panel of this source
@ -144,9 +145,9 @@ signals:
/**
* This signal is emitted whenever the enabled flag (mEnabled) of this source has changed
*/
void enabledChanged(bool inEnabled, Source* inSource); // needed by kima.cpp to add sources to its layout
void enabledChanged(bool inEnabled, Source* inSource); // needed by kima.cpp to add sources to its tqlayout
/**
* This signal is emitted whenever this Source should be added or removed from the display (layout) of the kicker applet
* This signal is emitted whenever this Source should be added or removed from the display (tqlayout) of the kicker applet
*/
void displaySource(bool inDisplay, Source* inSource);
@ -154,12 +155,12 @@ protected:
/**
* This method can be overridden in sub classes to add specific the preference panels
*/
virtual void addPrefs(QWidget* inParent);
virtual void addPrefs(TQWidget* inParent);
/**
* Allows subclasses adding their own preferences using the addPrefs method
*/
virtual void createSubPrefs(QWidget* inParent) = 0;
virtual void createSubPrefs(TQWidget* inParent) = 0;
/**
* This method enables or disables various widgets of the preferences dialog depending on isEnabled and isShownOnApplet
@ -176,19 +177,19 @@ protected:
* The ID of the source
* must be unique among the sources
*/
QString mID;
TQString mID;
/**
* The Position of the source in the layout
* The Position of the source in the tqlayout
*/
int mPosition;
/**
* The name of that source showed in the kicker
*/
QString mName;
TQString mName;
/**
* The description of that source
*/
QString mDescription;
TQString mDescription;
/**
* Indicates whether that source is enabled (showed on the kicker) or not
*/
@ -221,11 +222,11 @@ protected:
* formats the given temperature into a string which has
* a degree sign / fahrenheit sign depending on the locale used.
*/
QString formatTemperature(const QString& temp) const;
TQString formatTemperature(const TQString& temp) const;
/**
* Translates a given frequency in KHz to a human readable string
*/
QString KHzinHumanReadable(uint value) const;
TQString KHzinHumanReadable(uint value) const;
/**
* Translates degree Celsius to degree Fahrenheit
*/

@ -11,55 +11,55 @@
#include "sourceprefs.h"
#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <tqvariant.h>
#include <tqpushbutton.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
/*
* Constructs a SourcePrefs as a child of 'parent', with the
* Constructs a SourcePrefs as a child of 'tqparent', with the
* name 'name' and widget flags set to 'f'.
*/
SourcePrefs::SourcePrefs( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
SourcePrefs::SourcePrefs( TQWidget* tqparent, const char* name, WFlags fl )
: TQWidget( tqparent, name, fl )
{
if ( !name )
setName( "SourcePrefs" );
SourcePrefsLayout = new QVBoxLayout( this, 0, 6, "SourcePrefsLayout");
SourcePrefsLayout = new TQVBoxLayout( this, 0, 6, "SourcePrefsLayout");
descriptionLabel = new QLabel( this, "descriptionLabel" );
descriptionLabel = new TQLabel( this, "descriptionLabel" );
SourcePrefsLayout->addWidget( descriptionLabel );
hBoxLayout = new QHBoxLayout( 0, 0, 6, "hBoxLayout");
hBoxLayout = new TQHBoxLayout( 0, 0, 6, "hBoxLayout");
nameLabel = new QLabel( this, "nameLabel" );
nameLabel = new TQLabel( this, "nameLabel" );
hBoxLayout->addWidget( nameLabel );
nameLineEdit = new QLineEdit( this, "nameLineEdit" );
nameLineEdit = new TQLineEdit( this, "nameLineEdit" );
hBoxLayout->addWidget( nameLineEdit );
spacer8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
spacer8 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
hBoxLayout->addItem( spacer8 );
SourcePrefsLayout->addLayout( hBoxLayout );
taskbarCheckBox = new QCheckBox( this, "taskbarCheckBox" );
taskbarCheckBox = new TQCheckBox( this, "taskbarCheckBox" );
SourcePrefsLayout->addWidget( taskbarCheckBox );
hBoxLayout2 = new QHBoxLayout( 0, 0, 6, "hBoxLayout2");
spacer8_2 = new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
hBoxLayout2 = new TQHBoxLayout( 0, 0, 6, "hBoxLayout2");
spacer8_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Fixed, TQSizePolicy::Minimum );
hBoxLayout2->addItem( spacer8_2 );
nameCheckBox = new QCheckBox( this, "nameCheckBox" );
nameCheckBox = new TQCheckBox( this, "nameCheckBox" );
hBoxLayout2->addWidget( nameCheckBox );
SourcePrefsLayout->addLayout( hBoxLayout2 );
tooltipCheckBox = new QCheckBox( this, "tooltipCheckBox" );
tooltipCheckBox = new TQCheckBox( this, "tooltipCheckBox" );
SourcePrefsLayout->addWidget( tooltipCheckBox );
languageChange();
resize( QSize(203, 127).expandedTo(minimumSizeHint()) );
resize( TQSize(203, 127).expandedTo(tqminimumSizeHint()) );
clearWState( WState_Polished );
}
@ -68,7 +68,7 @@ SourcePrefs::SourcePrefs( QWidget* parent, const char* name, WFlags fl )
*/
SourcePrefs::~SourcePrefs()
{
// no need to delete child widgets, Qt does it all for us
// no need to delete child widgets, TQt does it all for us
}
/*

@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>SourcePrefs</class>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>SourcePrefs</cstring>
</property>
@ -22,7 +22,7 @@
<property name="margin">
<number>0</number>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>descriptionLabel</cstring>
</property>
@ -30,7 +30,7 @@
<string>description</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>hBoxLayout</cstring>
</property>
@ -38,7 +38,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>nameLabel</cstring>
</property>
@ -46,7 +46,7 @@
<string>Name:</string>
</property>
</widget>
<widget class="QLineEdit">
<widget class="TQLineEdit">
<property name="name">
<cstring>nameLineEdit</cstring>
</property>
@ -61,7 +61,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
@ -70,7 +70,7 @@
</spacer>
</hbox>
</widget>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>taskbarCheckBox</cstring>
</property>
@ -78,7 +78,7 @@
<string>Show this source in Taskbar</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>hBoxLayout2</cstring>
</property>
@ -96,14 +96,14 @@
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>nameCheckBox</cstring>
</property>
@ -113,7 +113,7 @@
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>tooltipCheckBox</cstring>
</property>
@ -123,5 +123,5 @@
</widget>
</vbox>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<tqlayoutdefaults spacing="6" margin="11"/>
</UI>

@ -19,16 +19,16 @@
***************************************************************************/
#include "sysfreqsrc.h"
#include <qtextstream.h>
#include <qfile.h>
#include <qdir.h>
#include <tqtextstream.h>
#include <tqfile.h>
#include <tqdir.h>
#include <klocale.h>
SysFreqSrc::SysFreqSrc(QWidget* inParent, const QFile& inSourceFile):
SysFreqSrc::SysFreqSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this){
mID = "cpufreq" + mSourceFile.name().section( '/', -3, -3, QString::SectionSkipEmpty ).remove("cpu");
mID = "cpufreq" + mSourceFile.name().section( '/', -3, -3, TQString::SectionSkipEmpty ).remove("cpu");
mName = mID;
mDescription = i18n("This source is provided by the Linux kernel cpufreq subsystem.");
}
@ -36,16 +36,16 @@ SysFreqSrc::SysFreqSrc(QWidget* inParent, const QFile& inSourceFile):
SysFreqSrc::~SysFreqSrc(){
}
std::list<Source*>SysFreqSrc::createInstances(QWidget* inParent){
std::list<Source*>SysFreqSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QDir cpuDir( "/sys/devices/system/cpu" );
TQDir cpuDir( "/sys/devices/system/cpu" );
if ( cpuDir.exists() ){
cpuDir.setFilter( QDir::Dirs | QDir::NoSymLinks );
cpuDir.setSorting( QDir::Name);
cpuDir.setFilter( TQDir::Dirs | TQDir::NoSymLinks );
cpuDir.setSorting( TQDir::Name);
for ( unsigned int i = 0; i < cpuDir.count(); i++ ){
if(cpuDir[i].startsWith("cpu")){
QFile sysFreqFile(cpuDir.canonicalPath() + "/" + cpuDir[i] + "/cpufreq/scaling_cur_freq");
TQFile sysFreqFile(cpuDir.canonicalPath() + "/" + cpuDir[i] + "/cpufreq/scaling_cur_freq");
if(sysFreqFile.open(IO_ReadOnly))
list.push_back(new SysFreqSrc(inParent, sysFreqFile));
}
@ -54,10 +54,10 @@ std::list<Source*>SysFreqSrc::createInstances(QWidget* inParent){
return list;
}
QString SysFreqSrc::fetchValue(){
QString s = "n/a";
TQString SysFreqSrc::fetchValue(){
TQString s = "n/a";
if(mSourceFile.open(IO_ReadOnly)){
QTextStream textStream(&mSourceFile);
TQTextStream textStream(&mSourceFile);
s = KHzinHumanReadable(textStream.readLine().toUInt());
mSourceFile.close();
}

@ -22,37 +22,37 @@
#define SYSFREQSRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
* SysFreqSrc reads frequency values from /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
*/
class SysFreqSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File
*/
SysFreqSrc(QWidget* inParent, const QFile& inSourceFile);
SysFreqSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~SysFreqSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* triggers the fetchValue method

@ -19,7 +19,7 @@
***************************************************************************/
#include "threadedtrigger.h"
#include <qapplication.h>
#include <tqapplication.h>
//#include "kdebug.h"
@ -28,7 +28,7 @@ ThreadedTrigger::ThreadedTrigger(TriggeredSource* inSource, unsigned long inRefr
mRefreshSleep(inRefreshSleep),
mRunning(false)
{
connect(mSource, SIGNAL(enabledChanged(bool, Source*)), this, SLOT(enable(bool)));
connect(mSource, TQT_SIGNAL(enabledChanged(bool, Source*)), this, TQT_SLOT(enable(bool)));
}
ThreadedTrigger::~ThreadedTrigger(){
@ -40,7 +40,7 @@ void ThreadedTrigger::enable(bool inEnable){
//kdDebug() << "start thread " << mSource->getName() << endl;
// start the thread
mRunning = true;
this->start(QThread::LowPriority);
this->start(TQThread::LowPriority);
}else if(!inEnable && mRunning){ // stops the thread
//kdDebug() << "stop thread " << mSource->getName() << endl;
mRunning = false;
@ -54,14 +54,14 @@ void ThreadedTrigger::enable(bool inEnable){
void ThreadedTrigger::run(){
mWaitMutex.lock();
while( mRunning ) {
QString text = mSource->fetchValue();
UpdateEvent* ue = new UpdateEvent(text); // Qt will delete the ue when done
QApplication::postEvent(mSource, ue); // send the event to the TriggeredSource
TQString text = mSource->fetchValue();
UpdateEvent* ue = new UpdateEvent(text); // TQt will delete the ue when done
TQApplication::postEvent(mSource, ue); // send the event to the TriggeredSource
if(mWaitCond.wait(&mWaitMutex, mRefreshSleep))
break; // we were woken up
}
// if we are here, the mutex must be locked:
// 1. QWaitCondition::wait locks it when it returns
// 1. TQWaitCondition::wait locks it when it returns
// 2. mWaitMutex is locked when we enter the loop
mWaitMutex.unlock(); // unlock it again
}

@ -24,18 +24,18 @@
#include "source.h"
#include "updateevent.h"
#include "triggeredsource.h"
#include <qwaitcondition.h>
#include <qmutex.h>
#include <qthread.h>
#include <qevent.h>
#include <qobject.h>
#include <tqwaitcondition.h>
#include <tqmutex.h>
#include <tqthread.h>
#include <tqevent.h>
#include <tqobject.h>
/**
* ThreadedTrigger calls the fetchValue method of a source asynchronous using a thread
* @author Ken Werner
*/
class ThreadedTrigger : public QObject, QThread{
Q_OBJECT //macro which activates signals and slots (moc)
class ThreadedTrigger : public TQObject, TQThread{
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new ThreadedTrigger
@ -78,12 +78,12 @@ private:
* this is the condition, on which this thread sleeps
* mRefreshSleep milliseconds.
*/
QWaitCondition mWaitCond;
TQWaitCondition mWaitCond;
/*
* this mutex ensures that the thread always sleeps on the
* condition, if we signal it.
*/
QMutex mWaitMutex;
TQMutex mWaitMutex;
};
#endif //THREADEDTRIGGER_H

@ -20,18 +20,18 @@
#include "triggeredsource.h"
#include "updateevent.h"
#include <qapplication.h>
#include <tqapplication.h>
//#include "kdebug.h"
TriggeredSource::TriggeredSource(QWidget* inParent):
TriggeredSource::TriggeredSource(TQWidget* inParent):
Source(inParent){
}
TriggeredSource::~TriggeredSource(){
}
void TriggeredSource::customEvent(QCustomEvent* event){
void TriggeredSource::customEvent(TQCustomEvent* event){
if(event->type() == UpdateEvent::TYPE ){
UpdateEvent* ue = static_cast<UpdateEvent*>(event);
// update mValue
@ -43,6 +43,6 @@ void TriggeredSource::customEvent(QCustomEvent* event){
}
}
QString TriggeredSource::getValue() const{
TQString TriggeredSource::getValue() const{
return mValue;
}

@ -22,7 +22,7 @@
#define TRIGGEREDSOURCE_H
#include "source.h"
#include <qevent.h>
#include <tqevent.h>
/**
* TriggeredSource provides fetchValue and
@ -30,12 +30,13 @@
* @author Ken Werner
*/
class TriggeredSource : public Source{
Q_OBJECT //macro which activates signals and slots (moc)
Q_OBJECT
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new TriggeredSource
*/
TriggeredSource(QWidget* inParent);
TriggeredSource(TQWidget* inParent);
virtual ~TriggeredSource();
@ -44,29 +45,29 @@ public slots:
/**
* Returns the formatted value of this source
*/
virtual QString getValue() const;
virtual TQString getValue() const;
/**
* Fetches and returns the value of this source
* This method might be called from a thread so don't call it directly
*/
virtual QString fetchValue() = 0;
virtual TQString fetchValue() = 0;
signals:
/**
* This signal is emitted whenever the value of this source (mValue) is updated
*/
void valueUpdated(const QString& inValue);
void valueUpdated(const TQString& inValue);
protected:
/**
* consumes the UpdateEvent
*/
virtual void customEvent(QCustomEvent* event);
virtual void customEvent(TQCustomEvent* event);
/**
* the buffered value of this source
*/
QString mValue;
TQString mValue;
};
#endif //TRIGGEREDSOURCE_H

@ -20,10 +20,10 @@
#include "updateevent.h"
UpdateEvent::UpdateEvent(const QString& inMessage):
QCustomEvent(UpdateEvent::TYPE),
UpdateEvent::UpdateEvent(const TQString& inMessage):
TQCustomEvent(UpdateEvent::TYPE),
mMessage(inMessage){
}
const QString& UpdateEvent::getMessage() const{
const TQString& UpdateEvent::getMessage() const{
return mMessage;
}

@ -21,18 +21,18 @@
#ifndef UPDATEEVENT_H
#define UPDATEEVENT_H
#include <qevent.h>
#include <tqevent.h>
/**
* UpdateEvent is a custom event to update the QObject of the ThreadedTrigger periodically
* UpdateEvent is a custom event to update the TQObject of the ThreadedTrigger periodically
*/
class UpdateEvent: public QCustomEvent{
class UpdateEvent: public TQCustomEvent{
public:
UpdateEvent(const QString& inMessage);
static const int TYPE = QEvent::User + 1;
const QString& getMessage() const;
UpdateEvent(const TQString& inMessage);
static const int TYPE = TQEvent::User + 1;
const TQString& getMessage() const;
private:
QString mMessage;
TQString mMessage;
};
#endif //UPDATEEVENT_H

@ -19,10 +19,10 @@
***************************************************************************/
#include "uptimesrc.h"
#include <qtextstream.h>
#include <tqtextstream.h>
#include <klocale.h>
UptimeSrc::UptimeSrc(QWidget* inParent, const QFile& inSourceFile):
UptimeSrc::UptimeSrc(TQWidget* inParent, const TQFile& inSourceFile):
LabelSource(inParent),
mSourceFile(inSourceFile.name()),
mTrigger(this, 30000){ // 30 seconds
@ -35,29 +35,29 @@ UptimeSrc::UptimeSrc(QWidget* inParent, const QFile& inSourceFile):
UptimeSrc::~UptimeSrc(){
}
std::list<Source*>UptimeSrc::createInstances(QWidget* inParent){
std::list<Source*>UptimeSrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
QFile uptimeFile("/proc/uptime" );
TQFile uptimeFile("/proc/uptime" );
if(uptimeFile.open(IO_ReadOnly))
list.push_back(new UptimeSrc(inParent, uptimeFile));
return list;
}
QString UptimeSrc::fetchValue(){
QString s = "n/a";
TQString UptimeSrc::fetchValue(){
TQString s = "n/a";
int secs;
if(mSourceFile.open(IO_ReadOnly)) {
QTextStream stream( &mSourceFile );
TQTextStream stream( &mSourceFile );
stream >> secs;
//QString seconds = QString::number(secs % 60).rightJustify(2, '0');
QString minutes = QString::number(secs / 60 % 60).rightJustify(2, '0');
QString hours = QString::number(secs / 3600 % 24).rightJustify(2, '0');
QString days = QString::number(secs / 86400);
//TQString seconds = TQString::number(secs % 60).rightJustify(2, '0');
TQString minutes = TQString::number(secs / 60 % 60).rightJustify(2, '0');
TQString hours = TQString::number(secs / 3600 % 24).rightJustify(2, '0');
TQString days = TQString::number(secs / 86400);
if(days != "0")
s = mTimeFormatLong.arg(days).arg(hours).arg(minutes);
s = mTimeFormatLong.tqarg(days).tqarg(hours).tqarg(minutes);
else
s = mTimeFormatShort.arg(hours).arg(minutes);
s = mTimeFormatShort.tqarg(hours).tqarg(minutes);
mSourceFile.close();
}
return s;

@ -22,7 +22,7 @@
#define UPTIMESRC_H
#include "labelsource.h"
#include "threadedtrigger.h"
#include <qfile.h>
#include <tqfile.h>
#include <list>
/**
@ -30,24 +30,24 @@
* which is provided by the ibm-acpi kernel module.
*/
class UptimeSrc : public LabelSource {
Q_OBJECT //macro which activates signals and slots (moc)
TQ_OBJECT //macro which activates signals and slots (tqmoc)
public:
/**
* Creates a new Source from the given File and index
*/
UptimeSrc(QWidget* inParent, const QFile& inSourceFile);
UptimeSrc(TQWidget* inParent, const TQFile& inSourceFile);
virtual ~UptimeSrc();
/**
* Creates instances of that Source (and returns pointers to them)
*/
static std::list<Source*> createInstances(QWidget* inParent);
static std::list<Source*> createInstances(TQWidget* inParent);
/**
* Fetches and returns the value of this source
* This method is called from a thread so don't call it directly
*/
virtual QString fetchValue();
virtual TQString fetchValue();
/**
@ -58,13 +58,13 @@ private:
/**
* The file from which the value is read
*/
QFile mSourceFile;
TQFile mSourceFile;
/**
* the format of the time display. short and long version
*/
QString mTimeFormatShort;
QString mTimeFormatLong;
TQString mTimeFormatShort;
TQString mTimeFormatLong;
/**
* triggers the fetchValue method

Loading…
Cancel
Save