Changeset View
Changeset View
Standalone View
Standalone View
plugins/cppcheck/config/projectconfigpage.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include "projectconfigpage.h" | 21 | #include "projectconfigpage.h" | ||
22 | #include "ui_projectconfigpage.h" | 22 | #include "ui_projectconfigpage.h" | ||
23 | 23 | | |||
24 | #include "projectsettings.h" | 24 | #include "projectsettings.h" | ||
25 | 25 | | |||
26 | #include <interfaces/iproject.h> | 26 | #include <interfaces/iproject.h> | ||
27 | 27 | | |||
28 | #include <QFontDatabase> | ||||
29 | | ||||
28 | namespace cppcheck | 30 | namespace cppcheck | ||
29 | { | 31 | { | ||
30 | 32 | | |||
31 | ProjectConfigPage::ProjectConfigPage(KDevelop::IPlugin* plugin, KDevelop::IProject* project, QWidget* parent) | 33 | ProjectConfigPage::ProjectConfigPage(KDevelop::IPlugin* plugin, KDevelop::IProject* project, QWidget* parent) | ||
32 | : ConfigPage(plugin, new ProjectSettings, parent) | 34 | : ConfigPage(plugin, new ProjectSettings, parent) | ||
33 | , ui(new Ui::ProjectConfigPage) | 35 | , ui(new Ui::ProjectConfigPage) | ||
34 | , m_parameters(new Parameters(project)) | 36 | , m_parameters(new Parameters(project)) | ||
35 | { | 37 | { | ||
36 | configSkeleton()->setSharedConfig(project->projectConfiguration()); | 38 | configSkeleton()->setSharedConfig(project->projectConfiguration()); | ||
37 | configSkeleton()->load(); | 39 | configSkeleton()->load(); | ||
38 | 40 | | |||
39 | ui->setupUi(this); | 41 | ui->setupUi(this); | ||
40 | 42 | | |||
41 | ui->commandLine->setFontFamily(QStringLiteral("Monospace")); | 43 | ui->commandLine->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); | ||
42 | 44 | | |||
43 | connect(this, &ProjectConfigPage::changed, this, &ProjectConfigPage::updateCommandLine); | 45 | connect(this, &ProjectConfigPage::changed, this, &ProjectConfigPage::updateCommandLine); | ||
44 | connect(ui->commandLineFilter->lineEdit(), &QLineEdit::textChanged, this, &ProjectConfigPage::updateCommandLine); | 46 | connect(ui->commandLineFilter->lineEdit(), &QLineEdit::textChanged, this, &ProjectConfigPage::updateCommandLine); | ||
45 | connect(ui->commandLineBreaks, &QCheckBox::stateChanged, this, &ProjectConfigPage::updateCommandLine); | 47 | connect(ui->commandLineBreaks, &QCheckBox::stateChanged, this, &ProjectConfigPage::updateCommandLine); | ||
46 | } | 48 | } | ||
47 | 49 | | |||
48 | ProjectConfigPage::~ProjectConfigPage() | 50 | ProjectConfigPage::~ProjectConfigPage() | ||
49 | { | 51 | { | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 77 | { | |||
93 | if (message.isEmpty()) { | 95 | if (message.isEmpty()) { | ||
94 | ui->messageWidget->hide(); | 96 | ui->messageWidget->hide(); | ||
95 | } else { | 97 | } else { | ||
96 | ui->messageWidget->setText(message); | 98 | ui->messageWidget->setText(message); | ||
97 | ui->messageWidget->show(); | 99 | ui->messageWidget->show(); | ||
98 | } | 100 | } | ||
99 | 101 | | |||
100 | if (!ui->commandLineBreaks->isChecked()) { | 102 | if (!ui->commandLineBreaks->isChecked()) { | ||
101 | ui->commandLine->setText(commandLine); | 103 | ui->commandLine->setPlainText(commandLine); | ||
102 | return; | 104 | return; | ||
103 | } | 105 | } | ||
104 | 106 | | |||
105 | commandLine.replace(QLatin1String(" -"), QLatin1String("\n-")); | 107 | commandLine.replace(QLatin1String(" -"), QLatin1String("\n-")); | ||
106 | QString filterText = ui->commandLineFilter->lineEdit()->text(); | 108 | QString filterText = ui->commandLineFilter->lineEdit()->text(); | ||
107 | if (filterText.isEmpty()) { | 109 | if (filterText.isEmpty()) { | ||
108 | ui->commandLine->setText(commandLine); | 110 | ui->commandLine->setPlainText(commandLine); | ||
109 | ui->commandLineBreaks->setEnabled(true); | 111 | ui->commandLineBreaks->setEnabled(true); | ||
110 | return; | 112 | return; | ||
111 | } | 113 | } | ||
112 | 114 | | |||
113 | QStringList lines = commandLine.split('\n'); | 115 | QStringList lines = commandLine.split('\n'); | ||
114 | QMutableStringListIterator i(lines); | 116 | QMutableStringListIterator i(lines); | ||
115 | 117 | | |||
116 | while (i.hasNext()) { | 118 | while (i.hasNext()) { | ||
117 | if (!i.next().contains(filterText)) { | 119 | if (!i.next().contains(filterText)) { | ||
118 | i.remove(); | 120 | i.remove(); | ||
119 | } | 121 | } | ||
120 | } | 122 | } | ||
121 | 123 | | |||
122 | ui->commandLine->setText(lines.join('\n')); | 124 | ui->commandLine->setPlainText(lines.join('\n')); | ||
123 | ui->commandLineBreaks->setEnabled(false); | 125 | ui->commandLineBreaks->setEnabled(false); | ||
124 | } | 126 | } | ||
125 | 127 | | |||
126 | } | 128 | } |