Files
edgetx-gx12/companion/src/simulation/debugoutput.h
T
Max PapernoandBertrand Songis 2f9d9c1a99 [Simulator] New main UI window, debug console, separate outputs window, more. (#4385)
* [package] Add QtSvg support DLLs for Windows.

* [Simulator] Add images/css resources for new version; Create SimulatorIcon and SimulatorStyle classes; Build with SVG support, remove unused bitmaps.

* [Simulator] Improve and simplify VirtualJoystickWidget resize event (sticks maintain X/Y position) & improve values layout w/out trims.

* [Simulator] Refactor Trainer simulator to use VirtualJoystickWidget, gains lock/hold buttons and X/Y position readout.

* [Simulator] More compact layout for Telemetry simulator, reduces min. width and adds scrolling columns to allow smaller window sizes.

* [Simulator] Add new SimulatorMainWindow and RadioOutputsWidget UI classes.

* [storage] Add non-persistent sessionId() to AppData for tracking currently active radio profile ID.

* [Simulator] Major UI updates:
    * Use a MainWindow interface with dockable/floatable windows, proper toolbar & menu;
    * Persistent size/layout state of all windows/docks/etc between uses, per radio profile;
    * Completely separate radio Outputs window with configurable layout (also persistent between uses);
    * Translations now enabled in standalone Simulator, follows main Companion setting (they need a lot of updates);
    * New custom icons throughout, toolbar icon sizes adhere to user preference in Companion.

* [Simulator] Debug Output console updates:
    * New filter feature with optional full RegEx support, can work in inclusive or exclusive modes (full help text is included in UI);
    * Up to 50 user-defined filters are saved to permanent settings, also a few predefined filters are provided;
    * Saves/restores the last filter used and if it was en/disabled;
    * Added word wrap and clear screen features;
    * Configurable scroll-back buffer size;
    * Increased efficiency & performance of the buffering/printing process.

* [Simulator][OSX] Visual UI tweaks for OS X.

* [Simulator] Fix some debug console settings not being restored properly.

* [Simulator] Add ability to hide/show menu bar; Persist view state of menu bar and radio title bar; Reduce font size on OS X; Other small visual tweaks and improvements.

* [build] Add QtSvg to Linux build scripts (a guess for Dockerfile).

* [build] Fix for Qt 5.3.

* Add OpenTx headers to new files.

* [Companion][storage] Update GeneralSettings() initializer to use current sessionId for profile data retrieval, removes workaround for standalone Simulator being started with arbitrary profile; AppData: always update sessionId when global id() changes.

* [X10] Fixes for new simulator
2017-02-04 11:59:42 +01:00

98 lines
2.4 KiB
C++

/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _DEBUGOUTPUT_H_
#define _DEBUGOUTPUT_H_
#include "simulator.h"
#include "simulatorinterface.h"
#include <QMutex>
#include <QTimer>
#include <QValidator>
#include <QWidget>
namespace Ui {
class DebugOutput;
}
class QAbstractButton;
using namespace Simulator;
class DebugOutput : public QWidget
{
Q_OBJECT
public:
explicit DebugOutput(QWidget * parent, SimulatorInterface * simulator);
virtual ~DebugOutput();
void start();
void stop();
void traceCallback(const char * text);
static QRegularExpression makeRegEx(const QString & input, bool * isExlusive = NULL);
protected slots:
void saveState();
void restoreState();
void processBytesReceived();
void onFilterTextEdited();
void onFilterTextChanged(const QString &);
void on_bufferSize_editingFinished();
void on_actionWordWrap_toggled(bool checked);
void on_actionClearScr_triggered();
void on_actionShowFilterHelp_triggered();
protected:
Ui::DebugOutput * ui;
SimulatorInterface * m_simulator;
QTimer * m_tmrDataPrint;
QStringList m_dataBuffer;
QMutex m_mtxDataBuffer;
QRegularExpression m_filterRegEx;
int m_radioProfileId;
int m_dataPrintFreq;
bool m_running;
bool m_filterExclude;
const static int m_dataBufferMaxSize;
const static int m_dataPrintFreqDefault;
const static quint16 m_savedViewStateVersion;
};
class DebugOutputFilterValidator : public QValidator
{
public:
DebugOutputFilterValidator(QObject *parent = Q_NULLPTR) : QValidator(parent) { }
virtual State validate(QString & input, int &) const;
};
class DeleteComboBoxItemEventFilter : public QObject
{
Q_OBJECT
protected:
bool eventFilter(QObject *obj, QEvent *event);
};
#endif // _DEBUGOUTPUT_H_