merge of various commits

This commit is contained in:
itsmattkc
2019-02-19 02:41:01 -08:00
7 changed files with 3306 additions and 3285 deletions
+64 -56
View File
@@ -34,68 +34,76 @@ QFile debug_file;
QTextStream debug_stream; QTextStream debug_stream;
void open_debug_file() { void open_debug_file() {
QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
debug_dir.mkpath("."); debug_dir.mkpath(".");
if (debug_dir.exists()) { if (debug_dir.exists()) {
debug_file.setFileName(debug_dir.path() + "/debug_log"); debug_file.setFileName(debug_dir.path() + "/debug_log");
if (debug_file.open(QFile::WriteOnly)) { if (debug_file.open(QFile::WriteOnly)) {
debug_stream.setDevice(&debug_file); debug_stream.setDevice(&debug_file);
} else { } else {
qWarning() << "Couldn't open debug log file, debug log will not be saved"; qWarning() << "Couldn't open debug log file, debug log will not be saved";
} }
} }
} }
void close_debug_file() { 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) { void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
debug_mutex.lock(); {
QByteArray localMsg = msg.toLocal8Bit(); debug_mutex.lock();
switch (type) { const QByteArray localMsg = msg.toLocal8Bit();
case QtDebugMsg: const QDateTime now = QDateTime::currentDateTime();
// fprintf(stderr, "[DEBUG] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); const QByteArray timeRepr(now.toString(Qt::ISODate).toLocal8Bit());
fprintf(stderr, "[DEBUG] %s\n", localMsg.constData()); QString msgTag;
if (debug_file.isOpen()) debug_stream << QString("[DEBUG] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function); QString fontColor;
debug_info.append(QString("<b>[DEBUG]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function)); switch (type) {
fflush(stderr); case QtDebugMsg:
break; msgTag = "DEBUG";
case QtInfoMsg: fontColor = "grey";
// fprintf(stderr, "[INFO] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); break;
fprintf(stderr, "[INFO] %s\n", localMsg.constData()); case QtInfoMsg:
if (debug_file.isOpen()) debug_stream << QString("[INFO] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function); msgTag = "INFO";
debug_info.append(QString("<b>[INFO]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function)); fontColor = "blue";
fflush(stderr); break;
break; case QtWarningMsg:
case QtWarningMsg: msgTag = "WARNING";
// fprintf(stderr, "[WARNING] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); fontColor = "yellow";
fprintf(stderr, "[WARNING] %s\n", localMsg.constData()); break;
if (debug_file.isOpen()) debug_stream << QString("[WARNING] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function); case QtCriticalMsg:
debug_info.append(QString("<font color='yellow'><b>[WARNING]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function)); msgTag = "ERROR";
fflush(stderr); fontColor = "red";
break; break;
case QtCriticalMsg: case QtFatalMsg:
// fprintf(stderr, "[ERROR] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); msgTag = "FATAL";
fprintf(stderr, "[ERROR] %s\n", localMsg.constData()); fontColor = "red";
if (debug_file.isOpen()) debug_stream << QString("[ERROR] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function); break;
debug_info.append(QString("<font color='red'><b>[ERROR]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function)); default:
fflush(stderr); fprintf(stderr, "Unknown debug msg type");
break; fflush(stderr);
case QtFatalMsg: break;
// fprintf(stderr, "[FATAL] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); }//switch
fprintf(stderr, "[FATAL] %s\n", localMsg.constData());
if (debug_file.isOpen()) debug_stream << QString("[FATAL] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function); fprintf(stderr, "%s [%s] %s (%s:%u, %s)\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data(),
debug_info.append(QString("<font color='red'><b>[FATAL]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function)); context.file, context.line, context.function);
fflush(stderr); if (debug_file.isOpen()) {
// abort(); 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()) { if (olive::DebugDialog != nullptr && olive::DebugDialog->isVisible()) {
QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection); QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection);
} }
debug_mutex.unlock(); debug_mutex.unlock();
} }
const QString &get_debug_str() { const QString &get_debug_str()
return debug_info; {
return debug_info;
} }
+1 -1
View File
@@ -694,7 +694,7 @@ void ExportDialog::setup_ui() {
verticalLayout->addWidget(videoGroupbox); verticalLayout->addWidget(videoGroupbox);
audioGroupbox = new QGroupBox(this); audioGroupbox = new QGroupBox(this);
audioGroupbox->setTitle("Audio"); audioGroupbox->setTitle(tr("Audio"));
audioGroupbox->setCheckable(true); audioGroupbox->setCheckable(true);
QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox); QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox);
+1 -1
View File
@@ -1,4 +1,4 @@
/*** /***
Olive - Non-Linear Video Editor Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team Copyright (C) 2019 Olive Team
+878 -857
View File
File diff suppressed because it is too large Load Diff
+658 -635
View File
File diff suppressed because it is too large Load Diff
+829 -872
View File
File diff suppressed because it is too large Load Diff
+875 -863
View File
File diff suppressed because it is too large Load Diff