dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
usagestatsoptionpage.cpp
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  */
25 
26 #include "usagestatsoptionpage.h"
27 #include "ui_usagestatsoptionpage.h"
28 #include "usagestatsplugin.h"
30 
32  : IOptionsPage(parent)
33 {
34  m_config = qobject_cast<UsageStatsPlugin *>(parent);
35  connect(this, &UsageStatsOptionPage::settingsUpdated, m_config,
37 }
39 {
40 }
41 QWidget *UsageStatsOptionPage::createPage(QWidget *parent)
42 {
43 
44  m_page = new Ui::UsageStatsOptionPage();
45  QWidget *w = new QWidget(parent);
46  m_page->setupUi(w);
47  m_page->cb_AllowSending->setChecked(m_config->getSendUsageStats());
48  m_page->cb_AllowPrivate->setChecked(m_config->getSendPrivateData());
49  m_page->label_UUID->setText(QString("UUID: ") + m_config->getInstallationUUID());
50 
51  m_page->cbDebugLogLevel->clear();
52  m_page->cbDebugLogLevel->addItem(tr("Debug"), DebugEngine::DEBUG);
53  m_page->cbDebugLogLevel->addItem(tr("Info"), DebugEngine::INFO);
54  m_page->cbDebugLogLevel->addItem(tr("Warning"), DebugEngine::WARNING);
55  m_page->cbDebugLogLevel->addItem(tr("Critical"), DebugEngine::CRITICAL);
56  m_page->cbDebugLogLevel->addItem(tr("Fatal"), DebugEngine::FATAL);
57  for (int i = 0; i < m_page->cbDebugLogLevel->count(); i++) {
58  if (m_page->cbDebugLogLevel->itemData(i).toInt() == m_config->getDebugLogLevel())
59  m_page->cbDebugLogLevel->setCurrentIndex(i);
60  }
61 
62  return w;
63 }
64 
66 {
67  m_config->setSendUsageStats(m_page->cb_AllowSending->isChecked());
68  m_config->setSendPrivateData(m_page->cb_AllowPrivate->isChecked());
69  m_config->setDebugLogLevel(m_page->cbDebugLogLevel->currentData().toInt());
70  emit settingsUpdated();
71 }
72 
74 {
75  delete m_page;
76 }
UsageStatsOptionPage(QObject *parent=nullptr)
QWidget * createPage(QWidget *parent)
for i
Definition: OPPlots.m:140