Skip to content

Commit

Permalink
Use FTesting enabled function instead of member flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kjell Morgenstern authored and pythonorcpp committed Apr 29, 2024
1 parent 30a14c8 commit 0067811
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/fapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ int FApplication::init() {

Q_INIT_RESOURCE(phoenixresources);

MainWindow::initNames(isFTestingActive);
MainWindow::initNames();
FSvgRenderer::initNames();
ViewLayer::initNames();
RatsnestColors::initNames(isFTestingActive);
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
#include "../mainwindow/FProbeKeyPressEvents.h"
#include "connectors/debugconnectors.h"
#include "connectors/debugconnectorsprobe.h"
#include "testing/FTesting.h"
#include "servicelistfetcher.h"
#include "utils/uploadpair.h"

Expand Down Expand Up @@ -237,7 +238,6 @@ const QString MainWindow::UntitledSketchName = "Untitled Sketch";
int MainWindow::UntitledSketchIndex = 1;
int MainWindow::CascadeFactorX = 21;
int MainWindow::CascadeFactorY = 19;
bool MainWindow::m_isFTesting = false;

static constexpr int MainWindowDefaultWidth = 1024;
static constexpr int MainWindowDefaultHeight = 768;
Expand Down Expand Up @@ -3513,5 +3513,5 @@ void MainWindow::postKeyEvent(const QString & serializedKeys) {
}

bool MainWindow::isTransientSimulationEnabled() {
return m_isFTesting || DebugDialog::enabled();
return FTesting::getInstance()->enabled() || DebugDialog::enabled();
}
3 changes: 1 addition & 2 deletions src/mainwindow/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class MainWindow : public FritzingWindow
bool isTransientSimulationEnabled();

public:
static void initNames(bool isFTesting);
static void initNames();
static MainWindow * newMainWindow(ReferenceModel *referenceModel, const QString & displayPath, bool showProgress, bool lockFiles, int initialTab);
static void setAutosavePeriod(int);
static void setAutosaveEnabled(bool);
Expand Down Expand Up @@ -993,7 +993,6 @@ protected Q_SLOTS:
static int CascadeFactorY;
static QRegularExpression GuidMatcher;
void exportIPC_D_356A_interactive();
static bool m_isFTesting;
};

#endif
3 changes: 1 addition & 2 deletions src/mainwindow/mainwindow_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool sortPartList(ItemBase * b1, ItemBase * b2) {

/////////////////////////////////////////////////////////

void MainWindow::initNames(bool isFTesting)
void MainWindow::initNames()
{
OtherKnownExtensions << jpgActionType << pdfActionType << pngActionType << svgActionType << bomActionType << bomCsvActionType << ipcActionType << netlistActionType << spiceNetlistActionType;

Expand All @@ -124,7 +124,6 @@ void MainWindow::initNames(bool isFTesting)
QSettings settings;
AutosaveEnabled = settings.value("autosaveEnabled", QString("%1").arg(AutosaveEnabled)).toBool();
AutosaveTimeoutMinutes = settings.value("autosavePeriod", QString("%1").arg(AutosaveTimeoutMinutes)).toInt();
m_isFTesting = isFTesting;
}

void MainWindow::print() {
Expand Down
4 changes: 4 additions & 0 deletions src/testing/FTesting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void FTesting::init() {
m_initialized = true;
}

bool FTesting::enabled() {
return m_initialized;
}

void FTesting::addProbe(FProbe * probe)
{
m_probeMap[probe->name()] = probe;
Expand Down
2 changes: 2 additions & 0 deletions src/testing/FTesting.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class FTesting : public QObject {

void init();

bool enabled();

void addProbe(FProbe * probe);

void removeProbe(std::string name);
Expand Down

0 comments on commit 0067811

Please sign in to comment.