void MadThread::run(){ madWorker = new MadWorker(); connect(&timer1,SIGNAL(timeout()),this,SLOT(stats())); qRegisterMetaType<QImage>("QImage&"); connect(this,SIGNAL(startShooting()),madShooter,SLOT(makeScreenShoot()),Qt::QueuedConnection); connect(madWorker,SIGNAL(nextPlease()),madShooter,SLOT(makeScreenShoot()),Qt::QueuedConnection); connect(madShooter,SIGNAL(sendImage(QImage&,QImage&)),madWorker,SLOT(getImage(QImage&,QImage&)),Qt::QueuedConnection); connect(madWorker,SIGNAL(sendBuffer(QByteArray*)),madNet,SLOT(sendBuffer(QByteArray*)),Qt::QueuedConnection); connect(madNet,SIGNAL(connectionStart(const QString &)),this,SLOT(startGrab())); connect(madNet,SIGNAL(connectionStart(const QString &)),&madTray,SLOT(connectionStarted(const QString &))); connect(&madTray,SIGNAL(stopWorking()),madShooter,SLOT(stopingWorking())); connect(&madTray,SIGNAL(stopWorking()),madWorker,SLOT(stopingWorking())); connect(&madTray,SIGNAL(stopWorking()),madNet,SLOT(stopingWorking())); connect(&madTray,SIGNAL(stopWorking()),this,SLOT(stopingWorking())); connect(madNet,SIGNAL(stopWorking()),&madTray,SLOT(stopingWorking())); connect(madNet,SIGNAL(stopWorking()),madWorker,SLOT(stopingWorking())); connect(madNet,SIGNAL(stopWorking()),madShooter,SLOT(stopingWorking())); connect(madNet,SIGNAL(stopWorking()),this,SLOT(stopingWorking())); exec(); }
MadTray::MadTray(){ trayIconMenu = new QMenu(this); // trayIconMenu->addAction(restoreAction); quitAction = new QAction(trUtf8("&Close"), this); disconnectAction = new QAction(trUtf8("&Disconnect"), this); disconnectAction->setDisabled(true); addressAction = new QAction(trUtf8("Not Connected"), this); addressAction->setDisabled(true); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(disconnectAction, SIGNAL(triggered()), this, SIGNAL(stopWorking())); connect(disconnectAction, SIGNAL(triggered()), this, SLOT(stopingWorking())); trayIconMenu->addAction(addressAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(disconnectAction); trayIconMenu->addAction(quitAction); trayIcon = new QSystemTrayIcon(this); cIcon = new QIcon("images/on.png"); dIcon = new QIcon("images/off.png"); sIcon = new QIcon("images/suspend.png"); trayIcon->setContextMenu(trayIconMenu); trayIcon->setIcon(*dIcon); trayIcon->setVisible(true); }
int BackgroundBee::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QThread::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: finishedIteration((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 1: finishedWorking((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break; case 2: stopWorking(); break; default: ; } _id -= 3; } return _id; }