Skip to content

Commit ae64096

Browse files
jgeudensclaude
andcommitted
Apply clang-format fixes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1ee6a08 commit ae64096

13 files changed

Lines changed: 177 additions & 204 deletions

src/dialogs/importmbcdialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ private slots:
4848
void handleAcceptUpdate(const QModelIndex& index);
4949
bool confirmClose();
5050

51-
Ui::ImportMbcDialog *_pUi;
51+
Ui::ImportMbcDialog* _pUi;
5252

5353
CenteredBoxProxyStyle _centeredBoxStyle;
5454
std::unique_ptr<ActionButtonDelegate> _pUpdateDelegate;
5555

56-
GuiModel * _pGuiModel;
56+
GuiModel* _pGuiModel;
5757
GraphDataModel* _pGraphDataModel;
5858
MbcRegisterModel _mbcRegisterModel;
5959
MbcUpdateModel* _pMbcUpdateModel;
6060

61-
MbcRegisterFilter * _pTabProxyFilter;
61+
MbcRegisterFilter* _pTabProxyFilter;
6262
};
6363

6464
#endif // IMPORTMBCDIALOG_H

src/dialogs/mainwindow.cpp

100755100644
Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,22 @@
3434

3535
using GuiState = GuiModel::GuiState;
3636

37-
MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
38-
SettingsModel* pSettingsModel, GraphDataModel* pGraphDataModel,
39-
NoteModel* pNoteModel, DiagnosticModel* pDiagnosticModel,
40-
DataParserModel* pDataParserModel, QWidget *parent) :
41-
QMainWindow(parent),
42-
_pUi(new Ui::MainWindow),
43-
_pGuiModel(pGuiModel),
44-
_pSettingsModel(pSettingsModel),
45-
_pGraphDataModel(pGraphDataModel),
46-
_pNoteModel(pNoteModel),
47-
_pDiagnosticModel(pDiagnosticModel),
48-
_pDataParserModel(pDataParserModel)
37+
MainWindow::MainWindow(QStringList cmdArguments,
38+
GuiModel* pGuiModel,
39+
SettingsModel* pSettingsModel,
40+
GraphDataModel* pGraphDataModel,
41+
NoteModel* pNoteModel,
42+
DiagnosticModel* pDiagnosticModel,
43+
DataParserModel* pDataParserModel,
44+
QWidget* parent)
45+
: QMainWindow(parent),
46+
_pUi(new Ui::MainWindow),
47+
_pGuiModel(pGuiModel),
48+
_pSettingsModel(pSettingsModel),
49+
_pGraphDataModel(pGraphDataModel),
50+
_pNoteModel(pNoteModel),
51+
_pDiagnosticModel(pDiagnosticModel),
52+
_pDataParserModel(pDataParserModel)
4953
{
5054
_pUi->setupUi(this);
5155

@@ -60,7 +64,8 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
6064
connect(_pModbusPoll, &ModbusPoll::registerDataReady, _pGraphDataHandler, &GraphDataHandler::handleRegisterData);
6165

6266
_pGraphView = new GraphView(_pGuiModel, _pSettingsModel, _pGraphDataModel, _pNoteModel, _pUi->customPlot, this);
63-
_pDataFileHandler = new DataFileHandler(_pGuiModel, _pGraphDataModel, _pNoteModel, _pSettingsModel, _pDataParserModel, this);
67+
_pDataFileHandler =
68+
new DataFileHandler(_pGuiModel, _pGraphDataModel, _pNoteModel, _pSettingsModel, _pDataParserModel, this);
6469
_pProjectFileHandler = new ProjectFileHandler(_pGuiModel, _pSettingsModel, _pGraphDataModel);
6570
_pExpressionStatus = new ExpressionStatus(_pGraphDataModel, pSettingsModel);
6671
_pCommunicationStats = new CommunicationStats(_pGraphDataModel);
@@ -84,13 +89,17 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
8489
connect(_pUi->actionManageNotes, &QAction::triggered, this, &MainWindow::showNotesDialog);
8590
connect(_pUi->actionExit, &QAction::triggered, this, &MainWindow::exitApplication);
8691
connect(_pUi->actionSaveDataFile, &QAction::triggered, _pDataFileHandler, &DataFileHandler::selectDataExportFile);
87-
connect(_pUi->actionOpenProjectFile, &QAction::triggered, _pProjectFileHandler, &ProjectFileHandler::selectProjectOpenFile);
88-
connect(_pUi->actionReloadProjectFile, &QAction::triggered, _pProjectFileHandler, &ProjectFileHandler::reloadProjectFile);
92+
connect(_pUi->actionOpenProjectFile, &QAction::triggered, _pProjectFileHandler,
93+
&ProjectFileHandler::selectProjectOpenFile);
94+
connect(_pUi->actionReloadProjectFile, &QAction::triggered, _pProjectFileHandler,
95+
&ProjectFileHandler::reloadProjectFile);
8996
connect(_pUi->actionOpenDataFile, &QAction::triggered, _pDataFileHandler, &DataFileHandler::selectDataImportFile);
9097
connect(_pUi->actionImportFromMbcFile, &QAction::triggered, this, &MainWindow::showMbcImportDialog);
9198
connect(_pUi->actionExportImage, &QAction::triggered, this, &MainWindow::selectImageExportFile);
92-
connect(_pUi->actionSaveProjectFileAs, &QAction::triggered, _pProjectFileHandler, &ProjectFileHandler::selectProjectSaveFile);
93-
connect(_pUi->actionSaveProjectFile, &QAction::triggered, _pProjectFileHandler, &ProjectFileHandler::saveProjectFile);
99+
connect(_pUi->actionSaveProjectFileAs, &QAction::triggered, _pProjectFileHandler,
100+
&ProjectFileHandler::selectProjectSaveFile);
101+
connect(_pUi->actionSaveProjectFile, &QAction::triggered, _pProjectFileHandler,
102+
&ProjectFileHandler::saveProjectFile);
94103
connect(_pUi->actionAbout, &QAction::triggered, this, &MainWindow::showAbout);
95104
connect(_pUi->actionOnlineDocumentation, &QAction::triggered, this, &MainWindow::openOnlineDoc);
96105
connect(_pUi->actionUpdateAvailable, &QAction::triggered, this, &MainWindow::openUpdateUrl);
@@ -100,7 +109,8 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
100109
connect(_pUi->actionSettings, &QAction::triggered, this, &MainWindow::showSettingsDialog);
101110
connect(_pUi->actionRegisterSettings, &QAction::triggered, this, &MainWindow::handleShowRegisterDialog);
102111
connect(_pUi->actionAddNote, &QAction::triggered, this, &MainWindow::addNoteToGraph);
103-
connect(_pUi->actionZoom, &QAction::triggered, this, &MainWindow::toggleZoom); /* Only called on GUI click, not on setChecked */
112+
connect(_pUi->actionZoom, &QAction::triggered, this,
113+
&MainWindow::toggleZoom); /* Only called on GUI click, not on setChecked */
104114

105115
/*-- connect model to view --*/
106116
connect(_pGuiModel, &GuiModel::highlightSamplesChanged, this, &MainWindow::updateHighlightSampleMenu);
@@ -183,7 +193,8 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
183193
connect(_pUi->customPlot, &QCustomPlot::customContextMenuRequested, this, &MainWindow::showContextMenu);
184194

185195
/* handle focus change */
186-
connect(dynamic_cast<QApplication*>(QApplication::instance()), &QApplication::focusChanged, this, &MainWindow::appFocusChanged);
196+
connect(dynamic_cast<QApplication*>(QApplication::instance()), &QApplication::focusChanged, this,
197+
&MainWindow::appFocusChanged);
187198

188199
/* Update notes in data file when requested by notes model */
189200
connect(_pNoteModel, &NoteModel::dataFileUpdateRequested, this, &MainWindow::updateDataFileNotes);
@@ -201,7 +212,8 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
201212

202213
connect(_pGraphDataHandler, &GraphDataHandler::graphDataReady, _pGraphView, &GraphView::plotResults);
203214
connect(_pGraphDataHandler, &GraphDataHandler::graphDataReady, _pLegend, &Legend::addLastReceivedDataToLegend);
204-
connect(_pGraphDataHandler, &GraphDataHandler::graphDataReady, _pCommunicationStats, &CommunicationStats::updateCommunicationStats);
215+
connect(_pGraphDataHandler, &GraphDataHandler::graphDataReady, _pCommunicationStats,
216+
&CommunicationStats::updateCommunicationStats);
205217

206218
handleCommandLineArguments(cmdArguments);
207219

@@ -220,7 +232,6 @@ MainWindow::MainWindow(QStringList cmdArguments, GuiModel* pGuiModel,
220232
//_pGraphDataModel->setActive(2, false);
221233

222234
#endif
223-
224235
}
225236

226237
MainWindow::~MainWindow()
@@ -259,17 +270,14 @@ void MainWindow::keyReleaseEvent(QKeyEvent* event)
259270
QMainWindow::keyReleaseEvent(event);
260271
}
261272

