Changes: BoosterKiller polished

RevBy: Antti Kervinen
pull/1/head
Jussi Lind 15 years ago
parent 77de29cbff
commit b4480b410b

@ -17,36 +17,35 @@
**
****************************************************************************/
#include <QString>
#include <QCoreApplication>
#include <QObject>
#include <MGConfItem>
#include "boosterkiller.h"
#include <cstdlib>
#include "boosterkiller.h"
void BoosterKiller::addKey(const QString & key)
{
MGConfItem * item = new MGConfItem(key, 0);
m_gConfItems << QSharedPointer<MGConfItem>(item);
QObject::connect(item, SIGNAL(valueChanged()),
this, SLOT(killProcesses()));
}
void BoosterKiller::addProcessName(const QString & processName)
{
processNames << processName;
m_processNames << processName;
}
void BoosterKiller::start()
{
int argc = 0;
//char **argv = 0;
QCoreApplication(argc, 0).exec();
}
void BoosterKiller::killProcesses()
{
Q_FOREACH(QString processName, processNames) {
Q_FOREACH(QString processName, m_processNames) {
system( (QString("pkill ") + processName).toStdString().c_str() );
}
}

@ -22,33 +22,42 @@
#include <QObject>
#include <QStringList>
#include <QSharedPointer>
#include <MGConfItem>
class QString;
class MGConfItem;
/*! \class BoosterKiller
*
* BoosterKiller kills certain boosters e.g. when themeing or language changes.
* Daemon will then restart the boosters.
*/
class BoosterKiller : public QObject
{
Q_OBJECT
public:
/* Add a GConf key and the name of the process that should be
killed in case the value associated to the key is changed.
*/
//! Add a GConf key to trigger booster process termination
void addKey(const QString & key);
//! Add a booster process name to be killed
void addProcessName(const QString & processName);
/* Starts the killer. This will initialize qcoreapplication, does
not return.
/*! Starts the killer. This will initialize a QCoreApplication, does
* not return.
*/
void start();
private slots:
private Q_SLOTS:
//! Kill all added processes
void killProcesses();
private:
QList<MGConfItem*> gconfItems;
QStringList processNames;
QStringList m_processNames;
QList<QSharedPointer<MGConfItem> > m_gConfItems;
};
#endif
#endif // BOOSTERKILLER_H

Loading…
Cancel
Save