本文整理汇总了C++中QLOG_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ QLOG_ERROR函数的具体用法?C++ QLOG_ERROR怎么用?C++ QLOG_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QLOG_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLOG_INFO
bool DisplayManager::initialize()
{
QLOG_INFO() << QString("DisplayManager found %1 Display(s).").arg(displays.size());
// list video modes
foreach(int displayid, displays.keys())
{
DMDisplayPtr display = displays[displayid];
QLOG_INFO() << QString("Available modes for Display #%1 (%2)").arg(displayid).arg(display->name);
for (int modeid = 0; modeid < display->videoModes.size(); modeid++)
{
DMVideoModePtr mode = display->videoModes[modeid];
QLOG_INFO() << QString("Mode %1: %2").arg(modeid, 2).arg(mode->getPrettyName());
}
}
// Log current display mode
int mainDisplay = getMainDisplay();
if (mainDisplay >= 0)
{
int currentMode = getCurrentDisplayMode(mainDisplay);
if (currentMode >= 0)
QLOG_INFO() << QString("DisplayManager : Current Display Mode on Display #%1 is %2")
.arg(mainDisplay)
.arg(displays[mainDisplay]->videoModes[currentMode]->getPrettyName());
else
QLOG_ERROR() << "DisplayManager : unable to retrieve current video mode";
}
else
QLOG_ERROR() << "DisplayManager : unable to retrieve main display";
return true;
}
示例2: qDebug
void OcNetwork::slotAuthenticationRequired(QNetworkReply* rep, QAuthenticator *authenticator)
{
QVariantMap account = config.getAccount();
#ifdef QT_DEBUG
qDebug() << "Account: " << account;
qDebug() << "Current user: " << authenticator->user();
qDebug() << "Current password: " << authenticator->password();
#endif
if (account["state"].toInt() == 0)
{
if (authenticator->user().isEmpty() && authenticator->password().isEmpty())
{
authenticator->setUser(account["uname"].toString());
authenticator->setPassword(account["pword"].toString());
} else {
if ((authenticator->user() != account["uname"].toString()) || (authenticator->password() != account["pword"].toString() ))
{
authenticator->setUser(account["uname"].toString());
authenticator->setPassword(account["pword"].toString());
} else {
rep->abort();
QLOG_ERROR() << "Network: Abort authentication";
}
}
} else {
rep->abort();
QLOG_ERROR() << "Network: Abort authentication, account state: " << account["state"].toInt();
}
}
示例3: QLOG_ERROR
//*******************************************************************
// Every time we add a new object, we call this to get its unique
// local ID. This number never changes
//*******************************************************************
qint32 ConfigStore::incrementLidCounter() {
QSqlQuery sql;
// Prepare the SQL statement & fetch the row
sql.prepare("Select value from ConfigStore where key=:key");
sql.bindValue(":key", CONFIG_STORE_LID);
if (!sql.exec()) {
QLOG_ERROR() << "Fetch of ConfigStore LID counter statement failed: " << sql.lastError();
}
if (!sql.next()) {
QLOG_ERROR() << "LID NOT FOUND!!!";
} else {
// Now that we have the next lid, increment the number & save it
qint32 sequence = QVariant(sql.value(0)).toInt();
sequence++;
sql.prepare("Update ConfigStore set value=:lid where key=:key;");
sql.bindValue(":lid",sequence);
sql.bindValue(":key", CONFIG_STORE_LID);
if (!sql.exec()) {
QLOG_ERROR() << "Error updating sequence number: " << sql.lastError();
}
// Return the next lid to the caller
return sequence;
}
return -1;
}
示例4: QLOG_ERROR
void BuyoutManager::Deserialize(const std::string &data, std::map<std::string, Buyout> *buyouts) {
buyouts->clear();
// if data is empty (on first use) we shouldn't make user panic by showing ERROR messages
if (data.empty())
return;
rapidjson::Document doc;
if (doc.Parse(data.c_str()).HasParseError()) {
QLOG_ERROR() << "Error while parsing buyouts.";
QLOG_ERROR() << rapidjson::GetParseError_En(doc.GetParseError());
return;
}
if (!doc.IsObject())
return;
for (auto itr = doc.MemberBegin(); itr != doc.MemberEnd(); ++itr) {
auto &object = itr->value;
const std::string &name = itr->name.GetString();
Buyout bo;
bo.currency = Currency::FromTag(object["currency"].GetString());
bo.type = Buyout::TagAsBuyoutType(object["type"].GetString());
bo.value = object["value"].GetDouble();
if (object.HasMember("last_update")){
bo.last_update = QDateTime::fromTime_t(object["last_update"].GetInt());
}
if (object.HasMember("source")){
bo.source = Buyout::TagAsBuyoutSource(object["source"].GetString());
}
bo.inherited = false;
if (object.HasMember("inherited"))
bo.inherited = object["inherited"].GetBool();
(*buyouts)[name] = bo;
}
}
示例5: query
// Update the database's user record
void UserTable::updateSyncState(SyncState s) {
NSqlQuery query(*db);
query.prepare("Delete from UserTable where key=:key1 or key=:key2 or key=:key3;");
query.bindValue(":key1", USER_SYNC_UPLOADED);
query.bindValue(":key2", USER_SYNC_LAST_DATE);
query.bindValue(":key3", USER_SYNC_LAST_NUMBER);
query.exec();
query.prepare("Insert into UserTable (key, data) values (:key, :data);");
if (s.uploaded.isSet()) {
query.bindValue(":key", USER_SYNC_UPLOADED);
query.bindValue(":data",qlonglong(s.uploaded));
if (!query.exec()) {
QLOG_ERROR() << "Error updating USER_SYNC_UPLOADED : " << query.lastError();
}
}
query.prepare("Insert into UserTable (key, data) values (:key, :data);");
query.bindValue(":key", USER_SYNC_LAST_DATE);
query.bindValue(":data", qlonglong(s.currentTime));
if (!query.exec()) {
QLOG_ERROR() << "Error updating USER_SYNC_LAST_DATE : " << query.lastError();
}
query.prepare("Insert into UserTable (key, data) values (:key, :data);");
query.bindValue(":key", USER_SYNC_LAST_NUMBER);
query.bindValue(":data", s.updateCount);
if (!query.exec()) {
QLOG_ERROR() << "Error updating USER_SYNC_LAST_NUMBER : " << query.lastError();
}
query.finish();
}
示例6: file
QString MediaManager::getMediaHash(const QString &path)
{
//Hashing
QFile file(path);
if(!file.open(QIODevice::ReadOnly))
{
QLOG_ERROR() << "Unable to read file: " + path;
return nullptr;
}
//Read first 50K of the file
QByteArray arr(51200, 0);
qint64 toRead = 51200;
while(qint64 haveRead = file.read(arr.data(), toRead) < toRead)
{
if(haveRead < 0) {
QLOG_ERROR() << "Unable to read file: " + path;
return nullptr;
}
toRead -= haveRead;
}
//Hash them
hasher->addData(arr);
QString rez = hasher->result().toBase64();
QLOG_TRACE() << file.fileName() + ": " + rez;
//Reset hasher
hasher->reset();
return rez;
}
示例7: QLOG_ERROR
void LoginDialog::OnLeaguesRequestFinished() {
QNetworkReply *reply = qobject_cast<QNetworkReply *>(QObject::sender());
QByteArray bytes = reply->readAll();
rapidjson::Document doc;
doc.Parse(bytes.constData());
leagues_.clear();
// ignore actual response completely since it's broken anyway (at the moment of writing!)
if (true) {
QLOG_ERROR() << "Failed to parse leagues. The output was:";
QLOG_ERROR() << QString(bytes);
// But let's do our best and try to add at least some leagues!
// It's in case GGG's API is broken and suddenly starts returning empty pages,
// which of course will never happen.
leagues_ = { "Flashback Event (IC001)", "Flashback Event HC (IC002)", "Standard", "Hardcore" };
} else {
for (auto &league : doc)
leagues_.push_back(league["id"].GetString());
}
ui->leagueComboBox->clear();
for (auto &league : leagues_)
ui->leagueComboBox->addItem(league.c_str());
ui->leagueComboBox->setEnabled(true);
if (saved_league_.size() > 0)
ui->leagueComboBox->setCurrentText(saved_league_);
}
示例8: page
void Shop::OnEditPageFinished() {
QNetworkReply *reply = qobject_cast<QNetworkReply *>(QObject::sender());
QByteArray bytes = reply->readAll();
std::string page(bytes.constData(), bytes.size());
std::string hash = Util::GetCsrfToken(page, "forum_thread");
if (hash.empty()) {
QLOG_ERROR() << "Can't update shop -- cannot extract CSRF token from the page. Check if thread ID is valid.";
submitting_ = false;
return;
}
// now submit our edit
// holy shit give me some html parser library please
std::string title = Util::FindTextBetween(page, "<input type=\"text\" name=\"title\" id=\"title\" value=\"", "\" class=\"textInput\">");
if (title.empty()) {
QLOG_ERROR() << "Can't update shop -- title is empty. Check if thread ID is valid.";
submitting_ = false;
return;
}
QUrlQuery query;
query.addQueryItem("forum_thread", hash.c_str());
query.addQueryItem("title", title.c_str());
query.addQueryItem("content", requests_completed_ < shop_data_.size() ? shop_data_[requests_completed_].c_str() : "Empty");
query.addQueryItem("submit", "Submit");
QByteArray data(query.query().toUtf8());
QNetworkRequest request((QUrl(ShopEditUrl(requests_completed_).c_str())));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QNetworkReply *submitted = app_.logged_in_nm().post(request, data);
new QReplyTimeout(submitted, kEditThreadTimeout);
connect(submitted, SIGNAL(finished()), this, SLOT(OnShopSubmitted()));
}
示例9: QLOG_ERROR
void ItemsManagerWorker::Init() {
items_.clear();
std::string items = data_manager_.Get("items");
if (items.size() != 0) {
rapidjson::Document doc;
doc.Parse(items.c_str());
for (auto item = doc.Begin(); item != doc.End(); ++item)
items_.push_back(std::make_shared<Item>(*item));
}
tabs_.clear();
std::string tabs = data_manager_.Get("tabs");
if (tabs.size() != 0) {
rapidjson::Document doc;
if (doc.Parse(tabs.c_str()).HasParseError()) {
QLOG_ERROR() << "Malformed tabs data:" << tabs.c_str() << "The error was"
<< rapidjson::GetParseError_En(doc.GetParseError());
return;
}
for (auto &tab : doc) {
if (!tab.HasMember("n") || !tab["n"].IsString()) {
QLOG_ERROR() << "Malformed tabs data:" << tabs.c_str() << "Tab doesn't contain its name (field 'n').";
continue;
}
tabs_.push_back(tab["n"].GetString());
}
}
emit ItemsRefreshed(items_, tabs_, true);
}
示例10: dir
void IQmolApplication::initOpenBabel()
{
QDir dir(QApplication::applicationDirPath());
dir.cdUp();
QString path(dir.absolutePath());
#ifdef Q_WS_MAC
// Assumed directory structure: IQmol.app/Contents/MacOS/IQmol
QApplication::addLibraryPath(path + "/Frameworks");
QApplication::addLibraryPath(path + "/PlugIns");
#else
// Assumed directory structure: IQmol-xx/bin/IQmol
QApplication::addLibraryPath(path + "/lib");
QApplication::addLibraryPath(path + "/lib/plugins");
#endif
#ifdef Q_OS_LINUX
return;
#endif
QString env(qgetenv("BABEL_LIBDIR"));
if (env.isEmpty()) {
env = path + "/lib/openbabel";
qputenv("BABEL_LIBDIR", env.toAscii());
QLOG_INFO() << "Setting BABEL_LIBDIR = " << env;
}else {
QLOG_INFO() << "BABEL_LIBDIR already set: " << env;
}
env = qgetenv("BABEL_DATADIR");
if (env.isEmpty()) {
env = path + "/share/openbabel";
qputenv("BABEL_DATADIR", env.toAscii());
QLOG_INFO() << "Setting BABEL_DATADIR = " << env;
}else {
QLOG_INFO() << "BABEL_DATADIR already set: " << env;
}
#ifdef Q_WS_WIN
QLibrary openBabel("libopenbabel.dll");
#else
QLibrary openBabel("openbabel");
#endif
if (!openBabel.load()) {
QString msg("Could not load library ");
msg += openBabel.fileName();
QLOG_ERROR() << msg << " " << openBabel.errorString();
QLOG_ERROR() << "Library Paths:";
QLOG_ERROR() << libraryPaths();
msg += "\n\nPlease ensure the OpenBabel libraries have been installed correctly";
QMsgBox::critical(0, "IQmol", msg);
QApplication::quit();
return;
}
}
示例11: setStatus
bool LegacyUpdate::MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained,
MetainfAction metainf)
{
setStatus(tr("Installing mods: Adding ") + from.fileName() + " ...");
QuaZip modZip(from.filePath());
modZip.open(QuaZip::mdUnzip);
QuaZipFile fileInsideMod(&modZip);
QuaZipFile zipOutFile(into);
for (bool more = modZip.goToFirstFile(); more; more = modZip.goToNextFile())
{
QString filename = modZip.getCurrentFileName();
if (filename.contains("META-INF") && metainf == LegacyUpdate::IgnoreMetainf)
{
QLOG_INFO() << "Skipping META-INF " << filename << " from " << from.fileName();
continue;
}
if (contained.contains(filename))
{
QLOG_INFO() << "Skipping already contained file " << filename << " from "
<< from.fileName();
continue;
}
contained.insert(filename);
QLOG_INFO() << "Adding file " << filename << " from " << from.fileName();
if (!fileInsideMod.open(QIODevice::ReadOnly))
{
QLOG_ERROR() << "Failed to open " << filename << " from " << from.fileName();
return false;
}
/*
QuaZipFileInfo old_info;
fileInsideMod.getFileInfo(&old_info);
*/
QuaZipNewInfo info_out(fileInsideMod.getActualFileName());
/*
info_out.externalAttr = old_info.externalAttr;
*/
if (!zipOutFile.open(QIODevice::WriteOnly, info_out))
{
QLOG_ERROR() << "Failed to open " << filename << " in the jar";
fileInsideMod.close();
return false;
}
if (!JlCompress::copyData(fileInsideMod, zipOutFile))
{
zipOutFile.close();
fileInsideMod.close();
QLOG_ERROR() << "Failed to copy data of " << filename << " into the jar";
return false;
}
zipOutFile.close();
fileInsideMod.close();
}
return true;
}
示例12: QLOG_INFO
void UpdaterComponent::downloadUpdate(const QVariantMap& updateInfo)
{
if (isDownloading())
return;
QLOG_INFO() << updateInfo;
if (!updateInfo.contains("version") ||
!updateInfo.contains("manifestURL") || !updateInfo.contains("manifestHash") ||
!updateInfo.contains("fileURL") || !updateInfo.contains("fileHash") || !updateInfo.contains("fileName"))
{
QLOG_ERROR() << "updateInfo was missing fields required to carry out this action.";
return;
}
m_version = updateInfo["version"].toString();
m_manifest = new Update(updateInfo["manifestURL"].toString(),
UpdateManager::GetPath("manifest.xml.bz2", m_version, false),
updateInfo["manifestHash"].toString(), this);
// determine if we have a manifest (some distros don't like OE)
m_hasManifest = ((!m_manifest->m_url.isEmpty()) && (!m_manifest->m_hash.isEmpty()));
m_file = new Update(updateInfo["fileURL"].toString(),
UpdateManager::GetPath(updateInfo["fileName"].toString(), m_version, true),
updateInfo["fileHash"].toString(), this);
if (m_hasManifest)
connect(m_manifest, &Update::fileDone, this, &UpdaterComponent::fileComplete);
connect(m_file, &Update::fileDone, this, &UpdaterComponent::fileComplete);
// create directories we need
QDir dr(QFileInfo(m_file->m_localPath).dir());
if (!dr.exists())
{
if (!dr.mkpath("."))
{
QLOG_ERROR() << "Failed to create update directory:" << dr.absolutePath();
emit downloadError("Failed to create download directory");
return;
}
}
// this will first check if the files are done
// and in that case emit the done signal.
if (fileComplete(NULL))
return;
if (!m_manifest->isReady() && m_hasManifest)
downloadFile(m_manifest);
if (!m_file->isReady())
downloadFile(m_file);
}
示例13: QLOG_ERROR
bool M64BirDevice::connectDevice()
{
int err;
char str[100];
// At this point device should point to a valid usb_device if a M64Bir was attached
if( mDevice == NULL )
{
QLOG_ERROR() << "No M64BIR device defined: " << usb_strerror();
return false;
}
// Open the USB device
usb_dev_handle *handle = usb_open( mDevice );
err = usb_set_configuration( handle, 1 );
if( err < 0 )
{
QLOG_ERROR() << "usb_set_configuration() returned " << usb_strerror();
usb_close( handle );
return false;
}
err = usb_claim_interface( handle, 0 );
if( err < 0 )
{
QLOG_ERROR() << "usb_claim_interface() returned " << usb_strerror();
usb_close( handle );
return false;
}
mDeviceHandle = handle;
// Print device information
if( mDevice->descriptor.iManufacturer )
{
err = usb_get_string_simple( mDeviceHandle, mDevice->descriptor.iManufacturer, str, sizeof(str) );
if( err > 0 )
{
mDeviceManufacturer = str;
QLOG_INFO() << "Manufacturer is " << mDeviceManufacturer;
}
}
if( mDevice->descriptor.iProduct )
{
err = usb_get_string_simple( mDeviceHandle, mDevice->descriptor.iProduct, str, sizeof(str) );
if( err > 0 )
{
mDeviceProductName = str;
QLOG_INFO() << "Product is " << mDeviceProductName;
}
}
return true;
}
示例14: QLOG_ERROR
void YggdrasilTask::sslErrors(QList<QSslError> errors)
{
int i = 1;
for (auto error : errors)
{
QLOG_ERROR() << "LOGIN SSL Error #" << i << " : " << error.errorString();
auto cert = error.certificate();
QLOG_ERROR() << "Certificate in question:\n" << cert.toText();
i++;
}
}
示例15: QLOG_INFO
void OcFeedsModelNew::init()
{
QLOG_INFO() << "Initializing feeds model";
if (!m_items.isEmpty())
clear(false);
QSqlQuery query;
int length = 1;
QString querystring(QString("SELECT COUNT(id) FROM feeds WHERE folderId = %1").arg(folderId()));
if (!query.exec(querystring)) {
QLOG_ERROR() << "Feeds mode: failed to select feeds count from database: " << query.lastError().text();
}
query.next();
length += query.value(0).toInt();
querystring = QString("SELECT %1 AS id, 1 AS type, '%2' AS title, (SELECT localUnreadCount FROM folders WHERE id = %1) AS unreadCount, '' AS iconSource, '' AS iconWidth, '' AS iconHeight ").arg(folderId()).arg(tr("All posts"));
if (length > 1) {
querystring.append("UNION ");
querystring.append(QString("SELECT id, 0 AS type, title, localUnreadCount AS unreadCount, iconSource, iconWidth, iconHeight FROM feeds WHERE folderId = %1 ").arg(folderId()));
}
querystring.append("ORDER BY type DESC");
if (!query.exec(querystring)) {
QLOG_ERROR() << "Feeds mode: failed to select feeds from database: " << query.lastError().text();
}
beginInsertRows(QModelIndex(), 0, length-1);
while(query.next())
{
OcFeedObject *fobj = new OcFeedObject(query.value(0).toInt(),
query.value(1).toInt(),
query.value(2).toString(),
query.value(3).toInt(),
query.value(4).toString(),
query.value(5).toInt(),
query.value(6).toInt());
m_items.append(fobj);
}
endInsertRows();
}