void TimeInterpolatorRK4::setDt(const Real& a_dt) { resetData(); m_dt = a_dt; m_gotDt = true; m_coeffs.resize(m_numCoeffs); // setVectorDt uses m_dt; // setVectorDt(vec, a, b, c, d) sets vec := [a, b, c, d]*m_dt setVectorDt(m_coeffs[0], 0., 0., 0., 0.); setVectorDt(m_coeffs[1], 1., 0., 0., 0.); setVectorDt(m_coeffs[2], -3./2., 1., 1., -1./2.); setVectorDt(m_coeffs[3], 2./3., -2./3., -2./3., 2./3.); }
void ImageItem::rotate(const RotateDegree orient) { if (data_ != 0) { int real_orient = getRealOrientation(orient); int prev_orient = getRealOrientation(renderSetting().rotation()); real_orient = (real_orient - prev_orient + 360) % 360; QMatrix matrix; matrix.rotate(static_cast<qreal>(real_orient)); QImage img = data_->transformed(matrix); resetData(img); } }
bool AAGCloudWatcher::Disconnect() { if (cwc != NULL) { resetData(); resetConstants(); cwc->setPWMDutyCycle(1); delete cwc; cwc = NULL; IDMessage(getDefaultName(), "Disconnected from AAG Cloud Watcher\n"); } return true; }
C_SignalProcessing::C_SignalProcessing() { debugLog = SMART_DEBUG_LOG::Instance(); //Execute Processing Tasks in a Seperate Thread moveToThread(&mThread); mThread.start(); mIsAlive.store(true); mRecvThread = std::thread(doRun, this); //Initialize Members resetData(); }
void LLPanelClassifiedInfo::onOpen(const LLSD& key) { LLUUID avatar_id = key["classified_creator_id"]; if(avatar_id.isNull()) { return; } if(getAvatarId().notNull()) { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); } setAvatarId(avatar_id); resetData(); resetControls(); scrollToTop(); setClassifiedId(key["classified_id"]); setClassifiedName(key["classified_name"]); setDescription(key["classified_desc"]); setSnapshotId(key["classified_snapshot_id"]); setFromSearch(key["from_search"]); LL_INFOS() << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << LL_ENDL; LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough); // While we're at it let's get the stats from the new table if that // capability exists. std::string url = gAgent.getRegion()->getCapability("SearchStatRequest"); if (!url.empty()) { LL_INFOS() << "Classified stat request via capability" << LL_ENDL; LLSD body; body["classified_id"] = getClassifiedId(); LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId())); } // Update classified click stats. // *TODO: Should we do this when opening not from search? sendClickMessage("profile"); setInfoLoaded(false); }
void LLPanelProfileTab::onOpen(const LLSD& key) { // Don't reset panel if we are opening it for same avatar. if(getAvatarId() != key.asUUID()) { resetControls(); resetData(); scrollToTop(); } // Update data even if we are viewing same avatar profile as some data might been changed. setAvatarId(key.asUUID()); updateData(); updateButtons(); }
KviHttpRequest::KviHttpRequest() : QObject() { m_p = new KviHttpRequestPrivate(); m_p->pSocket = NULL; m_p->bIsSSL = false; m_p->pConnectTimeoutTimer = NULL; m_p->pBuffer = new KviDataBuffer(); m_p->pFile = NULL; m_pPrivateData = 0; m_bHeaderProcessed = false; m_uConnectionTimeout = 60; resetStatus(); resetData(); }
void inputData() { resetData(); printf("Enter the maximum possible length of the Hamming code: "); scanf("%u", &hammingLength); if (hammingLength == 0) { error("Hamming length can't be 0..."); } printf("Enter the Parity (0 = even, 1 = odd): "); scanf("%u", &parity); if (parity > 1) { error("Parity must be either 0 or 1..."); } printf("\n"); }
void LLPanelMyProfileEdit::onOpen(const LLSD& key) { resetData(); // Disable editing until data is loaded, or edited fields will be overwritten when data // is loaded. enableEditing(false); // force new avatar name fetch so we have latest update time LLAvatarNameCache::fetch(gAgent.getID()); LLPanelMyProfile::onOpen(getAvatarId()); LLAvatarName av_name; if (LLAvatarNameCache::useDisplayNames()) { if (LLAvatarNameCache::get(gAgent.getID(), &av_name) && av_name.mIsDisplayNameDefault) { LLFirstUse::setDisplayName(); } else { LLFirstUse::setDisplayName(false); } } if (LLAvatarNameCache::useDisplayNames()) { getChild<LLUICtrl>("user_label")->setVisible( true ); getChild<LLUICtrl>("user_slid")->setVisible( true ); getChild<LLUICtrl>("display_name_label")->setVisible( true ); getChild<LLUICtrl>("set_name")->setVisible( true ); getChild<LLUICtrl>("set_name")->setEnabled( true ); getChild<LLUICtrl>("solo_user_name")->setVisible( false ); getChild<LLUICtrl>("solo_username_label")->setVisible( false ); } else { getChild<LLUICtrl>("user_label")->setVisible( false ); getChild<LLUICtrl>("user_slid")->setVisible( false ); getChild<LLUICtrl>("display_name_label")->setVisible( false ); getChild<LLUICtrl>("set_name")->setVisible( false ); getChild<LLUICtrl>("set_name")->setEnabled( false ); getChild<LLUICtrl>("solo_user_name")->setVisible( true ); getChild<LLUICtrl>("solo_username_label")->setVisible( true ); } }
PhysicsDirect::~PhysicsDirect() { if (m_data->m_commandProcessor->isConnected()) { m_data->m_commandProcessor->disconnect(); } if (m_data->m_ownsCommandProcessor) { delete m_data->m_commandProcessor; } resetData(); delete m_data; }
/** * Create a domain with regular values in an interval. The step in values is * (endX - startX) / (n - 1). * If n == 1 creates a single value of (startX + endX) / 2. * @param startX :: The start of an interval. * @param endX :: The end of an interval. * @param n :: Number of values to create. */ FunctionDomain1DVector::FunctionDomain1DVector(const double startX, const double endX, const size_t n) : FunctionDomain1D(NULL, 0) { if (n == 0) { throw std::invalid_argument("FunctionDomain1D cannot have zero size."); } m_X.resize(n); if (n == 1) { m_X[0] = (startX + endX) / 2; } else { const double dx = (endX - startX) / double(n - 1); for (size_t i = 0; i < n; ++i) { m_X[i] = startX + dx * double(i); } } resetData(&m_X[0], m_X.size()); }
void inputData() { unsigned i, j; resetData(); printf("* Enter fixed numbers for all input. (1, 2, 4, 8, 16, 32, etc)\n"); printf("* Cache size must be smaller than or equal to main memory size.\n"); printf("* Block Size must be smaller than or equal to cache size.\n"); printf("Enter main memory size (words): "); scanf("%d", &mainMemorySize); if (mainMemorySize < 0 || validNumber(mainMemorySize) == 0) { error("Invalid main memory size..."); } printf("Enter cache size (words): "); scanf("%u", &cacheSize); if (validNumber(cacheSize) == 0 || cacheSize > mainMemorySize) { error("Invalid cache size..."); } printf("Enter block size (words/block): "); scanf("%u", &blockSize); if (validNumber(blockSize) == 0 || blockSize > cacheSize) { error("Invalid block size..."); } lines = cacheSize / blockSize; mainMemory = (int *)malloc(mainMemorySize * sizeof(int)); for (i = 0; i < mainMemorySize; i++) { mainMemory[i] = mainMemorySize - i; } cache = (Line *)malloc(lines * sizeof(Line)); for (i = 0; i < lines; i++) { cache[i].tag = -1; cache[i].block = (int *)malloc(blockSize * sizeof(int)); for (j = 0; j < blockSize; j++) { cache[i].block[j] = 0; } } printf("\n"); }
void setup() { // Serial.begin(9600); // init resetData(); // dec_init(); // pixel_segment = 0; // pixel_count = 0; // pixel_start = 0; // for (uint8_t i = 0; i < DEC_MAX_NUMBER_OF_PIXELS_PER_LIGHT_STRIP; ++i) // { // red_buffer[i] = (uint8_t)0; // green_buffer[i] = (uint8_t)0; // blue_buffer[i] = (uint8_t)0; // } CPU_PRESCALE(0); /* Run at 16 MHz */ DDRD = _BV(DDD6); /* Teensy onboard Led Enable */ /* ADC */ DDRF = ~_BV(DDF0); /* F0 as Input */ //PORTF = _BV(PORTF0); /* Enable Pullup */ DIDR0 = _BV(ADC0D); /* Disable Digital Pin */ // initialize the digital pin as an output to blink the LED. // pinMode(led_pin, OUTPUT); dbg_init ; /* If Debug State On, Init USB */ SPI_Init(SPI_DP2, SPI_PRESC_1); /* AVR SPI Init */ do { ENC_Init(MACAddr); /* ENC28J60 Init */ _delay_ms(500); aux_init = ENC_RevID; } while (!aux_init); ENC_LEDInit; /* ENC Leds Init */ is_setup = 0; }
KviHttpRequest::KviHttpRequest() : QObject() { m_p = new KviHttpRequestPrivate(); m_p->pSocket = nullptr; m_p->bIsSSL = false; m_p->pConnectTimeoutTimer = nullptr; m_p->pBuffer = new KviDataBuffer(); m_p->pFile = nullptr; m_pPrivateData = nullptr; m_bHeaderProcessed = false; m_uConnectionTimeout = 60; m_bFollowRedirects = true; m_uRedirectCount = 0; m_uMaximumRedirectCount = 2; resetStatus(); resetData(); }
int main(int argSize, char ** argArray) { unsigned repeat = 1, input; while (repeat == 1) { input = 5; printf("Main memory to Cache mapping:\n"); printf("-----------------------------\n"); printf("1) Set parameters\n"); printf("2) Read from cache\n"); printf("3) Write to cache\n"); printf("4) Snapshot of cache\n"); printf("5) Exit\n\n"); printf("Enter selection: "); scanf("%u", &input); switch (input) { case 1: inputData(); break; case 2: accessCache(1); break; case 3: accessCache(2); break; case 4: printLine(); break; case 5: printf("Goodbye.\n"); resetData(); repeat = 0; break; default: printf("Please enter 1, 2, 3, 4 or 5...\n\n"); } } return 0; }
RestorePanel::RestorePanel(QWidget *parent) : QWidget(parent) { save = new QPushButton(QIcon::fromTheme("document-save"), "", this); save->setToolTip("Save current page state"); revert = new QPushButton(QIcon::fromTheme("document-revert"), "", this); revert->setToolTip("Revert to previous page state"); restoreMenu = new DeviceRestoreMenu(this); restoreMenu->revertData->setEnabled(false); revert->setMenu(restoreMenu); panelLayout = new QHBoxLayout(this); panelLayout->addWidget(save); panelLayout->addWidget(revert); panelLayout->addStretch(-1); setLayout(panelLayout); connect(save, SIGNAL(clicked()), this, SIGNAL(saveData())); connect(restoreMenu->revertData, SIGNAL(triggered()), this, SIGNAL(revertData())); connect(restoreMenu->resetData, SIGNAL(triggered()), this, SIGNAL(resetData())); }
BOOL LLPanelAvatarProfile::postBuild() { childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL); childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL); childSetCommitCallback("overflow_btn", boost::bind(&LLPanelAvatarProfile::onOverflowButtonClicked, this), NULL); childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL); childSetCommitCallback("show_on_map_btn", (boost::bind( &LLPanelAvatarProfile::onMapButtonClick, this)), NULL); LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("Profile.ShowOnMap", boost::bind(&LLPanelAvatarProfile::onMapButtonClick, this)); registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this)); registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this)); registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this)); registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this)); registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this)); LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; enable.add("Profile.EnableShowOnMap", boost::bind(&LLPanelAvatarProfile::enableShowOnMap, this)); enable.add("Profile.EnableGod", boost::bind(&enable_god)); enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this)); enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this)); mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); resetControls(); resetData(); return TRUE; }
OS_Booting::OS_Booting( QWidget *parent, QString _xmlDesc) : _QWidget(parent), xmlDesc(_xmlDesc) { setObjectName("OS_Booting"); // workaround editor = new QTextEdit(this); // scrolledLayout = new QVBoxLayout(this); scrolledLayout->addWidget(editor); scrolledLayout->addStretch(-1); scrolled = new QWidget(this); scrolled->setLayout(scrolledLayout); restorePanel = new RestorePanel(this); commonWdg = new QScrollArea(this); commonWdg->setWidget(scrolled); commonWdg->setWidgetResizable(true); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(restorePanel, 0, Qt::AlignRight); commonLayout->addWidget(commonWdg); commonLayout->addStretch(-1); setLayout(commonLayout); readXMLDesciption(); // dataChanged connections connect(editor, SIGNAL(textChanged()), this, SIGNAL(dataChanged())); connect(this, SIGNAL(dataChanged()), restorePanel, SLOT(stateChanged())); // action connections connect(restorePanel, SIGNAL(resetData()), this, SLOT(resetSecData())); connect(restorePanel, SIGNAL(revertData()), this, SLOT(revertSecData())); connect(restorePanel, SIGNAL(saveData()), this, SLOT(saveSecData())); }
QCvCameraCalibration::QCvCameraCalibration(QObject *parent) { // Initialize States initialize(); // Initialize Menu menu = new QMenu("Calibration"); action_Settings = new QAction(tr("Calibration &Settings"),this); connect(action_Settings,SIGNAL(triggered()),this,SLOT(getSettingsDlg())); action_Reset = new QAction(tr("&Reset Data"),this); connect(action_Reset,SIGNAL(triggered()),this,SLOT(resetData())); action_Calibrate = new QAction(tr("&Generate Calibration"),this); connect(action_Calibrate,SIGNAL(triggered()),this,SLOT(calibrate())); action_Load = new QAction(tr("&Load Calibration"),this); connect(action_Load,SIGNAL(triggered()),this,SLOT(load())); menu->addAction(action_Settings); menu->addAction(action_Reset); menu->addAction(action_Calibrate); menu->addAction(action_Load); settingsDlg = new QCvCameraCalibrationDlg(&s); }
void resetData(const QVector<ThresholdT>& thresholdLimits) {resetData(); m_thresholdsLimits = thresholdLimits;}
bool parseDotaData (char const* dest, char const* path) { MPQARCHIVE map = MPQOpen (path, MPQFILE_READ); if (map == 0) map = MPQOpen (mprintf ("%s%s", warPath, path), MPQFILE_READ); if (map == 0) { if (useropen) MessageBox (NULL, mprintf ("Could not locate %s", path), "Error", MB_OK | MB_ICONHAND); return false; } MPQAddArchive (warloader, map); CProgressDlg* prg = ((CDotAReplayApp*) ::AfxGetApp ())->progress; char title[256]; _splitpath (path, NULL, NULL, title, NULL); prg->SetSupText (mprintf ("Parsing %s", title), 0); prg->SetSubText ("Parsing object data..."); prg->show (); GameData data; LoadGameData (data, warloader, WC3_LOAD_UNITS | WC3_LOAD_ITEMS | WC3_LOAD_ABILITIES); resetData (); bool ok = true; dir = NULL; idir = NULL; reset_id (); int tavernCount = 0; prg->SetSubText ("Parsing taverns and shops...", 40); for (int i = 0; i < data.data[WC3_UNITS]->getNumUnits (); i++) { UnitData* tav = data.data[WC3_UNITS]->getUnit (i); if (tav != NULL) { char const* name = tav->getStringData ("Name"); for (int ti = 0; ti < numTaverns; ti++) { if (!stricmp (taverns[ti].name, name)) { tavernCount++; char const* herolist = tav->getData ("Sellunits"); for (int p = 0; herolist[p];) { static char _id[5]; int idl = 0; for (; idl < 4 && herolist[p]; idl++, p++) _id[idl] = herolist[p]; if (idl == 4) { _id[4] = 0; if (getValue (dir, _id) == 0) { UnitData* hero = data.data[WC3_UNITS]->getUnitById (_id); if (hero) addHero (data.data[WC3_ABILITIES], hero, ti); dir = addString (dir, _id, 1); } } if (herolist[p] == ',') p++; else break; } } } for (int si = 0; si < numShops; si++) { if (!stricmp (shops[si].name, name)) { for (int m = 0; m < 2; m++) { char const* itemlist = tav->getData (m ? "Sellitems" : "Sellunits"); for (int p = 0; itemlist[p];) { static char _id[5]; int idl = 0; for (; idl < 4 && itemlist[p]; idl++, p++) _id[idl] = itemlist[p]; if (idl == 4) { _id[4] = 0; if (getValue (dir, _id) == 0) { UnitData* item = data.data[m ? WC3_ITEMS : WC3_UNITS]->getUnitById (_id); if (item) if (addSoldItem (item)) dir = addString (dir, _id, 1); } } if (itemlist[p] == ',') p++; else break; } } break; } } } } if (tavernCount == 0) { for (int i = 0; i < data.data[WC3_UNITS]->getNumUnits (); i++) { UnitData* tav = data.data[WC3_UNITS]->getUnit (i); if (tav != NULL) { char const* name = tav->getStringData ("Name"); for (int ti = 0; ti < numOldTaverns; ti++) { if (!stricmp (oldTaverns[ti], name)) { char const* herolist = tav->getData ("Sellunits"); for (int p = 0; herolist[p];) { static char _id[5]; int idl = 0; for (; idl < 4 && herolist[p]; idl++, p++) _id[idl] = herolist[p]; if (idl == 4) { _id[4] = 0; if (getValue (dir, _id) == 0) { UnitData* hero = data.data[WC3_UNITS]->getUnitById (_id); if (hero) addHero (data.data[WC3_ABILITIES], hero, ti); dir = addString (dir, _id, 1); } } if (herolist[p] == ',') p++; else break; } } } } } } prg->SetSubText ("Parsing items...", 60); for (int i = 0; i < numItems; i++) { if (items[i].index == 0) continue; if (items[i].type == ITEM_RECIPE) { // parse recipe UnitData* unit = data.data[WC3_ITEMS]->getUnitById (items[i].ids[0]); if (unit == NULL) unit = data.data[WC3_UNITS]->getUnitById (items[i].ids[0]); if (unit) { char const* descr = strstr (unit->getStringData ("Ubertip"), "Requires:"); if (descr && (strstr (descr, "Any of the following") || strstr (descr, "Staff of Wizardry and Blade of Alacrity"))) { // scepter int scepter = items[items[i].realid].ids[0]; int recipe = items[i].ids[0]; int booster = _getItemByName ("Point Booster"); int axe = _getItemByName ("Ogre Axe"); int blade = _getItemByName ("Blade of Alacrity"); int staff = _getItemByName ("Staff of Wizardry"); recipes[numRecipes].recipeid = recipe; recipes[numRecipes].result = scepter; recipes[numRecipes].numsrc = 4; recipes[numRecipes].srcid[0] = recipe; recipes[numRecipes].srccount[0] = 1; recipes[numRecipes].srcid[1] = booster; recipes[numRecipes].srccount[1] = 1; recipes[numRecipes].srcid[2] = axe; recipes[numRecipes].srccount[2] = 1; recipes[numRecipes].srcid[3] = blade; recipes[numRecipes].srccount[3] = 1; numRecipes++; recipes[numRecipes].recipeid = recipe; recipes[numRecipes].result = scepter; recipes[numRecipes].numsrc = 4; recipes[numRecipes].srcid[0] = recipe; recipes[numRecipes].srccount[0] = 1; recipes[numRecipes].srcid[1] = booster; recipes[numRecipes].srccount[1] = 1; recipes[numRecipes].srcid[2] = axe; recipes[numRecipes].srccount[2] = 1; recipes[numRecipes].srcid[3] = staff; recipes[numRecipes].srccount[3] = 1; numRecipes++; recipes[numRecipes].recipeid = recipe; recipes[numRecipes].result = scepter; recipes[numRecipes].numsrc = 4; recipes[numRecipes].srcid[0] = recipe; recipes[numRecipes].srccount[0] = 1; recipes[numRecipes].srcid[1] = booster; recipes[numRecipes].srccount[1] = 1; recipes[numRecipes].srcid[2] = staff; recipes[numRecipes].srccount[2] = 1; recipes[numRecipes].srcid[3] = blade; recipes[numRecipes].srccount[3] = 1; numRecipes++; } else if (descr) { recipes[numRecipes].numsrc = 0; recipes[numRecipes].recipeid = 0; if (items[i].cost) { recipes[numRecipes].srccount[0] = 1; recipes[numRecipes].srcid[0] = items[i].ids[0]; recipes[numRecipes].numsrc = 1; recipes[numRecipes].recipeid = items[i].ids[0]; } recipes[numRecipes].result = items[items[i].realid].ids[0]; int num = 0; int pos = 0; int prev = 0; bool prevOr = false; while (true) { if (descr[pos] == 0 || (descr[pos] == '|' && descr[pos + 1] == 'n')) { if (num) { char* iname = strip_item (descr + prev, pos - prev); int count = 1; bool hasx = false; if (*iname >= '0' && *iname <= '9') { count = atoi (iname); while (*iname && *iname != ' ') { if (*iname == 'x') hasx = true; iname++; } while (*iname == ' ') iname++; } if (count > 1) { int len = (int) strlen (iname); if (len && iname[len - 1] == 's') iname[--len] = 0; } int upgrLen = (int) strlen ("Buy recipe to upgrade ("); if (!stricmp (iname, "or")) prevOr = true; else if (!strnicmp (iname, "Buy recipe to upgrade (", upgrLen)) { int levels = atoi (iname + upgrLen); int iid = items[i].realid; for (int lvl = 2; lvl <= levels; lvl++) { numRecipes++; recipes[numRecipes].numsrc = 2; recipes[numRecipes].srcid[0] = recipes[numRecipes - 1].srcid[0]; recipes[numRecipes].srccount[0] = 1; recipes[numRecipes].srcid[1] = recipes[numRecipes - 1].result; recipes[numRecipes].srccount[1] = 1; items[numItems].ids[0] = new_id (); recipes[numRecipes].result = items[numItems].ids[0]; items[numItems].numIds = 1; sprintf (items[numItems].name, "%s %d", items[iid].name, lvl); strcpy (items[numItems].imgTag, items[iid].imgTag); items[numItems].index = numItems; items[numItems].type = ITEM_COMBO; items[numItems].realid = i; items[numItems].cost = 0; idir = saddString (idir, items[numItems].name, numItems + 1); numItems++; } strcat (items[iid].name, " 1"); idir = saddString (idir, items[iid].name, iid + 1); } else { int cpos = sgetValue (idir, iname) - 1; if (cpos >= 0) { if (prevOr) { memcpy (&recipes[numRecipes + 1], &recipes[numRecipes], sizeof recipes[0]); numRecipes++; recipes[numRecipes].srcid[recipes[numRecipes].numsrc - 1] = items[cpos].ids[0]; recipes[numRecipes].srccount[recipes[numRecipes].numsrc - 1] = count; } else { recipes[numRecipes].srcid[recipes[numRecipes].numsrc] = items[cpos].ids[0]; recipes[numRecipes].srccount[recipes[numRecipes].numsrc] = count; recipes[numRecipes].numsrc++; } prevOr = false; } } } num++; if (descr[pos] == 0) break; pos += 2; prev = pos; } else pos++; } if (recipes[numRecipes].numsrc) numRecipes++; } } } } for (int i = 0; i < data.data[WC3_ITEMS]->getNumUnits (); i++) { UnitData* item = data.data[WC3_ITEMS]->getUnit (i); if (item != NULL) mergeItemName (item); } for (int i = 0; i < data.data[WC3_UNITS]->getNumUnits (); i++) { UnitData* item = data.data[WC3_UNITS]->getUnit (i); if (item != NULL) mergeItemName (item); } prg->SetSubText ("Parsing upgradeable abilities...", 80); for (int i = 0; i < data.data[WC3_ABILITIES]->getNumUnits (); i++) { UnitData* abil = data.data[WC3_ABILITIES]->getUnit (i); if (abil != NULL && !strcmp (abil->getStringData ("code"), "ANeg")) addEngineering (abil); } prg->SetSubText ("Computing recipe costs...", 90); for (int i = 0; i < numRecipes; i++) { int res = getItemById (recipes[i].result)->index; if (res > 0 && items[res].type >= 0) { items[res].cost = 0; items[res].type = -items[res].type; } } for (int maxc = 0; maxc < 20; maxc++) { bool total = true; for (int i = 0; i < numRecipes; i++) { int res = getItemById (recipes[i].result)->index; if (res > 0 && items[res].type < 0) { bool ok = true; items[res].cost = 0; for (int j = 0; j < recipes[i].numsrc; j++) { int comp = getItemById (recipes[i].srcid[j])->index; if (comp > 0) { if (items[comp].type < 0) { ok = false; break; } else items[res].cost += items[comp].cost * recipes[i].srccount[j]; } } if (!ok) total = false; else items[res].type = ITEM_COMBO; } } if (total) break; } //FILE* log = fopen ("recipes.txt", "wt"); //for (int i = 0; i < numRecipes; i++) //{ // int res = getItemById (recipes[i].result)->index; // if (res <= 0) continue; // fprintf (log, "%s =", items[res].name); // for (int j = 0; j < recipes[i].numsrc; j++) // { // int comp = getItemById (recipes[i].srcid[j])->index; // if (comp > 0) // fprintf (log, " %s x%d", items[comp].name, recipes[i].srccount[j]); // } // fprintf (log, "\n"); //} //fclose (log); delete dir; delete idir; MPQRemoveArchive (warloader, map); MPQClose (map); prg->hide (); if (!ok) return false; return saveDotaData (dest); }
CMarkdownEditorDoc::CMarkdownEditorDoc() { // TODO: 在此添加一次性构造代码 resetData(); }
Texture::Texture(int width, int height, int nChannels, const TextureType::Enum& textureType /*= TextureType::kColor*/) : TextureBuffer(width, height, nChannels), m_textureType(textureType) { resetData(); }
void KviHttpRequest::reset() { resetStatus(); resetData(); resetInternalStatus(); }
DataManager::DataManager() { m_bPhysicEnable = true; resetData(); }
OS_Booting::OS_Booting( QWidget *parent, QString _caps, QString _xmlDesc) : _Tab(parent), capabilities(_caps), xmlDesc(_xmlDesc) { setObjectName("OS_Booting"); readCapabilities(); bootType = new BootType(this); bootSet = new QStackedWidget(this); bootSet->addWidget(new BIOS_Boot(this, capabilities)); bootSet->addWidget(new Host_Boot(this)); bootSet->addWidget(new Direct_Kernel_Boot(this)); bootSet->addWidget(new LXC_OSBooting(this, capabilities)); bootSet->widget(0)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(1)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(2)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(3)->setEnabled(type.toLower().compare("lxc")==0); bootType->osType->setEnabled(type.toLower().compare("lxc")!=0); connect(bootType->bootType, SIGNAL(currentIndexChanged(int)), bootSet, SLOT(setCurrentIndex(int))); connect(bootType->bootType, SIGNAL(currentIndexChanged(int)), this, SLOT(changeBootType())); //scrolledLayout = new QVBoxLayout(this); //scrolledLayout->addWidget(bootType); //scrolledLayout->addWidget(bootSet); //scrolledLayout->addStretch(-1); //scrolled = new QWidget(this); //scrolled->setLayout(scrolledLayout); restorePanel = new RestorePanel(this); //commonWdg = new QScrollArea(this); //commonWdg->setWidget(scrolled); //commonWdg->setWidgetResizable(true); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(restorePanel, 0, Qt::AlignRight); //commonLayout->addWidget(commonWdg); commonLayout->addWidget(bootType); commonLayout->addWidget(bootSet); commonLayout->addStretch(-1); setLayout(commonLayout); readXMLDesciption(); // dataChanged connections connect(this, SIGNAL(dataChanged()), restorePanel, SLOT(stateChanged())); connect(bootType->osType, SIGNAL(textEdited(QString)), this, SLOT(stateChanged())); // action connections connect(restorePanel, SIGNAL(resetData()), this, SLOT(resetData())); connect(restorePanel, SIGNAL(revertData()), this, SLOT(revertData())); connect(restorePanel, SIGNAL(saveData()), this, SLOT(saveData())); for (int i=0; i<bootSet->count(); i++) { connect(bootSet->widget(i), SIGNAL(domainType(const QString&)), this, SIGNAL(domainType(const QString&))); connect(bootSet->widget(i), SIGNAL(osType(const QString&)), this, SLOT(changeOSType(const QString&))); connect(bootSet->widget(i), SIGNAL(emulatorType(const QString&)), this, SIGNAL(emulatorType(const QString&))); connect(bootSet->widget(i), SIGNAL(dataChanged()), this, SLOT(stateChanged())); }; BIOS_Boot *wdg = static_cast<BIOS_Boot*>(bootSet->widget(0)); connect(wdg->architecture, SIGNAL(maxVCPU(const QString&)), this, SIGNAL(maxVCPU(const QString&))); connect(wdg->architecture, SIGNAL(archType(const QString&)), this, SIGNAL(archChanged(const QString&))); }
siblingData::siblingData(os::smart_ptr<tnet::Connection> con) { connection=con; resetData(); }
bool DecompressSelector::reset(Interpreter* R) { R->resetSymbolTable(); return IsAlgorithm ? resetAlgorithm(R) : resetData(R); }
MainWindow::MainWindow(QString filename, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowTitle(QApplication::applicationName()+" "+ QApplication::applicationVersion()); //ui->lastValuesBox->hide(); bytesRead=0; bytesWritten=0; lastValueDoubleClick=new DoubleClickEventFilter(this); ui->lastValuesBox->installEventFilter(lastValueDoubleClick); connect (lastValueDoubleClick,SIGNAL(doubleClicked()),this,SLOT(clearLastValues())); connect (lastValueDoubleClick,SIGNAL(doubleClicked()),this,SLOT(initLastValues())); appSettings=new QSettings(QSettings::IniFormat,QSettings::UserScope,QApplication::organizationName(),QApplication::applicationName(),this); data=new ExperimentData(this); dilatometerData=new DilatometerData(this); data->setDilatometerData(dilatometerData); experiment=new Experiment(&tcpClient,this); dilatometerPlot=NULL; plot=new Plot(this); plot->setExperimentData(data); plot->setAxisTitle(QwtPlot::xBottom,tr("t, sec")); ui->plotLayout->addWidget(plot); connect(ui->actionFullscreen,SIGNAL(triggered(bool)),this,SLOT(setFullscreen(bool))); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(ui->actionConnect_to,SIGNAL(triggered()),this,SLOT(connectTo())); connect(ui->actionDisconnect,SIGNAL(triggered()),this,SLOT(socketDisconnect())); connect(ui->actionViewData,SIGNAL(triggered()),this,SLOT(showDataViewWindow())); connect(ui->actionReplot,SIGNAL(triggered()),plot,SLOT(replot())); connect(ui->actionClear_plot,SIGNAL(triggered()),plot,SLOT(clear())); connect(ui->actionInitialize,SIGNAL(triggered()),plot,SLOT(initialize())); connect(ui->actionSelect_points,SIGNAL(toggled(bool)),plot,SLOT(selectPointsMode(bool))); connect(ui->actionZoom_to_extents,SIGNAL(triggered()),plot,SLOT(zoomExtents())); connect(ui->actionDraw_incremental,SIGNAL(triggered(bool)),plot,SLOT(setIncrementalDraw(bool))); connect(ui->actionOpen_file,SIGNAL(triggered()),SLOT(openFile())); connect(ui->actionSave_as,SIGNAL(triggered()),SLOT(saveFile())); connect(ui->actionMonitoring_interval,SIGNAL(triggered()),SLOT(setMonitoringInterval())); connect(ui->actionSetup,SIGNAL(triggered()),SLOT(showSetupCurvesDialog())); connect(ui->actionSet_interval,SIGNAL(triggered()),SLOT(setInterval())); connect(ui->actionControl,SIGNAL(triggered()),SLOT(viewExperimentControlDialog())); connect(ui->actionStart,SIGNAL(triggered(bool)),&tcpClient,SLOT(start(bool))); connect(ui->actionApproximate,SIGNAL(triggered()),SLOT(approximate())); connect(ui->actionShow_approximations,SIGNAL(triggered(bool)),plot,SLOT(showApproximationCurves(bool))); connect(ui->actionConfiguration,SIGNAL(triggered()),SLOT(showConfigurationDialog())); connect(ui->actionLast_calculation,SIGNAL(triggered()),SLOT(showCalculationLog())); connect(ui->actionDilatometry,SIGNAL(toggled(bool)),SLOT(showDilatometryPlot(bool))); connect(ui->actionZoom_yLeft_to_extents,SIGNAL(triggered()),SLOT(zoomYLeftToExtents())); connect(ui->actionAbout_Qt,SIGNAL(triggered()),QApplication::instance(),SLOT(aboutQt())); connect(ui->actionAbout,SIGNAL(triggered()),SLOT(showAbout())); connect(ui->actionSet_tolerance_alarm,SIGNAL(triggered()),plot,SLOT(setToleranceAlarm())); connect(ui->actionRemove_tolerance_alarm,SIGNAL(triggered()),plot,SLOT(removeToleranceAlarm())); connect(ui->actionView_tolerance,SIGNAL(triggered()),SLOT(showToleranceAlarmState())); plot->enableAutoZoom(ui->actionAuto_zoom->isChecked()); connect(ui->actionAuto_zoom,SIGNAL(triggered(bool)),plot,SLOT(enableAutoZoom(bool))); //ui->actionDraw_incremental->trigger(); connect(plot,SIGNAL(message(QString)),statusBar(),SLOT(showMessage(QString))); connect(ui->actionSelectT0,SIGNAL(toggled(bool)),plot,SLOT(selectT0(bool))); connect(plot,SIGNAL(T0Selected(bool)),ui->actionSelectT0,SLOT(trigger())); connect(plot,SIGNAL(T0Selected(bool)),ui->actionSelect_points,SLOT(setChecked(bool))); connect(plot,SIGNAL(toleranceAlarmSet(bool)),SLOT(toleranceAlarmStatusChange(bool))); connect(plot,SIGNAL(curvePointClicked(QwtPlotCurve*,int)),this,SLOT(updateSelectedValue(QwtPlotCurve*,int))); connect(&tcpClient,SIGNAL(connected()),this,SLOT(socketConnectedToServer())); connect(&tcpClient,SIGNAL(disconnected()),this,SLOT(socketDisconnectedFromServer())); connect(&tcpClient,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(socketStateChanged(QAbstractSocket::SocketState))); connect(&tcpClient,SIGNAL(dataLine(QByteArray&)),data,SLOT(parseLine(QByteArray&))); connect(&tcpClient,SIGNAL(initialData()),plot,SLOT(clear())); connect(&tcpClient,SIGNAL(initialData()),data,SLOT(resetData())); connect(&tcpClient,SIGNAL(serverStatus(bool)),ui->actionStart,SLOT(setChecked(bool))); connect(&tcpClient,SIGNAL(bytesWritten(int)),this,SLOT(appendBytesWritten(int))); connect(&tcpClient,SIGNAL(bytesRead(int)),this,SLOT(appendBytesRead(int))); connect(&tcpClient,SIGNAL(serverInterval(int)),experiment,SLOT(setInterval(int))); connect(data,SIGNAL(initialized()),plot,SLOT(initialize())); connect(data,SIGNAL(initialized()),this,SLOT(initLastValues())); connect(data,SIGNAL(pointCount(int)),&pointCountLabel,SLOT(setNum(int))); connect(data,SIGNAL(pointCount(int)),plot,SLOT(drawLastPoint())); /** This connection will cause to plot VLine markers*/ //connect(data,SIGNAL(marker(QPointF,int)),plot,SLOT(appendMarker(QPointF,int))); connect(data,SIGNAL(marker(int)),plot,SLOT(appendMarker(int))); connect(data,SIGNAL(pointCount(int)),this,SLOT(updateLastValues())); connect(data,SIGNAL(heaterPower(int)),this,SLOT(setHeaterPower(int))); connectionLabel.setText("*"); connectionLabel.setToolTip(tr("Connection status:\nGreen - connected\nRed - disconnected")); connectionLabel.setStyleSheet("QLabel {color:red; font-weight:bold;}"); pointCountLabel.setText("0"); pointCountLabel.setToolTip(tr("Number of points")); bytesWrittenLabel.setText("0"); bytesWrittenLabel.setToolTip("Bytes written to network"); bytesReadLabel.setText("0"); bytesReadLabel.setToolTip("Bytes read from network"); ui->heaterPowerBar->setStyleSheet("QProgressBar::chunk {margin: 0px; width: 1px;}"); ui->statusBar->addPermanentWidget(&bytesReadLabel); ui->statusBar->addPermanentWidget(&bytesWrittenLabel); ui->statusBar->addPermanentWidget(&pointCountLabel); ui->statusBar->addPermanentWidget(&connectionLabel); //if file was specified on startup - try open it if (!filename.isEmpty()) openFile(filename); }
int ClientInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: sendMessage(); break; case 1: chat((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< ENUM_TYPE(*)>(_a[4]))); break; case 2: changeServerInformations((*reinterpret_cast< ServerInformations(*)>(_a[1]))); break; case 3: changeClientID((*reinterpret_cast< CLID(*)>(_a[1]))); break; case 4: changeClientNickname((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 5: showError((*reinterpret_cast< ENUM_TYPE(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 6: changeGameMaster((*reinterpret_cast< CLID(*)>(_a[1]))); break; case 7: clientVoted((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< CLID(*)>(_a[2]))); break; case 8: connectionEtablished(); break; case 9: connectionLost(); break; case 10: diceRolled((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< quint16(*)>(_a[2])),(*reinterpret_cast< quint16(*)>(_a[3]))); break; case 11: sanctionned((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< ENUM_TYPE(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; case 12: rollDice(); break; case 13: rollSpecialDice(); break; case 14: serverName((*reinterpret_cast< QString(*)>(_a[1]))); break; case 15: motdChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 16: gameLaunched(); break; case 17: setTitle(); break; case 18: playSound((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 19: updatePlayerList(); break; case 20: clientJoined((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 21: clientLeft((*reinterpret_cast< CLID(*)>(_a[1]))); break; case 22: updateGMLabel(); break; case 23: updateGMPanel(); break; case 24: { bool _r = addLanguage(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 25: { bool _r = addLanguage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 26: languageListMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 27: { bool _r = removeLanguage((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 28: removeLanguageMenu(); break; case 29: importLanguageList(); break; case 30: sendLanguageList(); break; case 31: { CLID _r = CLIDFromString((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< CLID*>(_a[0]) = _r; } break; case 32: switchConnectionState(); break; case 33: openSettings(); break; case 34: openSoundsGUI(); break; case 35: aboutUs(); break; case 36: aboutServer(); break; case 37: openMapEditor(); break; case 38: clearMapEditor(); break; case 39: mapFlare(); break; case 40: resetData(); break; case 41: setCSS((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 42: setCSS(); break; case 43: setInterface((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 44: setInterface(); break; case 45: playerListMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 46: actionKick(); break; case 47: actionBan(); break; case 48: actionVoteGM(); break; case 49: actionChangeGM(); break; case 50: refresh(); break; case 51: textChanged(); break; case 52: narrationChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 53: syncSoundLibs((*reinterpret_cast< QList<SoundLibInformations>(*)>(_a[1]))); break; case 54: syncLanguagesList((*reinterpret_cast< QList<QPair<QString,QString> >(*)>(_a[1]))); break; case 55: syncDictionariesList((*reinterpret_cast< QStringList(*)>(_a[1]))); break; case 56: requestScriptDownload((*reinterpret_cast< QString(*)>(_a[1]))); break; case 57: sendScriptToServer((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 58: deleteScript((*reinterpret_cast< QString(*)>(_a[1]))); break; case 59: renameScript((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 60: makeEntity((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 61: deleteEntity((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 62: injectCode((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 63: scriptToGMMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 64: scriptToOwnerMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 65: scriptActionMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 66: scriptToPlayerMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 67: scriptMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 68: scriptError((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 69: sendMapToServer((*reinterpret_cast< const MapInformations*const(*)>(_a[1])),(*reinterpret_cast< const QMap<QString,RSID>(*)>(_a[2]))); break; case 70: addDictionnary(); break; case 71: saveGame(); break; case 72: loadGame(); break; case 73: VOIPRemoveClient(); break; case 74: VOIPAddClient(); break; case 75: VOIPClientVolume(); break; case 76: dataPerSecond((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; default: ; } _id -= 77; } return _id; }