本文整理汇总了C++中QLOG_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ QLOG_WARN函数的具体用法?C++ QLOG_WARN怎么用?C++ QLOG_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QLOG_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLOG_WARN
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();
}
示例2: fi
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;
}
}
示例3: jobInfo
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;
}
示例4: 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;
}
示例5: indexOf
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;
}
示例6: QLOG_WARN
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();
}
示例7: shader
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;
}
示例8: QLOG_ERROR
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 );
}
示例9: QLOG_WARN
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);
}
示例10: fp
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;
}
示例11: switch
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;
}
示例12: QLOG_WARN
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);
}
示例13: messageHandler
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;
}
}
}
示例14: removeAllPresets
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();
}
示例15: path
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;
}