diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/synaescope/synaescope.cpp | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/synaescope/synaescope.cpp')
-rw-r--r-- | noatun-plugins/synaescope/synaescope.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/noatun-plugins/synaescope/synaescope.cpp b/noatun-plugins/synaescope/synaescope.cpp new file mode 100644 index 0000000..7e4df1c --- /dev/null +++ b/noatun-plugins/synaescope/synaescope.cpp @@ -0,0 +1,110 @@ +/* Synaescope - a pretty noatun visualization (based on P. Harrison's Synaesthesia) + Copyright (C) 1997 Paul Francis Harrison <pfh@yoyo.cc.monash.edu.au> + 2001 Charles Samuels <charles@kde.org> + + this file is X11 source + */ + +#include "synaescope.h" +#include "cmodule.h" + +#include <kdebug.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kstandarddirs.h> + +extern "C" +{ + Plugin *create_plugin() + { + KGlobal::locale()->insertCatalogue("synaescope"); + return new SynaeScope(); + } +} + +SynaeScope::SynaeScope() : Plugin(), scopeExePath(0) +{ + kdDebug(66666) << k_funcinfo << endl; + restarting=false; + connect(&process, SIGNAL(processExited(KProcess *)), + this, SLOT(processExited(KProcess *))); + connect(&process, SIGNAL(receivedStdout(KProcess *,char *,int)), + this, SLOT(receivedStdout(KProcess *,char *,int))); + connect(&process, SIGNAL(receivedStderr(KProcess *,char *,int)), + this, SLOT(receivedStderr(KProcess *,char *,int))); +} + +SynaeScope::~SynaeScope() +{ + kdDebug(66666) << k_funcinfo << endl; + process.kill(); +} + +void SynaeScope::init() +{ + kdDebug(66666) << k_funcinfo << endl; + mPrefs = new SynaePrefs(this); + mPrefs->reopen(); + mPrefs->save(); + connect(mPrefs, SIGNAL(configChanged()), this, SLOT(readConfig())); + + scopeExePath = KStandardDirs::findExe("noatunsynaescope.bin"); + if (scopeExePath.isEmpty()) + { + KMessageBox::error(0, i18n("Unable to locate noatunsynaescope.bin in your path. Check your installation.")); + unload(); + } + + process << scopeExePath; + + runScope(); +} + +void SynaeScope::runScope() +{ + kdDebug(66666) << k_funcinfo << endl; + if(!process.start(KProcess::NotifyOnExit, (KProcess::Communication)(KProcess::Stdin | KProcess::Stdout))) + { + KMessageBox::error(0, i18n("Unable to start noatunsynaescope. Check your installation.")); + unload(); + } +} + + +void SynaeScope::readConfig() +{ + kdDebug(66666) << k_funcinfo << endl; + if (!process.isRunning()) + return; + + restarting=true; + process.kill(); +} + +void SynaeScope::processExited(KProcess *) +{ + kdDebug(66666) << k_funcinfo << endl; + if(restarting) + { + restarting=false; + runScope(); + } + else + { + unload(); + } +} + +void SynaeScope::receivedStdout(KProcess *, char *buf, int len) +{ + QCString debugString(buf,len); + kdDebug(66666) << k_funcinfo << debugString << endl; +} + +void SynaeScope::receivedStderr(KProcess *, char *buf, int len) +{ + QCString debugString(buf,len); + kdDebug(66666) << k_funcinfo << debugString << endl; +} + +#include "synaescope.moc" |