removed internal blending modes

This commit is contained in:
itsmattkc
2019-03-10 09:03:08 +11:00
parent 8cf3bd46a1
commit 0e612e717d
13 changed files with 1190 additions and 1397 deletions
+58 -58
View File
@@ -34,79 +34,79 @@ QFile debug_file;
QTextStream debug_stream;
void open_debug_file() {
QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
debug_dir.mkpath(".");
if (debug_dir.exists()) {
debug_file.setFileName(debug_dir.path() + "/debug_log");
if (debug_file.open(QFile::WriteOnly)) {
debug_stream.setDevice(&debug_file);
} else {
qWarning() << "Couldn't open debug log file, debug log will not be saved";
}
QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
debug_dir.mkpath(".");
if (debug_dir.exists()) {
debug_file.setFileName(debug_dir.path() + "/debug_log");
if (debug_file.open(QFile::WriteOnly)) {
debug_stream.setDevice(&debug_file);
} else {
qWarning() << "Couldn't open debug log file, debug log will not be saved";
}
}
}
void close_debug_file()
{
if (debug_file.isOpen()) {
debug_file.close();
}
if (debug_file.isOpen()) {
debug_file.close();
}
}
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
debug_mutex.lock();
const QByteArray localMsg = msg.toLocal8Bit();
const QDateTime now = QDateTime::currentDateTime();
const QByteArray timeRepr(now.toString(Qt::ISODate).toLocal8Bit());
QString msgTag;
QString fontColor;
switch (type) {
case QtDebugMsg:
msgTag = "DEBUG";
fontColor = "grey";
break;
case QtInfoMsg:
msgTag = "INFO";
fontColor = "blue";
break;
case QtWarningMsg:
msgTag = "WARNING";
fontColor = "yellow";
break;
case QtCriticalMsg:
msgTag = "ERROR";
fontColor = "red";
break;
case QtFatalMsg:
msgTag = "FATAL";
fontColor = "red";
break;
default:
fprintf(stderr, "Unknown debug msg type");
fflush(stderr);
break;
}//switch
debug_mutex.lock();
const QByteArray localMsg = msg.toLocal8Bit();
const QDateTime now = QDateTime::currentDateTime();
const QByteArray timeRepr(now.toString(Qt::ISODate).toLocal8Bit());
QString msgTag;
QString fontColor;
switch (type) {
case QtDebugMsg:
msgTag = "DEBUG";
fontColor = "grey";
break;
case QtInfoMsg:
msgTag = "INFO";
fontColor = "blue";
break;
case QtWarningMsg:
msgTag = "WARNING";
fontColor = "yellow";
break;
case QtCriticalMsg:
msgTag = "ERROR";
fontColor = "red";
break;
case QtFatalMsg:
msgTag = "FATAL";
fontColor = "red";
break;
default:
fprintf(stderr, "Unknown debug msg type");
fflush(stderr);
break;
}//switch
/*fprintf(stderr, "%s [%s] %s (%s:%u, %s)\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data(),
/*fprintf(stderr, "%s [%s] %s (%s:%u, %s)\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data(),
context.file, context.line, context.function);*/
fprintf(stderr, "%s [%s] %s\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data());
fprintf(stderr, "%s [%s] %s\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data());
if (debug_file.isOpen()) {
debug_stream << QString("[%1] %2 (%3:%4, %5)\n")
.arg(msgTag, localMsg, context.file, QString::number(context.line), context.function);
}
debug_info.prepend(QString("<font color='%1'><b>[%2]</b> %3 (%4:%5, %6)</font><br>")
.arg(fontColor, msgTag, localMsg, context.file, QString::number(context.line), context.function));
fflush(stderr);
if (olive::DebugDialog != nullptr && olive::DebugDialog->isVisible()) {
QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection);
}
debug_mutex.unlock();
if (debug_file.isOpen()) {
debug_stream << QString("[%1] %2 (%3:%4, %5)\n")
.arg(msgTag, localMsg, context.file, QString::number(context.line), context.function);
}
debug_info.prepend(QString("<font color='%1'><b>[%2]</b> %3 (%4:%5, %6)</font><br>")
.arg(fontColor, msgTag, localMsg, context.file, QString::number(context.line), context.function));
fflush(stderr);
if (olive::DebugDialog != nullptr && olive::DebugDialog->isVisible()) {
QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection);
}
debug_mutex.unlock();
}
const QString &get_debug_str()
{
return debug_info;
return debug_info;
}