262-
void MainWindow::closeEvent(QCloseEvent *event)
273+
void MainWindow::closeEvent(QCloseEvent* event)
263274
{
264-
if (
265-
(_pGuiModel->guiState() == GuiState::DATA_LOADED)
266-
&& (_pNoteModel->isNotesDataUpdated())
267-
)
275+
if ((_pGuiModel->guiState() == GuiState::DATA_LOADED) && (_pNoteModel->isNotesDataUpdated()))
268276
{
269-
QMessageBox::StandardButton resBtn = QMessageBox::question(this, windowTitle(),
270-
tr("The notes are changed.\nDo you want discard the changes or update (save) the data file?\n"),
271-
QMessageBox::Cancel | QMessageBox::Discard | QMessageBox::Save,
272-
QMessageBox::Cancel);
277+
QMessageBox::StandardButton resBtn = QMessageBox::question(
278+
this, windowTitle(),
279+
tr("The notes are changed.\nDo you want discard the changes or update (save) the data file?\n"),
280+
QMessageBox::Cancel | QMessageBox::Discard | QMessageBox::Save, QMessageBox::Cancel);
273281
if (resBtn == QMessageBox::Cancel)
274282
{
275283
event->ignore();
@@ -307,8 +315,7 @@ void MainWindow::selectImageExportFile()
307315
const QPixmap pixMap = this->window()->grab();
308316

309317
QFileDialog dialog(this);
310-
FileSelectionHelper::configureFileDialog(&dialog,
311-
FileSelectionHelper::DIALOG_TYPE_SAVE,
318+
FileSelectionHelper::configureFileDialog(&dialog, FileSelectionHelper::DIALOG_TYPE_SAVE,
312319
FileSelectionHelper::FILE_TYPE_PNG);
313320

314321
QString selectedFile = FileSelectionHelper::showDialog(&dialog);
@@ -345,7 +352,7 @@ void MainWindow::openUpdateUrl()
345352

346353
void MainWindow::menuShowHideGraphClicked(bool bState)
347354
{
348-
QAction * pAction = qobject_cast<QAction *>(QObject::sender());
355+
QAction* pAction = qobject_cast<QAction*>(QObject::sender());
349356

350357
const qint32 graphIdx = _pGraphDataModel->convertToGraphIndex(pAction->data().toInt());
351358
_pGraphDataModel->setVisible(graphIdx, bState);
@@ -375,7 +382,10 @@ void MainWindow::showRegisterDialog()
375382
if (_pGuiModel->guiState() == GuiState::DATA_LOADED)
376383
{
377384
QMessageBox::StandardButton reply;
378-
reply = QMessageBox::question(this, "Clear data?", "An imported data file is loaded. Do you want to clear the data and start adding registers for a new log?", QMessageBox::Yes|QMessageBox::No);
385+
reply = QMessageBox::question(
386+
this, "Clear data?",
387+
"An imported data file is loaded. Do you want to clear the data and start adding registers for a new log?",
388+
QMessageBox::Yes | QMessageBox::No);
379389
if (reply != QMessageBox::Yes)
380390
{
381391
return;
@@ -394,9 +404,7 @@ void MainWindow::showRegisterDialog()
394404
void MainWindow::addNoteToGraph()
395405
{
396406
bool ok;
397-
QString text = QInputDialog::getText(this, tr("Add note"),
398-
tr("Note text:"), QLineEdit::Normal,
399-
"", &ok);
407+
QString text = QInputDialog::getText(this, tr("Add note"), tr("Note text:"), QLineEdit::Normal, "", &ok);
400408
if (ok)
401409
{
402410
Note newNote(text, _lastRightClickPos);
@@ -557,7 +565,7 @@ void MainWindow::handleGraphColorChange(const quint32 graphIdx)
557565
{
558566
const quint32 activeIdx = static_cast<quint32>(_pGraphDataModel->convertToActiveGraphIndex(graphIdx));
559567

560-
QPixmap pixmap(20,5);
568+
QPixmap pixmap(20, 5);
561569
pixmap.fill(_pGraphDataModel->color(graphIdx));
562570

563571
QIcon showHideIcon = QIcon(pixmap);
@@ -613,13 +621,13 @@ void MainWindow::rebuildGraphMenu()
613621
QList<quint16> activeGraphList;
614622
_pGraphDataModel->activeGraphIndexList(&activeGraphList);
615623

616-
for(qint32 activeIdx = 0; activeIdx < activeGraphList.size(); activeIdx++)
624+
for (qint32 activeIdx = 0; activeIdx < activeGraphList.size(); activeIdx++)
617625
{
618626

619627
QString label = _pGraphDataModel->label(activeGraphList[activeIdx]);
620-
QAction * pShowHideAction = _pGraphShowHide->addAction(label);
628+
QAction* pShowHideAction = _pGraphShowHide->addAction(label);
621629

622-
QPixmap pixmap(20,5);
630+
QPixmap pixmap(20, 5);
623631
pixmap.fill(_pGraphDataModel->color(activeGraphList[activeIdx]));
624632
QIcon icon = QIcon(pixmap);
625633

@@ -727,7 +735,7 @@ void MainWindow::updateGuiState()
727735
_pUi->actionSaveProjectFileAs->setEnabled(false);
728736
_pUi->actionSaveProjectFile->setEnabled(false);
729737
_pUi->actionExportImage->setEnabled(true);
730-
_pUi->actionClearData->setEnabled(false);
738+
_pUi->actionClearData->setEnabled(false);
731739
_pUi->actionReloadProjectFile->setEnabled(false);
732740

733741
_pGuiModel->setWindowTitleDetail(QFileInfo(_pDataParserModel->dataFilePath()).fileName());
@@ -789,15 +797,15 @@ void MainWindow::showContextMenu(const QPoint& pos)
789797
}
790798
}
791799

792-
void MainWindow::dragEnterEvent(QDragEnterEvent *e)
800+
void MainWindow::dragEnterEvent(QDragEnterEvent* e)
793801
{
794802
if (e->mimeData()->hasUrls())
795803
{
796804
e->acceptProposedAction();
797805
}
798806
}
799807

800-
void MainWindow::dropEvent(QDropEvent *e)
808+
void MainWindow::dropEvent(QDropEvent* e)
801809
{
802810
if (!_pModbusPoll->isActive())
803811
{
@@ -806,7 +814,7 @@ void MainWindow::dropEvent(QDropEvent *e)
806814
}
807815
}
808816

809-
void MainWindow::appFocusChanged(QWidget *old, QWidget *now)
817+
void MainWindow::appFocusChanged(QWidget* old, QWidget* now)
810818
{
811819
Q_UNUSED(now);
812820
if (old != nullptr)
@@ -849,8 +857,9 @@ void MainWindow::handleCommandLineArguments(QStringList cmdArguments)
849857
argumentParser.setApplicationDescription("Log data through the Modbus protocol");
850858
argumentParser.addHelpOption();
851859

852-
// Project file option
853-
argumentParser.addPositionalArgument("project file", QCoreApplication::translate("main", "Project file (.mbs) to open"));
860+
// Project file option
861+
argumentParser.addPositionalArgument("project file",
862+
QCoreApplication::translate("main", "Project file (.mbs) to open"));
854863

855864
// Process arguments
856865
argumentParser.process(cmdArguments);
@@ -882,4 +891,3 @@ void MainWindow::handleFileOpen(QString filename)
882891
_pDataFileHandler->openDataFile(filename);
883892
}
884893
}
885-

src/dialogs/mainwindow.h

100755100644
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ class MainWindow : public QMainWindow
4040
Q_OBJECT
4141

4242
public:
43-
explicit MainWindow(QStringList cmdArguments, GuiModel *pGuiModel, SettingsModel *pSettingsModel,
44-
GraphDataModel *pGraphDataModel, NoteModel *pNoteModel,
45-
DiagnosticModel *pDiagnosticModel,
46-
DataParserModel *pDataParserModel, QWidget *parent = nullptr);
43+
explicit MainWindow(QStringList cmdArguments,
44+
GuiModel* pGuiModel,
45+
SettingsModel* pSettingsModel,
46+
GraphDataModel* pGraphDataModel,
47+
NoteModel* pNoteModel,
48+
DiagnosticModel* pDiagnosticModel,
49+
DataParserModel* pDataParserModel,
50+
QWidget* parent = nullptr);
4751
~MainWindow();
4852

4953
protected:
@@ -91,9 +95,9 @@ private slots:
9195
void scaleWidgetUndocked(bool bFloat);
9296
void legendWidgetUndocked(bool bFloat);
9397
void showContextMenu(const QPoint& pos);
94-
void dragEnterEvent(QDragEnterEvent *e);
95-
void dropEvent(QDropEvent *e);
96-
void appFocusChanged(QWidget *old, QWidget *now);
98+
void dragEnterEvent(QDragEnterEvent* e);
99+
void dropEvent(QDropEvent* e);
100+
void appFocusChanged(QWidget* old, QWidget* now);
97101
void updateDataFileNotes();
98102

99103
void showVersionUpdate(UpdateNotify::UpdateState result);
@@ -104,34 +108,34 @@ private slots:
104108
void handleCommandLineArguments(QStringList cmdArguments);
105109
void handleFileOpen(QString filename);
106110

107-
Ui::MainWindow * _pUi;
108-
ModbusPoll * _pModbusPoll;
109-
GraphView * _pGraphView;
111+
Ui::MainWindow* _pUi;
112+
ModbusPoll* _pModbusPoll;
113+
GraphView* _pGraphView;
110114

111-
GuiModel * _pGuiModel;
112-
SettingsModel * _pSettingsModel;
113-
GraphDataModel * _pGraphDataModel;
114-
NoteModel * _pNoteModel;
115-
DiagnosticModel * _pDiagnosticModel;
116-
DataParserModel * _pDataParserModel;
115+
GuiModel* _pGuiModel;
116+
SettingsModel* _pSettingsModel;
117+
GraphDataModel* _pGraphDataModel;
118+
NoteModel* _pNoteModel;
119+
DiagnosticModel* _pDiagnosticModel;
120+
DataParserModel* _pDataParserModel;
117121

118122
UpdateNotify* _pUpdateNotify;
119123
GraphDataHandler* _pGraphDataHandler;
120124
ExpressionStatus* _pExpressionStatus;
121125
CommunicationStats* _pCommunicationStats;
122126

123-
DiagnosticDialog * _pDiagnosticDialog;
127+
DiagnosticDialog* _pDiagnosticDialog;
124128

125129
DataFileHandler* _pDataFileHandler;
126130
ProjectFileHandler* _pProjectFileHandler;
127131

128-
NotesDock * _pNotesDock;
129-
MarkerInfo * _pMarkerInfo;
130-
Legend * _pLegend;
131-
StatusBar * _pStatusBar;
132+
NotesDock* _pNotesDock;
133+
MarkerInfo* _pMarkerInfo;
134+
Legend* _pLegend;
135+
StatusBar* _pStatusBar;
132136

133137
QMenu _menuRightClick;
134-
QMenu * _pGraphShowHide;
138+
QMenu* _pGraphShowHide;
135139

136140
MostRecentMenu* _pMostRecentMenu;
137141
RecentFileModule _recentFileModule;

src/dialogs/mbcheader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class MbcHeader : public QHeaderView
3232
QRect checkbox_rect = style()->subElementRect(QStyle::SubElement::SE_CheckBoxIndicator, &option, this);
3333
checkbox_rect.moveCenter(rect.center());
3434

35-
const auto headerState = static_cast<Qt::CheckState>(
36-
model()->headerData(logicalIndex, orientation(), Qt::CheckStateRole).toInt());
35+
const auto headerState =
36+
static_cast<Qt::CheckState>(model()->headerData(logicalIndex, orientation(), Qt::CheckStateRole).toInt());
3737

3838
option.rect = checkbox_rect;
3939
option.state &= ~(QStyle::State_On | QStyle::State_Off | QStyle::State_NoChange);

0 commit comments

Comments
 (0)