Cppcheck
scratchpad.cpp
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2023 Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "scratchpad.h"
20 
21 #include "codeeditor.h"
22 #include "mainwindow.h"
23 
24 #include "ui_scratchpad.h"
25 
26 #include <QLineEdit>
27 #include <QPushButton>
28 
30  : QDialog(&mainWindow)
31  , mUI(new Ui::ScratchPad)
32  , mMainWindow(mainWindow)
33 {
34  mUI->setupUi(this);
35 
36  connect(mUI->mCheckButton, &QPushButton::clicked, this, &ScratchPad::checkButtonClicked);
37 }
38 
40 {
41  delete mUI;
42 }
43 
45 {
46  mUI->retranslateUi(this);
47 }
48 
50 {
51  QString filename = mUI->lineEdit->text();
52  if (filename.isEmpty())
53  filename = "test.cpp";
54  mMainWindow.analyzeCode(mUI->plainTextEdit->toPlainText(), filename);
55 }
Main window for cppcheck-gui.
Definition: mainwindow.h:58
void analyzeCode(const QString &code, const QString &filename)
Analyze given code.
Definition: mainwindow.cpp:625
A window with a text field that .
Definition: scratchpad.h:37
~ScratchPad() override
Definition: scratchpad.cpp:39
ScratchPad(MainWindow &mainWindow)
Definition: scratchpad.cpp:29
Ui::ScratchPad * mUI
Definition: scratchpad.h:55
void translate()
Translate dialog.
Definition: scratchpad.cpp:44
MainWindow & mMainWindow
Definition: scratchpad.h:56
void checkButtonClicked()
Called when check button is clicked.
Definition: scratchpad.cpp:49
Definition: aboutdialog.h:27