void StudentDashBoard::createActions() { //reset system toolbar connect(timer,SIGNAL(timeout()),this,SLOT(statusMessage())); connect(messageCheck,SIGNAL(timeout()),this,SLOT(newQuestion())); connect(broadCastTimer,SIGNAL(timeout()),SLOT(showBroadCastContent())); connect(clearHelpContent,SIGNAL(timeout()),ui->label,SLOT(clear())); connect(clearHelpContent,SIGNAL(timeout()),clearHelpContent,SLOT(stop())); connect(clearBroadCastContent,SIGNAL(timeout()),SLOT(clearBroadCast())); connect(clearBroadCastContent,SIGNAL(timeout()),clearBroadCastContent,SLOT(stop())); //the head actions connect(ui->exit,SIGNAL(clicked()),this,SLOT(quitApp())); connect(ui->helpBtn,SIGNAL(clicked()),this,SLOT(showHelpInfo())); //viewppt connect(ui->viewpptBtn,SIGNAL(clicked()),this,SLOT(viewPPt())); //coding connect(ui->codingBtn,SIGNAL(clicked()),timer,SLOT(stop())); connect(ui->codingBtn,SIGNAL(clicked()),codingWin,SLOT(showFullScreen())); connect(codingWin,SIGNAL(exitCoding()),SLOT(showFullScreen())); connect(codingWin,SIGNAL(serverStarted()),SLOT(hide()));///???????????????????????????????!!!!!!!!!!!!!!!!! //question connect(ui->questionViewBtn,SIGNAL(clicked()),this,SLOT(exerciseQuestion())); //socket to server connect(socket, SIGNAL( readyRead()), SLOT(receiveQuestionID())); // connect(qApp,SIGNAL(aboutToQuit()),SLOT(sendStudentStatus())); //video view connect(ui->viewVideoBtn,SIGNAL(clicked()),this,SLOT(viewVideos())); //refreshdata connect(this,SIGNAL(refreshDatabase()),SLOT(refreshDataFromDB())); }
void StudentDashBoard::receiveQuestionID() { while (socket->canReadLine()) { QString line = QString::fromUtf8(socket->readLine()).trimmed(); //the teacher data format :teacher/studentid/questionid //the student data format : student/studentid/questionid/questionanswer QStringList messageList = line.split(QRegExp("/")); //refreshdata if(messageList.at(0) == QString("refreshdata")){ emit refreshDatabase(); } //data from teachar if(messageList.at(0)==QString("teacher")){ message = RECEIEVEQUESTION; //check the studentid if(messageList.at(1) == studentID){ questionId= messageList.at(2).toInt(); } else{ questionId = 0; } if(questionId != 0){ hasMessage = true; } }//is teacher if(messageList.at(0)==QString("broadcast")){ message = messageList.at(1); broadCastTimer->start(100); clearBroadCastContent->start(5000); } } }
void CmaClient::enterEventLoop(vita_device_t *device) { vita_event_t event; qDebug("Starting event loop"); CmaEvent eventLoop (device); QThread thread; thread.setObjectName("event_thread"); eventLoop.moveToThread(&thread); connect(&thread, SIGNAL(started()), &eventLoop, SLOT(process())); connect(&eventLoop, SIGNAL(refreshDatabase()), this, SIGNAL(refreshDatabase()), Qt::DirectConnection); connect(&eventLoop, SIGNAL(finishedEventLoop()), &thread, SLOT(quit()), Qt::DirectConnection); thread.start(); while(isActive()) { if(VitaMTP_Read_Event(device, &event) < 0) { qWarning("Error reading event from Vita."); break; } // do not create a event for this since there aren't more events to read if(event.Code == PTP_EC_VITA_RequestTerminate) { qDebug("Terminating event thread"); break; // this one shuold be processed inmediately } else if(event.Code == PTP_EC_VITA_RequestCancelTask) { eventLoop.vitaEventCancelTask(&event, event.Param1); qDebug("Ended event, code: 0x%x, id: %d", event.Code, event.Param1); continue; } // the events are processed synchronously except for cancel/terminate qDebug("Sending new event"); eventLoop.setEvent(event); } eventLoop.stop(); thread.wait(); qDebug("Finishing event loop"); }
void MainWidget::createTrayIcon() { trayIcon = createTrayObject(this); trayIcon->init(); #ifndef Q_OS_WIN32 trayIcon->setIcon("qcma_off"); #else trayIcon->setIcon("tray/qcma_off_16"); #endif trayIcon->show(); connect(trayIcon, SIGNAL(openConfig()), this, SLOT(openConfig())); connect(trayIcon, SIGNAL(openManager()), this, SLOT(openManager())); connect(trayIcon, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase())); connect(trayIcon, SIGNAL(showAboutDialog()), this, SLOT(showAboutDialog())); connect(trayIcon, SIGNAL(showAboutQt()), this, SLOT(showAboutQt())); connect(trayIcon, SIGNAL(stopServer()), this, SLOT(stopServer())); connect(managerForm, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnect(QString))); connect(managerForm, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect())); connect(managerForm, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString))); }
void TelegramDialogsModel::setTelegram(TelegramQml *tgo) { if( p->telegram == tgo ) return; if( p->telegram ) { disconnect( p->telegram, SIGNAL(dialogsChanged(bool)), this, SLOT(dialogsChanged(bool)) ); disconnect( p->telegram, SIGNAL(phoneNumberChanged()), this, SLOT(refreshDatabase()) ); disconnect( p->telegram->userData(), SIGNAL(favoriteChanged(int)) , this, SLOT(userDataChanged()) ); disconnect( p->telegram->userData(), SIGNAL(valueChanged(QString)), this, SLOT(userDataChanged()) ); disconnect(p->telegram, SIGNAL(authLoggedInChanged()), this, SLOT(recheck())); }
void KDENotifierTray::init() { options = new QAction(tr("Settings"), this); reload = new QAction(tr("Refresh database"), this); backup = new QAction(tr("Backup Manager"), this); about = new QAction(tr("About QCMA"), this); about_qt = new QAction(tr("About Qt"), this); quit = new QAction(tr("Quit"), this); connect(options, SIGNAL(triggered()), this, SIGNAL(openConfig())); connect(backup, SIGNAL(triggered()), this, SIGNAL(openManager())); connect(reload, SIGNAL(triggered()), this, SIGNAL(refreshDatabase())); connect(about, SIGNAL(triggered()), this, SIGNAL(showAboutDialog())); connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt())); connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer())); #if QT_VERSION < 0x050000 KMenu *tray_icon_menu = new KMenu(this); #else QMenu *tray_icon_menu = new QMenu(this); #endif tray_icon_menu->addAction(options); tray_icon_menu->addAction(reload); tray_icon_menu->addAction(backup); tray_icon_menu->addSeparator(); tray_icon_menu->addAction(about); tray_icon_menu->addAction(about_qt); tray_icon_menu->addSeparator(); tray_icon_menu->addAction(quit); m_notifier_item = new KDENotifier("QcmaNotifier", this); m_notifier_item->setContextMenu(tray_icon_menu); m_notifier_item->setTitle("Qcma"); m_notifier_item->setCategory(KStatusNotifierItem::ApplicationStatus); m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/qcma_off.png")); m_notifier_item->setStatus(KStatusNotifierItem::Active); m_notifier_item->setToolTipTitle(tr("Qcma status")); m_notifier_item->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png")); m_notifier_item->setToolTipSubTitle(tr("Disconnected")); m_notifier_item->setStandardActionsEnabled(false); }
void CmaEvent::vitaEventGetSettingInfo(vita_event_t *event, int eventId) { qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId); settings_info_t *settingsinfo; if(VitaMTP_GetSettingInfo(device, eventId, &settingsinfo) != PTP_RC_OK) { qWarning("Failed to get setting info from Vita."); return; } qDebug("Current account id: %s", settingsinfo->current_account.accountId); QSettings settings; if(settings.value("lastAccountId").toString() != settingsinfo->current_account.accountId) { m_db->setUUID(settingsinfo->current_account.accountId); // set the database to be updated ASAP emit refreshDatabase(); } // free all the information VitaMTP_Data_Free_Settings(settingsinfo); VitaMTP_ReportResult(device, eventId, PTP_RC_OK); }
void ServiceManager::start() { VitaMTP_Init(); loadDefaultSettings(); if(QSettings().value("useMemoryStorage", true).toBool()) { m_db = new QListDB(); } else { m_db = new SQLiteDB(); } // initializing database for the first use refreshDatabase(); // send a signal when the update is finished connect(m_db, SIGNAL(updated(int)), this, SIGNAL(databaseUpdated(int))); thread_count = 0; qDebug("Starting cma threads"); CmaClient *client; QSettings settings; if(!settings.value("disableUSB", false).toBool()) { usb_thread = new QThread(); client = new CmaClient(m_db); usb_thread->setObjectName("usb_thread"); connect(usb_thread, SIGNAL(started()), client, SLOT(connectUsb())); connect(client, SIGNAL(finished()), usb_thread, SLOT(quit()), Qt::DirectConnection); connect(usb_thread, SIGNAL(finished()), usb_thread, SLOT(deleteLater())); connect(usb_thread, SIGNAL(finished()), this, SLOT(threadStopped())); connect(usb_thread, SIGNAL(finished()), client, SLOT(deleteLater())); connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase())); client->moveToThread(usb_thread); usb_thread->start(); thread_count++; } if(!settings.value("disableWireless", false).toBool()) { CmaBroadcast *broadcast = new CmaBroadcast(this); wireless_thread = new QThread(); client = new CmaClient(m_db, broadcast); wireless_thread->setObjectName("wireless_thread"); connect(wireless_thread, SIGNAL(started()), client, SLOT(connectWireless())); connect(client, SIGNAL(finished()), wireless_thread, SLOT(quit()), Qt::DirectConnection); connect(wireless_thread, SIGNAL(finished()), wireless_thread, SLOT(deleteLater())); connect(wireless_thread, SIGNAL(finished()), this, SLOT(threadStopped())); connect(wireless_thread, SIGNAL(finished()), client, SLOT(deleteLater())); connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase())); client->moveToThread(wireless_thread); wireless_thread->start(); thread_count++; } if(thread_count == 0) { qCritical("You must enable at least USB or Wireless monitoring"); } }