testobject.cpp

00001 /***************************************************************************
00002  * testobject.cpp
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #include "testobject.h"
00021 
00022 #include <iostream> // for std::out
00023 
00024 #include <kdebug.h>
00025 
00026 TestObject::TestObject()
00027     : QObject(0, "TestObject")
00028 {
00029 }
00030 
00031 TestObject::TestObject(QObject* parent, Kross::Api::ScriptContainer::Ptr scriptcontainer)
00032     : QObject(parent, "TestObject")
00033 {
00034     //kdDebug() << "TestObject::TestObject Constructor." << endl;
00035 
00036     connect(this, SIGNAL(testSignal()), this, SLOT(testSignalSlot()));
00037     connect(this, SIGNAL(stdoutSignal(const QString&)), this, SLOT(stdoutSlot(const QString&)));
00038     connect(this, SIGNAL(stderrSignal(const QString&)), this, SLOT(stderrSlot(const QString&)));
00039 
00040     scriptcontainer->addQObject(this);
00041 
00042 //scriptcontainer->addSignal("stdout", this, SIGNAL(stdoutSignal(const QString&)));
00043 //scriptcontainer->addSlot("stderr", this, SLOT(stderrSlot(const QString&)));
00044 
00045     //scriptcontainer->addSignal("myTestSignal", this, SIGNAL(testSignal()));
00046     //scriptcontainer->addSlot("myTestSlot", this, SLOT(testSlot()));
00047 }
00048 
00049 TestObject::~TestObject()
00050 {
00051     //kdDebug() << "TestObject::~TestObject Destructor." << endl;
00052 }
00053 
00054 uint TestObject::func1(uint i)
00055 {
00056     kdDebug() << "CALLED => TestObject::func1 i=" << i << endl;
00057     return i;
00058 }
00059 
00060 void TestObject::func2(QString s, int i)
00061 {
00062     kdDebug() << "CALLED => TestObject::func2 s=" << s << " i=" << i << endl;
00063 }
00064 
00065 QString TestObject::func3(QString s, int i)
00066 {
00067     kdDebug() << "CALLED => TestObject::func3 s=" << s << " i=" << i << endl;
00068     return s;
00069 }
00070 
00071 const QString& TestObject::func4(const QString& s, int i) const
00072 {
00073     kdDebug() << "CALLED => TestObject::func4 s=" << s << " i=" << i << endl;
00074     return s;
00075 }
00076 
00077 void TestObject::testSlot()
00078 {
00079     kdDebug() << "TestObject::testSlot called" << endl;
00080     emit testSignal();
00081     emit testSignalString("This is the emitted TestObject::testSignalString(const QString&)");
00082 }
00083 
00084 void TestObject::testSlot2()
00085 {
00086     kdDebug() << "TestObject::testSlot2 called" << endl;
00087 }
00088 
00089 void TestObject::testSignalSlot()
00090 {
00091     kdDebug() << "TestObject::testSignalSlot called" << endl;
00092 }
00093 
00094 void TestObject::stdoutSlot(const QString& s)
00095 {
00096     kdDebug() << "<stdout> " << s << endl;
00097     //std::cout << "<stdout> " << s.latin1() << std::endl;
00098 }
00099 
00100 void TestObject::stderrSlot(const QString& s)
00101 {
00102     kdDebug() << "<stderr> " << s << endl;
00103     //std::cout << "<stderr> " << s.latin1() << std::endl;
00104 }
00105 
00106 //#include "testobject.moc"

Generated on Thu Feb 9 17:59:11 2006 for Kross by  doxygen 1.4.6