summaryrefslogtreecommitdiffstats
path: root/bab/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bab/main.cpp')
-rw-r--r--bab/main.cpp188
1 files changed, 94 insertions, 94 deletions
diff --git a/bab/main.cpp b/bab/main.cpp
index df09293..b530769 100644
--- a/bab/main.cpp
+++ b/bab/main.cpp
@@ -19,17 +19,17 @@
***************************************************************************/
#include "bab.h"
-#include <qpushbutton.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qdir.h>
-#include <qlayout.h>
-#include <qsettings.h>
-#include <qtabwidget.h>
-#include <qtooltip.h>
-#include <qtimer.h>
-#include <qvbox.h>
-#include <qpainter.h>
+#include <tqpushbutton.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqdir.h>
+#include <tqlayout.h>
+#include <tqsettings.h>
+#include <tqtabwidget.h>
+#include <tqtooltip.h>
+#include <tqtimer.h>
+#include <tqvbox.h>
+#include <tqpainter.h>
#include <dcopclient.h>
#include <kapplication.h>
// #include <kconfig.h>
@@ -94,20 +94,20 @@ int main(int argc, char **argv)
}
-bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
+bab::bab() : KMainWindow(0,"bab",TQt::WStyle_StaysOnTop | TQt::WX11BypassWM ){
bSwitcher = new BabSwitcher(this,"switcher");
- QToolTip::add(bSwitcher, i18n("leftclick toggles state<br>rightclick toggles setupmenu"));
+ TQToolTip::add(bSwitcher, i18n("leftclick toggles state<br>rightclick toggles setupmenu"));
bSwitcher->show();
- QDir d( QDir::homeDirPath() + "/.baghira");
+ TQDir d( TQDir::homeDirPath() + "/.baghira");
if (!d.exists())
- d.mkdir(QDir::homeDirPath() + "/.baghira");
- d = QDir( QDir::homeDirPath() + "/.baghira/.bab");
+ d.mkdir(TQDir::homeDirPath() + "/.baghira");
+ d = TQDir( TQDir::homeDirPath() + "/.baghira/.bab");
if (!d.exists())
- d.mkdir(QDir::homeDirPath() + "/.baghira/.bab");
+ d.mkdir(TQDir::homeDirPath() + "/.baghira/.bab");
FILE *file = NULL;
- QString tmpString = QDir::homeDirPath() + "/.baghira/Jaguar";
- if (!QFile::exists(tmpString))
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/Jaguar";
+ if (!TQFile::exists(tmpString))
{
if( (file = fopen(tmpString.latin1(), "w")) != NULL )
{
@@ -115,8 +115,8 @@ bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
fclose(file);
}
}
- tmpString = QDir::homeDirPath() + "/.baghira/Panther";
- if (!QFile::exists(tmpString))
+ tmpString = TQDir::homeDirPath() + "/.baghira/Panther";
+ if (!TQFile::exists(tmpString))
{
if( (file = fopen(tmpString.latin1(), "w")) != NULL )
{
@@ -124,8 +124,8 @@ bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
fclose(file);
}
}
- tmpString = QDir::homeDirPath() + "/.baghira/Brushed";
- if (!QFile::exists(tmpString))
+ tmpString = TQDir::homeDirPath() + "/.baghira/Brushed";
+ if (!TQFile::exists(tmpString))
{
if( (file = fopen(tmpString.latin1(), "w")) != NULL )
{
@@ -133,8 +133,8 @@ bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
fclose(file);
}
}
- tmpString = QDir::homeDirPath() + "/.baghira/Tiger";
- if (!QFile::exists(tmpString))
+ tmpString = TQDir::homeDirPath() + "/.baghira/Tiger";
+ if (!TQFile::exists(tmpString))
{
if( (file = fopen(tmpString.latin1(), "w")) != NULL )
{
@@ -142,8 +142,8 @@ bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
fclose(file);
}
}
- tmpString = QDir::homeDirPath() + "/.baghira/Milk";
- if (!QFile::exists(tmpString))
+ tmpString = TQDir::homeDirPath() + "/.baghira/Milk";
+ if (!TQFile::exists(tmpString))
{
if( (file = fopen(tmpString.latin1(), "w")) != NULL )
{
@@ -152,27 +152,27 @@ bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){
}
}
- QVBox *vb = new QVBox(this);
+ TQVBox *vb = new TQVBox(this);
vb->setLineWidth(2);
vb->setMargin(2);
-// vb->setFrameStyle(QFrame::Panel | QFrame::Plain );
+// vb->setFrameStyle(TQFrame::Panel | TQFrame::Plain );
- QLabel *DefStyleLabel = new QLabel("Default Style is", vb);
- DefStyle = new QComboBox(vb);
+ TQLabel *DefStyleLabel = new TQLabel("Default Style is", vb);
+ DefStyle = new TQComboBox(vb);
DefStyle->insertItem ( "Jaguar" );
DefStyle->insertItem ( "Panther" );
DefStyle->insertItem ( "Brushed" );
DefStyle->insertItem ( "Tiger" );
DefStyle->insertItem ( "Milk" );
- cornerCheck = new QCheckBox("Round upper screen corners", vb);
- QSettings config;
+ cornerCheck = new TQCheckBox("Round upper screen corners", vb);
+ TQSettings config;
config.beginGroup("/baghira/BAB");
DefStyle->setCurrentItem(config.readNumEntry("defaultState", BabSwitcher::Panther ));
cornerCheck->setChecked( config.readBoolEntry("roundCorners", true ) );
config.endGroup();
- QPushButton *configBaghira = new QPushButton("Configure Baghira", vb);
- QPushButton *Quit = new QPushButton("Quit BAB", vb);
- QPushButton *Close = new QPushButton("Close Menu", vb);
+ TQPushButton *configBaghira = new TQPushButton("Configure Baghira", vb);
+ TQPushButton *Quit = new TQPushButton("Quit BAB", vb);
+ TQPushButton *Close = new TQPushButton("Close Menu", vb);
vb->adjustSize();
bSwitcher->setStyle(DefStyle->currentText());
bSwitcher->setDeco(DefStyle->currentText());
@@ -204,10 +204,10 @@ void bab::configureBaghira()
// any errors that arise
KLibLoader* loader = KLibLoader::self();
- KLibrary* library = loader->library( QFile::encodeName("kstyle_baghira_config") );
+ KLibrary* library = loader->library( TQFile::encodeName("kstyle_baghira_config") );
if (!library)
{
- qWarning("There was an error loading the configuration dialog for this style.");
+ tqWarning("There was an error loading the configuration dialog for this style.");
return;
}
@@ -215,7 +215,7 @@ void bab::configureBaghira()
if (!allocPtr)
{
- qWarning("There was an error loading the configuration dialog for this style.");
+ tqWarning("There was an error loading the configuration dialog for this style.");
return;
}
@@ -223,42 +223,42 @@ void bab::configureBaghira()
StyleConfigDialog* dial = new StyleConfigDialog(this, "Baghira Configuration");
dial->enableButtonSeparator(true);
- typedef QWidget*(* factoryRoutine)( QWidget* parent );
+ typedef TQWidget*(* factoryRoutine)( TQWidget* parent );
//Get the factory, and make the widget.
factoryRoutine factory = (factoryRoutine)(allocPtr);
- QWidget* styleConfig = factory( dial );
+ TQWidget* styleConfig = factory( dial );
- QTabWidget* tw = (QTabWidget*)styleConfig->child("tabWidget");
+ TQTabWidget* tw = (TQTabWidget*)styleConfig->child("tabWidget");
- QWidget* decoConfig = 0;
- QObject *decoObject = 0;
+ TQWidget* decoConfig = 0;
+ TQObject *decoObject = 0;
if (tw)
{
- KLibrary* library2 = loader->library( QFile::encodeName("kwin_baghira_config") );
+ KLibrary* library2 = loader->library( TQFile::encodeName("kwin_baghira_config") );
if (!library2)
{
- qWarning("There was an error loading the configuration dialog for the deco.");
+ tqWarning("There was an error loading the configuration dialog for the deco.");
return;
}
void* allocPtr2 = library2->symbol("allocate_config");
if (!allocPtr2)
{
- qWarning("There was an error loading the configuration dialog for this style.");
+ tqWarning("There was an error loading the configuration dialog for this style.");
return;
}
- typedef QObject*(* factoryRoutine2)( KConfig* conf, QWidget* parent );
+ typedef TQObject*(* factoryRoutine2)( KConfig* conf, TQWidget* parent );
factoryRoutine2 factory2 = (factoryRoutine2)(allocPtr2);
decoObject = factory2( 0, tw );
- decoConfig = (QWidget*)tw->child("ConfigDialog");
+ decoConfig = (TQWidget*)tw->child("ConfigDialog");
tw->addTab(decoConfig, "Decoration");
}
//Insert it in...
dial->setMainWidget( styleConfig );
- QWidget *desktop = QApplication::desktop();
- QPoint nPos((desktop->width() - dial->width())/2, (desktop->height() - dial->height() - 100)/2);
+ TQWidget *desktop = TQApplication::desktop();
+ TQPoint nPos((desktop->width() - dial->width())/2, (desktop->height() - dial->height() - 100)/2);
dial->move(nPos);
//..and connect it to the wrapper
connect(styleConfig, SIGNAL(changed(bool)), dial, SLOT(setStyleDirty(bool)));
@@ -268,7 +268,7 @@ void bab::configureBaghira()
connect(dial, SIGNAL(defaults()), decoObject, SLOT(defaults()));
connect(dial, SIGNAL(save(KConfig*)), decoObject, SLOT(save(KConfig*)));
- if (dial->exec() == QDialog::Accepted)
+ if (dial->exec() == TQDialog::Accepted)
{
//For now, ask all KDE apps to recreate their styles to apply the setitngs
if (dial->isStyleDirty())
@@ -277,21 +277,21 @@ void bab::configureBaghira()
KIPC::sendMessageAll(KIPC::ToolbarStyleChanged);
}
if (dial->isDecoDirty())
- kapp->dcopClient()->send("kwin", "KWinInterface", "reconfigure()", QByteArray());
+ kapp->dcopClient()->send("kwin", "KWinInterface", "reconfigure()", TQByteArray());
}
tw->removeChild( decoObject );
dial->insertChild( decoObject );
- decoConfig->reparent(dial, QPoint(0,0));
+ decoConfig->reparent(dial, TQPoint(0,0));
delete dial;
}
/* overwrite the show event for repositioning the window on top
of the icon, adapted from kkeyled */
-void bab::showEvent(QShowEvent *e){
+void bab::showEvent(TQShowEvent *e){
if ( bSwitcher->globalPos->x() >= 0) {
- QWidget *desktop = QApplication::desktop();
+ TQWidget *desktop = TQApplication::desktop();
int w = desktop->width();
- QPoint nPos;
+ TQPoint nPos;
if (bSwitcher->globalPos->y() - height() >= 0 )
{ // it's not on top
nPos.setY(bSwitcher->globalPos->y() -height());
@@ -315,13 +315,13 @@ void bab::showEvent(QShowEvent *e){
// If it was set by the normal sessionmanagement it needs
// to set the Flags again
- setWFlags(Qt::WStyle_StaysOnTop | Qt::WX11BypassWM);
- QWidget::showEvent(e); // execute the normal showevent
+ setWFlags(TQt::WStyle_StaysOnTop | TQt::WX11BypassWM);
+ TQWidget::showEvent(e); // execute the normal showevent
raise();
}
void bab::saveSettings(){
- QSettings *config = new QSettings();
+ TQSettings *config = new TQSettings();
// KConfig *config = new KConfig("baghirarc");
config->beginGroup("/baghira/BAB");
config->writeEntry("defaultState", DefStyle->currentItem());
@@ -330,7 +330,7 @@ void bab::saveSettings(){
delete config;
}
-QPoint *BabSwitcher::globalPos = new QPoint(0,0);
+TQPoint *BabSwitcher::globalPos = new TQPoint(0,0);
BabSwitcher::BabSwitcher(bab *parent, const char *name)
: KSystemTray(parent,name), DCOPObject("babInterface") {
@@ -353,7 +353,7 @@ void BabSwitcher::toggle()
else
state_ = Jaguar;
decoState_ = state_;
- QString nameString;
+ TQString nameString;
switch (state_)
{
case Jaguar:
@@ -371,17 +371,17 @@ void BabSwitcher::toggle()
case Milk:
nameString = "Milk";
}
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + nameString;
- QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.style";
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + nameString;
+ TQString tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/.style";
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
- tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.deco";
+ tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/.deco";
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
repaint();
}
-void BabSwitcher::setStyle(QString style)
+void BabSwitcher::setStyle(TQString style)
{
if (style == "Jaguar")
state_ = Jaguar;
@@ -397,14 +397,14 @@ void BabSwitcher::setStyle(QString style)
style = "Panther";
state_ = Panther;
}
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + style;
- QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.style";
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + style;
+ TQString tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/.style";
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
repaint();
}
-void BabSwitcher::setDeco(QString deco)
+void BabSwitcher::setDeco(TQString deco)
{
if (deco == "Jaguar")
decoState_ = Jaguar;
@@ -420,13 +420,13 @@ void BabSwitcher::setDeco(QString deco)
deco = "Panther";
decoState_ = Panther;
}
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + deco;
- QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.deco";
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + deco;
+ TQString tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/.deco";
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
}
-QString BabSwitcher::style()
+TQString BabSwitcher::style()
{
switch (state_)
{
@@ -443,7 +443,7 @@ QString BabSwitcher::style()
}
}
-QString BabSwitcher::deco()
+TQString BabSwitcher::deco()
{
switch (decoState_)
{
@@ -460,10 +460,10 @@ QString BabSwitcher::deco()
}
}
-void BabSwitcher::start(QString name, QString settings)
+void BabSwitcher::start(TQString name, TQString settings)
{
KProcess proc;
- QString section; int i = 0; bool done = false;
+ TQString section; int i = 0; bool done = false;
if (name.contains(' '))
{
while (!done)
@@ -471,8 +471,8 @@ void BabSwitcher::start(QString name, QString settings)
section = name.section(' ',i,i);
if (i == 0)
{
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + settings;
- QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/" + section;
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + settings;
+ TQString tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/" + section;
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
}
@@ -485,8 +485,8 @@ void BabSwitcher::start(QString name, QString settings)
}
else
{
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + settings;
- QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/" + name;
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + settings;
+ TQString tmpString2 = TQDir::homeDirPath() + "/.baghira/.bab/" + name;
remove(tmpString2.latin1());
symlink (tmpString.latin1(), tmpString2.latin1());
proc << name;
@@ -501,9 +501,9 @@ void BabSwitcher::emitStyleChanged()
KIPC::sendMessageAll(KIPC::ToolbarStyleChanged);
}
-void BabSwitcher::mousePressEvent(QMouseEvent *e){
+void BabSwitcher::mousePressEvent(TQMouseEvent *e){
- QWidget *daddy = parentWidget();
+ TQWidget *daddy = parentWidget();
globalPos->setX(e->globalX() - e->x());
globalPos->setY(e->globalY() - e->y());
@@ -526,38 +526,38 @@ void BabSwitcher::mousePressEvent(QMouseEvent *e){
}
}
-void BabSwitcher::paintEvent(QPaintEvent *ev){
+void BabSwitcher::paintEvent(TQPaintEvent *ev){
KSystemTray::paintEvent(ev);
- QPainter icyApainter(this);
+ TQPainter icyApainter(this);
switch (state_)
{
case Jaguar:
- JaguarIcon.isNull() ? icyApainter.fillRect(rect(), Qt::blue) : icyApainter.drawPixmap(0, 0, JaguarIcon);
+ JaguarIcon.isNull() ? icyApainter.fillRect(rect(), TQt::blue) : icyApainter.drawPixmap(0, 0, JaguarIcon);
break;
case Panther:
- PantherIcon.isNull() ? icyApainter.fillRect(rect(), Qt::black) : icyApainter.drawPixmap(0, 0, PantherIcon);
+ PantherIcon.isNull() ? icyApainter.fillRect(rect(), TQt::black) : icyApainter.drawPixmap(0, 0, PantherIcon);
break;
case iTunes:
- iTunesIcon.isNull() ? icyApainter.fillRect(rect(), Qt::gray) : icyApainter.drawPixmap(0, 0, iTunesIcon);
+ iTunesIcon.isNull() ? icyApainter.fillRect(rect(), TQt::gray) : icyApainter.drawPixmap(0, 0, iTunesIcon);
break;
case Tiger:
- TigerIcon.isNull() ? icyApainter.fillRect(rect(), Qt::yellow) : icyApainter.drawPixmap(0, 0, TigerIcon);
+ TigerIcon.isNull() ? icyApainter.fillRect(rect(), TQt::yellow) : icyApainter.drawPixmap(0, 0, TigerIcon);
break;
case Milk:
- MilkIcon.isNull() ? icyApainter.fillRect(rect(), Qt::white) : icyApainter.drawPixmap(0, 0, MilkIcon);
+ MilkIcon.isNull() ? icyApainter.fillRect(rect(), TQt::white) : icyApainter.drawPixmap(0, 0, MilkIcon);
default:
break;
}
icyApainter.end();
}
-Corner::Corner(Side side) : QWidget(0, (side == left)?"left_corner":"right_corner", Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM )
+Corner::Corner(Side side) : TQWidget(0, (side == left)?"left_corner":"right_corner", TQt::WType_TopLevel | TQt::WStyle_NoBorder | TQt::WStyle_StaysOnTop | TQt::WX11BypassWM )
{
if (side == left) {
setFixedSize(5,4);
move(0,0);
show();
- setPaletteBackgroundColor(Qt::black);
+ setPaletteBackgroundColor(TQt::black);
XRectangle* xrects = new XRectangle[4];
xrects[ 0 ].x = 0;
xrects[ 0 ].y = 0;
@@ -575,15 +575,15 @@ Corner::Corner(Side side) : QWidget(0, (side == left)?"left_corner":"right_corne
xrects[ 3 ].y = 3;
xrects[ 3 ].width = 1;
xrects[ 3 ].height = 2;
- XShapeCombineRectangles( qt_xdisplay(), winId(), ShapeBounding, 0, 0,
+ XShapeCombineRectangles( tqt_xdisplay(), winId(), ShapeBounding, 0, 0,
xrects, 4, ShapeSet, 0 );
delete[] xrects;
}
else {
setFixedSize(5,4);
- move(QApplication::desktop()->width()-5,0);
+ move(TQApplication::desktop()->width()-5,0);
show();
- setPaletteBackgroundColor(Qt::black);
+ setPaletteBackgroundColor(TQt::black);
XRectangle* xrects = new XRectangle[4];
xrects[ 0 ].x = 0;
xrects[ 0 ].y = 0;
@@ -601,7 +601,7 @@ Corner::Corner(Side side) : QWidget(0, (side == left)?"left_corner":"right_corne
xrects[ 3 ].y = 3;
xrects[ 3 ].width = 1;
xrects[ 3 ].height = 2;
- XShapeCombineRectangles( qt_xdisplay(), winId(), ShapeBounding, 0, 0,
+ XShapeCombineRectangles( tqt_xdisplay(), winId(), ShapeBounding, 0, 0,
xrects, 4, ShapeSet, 0 );
delete[] xrects;
}