void APMFirmwareVersion::parseVersion(const QString &versionText) { if (versionText.isEmpty()) { return; } if (VERSION_REXP.indexIn(versionText) == -1) { QLOG_WARN() << "firmware version regex didn't match anything" << "version text to be parsed" << versionText; return; } QStringList capturedTexts = VERSION_REXP.capturedTexts(); if (capturedTexts.count() < 5) { QLOG_WARN() << "something wrong with parsing the version text, not hitting anything" << VERSION_REXP.captureCount() << VERSION_REXP.capturedTexts(); return; } // successful extraction of version numbers // even though we could have collected the version string atleast // but if the parsing has faild, not much point _versionString = versionText; _vehicleType = capturedTexts[1]; _major = capturedTexts[2].toInt(); _minor = capturedTexts[3].toInt(); _patch = capturedTexts[4].toInt(); }
void SystemComponent::runUserScript(QString script) { // We take the path the user supplied and run it through fileInfo and // look for the fileName() part, this is to avoid people sharing keymaps // that tries to execute things like ../../ etc. Note that this function // is still not safe, people can do nasty things with it, so users needs // to be careful with their keymaps. // QFileInfo fi(script); QString scriptPath = Paths::dataDir("scripts/" + fi.fileName()); QFile scriptFile(scriptPath); if (scriptFile.exists()) { if (!QFileInfo(scriptFile).isExecutable()) { QLOG_WARN() << "Script:" << script << "is not executable"; return; } QLOG_INFO() << "Running script:" << scriptPath; if (QProcess::startDetached(scriptPath, QStringList())) QLOG_DEBUG() << "Script started successfully"; else QLOG_WARN() << "Error running script:" << scriptPath; } else { QLOG_WARN() << "Could not find script:" << scriptPath; } }
QString Server::replaceMacros(QString const& input, Process* process) { JobInfo* jobInfo(process->jobInfo()); QString output(input); qDebug() << "Server::replaceMacros:"; qDebug() << output; output.replace("${QC}", m_qchemEnvironment); output.replace("${EXE_NAME}", m_executableName); output.replace("${JOB_ID}", process->id()); output.replace("${JOB_NAME}", jobInfo->get(JobInfo::BaseName)); output.replace("${QUEUE}", jobInfo->get(JobInfo::Queue)); output.replace("${WALLTIME}", jobInfo->get(JobInfo::Walltime)); output.replace("${MEMORY}", jobInfo->get(JobInfo::Memory)); output.replace("${JOBFS}", jobInfo->get(JobInfo::Jobfs)); output.replace("${NCPUS}", jobInfo->get(JobInfo::Ncpus)); if (output.contains("${")) { QLOG_WARN() << "Unmatched macros found in string:"; QLOG_WARN() << input; } qDebug() << "Substituted output"; qDebug() << output; return output; }
QString Server::replaceMacros(QString const& input, Process* process) { QString output(input); //qDebug() << "Server::replaceMacros on string:" << output; output.replace("${USER}", m_userName); // output.replace("${QC}", m_qchemEnvironment); output.replace("${EXE_NAME}", m_executableName); // bit of a hack, we don't need the executable name for an HTTP server, so // we store the location of the cgi scripts instead. output.replace("${CGI_ROOT}", m_executableName); output.replace("${SERVER}", m_name); if (process) { JobInfo* jobInfo(process->jobInfo()); output.replace("${JOB_ID}", process->id()); output.replace("${JOB_NAME}", jobInfo->get(JobInfo::BaseName)); output.replace("${QUEUE}", jobInfo->get(JobInfo::Queue)); output.replace("${WALLTIME}", jobInfo->get(JobInfo::Walltime)); output.replace("${MEMORY}", jobInfo->get(JobInfo::Memory)); output.replace("${JOBFS}", jobInfo->get(JobInfo::Scratch)); output.replace("${SCRATCH}", jobInfo->get(JobInfo::Scratch)); output.replace("${NCPUS}", jobInfo->get(JobInfo::Ncpus)); } if (output.contains("${")) { QLOG_WARN() << "Unmatched macros found in string:"; QLOG_WARN() << input; } QLOG_DEBUG() << "Substituted output: " << output; return output; }
bool QsLanguage::setApplicationLanguage(const int newLanguageId) { const int newLanguageIndex = indexOf(newLanguageId); if( -1 == newLanguageIndex ) return false; const LanguageItem& newLanguage = mLanguages.at(newLanguageIndex); if( newLanguage.id == mApplicationLanguage ) return true; // remove current translators if( mLangIdToTranslator.contains(mApplicationLanguage) ) qApp->removeTranslator(mLangIdToTranslator.value(mApplicationLanguage, NULL)); if( mLangIdToQtTranslator.contains(mApplicationLanguage) ) qApp->removeTranslator(mLangIdToQtTranslator.value(mApplicationLanguage, NULL)); if( newLanguageId == defaultLanguage().id ) { mApplicationLanguage = newLanguageId; return true; // the default language doesn't need translators } const QString appDir = qApp->applicationDirPath(); if( mLangIdToQtTranslator.contains(newLanguageId) ) qApp->installTranslator(mLangIdToQtTranslator.value(newLanguageId, NULL)); else // try to load from disk { QScopedPointer<QTranslator> t(new QTranslator); const bool loadedQt = t->load(QString("qt_%1.qm").arg(newLanguage.shortName), appDir); if( !loadedQt ) { QLOG_WARN() << "Failed to load Qt translation for" << newLanguage.name; return false; } qApp->installTranslator(t.data()); mLangIdToQtTranslator.insert(newLanguageId, t.take()); } if( mLangIdToTranslator.contains(newLanguageId) ) qApp->installTranslator(mLangIdToTranslator.value(newLanguageId, NULL)); else // try to load from disk { QScopedPointer<QTranslator> t(new QTranslator); const bool loadedApp = t->load(QString("qswallet_%1.qm").arg(newLanguage.shortName), appDir); if( !loadedApp ) { QLOG_WARN() << "Failed to load app translation for" << newLanguage.name; return false; } qApp->installTranslator(t.data()); mLangIdToTranslator.insert(newLanguageId, t.take()); } mApplicationLanguage = newLanguageId; return true; }
void Shop::SubmitShopToForum(bool force) { if (submitting_) { QLOG_WARN() << "Already submitting your shop."; return; } if (threads_.empty()) { QLOG_ERROR() << "Asked to update a shop with no shop ID defined."; return; } if (shop_data_outdated_) Update(); std::string previous_hash = app_.data().Get("shop_hash"); // Don't update the shop if it hasn't changed if (previous_hash == shop_hash_ && !force) return; if (threads_.size() < shop_data_.size()) { QLOG_WARN() << "Need" << shop_data_.size() - threads_.size() << "more shops defined to fit all your items."; } requests_completed_ = 0; submitting_ = true; SubmitSingleShop(); }
unsigned ShaderLibrary::loadShader(QString const& path, unsigned const mode) { unsigned shader(0); QFile file(path); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QString contents(file.readAll()); file.close(); QByteArray raw(contents.toLocal8Bit()); const char* c_str(raw.data()); shader = glCreateShader(mode); glShaderSource(shader, 1, &c_str, NULL); glCompileShader(shader); // Check if things compiled okay unsigned buflen(1000); GLsizei msgLength; char msg[buflen]; glGetShaderInfoLog(shader, buflen, &msgLength, msg); if (msgLength != 0) { QLOG_WARN() << "Failed to compile shader " << path; QLOG_WARN() << QString(msg); glDeleteShader(shader); // required? shader = 0; } } return shader; }
void M64BirDevice::getDeviceFrame() { char buffer[1]; // buffer for the 'read command' m64_frame_t myFrame; // storage structure, this should be an attribute of the // class and not a local variable. int ret; // nb of bytes written or read if( mDeviceHandle == NULL ) { QLOG_ERROR() << "mDeviceHandle not defined"; return; } // // Step 1 - send the 'read command' // Send 'read M64Bir Device opd values' command // buffer[0] = 'A'; ret = usb_bulk_write( mDeviceHandle, M64_EP_OUT, buffer, 1, 1000); if( ret < 0 ) { QLOG_WARN() << "Error writting: " << usb_strerror(); return; } // // Step 2 - Read the data // ret = usb_bulk_read( mDeviceHandle, M64_EP_IN, (char *)&myFrame, sizeof(m64_frame_t), 1000); if( ret != sizeof(m64_frame_t) ) { QLOG_WARN() << "ERROR: read" << ret << "bytes instead of" << sizeof(m64_frame_t); } if( ret < 0 ) { QLOG_WARN() << "Error reading: " << usb_strerror(); return; } // // Build OpenCV frame here // cv::Mat data( 16, 16, CV_16U ); for(int i=0; i<16; i++) { for(int j=0; j<16; j++) { data.at< unsigned short int >( i, j ) = myFrame.img[ i*16 + j ]; } } emit newFrame( data ); }
std::string BuyoutManager::Serialize(const std::map<std::string, Buyout> &buyouts) { rapidjson::Document doc; doc.SetObject(); auto &alloc = doc.GetAllocator(); for (auto &bo : buyouts) { const Buyout &buyout = bo.second; if (buyout.type != BUYOUT_TYPE_NO_PRICE && (buyout.currency == CURRENCY_NONE || buyout.type == BUYOUT_TYPE_NONE)) continue; if (buyout.type >= BuyoutTypeAsTag.size() || buyout.currency >= CurrencyAsTag.size()) { QLOG_WARN() << "Ignoring invalid buyout, type:" << buyout.type << "currency:" << buyout.currency; continue; } rapidjson::Value item(rapidjson::kObjectType); item.AddMember("value", buyout.value, alloc); if (!buyout.last_update.isNull()){ item.AddMember("last_update", buyout.last_update.toTime_t(), alloc); }else{ // If last_update is null, set as the actual time item.AddMember("last_update", QDateTime::currentDateTime().toTime_t(), alloc); } Util::RapidjsonAddConstString(&item, "type", BuyoutTypeAsTag[buyout.type], alloc); Util::RapidjsonAddConstString(&item, "currency", CurrencyAsTag[buyout.currency], alloc); rapidjson::Value name(bo.first.c_str(), alloc); doc.AddMember(name, item, alloc); } return Util::RapidjsonSerialize(doc); }
bool HelperLaunchd::writePlist() { QVariantMap launchPlist; launchPlist.insert("Label", "tv.plex.player"); launchPlist.insert("RunAtLoad", true); QVariantMap keepAlive; keepAlive.insert("SuccessfulExit", false); launchPlist.insert("KeepAlive", keepAlive); launchPlist.insert("ProcessType", "Background"); launchPlist.insert("Program", HelperLauncher::HelperPath()); PListSerializer plistOut; QString output = plistOut.toPList(launchPlist); if (!output.isEmpty()) { QFile fp(launchPlistPath()); if (fp.open(QIODevice::WriteOnly | QIODevice::Truncate)) { fp.write(output.toUtf8()); } else { QLOG_WARN() << "Failed to write launchd plist file:" << launchPlistPath(); return false; } } return false; }
int InputCEC::CecLogMessage(void* cbParam, const cec_log_message message) { InputCEC *cec = (InputCEC*)cbParam; switch (message.level) { case CEC_LOG_ERROR: QLOG_ERROR() << "libCEC ERROR:" << message.message; break; case CEC_LOG_WARNING: QLOG_WARN() << "libCEC WARNING:" << message.message; break; case CEC_LOG_NOTICE: QLOG_INFO() << "libCEC NOTICE:" << message.message; break; case CEC_LOG_DEBUG: if (cec->m_verboseLogging) { QLOG_DEBUG() << "libCEC DEBUG:" << message.message; } break; case CEC_LOG_TRAFFIC: break; default: break; } return 0; }
void ItemsManagerWorker::Update(TabCache::Policy policy, const std::vector<ItemLocation> &tab_names) { if (updating_) { QLOG_WARN() << "ItemsManagerWorker::Update called while updating"; return; } if (policy == TabCache::ManualCache) { for (auto const &tab: tab_names) tab_cache_->AddManualRefresh(tab); } tab_cache_->OnPolicyUpdate(policy); QLOG_DEBUG() << "Updating stash tabs"; updating_ = true; // remove all mappings (from previous requests) if (signal_mapper_) delete signal_mapper_; signal_mapper_ = new QSignalMapper; // remove all pending requests queue_ = std::queue<ItemsRequest>(); queue_id_ = 0; replies_.clear(); items_.clear(); tabs_as_string_ = ""; selected_character_ = ""; // first, download the main page because it's the only way to know which character is selected QNetworkReply *main_page = network_manager_.get(Request(QUrl(kMainPage), ItemLocation(), TabCache::Refresh)); connect(main_page, &QNetworkReply::finished, this, &ItemsManagerWorker::OnMainPageReceived); }
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) { (void)context; QDateTime now = QDateTime::currentDateTime(); QDate nowDate = now.date(); QTime nowTime = now.time(); QByteArray localMsg = msg.toLocal8Bit(); switch (type) { case QtDebugMsg: { QLOG_DEBUG() << localMsg.constData(); break; } case QtWarningMsg: { QLOG_WARN() << localMsg.constData(); break; } case QtCriticalMsg: { QLOG_ERROR() << localMsg.constData(); break; } case QtFatalMsg: { QLOG_FATAL() << localMsg.constData(); break; } } }
void PresetManager::readPresetFile() { // first remove all loaded presets removeAllPresets(); QSettings presets(m_presetFile.absoluteFilePath(), QSettings::IniFormat); presets.beginGroup("GRAPHING_PRESETS"); if(presets.contains(("PRESET_FILE_VERSION"))) { QString presetVersion = presets.value("PRESET_FILE_VERSION").toString(); if(presetVersion == "1.0") { readPresetFileVersion10(presets); } // Add new preset versions here! else { QLOG_ERROR() << "Could not load preset file " << m_presetFile.absoluteFilePath() << ". Unknown Version:" << presetVersion; m_presetFile = QFileInfo(); } } else { QLOG_WARN() << "PresetManager::readPresetFile() - ini file has no version string - not loaded"; m_presetFile = QFileInfo(); } presets.endGroup(); // "GRAPHING_PRESETS" m_presetHasChanged = false; // a fresh loaded preset has not changed adaptWindowTitle(); }
bool OcDbManager::openDB() { db = QSqlDatabase::addDatabase("QSQLITE"); QString path(QDir::homePath()); path.append(BASE_PATH).append("/database.sqlite"); path = QDir::toNativeSeparators(path); QLOG_DEBUG() << "Database file path: " << path; // check if database file exists before database will be opened QFile dbfile(path); while(!dbfile.exists()) { QLOG_WARN() << "Database file does not exist. Waiting for it's creation by the engine..."; QEventLoop loop; QTimer::singleShot(1000, &loop, SLOT(quit())); loop.exec(); } db.setDatabaseName(path); db.setConnectOptions("QSQLITE_OPEN_READONLY"); bool dbOpen = db.open(); if (!dbOpen) { QLOG_FATAL() << "Can not open sqlite database"; } else { QLOG_INFO() << "Opened sqlite database"; } return dbOpen; }
std::string BuyoutManager::Serialize(const QMap<QString, Buyout> &buyouts) { QJsonDocument doc; QJsonObject root; for (QString hash : buyouts.uniqueKeys()) { Buyout buyout = buyouts.value(hash); if (buyout.type != BUYOUT_TYPE_NO_PRICE && (buyout.currency == CURRENCY_NONE || buyout.type == BUYOUT_TYPE_NONE)) continue; if (buyout.type >= BuyoutTypeAsTag.size() || buyout.currency >= CurrencyAsTag.size()) { QLOG_WARN() << "Ignoring invalid buyout, type:" << buyout.type << "currency:" << buyout.currency; continue; } QJsonObject value; value.insert("value", buyout.value); value.insert("set_by", buyout.set_by); if (!buyout.last_update.isNull()){ value.insert("last_update", (int) buyout.last_update.toTime_t()); } else { // If last_update is null, set as the actual time value.insert("last_update", (int) QDateTime::currentDateTime().toTime_t()); } value.insert("type", QString::fromStdString(BuyoutTypeAsTag[buyout.type])); value.insert("currency", QString::fromStdString(CurrencyAsTag[buyout.currency])); root.insert(hash, value); } doc.setObject(root); QByteArray result = doc.toJson(); return result.toStdString(); }
bool InputComponent::addInput(InputBase* base) { if (!base->initInput()) { QLOG_WARN() << "Failed to init input:" << base->inputName(); return false; } QLOG_INFO() << "Successfully inited input:" << base->inputName(); m_inputs.push_back(base); // we connect to the provider receivedInput signal, then we check if the name // needs to be remaped in remapInput and then finally send it out to JS land. // connect(base, &InputBase::receivedInput, this, &InputComponent::remapInput); // for auto-repeating inputs // m_autoRepeatTimer = new QTimer(this); connect(m_autoRepeatTimer, &QTimer::timeout, [=]() { if (!m_currentAction.isEmpty()) { m_currentActionCount ++; emit receivedAction(m_currentAction); } qint32 multiplier = qMin(5, qMax(1, m_currentActionCount / 5)); m_autoRepeatTimer->setInterval(100 / multiplier); }); return true; }
void ThreadHandler::restoreThreads() { int threadCount; out << "Reopening threads\n"; threadCount = settings->value("tabs/count",0).toInt(); QLOG_TRACE() << "ThreadHandler :: restoring Threads"; ImageThread* it; if (threadCount > 0) { for (int i=0; i<threadCount; i++) { it = addThread(); it->setValues( settings->value(QString("tabs/tab%1").arg(i), ";;;;0;;every 30 seconds;;0").toString() ); out << " opening " << it->getUrl() << "\n"; } } else { QLOG_WARN() << "ThreadHandler :: No threads available to restore"; emit threadListEmpty(); } out.flush(); }
bool QueueResources::fromQVariant(QVariant const& qvar) { QVariantList list(qvar.toList()); if (list.size() != 12) { QLOG_WARN() << "Invalid resource list passed to QueueResources::fromQVariant()"; return false; } bool allOk(true), ok(true); m_name = list.at( 0).toString(); m_maxWallTime = list.at( 1).toString(); m_defaultWallTime = list.at( 2).toString(); m_maxMemory = list.at( 3).toInt(&ok); allOk = allOk && ok; m_minMemory = list.at( 4).toInt(&ok); allOk = allOk && ok; m_defaultMemory = list.at( 5).toInt(&ok); allOk = allOk && ok; m_maxScratch = list.at( 6).toInt(&ok); allOk = allOk && ok; m_minScratch = list.at( 7).toInt(&ok); allOk = allOk && ok; m_defaultScratch = list.at( 8).toInt(&ok); allOk = allOk && ok; m_maxCpus = list.at( 9).toInt(&ok); allOk = allOk && ok; m_minCpus = list.at(10).toInt(&ok); allOk = allOk && ok; m_defaultCpus = list.at(11).toInt(&ok); allOk = allOk && ok; return allOk; }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); // init the logging mechanism QsLogging::Logger& logger = QsLogging::Logger::instance(); logger.setLoggingLevel(QsLogging::TraceLevel); const QString sLogPath(QDir(a.applicationDirPath()).filePath("log.txt")); QsLogging::DestinationPtr fileDestination( QsLogging::DestinationFactory::MakeFileDestination(sLogPath) ); QsLogging::DestinationPtr debugDestination( QsLogging::DestinationFactory::MakeDebugOutputDestination() ); logger.addDestination(debugDestination.get()); logger.addDestination(fileDestination.get()); //logger.setLoggingLevel(QsLogging::InfoLevel); QLOG_INFO() << "Program started"; QLOG_INFO() << "Built with Qt" << QT_VERSION_STR << "running on" << qVersion(); QLOG_TRACE() << "Here's a" << QString("trace") << "message"; QLOG_DEBUG() << "Here's a" << static_cast<int>(QsLogging::DebugLevel) << "message"; QLOG_WARN() << "Uh-oh!"; qDebug() << "This message won't be picked up by the logger"; QLOG_ERROR() << "An error has occurred"; qWarning() << "Neither will this one"; QLOG_FATAL() << "Fatal error!"; const int ret = 0; std::cout << std::endl << "Press any key..."; std::cin.get(); QLOG_INFO() << "Program exited with return code" << ret; return ret; }
void MainForm::runPause() {//暂停/继续运行槽函数 if(true==this->running) { this->ui->runPauseBtn->setText("开始统计"); this->running=false; this->timer->stop(); QLOG_WARN() << "已暂停测量!"; }else { ui->runPauseBtn->setText("暂停统计"); this->running=true; this->timer->start(1000); QLOG_WARN() << "已继续测量!"; } }
void Application::OnItemsRefreshed(const Items &items, const std::vector<std::string> &tabs, bool initial_refresh) { items_ = items; tabs_ = tabs; shop_->ExpireShopData(); if (!initial_refresh) { if (shop_->IsAutoUpdateEnabled()) { shop_->SubmitShopToForum(); } } else { // Fix up invalid hashes... ZZZ int fixed = 0; buyout_manager().UseBroken(); for (const std::shared_ptr<Item> &item : items) { if (buyout_manager().Exists(*item)) { // We found a buyout set with the broken hash! Buyout b = buyout_manager().Get(*item); QString setter = b.set_by; buyout_manager().Delete(*item); buyout_manager().UseBroken(false); buyout_manager().Set(*item, b, setter); buyout_manager().UseBroken(); fixed++; } } buyout_manager().UseBroken(false); if (fixed) { QLOG_WARN() << qPrintable("Fixed " + QString::number(fixed) + " broken buyout hashes. You can safely ignore this message."); } } }
void ItemsManagerWorker::Update() { if (updating_) { QLOG_WARN() << "ItemsManagerWorker::Update called while updating"; return; } QLOG_INFO() << "Updating stash tabs"; updating_ = true; // remove all mappings (from previous requests) if (signal_mapper_) delete signal_mapper_; signal_mapper_ = new QSignalMapper; // remove all pending requests queue_ = std::queue<ItemsRequest>(); queue_id_ = 0; replies_.clear(); items_.clear(); tabs_as_string_ = ""; items_as_string_ = "[ "; // space here is important, see ParseItems and OnTabReceived when all requests are completed selected_character_ = ""; CurrentStatusUpdate status = CurrentStatusUpdate(); status.state = ProgramState::ItemsUpdating; status.progress = 0; status.total = 100; emit StatusUpdate(status); // first, download the main page because it's the only way to know which character is selected QNetworkReply *main_page = network_manager_.get(QNetworkRequest(QUrl(kMainPage))); connect(main_page, &QNetworkReply::finished, this, &ItemsManagerWorker::OnMainPageReceived); }
void ProcessMonitor::reconnectServers() { ProcessList list(s_processMap.keys()); QSet<Server*> servers; ProcessList::iterator iter; for (iter = list.begin(); iter != list.end(); ++iter) { // We set the status to Unknown when we load the proceses from file if // the process hasn't finished. if ((*iter)->status() == Process::Unknown || (*iter)->status() == Process::Queued) { Server* server = ServerRegistry::instance().get((*iter)->serverName()); if (server) servers.insert(server); } } QSet<Server*>::iterator server; for (server = servers.begin(); server != servers.end(); ++server) { try { QLOG_INFO() << "Reconnecting to server" << (*server)->name(); if (!(*server)->connectServer()) throw Server::Exception("Connection failed"); QLOG_INFO() << "Updating Processes on server" << (*server)->name(); (*server)->updateProcesses(); } catch (std::exception& err) { QString msg("Failed to reconnect to server: "); msg += (*server)->name() +":\n"; QLOG_WARN() << msg; QMsgBox::warning(this, "IQmol", msg); } } }
bool VersionBuilder::readOverrideOrders(OneSixInstance *instance, PatchOrder &order) { QFile orderFile(instance->instanceRoot() + "/order.json"); if (!orderFile.open(QFile::ReadOnly)) { QLOG_ERROR() << "Couldn't open" << orderFile.fileName() << " for reading:" << orderFile.errorString(); QLOG_WARN() << "Ignoring overriden order"; return false; } // and it's valid JSON QJsonParseError error; QJsonDocument doc = QJsonDocument::fromJson(orderFile.readAll(), &error); if (error.error != QJsonParseError::NoError) { QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString(); QLOG_WARN() << "Ignoring overriden order"; return false; } // and then read it and process it if all above is true. try { auto obj = MMCJson::ensureObject(doc); // check order file version. auto version = MMCJson::ensureInteger(obj.value("version"), "version"); if (version != currentOrderFileVersion) { throw JSONValidationError(QObject::tr("Invalid order file version, expected %1") .arg(currentOrderFileVersion)); } auto orderArray = MMCJson::ensureArray(obj.value("order")); for(auto item: orderArray) { order.append(MMCJson::ensureString(item)); } } catch (JSONValidationError &err) { QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ": bad file format"; QLOG_WARN() << "Ignoring overriden order"; order.clear(); return false; } return true; }
Currency Currency::FromIndex(int index) { if (index >= currency_type_as_tag_.size()) { QLOG_WARN() << "Currency type index out of bounds: " << index << ". This should never happen - please report."; return CURRENCY_NONE; } else { return Currency(static_cast<CurrencyType>(index)); } }
BuyoutType Buyout::IndexAsBuyoutType(int index) { if (index >= buyout_type_as_tag_.size()) { QLOG_WARN() << "Buyout type index out of bounds: " << index << ". This should never happen - please report."; return BUYOUT_TYPE_INHERIT; } else { return static_cast<BuyoutType>(index); } }
void EmsData::ramBytesLocalUpdate(unsigned short locationid,unsigned short offset,unsigned short size,QByteArray data) { if (!hasLocalRamBlock(locationid)) { QLOG_WARN() << "Write requested when there is no local ram block!"; return; } if (getLocalRamBlock(locationid).mid(offset,size) == data) { QLOG_WARN() << "Data in application ram memory unchanged, no reason to send write for single value"; return; } QLOG_TRACE() << "Updating ram locationid" << locationid << "with" << data.size() << "bytes at offset" << offset; setLocalRamBlock(locationid,getLocalRamBlock(locationid).replace(offset,size,data)); //emit updateRequired(locationid); emit ramBlockUpdateRequest(locationid,offset,size,data); }
QVariant SettingsSection::value(const QString& key) { if (m_values.contains(key)) return m_values[key]->value(); QLOG_WARN() << "Looking for value:" << key << "in section:" << m_sectionID << "but it can't be found"; return QVariant(); }
const std::string &Currency::AsTag() const { auto const &it = currency_type_as_tag_.find(type); if (it != currency_type_as_tag_.end()) { return it->second; } else { QLOG_WARN() << "No mapping from currency type: " << type << " to tag. This should never happen - please report."; return currency_type_error_; } }