refactor: Remove dev flag from bootstrap json

With this, the database debug flag can only be activated when using swift
with a development build. Setting the development flag in the json also
didn't worked previously as expected because the corresponding function
to get the flag in application.cpp was called before the setup was loaded.
This commit is contained in:
Lars Toenning
2024-02-04 17:23:12 +01:00
parent 5842cb627a
commit da552d60cc
11 changed files with 4 additions and 203 deletions

View File

@@ -364,7 +364,6 @@ add_library(gui SHARED
components/autopublishcomponent.h
components/audioadvanceddistributeddialog.ui
components/settingsadvancedcomponent.h
components/dbdebugdatabasesetup.h
components/copyconfigurationcomponent.h
components/airportdialog.h
components/settingsmatchingdialog.cpp
@@ -537,7 +536,6 @@ add_library(gui SHARED
components/interpolationcomponent.ui
components/dbownmodelsetformdialog.h
components/airportcompleter.cpp
components/dbdebugdatabasesetup.cpp
components/modelmatcherlogenable.h
components/updateinfocomponent.h
components/countryselector.cpp
@@ -648,7 +646,6 @@ add_library(gui SHARED
components/settingsviewupdatetimes.ui
components/airportcompleter.h
components/cockpitinfoareacomponent.cpp
components/dbdebugdatabasesetup.ui
components/cockpittranspondermodeledscomponent.cpp
components/installfsxterrainprobecomponent.h
components/interpolationlogdisplay.h

View File

@@ -1,41 +0,0 @@
// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#include "blackgui/components/dbdebugdatabasesetup.h"
#include "blackgui/guiapplication.h"
#include "ui_dbdebugdatabasesetup.h"
#include <QCheckBox>
using namespace BlackCore::Data;
using namespace BlackMisc;
namespace BlackGui::Components
{
CDbDebugDatabaseSetup::CDbDebugDatabaseSetup(QWidget *parent) : QFrame(parent),
ui(new Ui::CDbDebugDatabaseSetup)
{
ui->setupUi(this);
const bool enabled = sGui->isDeveloperFlagSet();
this->setEnabled(enabled);
if (!enabled)
{
this->setToolTip("Disabled, cannot be set!");
}
else
{
connect(ui->cb_EnableServerDebugging, &QCheckBox::toggled, this, &CDbDebugDatabaseSetup::onDebugChanged);
}
}
CDbDebugDatabaseSetup::~CDbDebugDatabaseSetup()
{}
void CDbDebugDatabaseSetup::onDebugChanged(bool set)
{
CGlobalSetup gs(m_setup.getThreadLocal());
gs.setServerDebugFlag(set);
m_setup.set(gs);
}
} // ns

View File

@@ -1,47 +0,0 @@
// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
//! \file
#ifndef BLACKGUI_COMPONENTS_DBDEBUGDATABASESETUP_H
#define BLACKGUI_COMPONENTS_DBDEBUGDATABASESETUP_H
#include "blackcore/data/globalsetup.h"
#include "blackgui/blackguiexport.h"
#include "blackmisc/datacache.h"
#include <QFrame>
#include <QObject>
#include <QScopedPointer>
namespace Ui
{
class CDbDebugDatabaseSetup;
}
namespace BlackGui::Components
{
/*!
* Debug settings for DB (only to be used as developer)
* \remarks Disabled when not runnig in dev.environment
*/
class BLACKGUI_EXPORT CDbDebugDatabaseSetup : public QFrame
{
Q_OBJECT
public:
//! Constructor
explicit CDbDebugDatabaseSetup(QWidget *parent = nullptr);
//! Dstructor
~CDbDebugDatabaseSetup();
private:
//! Changed the debug checkbox
void onDebugChanged(bool set);
QScopedPointer<Ui::CDbDebugDatabaseSetup> ui;
BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup { this }; //!< data cache
};
} // ns
#endif // guard

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CDbDebugDatabaseSetup</class>
<widget class="QFrame" name="CDbDebugDatabaseSetup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>176</width>
<height>40</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lbl_EnableWebServerDebugging">
<property name="text">
<string>Server debug flag:</string>
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="cb_EnableServerDebugging">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="hs_DebugDatabaseSetup">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -49,9 +49,6 @@ namespace BlackGui::Components
ui->tbr_InfoAndHints->setHtml(html);
ui->tbr_InfoAndHints->setOpenExternalLinks(true);
const bool devEnv = sGui->isDeveloperFlagSet();
ui->comp_DebugSetup->setVisible(devEnv);
const QString dbUrl = sGui->getGlobalSetup().getDbHomePageUrl().toQString();
ui->lbl_DatabaseName->setText(asHyperlink(dbUrl));
ui->lbl_DatabaseName->setTextFormat(Qt::RichText);

View File

@@ -88,16 +88,6 @@
<property name="spacing">
<number>6</number>
</property>
<item row="5" column="0" colspan="3">
<widget class="BlackGui::Components::CDbDebugDatabaseSetup" name="comp_DebugSetup">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QWidget" name="wi_Button" native="true">
<layout class="QHBoxLayout" name="hl_LoginFrame">
@@ -152,7 +142,7 @@
</property>
</spacer>
</item>
<item row="6" column="0">
<item row="5" column="0">
<spacer name="vs_FrameLogin">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -406,14 +396,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Components::CDbDebugDatabaseSetup</class>
<extends>QFrame</extends>
<header>blackgui/components/dbdebugdatabasesetup.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tb_LoginToDbAndHints</tabstop>
<tabstop>le_Username</tabstop>