swift
settingsadvancedcomponent.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include "ui_settingsadvancedcomponent.h"
7 
8 using namespace swift::misc;
9 
10 namespace swift::gui::components
11 {
12  CSettingsAdvancedComponent::CSettingsAdvancedComponent(QWidget *parent)
13  : QFrame(parent), ui(new Ui::CSettingsAdvancedComponent)
14  {
15  ui->setupUi(this);
16 
17  const bool crashDumpUploadEnabled = m_crashDumpUploadEnabled.getThreadLocal();
18  ui->cb_crashDumpsUpload->setChecked(crashDumpUploadEnabled);
19  connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this,
20  &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
21  }
22 
24 
25  void CSettingsAdvancedComponent::crashDumpUploadEnabledChanged(int state)
26  {
27  auto text = ui->cb_crashDumpsUpload->text();
28  if (!text.endsWith("(restart needed)"))
29  {
30  ui->cb_crashDumpsUpload->setText(ui->cb_crashDumpsUpload->text() + " (restart needed)");
31  }
32 
33  m_crashDumpUploadEnabled.set(state == Qt::Checked);
34  }
35 
36 } // namespace swift::gui::components
CStatusMessage set(const T &value, qint64 timestamp=0)
Write a new value. Must be called from the thread in which the owner lives.
Definition: valuecache.h:411
const T & getThreadLocal() const
Read the current value.
Definition: valuecache.h:400
High level reusable GUI components.
Definition: aboutdialog.cpp:13
Free functions in swift::misc.