Make crash dump uploading configurable

refs #490
This commit is contained in:
Roland Winklmeier
2016-07-29 16:56:43 +02:00
parent e47aec223e
commit 78eeecf052
7 changed files with 205 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "blackgui/components/settingsadvancedcomponent.h"
#include "ui_settingsadvancedcomponent.h"
using namespace BlackMisc;
namespace BlackGui
{
namespace Components
{
CSettingsAdvancedComponent::CSettingsAdvancedComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CSettingsAdvancedComponent)
{
ui->setupUi(this);
ui->m_crashDumpsUpload->setChecked(m_crashDumpUploadEnabled.getThreadLocal());
connect(ui->m_crashDumpsUpload, &QCheckBox::stateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
}
CSettingsAdvancedComponent::~CSettingsAdvancedComponent()
{
}
void CSettingsAdvancedComponent::crashDumpUploadEnabledChanged(int state)
{
auto text = ui->m_crashDumpsUpload->text();
if (!text.endsWith("(restart needed)"))
{
ui->m_crashDumpsUpload->setText(ui->m_crashDumpsUpload->text() + " (restart needed)");
}
m_crashDumpUploadEnabled.set(state == Qt::Checked);
}
} // ns
} // ns

View File

@@ -0,0 +1,54 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_COMPONENTS_SETTINGSGENERALCOMPONENT_H
#define BLACKGUI_COMPONENTS_SETTINGSGENERALCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackcore/application/applicationsettings.h"
#include "blackmisc/settingscache.h"
#include <QFrame>
#include <QObject>
#include <QScopedPointer>
class QWidget;
namespace Ui { class CSettingsAdvancedComponent; }
namespace BlackGui
{
namespace Components
{
//! Configure general settings
class BLACKGUI_EXPORT CSettingsAdvancedComponent :
public QFrame
{
Q_OBJECT
public:
//! Constructor
CSettingsAdvancedComponent(QWidget *parent = nullptr);
//! Destructor
~CSettingsAdvancedComponent();
private:
void crashDumpUploadEnabledChanged(int state);
QScopedPointer<Ui::CSettingsAdvancedComponent> ui;
BlackMisc::CSetting<BlackCore::Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this };
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsAdvancedComponent</class>
<widget class="QFrame" name="CSettingsAdvancedComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>193</height>
</rect>
</property>
<property name="windowTitle">
<string>sample_hotkeys</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="m_crashDumpsUpload">
<property name="text">
<string>Upload crash dumps</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@@ -687,6 +687,23 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_SettingsAdvanced">
<attribute name="title">
<string>Advanced</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="BlackGui::Components::CSettingsAdvancedComponent" name="comp_SettingsAdvancedComponent">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
@@ -695,6 +712,12 @@
<header>blackgui/components/audiosetupcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CSettingsAdvancedComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/settingsadvancedcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CSettingsSimulatorComponent</class>
<extends>QFrame</extends>