| 119 | } |
| 120 | |
| 121 | MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : |
| 122 | mSettings(settings), |
| 123 | mApplications(new ApplicationList(this)), |
| 124 | mTranslation(th), |
| 125 | mUI(new Ui::MainWindow), |
| 126 | mPlatformActions(new QActionGroup(this)), |
| 127 | mCStandardActions(new QActionGroup(this)), |
| 128 | mCppStandardActions(new QActionGroup(this)), |
| 129 | mSelectLanguageActions(new QActionGroup(this)), |
| 130 | mSelectReportActions(new QActionGroup(this)) |
| 131 | { |
| 132 | { |
| 133 | Settings tempSettings; |
| 134 | tempSettings.exename = QCoreApplication::applicationFilePath().toStdString(); |
| 135 | Suppressions tempSupprs; |
| 136 | Settings::loadCppcheckCfg(tempSettings, tempSupprs); // TODO: how to handle error? |
| 137 | mCppcheckCfgProductName = QString::fromStdString(tempSettings.cppcheckCfgProductName); |
| 138 | mCppcheckCfgAbout = QString::fromStdString(tempSettings.cppcheckCfgAbout); |
| 139 | } |
| 140 | |
| 141 | mUI->setupUi(this); |
| 142 | mThread = new ThreadHandler(this); |
| 143 | mUI->mResults->initialize(mSettings, mApplications, mThread); |
| 144 | |
| 145 | // Filter timer to delay filtering results slightly while typing |
| 146 | mFilterTimer = new QTimer(this); |
| 147 | mFilterTimer->setInterval(500); |
| 148 | mFilterTimer->setSingleShot(true); |
| 149 | connect(mFilterTimer, &QTimer::timeout, this, &MainWindow::filterResults); |
| 150 | |
| 151 | // "Filter" toolbar |
| 152 | mLineEditFilter = new QLineEdit(mUI->mToolBarFilter); |
| 153 | mLineEditFilter->setPlaceholderText(tr("Quick Filter:")); |
| 154 | mLineEditFilter->setClearButtonEnabled(true); |
| 155 | mUI->mToolBarFilter->addWidget(mLineEditFilter); |
| 156 | connect(mLineEditFilter, SIGNAL(textChanged(QString)), mFilterTimer, SLOT(start())); |
| 157 | connect(mLineEditFilter, &QLineEdit::returnPressed, this, &MainWindow::filterResults); |
| 158 | |
| 159 | connect(mUI->mActionPrint, SIGNAL(triggered()), mUI->mResults, SLOT(print())); |
| 160 | connect(mUI->mActionPrintPreview, SIGNAL(triggered()), mUI->mResults, SLOT(printPreview())); |
| 161 | connect(mUI->mActionQuit, &QAction::triggered, this, &MainWindow::close); |
| 162 | connect(mUI->mActionAnalyzeFiles, &QAction::triggered, this, &MainWindow::analyzeFiles); |
| 163 | connect(mUI->mActionAnalyzeDirectory, &QAction::triggered, this, &MainWindow::analyzeDirectory); |
| 164 | connect(mUI->mActionSettings, &QAction::triggered, this, &MainWindow::programSettings); |
| 165 | connect(mUI->mActionClearResults, &QAction::triggered, this, &MainWindow::clearResults); |
| 166 | connect(mUI->mActionOpenXML, &QAction::triggered, this, &MainWindow::openResults); |
| 167 | |
| 168 | connect(mUI->mActionShowStyle, &QAction::toggled, this, &MainWindow::showStyle); |
| 169 | connect(mUI->mActionShowErrors, &QAction::toggled, this, &MainWindow::showErrors); |
| 170 | connect(mUI->mActionShowWarnings, &QAction::toggled, this, &MainWindow::showWarnings); |
| 171 | connect(mUI->mActionShowPortability, &QAction::toggled, this, &MainWindow::showPortability); |
| 172 | connect(mUI->mActionShowPerformance, &QAction::toggled, this, &MainWindow::showPerformance); |
| 173 | connect(mUI->mActionShowInformation, &QAction::toggled, this, &MainWindow::showInformation); |
| 174 | connect(mUI->mActionShowCppcheck, &QAction::toggled, mUI->mResults, &ResultsView::showCppcheckResults); |
| 175 | connect(mUI->mActionShowClang, &QAction::toggled, mUI->mResults, &ResultsView::showClangResults); |
| 176 | connect(mUI->mActionCheckAll, &QAction::triggered, this, &MainWindow::checkAll); |
| 177 | connect(mUI->mActionUncheckAll, &QAction::triggered, this, &MainWindow::uncheckAll); |
| 178 | connect(mUI->mActionCollapseAll, &QAction::triggered, mUI->mResults, &ResultsView::collapseAllResults); |
nothing calls this directly
no test coverage detected