Files
uartscope/include/mainwindow.h

69 lines
1.6 KiB
C++

#pragma once
#include <QMainWindow>
#include <QThread>
#include <QTabWidget>
#include <QSplitter>
#include <QStatusBar>
#include <QToolBar>
#include <QLabel>
#include <QAction>
#include <QSpinBox>
#include <QCheckBox>
#include "serialworker.h"
#include "rawview.h"
#include "tableview.h"
#include "tagwidget.h"
#include "connectdialog.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void onConnectClicked();
void onDisconnectClicked();
void onPortOpened();
void onPortClosed();
void onReconnecting(int attempt);
void onClearScreen();
void onError(const QString &message);
void onNewLine(const QString &line);
void onTagDetected(const QString &tag, const QString &value);
void showFormatReference();
private:
void setupUi();
void setupToolBar();
void setupStatusBar();
void clearAllViews();
// Worker & thread
QThread *m_thread = nullptr;
SerialWorker *m_worker = nullptr;
// Views
RawView *m_rawView = nullptr;
TableView *m_tableView = nullptr;
TagWidget *m_tagWidget = nullptr;
// Status bar widgets
QLabel *m_portLabel = nullptr;
QLabel *m_stateLabel = nullptr;
QLabel *m_reconnectLabel = nullptr;
// Toolbar widgets
QCheckBox *m_autoReconnectCb = nullptr;
QSpinBox *m_reconnectIntervalSb= nullptr;
// Actions
QAction *m_connectAction = nullptr;
QAction *m_disconnectAction = nullptr;
SerialConfig m_lastConfig;
};