static LONG WINAPI unhandledExceptionHandler(LPEXCEPTION_POINTERS info) { if (!g_is_crash_reporting_enabled) return EXCEPTION_CONTINUE_SEARCH; struct CrashInfo { LPEXCEPTION_POINTERS info; DWORD thread_id; }; auto dumper = [](void* data) -> DWORD { auto info = ((CrashInfo*)data)->info; char message[4096]; getStack(*info->ContextRecord, message, sizeof(message)); messageBox(message); char minidump_path[Lumix::MAX_PATH_LENGTH]; GetCurrentDirectory(sizeof(minidump_path), minidump_path); Lumix::catString(minidump_path, "\\minidump.dmp"); HANDLE process = GetCurrentProcess(); DWORD process_id = GetProcessId(process); HANDLE file = CreateFile( minidump_path, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); MINIDUMP_TYPE minidump_type = (MINIDUMP_TYPE)( MiniDumpWithFullMemoryInfo | MiniDumpFilterMemory | MiniDumpWithHandleData | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules); MINIDUMP_EXCEPTION_INFORMATION minidump_exception_info; minidump_exception_info.ThreadId = ((CrashInfo*)data)->thread_id; minidump_exception_info.ExceptionPointers = info; minidump_exception_info.ClientPointers = FALSE; MiniDumpWriteDump(process, process_id, file, minidump_type, info ? &minidump_exception_info : nullptr, nullptr, nullptr); CloseHandle(file); SendFile("Lumix Studio crash", "SMTP:[email protected]", "Lumix Studio", message, minidump_path); minidump_type = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithFullMemoryInfo | MiniDumpFilterMemory | MiniDumpWithHandleData | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules); file = CreateFile( "fulldump.dmp", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); MiniDumpWriteDump(process, process_id, file, minidump_type, info ? &minidump_exception_info : nullptr, nullptr, nullptr); CloseHandle(file); return 0; }; DWORD thread_id; CrashInfo crash_info = { info, GetCurrentThreadId() }; auto handle = CreateThread(0, 0x8000, dumper, &crash_info, 0, &thread_id); WaitForSingleObject(handle, INFINITE); return EXCEPTION_CONTINUE_SEARCH; }
MRESULT EXPENTRY specialOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { CWDataFolder* thisPtr; ULONG ulFlags; LONG lSpinValue; static HWND hwndStatus; int a; char chrCD[4]; char text[CCHMAXPATH]; char title[CCHMAXPATH]; char text2[40]; ULONG rc; THISPTR thisPtrStruct; switch(msg) { case WM_INITDLG : WinSetWindowULong(hwnd, QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr. thisPtr=(CWDataFolder*)PVOIDFROMMP(mp2); if(somIsObj(thisPtr)) { ulFlags=((CWDataFolder*)PVOIDFROMMP(mp2))->cwQueryMkisofsFlags(); if(ulFlags & IDMK_SHADOWSINROOTONLY) { WinCheckButton(hwnd,IDRB_SHADOWSINROOTONLY,1); enableArchiveCntrls(hwnd, FALSE); } else { WinCheckButton(hwnd,IDRB_FOLLOWALLSHADOWS,1); enableArchiveCntrls(hwnd, TRUE); } /* Use archive bit */ if(ulFlags & IDMK_USEARCHIVEBIT) WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 1); else WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 0); /* Reset archive bit */ if(ulFlags & IDMK_RESETARCHIVEBIT) WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT,1); else WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT, 0); } /* Move default buttons on Warp 4 */ cwMoveNotebookButtonsWarp4(hwnd, IDPB_SPECIALHELP, 20); return (MRESULT) TRUE; /* This prevents switching the notebook page behind the open folder */ case WM_WINDOWPOSCHANGED: { MRESULT mr; if(WinQueryFocus(HWND_DESKTOP)!= WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) { mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/ mr=WinDefDlgProc(hwnd, msg, mp1, mp2); return mr; } break; } case WM_FOCUSCHANGE: { if(!SHORT1FROMMP(mp2)) { if(HWNDFROMMP(mp1)==hwnd) { MRESULT mr; mr=WinDefDlgProc(hwnd, msg, mp1, mp2); WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE); return mr; } } break; } case WM_DESTROY: /* The notebook closes and gets destroyed */ /* Set focus to desktop to prevent PM freeze */ WinSetFocus(HWND_DESKTOP, HWND_DESKTOP); /* Let the WPS save the new instance data */ // thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_SPECIALUNDO),QWL_USER); thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER); if(somIsObj(thisPtr)) { ulFlags=thisPtr->cwQueryMkisofsFlags(); if(WinQueryButtonCheckstate(hwnd,IDRB_SHADOWSINROOTONLY) & 1) { ulFlags|=IDMK_SHADOWSINROOTONLY; } else ulFlags&=~IDMK_SHADOWSINROOTONLY; /* Use archive bit */ if(WinQueryButtonCheckstate(hwnd, IDCB_USEARCHIVEBIT) & 1) { ulFlags|=IDMK_USEARCHIVEBIT; } else ulFlags&=~IDMK_USEARCHIVEBIT; /* Reset archive bit */ if(WinQueryButtonCheckstate(hwnd, IDCB_RESETARCHIVEBIT) & 1) { ulFlags|=IDMK_RESETARCHIVEBIT; } else ulFlags&=~IDMK_RESETARCHIVEBIT; thisPtr->cwSetMkisofsFlags(ulFlags,MK_ALLFLAGS); thisPtr->wpSaveImmediate(); } /* Setup is done */ return (MRESULT) FALSE; case WM_CONTROL: switch(SHORT1FROMMP(mp1)) { case IDRB_SHADOWSINROOTONLY: enableArchiveCntrls(hwnd, FALSE); break; case IDRB_FOLLOWALLSHADOWS: enableArchiveCntrls(hwnd, TRUE); break; default: break; } break; case WM_COMMAND: //thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_SPECIALUNDO),QWL_USER); thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER); if(!somIsObj(thisPtr)) return (MRESULT) TRUE; switch(SHORT1FROMMP(mp1)) { case IDPB_SPECIALUNDO: /* User pressed the UNDO button */ ulFlags=thisPtr->cwQueryMkisofsFlags(); if(ulFlags & IDMK_SHADOWSINROOTONLY) WinCheckButton(hwnd,IDRB_SHADOWSINROOTONLY,1); else WinCheckButton(hwnd, IDRB_FOLLOWALLSHADOWS,1); /* Use archive bit */ if(ulFlags & IDMK_USEARCHIVEBIT) WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 1); else WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 0); /* Reset archive bit */ if(ulFlags & IDMK_RESETARCHIVEBIT) WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT,1); else WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT, 0); break; case IDPB_SPECIALHELP: thisPtr->wpDisplayHelp(IDHLP_DATAFOLDERSPECIAL,AFHELPLIBRARY); break; case IDPB_RESETNOW: /* Text: "" Title: "" */ rc=messageBox( text, IDSTRD_RESETARCHIVEBITCONFIRM , sizeof(text), title, IDSTRD_RESETARCHIVEBITTITLE, sizeof(title), hDataResource, HWND_DESKTOP, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE | MB_DEFBUTTON2); if(rc==MBID_YES) DosBeep(5000,1000); break; default: break; } return (MRESULT) TRUE; default: break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); }
void InterpreterContext::report (const std::string& message) { messageBox (message); }
void ccGraphicalSegmentationTool::doExportSegmentationPolyline() { MainWindow* mainWindow = MainWindow::TheInstance(); if (mainWindow && m_segmentationPoly) { QMessageBox messageBox(0); messageBox.setWindowTitle("Choose export type"); messageBox.setText("Export polyline in:\n - 2D (with coordinates relative to the screen)\n - 3D (with coordinates relative to the segmented entities)"); QPushButton* button2D = new QPushButton("2D"); QPushButton* button3D = new QPushButton("3D"); messageBox.addButton(button2D,QMessageBox::AcceptRole); messageBox.addButton(button3D,QMessageBox::AcceptRole); messageBox.addButton(QMessageBox::Cancel); messageBox.setDefaultButton(button3D); messageBox.exec(); if (messageBox.clickedButton() == messageBox.button(QMessageBox::Cancel)) { //process cancelled by user return; } ccPolyline* poly = new ccPolyline(*m_segmentationPoly); //if we export the polyline in 3D, we must project its vertices bool mode2D = (messageBox.clickedButton() == button2D); if (!mode2D) { //get current display parameters const double* MM = m_associatedWin->getModelViewMatd(); //viewMat const double* MP = m_associatedWin->getProjectionMatd(); //projMat const GLdouble half_w = static_cast<GLdouble>(m_associatedWin->width())/2; const GLdouble half_h = static_cast<GLdouble>(m_associatedWin->height())/2; int VP[4]; m_associatedWin->getViewportArray(VP); //project the 2D polyline in 3D CCLib::GenericIndexedCloudPersist* vertices = poly->getAssociatedCloud(); ccPointCloud* verticesPC = dynamic_cast<ccPointCloud*>(vertices); if (verticesPC) { for (unsigned i=0; i<vertices->size(); ++i) { CCVector3* Pscreen = const_cast<CCVector3*>(verticesPC->getPoint(i)); GLdouble xp,yp,zp; gluUnProject(half_w+Pscreen->x,half_h+Pscreen->y,0/*Pscreen->z*/,MM,MP,VP,&xp,&yp,&zp); Pscreen->x = static_cast<PointCoordinateType>(xp); Pscreen->y = static_cast<PointCoordinateType>(yp); Pscreen->z = static_cast<PointCoordinateType>(zp); } verticesPC->invalidateBoundingBox(); } else { assert(false); ccLog::Warning("[Segmentation] Failed to convert 2D polyline to 3D! (internal inconsistency)"); mode2D = false; } } poly->setName(QString("Segmentation polyline #%1").arg(++s_polylineExportCount)); poly->setEnabled(false); //we don't want it to appear while the segmentation mode is enabled! (anyway it's 2D only...) poly->set2DMode(mode2D); poly->setColor(ccColor::yellow); //we use a different color so as to differentiate them from the active polyline! mainWindow->addToDB(poly); ccLog::Print(QString("[Segmentation] Polyline exported (%1 vertices)").arg(poly->size())); } }
void AccountModifyDlg::save() { /*if(pa && le_name->text().isEmpty()) { QMessageBox::information(this, tr("Error"), tr("You must specify a name for the account before you may save it.")); return; }*/ Jid newJid( JIDUtil::accountFromString(le_jid->text().trimmed()) ); if ( newJid.node().isEmpty() || newJid.domain().isEmpty() ) { if (!PsiOptions::instance()->getOption("options.account.domain").toString().isEmpty()) { QMessageBox::information(this, tr("Error"), tr("<i>Username</i> is invalid.")); } else { QMessageBox::information(this, tr("Error"), tr("<i>Jabber ID</i> must be specified in the format <i>user@host</i>.")); } return; } // do not allow duplicate account names if (!pa && le_name->text().isEmpty()) le_name->setText(newJid.domain()); QString def = le_name->text(); QString aname = def; int n = 0; { foreach(PsiAccount* pa, psi->contactList()->accounts()) if(aname == pa->name()) n++; } if ( aname == acc.name ) n--; if ( n ) aname = def + '_' + QString::number(++n); le_name->setText( aname ); acc.name = le_name->text(); acc.jid = JIDUtil::accountFromString(le_jid->text().trimmed()).bare(); acc.pass = le_pass->text(); acc.opt_pass = !acc.pass.isEmpty(); acc.opt_host = ck_host->isChecked(); acc.host = le_host->text(); acc.port = le_port->text().toInt(); acc.req_mutual_auth = ck_req_mutual->isChecked(); if (!ck_host->isChecked()) acc.legacy_ssl_probe = ck_legacy_ssl_probe->isChecked(); acc.security_level = cb_security_level->itemData(cb_security_level->currentIndex()).toInt(); acc.opt_automatic_resource = ck_automatic_resource->isChecked(); acc.resource = le_resource->text(); acc.priority = le_priority->text().toInt(); acc.customAuth = ck_custom_auth->isChecked(); acc.authid = le_authid->text(); acc.realm = le_realm->text(); acc.ssl = (UserAccount::SSLFlag) cb_ssl->itemData(cb_ssl->currentIndex()).toInt(); acc.allow_plain = (ClientStream::AllowPlainType) cb_plain->itemData(cb_plain->currentIndex()).toInt(); acc.opt_compress = ck_compress->isChecked(); acc.opt_auto = ck_auto->isChecked(); acc.opt_connectAfterSleep = ck_connectAfterSleep->isChecked(); acc.opt_reconn = ck_reconn->isChecked(); acc.opt_log = ck_log->isChecked(); acc.opt_keepAlive = ck_keepAlive->isChecked(); acc.dtProxy = le_dtProxy->text(); acc.stunHost = le_stunHost->text(); acc.stunPort = le_stunPort->text().toInt(); acc.pgpSecretKey = key; acc.proxyID = pc->currentItem(); if (pa) { pa->setUserAccount(acc); if (pa->isActive()) { QMessageBox messageBox(QMessageBox::Information, tr("Warning"), tr("This account is currently active, so certain changes may not take effect until the next login."), QMessageBox::NoButton, this); QPushButton* cancel = messageBox.addButton(tr("Reconnect &Later"), QMessageBox::RejectRole); QPushButton* reconnect = messageBox.addButton(tr("Reconnect &Now"), QMessageBox::AcceptRole); messageBox.setDefaultButton(reconnect); messageBox.exec(); Q_UNUSED(cancel); if (messageBox.clickedButton() == reconnect) { XMPP::Status status = pa->status(); pa->setStatus(XMPP::Status::Offline); pa->setStatus(status); } } } else { psi->contactList()->createAccount(acc); } accept(); //restart midiclient with updated options psi->midiClient()->restart(); }
bool GroupClient::kickCharacter(const QByteArray &) { emit messageBox("Clients cannot kick players."); return false; }
void Shell::About() { messageBox( "\003Dynamic Text Demo", mfInformation | mfOKButton ); }
bool SpellChecker::spellCheck() { if ((spell_checker1 == 0) && (spell_checker2 == 0)) { QPixmap icon; icon.load(":/warning.png"); QMessageBox messageBox(QMessageBox::NoIcon, "YAGF", QObject::trUtf8("Required spelling dictionary (%1) is not found.\nSpell-checking is disabled.\nTry to install an appropriate aspell dictionary.").arg(bad_language), QMessageBox::Ok, 0); messageBox.setIconPixmap(icon); messageBox.exec(); return false; } QTextCursor cursor(m_textEdit->document()); while (!cursor.isNull() && !cursor.atEnd()) { if (hasLongHyphen(&cursor)) { cursor.select(QTextCursor::WordUnderCursor); QString word1 = cursor.selectedText(); word1.truncate(word1.length()-1); cursor.movePosition(QTextCursor::NextWord); cursor.select(QTextCursor::WordUnderCursor); QString word2 = cursor.selectedText(); word1 = word1 +word2; if (checkWordSpelling(word1)) { cursor.movePosition(QTextCursor::PreviousWord); cursor.select(QTextCursor::WordUnderCursor); cursor.removeSelectedText(); cursor.select(QTextCursor::WordUnderCursor); cursor.removeSelectedText(); cursor.insertText(word1); } } cursor.select(QTextCursor::WordUnderCursor); QString word = cursor.selectedText(); if (word == QString::fromUtf8("—")) { cursor.removeSelectedText(); cursor.insertText(QString::fromUtf8("—")); } if (hasHyphen(&cursor)) { QString cc = checkConcatenation(&cursor); if (!cc.isEmpty()) { cursor.movePosition(QTextCursor::PreviousWord); cursor.movePosition(QTextCursor::PreviousWord); cursor.select(QTextCursor::WordUnderCursor); cursor.removeSelectedText(); cursor.select(QTextCursor::WordUnderCursor); cursor.removeSelectedText(); cursor.movePosition(QTextCursor::NextWord); cursor.select(QTextCursor::WordUnderCursor); cursor.removeSelectedText(); cursor.insertText(cc); } } _checkWord(&cursor); QTextCursor oldc = cursor; if (!cursor.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor)) break; //cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor); //cursor = m_textEdit->document()->find(*m_regExp, cursor); int oldpos = oldc.position(); int newpos = cursor.position(); if (abs(newpos - oldpos) < 3) cursor.setPosition(newpos + 1); } if (!cursor.isNull()) _checkWord(&cursor); return true; }
/* * Open an item. Return the minor version. */ short tagItem::open(const STRING fileName, SPRITE_ATTR *pAttr) { // Allow opening outside of a CItem by creating a local SPRITE_ATTR. const bool bAttr = (pAttr == NULL); CFile file(fileName); if (!file.isOpen()) { // FileExists check. messageBox(_T("File not found: ") + fileName); return 0; } itmAnimation = _T(""); file.seek(13); char cVersion; file >> cVersion; if (cVersion) { messageBox(_T("Please save ") + fileName + _T(" in the editor!")); return 0; } file.seek(0); STRING fileHeader; file >> fileHeader; if (fileHeader != _T("RPGTLKIT ITEM")) { messageBox(_T("Unrecognised File Format! ") + fileName); return 0; } short majorVer, minorVer; file >> majorVer; file >> minorVer; file >> itemName; file >> itmDescription; file >> equipYN; file >> menuYN; file >> boardYN; file >> fightYN; file >> usedBy; itmChars.clear(); unsigned int i; for (i = 0; i <= 50; i++) { STRING str; file >> str; itmChars.push_back(str); } if (minorVer >= 3) { file >> buyPrice; file >> sellPrice; }
void messageBox (const std::string& message) { std::vector<std::string> empty; messageBox (message, empty); }
void ccGraphicalSegmentationTool::doExportSegmentationPolyline() { MainWindow* mainWindow = MainWindow::TheInstance(); if (mainWindow && m_segmentationPoly) { bool mode2D = false; #ifdef ALLOW_2D_OR_3D_EXPORT QMessageBox messageBox(0); messageBox.setWindowTitle("Choose export type"); messageBox.setText("Export polyline in:\n - 2D (with coordinates relative to the screen)\n - 3D (with coordinates relative to the segmented entities)"); QPushButton* button2D = new QPushButton("2D"); QPushButton* button3D = new QPushButton("3D"); messageBox.addButton(button2D,QMessageBox::AcceptRole); messageBox.addButton(button3D,QMessageBox::AcceptRole); messageBox.addButton(QMessageBox::Cancel); messageBox.setDefaultButton(button3D); messageBox.exec(); if (messageBox.clickedButton() == messageBox.button(QMessageBox::Cancel)) { //process cancelled by user return; } mode2D = (messageBox.clickedButton() == button2D); #endif ccPolyline* poly = new ccPolyline(*m_segmentationPoly); //if the polyline is 2D and we export the polyline in 3D, we must project its vertices if (!mode2D) { //get current display parameters ccGLCameraParameters camera; m_associatedWin->getGLCameraParameters(camera); const double half_w = camera.viewport[2] / 2.0; const double half_h = camera.viewport[3] / 2.0; //project the 2D polyline in 3D CCLib::GenericIndexedCloudPersist* vertices = poly->getAssociatedCloud(); ccPointCloud* verticesPC = dynamic_cast<ccPointCloud*>(vertices); if (verticesPC) { for (unsigned i=0; i<vertices->size(); ++i) { CCVector3* Pscreen = const_cast<CCVector3*>(verticesPC->getPoint(i)); CCVector3d Pd(half_w + Pscreen->x, half_h + Pscreen->y, 0/*Pscreen->z*/); CCVector3d Q3D; camera.unproject(Pd, Q3D); *Pscreen = CCVector3::fromArray(Q3D.u); } verticesPC->invalidateBoundingBox(); } else { assert(false); ccLog::Warning("[Segmentation] Failed to convert 2D polyline to 3D! (internal inconsistency)"); mode2D = false; } } QString polyName = QString("Segmentation polyline #%1").arg(++s_polylineExportCount); poly->setName(polyName); poly->setEnabled(false); //we don't want it to appear while the segmentation mode is enabled! (anyway it's 2D only...) poly->set2DMode(mode2D); poly->setColor(ccColor::yellow); //we use a different color so as to differentiate them from the active polyline! //save associated viewport cc2DViewportObject* viewportObject = new cc2DViewportObject(polyName + QString(" viewport")); viewportObject->setParameters(m_associatedWin->getViewportParameters()); viewportObject->setDisplay(m_associatedWin); poly->addChild(viewportObject); mainWindow->addToDB(poly,false,false,false); ccLog::Print(QString("[Segmentation] Polyline exported (%1 vertices)").arg(poly->size())); } }
void PlantBrushDockWidget::slotEditButtonClicked(bool) { //test if not a enterprise VirtualDataSceneBase::TransformableActor* layer = g_SystemViewContextMap[DEFAULT_VIEWID]->_layerManager->getLoadInLayer(); if (!layer->isInstanceOf(CLASS_ENTERPRISELAYER)) { QMessageBox messageBox(this); messageBox.setWindowTitle(QWidget::tr("提示")); messageBox.setIcon(QMessageBox::Information); messageBox.setText(QWidget::tr("只允许在企业层级下编辑植被,请加载企业层级!")); QAbstractButton* button = messageBox.addButton(QWidget::tr("确定"), QMessageBox::ActionRole); messageBox.exec(); return; } std::vector<VirtualDataSceneBase::ActorBase*> actorList; static_cast<VirtualDataSceneKernel::SingleLayerActor*>(layer)->getAllChildren(actorList, CLASS_PLANTBLOCK, false, false); if (actorList.size() < 4) { QMessageBox messageBox(this); messageBox.setWindowTitle(QWidget::tr("提示")); messageBox.setIcon(QMessageBox::Question); messageBox.setText(QWidget::tr("该图层植被数据文件未初始化或者已损坏,是否重新生成默认植被数据文件?")); QPushButton *yesButton = messageBox.addButton(QWidget::tr("重新生成"), QMessageBox::YesRole); QPushButton *noButton = messageBox.addButton(QWidget::tr("放弃生成"), QMessageBox::NoRole); messageBox.exec(); if (messageBox.clickedButton() == noButton) return; //waiting dialog std::vector<osg::Vec3> v(4); v[0] = osg::Vec3(-1, -1, 0); v[1] = osg::Vec3(1, -1, 0); v[2] = osg::Vec3(1, 1, 0); v[3] = osg::Vec3(-1, 1, 0); buildPlantBlockActor(v); } _projectModify = isCurrentProjectDirty(); dirtyCurrentProject(false); _toolBox->setEnabled(true); _densitySpin->setEnabled(true); _vegetationWidget->setEnabled(true); _innerRadius->setEnabled(true); _sliderRadius->setEnabled(true); _applyButton->setEnabled(true); _saveButton->setEnabled(true); _cancelButton->setEnabled(true); _editButton->setEnabled(false); //load as point for (unsigned int i = 0; i < actorList.size(); ++i) { VirtualDataSceneBase::PlantBlockActor* blockActor = dynamic_cast<VirtualDataSceneBase::PlantBlockActor*>(actorList.at(i)); blockActor->mandatoryUnLoadNode(); blockActor->mandatoryLoadNodeSynchronous(); } //add brusheventhandler EditEventHandler* pm = EventHandlerRegistry::instance()->create("PlantBrushEventHandler"); _plantBrushEventHandler = static_cast<PlantBrushEventHandler*>(pm); EditorSystemViewContext* currentContext = static_cast<EditorSystemViewContext*>(g_SystemViewContextMap[DEFAULT_VIEWID].get()); ViewerWidget* mainView = static_cast<ViewerWidget*>(currentContext->_compositeViewer.get()); mainView->resetEventHandler(_plantBrushEventHandler); SignalsSlotsCenter::instance().emitActiveWidget(this, true); CommandManager::instance().switchStack("PlantEdit"); }
void TOutputDevice::encodeCard() { static Boolean resetDone = False; if( !resetDone || formDef->oldDevice ) { writeCommand( "@" ); checkStatus(); if( !formDef->oldDevice ) delay( 3000 ); else delay( 1000 ); resetDone = True; } filterExtChars( trackBuffer, noTracks * trackLength ); static Boolean tracksSet = False; if( formDef->oldDevice ) { writeCommand( "E" ); checkStatus(); // if( !tracksSet ) // { writeCommand( "T2" ); checkStatus(); writeCommand( "T3" ); checkStatus(); tracksSet = True; // } } char trackCommand[3] = "Ix"; for( char c = 0; c < noTracks; c++ ) { trackCommand[1] = ((char)(c + '1')); int dataLen; if( formDef->oldDevice ) switch( c ) { case 0: dataLen = 76; break; case 1: dataLen = 36; for( int i = 0; i < dataLen; i++ ) { int index = c * trackLength + i; switch( trackBuffer[index] ) { case ' ': trackBuffer[index] = '0'; break; case '.': trackBuffer[index] = 'D'; break; } } break; case 2: dataLen = 104; break; } else dataLen = trackLength; writeCommand( trackCommand, &trackBuffer[c * trackLength], dataLen ); if( !formDef->oldDevice ) checkStatus(); else processEcho(); } if( !formDef->oldDevice ) { filterExtChars( label, noLines * lineLength ); writeCommand( "N" ); checkStatus(); char command[3]; command[0] = esc; command[2] = '\r'; command[0] = 0x1C; command[1] = 'T'; writeBytes( command, 3 ); for( c = 0; c < noLines; c++ ) { if( c == 0 ) { command[1] = 'F'; writeBytes( command, 2 ); } else { command[1] = 'H'; writeBytes( command, 2 ); } char indent[2] = { ' ', ' ' }; writeBytes( indent, sizeof( indent ) ); writeBytes( &label[c * lineLength], lineLength ); command[1] = '\r'; command[2] = '\n'; writeBytes( &command[1], 2 ); } writeCommand( "O" ); checkStatus(); } writeCommand( "W" ); checkStatus(); if( !formDef->oldDevice ) writeCommand( "A" ); if( formDef->oldDevice ) messageBox( "Bitte Karte einf�hren, warten, bis " "der Kodiervorgang beendet ist und " "mit Enter best�tigen.", mfInformation | mfOKButton ); writeCommand( "H" ); if( formDef->oldDevice ) checkStatus(); }
static int wtCmd(ClientData clientData, Tcl_Interp * interp, int argc, char ** argv) { enum mode mode = MODE_NONE; poptContext optCon; int arg; const char * optArg; const char * text; const char * nextArg; char * end; int height; int width; int noCancel = 0; int noItem = 0; int scrollText = 0; int rc = 0; int flags = 0; int defaultNo = 0; char * result; char ** selections, ** next; char * title = NULL; struct poptOption optionsTable[] = { { "checklist", '\0', 0, 0, OPT_CHECKLIST }, { "defaultno", '\0', 0, &defaultNo, 0 }, { "inputbox", '\0', 0, 0, OPT_INPUTBOX }, { "menu", '\0', 0, 0, OPT_MENU }, { "msgbox", '\0', 0, 0, OPT_MSGBOX }, { "nocancel", '\0', 0, &noCancel, 0 }, { "noitem", '\0', 0, &noItem, 0 }, { "radiolist", '\0', 0, 0, OPT_RADIOLIST }, { "scrolltext", '\0', 0, &scrollText, 0 }, { "title", '\0', POPT_ARG_STRING, &title, 0 }, { "yesno", '\0', 0, 0, OPT_YESNO }, { 0, 0, 0, 0, 0 } }; optCon = poptGetContext("whiptcl", argc, argv, optionsTable, 0); while ((arg = poptGetNextOpt(optCon)) > 0) { optArg = poptGetOptArg(optCon); switch (arg) { case OPT_MENU: if (mode != MODE_NONE) rc = -1; mode = MODE_MENU; break; case OPT_MSGBOX: if (mode != MODE_NONE) rc = -1; mode = MODE_MSGBOX; break; case OPT_RADIOLIST: if (mode != MODE_NONE) rc = -1; mode = MODE_RADIOLIST; break; case OPT_CHECKLIST: if (mode != MODE_NONE) rc = -1; mode = MODE_CHECKLIST; break; case OPT_YESNO: if (mode != MODE_NONE) rc = -1; mode = MODE_YESNO; break; case OPT_INPUTBOX: if (mode != MODE_NONE) rc = -1; mode = MODE_INPUTBOX; break; } } if (arg < -1) { /* this could buffer oveflow, bug we're not setuid so I don't care */ interp->result = malloc(200); interp->freeProc = TCL_DYNAMIC; sprintf(interp->result, "%s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(arg)); return TCL_ERROR; } if (mode == MODE_NONE) { interp->result = "no dialog mode was specified"; return TCL_ERROR; } else if (rc) { interp->result = "multiple modes were specified"; return TCL_ERROR; } if (!(text = poptGetArg(optCon))) { interp->result = "missing text parameter"; return TCL_ERROR; } if (!(nextArg = poptGetArg(optCon))) { interp->result = "height missing"; return TCL_ERROR; } height = strtoul(nextArg, &end, 10); if (*end) { interp->result = "height is not a number"; return TCL_ERROR; } if (!(nextArg = poptGetArg(optCon))) { interp->result = "width missing"; return TCL_ERROR; } width = strtoul(nextArg, &end, 10); if (*end) { interp->result = "width is not a number"; return TCL_ERROR; } width -= 2; height -= 2; newtOpenWindow((80 - width) / 2, (24 - height) / 2, width, height, title); if (noCancel) flags |= FLAG_NOCANCEL; if (noItem) flags |= FLAG_NOITEM; if (scrollText) flags |= FLAG_SCROLL_TEXT; if (defaultNo) flags |= FLAG_DEFAULT_NO; switch (mode) { case MODE_MSGBOX: rc = messageBox(text, height, width, MSGBOX_MSG, flags); break; case MODE_YESNO: rc = messageBox(text, height, width, MSGBOX_YESNO, flags); if (rc == DLG_OKAY) interp->result = "yes"; else interp->result = "no"; if (rc == DLG_ERROR) rc = 0; break; case MODE_INPUTBOX: rc = inputBox(text, height, width, optCon, flags, &result); if (!rc) { interp->result = strdup(result); interp->freeProc = TCL_DYNAMIC; } break; case MODE_MENU: rc = listBox(text, height, width, optCon, flags, &result); if (!rc) { interp->result = strdup(result); interp->freeProc = TCL_DYNAMIC; } break; case MODE_RADIOLIST: rc = checkList(text, height, width, optCon, 1, flags, &selections); if (!rc) { interp->result = strdup(selections[0]); interp->freeProc = TCL_DYNAMIC; } break; case MODE_CHECKLIST: rc = checkList(text, height, width, optCon, 0, flags, &selections); if (!rc) { for (next = selections; *next; next++) Tcl_AppendElement(interp, *next); free(selections); } break; case MODE_NONE: /* this can't happen */ } newtPopWindow(); if (rc == DLG_ERROR) { interp->result = "bad paramter for whiptcl dialog box"; return TCL_ERROR; } Tcl_SetVar(interp, "whiptcl_canceled", (rc == DLG_CANCEL) ? "1" : "0", 0); return TCL_OK; } static char * setBacktext(ClientData data, Tcl_Interp * interp, char * name1, char * name2, int flags) { static char blankLine[81] = " " " "; newtDrawRootText(0, 0, blankLine); newtDrawRootText(0, 0, Tcl_GetVar(interp, "whiptcl_backtext", TCL_GLOBAL_ONLY)); return NULL; } static char * setHelptext(ClientData data, Tcl_Interp * interp, char * name1, char * name2, int flags) { char * text = Tcl_GetVar(interp, "whiptcl_helpline", TCL_GLOBAL_ONLY); if (!text) text = ""; else if (!strlen(text)) text = NULL; newtPopHelpLine(); newtPushHelpLine(text); return NULL; }
void EspecieView::deleteClicked() { if (tableView->currentIndex().row() < 0) { return; } QSqlRecord record = model->record(tableView->currentIndex().row()); int cod = record.value("cod_materialespecie").toInt(); QString nome = record.value("nome").toString(); QMessageBox messageBox(QMessageBox::Question, "Admin", QString::fromUtf8("Confirma a exclusão do registro <b>%1</b>?").arg(nome), QMessageBox::Yes | QMessageBox::No, this); if (messageBox.exec() == QMessageBox::Yes) { QString detailedText; QSqlQuery sql; sql.prepare("delete from materialespecie where cod_materialespecie = :cod"); sql.bindValue(":cod", cod); if (!sql.exec()) { QSqlQuery query1; query1.prepare("select nome from materiaprima where cod_materialespecie = :cod"); query1.bindValue(":cod", cod); if (query1.exec()) { while (query1.next()) { detailedText.append(query1.value(query1.record().indexOf("nome")).toString()); detailedText.append("\n"); } } QSqlQuery query2; query2.prepare("delete from materiaprima where cod_materialespecie = :cod"); query2.bindValue(":cod", cod); QMessageBox messageBox; messageBox.setWindowTitle("Admin"); messageBox.setText(QString::fromUtf8( "Existe alguma matéria prima sendo referenciada por este material (veja em detalhes)\n" "tentar uma exclusão em cadeia forçada?" )); messageBox.setDetailedText(detailedText); messageBox.setIcon(QMessageBox::Critical); messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); switch(messageBox.exec()) { case QMessageBox::Yes: query2.exec(); sql.exec(); break; default: break; } } model->select(); } }
/* * Load a plugin. */ IPlugin *loadPlugin(const STRING path) { const STRING file = resolve(path); HMODULE mod = LoadLibrary(file.c_str()); if (!mod) { messageBox(_T("The file ") + file + _T(" is not a valid dynamically linkable library.")); return NULL; } FARPROC pReg = GetProcAddress(mod, _T("DllRegisterServer")); if (!pReg) { FreeLibrary(mod); COldPlugin *p = new COldPlugin(); if (p->load(file)) { p->initialize(); return p; } messageBox(_T("The file ") + file + _T(" is not a valid plugin.")); delete p; return NULL; } FreeLibrary(mod); CComPlugin *p = new CComPlugin(); STRING manifestFile = file + ".x.manifest"; // Create an "Active Context" to load the DLL into this processes // execution address. // // Normally you would have to register a COM DLL to access it which // would require administrative rights, to get around that issue // we are using "Registration Free COM". ACTCTX actCtx; memset((void*)&actCtx, 0, sizeof(ACTCTX)); actCtx.cbSize = sizeof(ACTCTX); actCtx.lpSource = manifestFile.c_str(); HANDLE hCtx = ::CreateActCtx(&actCtx); if (hCtx == INVALID_HANDLE_VALUE) { messageBox(_T("Failed to load the type library manifest ") + manifestFile + _T(".")); return NULL; } else { ULONG_PTR cookie; if (::ActivateActCtx(hCtx, &cookie)) { ITypeLib *pTypeLib = NULL; // Because we can't simply cast to 'LPCOLESTR'. std::wstring fileWstring = getUnicodeString(file); LPCOLESTR fileLibrary = fileWstring.c_str(); if (FAILED(LoadTypeLib(fileLibrary, &pTypeLib))) { messageBox(_T("Failed to load the type library of ") + file + _T(".")); return NULL; } const int types = pTypeLib->GetTypeInfoCount(); // Check all the types in the library. bool bLoaded = false; for (int i = 0; i < types; ++i) { ITypeInfo *pTypeInfo = NULL; pTypeLib->GetTypeInfo(i, &pTypeInfo); if (bLoaded = p->load(pTypeInfo)) { break; } } // Release the type library. pTypeLib->Release(); if (!bLoaded) { messageBox(_T("A remotable class was not found in ") + file + _T(".")); delete p; return NULL; } ::DeactivateActCtx(0, cookie); } } p->initialize(); return p; }
void WBWebPage::handleUnsupportedContent(QNetworkReply *reply) { if(reply->url().scheme() == "mailto") { bool result = QDesktopServices::openUrl(reply->url()); if (result) return; } QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); bool isPDF = (contentType == "application/pdf"); // Delete this big "if (isPDF)" block to get the pdf directly inside the browser if (isPDF) { QMessageBox messageBox(mainWindow()); messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Sankore document?")); messageBox.addButton(tr("Download"), QMessageBox::AcceptRole); QAbstractButton *addButton = messageBox.addButton(tr("Add to Current Document"), QMessageBox::AcceptRole); messageBox.exec(); if (messageBox.clickedButton() == addButton) { UBApplication::applicationController->showBoard(); UBApplication::boardController->downloadURL(reply->request().url()); return; } else { isPDF = false; } } if (!isPDF && reply->error() == QNetworkReply::NoError) { if(contentType == "application/widget") WBBrowserWindow::downloadManager()->handleUnsupportedContent(reply,false, UBSettings::settings()->uniboardGipLibraryDirectory()); else WBBrowserWindow::downloadManager()->handleUnsupportedContent(reply); return; } QFile file; file.setFileName(isPDF ? QLatin1String(":/webbrowser/object-wrapper.html") : QLatin1String(":/webbrowser/notfound.html")); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); QString html; if (isPDF) { html = QString(QLatin1String(file.readAll())) .arg(tr("PDF")) .arg("application/x-ub-pdf") .arg(reply->url().toString()); } else { QString title = tr("Error loading page: %1").arg(reply->url().toString()); html = QString(QLatin1String(file.readAll())) .arg(title) .arg(reply->errorString()) .arg(reply->url().toString()); } QList<QWebFrame*> frames; frames.append(mainFrame()); while (!frames.isEmpty()) { QWebFrame *frame = frames.takeFirst(); if (frame->url() == reply->url()) { frame->setHtml(html, reply->url()); return; } QList<QWebFrame *> children = frame->childFrames(); foreach(QWebFrame *frame, children) frames.append(frame); } if (mLoadingUrl == reply->url()) { mainFrame()->setHtml(html, reply->url()); } }
void InfoPad::handleEvent(TEvent& event) { if (event.what == evCommand && event.message.command == cmQuit) { while (editWindows) editWindows->WinMessage(WM_COMMAND, IDM_CLOSE, 0); } TApplication::handleEvent(event); if (event.what == evCommand) { switch (event.message.command) { case ID_OPTIONS: optionsBox(); break; case ID_MOREWINDOWS: if (WindowMRU.Get(0)) WindowMenuBox(); else messageBox("No windows available", mfInformation); break; case ID_UNDO: if (current) { current->child->WinMessage(WM_UNDO, 0, 0); } break; case IDM_REDO: if (current) { current->child->WinMessage(WM_REDO, 0, 0); } break; case ID_CUT: if (current) { current->child->WinMessage(WM_CUT, 0, 0); } break; case ID_COPY: if (current) { current->child->WinMessage(WM_COPY, 0, 0); } break; case ID_PASTE: if (current) { current->child->WinMessage(WM_PASTE, 0, 0); } break; case ID_NEW: openfile((DWINFO *)-1, True, True); break; case ID_OPEN: CreateDrawWindow((DWINFO *)0, True); break; case ID_SAVE: if (current) { current->WinMessage(WM_COMMAND, IDM_SAVE, 0); } break; case ID_SAVEAS: if (current) { current->WinMessage(WM_COMMAND, IDM_SAVEAS, 0); } break; case ID_CLOSE: if (current) { current->WinMessage(WM_COMMAND, IDM_CLOSE, 0); current->close(); current = NULL; } break; case ID_SEARCH: if (current) { current->WinMessage(WM_COMMAND, IDM_FIND, 0); } break; case ID_REPLACE: if (current) { current->WinMessage(WM_COMMAND, IDM_REPLACE, 0); } break; case ID_SEARCHNEXT: if (current) { current->WinMessage(WM_COMMAND, IDM_FINDNEXT, 0); } break; case ID_GOTO: if (current) { current->WinMessage(WM_COMMAND, IDM_GOTO, 0); } break; case ID_TOUPPER: if (current) { current->WinMessage(WM_COMMAND, IDM_TOUPPER, 0); } break; case ID_TOLOWER: if (current) { current->WinMessage(WM_COMMAND, IDM_TOLOWER, 0); } break; case ID_INDENT: if (current) { current->WinMessage(WM_COMMAND, IDM_INDENT, 0); } break; case ID_OUTDENT: if (current) { current->WinMessage(WM_COMMAND, IDM_UNINDENT, 0); } break; case ID_COMMENT: if (current) { current->WinMessage(WM_COMMAND, IDM_COMMENT, 0); } break; case ID_UNCOMMENT: if (current) { current->WinMessage(WM_COMMAND, IDM_UNCOMMENT, 0); } break; case ID_CLOSEALL: CloseAll(); break; case ID_ABOUT: AboutBox(); break; default: if (event.message.command >= FILE_MRU_BASE && event.message.command < FILE_MRU_BASE + MRU::MAX_MRU) { static DWINFO temp; MRUItem *p = cfg.FileMRU().Get(event.message.command - FILE_MRU_BASE); if (p) { newInfo = &temp; newInfo->dwLineNo = - 1; newInfo->logMRU = TRUE; strcpy(newInfo->dwTitle, p->title); strcpy(newInfo->dwName, p->name); openfile(newInfo, FALSE, TRUE); } } else if (event.message.command >= WINDOW_MRU_BASE && event.message.command < WINDOW_MRU_BASE + MRU::MAX_WINDOW_MRU) { static DWINFO temp; MRUItem *p = WindowMRU.Get(event.message.command - WINDOW_MRU_BASE); if (p) { newInfo = &temp; newInfo->dwLineNo = - 1; newInfo->logMRU = TRUE; strcpy(newInfo->dwTitle, p->title); strcpy(newInfo->dwName, p->name); openfile(newInfo, FALSE, TRUE); } } break; } } }
void OBSBasic::DispatchTBLiveCmd(std::wstring cmd, std::map<std::wstring, std::wstring> args) { if ( cmd == L"start_live" ) { if (!m_bServiceInited) { // async init InitServiceData(base::Bind(&OBSBasic::DispatchTBLiveCmd, base::Unretained(this), cmd, args)); return; } std::wstring biz = args[L"biz"]; // tblive protocol match config auto fit = std::find_if(m_serviceData.service_list.begin(), m_serviceData.service_list.end(), [biz](ServiceItem item) { return biz == item.biz; }); if (fit == m_serviceData.service_list.end()) {// Not match return; } std::wstring url = args[L"url"]; std::wstring loginuser = args[L"loginuser"]; PrgString user = CLoginBiz::GetInstance()->GetLoginedUser(); if (!loginuser.empty() && loginuser != user.GetString()) { // Notify user not match QMessageBox messageBox(this); messageBox.setWindowTitle(QTStr("TBLive.NotifyTitle")); messageBox.setText(QTStr("TBLive.NotifyLoginUserNotMatch")); messageBox.exec(); return; } // Notify if stream active if (outputHandler->StreamingActive()) { BringToTop(); QMessageBox messageBox(this); messageBox.setWindowTitle(QTStr("TBLive.NotifyTitle")); messageBox.setText(QTStr("TBLive.ChangeLiveRoomWhenActive")); messageBox.exec(); return; } PrgString destUrl; CLoginBiz::GetInstance()->TranslateUrl(url, destUrl); ui->bizWebview->load(QString::fromStdWString(destUrl.GetString())); BringToTop(); } else if ( cmd == L"set_focus" ) { BringToTop(); } }
void GroupClient::retrieveData(GroupSocket *const /* socket */, const Messages message, const QVariantMap &data) { if (message == Messages::STATE_KICKED) { emit messageBox(QString("You got kicked! Reason: %1").arg(data["text"].toString())); stop(); return; } if (socket.getProtocolState() == ProtocolState::AwaitingLogin) { // Login state. either REQ_HANDSHAKE, REQ_LOGIN, or ACK should come if (message == Messages::REQ_HANDSHAKE) { sendHandshake(data); } else if (message == Messages::REQ_LOGIN) { assert(!NO_OPEN_SSL); socket.setProtocolVersion(proposedProtocolVersion); socket.startClientEncrypted(); } else if (message == Messages::ACK) { // aha! logged on! sendMessage(&socket, Messages::REQ_INFO); socket.setProtocolState(ProtocolState::AwaitingInfo); } else { // ERROR: unexpected message marker! // try to ignore? qWarning("(AwaitingLogin) Unexpected message marker. Trying to ignore."); } } else if (socket.getProtocolState() == ProtocolState::AwaitingInfo) { // almost connected. awaiting full information about the connection if (message == Messages::UPDATE_CHAR) { emit scheduleAction(new AddCharacter(data)); } else if (message == Messages::STATE_LOGGED) { socket.setProtocolState(ProtocolState::Logged); } else if (message == Messages::REQ_ACK) { sendMessage(&socket, Messages::ACK); } else { // ERROR: unexpected message marker! // try to ignore? qWarning("(AwaitingInfo) Unexpected message marker. Trying to ignore."); } } else if (socket.getProtocolState() == ProtocolState::Logged) { if (message == Messages::ADD_CHAR) { emit scheduleAction(new AddCharacter(data)); } else if (message == Messages::REMOVE_CHAR) { emit scheduleAction(new RemoveCharacter(data)); } else if (message == Messages::UPDATE_CHAR) { emit scheduleAction(new UpdateCharacter(data)); } else if (message == Messages::RENAME_CHAR) { emit scheduleAction(new RenameCharacter(data)); } else if (message == Messages::GTELL) { emit gTellArrived(data); } else if (message == Messages::REQ_ACK) { sendMessage(&socket, Messages::ACK); } else { // ERROR: unexpected message marker! // try to ignore? qWarning("(Logged) Unexpected message marker. Trying to ignore."); } } }
void GUI::_showError(const QString& title, const QString& msg) { QMessageBox messageBox(QMessageBox::Critical, title, msg, QMessageBox::Ok, getMainWidget()); messageBox.setButtonText(QMessageBox::Ok, QApplication::tr("Ok")); messageBox.exec(); }
void skip(string args) { UNUSED(args); messageBox("This command literally does nothing :)"); }
/* * Open a player. * * fileName (in) - file to open. * spriteAttr (in) - common attributes that feed into CSprite. * short (out) - minor version. */ short tagPlayer::open(const STRING fileName, SPRITE_ATTR &spriteAttr) { CFile file(fileName); if (!file.isOpen()) { // FileExists check. messageBox(_T("File not found: ") + fileName); return 0; } // Preserve subfolder to ensure loading from saved file. this->fileName = removePath(fileName, TEM_PATH); file.seek(13); char cVersion; file >> cVersion; file.seek(0); if (!cVersion) { STRING fileHeader; file >> fileHeader; if (fileHeader != _T("RPGTLKIT CHAR")) { messageBox(_T("Unrecognised File Format! ") + fileName); return 0; } short majorVer, minorVer; file >> majorVer; file >> minorVer; file >> charname; file >> experienceVar; replace(experienceVar, _T("!"), _T("")); file >> defenseVar; replace(defenseVar, _T("!"), _T("")); file >> fightVar; replace(fightVar, _T("!"), _T("")); file >> healthVar; replace(healthVar, _T("!"), _T("")); file >> maxHealthVar; replace(maxHealthVar, _T("!"), _T("")); file >> nameVar; replace(nameVar, _T("$"), _T("")); file >> smVar; replace(smVar, _T("!"), _T("")); file >> smMaxVar; replace(smMaxVar, _T("!"), _T("")); file >> leVar; replace(leVar, _T("!"), _T("")); file >> stats.experience; file >> stats.health; file >> stats.maxHealth; file >> stats.defense; file >> stats.fight; file >> stats.sm; file >> stats.smMax; file >> stats.level; file >> profilePic; unsigned int i; smlist.clear(); spcMinExp.clear(); spcMinLevel.clear(); spcVar.clear(); spcEquals.clear(); for (i = 0; i <= 200; i++) { STRING str; int num; file >> str; smlist.push_back(str); file >> num; spcMinExp.push_back(num); file >> num; spcMinLevel.push_back(num); file >> str; spcVar.push_back(str); file >> str; spcEquals.push_back(str); } file >> specialMoveName; file >> smYN; accessoryName.clear(); for (i = 0; i <= 10; i++) { STRING str; file >> str; accessoryName.push_back(str); } armorType.clear(); for (i = 0; i <= 6; i++) { char chr; file >> chr; armorType.push_back(chr); } if (minorVer == 3) { char lev; file >> lev; levelType = lev; }
// Удаление выбранных веток, вызывается при выборе соотвествущей // кнопки или пункта меню void TreeScreen::del_branch(QString mode) { qDebug() << "In del_branch()"; // На время удаления блокируется главное окно find_object<MainWindow>("mainwindow")->setDisabled(true); find_object<MainWindow>("mainwindow")->blockSignals(true); // Получение списка индексов QModelIndex выделенных элементов QModelIndexList selectitems=knowTreeView->selectionModel()->selectedIndexes(); // Список имен веток, которые нужно удалить QStringList branches_name; for(int i = 0; i < selectitems.size(); ++i) { QModelIndex index=selectitems.at(i); TreeItem *item=knowTreeModel->getItem(index); branches_name << item->getField("name"); } // Если системный пароль не установлен, зашифрованные ветки удалять нельзя if(globalParameters.getCryptKey().size()==0) { bool disableFlag=false; // Перебираются удаляемые ветки for(int i = 0; i < selectitems.size(); ++i) { QModelIndex index=selectitems.at(i); TreeItem *item=knowTreeModel->getItem(index); // Если у ветки установлен флаг шифрования if(item->getField("crypt")=="1") { disableFlag=true; break; } // Проверяется наличие флага шифрования у всех подветок QList<QStringList> cryptFlagsList=item->getAllChildrenPathAsField("crypt"); foreach(QStringList cryptFlags, cryptFlagsList) if(cryptFlags.contains("1")) { disableFlag=true; break; } if(disableFlag) break; } // Закрылся цикл перебора всех выделенных для удаления веток // Если в какой-то ветке обнаружено шифрование if(disableFlag) { QMessageBox messageBox(this); messageBox.setWindowTitle(tr("Unavailable action")); messageBox.setText(tr("In your selected data found closed item. Action canceled.")); messageBox.addButton(tr("OK"), QMessageBox::AcceptRole); messageBox.exec(); // Разблокируется главное окно find_object<MainWindow>("mainwindow")->setEnabled(true); find_object<MainWindow>("mainwindow")->blockSignals(false); return; } } // Закрылось условие что системный пароль не установлен
void TVDemo::outOfMemory() { messageBox( "Not enough memory available to complete operation.", mfError | mfOKButton ); }
void me(string args) { if (!hasSetup) { if (streql(splitArg(args, 1), "-H")) { // a super legit help section brought to you by @plankp print("\nMe is here to help you... Believe me...", brown); } else if (streql(splitArg(args, 1), "TEST") && !hasSetup) { hasSetup = true; messageBox("\nYou have skipped the Me setup process."); } else if (!hasSetup) { meHeader(); messageBox("\nWelcome to Me. To start using Me,\n\rpress <RET> to setup Me."); meHeader(); name = messageBox_I("What is your name?"); meHeader(); while (!birthYearValid) { birthYear = messageBox_I("What year were you born in?"); birthYearInt = stoi(birthYear); // need to make this always the current year + 1 if (birthYearInt < getTime("year") && birthYearInt > 1900) { birthYearValid = true; goodAnswer(); } if (!birthYearValid) { badAnswer(); } } meHeader(); while (!birthDateValid) { newline(); birthDate = messageBox_I("What day were you born on"); birthDateInt = stoi(birthDate); if (birthDateInt < 32) { birthDateValid = true; goodAnswer(); } if (!birthDateValid) { badAnswer(); } } meHeader(); while (!birthMonthValid) { newline(); birthMonth = messageBox_I("What month were you born in?"); birthMonth = toUpper(birthMonth); if (findInDictionary("me/setup/month.text",birthMonth)) { birthMonthValid = true; goodAnswer(); } if (!birthMonthValid) { badAnswer(); } } meHeader(); while (!continentValid) { newline(); continent = messageBox_I("What continent do you live in?"); continent = toUpper(continent); if (findInDictionary("me/setup/continent.text",continent)) { continentValid = true; goodAnswer(); } if (!continentValid) { badAnswer(); } } meHeader(); while (!countryValid) { newline(); country = messageBox_I("What country do you live in?"); country = toUpper(country); if (findInDictionary("me/setup/country.text",country)) { countryValid = true; goodAnswer(); } if (!countryValid) { badAnswer(); } } meHeader(); while (!stateValid) { newline(); state = messageBox_I("What state/province do you live in?"); state = toUpper(state); if (findInDictionary("me/setup/state.text",state)) { stateValid = true; goodAnswer(); } if (!stateValid) { badAnswer(); } } meHeader(); newline(); city = messageBox_I("What city/town do you live in?"); clearLine(0,26,0x88); drawFrame(header_background, 20, 8, 60, 11); printAt("Me Setup Process", 0x3D, 21, 9); while (!zipValid) { newline(); zip = messageBox_I("What is your zip/post code?"); zipInt = htoi(zip); if (zipInt > 0) { zipValid = true; goodAnswer(); } else { badAnswer(); } } meHeader(); hasSetup = "true"; messageBox("Me is now ready to use! Type 'me' on\n\rthe command line to begin."); printIntro(); drawBorder(screen_background, 0, 4, 80, sh - 1); actualY = 5; printAt("Q-Kernel> ", light_grey, 1, actualY); } else { print("\nYou have already completed the setup process for Me!",purple); } } else if (streql(splitArg(args, 1),"")) { querying = true; string meArgs = NULL; while (querying) { newline(); //meArgs = ""; print("me> ",green); meArgs = readstr(); print(answer(meArgs,0),red); } } else { answer(args,1); } }
int AgiEngine::saveGameDialog() { char *desc; const char *buttons[] = { "Do as I say!", "I regret", NULL }; char dstr[200]; int rc, slot = 0; int hm, vm, hp, vp; int w; hm = 1; vm = 3; hp = hm * CHAR_COLS; vp = vm * CHAR_LINES; w = (40 - 2 * hm) - 1; do { drawWindow(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp); printText("Select a slot in which you wish to\nsave the game:", 0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOR); slot = selectSlot(); if (slot + _firstSlot == 0) messageBox("That slot is for Autosave only."); else if (slot < 0) return errOK; } while (slot + _firstSlot == 0); drawWindow(hp, vp + 5 * CHAR_LINES, GFX_WIDTH - hp, GFX_HEIGHT - vp - 9 * CHAR_LINES); printText("Enter a description for this game:", 0, hm + 1, vm + 6, w, MSG_BOX_TEXT, MSG_BOX_COLOR); _gfx->drawRectangle(3 * CHAR_COLS, 11 * CHAR_LINES - 1, 37 * CHAR_COLS, 12 * CHAR_LINES, MSG_BOX_TEXT); _gfx->flushBlock(3 * CHAR_COLS, 11 * CHAR_LINES - 1, 37 * CHAR_COLS, 12 * CHAR_LINES); // The description field of the save/restore dialog holds 32 characters // but we use four of them for the slot number. The input field is a // bit wider than that, so we don't have to worry about leaving space // for the cursor. getString(2, 11, 28, MAX_STRINGS); // If we're saving over an old slot, show the old description. We can't // access that buffer directly, so we have to feed the characters to // the input handler one at a time. char name[40]; int numChars; getSavegameDescription(_firstSlot + slot, name, false); for (numChars = 0; numChars < 28 && name[numChars]; numChars++) handleGetstring(name[numChars]); _gfx->printCharacter(numChars + 3, 11, _game.cursorChar, MSG_BOX_COLOR, MSG_BOX_TEXT); do { mainCycle(); } while (_game.inputMode == INPUT_GETSTRING); closeWindow(); desc = _game.strings[MAX_STRINGS]; sprintf(dstr, "Are you sure you want to save the game " "described as:\n\n%s\n\nin slot %d?\n\n\n", desc, _firstSlot + slot); rc = selectionBox(dstr, buttons); if (rc != 0) { messageBox("Game NOT saved."); return errOK; } Common::String fileName = getSavegameFilename(_firstSlot + slot); debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str()); // Make sure all graphics was blitted to screen. This fixes bug // #2960567: "AGI: Ego partly erased in Load/Save thumbnails" _gfx->doUpdate(); int result = saveGame(fileName, desc); if (result == errOK) messageBox("Game saved."); else messageBox("Error saving game."); return result; }