Merge branch 'master' of https://github.com/olive-editor/olive into otio
This commit is contained in:
@@ -71,49 +71,62 @@ bool LinuxExceptionHandler(int, siginfo_t*, ucontext_t*)
|
||||
|
||||
bool InitializeCrashpad()
|
||||
{
|
||||
QString exe_dir = QCoreApplication::applicationDirPath();
|
||||
QString handler_fn;
|
||||
|
||||
// Determine filename of handler from platform
|
||||
#ifdef OS_WIN
|
||||
base::FilePath handler(QSTRING_TO_BASE_STRING(QDir(exe_dir).filePath(QStringLiteral("crashpad_handler.exe"))));
|
||||
handler_fn = QStringLiteral("crashpad_handler.exe");
|
||||
#else
|
||||
// FIXME: On Linux, probably should put this in a subdir so that it doesn't conflict with
|
||||
// anything else in /usr/bin
|
||||
base::FilePath handler(QSTRING_TO_BASE_STRING(QDir(exe_dir).filePath(QStringLiteral("crashpad_handler"))));
|
||||
handler_fn = QStringLiteral("crashpad_handler");
|
||||
#endif
|
||||
|
||||
base::FilePath reports_dir = GenerateReportPathForCrashpad();
|
||||
// Generate absolute path
|
||||
QString handler_abs_path = QDir(QCoreApplication::applicationDirPath()).filePath(handler_fn);
|
||||
|
||||
base::FilePath metrics_dir(QSTRING_TO_BASE_STRING(QDir(OLIVE_NAMESPACE::FileFunctions::GetTempFilePath()).filePath(QStringLiteral("metrics"))));
|
||||
bool status = false;
|
||||
|
||||
// Metadata that will be posted to the server with the crash report map
|
||||
std::map<std::string, std::string> annotations;
|
||||
if (QFileInfo::exists(handler_abs_path)) {
|
||||
base::FilePath handler(QSTRING_TO_BASE_STRING(handler_fn));
|
||||
|
||||
// Disable crashpad rate limiting so that all crashes have dmp files
|
||||
std::vector<std::string> arguments;
|
||||
arguments.push_back("--no-rate-limit");
|
||||
arguments.push_back("--no-upload-gzip");
|
||||
base::FilePath reports_dir = GenerateReportPathForCrashpad();
|
||||
|
||||
// Initialize Crashpad database
|
||||
std::unique_ptr<crashpad::CrashReportDatabase> database = crashpad::CrashReportDatabase::Initialize(reports_dir);
|
||||
if (database == NULL) return false;
|
||||
base::FilePath metrics_dir(QSTRING_TO_BASE_STRING(QDir(OLIVE_NAMESPACE::FileFunctions::GetTempFilePath()).filePath(QStringLiteral("metrics"))));
|
||||
|
||||
// Disable automated crash uploads
|
||||
crashpad::Settings *settings = database->GetSettings();
|
||||
if (settings == NULL) return false;
|
||||
settings->SetUploadsEnabled(false);
|
||||
// Metadata that will be posted to the server with the crash report map
|
||||
std::map<std::string, std::string> annotations;
|
||||
|
||||
// Disable crashpad rate limiting so that all crashes have dmp files
|
||||
std::vector<std::string> arguments;
|
||||
arguments.push_back("--no-rate-limit");
|
||||
arguments.push_back("--no-upload-gzip");
|
||||
|
||||
// Initialize Crashpad database
|
||||
std::unique_ptr<crashpad::CrashReportDatabase> database = crashpad::CrashReportDatabase::Initialize(reports_dir);
|
||||
if (database == NULL) return false;
|
||||
|
||||
// Disable automated crash uploads
|
||||
crashpad::Settings *settings = database->GetSettings();
|
||||
if (settings == NULL) return false;
|
||||
settings->SetUploadsEnabled(false);
|
||||
|
||||
// Start crash handler
|
||||
client = new crashpad::CrashpadClient();
|
||||
status = client->StartHandler(handler, reports_dir, metrics_dir,
|
||||
"https://olivevideoeditor.org/crashpad/report.php",
|
||||
annotations, arguments, true, true);
|
||||
}
|
||||
|
||||
// Start crash handler
|
||||
client = new crashpad::CrashpadClient();
|
||||
bool status = client->StartHandler(handler, reports_dir, metrics_dir,
|
||||
"https://olivevideoeditor.org/crashpad/report.php",
|
||||
annotations, arguments, true, true);
|
||||
|
||||
// Override Crashpad exception filter with our own
|
||||
if (status) {
|
||||
#if defined(OS_WIN)
|
||||
SetUnhandledExceptionFilter(Win32ExceptionHandler);
|
||||
SetUnhandledExceptionFilter(Win32ExceptionHandler);
|
||||
#elif defined(OS_LINUX)
|
||||
crashpad::CrashpadClient::SetFirstChanceExceptionHandler(LinuxExceptionHandler);
|
||||
crashpad::CrashpadClient::SetFirstChanceExceptionHandler(LinuxExceptionHandler);
|
||||
#endif
|
||||
} else {
|
||||
qWarning() << "Failed to start Crashpad, automatic crash reporting will be disabled";
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
+26
-4
@@ -29,6 +29,9 @@
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QStyleFactory>
|
||||
#ifdef Q_OS_WINDOWS
|
||||
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
||||
#endif
|
||||
|
||||
#include "audio/audiomanager.h"
|
||||
#include "cli/clitask/clitaskdialog.h"
|
||||
@@ -374,18 +377,30 @@ void Core::DialogProjectPropertiesShow()
|
||||
|
||||
void Core::DialogExportShow()
|
||||
{
|
||||
TimeBasedPanel* latest_time_based = PanelManager::instance()->MostRecentlyFocused<TimeBasedPanel>();
|
||||
// First try the most recently focused time based window
|
||||
TimeBasedPanel* time_panel = PanelManager::instance()->MostRecentlyFocused<TimeBasedPanel>();
|
||||
|
||||
if (latest_time_based && latest_time_based->GetConnectedViewer()) {
|
||||
if (latest_time_based->GetConnectedViewer()->GetLength() == 0) {
|
||||
// If that fails try defaulting to the first timeline (i.e. if a project has just been loaded).
|
||||
if (!time_panel->GetConnectedViewer()) {
|
||||
// Safe to assume there will always be one timeline.
|
||||
time_panel = PanelManager::instance()->GetPanelsOfType<TimelinePanel>().first();
|
||||
}
|
||||
|
||||
if (time_panel && time_panel->GetConnectedViewer()) {
|
||||
if (time_panel->GetConnectedViewer()->GetLength() == 0) {
|
||||
QMessageBox::critical(main_window_,
|
||||
tr("Error"),
|
||||
tr("This Sequence is empty. There is nothing to export."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
ExportDialog ed(latest_time_based->GetConnectedViewer(), main_window_);
|
||||
ExportDialog ed(time_panel->GetConnectedViewer(), main_window_);
|
||||
ed.exec();
|
||||
}
|
||||
} else {
|
||||
QMessageBox::critical(main_window_,
|
||||
tr("Error"),
|
||||
tr("No valid sequence detected.\n\nMake sure a sequence is loaded and it has a connected Viewer node."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,12 +689,19 @@ void Core::StartGUI(bool full_screen)
|
||||
|
||||
// Create main window and open it
|
||||
main_window_ = new MainWindow();
|
||||
|
||||
if (full_screen) {
|
||||
main_window_->showFullScreen();
|
||||
} else {
|
||||
main_window_->showMaximized();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// Workaround for Qt bug where menus don't appear in full screen mode
|
||||
// See: https://doc.qt.io/qt-5/windows-issues.html
|
||||
QWindowsWindowFunctions::setHasBorderInFullScreen(main_window_->windowHandle(), true);
|
||||
#endif
|
||||
|
||||
// When a new project is opened, update the mainwindow
|
||||
connect(this, &Core::ProjectOpened, main_window_, &MainWindow::ProjectOpen);
|
||||
connect(this, &Core::ProjectClosed, main_window_, &MainWindow::ProjectClose);
|
||||
|
||||
Reference in New Issue
Block a user