void addForm::add_contact() { QFile fileNewContact("Contacts/"+ui->lName->text().simplified()+" "+ui->lNick->text().simplified()); if(fileNewContact.open(QIODevice::WriteOnly|QIODevice::Text)) { QTextStream sout(&fileNewContact); sout<<ui->lNick->text().simplified()<<endl << ui->lName->text().simplified()<<endl << ui->lFathername->text().simplified()<<endl << ui->lFamily->text().simplified()<<endl << ui->lCity->text().simplified()<<endl << ui->lICQ->text().simplified()<<endl << ui->lVK->text().simplified()<<endl << ui->lOK->text().simplified()<<endl << ui->lFacebook->text().simplified()<<endl << ui->lPhone->text().simplified()<<endl << ui->lMail->text().simplified()<<endl << ui->lInfo->toPlainText().simplified()<<endl; } fileNewContact.close(); emit closing(); this->close(); }
NetworkControl::NetworkControl(PresentationControl* p) { pc = p; QObject::connect(pc, SIGNAL(presentationChanged()), this, SLOT(onPresentationChanged())); QThread* networkThread = new QThread(); client = new Client(); QObject::connect(client, SIGNAL(currentPageReceived(qint64)), pc, SLOT(onCurrenPageChanged(qint64))); QObject::connect(client, SIGNAL(connected()), this, SLOT(onConnected())); QObject::connect(client, SIGNAL(hostFound()), this, SLOT(onHostFound())); QObject::connect(client, SIGNAL(loggingIn()), this, SLOT(onLoggingIn())); QObject::connect(client, SIGNAL(successfullJoin()), this, SLOT(onConnectionAccepted())); QObject::connect(client, SIGNAL(disconnected()), this, SLOT(onDisconnected())); QObject::connect(client, SIGNAL(presentationReceived(QString, QList<QImage>)), this, SLOT(onPresentationReceived(QString, QList<QImage>))); server = new Server(); server->setPresentation(p->getPresentation()); QObject::connect(server, SIGNAL(listening()), this, SLOT(onStarted())); QObject::connect(server, SIGNAL(connectionAccepted()), this, SLOT(onClientConnected())); QObject::connect(server, SIGNAL(clientVerified()), this, SLOT(onClientVerified())); QObject::connect(server, SIGNAL(clientLeft()), this, SLOT(onClientLeft())); QObject::connect(server, SIGNAL(closing()), this, SLOT(onClosed())); }
void DocumentManager::closeDocument( IDocument *document) { if (document != NULL) { int i = m_documents.indexOf(document); if (i >= 0) { m_documents.removeAt(i); emit (closing(document)); if (this->m_activeDocument == document) { this->m_activeDocument = m_documents.count() == 0 ? NULL : i == 0 ? m_documents[0] : m_documents[i-1]; emit(activeDocumentChanged(this->m_activeDocument)); } delete document; } } }
void VBoxVMLogViewer::createLogViewer (QWidget *aCenterWidget, CMachine &aMachine) { if (!mSelfArray.contains (aMachine.GetName())) { /* Creating new log viewer if there is no one existing */ #ifdef Q_WS_MAC VBoxVMLogViewer *lv = new VBoxVMLogViewer (aCenterWidget, Qt::Window, aMachine); #else /* Q_WS_MAC */ VBoxVMLogViewer *lv = new VBoxVMLogViewer (NULL, Qt::Window, aMachine); #endif /* Q_WS_MAC */ lv->centerAccording (aCenterWidget); connect (vboxGlobal().mainWindow(), SIGNAL (closing()), lv, SLOT (close())); lv->setAttribute (Qt::WA_DeleteOnClose); mSelfArray [aMachine.GetName()] = lv; } VBoxVMLogViewer *viewer = mSelfArray [aMachine.GetName()]; viewer->show(); viewer->raise(); viewer->setWindowState (viewer->windowState() & ~Qt::WindowMinimized); viewer->activateWindow(); }
// Background color class void ImodvBkgColor::openDialog() { mSelector = new ColorSelector(imodvDialogManager.parent(IMODV_DIALOG), "3dmodv background color.", Imodv->rbgcolor->red(), Imodv->rbgcolor->green(), Imodv->rbgcolor->blue(), hotSliderFlag(), hotSliderKey(), ImodPrefs->getRoundedStyle(), "selector"); connect(mSelector, SIGNAL(newColor(int, int, int)), this, SLOT(newColorSlot(int, int, int))); connect(mSelector, SIGNAL(done()), this, SLOT(doneSlot())); connect(mSelector, SIGNAL(closing()), this, SLOT(closingSlot())); connect(mSelector, SIGNAL(keyPress(QKeyEvent *)), this, SLOT(keyPressSlot(QKeyEvent *))); connect(mSelector, SIGNAL(keyRelease(QKeyEvent *)), this, SLOT(keyReleaseSlot(QKeyEvent *))); setModvDialogTitle(mSelector, "3dmodv: "); imodvDialogManager.add((QWidget *)mSelector, IMODV_DIALOG); adjustGeometryAndShow((QWidget *)mSelector, IMODV_DIALOG); }
TEST(Async, Send) { auto loop = uvw::Loop::getDefault(); auto handle = loop->resource<uvw::AsyncHandle>(); bool checkAsyncEvent = false; handle->on<uvw::ErrorEvent>([](const auto &, auto &) { FAIL(); }); handle->on<uvw::AsyncEvent>([&checkAsyncEvent](const auto &, auto &hndl) { ASSERT_FALSE(checkAsyncEvent); checkAsyncEvent = true; hndl.close(); ASSERT_TRUE(hndl.closing()); }); handle->send(); ASSERT_TRUE(handle->active()); ASSERT_FALSE(handle->closing()); loop->run(); ASSERT_TRUE(checkAsyncEvent); }
bool KexiWindow::close(bool force) { KexiMainWindowIface::global()->acceptPropertySetEditing(); //let any view send "closing" signal QList<KexiView *> list(findChildren<KexiView*>()); foreach(KexiView * view, list) { if (view->parent() == d->stack) { bool cancel = false; emit view->closing(&cancel); if (!force && cancel) { return false; } } } emit closing(); foreach(KexiView * view, list) { if (view->parent() == d->stack) { removeView(view); delete view; } } return true; }
void ChatList::addChatWindow(ChatWindow* chatw) { connect(m_mainWindow, SIGNAL(closing()), chatw, SLOT(save())); int listSize = m_chatWindowList.size(); beginInsertRows(QModelIndex(), listSize, listSize); m_chatMenu.addAction(chatw->toggleViewAction()); connect(chatw, SIGNAL(ChatWindowHasChanged(ChatWindow *)), this, SLOT(changeChatWindow(ChatWindow *))); QMdiSubWindow* subWindowChat = static_cast<QMdiSubWindow*>(m_mainWindow->registerSubWindow(chatw,chatw->toggleViewAction())); connect(chatw->chat(), SIGNAL(changedName(QString)), subWindowChat, SLOT(setWindowTitle(QString))); m_chatWindowList.append(chatw); m_chatSubWindowList.append(subWindowChat); if((subWindowChat->height()<451)||(subWindowChat->width()<264)) { subWindowChat->resize(264,451); } if(NULL!=subWindowChat) { chatw->setSubWindow(subWindowChat); subWindowChat->setWindowTitle(tr("%1 (Chat)").arg(chatw->getTitleFromChat())); subWindowChat->setWindowIcon(QIcon(":/chat.png")); subWindowChat->setAttribute(Qt::WA_DeleteOnClose, false); chatw->setAttribute(Qt::WA_DeleteOnClose, false); subWindowChat->setVisible(chatw->toggleViewAction()->isChecked()); } endInsertRows(); }
void NavigationWindow:: closeEvent(QCloseEvent *ev) { emit closing(); ev->accept(); }
void UBApplication::closeEvent(QCloseEvent *event) { Q_UNUSED(event); closing(); }
int UBApplication::exec(const QString& pFileToImport) { QPixmapCache::setCacheLimit(1024 * 100); QString webDbPath = UBSettings::userDataDirectory() + "/web-databases"; QDir webDbDir(webDbPath); if (!webDbDir.exists(webDbPath)) webDbDir.mkpath(webDbPath); QWebSettings::setIconDatabasePath(webDbPath); QWebSettings::setOfflineStoragePath (webDbPath); QWebSettings *gs = QWebSettings::globalSettings(); gs->setAttribute(QWebSettings::JavaEnabled, true); gs->setAttribute(QWebSettings::PluginsEnabled, true); gs->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); gs->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); gs->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); gs->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); gs->setAttribute(QWebSettings::DnsPrefetchEnabled, true); mainWindow = new UBMainWindow(0, Qt::FramelessWindowHint); // deleted by application destructor mainWindow->setAttribute(Qt::WA_NativeWindow, true); mainWindow->actionCopy->setShortcuts(QKeySequence::Copy); mainWindow->actionPaste->setShortcuts(QKeySequence::Paste); mainWindow->actionCut->setShortcuts(QKeySequence::Cut); connect(mainWindow->actionBoard, SIGNAL(triggered()), this, SLOT(showBoard())); connect(mainWindow->actionWeb, SIGNAL(triggered()), this, SLOT(showInternet())); connect(mainWindow->actionWeb, SIGNAL(triggered()), this, SLOT(stopScript())); connect(mainWindow->actionDocument, SIGNAL(triggered()), this, SLOT(showDocument())); connect(mainWindow->actionDocument, SIGNAL(triggered()), this, SLOT(stopScript())); connect(mainWindow->actionQuit, SIGNAL(triggered()), this, SLOT(closing())); connect(mainWindow, SIGNAL(closeEvent_Signal(QCloseEvent*)), this, SLOT(closeEvent(QCloseEvent*))); boardController = new UBBoardController(mainWindow); boardController->init(); webController = new UBWebController(mainWindow); documentController = new UBDocumentController(mainWindow); boardController->paletteManager()->connectToDocumentController(); UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)), boardController->paletteManager(), SLOT(slot_changeMainMode(UBApplicationController::MainMode))); connect(applicationController, SIGNAL(desktopMode(bool)), boardController->paletteManager(), SLOT(slot_changeDesktopMode(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), this, SLOT(stopScript())); #ifndef Q_WS_MAC connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); #else connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized())); #endif mPreferencesController = new UBPreferencesController(mainWindow); connect(mainWindow->actionPreferences, SIGNAL(triggered()), mPreferencesController, SLOT(show())); connect(mainWindow->actionTutorial, SIGNAL(triggered()), applicationController, SLOT(showTutorial())); connect(mainWindow->actionTutorial, SIGNAL(triggered()), this, SLOT(stopScript())); connect(mainWindow->actionSankoreEditor, SIGNAL(triggered()), applicationController, SLOT(showSankoreEditor())); connect(mainWindow->actionCheckUpdate, SIGNAL(triggered()), applicationController, SLOT(checkUpdateRequest())); toolBarPositionChanged(UBSettings::settings()->appToolBarPositionedAtTop->get()); bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool(); mainWindow->actionMultiScreen->setChecked(bUseMultiScreen); connect(mainWindow->actionMultiScreen, SIGNAL(triggered(bool)), applicationController, SLOT(useMultiScreen(bool))); connect(mainWindow->actionWidePageSize, SIGNAL(triggered(bool)), boardController, SLOT(setWidePageSize(bool))); connect(mainWindow->actionRegularPageSize, SIGNAL(triggered(bool)), boardController, SLOT(setRegularPageSize(bool))); connect(mainWindow->actionImportUniboardDocuments, SIGNAL(triggered()), this, SLOT(importUniboardFiles())); connect(mainWindow->actionCut, SIGNAL(triggered()), applicationController, SLOT(actionCut())); connect(mainWindow->actionCopy, SIGNAL(triggered()), applicationController, SLOT(actionCopy())); connect(mainWindow->actionPaste, SIGNAL(triggered()), applicationController, SLOT(actionPaste())); applicationController->initScreenLayout(bUseMultiScreen); boardController->setupLayout(); if (pFileToImport.length() > 0) { UBApplication::applicationController->importFile(pFileToImport); } #if defined(Q_WS_MAC) static AEEventHandlerUPP ub_proc_ae_handlerUPP = AEEventHandlerUPP(ub_appleEventProcessor); AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, ub_proc_ae_handlerUPP, SRefCon(UBApplication::applicationController), true); #endif if (UBSettings::settings()->appStartMode->get() == "Desktop") applicationController->showDesktop(); else applicationController->showBoard(); return QApplication::exec(); }
int main(int argc, char *argv[]) { int i; int rval, ll; struct text *kk; init(); /* Initialize everything */ signal(SIGINT, trapdel); if (argc > 1) { /* Restore file specified */ /* Restart is label 8305 (Fortran) */ i = restore(argv[1]); /* See what we've got */ switch (i) { case 0: /* The restore worked fine */ yea = Start(); k = null; unlink(argv[1]);/* Don't re-use the save */ goto l8; /* Get where we're going */ case 1: /* Couldn't open it */ errx(1, "can't open file"); /* So give up */ case 2: /* Oops -- file was altered */ rspeak(202); /* You dissolve */ exit(2); /* File could be non-adventure */ } /* So don't unlink it. */ } startup(); /* prepare for a user */ for (;;) { /* main command loop (label 2) */ if (newloc < 9 && newloc != 0 && closng) { rspeak(130); /* if closing leave only by */ newloc = loc; /* main office */ if (!panic) clock2 = 15; panic = TRUE; } rval = fdwarf(); /* dwarf stuff */ if (rval == 99) die(99); l2000: if (loc == 0) die(99); /* label 2000 */ kk = &stext[loc]; if ((abb[loc] % abbnum) ==0 || kk->seekadr == 0) kk = <ext[loc]; if (!forced(loc) && dark()) { if (wzdark && pct(35)) { die(90); goto l2000; } kk = &rtext[16]; } l2001: if (toting(bear)) rspeak(141); /* 2001 */ speak(kk); k = 1; if (forced(loc)) goto l8; if (loc == 33 && pct(25) && !closng) rspeak(8); if (!dark()) { abb[loc]++; for (i = atloc[loc]; i != 0; i = linkx[i]) { /*2004*/ obj = i; if (obj > 100) obj -= 100; if (obj == steps && toting(nugget)) continue; if (prop[obj] < 0) { if (closed) continue; prop[obj] = 0; if (obj == rug || obj == chain) prop[obj] = 1; tally--; if (tally == tally2 && tally != 0) if (limit > 35) limit = 35; } ll = prop[obj]; /* 2006 */ if (obj == steps && loc == fixed[steps]) ll = 1; pspeak(obj, ll); } /* 2008 */ goto l2012; l2009: k = 54; /* 2009 */ l2010: spk = k; l2011: rspeak(spk); } l2012: verb = 0; /* 2012 */ obj = 0; l2600: checkhints(); /* to 2600-2602 */ if (closed) { if (prop[oyster] < 0 && toting(oyster)) pspeak(oyster, 1); for (i = 1; i < 100; i++) if (toting(i) && prop[i] < 0) /* 2604 */ prop[i] = -1 - prop[i]; } wzdark = dark(); /* 2605 */ if (knfloc > 0 && knfloc != loc) knfloc = 1; getin(wd1, sizeof(wd1), wd2, sizeof(wd2)); if (delhit) { /* user typed a DEL */ delhit = 0; /* reset counter */ /* pretend he's quitting */ strlcpy(wd1, "quit", sizeof(wd1)); wd2[0] = 0; } l2608: if ((foobar = -foobar) > 0) foobar = 0; /* 2608 */ /* should check here for "magic mode" */ turns++; if (demo && turns >= SHORT) done(1); /* to 13000 */ if (verb == say && wd2[0] != 0) verb = 0; if (verb == say) goto l4090; if (tally == 0 && loc >= 15 && loc != 33) clock1--; if (clock1 == 0) { closing(); /* to 10000 */ goto l19999; } if (clock1 < 0) clock2--; if (clock2 == 0) { caveclose(); /* to 11000 */ continue; /* back to 2 */ } if (prop[lamp] == 1) limit--; if (limit <= 30 && here(batter) && prop[batter] == 0 && here(lamp)) { rspeak(188); /* 12000 */ prop[batter] = 1; if (toting(batter)) drop(batter, loc); limit += 2500; lmwarn = FALSE; goto l19999; } if (limit == 0) { limit = -1; /* 12400 */ prop[lamp] = 0; rspeak(184); goto l19999; } if (limit < 0 && loc <= 8) { rspeak(185); /* 12600 */ gaveup = TRUE; done(2); /* to 20000 */ } if (limit <= 30) { if (lmwarn || !here(lamp)) goto l19999; /*12200*/ lmwarn = TRUE; spk = 187; if (place[batter] == 0) spk = 183; if (prop[batter] == 1) spk = 189; rspeak(spk); } l19999: k = 43; if (liqloc(loc) == water) k = 70; if (weq(wd1, "enter") && (weq(wd2, "strea") || weq(wd2, "water"))) goto l2010; if (weq(wd1, "enter") && *wd2 != 0) goto l2800; if ((!weq(wd1, "water") && !weq(wd1, "oil")) || (!weq(wd2, "plant") && !weq(wd2, "door"))) goto l2610; if (at(vocab(wd2, 1, 0))) strlcpy(wd2, "pour", sizeof(wd2)); l2610: if (weq(wd1, "west")) if (++iwest == 10) rspeak(17); l2630: i = vocab(wd1, -1, 0); if (i== -1) { spk = 60; /* 3000 */ if (pct(20)) spk = 61; if (pct(20)) spk = 13; rspeak(spk); goto l2600; } k = i % 1000; kq = i / 1000 + 1; switch (kq) { case 1: goto l8; case 2: goto l5000; case 3: goto l4000; case 4: goto l2010; default: bug(22); } l8: switch (march()) { case 2: continue; /* i.e. goto l2 */ case 99: die(99); goto l2000; default: bug(110); } l2800: strlcpy(wd1, wd2, sizeof(wd1)); wd2[0] = 0; goto l2610; l4000: verb = k; spk = actspk[verb]; if (wd2[0] != 0 && verb != say) goto l2800; if (verb == say) obj = wd2[0]; if (obj != 0) goto l4090; l4080: switch (verb) { case 1: /* take = 8010 */ if (atloc[loc] == 0 || linkx[atloc[loc]] != 0) goto l8000; for (i = 1; i <= 5; i++) if (dloc[i] == loc && dflag >= 2) goto l8000; obj = atloc[loc]; goto l9010; case 2: case 3: case 9: /* 8000 : drop, say, wave */ case 10: case 16: case 17: /* calm, rub, toss */ case 19: case 21: case 28: /* find, feed, break */ case 29: /* wake */ l8000: printf("%s what?\n", wd1); obj = 0; goto l2600; case 4: case 6: /* 8040 open, lock */ spk = 28; if (here(clam)) obj = clam; if (here(oyster)) obj = oyster; if (at(door)) obj = door; if (at(grate)) obj = grate; if (obj != 0 && here(chain)) goto l8000; if (here(chain)) obj = chain; if (obj == 0) goto l2011; goto l9040; case 5: goto l2009; /* nothing */ case 7: goto l9070; /* on */ case 8: goto l9080; /* off */ case 11: goto l8000; /* walk */ case 12: goto l9120; /* kill */ case 13: goto l9130; /* pour */ case 14: /* eat: 8140 */ if (!here(food)) goto l8000; l8142: dstroy(food); spk = 72; goto l2011; case 15: goto l9150; /* drink */ case 18: /* quit: 8180 */ gaveup = yes(22, 54, 54); if (gaveup) done(2); /* 8185 */ goto l2012; case 20: /* invent = 8200 */ spk = 98; for (i = 1; i <= 100; i++) { if (i != bear && toting(i)) { if (spk == 98) rspeak(99); blklin = FALSE; pspeak(i, -1); blklin = TRUE; spk = 0; } } if (toting(bear)) spk = 141; goto l2011; case 22: goto l9220; /* fill */ case 23: goto l9230; /* blast */ case 24: /* score: 8240 */ scorng = TRUE; printf("If you were to quit now, you would score"); printf(" %d out of a possible ", score()); printf("%d.", mxscor); scorng = FALSE; gaveup = yes(143, 54, 54); if (gaveup) done(2); goto l2012; case 25: /* foo: 8250 */ k = vocab(wd1, 3, 0); spk = 42; if (foobar == 1 - k) goto l8252; if (foobar != 0) spk = 151; goto l2011; l8252: foobar = k; if (k != 4) goto l2009; foobar = 0; if (place[eggs] == plac[eggs] || (toting(eggs) && loc == plac[eggs])) goto l2011; if (place[eggs] == 0 && place[troll] == 0 && prop[troll] == 0) prop[troll] = 1; k = 2; if (here(eggs)) k = 1; if (loc == plac[eggs]) k = 0; move(eggs, plac[eggs]); pspeak(eggs, k); goto l2012; case 26: /* brief = 8260 */ spk = 156; abbnum = 10000; detail = 3; goto l2011; case 27: /* read = 8270 */ if (here(magzin)) obj = magzin; if (here(tablet)) obj = obj * 100 + tablet; if (here(messag)) obj = obj * 100 + messag; if (closed && toting(oyster)) obj = oyster; if (obj > 100 || obj == 0 || dark()) goto l8000; goto l9270; case 30: /* suspend = 8300 */ spk = 201; if (demo) goto l2011; printf("I can suspend your adventure for you so"); printf(" you can resume later, but\n"); printf("you will have to wait at least"); printf(" %d minutes before continuing.", latncy); if (!yes(200, 54, 54)) goto l2012; time(&savet); ciao(); /* Do we quit? */ continue; /* Maybe not */ case 31: /* hours = 8310 */ printf("Colossal cave is closed 9am-5pm Mon "); printf("through Fri except holidays.\n"); goto l2012; default: bug(23); } l4090: switch (verb) { case 1: /* take = 9010 */ l9010: switch (trtake()) { case 2011: goto l2011; case 9220: goto l9220; case 2009: goto l2009; case 2012: goto l2012; default: bug(102); } l9020: case 2: /* drop = 9020 */ switch (trdrop()) { case 2011: goto l2011; case 19000: done(3); case 2012: goto l2012; default: bug(105); } l9030: case 3: switch (trsay()) { case 2012: goto l2012; case 2630: goto l2630; default: bug(107); } l9040: case 4: case 6: /* open, close */ switch (tropen()) { case 2011: goto l2011; case 2010: goto l2010; default: bug(106); } case 5: goto l2009; /* nothing */ case 7: /* on 9070 */ l9070: if (!here(lamp)) goto l2011; spk = 184; if (limit < 0) goto l2011; prop[lamp] = 1; rspeak(39); if (wzdark) goto l2000; goto l2012; case 8: /* off */ l9080: if (!here(lamp)) goto l2011; prop[lamp] = 0; rspeak(40); if (dark()) rspeak(16); goto l2012; case 9: /* wave */ if ((!toting(obj)) && (obj != rod || !toting(rod2))) spk = 29; if (obj != rod || !at(fissur)||!toting(obj) || closng) goto l2011; prop[fissur] = 1-prop[fissur]; pspeak(fissur, 2-prop[fissur]); goto l2012; case 10: case 11: case 18: /* calm, walk, quit */ case 24: case 25: case 26: /* score, foo, brief */ case 30: case 31: /* suspend, hours */ goto l2011; l9120: case 12: /* kill */ switch (trkill()) { case 8000: goto l8000; case 8: goto l8; case 2011: goto l2011; case 2608: goto l2608; case 19000: done(3); default: bug(112); } l9130: case 13: /* pour */ if (obj == bottle || obj == 0) obj = liq(); if (obj == 0) goto l8000; if (!toting(obj)) goto l2011; spk = 78; if (obj != oil && obj != water) goto l2011; prop[bottle] = 1; place[obj] = 0; spk = 77; if (!(at(plant) || at(door))) goto l2011; if (at(door)) { prop[door] = 0; /* 9132 */ if (obj == oil) prop[door] = 1; spk = 113 + prop[door]; goto l2011; } spk = 112; if (obj != water) goto l2011; pspeak(plant, prop[plant] + 1); prop[plant] = (prop[plant] + 2) % 6; prop[plant2] = prop[plant] / 2; k = null; goto l8; case 14: /* 9140 - eat */ if (obj == food) goto l8142; if (obj == bird || obj == snake || obj == clam || obj == oyster || obj == dwarf || obj == dragon || obj == troll || obj == bear) spk = 71; goto l2011; l9150: case 15: /* 9150 - drink */ if (obj == 0 && liqloc(loc) != water && (liq() != water || !here(bottle))) goto l8000; if (obj != 0 && obj != water) spk = 110; if (spk == 110 || liq() != water || !here(bottle)) goto l2011; prop[bottle] = 1; place[water] = 0; spk = 74; goto l2011; case 16: /* 9160: rub */ if (obj != lamp) spk = 76; goto l2011; case 17: /* 9170: throw */ switch (trtoss()) { case 2011: goto l2011; case 9020: goto l9020; case 9120: goto l9120; case 8: goto l8; case 9210: goto l9210; default: bug(113); } case 19: case 20: /* 9190: find, invent */ if (at(obj) || (liq() == obj && at(bottle)) || k == liqloc(loc)) spk = 94; for (i = 1; i <= 5; i++) if (dloc[i] == loc && dflag >= 2 && obj == dwarf) spk = 94; if (closed) spk = 138; if (toting(obj)) spk = 24; goto l2011; l9210: case 21: /* feed */ switch (trfeed()) { case 2011: goto l2011; default: bug(114); } l9220: case 22: /* fill */ switch (trfill()) { case 2011: goto l2011; case 8000: goto l8000; case 9020: goto l9020; default: bug(115); } l9230: case 23: /* blast */ if (prop[rod2] < 0 || !closed) goto l2011; bonus = 133; if (loc == 115) bonus = 134; if (here(rod2)) bonus = 135; rspeak(bonus); done(2); l9270: case 27: /* read */ if (dark()) goto l5190; if (obj == magzin) spk = 190; if (obj == tablet) spk = 196; if (obj == messag) spk = 191; if (obj == oyster && hinted[2] && toting(oyster)) spk = 194; if (obj != oyster || hinted[2] || !toting(oyster) || !closed) goto l2011; hinted[2] = yes(192, 193, 54); goto l2012; l9280: case 28: /* break */ if (obj == mirror) spk = 148; if (obj == vase && prop[vase] == 0) { spk = 198; if (toting(vase)) drop(vase, loc); prop[vase] = 2; fixed[vase] = -1; goto l2011; } if (obj != mirror||!closed) goto l2011; rspeak(197); done(3); l9290: case 29: /* wake */ if (obj != dwarf||!closed) goto l2011; rspeak(199); done(3); default: bug(24); } l5000: obj = k; if (fixed[k] != loc && !here(k)) goto l5100; l5010: if (wd2[0] != 0) goto l2800; if (verb != 0) goto l4090; printf("What do you want to do with the %s?\n", wd1); goto l2600; l5100: if (k != grate) goto l5110; if (loc == 1 || loc == 4 || loc == 7) k = dprssn; if (loc > 9 && loc < 15) k = entrnc; if (k != grate) goto l8; l5110: if (k != dwarf) goto l5120; for (i = 1; i <= 5; i++) if (dloc[i] == loc && dflag >= 2) goto l5010; l5120: if ((liq() == k && here(bottle)) || k == liqloc(loc)) goto l5010; if (obj != plant || !at(plant2) || prop[plant2] == 0) goto l5130; obj = plant2; goto l5010; l5130: if (obj != knife || knfloc != loc) goto l5140; knfloc = -1; spk = 116; goto l2011; l5140: if (obj != rod || !here(rod2)) goto l5190; obj = rod2; goto l5010; l5190: if ((verb == find || verb == invent) && wd2[0] == 0) goto l5010; printf("I see no %s here\n", wd1); goto l2012; } }
void crearExamenes::isClosing() { emit closing(); }
void crearExamenes::on_pushButton_clicked() { emit closing(); ui->treeWidget->clear(); this->close(); }
void OscarEncodingSelectionDialog::slotOk() { emit closing( QDialog::Accepted ); }
void ShortcutConfig::closeEvent(QCloseEvent* /*e*/) // prevent compiler warning : unused variable { closing(); }
///////////////////////////////////////////////////// // Handle a protocol level packet. This could be either a top-level // EQUDPIPPacket or a subpacket that is just an EQProtocolPacket. Either way // we use net opcodes here. void EQPacketStream::processPacket(EQProtocolPacket& packet, bool /*isSubpacket*/) { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("-->EQPacketStream::processPacket, subpacket=%s on stream %s (%d)", (isSubpacket ? "true" : "false"), EQStreamStr[m_streamid], m_streamid); #endif if (IS_APP_OPCODE(packet.getNetOpCode())) { // This is an app-opcode directly on the wire with no wrapping protocol // information. Weird, but whatever gets the stream read, right? dispatchPacket(packet.payload(), packet.payloadLength(), packet.getNetOpCode(), m_opcodeDB.find(packet.getNetOpCode())); return; } // Process the net opcode switch (packet.getNetOpCode()) { case OP_Combined: { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: found combined packet (net op: %04x, size %d) on stream %s (%d). Unrolling.", packet.getNetOpCode(), packet.payloadLength(), EQStreamStr[m_streamid], m_streamid); #endif // Rolled up multiple packets inside this packet. Need to unroll them // and process them individually. subpacket starts after the net opcode. uint8_t* subpacket = packet.payload(); while (subpacket < packet.payload() + packet.payloadLength()) { // Length specified first on the wire. uint8_t subpacketLength = subpacket[0]; // Move past the length subpacket++; // OpCode (in net order) uint16_t subOpCode = *(uint16_t*)subpacket; #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: unrolling length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // Opcode is next. Net opcode or app opcode? if (subOpCode == 0) { // App opcode < 0x00ff. Skip the first byte and dispatch the app // opcode appropriately subpacket++; subOpCode = *(uint16_t*)subpacket; #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: processing unrolled special app opcode, length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength-3, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // App opcode. Dispatch it, skipping opcode. dispatchPacket(&subpacket[2], subpacketLength-2, subOpCode, m_opcodeDB.find(subOpCode)); } else if (IS_NET_OPCODE(subOpCode)) { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: processing unrolled net opcode, length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // Net opcode. false = copy. true = subpacket EQProtocolPacket spacket(subpacket, subpacketLength, false, true); processPacket(spacket, true); } else { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: processing unrolled app opcode, length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength-2, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // App opcode. Dispatch it, skipping opcode. dispatchPacket(&subpacket[2], subpacketLength-2, subOpCode, m_opcodeDB.find(subOpCode)); } subpacket += subpacketLength; } } break; case OP_AppCombined: { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: found appcombined packet (net op: %04x, size %d) on stream %s (%d). Unrolling.", packet.getNetOpCode(), packet.payloadLength(), EQStreamStr[m_streamid], m_streamid); #endif // Multiple app op codes in the same packet. Need to unroll and dispatch // them. uint8_t* subpacket = packet.payload(); while (subpacket < packet.payload() + packet.payloadLength()) { // Length specified first on the wire. uint8_t subpacketLength = subpacket[0]; // Move past the length subpacket++; if (subpacketLength != 0xff) { // Dispatch app op code using given packet length. Net order! uint16_t subOpCode = *(uint16_t*)(subpacket); // Handle 3 byte opcodes properly if (subOpCode == 0) { // 3 byte opcode. Drop the first byte, opcode is byte 2 and 3 subpacket++; subpacketLength--; subOpCode = *(uint16_t*)(subpacket); } #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: unrolling length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength, EQStreamStr[m_streamid], m_streamid, subOpCode); seqDebug("EQPacket: processing unrolled app opcode, length %d bytes from combined packet on stream %s (%d). Opcode %04x", subpacketLength-2, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // Dispatch, skipping op code. dispatchPacket(&subpacket[2], subpacketLength-2, subOpCode, m_opcodeDB.find(subOpCode)); // Move ahead subpacket += subpacketLength; } else { // If original length is 0xff, it means it is a long one. The length // is 2 bytes and next. uint16_t longOne = eqntohuint16(subpacket); // Move past the 2 byte length subpacket += 2; // OpCode next. Net order for op codes. uint16_t subOpCode = *(uint16_t*)subpacket; // Handle 3 byte opcodes properly if (subOpCode == 0) { // 3 byte opcode. Drop the first byte, opcode is byte 2 and 3 subpacket++; longOne--; subOpCode = *(uint16_t*)(subpacket); } #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: unrolling length %d bytes from combined packet on stream %s (%d). Opcode %04x", longOne, EQStreamStr[m_streamid], m_streamid, subOpCode); seqDebug("EQPacket: processing unrolled app opcode, length %d bytes from combined packet on stream %s (%d). Opcode %04x", longOne-2, EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // Dispatch, skipping op code. dispatchPacket(&subpacket[2], longOne-2, subOpCode, m_opcodeDB.find(subOpCode)); // Move ahead subpacket += longOne; } } } break; case OP_Packet: { // Normal unfragmented sequenced packet. uint16_t seq = packet.arqSeq(); emit seqReceive(seq, (int)m_streamid); // Future packet? if (seq == m_arqSeqExp) { // Expected packet. m_arqSeqExp++; emit seqExpect(m_arqSeqExp, (int)m_streamid); // OpCode next. Net order for op codes. uint16_t subOpCode = *(uint16_t*)(packet.payload()); #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 1) seqDebug("SEQ: Found next sequence number in data stream %s (%d), incrementing expected seq, %04x (op code %04x, sub opcode %04x)", EQStreamStr[m_streamid], m_streamid, seq, packet.getNetOpCode(), subOpCode); #endif // Opcode is next. Net opcode or app opcode? if (subOpCode == 0) { // App opcode < 0x00ff. Skip the first byte and dispatch the app // opcode appropriately subOpCode = *(uint16_t*)&packet.payload()[1]; #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 1) seqDebug("EQPacket: special app opcode extracted for opcode 0000 on stream %s (%d). Opcode %04x", EQStreamStr[m_streamid], m_streamid, subOpCode); #endif // App opcode. Dispatch it, skipping opcode. dispatchPacket(&packet.payload()[3], packet.payloadLength()-3, subOpCode, m_opcodeDB.find(subOpCode)); } else if (IS_NET_OPCODE(subOpCode)) { // Net opcode. false = no copy. true = subpacket. EQProtocolPacket spacket(packet.payload(), packet.payloadLength(), false, true); processPacket(spacket, true); } else { // App opcode. Dispatch, skipping opcode. dispatchPacket(&packet.payload()[2], packet.payloadLength()-2, subOpCode, m_opcodeDB.find(subOpCode)); } } else if ((seq > m_arqSeqExp && seq < (uint32_t(m_arqSeqExp + arqSeqWrapCutoff))) || seq < (int32_t(m_arqSeqExp) - arqSeqWrapCutoff)) { // Yeah, future packet. Push it on the packet cache. #ifdef PACKET_PROCESS_DIAG seqDebug("SEQ: out of order sequence %04x stream %s (%d) expecting %04x, sending to cache, %04d", seq, EQStreamStr[m_streamid], m_streamid, m_arqSeqExp, m_cache.size()); #endif setCache(seq, packet); } else { #ifdef PACKET_PROCESS_DIAG // Past packet outside the cut off seqWarn("SEQ: received sequenced %spacket outside expected window on stream %s (%d) netopcode=%04x size=%d. Expecting seq=%04x got seq=%04x, window size %d, dropping packet as in the past.", (isSubpacket ? "sub" : ""), EQStreamStr[m_streamid], m_streamid, packet.getNetOpCode(), packet.payloadLength(), m_arqSeqExp, seq, arqSeqWrapCutoff); #endif } } break; case OP_Oversized: { // Fragmented sequenced data packet. uint16_t seq = packet.arqSeq(); emit seqReceive(seq, (int)m_streamid); // Future packet? if (seq == m_arqSeqExp) { // Expected packet. m_arqSeqExp++; emit seqExpect(m_arqSeqExp, (int)m_streamid); #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 1) seqDebug("SEQ: Found next sequence number in data stream %s (%d), incrementing expected seq, %04x (op code %04x)", EQStreamStr[m_streamid], m_streamid, seq, packet.getNetOpCode()); #endif // Push the fragment on. m_fragment.addFragment(packet); if (m_fragment.isComplete()) { // OpCode from fragment. In network order. uint16_t fragOpCode = *(uint16_t*)(m_fragment.data()); #ifdef PACKET_PROCESS_DIAG seqDebug("SEQ: Completed oversized app packet on stream %s with seq %04x, total size %d opcode %04x", EQStreamStr[m_streamid], seq, m_fragment.size()-2, fragOpCode); #endif // dispatch fragment. Skip opcode. if (fragOpCode == 0) { // Special app opcode. Skip first byte and op is byte 2 and 3. fragOpCode = *(uint16_t*)(&m_fragment.data()[1]); #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 1) seqDebug("EQPacket: special app opcode on completed fragment for opcode 0000 on stream %s (%d). Opcode %04x", EQStreamStr[m_streamid], m_streamid, fragOpCode); #endif dispatchPacket(&m_fragment.data()[3], m_fragment.size()-3, fragOpCode, m_opcodeDB.find(fragOpCode)); } else { dispatchPacket(&m_fragment.data()[2], m_fragment.size()-2, fragOpCode, m_opcodeDB.find(fragOpCode)); } m_fragment.reset(); } } else if ((seq > m_arqSeqExp && seq < (uint32_t(m_arqSeqExp + arqSeqWrapCutoff))) || seq < (int32_t(m_arqSeqExp) - arqSeqWrapCutoff)) { // Yeah, future packet. Push it on the packet cache. #ifdef PACKET_PROCESS_DIAG seqDebug("SEQ: out of order sequence %04x stream %s (%d) expecting %04x, sending to cache, %04d", seq, EQStreamStr[m_streamid], m_streamid, m_arqSeqExp, m_cache.size()); #endif setCache(seq, packet); } else { #ifdef PACKET_PROCESS_DIAG // Past packet outside the cut off seqWarn("SEQ: received sequenced %spacket outside expected window on stream %s (%d) netopcode=%04x size=%d. Expecting seq=%04x got seq=%04x, window size %d, dropping packet as in the past.", (isSubpacket ? "sub" : ""), EQStreamStr[m_streamid], m_streamid, packet.getNetOpCode(), packet.payloadLength(), m_arqSeqExp, seq, arqSeqWrapCutoff); #endif } } break; case OP_SessionRequest: { // Session request from client to server. // // Sanity check the size. Don't assume any packet we see is an EQ // session request, since we're gonna cause a huge freakin' malloc // on the maxlength of the session which for some reason some people // won't enjoy! if (packet.payloadLength() != sizeof(SessionRequestStruct)) { // Either SessionRequestStruct changed or this isn't a session // request. #if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: Ignoring SessionRequest %s:%u->%s:%u with invalid size %d.", ((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(), ((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getIPv4DestA().ascii(), ((EQUDPIPPacketFormat&) packet).getDestPort(), packet.payloadLength()); #endif break; } // Pull off session request information SessionRequestStruct* request = (SessionRequestStruct*) packet.payload(); m_sessionId = eqntohuint32((uint8_t*)&(request->sessionId)); m_maxLength = eqntohuint32((uint8_t*)&(request->maxLength)); // Sanity check the max length requested if (m_maxLength > maxPacketSize) { seqWarn("EQPacket: SessionRequest wanted a max packet size of %d which is above our sane max packet size of %d. Using our max", m_maxLength, maxPacketSize); m_maxLength = maxPacketSize; } emit maxLength((int) m_maxLength, (int) m_streamid); #if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: SessionRequest found, resetting expected seq, stream %s (%d) (session tracking %s)", EQStreamStr[m_streamid], m_streamid, (m_session_tracking_enabled == 2 ? "locked on" : (m_session_tracking_enabled == 1 ? "enabled" : "disabled"))); #endif #if defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: SessionRequest %s:%u->%s:%u, sessionId %u maxLength %u, awaiting key for stream %s (%d)", ((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(), ((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getIPv4DestA().ascii(), ((EQUDPIPPacketFormat&) packet).getDestPort(), m_sessionId, m_maxLength, EQStreamStr[m_streamid], m_streamid); #endif #if defined(PACKET_SESSION_DIAG) && (PACKET_SESSION_DIAG > 1) seqDebug("EQPacket: SessionRequest contents: unknown %u, sessionId %u, maxLength %u", eqntohuint32((uint8_t*)&(request->unknown0000)), m_sessionId, m_maxLength); #endif #if defined(PACKET_SESSION_DIAG) && (PACKET_SESSION_DIAG > 2) seqDebug("EQPacket: Raw SessionRequest: %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x", packet.payload()[0], packet.payload()[1], packet.payload()[2], packet.payload()[3], packet.payload()[4], packet.payload()[5], packet.payload()[6], packet.payload()[7], packet.payload()[8], packet.payload()[9], packet.payload()[10], packet.payload()[11]); #endif m_arqSeqExp = 0; m_arqSeqFound = true; if (m_session_tracking_enabled) { // Save off client port for the stream so we can match against it // later. SessionRequest should always be an outer protocol packet // so we can cast it to EQUDPIPPacketFormat to get the ip headers. m_sessionClientPort = ((EQUDPIPPacketFormat&) packet).getSourcePort(); } } break; case OP_SessionResponse: { // Session response from server // Sanity check the size. Don't assume any packet we see is an EQ // session response, since we're gonna cause a huge freakin' malloc // on the maxlength of the session which for some reason some people // won't enjoy! if (packet.payloadLength() != sizeof(SessionResponseStruct)) { // Either SessionResponseStruct changed or this isn't a session // response. #if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: Ignoring SessionResponse %s:%u->%s:%u with invalid size %d.", ((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(), ((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getIPv4DestA().ascii(), ((EQUDPIPPacketFormat&) packet).getDestPort(), packet.payloadLength()); #endif break; } // Pull off session response information SessionResponseStruct* response = (SessionResponseStruct*) packet.payload(); m_maxLength = eqntohuint32((uint8_t*)&(response->maxLength)); m_sessionKey = eqntohuint32((uint8_t*)&(response->key)); m_sessionId = eqntohuint32((uint8_t*)&(response->sessionId)); // Sanity check the max length requested if (m_maxLength > maxPacketSize) { seqWarn("EQPacket: SessionResponse wanted a max packet size of %d which is above our sane max packet size of %d. Using our max", m_maxLength, maxPacketSize); m_maxLength = maxPacketSize; } emit maxLength((int) m_maxLength, (int) m_streamid); #if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: SessionResponse found %s:%u->%s:%u, resetting expected seq, stream %s (%d) (session tracking %s)", ((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(), ((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getIPv4DestA().ascii(), ((EQUDPIPPacketFormat&) packet).getDestPort(), EQStreamStr[m_streamid], m_streamid, (m_session_tracking_enabled == 2 ? "locked on" : (m_session_tracking_enabled == 1 ? "enabled" : "disabled"))); #endif #if defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: SessionResponse sessionId %u maxLength %u, key is %u for stream %s (%d)", m_sessionId, m_maxLength, m_sessionKey, EQStreamStr[m_streamid], m_streamid); #endif #if defined(PACKET_SESSION_DIAG) && (PACKET_SESSION_DIAG > 1) seqDebug("EQPacket: SessionResponse contents: sessionId %u, key %u, unknown %u, unknown %u, maxLength %u, unknown %u", m_sessionId, m_sessionKey, eqntohuint16((uint8_t*)&(response->unknown0008)), response->unknown0010, m_maxLength, eqntohuint32((uint8_t*) &(response->unknown0015))); #endif #if defined(PACKET_SESSION_DIAG) && (PACKET_SESSION_DIAG > 2) seqDebug("EQPacket: Raw SessionResponse: %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x", packet.payload()[0], packet.payload()[1], packet.payload()[2], packet.payload()[3], packet.payload()[4], packet.payload()[5], packet.payload()[6], packet.payload()[7], packet.payload()[8], packet.payload()[9], packet.payload()[10], packet.payload()[11], packet.payload()[12], packet.payload()[13], packet.payload()[14], packet.payload()[15], packet.payload()[16], packet.payload()[17], packet.payload()[18]); #endif // Provide key to corresponding stream from this session/stream emit sessionKey(m_sessionId, m_streamid, m_sessionKey); m_arqSeqExp = 0; m_arqSeqFound = true; // Session tracking if (m_session_tracking_enabled) { // Save off client port for the stream so we can match against it // later. SessionRequest should always be an outer protocol packet // so we can cast it to EQUDPIPPacketFormat to get the ip headers. m_sessionClientPort = ((EQUDPIPPacketFormat&) packet).getDestPort(); // If this is the world server talking to us, reset session tracking if // it is on so we unlatch the client in case of getting kicked. if (m_streamid == world2client) { m_session_tracking_enabled = 1; emit sessionTrackingChanged(m_session_tracking_enabled); } // If this is the zone server talking to us, close the latch and lock else if (m_streamid == zone2client) { // SessionResponse should always be an outer protocol packet, so // the EQProtocolPacket passed in can be cast back to // EQUDPIPPacketFormat, which we need to go to get access to the IP // headers! m_session_tracking_enabled = 2; emit lockOnClient(((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getDestPort()); emit sessionTrackingChanged(m_session_tracking_enabled); } } } break; case OP_SessionDisconnect: { #if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG) seqDebug("EQPacket: SessionDisconnect found %s:%u->%s:%u, resetting expected seq, stream %s (%d) (session tracking %s)", ((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(), ((EQUDPIPPacketFormat&) packet).getSourcePort(), ((EQUDPIPPacketFormat&) packet).getIPv4DestA().ascii(), ((EQUDPIPPacketFormat&) packet).getDestPort(), EQStreamStr[m_streamid], m_streamid, (m_session_tracking_enabled == 2 ? "locked on" : (m_session_tracking_enabled == 1 ? "enabled" : "disabled"))); #endif #if defined(PACKET_SESSION_DIAG) && (PACKET_SESSION_DIAG > 2) seqDebug("EQPacket: Raw SessionDisconnect: %02x%02x %02x%02x %02x%02x %02x%02x", packet.payload()[0], packet.payload()[1], packet.payload()[2], packet.payload()[3], packet.payload()[4], packet.payload()[5], packet.payload()[6], packet.payload()[7]); #endif m_arqSeqExp = 0; // Clear cache resetCache(); // Signal closing. Unlatch session tracking if it is on. if (m_session_tracking_enabled) { m_session_tracking_enabled = 1; emit sessionTrackingChanged(m_session_tracking_enabled); m_sessionClientPort = 0; } emit closing(m_sessionId, m_streamid); } break; case OP_Ack: case OP_AckFuture: case OP_AckAfterDisconnect: { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: no-op on ACK for net opcode %04x seq %04x, stream %s (%d)", packet.getNetOpCode(), eqntohuint16(packet.payload()), EQStreamStr[m_streamid], m_streamid); #endif } break; case OP_KeepAlive: case OP_SessionStatRequest: case OP_SessionStatResponse: { #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 2) seqDebug("EQPacket: no-op on stats for net opcode %04x, stream %s (%d)", packet.getNetOpCode(), EQStreamStr[m_streamid], m_streamid); #endif } break; default : { seqWarn("EQPacket: Unhandled net opcode %04x, stream %s, size %d", packet.getNetOpCode(), EQStreamStr[m_streamid], packet.payloadLength()); } } }
void WidgetContainer::onChildCloseCanceled(Widget &child) { if (closing()) cancelClosing(); }
void administrador::on_toolButton_clicked() { emit closing(); this->close(); }
void OscarEncodingSelectionDialog::slotCancel() { emit closing( QDialog::Rejected ); }
void MasterPasswordDialog::closeEvent(QCloseEvent *e) { if (e->spontaneous()) { emit closing(); } }
///////////////////////////////////////////////////////// // Connect the given stream's signals to the proper slots void EQPacket::connectStream(EQPacketStream* stream) { // Packet logging switch (stream->streamID()) { case zone2client: case client2zone: { // Zone server stream connect(stream, SIGNAL(rawPacket(const uint8_t*, size_t, uint8_t, uint16_t)), this, SIGNAL(rawZonePacket(const uint8_t*, size_t, uint8_t, uint16_t))); connect(stream, SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)), this, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*))); connect(stream, SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)), this, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool))); } break; case world2client: case client2world: { // World server stream connect(stream, SIGNAL(rawPacket(const uint8_t*, size_t, uint8_t, uint16_t)), this, SIGNAL(rawWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t))); connect(stream, SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)), this, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*))); connect(stream, SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)), this, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool))); } break; default : { return; } } // Debugging connect(stream, SIGNAL(cacheSize(int, int)), this, SIGNAL(cacheSize(int, int))); connect(stream, SIGNAL(seqReceive(int, int)), this, SIGNAL(seqReceive(int, int))); connect(stream, SIGNAL(seqExpect(int, int)), this, SIGNAL(seqExpect(int, int))); connect(stream, SIGNAL(numPacket(int, int)), this, SIGNAL(numPacket(int, int))); // Session handling connect(stream, SIGNAL(sessionTrackingChanged(uint8_t)), this, SIGNAL(sessionTrackingChanged(uint8_t))); connect(stream, SIGNAL(lockOnClient(in_port_t, in_port_t)), this, SLOT(lockOnClient(in_port_t, in_port_t))); connect(stream, SIGNAL(closing(uint32_t, EQStreamID)), this, SLOT(closeStream(uint32_t, EQStreamID))); connect(stream, SIGNAL(sessionKey(uint32_t, EQStreamID, uint32_t)), this, SLOT(dispatchSessionKey(uint32_t, EQStreamID, uint32_t))); connect(stream, SIGNAL(maxLength(int, int)), this, SIGNAL(maxLength(int, int))); }
// This signal is used to make a connection between the closure of the align dialog and the end of the editing in the GLArea void AlignDialog::closeEvent ( QCloseEvent * /*event*/ ) { emit closing(); }
void reEditor::shutdown() { emit closing(); }
// NOTE: closeEvent was not being called when Esc was pressed, despite the implication that // it should in the Qt help ("close event can't be ignored"). So this is a workaround, // and the 'recommended' way according to forums. void ShortcutConfig::reject() { closing(); QDialog::reject(); }
void PictureWidget::closeEvent(QCloseEvent *evt) { emit closing(); }
void EventVisualizerWindow:: closeEvent(QCloseEvent *ev) { emit closing(); ev->accept(); }
void ShortcutConfig::applyAll() { applyButton->setDown(false); closing(); // Just call closing to store everything, and don't close. }
void rgbForm::closeEvent(QCloseEvent *) { emit closing(); }
static int inet_release(struct socket *sock, struct socket *peer) { struct sock *sk = (struct sock *) sock->data; if (sk == NULL) return(0); /* BSD 套接字层sock_release函数会调用inet_release() * 调用之前修改了sock的状态sock->state = SS_DISCONNECTING */ sk->state_change(sk); // def_callback1() 通知sock状态变化 /* Start closing the connection. This may take a while. */ #ifdef CONFIG_IP_MULTICAST /* Applications forget to leave groups before exiting */ ip_mc_drop_socket(sk); #endif /* * If linger is set, we don't return until the close * is complete. Otherwise we return immediately. The * actually closing is done the same either way. * * If the close is due to the process exiting, we never * linger.. 如果因为进程退出而释放套接字,将不会等待,直接返回 */ if (sk->linger == 0 || (current->flags & PF_EXITING)) { sk->prot->close(sk,0); sk->dead = 1; } else { sk->prot->close(sk, 0); cli(); if (sk->lingertime) current->timeout = jiffies + HZ*sk->lingertime; while(closing(sk) && current->timeout>0) { interruptible_sleep_on(sk->sleep); if (current->signal & ~current->blocked) { break; #if 0 /* not working now - closes can't be restarted */ sti(); current->timeout=0; return(-ERESTARTSYS); #endif } } current->timeout=0; sti(); sk->dead = 1; } sk->inuse = 1; /* This will destroy it. */ sock->data = NULL; release_sock(sk); sk->socket = NULL; return(0); }