void SC_TerminalClient::onInputRead(const boost::system::error_code &error, std::size_t bytes_transferred) { if (error == boost::asio::error::operation_aborted) { postfl("SCLang Input: Quit requested\n"); return; } if (error == boost::asio::error::eof) { postfl("SCLang Input: EOF. Will quit.\n"); onQuit(0); return; } if (error) { postfl("SCLang Input: %s.\n", error.message().c_str()); onQuit(1); return; } if (!error) { #if HAVE_READLINE if (mUseReadline) { rl_callback_read_char(); startInputRead(); return; } #endif pushCmdLine( inputBuffer.data(), bytes_transferred ); } }
void AudienceErrorWidget::on_quitBtn_clicked() { P2Y_PKInfo *pKInfo = P2Y_PKInfo::getInstance(); YYNotificationCenter *yync = YYNotificationCenter::getInstance(); pKInfo->bAcceptPlayPK = false; yync->sendAudiencePKInfo(pKInfo); emit onQuit(); }
/*! * Создаёт объекты QAction */ void DaemonUi::createActions() { m_actions[StartAction].append(m_menu->addAction(QIcon(":/images/start.png"), tr("Start"), this, SLOT(onStart()))); m_actions[StopAction].append(m_menu->addAction(QIcon(":/images/stop.png"), tr("Stop"), this, SLOT(onStop()))); m_actions[RestartAction].append(m_menu->addAction(QIcon(":/images/restart.png"), tr("Restart"), this, SLOT(onRestart()))); m_actions[SettingsAction].append(m_menu->addAction(QIcon(":/images/gear.png"), tr("Settings..."), this, SLOT(onSettings()))); m_menu->addSeparator(); m_menu->addAction(QIcon(LS(":/images/quit.png")), tr("Quit"), this, SLOT(onQuit())); }
void MainWindow::createDatabaseMenu() { QMenu* databaseMenu = menuBar()->addMenu(tr("&Databashe")); QAction* action = databaseMenu->addAction("&New Database"); connect(action, SIGNAL(triggered()), this, SLOT(onNewDatabase())); action = databaseMenu->addAction("&Open Database"); connect(action, SIGNAL(triggered()), this, SLOT(onOpenDatabase())); action = databaseMenu->addAction(tr("E&xit")); connect(action, SIGNAL(triggered()), this, SLOT(onQuit())); }
void DaemonUi::handleMessage(const QString& message) { QStringList args = message.split(LS(", ")); if (args.contains(LS("-exit"))) { onQuit(); return; } if (!arguments(args)) showUi(); }
void App::onMenuCommand( WORD id ) { switch( id ) { case IDM_EXIT: onQuit(); break; case IDM_RELOADSETUP: GetGame()->reload_setup(); break; } }
MainWindowController::MainWindowController(QObject *parent) : QObject(parent) { _window = new QMainWindow(); _ui = new Ui::MainWindow(); ui()->setupUi(window()); connect(ui()->startServerButton, SIGNAL(pressed()), this, SLOT(onStartServerButton())); connect(ui()->stopServerButton, SIGNAL(pressed()), this, SLOT(onStopServerButton())); connect(ui()->quitButton, SIGNAL(pressed()), this, SLOT(onQuit())); connect(ui()->hostListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onHostListSelectionChanged())); QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses(); for (QList<QHostAddress>::const_iterator index = ipAddressesList.constBegin(); ipAddressesList.constEnd() != index; ++index) { ui()->hostListWidget->addItem((*index).toString()); } }
LifeControlsWidget::LifeControlsWidget(SimOptions *opts, SimController *ctrlr, LifeScrollWidget &scroll) : displayWidget(scroll) { options = opts; controller = ctrlr; delay = 100; play = false; QLabel *gridLabel = new QLabel("Grid Size:"); QLabel *delayLabel = new QLabel("Delay:"); genLabel = new QLabel("Generation:\t 1"); refreshGenLabel(); QSpinBox *gridSizeSpin = new QSpinBox(); gridSizeSpin->setMinimum(1); gridSizeSpin->setMaximum(1000); gridSizeSpin->setValue(opts->getBlockSize()); QSpinBox *delaySpin = new QSpinBox(); delaySpin->setMinimum(10); delaySpin->setMaximum(10000); delaySpin->setValue(delay); QPushButton *quitBtn = new QPushButton("Quit"); QPushButton *restartBtn = new QPushButton("Restart"); playBtn = new QPushButton("Play"); QPushButton *stepBtn = new QPushButton("Step"); QBoxLayout *box = new QBoxLayout(QBoxLayout::TopToBottom, this); box->addWidget(gridLabel); box->addWidget(gridSizeSpin); box->addWidget(delayLabel); box->addWidget(delaySpin); box->addWidget(genLabel); box->addWidget(quitBtn); box->addWidget(restartBtn); box->addWidget(playBtn); box->addWidget(stepBtn); box->addStretch(1); box->addSpacing(12); setLayout(box); connect(quitBtn, SIGNAL(clicked()), this, SLOT(onQuit())); connect(restartBtn, SIGNAL(clicked()), this, SLOT(onRestart())); connect(playBtn, SIGNAL(clicked()), this, SLOT(onPlay())); connect(stepBtn, SIGNAL(clicked()), this, SLOT(onStep())); connect(gridSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(onSizeChange(int))); connect(delaySpin, SIGNAL(valueChanged(int)), this, SLOT(onDelayChange(int))); }
//---------------------------------------------------------------------- // KJOTSMAIN //---------------------------------------------------------------------- KJotsMain::KJotsMain() { // Main widget // KStandardAction::quit(this, SLOT(onQuit()), actionCollection()); component = new KJotsWidget(this, this); setCentralWidget(component); //QT5 statusBar()->insertItem(QString(), 0, 1); //QT5 statusBar()->setItemAlignment(0, Qt::AlignLeft | Qt::AlignVCenter); connect(component, SIGNAL(activeAnchorChanged(QString,QString)), SLOT(activeAnchorChanged(QString,QString))); setupGUI(); connect(component, &KJotsWidget::captionChanged, this, &KJotsMain::updateCaption); }
ChWindow::ChWindow() { QWidget *centralWidget = new QWidget; QVBoxLayout* mainLayout = new QVBoxLayout; QSplitter *spl = new QSplitter(Qt::Horizontal); m_tabLeft = createLeftPane(); m_wRight = new RightPaneWidget; spl->addWidget(m_tabLeft); spl->addWidget(m_wRight); spl->setStretchFactor(0, 0); spl->setStretchFactor(1, 1); spl->setCollapsible(0, false); spl->setCollapsible(1, false); mainLayout->addWidget(spl); centralWidget->setLayout(mainLayout); setCentralWidget(centralWidget); connect(m_trSongs, SIGNAL(songSelected(const Song&)), m_wRight, SLOT(songSelected(const Song&))); connect(m_trSongs, SIGNAL(noSongSelected()), m_wRight, SLOT(noSongSelected())); connect(m_trSongs, SIGNAL(quit()), this, SLOT(onQuit())); void setText(int textIndex, const QString& text); void deleteText(int textIndex); connect(m_wRight, SIGNAL(setText(int, const QString&)), m_trSongs, SLOT(saveText(int, const QString&))); connect(m_wRight, SIGNAL(deleteText(int)), m_trSongs, SLOT(deleteText(int))); setWindowTitle(tr("Chords")); setMinimumSize(160, 160); resize(600, 400); }
int ScreenHandler::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: sendDataToKnx((*reinterpret_cast< QString(*)>(_a[1]))); break; case 1: sendDataToScreenObj((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 2: disconnectGateway(); break; case 3: onQuit(); break; case 4: onScreenChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 5: onScreenChange((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: onDataFromKnx((*reinterpret_cast< QString(*)>(_a[1]))); break; case 7: onDataFromScreenObj((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; case 8: onMsg((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; default: ; } _id -= 9; } return _id; }
int Stage::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: sendDataToKnx((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; case 1: exit((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 2: quit(); break; case 3: DisplayMainScreen(); break; case 4: onBack(); break; case 5: UpdateScreen((*reinterpret_cast< QString(*)>(_a[1]))); break; case 6: onUiValueChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; case 7: onDataFromKnx((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 8: onExit((*reinterpret_cast< int(*)>(_a[1]))); break; case 9: onQuit(); break; default: ; } _id -= 10; } return _id; }
static gboolean onKeyPressed(GtkWidget *widget, GdkEventKey *ev, gpointer data) { /* Unused parameters. */ (void)data; guint key = ev->keyval; gchar *msg = NULL; /* When inside the note pad, don't do anything here. */ if (isInsideNotePad) return FALSE; /* Jump command? * * Note: This works as long as the values of GDK keysyms satisfy: * 1) GDK_0 < GDK_1 < GDK_2 < ... < GDK_9 * 2) All of them must be >= 0. */ key -= GDK_0; if (key <= 9) { /* The initial value is -1, so we have to reset this on the * first key stroke. */ if (target_page < 0) target_page = 0; /* Do a "decimal left shift" and add the given value. */ target_page *= 10; target_page += (int)key; /* Catch overflow and announce what would happen. */ if (target_page < 0) { target_page = -1; setStatusText_strdup("Invalid page."); } else { msg = g_strdup_printf("Jump to page: %d", target_page); setStatusText_strdup(msg); g_free(msg); } return FALSE; } gboolean changed = TRUE; saveCurrentNote(); switch (ev->keyval) { case GDK_Right: case GDK_Down: case GDK_Page_Down: case GDK_space: nextSlide(); break; case GDK_Left: case GDK_Up: case GDK_Page_Up: prevSlide(); break; case GDK_F5: /* Switch to fullscreen (if needed) and start the timer * (unless it's already running). */ if (!isFullScreen) toggleFullScreen(); if (timerMode != 1) toggleTimer(); break; case GDK_F6: /* this shall trigger a hard refresh, so empty the cache. */ clearCache(); break; case GDK_w: runpref.fit_mode = FIT_WIDTH; break; case GDK_h: runpref.fit_mode = FIT_HEIGHT; break; case GDK_p: runpref.fit_mode = FIT_PAGE; break; case GDK_l: current_fixate(); break; case GDK_L: current_release(FALSE); break; case GDK_J: current_release(TRUE); break; case GDK_f: toggleFullScreen(); break; case GDK_s: toggleTimer(); changed = FALSE; break; case GDK_c: toggleCurserVisibility(); break; case GDK_r: resetTimer(); changed = FALSE; break; case GDK_Escape: case GDK_q: if (prefs.q_exits_fullscreen && isFullScreen) { toggleFullScreen(); if (prefs.stop_timer_on_fs) { toggleTimer(); } } else { changed = FALSE; onQuit(NULL, NULL, NULL); } break; case GDK_i: /* This must not work when we're on the beamer window. */ if (widget != win_beamer) setEditingState(TRUE); changed = FALSE; break; case GDK_Return: if (executeJump() == 0) nextSlide(); break; case GDK_G: executeJump(); break; case GDK_period: case GDK_b: toggleBlankBeamer(); changed = FALSE; break; default: changed = FALSE; } if (changed == TRUE) { refreshPorts(); } return TRUE; }
int main(void) { char buf[256]; int lineCount = 0; int fileOpenResult = 0; FILE *fileRead = NULL, *fileWrite = NULL; StudentList studentList; studentList.count = 0; studentList.firstStudent = NULL; studentList.lastStudent = NULL; // student list 초기화 fileOpenResult = openStudentFile(&fileRead, &fileWrite); if (fileOpenResult == -1) return -1; // data.txt 읽어오기, 없으면 만들기, 만들기 실패하면 종료하기 if (fileOpenResult == 0) { while (fgets(buf, sizeof(buf), fileRead) != NULL) // file 읽어서 구조체 할당하고 list에 추가하기 { if (lineCount++ == 0) continue; // 첫줄 무시 Student *s = parseStudentStr(buf); addStudentToList(s, &studentList); } } if (fileRead) fclose(fileRead); if (fileWrite) fclose(fileWrite); // main program loop int choice = 0; int changeExists = 0; while (choice != 9) { runMainMenu(&choice); switch (choice) { case 1: printStudentList(&studentList); break; case 2: addNewStudent(&studentList); changeExists++; break; case 3: modifyStudentInfo(&studentList); changeExists++; break; case 4: deleteStudentInfo(&studentList); changeExists++; break; case 5: saveListToFile(&studentList); changeExists = 0; break; case 9: if (onQuit(changeExists)) saveListToFile(&studentList); break; default: printf("Invalid choice!\n"); break; } } cleanupOnExit(&studentList, fileRead, fileWrite); return 0; }
void Event::onEvent(SDL_Event *event) { switch (event->type) { case SDL_ACTIVEEVENT: switch (event->active.state) { case SDL_APPMOUSEFOCUS: if (event->active.gain) { onMouseFocus(); } else { onMouseBlur(); } break; case SDL_APPINPUTFOCUS: if (event->active.gain) { onInputFocus(); } else { onInputBlur(); } break; case SDL_APPACTIVE: if (event->active.gain) { onRestore(); } else { onMinimize(); } break; } break; //SDL_ACTIVEEVENT case SDL_KEYDOWN: onKeyDown(event->key.keysym.sym, event->key.keysym.mod, event->key.keysym.unicode); break; case SDL_KEYUP: onKeyUp(event->key.keysym.sym, event->key.keysym.mod, event->key.keysym.unicode); break; case SDL_MOUSEBUTTONDOWN: onMouseDown(event->button.button, event->button.x, event->button.y); break; case SDL_MOUSEBUTTONUP: onMouseUp(event->button.button, event->button.x, event->button.y); break; case SDL_JOYAXISMOTION: onJoyAxis(event->jaxis.which, event->jaxis.axis, event->jaxis.value); break; case SDL_JOYBALLMOTION: onJoyBall(event->jball.which, event->jball.ball, event->jball.xrel, event->jball.yrel); break; case SDL_JOYHATMOTION: onJoyHat(event->jhat.which, event->jhat.hat, event->jhat.value); break; case SDL_JOYBUTTONDOWN: onJoyButtonDown(event->jbutton.which, event->jbutton.button); break; case SDL_JOYBUTTONUP: onJoyButtonUp(event->jbutton.which, event->jbutton.button); break; case SDL_QUIT: onQuit(); break; case SDL_VIDEORESIZE: onResize(event->resize.w, event->resize.h); break; default: onUser(event->user.type, event->user.code, event->user.data1, event->user.data2); break; } }
void IRC::handle(const string& oline) { string line = trim(oline); printf("%s\n", line.c_str()); //We are pinged, respond! if(line.compare(0, 4, "PING") == 0) { onServerPing(line.substr(5)); return; } char* cstr = new char[line.size() + 1]; strcpy(cstr, line.c_str()); string sender, nick, login, host; bool nickOnly = false; size_t tokn = 0; char *tok = strtok(cstr, " "); while(tok != NULL) { //For each token, check string tmp = tok; if(tokn == 0) { sender = tmp; if(sender[0] == ':') sender = sender.substr(1); size_t exp = sender.find("!"); size_t at = sender.find("@"); //TODO: Add checks for 'exp' and 'at' being string::npos // to avoid calling these when there are (no ill effects // have been seen from not doing so yet, however for sanity sake) if(exp == string::npos || at == string::npos) { nick = trim(sender); login = ""; host = ""; nickOnly = true; } else { nick = trim(sender.substr(0, exp)); login = trim(sender.substr(exp + 1, at)); host = trim(sender.substr(at + 1)); } } if(tokn == 1) { tok = strtok(NULL, " "); string target(tok); //AKA channel uint32_t code = 0; if(tmp.length() == 3 && (code = (uint32_t) atoi(tmp.c_str())) != 0 && code < 1000) { string response = line.substr(sender.length()+5+target.length()+1); handle_numeric(code,target,response); onNumeric(sender,code,target,response); } else if(tmp.compare("PRIVMSG") == 0) { handle_msg(target, nick, login, host, line.substr(line.find(" :") + 2)); } else if(tmp.compare("NOTICE") == 0) { onNotice(target, nick, login, host, line.substr(line.find(" :") + 2)); } else if(tmp.compare("JOIN") == 0) { //TODO: Add this user to the channel. onJoin(target, nick, login, host); } else if(tmp.compare("PART") == 0) { //TODO: Remove this user from the channel. onPart(target, nick, login, host); } else if(tmp.compare("TOPIC") == 0) { onTopic(target, line.substr(line.find(" :") + 2), nick, time(NULL), true); } else if(tmp.compare("KICK") == 0) { tok = strtok(NULL, " "); string recipient(tok); onKick(target, nick, login, host, recipient, line.substr(line.find(" :") + 2)); } else if(tmp.compare("QUIT") == 0) { onQuit(nick, login, host, line.substr(line.find(" :") + 2)); } else if(tmp.compare("MODE") == 0) { tok = strtok(NULL, " "); string mode = tok; if(mode[0] == ':') mode = mode.substr(1); handle_mode(nick, login, host, target, mode); } //TODO: Add mode handler here else { onUnknown(line); } break; } tok = strtok(NULL, " "); ++tokn; } delete[] cstr; }
TiltNRoll::TiltNRoll(QWidget *parent) : QStackedWidget(parent), m_channel(0), m_embedded(true) { // call TrickManager::instance for initialization TrickManager::instance(); // call SoundPlayer::instance for initialization SoundPlayer::instance(); // start screen (tab 0) StartScreen *s0 = new StartScreen(); addWidget(s0); connect(s0, SIGNAL(playPressed()), this, SLOT(onPlay())); connect(s0, SIGNAL(trainingPressed()), this, SLOT(onTraining())); connect(s0, SIGNAL(quitPressed()), this, SLOT(onQuit())); connect(s0, SIGNAL(simulPressed()), this, SLOT(onSimul())); // play screen (tab 1) PlayScreen *s1 = new PlayScreen(); connect(s1, SIGNAL(backPressed()), this, SLOT(onStart())); connect(s1, SIGNAL(singlePlayerPressed()), this, SLOT(onSingleplayer())); addWidget(s1); // training screen (tab 2) //SettingsScreen *s2 = new SettingsScreen(); //TrainPage *s2 = new TrainPage; SettingsPage *s2 = new SettingsPage; connect(s2, SIGNAL(backPressed()), this, SLOT(onStart())); addWidget(s2); // DEBUG //addWidget(createGraph()); // single player screen (tab 3) SingleplayerScreen *s3 = new SingleplayerScreen(); connect(s3, SIGNAL(backPressed()), this, SLOT(onPlay())); connect(s3, SIGNAL(freestylePressed()), this, SLOT(onFreestyle())); connect(s3, SIGNAL(highscorePressed()), this, SLOT(onHighscore())); addWidget(s3); // freestyle screen (tab 4) freestyle_screen = new FreestyleScreen(); connect(freestyle_screen, SIGNAL(showPauseScreen()), this, SLOT(onPause())); connect(s3, SIGNAL(freestylePressed()), freestyle_screen, SLOT(reset())); addWidget(freestyle_screen); // pause screen (tab 5) PauseScreen *s5 = new PauseScreen(); qDebug("added!"); connect(s5, SIGNAL(resumePressed()), this, SLOT(onFreestyle())); connect(s5, SIGNAL(endGamePressed()), this, SLOT(checkHighscore())); addWidget(s5); // enter name screen (tab 6) EnterNameScreen *s6 = new EnterNameScreen(); qDebug("added!"); connect(s6, SIGNAL(nameEntered(QString)), this, SLOT(addToHighscore(QString))); addWidget(s6); // highscore screen (tab 7) HighscoreScreen *s7 = new HighscoreScreen(&hs); connect(s7, SIGNAL(backPressed()), this, SLOT(onStart())); addWidget(s7); // TrickSimulator (tab 8) //TrickSimulator* sim = TrickSimulator::instance(); // BTCapture* sim = BTCapture::instance(); // connect(sim, SIGNAL(backPressed()), this, SLOT(onStart())); // addWidget(sim->widget()); QSize s(640,360); resize(s); setMinimumSize(s); setMaximumSize(s); //setStyle(new QPlastiqueStyle()); //qApp->setOverrideCursor(Qt::BlankCursor); setWindowState(Qt::WindowFullScreen); onStart(); }
void WebRenderMainWindow::closeEvent(QCloseEvent *event) { onQuit(); event->accept(); }
void MainWindow::createMenus() { Settings::Manager *s = mMain->settings(); s->beginGroup("IDE/shortcuts"); new QShortcut( s->shortcut("cmdLineFocus"), this, SLOT(toggleComandLineFocus()) ); QAction *act; // File mActions[Quit] = act = new QAction( QIcon::fromTheme("application-exit"), tr("&Quit..."), this); act->setShortcut(s->shortcut("quit")); act->setStatusTip(tr("Quit SuperCollider IDE")); QObject::connect( act, SIGNAL(triggered()), this, SLOT(onQuit()) ); // View mActions[ShowDocList] = act = new QAction(tr("&Documents"), this); act->setStatusTip(tr("Show/Hide the Documents dock")); act->setCheckable(true); connect(act, SIGNAL(triggered(bool)), mDocListDock, SLOT(setVisible(bool))); connect(mDocListDock, SIGNAL(visibilityChanged(bool)), act, SLOT(setChecked(bool))); // Language mActions[EvaluateCurrentFile] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("Evaluate &File"), this); act->setStatusTip(tr("Evaluate current File")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateCurrentFile())); mActions[EvaluateSelection] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("&Evaluate Selection"), this); act->setShortcut(s->shortcut("evaluateSelection")); act->setStatusTip(tr("Evaluate selection or current line")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateSelection())); mActions[EvaluateRegion] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("&Evaluate Region"), this); act->setShortcut(s->shortcut("evaluateRegion")); act->setStatusTip(tr("Evaluate current region")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateRegion())); mMain->scProcess()->action(ScIDE::SCProcess::StopMain) ->setShortcut(s->shortcut("stopMain")); // Settings mActions[ShowSettings] = act = new QAction(tr("&Configure IDE..."), this); act->setStatusTip(tr("Show configuration dialog")); connect(act, SIGNAL(triggered()), this, SLOT(showSettings())); // Help mActions[BrowseHelp] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Browse Help"), this); act->setStatusTip(tr("Open help browser on the Browse page.")); //connect(act, SIGNAL(triggered()), this, SLOT(browseHelp())); mCodeEvalMapper.setMapping(act, "HelpBrowser.openBrowsePage"); connect(act, SIGNAL(triggered()), &mCodeEvalMapper, SLOT(map())); mActions[SearchHelp] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Search Help"), this); act->setStatusTip(tr("Open help browser on the Search page.")); //connect(act, SIGNAL(triggered()), this, SLOT(searchHelp())); mCodeEvalMapper.setMapping(act, "HelpBrowser.openSearchPage"); connect(act, SIGNAL(triggered()), &mCodeEvalMapper, SLOT(map())); mActions[HelpForSelection] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Help for Selection"), this); act->setShortcut(s->shortcut("helpForSelection")); act->setStatusTip(tr("Find help for selected text")); connect(act, SIGNAL(triggered()), this, SLOT(helpForSelection())); s->endGroup(); // IDE/shortcuts; QMenu *menu; QMenu *submenu; menu = new QMenu(tr("&File"), this); menu->addAction( mEditors->action(MultiEditor::DocNew) ); menu->addAction( mEditors->action(MultiEditor::DocOpen) ); menu->addAction( mEditors->action(MultiEditor::DocSave) ); menu->addAction( mEditors->action(MultiEditor::DocSaveAs) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::DocClose) ); menu->addSeparator(); menu->addAction( mActions[Quit] ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Edit"), this); menu->addAction( mEditors->action(MultiEditor::Undo) ); menu->addAction( mEditors->action(MultiEditor::Redo) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::Cut) ); menu->addAction( mEditors->action(MultiEditor::Copy) ); menu->addAction( mEditors->action(MultiEditor::Paste) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::Find) ); menu->addAction( mEditors->action(MultiEditor::Replace) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::IndentMore) ); menu->addAction( mEditors->action(MultiEditor::IndentLess) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::OpenClassDefinition) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&View"), this); submenu = new QMenu(tr("&Docks"), this); submenu->addAction( mActions[ShowDocList] ); menu->addMenu(submenu); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::EnlargeFont) ); menu->addAction( mEditors->action(MultiEditor::ShrinkFont) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::ShowWhitespace) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Language"), this); menu->addAction( mMain->scProcess()->action(SCProcess::StartSCLang) ); menu->addAction( mMain->scProcess()->action(SCProcess::RecompileClassLibrary) ); menu->addAction( mMain->scProcess()->action(SCProcess::StopSCLang) ); menu->addSeparator(); menu->addAction( mActions[EvaluateCurrentFile] ); menu->addAction( mActions[EvaluateRegion] ); menu->addAction( mActions[EvaluateSelection] ); menu->addSeparator(); menu->addAction( mMain->scProcess()->action(ScIDE::SCProcess::RunMain) ); menu->addAction( mMain->scProcess()->action(ScIDE::SCProcess::StopMain) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Settings"), this); menu->addAction( mActions[ShowSettings] ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Help"), this); menu->addAction( mActions[BrowseHelp] ); menu->addAction( mActions[SearchHelp] ); menu->addAction( mActions[HelpForSelection] ); menuBar()->addMenu(menu); }
IntelligentSecurity::IntelligentSecurity(QWidget *parent) : QMainWindow(parent), ui(new Ui::IntelligentSecurity) { ui->setupUi(this); #ifdef __linux__ struct stat st = {0}; if (stat(INSTALL_PATH.toStdString().c_str(), &st) == -1) { mkdir(INSTALL_PATH.toStdString().c_str(), 0744); } st = {0}; if (stat(QString(INSTALL_PATH+QString("/data")).toStdString().c_str(),&st) == -1){ mkdir(QString(INSTALL_PATH+QString("/data")).toStdString().c_str(),0744); } #else #endif /*************************************************/ /***** CREATING MENU FOR APP INDICATOR ***********/ a_updateModel = new QAction(tr("&Update"),this); connect(a_updateModel, SIGNAL(triggered()), this, SLOT(onUpdateModel())); a_showConfiguration = new QAction(tr("&Configure"), this); connect(a_showConfiguration, SIGNAL(triggered()), this, SLOT(onShowConfiguration())); a_showAccessAttempts = new QAction(tr("&Show access attempts"), this); connect(a_showAccessAttempts, SIGNAL(triggered()), this, SLOT(onShowAccessAttempts())); a_showhideRecognizerWindows = new QAction(tr("&Show recognizer window"),this); connect(a_showhideRecognizerWindows, SIGNAL(triggered()), this, SLOT(onShowHideRecognizerWindows())); a_help = new QAction(tr("&Help"), this); connect(a_help, SIGNAL(triggered()), this, SLOT(onHelp())); a_quit = new QAction(tr("&Quit"), this); connect(a_quit, SIGNAL(triggered()), this, SLOT(onQuit())); trayIconMenu = new QMenu(this); trayIconMenu->addAction(a_updateModel); trayIconMenu->addAction(a_showConfiguration); trayIconMenu->addAction(a_showAccessAttempts); trayIconMenu->addAction(a_showhideRecognizerWindows); trayIconMenu->addAction(a_help); trayIconMenu->addAction(a_quit); trayIcon = new QSystemTrayIcon(QIcon(DEFAULT_PATH("IS_Indicator.png")), this); trayIcon->setContextMenu(trayIconMenu); trayIcon->show(); /*************************************************/ /*************************************************/ faceRecognizer = new FaceRecognizer(); faceRecognizer->Init(); faceRecognizer->OpenVideoCapture(CV_CAP_ANY); QFile check(USER_PATH("IntelligentSecurity.cvs")); if(!check.open(QIODevice::ReadOnly | QIODevice::Text)) { this->onShowHideRecognizerWindows(); faceRecognizer->showWindows(); faceRecognizer->Train(1); faceRecognizer->SaveModel(USER_PATH("IntelligentSecurity.cvs")); cvDestroyAllWindows(); } else { faceRecognizer->LoadModel(USER_PATH("IntelligentSecurity.cvs")); } if(!this->readConfiguration()) { string msg = "Now enter your details for customization and press OK."; NotificationManager::showNotification("Setting up", msg.c_str(),"/usr/share/icons/HighContrast/256x256/status/dialog-information.png"); this->show(); pVoice.Speak(msg); } else { timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(runFaceRecognizer())); timer->start(10); } pVoice.Init(); workstation_locked = false; faceRecognizer->hideWindows(); }
void DaemonAdaptor::quit() { emit onQuit(); }
void Event::onExit() { onQuit(); }
bool CPPModule::onEvent(IrcConnection* connection, const std::string& senderID, const std::string& eventName, const std::string& json, const std::string& optString) { JSONNode n; if(!json.empty()) { n = libjson::parse(json); } if(senderID=="IRCCONNECTION") { //Create a IrcModuleConnection instance IrcModuleConnection ircModuleConnection(mID, mModuleManager, connection); //Call onConnect if its the called event if(eventName=="onConnect") { return onConnect(ircModuleConnection); } //Convert the IRC Message IrcMessage message; message.ircLine = n["ircLine"].as_string(); message.prefix = n["prefix"].as_string(); message.hasDetailedPrefix = n["hasDetailedPrefix"].as_bool(); if(message.hasDetailedPrefix) { message.msgPrefix.nick_or_server = n["msgPrefix"]["nick_or_server"].as_string(); message.msgPrefix.user = n["msgPrefix"]["user"].as_string(); message.msgPrefix.host = n["msgPrefix"]["host"].as_string(); } message.command = n["command"].as_string(); message.isNumeric = n["isNumeric"].as_bool(); message.target = n["target"].as_string(); message.params = n["params"].as_string(); //Call all other event handlers if(eventName=="onMessage") { return onMessage(ircModuleConnection, message); } else if(eventName=="onJoin") { return onJoin(ircModuleConnection, message); } else if(eventName=="onPart") { return onPart(ircModuleConnection, message); } else if(eventName=="onKick") { return onKick(ircModuleConnection, message, optString); } else if(eventName=="onQuit") { return onQuit(ircModuleConnection, message); } else if(eventName=="onKill") { return onKill(ircModuleConnection, message, optString); } else if(eventName=="onPrivateMessage") { return onPrivateMessage(ircModuleConnection, message); } else if(eventName=="onChannelMessage") { return onChannelMessage(ircModuleConnection, message); } else if(eventName=="onNotice") { return onNotice(ircModuleConnection, message); } else if(eventName=="onInvite") { return onInvite(ircModuleConnection, message); } else if(eventName=="onTopicChanged") { return onTopicChanged(ircModuleConnection, message); } else if(eventName=="onNickChanged") { return onNickChanged(ircModuleConnection, message); } } return true; }