forked from fpoussin/qtcreator-doxygen
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdoxygensettingswidget.cpp
186 lines (163 loc) · 7.95 KB
/
doxygensettingswidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/**************************************************************************
**
** This file is part of Doxygen plugin for Qt Creator
**
** Copyright (c) 2009 Kevin Tanguy ([email protected]).
** Copyright (c) 2015 Fabien Poussin ([email protected]).
**
** This plugin is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as
** published by the Free Software Foundation, either version 2.1
** of the License, or (at your option) any later version.
**
** This plugin is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Doxygen Plugin. If not, see <http://www.gnu.org/licenses/>.
**/
#include "doxygensettingswidget.h"
#include "ui_doxygensettingswidget.h"
DoxygenSettingsWidget::DoxygenSettingsWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::DoxygenSettingsWidget)
{
ui->setupUi(this);
ui->pathChooser_doxycpp->setExpectedKind(Utils::PathChooser::File);
ui->pathChooser_doxycpp->setPromptDialogTitle(tr("Doxygen cpp config"));
ui->pathChooser_doxyqml->setExpectedKind(Utils::PathChooser::File);
ui->pathChooser_doxyqml->setPromptDialogTitle(tr("Doxygen qml config"));
ui->pathChooser_doxypy->setExpectedKind(Utils::PathChooser::File);
ui->pathChooser_doxypy->setPromptDialogTitle(tr("Doxygen python config"));
ui->pathChooser_doxymd->setExpectedKind(Utils::PathChooser::File);
ui->pathChooser_doxymd->setPromptDialogTitle(tr("Doxygen docs config"));
ui->pathChooser_doxygen->setExpectedKind(Utils::PathChooser::Command);
ui->pathChooser_doxygen->setPromptDialogTitle(tr("Doxygen Command"));
// ui->pathChooser_custom->setExpectedKind(Utils::PathChooser::Command);
// ui->pathChooser_custom->setPromptDialogTitle(tr("Custom Command"));
ui->pathChooser_wizard->setExpectedKind(Utils::PathChooser::Command);
ui->pathChooser_wizard->setPromptDialogTitle(tr("DoxyWizard Command"));
ui->pathChooser_outdir->setExpectedKind(Utils::PathChooser::Kind::Directory);
ui->pathChooser_outdir->setPromptDialogTitle(tr("html OutPut Dir"));
// Why do I *have* to call processEvents() to get my QComboBox display the right value?!
qApp->processEvents();
connect(ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCustomWidgetPart(int)));
}
DoxygenSettingsWidget::~DoxygenSettingsWidget()
{
delete ui;
}
void DoxygenSettingsWidget::changeEvent(QEvent* e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
DoxygenSettingsStruct DoxygenSettingsWidget::settings() const
{
DoxygenSettingsStruct rc;
rc.doxygenOutDir = ui->pathChooser_outdir->path();
rc.doxyConfigQml = ui->pathChooser_doxyqml->path();
rc.doxyConfigPython = ui->pathChooser_doxypy->path();
rc.doxyConfigMarkdown = ui->pathChooser_doxymd->path();
rc.doxygenCommand = ui->pathChooser_doxygen->path();
rc.enableOpenHtml = ui->enableOpenHtml->isChecked();
rc.browserArgCommand = ui->lineEdit_browser_arg->text();
rc.browserCommand = ui->lineEdit_browser->text();
rc.doxyConfigCpp = ui->pathChooser_doxycpp->path();
rc.doxywizardCommand = ui->pathChooser_wizard->path();
rc.style = DoxygenStyle(ui->styleChooser->currentIndex());
rc.fcomment = Files2Comment(ui->fcommentChooser->currentIndex());
rc.printBrief = ui->printBriefTag->isChecked();
rc.shortVarDoc = ui->shortVariableDoc->isChecked();
rc.verbosePrinting = ui->verbosePrinting->isChecked();
rc.customBegin = QString(ui->edit_beginTag->text()).replace("\\n", "\n");
rc.customBrief = QString(ui->edit_briefTag->text()).replace("\\n", "\n");
rc.customEmptyLine = QString(ui->edit_emptyLineTag->text()).replace("\\n", "\n");
rc.customEnding = QString(ui->edit_endTag->text()).replace("\\n", "\n");
rc.customNewLine = QString(ui->edit_newLine->text()).replace("\\n", "\n");
rc.customShortDoc = QString(ui->edit_shortTag->text()).replace("\\n", "\n");
rc.customShortDocEnd = QString(ui->edit_shortTagEnd->text()).replace("\\n", "\n");
rc.fileComment = ui->fileCommentText->toPlainText();
rc.fileCommentHeaders = ui->commentHeaderFiles->isChecked();
rc.fileCommentImpl = ui->commentImplementationFiles->isChecked();
rc.fileCommentsEnabled = ui->fileComments->isChecked();
rc.automaticReturnType = ui->autoAddReturnTypes->isChecked();
return rc;
}
void DoxygenSettingsWidget::setSettings(const DoxygenSettingsStruct& s)
{
ui->pathChooser_outdir->setPath(s.doxygenOutDir);
ui->pathChooser_doxyqml->setPath(s.doxyConfigQml);
ui->pathChooser_doxypy->setPath(s.doxyConfigPython);
ui->pathChooser_doxymd->setPath(s.doxyConfigMarkdown);
ui->pathChooser_doxygen->setPath(s.doxygenCommand);
ui->enableOpenHtml->setChecked(s.enableOpenHtml);
ui->lineEdit_browser_arg->setText(s.browserArgCommand);
ui->lineEdit_browser->setText(s.browserCommand);
ui->pathChooser_wizard->setPath(s.doxywizardCommand);
ui->pathChooser_doxycpp->setPath(s.doxyConfigCpp);
ui->styleChooser->setCurrentIndex(s.style);
ui->fcommentChooser->setCurrentIndex(s.fcomment);
ui->printBriefTag->setChecked(s.printBrief);
ui->shortVariableDoc->setChecked(s.shortVarDoc);
ui->verbosePrinting->setChecked(s.verbosePrinting);
ui->edit_beginTag->setText(QString(s.customBegin).replace("\n", "\\n"));
ui->edit_briefTag->setText(QString(s.customBrief).replace("\n", "\\n"));
ui->edit_emptyLineTag->setText(QString(s.customEmptyLine).replace("\n", "\\n"));
ui->edit_endTag->setText(QString(s.customEnding).replace("\n", "\\n"));
ui->edit_newLine->setText(QString(s.customNewLine).replace("\n", "\\n"));
ui->edit_shortTag->setText(QString(s.customShortDoc).replace("\n", "\\n"));
ui->edit_shortTagEnd->setText(QString(s.customShortDocEnd).replace("\n", "\\n"));
ui->fileCommentText->setPlainText(s.fileComment);
ui->fileComments->setChecked(s.fileCommentsEnabled);
ui->commentHeaderFiles->setChecked(s.fileCommentHeaders);
ui->commentImplementationFiles->setChecked(s.fileCommentImpl);
ui->autoAddReturnTypes->setChecked(s.automaticReturnType);
updateCustomWidgetPart(s.style);
on_fileComments_clicked(s.fileCommentsEnabled);
on_enableOpenHtml_clicked(s.enableOpenHtml);
}
void DoxygenSettingsWidget::updateCustomWidgetPart(int index)
{
ui->customCommentsSettings->setEnabled(index == customDoc);
}
void DoxygenSettingsWidget::on_fileComments_clicked(bool checked)
{
Files2Comment toComment = Files2Comment(ui->fcommentChooser->currentIndex());
ui->fileCommentText->setEnabled(checked);
if (checked == false || toComment == all) {
checked = false;
ui->label_filecommentHeaders->setVisible(checked);
ui->label_filecommentImpl->setVisible(checked);
ui->commentHeaderFiles->setVisible(checked);
ui->commentImplementationFiles->setVisible(checked);
} else if (toComment == headers) {
ui->label_filecommentHeaders->setVisible(false);
ui->label_filecommentImpl->setVisible(true);
ui->commentHeaderFiles->setVisible(false);
ui->commentImplementationFiles->setVisible(true);
} else if (toComment == implementations) {
ui->label_filecommentHeaders->setVisible(true);
ui->label_filecommentImpl->setVisible(false);
ui->commentHeaderFiles->setVisible(true);
ui->commentImplementationFiles->setVisible(false);
}
}
void DoxygenSettingsWidget::on_fcommentChooser_currentIndexChanged(int index)
{
Q_UNUSED(index)
on_fileComments_clicked(ui->fileComments->isChecked());
}
void DoxygenSettingsWidget::on_enableOpenHtml_clicked(bool checked)
{
ui->lineEdit_browser->setEnabled(checked);
ui->lineEdit_browser_arg->setEnabled(checked);
}