├── INSTALL
├── doxygen.png
├── doxygen.qrc
├── Jenkinsfile
├── doxygenfilesdialog.h
├── doxygen_global.h
├── Doxygen.json.in
├── doxygenconstants.h
├── doxygensettings.h
├── doxygensettingswidget.h
├── README.md
├── doxygen.h
├── doxygensettings.cpp
├── doxygenfilesdialog.ui
├── doxygen.pro
├── doxygensettingsstruct.h
├── doxygenplugin.h
├── doxygenfilesdialog.cpp
├── doxygensettingswidget.cpp
├── .github
└── workflows
│ └── build_qmake.yml
├── doxygensettingsstruct.cpp
├── doxygenplugin.cpp
├── doxygensettingswidget.ui
├── doxygen.cpp
└── LICENSE
/INSTALL:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doxygen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fpoussin/qtcreator-doxygen/HEAD/doxygen.png
--------------------------------------------------------------------------------
/doxygen.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | doxygen.png
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline {
2 | agent {
3 | docker {
4 | image 'fpoussin/jenkins:ubuntu-20.04-qtcreator-4.13'
5 | }
6 |
7 | }
8 | stages {
9 | stage('Prepare') {
10 | steps {
11 | sh '''git submodule sync
12 | git submodule update --init'''
13 | }
14 | }
15 |
16 | stage('Build') {
17 | steps {
18 | sh '''mkdir build
19 | cd build
20 | export HOME=/tmp
21 | qmake QTC_SOURCE=/qtcreator QTC_BUILD=/qtcreator USE_USER_DESTDIR=YES ..
22 | nice make -j $(nproc)
23 | cp $HOME/.local/share/data/QtProject/qtcreator/plugins/**/libDoxygen.so $WORKSPACE/'''
24 | }
25 | }
26 |
27 | stage('Artifacts') {
28 | steps {
29 | archiveArtifacts(artifacts: 'libDoxygen.so', caseSensitive: true, onlyIfSuccessful: true)
30 | }
31 | }
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/doxygenfilesdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef DOXYGENFILESDIALOG_H
2 | #define DOXYGENFILESDIALOG_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | namespace Ui {
10 | class DoxygenFilesDialog;
11 | }
12 |
13 | class DoxygenFilesDialog : public QDialog
14 | {
15 | Q_OBJECT
16 |
17 | public:
18 | explicit DoxygenFilesDialog(QWidget *parent = 0);
19 | ~DoxygenFilesDialog();
20 | uint getFilesList(QStringList *out);
21 |
22 | void initFileTree(ProjectExplorer::Node *rootNode);
23 |
24 | private:
25 | Ui::DoxygenFilesDialog *ui;
26 |
27 | void createLeaf(ProjectExplorer::Node *parentNode, QTreeWidgetItem *parentItem);
28 | uint getFilesList(QTreeWidgetItem* parent, QStringList *out, int count);
29 | void changeCheckState(QTreeWidgetItem* parent, Qt::CheckState state);
30 |
31 | private slots:
32 | void checkAll();
33 | void checkNone();
34 | void updateChecks(QTreeWidgetItem* item, int column);
35 | };
36 |
37 | #endif // DOXYGENFILESDIALOG_H
38 |
--------------------------------------------------------------------------------
/doxygen_global.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
6 | **
7 | ** This plugin is free software: you can redistribute it and/or modify
8 | ** it under the terms of the GNU Lesser General Public License as
9 | ** published by the Free Software Foundation, either version 2.1
10 | ** of the License, or (at your option) any later version.
11 | **
12 | ** This plugin is distributed in the hope that it will be useful,
13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | ** GNU Lesser General Public License for more details.
16 | **
17 | ** You should have received a copy of the GNU General Public License
18 | ** along with Doxygen Plugin. If not, see .
19 | **/
20 |
21 | #ifndef DOXYGEN_GLOBAL_H
22 | #define DOXYGEN_GLOBAL_H
23 |
24 | #include
25 |
26 | #if defined(DOXYGEN_LIBRARY)
27 | # define DOXYGENSHARED_EXPORT Q_DECL_EXPORT
28 | #else
29 | # define DOXYGENSHARED_EXPORT Q_DECL_IMPORT
30 | #endif
31 |
32 | #endif // DOXYGEN_GLOBAL_H
33 |
34 |
--------------------------------------------------------------------------------
/Doxygen.json.in:
--------------------------------------------------------------------------------
1 | {
2 | \"Name\" : \"Doxygen\",
3 | \"Version\" : \"0.4.8\",
4 | \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
5 | \"Vendor\" : \"Fabien Poussin\",
6 | \"Copyright\" : \"Fabien Poussin\",
7 | \"License\" : [ \"Commercial Usage\",
8 | \"\",
9 | \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
10 | \"\",
11 | \"GNU Lesser General Public License Usage\",
12 | \"\",
13 | \"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\"
14 | ],
15 | \"Category\" : \"C++\",
16 | \"Description\" : \"This plugin allows doxygen blocs creation for files or full projects as well as full documentation creation.\",
17 | \"Url\" : \"https://github.com/fpoussin/qtcreator-doxygen\",
18 | $$dependencyList
19 | }
20 |
--------------------------------------------------------------------------------
/doxygenconstants.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
6 | **
7 | ** This plugin is free software: you can redistribute it and/or modify
8 | ** it under the terms of the GNU Lesser General Public License as
9 | ** published by the Free Software Foundation, either version 2.1
10 | ** of the License, or (at your option) any later version.
11 | **
12 | ** This plugin is distributed in the hope that it will be useful,
13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | ** GNU Lesser General Public License for more details.
16 | **
17 | ** You should have received a copy of the GNU General Public License
18 | ** along with Doxygen Plugin. If not, see .
19 | **/
20 |
21 | #ifndef DOXYGENCONSTANTS_H
22 | #define DOXYGENCONSTANTS_H
23 |
24 | namespace DoxyPlugin {
25 | namespace Constants {
26 |
27 | const char CREATE_DOCUMENTATION_DOXYGEN[] = "Doxygen.createDocumentation";
28 | const char DOCUMENT_FILE_DOXYGEN[] = "Doxygen.documentFile";
29 | const char DOXYGEN_SETTINGS_CATEGORY[] = "X.Doxygen";
30 | const char DOXYGEN_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Doxygen", "Doxygen Plugin");
31 |
32 |
33 | } // namespace Doxygen
34 | } // namespace Constants
35 |
36 | #endif // DOXYGENCONSTANTS_H
37 |
38 |
--------------------------------------------------------------------------------
/doxygensettings.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #ifndef DOXYGENSETTINGS_H
23 | #define DOXYGENSETTINGS_H
24 |
25 | #include
26 | #include "doxygensettingsstruct.h"
27 | #include "doxygensettingswidget.h"
28 | #include
29 |
30 | QT_BEGIN_NAMESPACE
31 | class QSettings;
32 | QT_END_NAMESPACE
33 |
34 | namespace DoxyPlugin {
35 | namespace Internal {
36 |
37 | class DoxygenSettings : public Core::IOptionsPage
38 | {
39 | Q_OBJECT
40 | public:
41 | DoxygenSettings();
42 |
43 | QWidget *widget();
44 | void apply();
45 | void finish();
46 | DoxygenSettingsStruct settings() const;
47 | void setSettings(const DoxygenSettingsStruct &s);
48 |
49 | private:
50 | DoxygenSettingsStruct m_settings;
51 | QPointer m_widget;
52 | };
53 |
54 | } // namespace Internal
55 | } // namespace DoxyPlugin
56 |
57 | #endif // DOXYGENSETTINGS_H
58 |
--------------------------------------------------------------------------------
/doxygensettingswidget.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #ifndef DOXYGENSETTINGSWIDGET_H
23 | #define DOXYGENSETTINGSWIDGET_H
24 |
25 | #include
26 | #include
27 | #include "doxygensettingsstruct.h"
28 |
29 | using namespace DoxyPlugin;
30 | using namespace DoxyPlugin::Internal;
31 |
32 | namespace Ui {
33 | class DoxygenSettingsWidget;
34 | }
35 |
36 | class DoxygenSettingsWidget : public QWidget
37 | {
38 | Q_OBJECT
39 | public:
40 | DoxygenSettingsWidget(QWidget *parent = 0);
41 | ~DoxygenSettingsWidget();
42 | DoxygenSettingsStruct settings() const;
43 | void setSettings(const DoxygenSettingsStruct &);
44 |
45 | protected:
46 | void changeEvent(QEvent *e);
47 |
48 | private:
49 | Ui::DoxygenSettingsWidget *ui;
50 |
51 | private slots:
52 | void updateCustomWidgetPart(int index);
53 | void on_fileComments_clicked(bool checked);
54 | void on_fcommentChooser_currentIndexChanged(int index);
55 | };
56 |
57 | #endif // DOXYGENSETTINGSWIDGET_H
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # qtcreator-doxygen
2 | Doxygen Plugin for Qt Creator
3 |
4 | [](https://github.com/fpoussin/qtcreator-doxygen/releases)
5 | [](https://jenkins.netyxia.net/job/qtcreator-doxygen/job/master/)
6 |
7 | This project is a fork of the original plugins at: http://dev.kofee.org/projects/qtcreator-doxygen
8 | Built for the latest Qt-Creator versions.
9 |
10 | It adds some features such as a file selection dialog for projects, and duplicate blocks detection.
11 |
12 | Binaries are available in the releases section.
13 | https://github.com/fpoussin/qtcreator-doxygen/releases
14 |
15 | ## Compiling
16 |
17 | You will have to install the same Qt version (ie: 5.10 MSVC 2015 32 bit for 4.5.0) that was used to build the Qt creator version you are targeting for the plugin.
18 | You can check this in the "about" menu of Qt creator.
19 |
20 | * Download and extract the Qt creator sources from the official website
21 | * Compile them using the correct Qt kit (Optional on linux, you can point to the official binary release which should be in your home folder by default)
22 | * You don't need to install it when compiled
23 |
24 |
25 | ##### To compile the plugin you have 2 options:
26 | #### Qmake
27 | * Specify the path of source and binaries for Qt creator using **QTC_SOURCE** and **QTC_BUILD** vars
28 | * **QTC_SOURCE** must point to the sources you extracted
29 | * **QTC_BUILD** must point to your build folder (or binary release on Linux)
30 | * **USE_USER_DESTDIR** installs the module automatically
31 | * Example command: *qmake USE_USER_DESTDIR=yes QTC_SOURCE=\~/src/qt-creator-opensource-src-4.5.0 QTC_BUILD=\~/qtcreator-4.5.0* .
32 |
33 | #### Qt Creator
34 | * Specify the path of source and binaries for Qt creator by editing the dexygen.pro file
35 | * You have to change the **QTCREATOR_SOURCES** and **IDE_BUILD_TREE** vars
36 |
37 |
38 | ## Installing
39 | If you compiled the plugin, it will be installed automatically.
40 |
41 | ##### If you downloaded a binary release, the paths are as follow:
42 | * Unix: ~/.local/share/data/QtProject/qtcreator/plugins/**\**
43 | * OSX: ~/Library/Application Support/QtProject/Qt Creator/plugins/**\**
44 | * Windows: %LOCALAPPDATA%\QtProject\qtcreator\plugins\\**\**
45 | Replace **\** with your Qt Creator version (ie: 4.8.0)
46 |
--------------------------------------------------------------------------------
/doxygen.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #ifndef DOXYGEN_H
23 | #define DOXYGEN_H
24 |
25 | #include <3rdparty/cplusplus/Symbols.h>
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include "doxygensettingsstruct.h"
31 |
32 | namespace DoxyPlugin {
33 | namespace Internal {
34 |
35 | class Doxygen : public QObject
36 | {
37 | Q_OBJECT
38 | public:
39 | static Doxygen* instance();
40 | static QString getProjectRoot();
41 |
42 | public slots:
43 | bool documentEntity(const DoxygenSettingsStruct &DoxySettings, Core::IEditor *editor);
44 | bool addFileComment(const DoxygenSettingsStruct &DoxySettings, Core::IEditor *editor);
45 | uint documentFile(const DoxygenSettingsStruct &DoxySettings, Core::IEditor *editor);
46 | uint documentProject(ProjectExplorer::Project *p, const DoxygenSettingsStruct &DoxySettings);
47 | uint documentSpecificProject(const DoxygenSettingsStruct &DoxySettings);
48 | uint documentCurrentProject(const DoxygenSettingsStruct &DoxySettings);
49 |
50 | signals:
51 | void message(QString);
52 |
53 | private slots:
54 | void cancelOperation(void);
55 |
56 | private:
57 | Doxygen(QObject *parent = 0);
58 | ~Doxygen();
59 | void addSymbol(const CPlusPlus::Symbol* symbol, QList &symmap);
60 |
61 | QProgressDialog* m_projectProgress;
62 | QProgressDialog* m_fileProgress;
63 | bool m_cancel;
64 |
65 | static Doxygen* m_instance;
66 | };
67 |
68 | } // namespace Internal
69 | } // namespace DoxyPlugin
70 | #endif // DOXYGEN_H
71 |
--------------------------------------------------------------------------------
/doxygensettings.cpp:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #include "doxygensettings.h"
23 | #include "doxygen.h"
24 | #include "doxygenconstants.h"
25 | #include "doxygenplugin.h"
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | namespace DoxyPlugin {
33 | namespace Internal {
34 |
35 | DoxygenSettings::DoxygenSettings()
36 | : m_widget()
37 | {
38 | if (QSettings* settings = Core::ICore::instance()->settings())
39 | m_settings.fromSettings(settings);
40 | setId("A.General");
41 | setDisplayName(tr("Doxygen"));
42 | setCategory(Utils::Id::fromString(QString(Constants::DOXYGEN_SETTINGS_CATEGORY)));
43 | setDisplayCategory("Doxygen");
44 | setCategoryIcon(Utils::Icon(":/doxygen.png"));
45 | }
46 |
47 | QWidget* DoxygenSettings::widget()
48 | {
49 | if (!m_widget) {
50 | m_widget = new DoxygenSettingsWidget;
51 | m_widget->setSettings(settings());
52 | }
53 | return m_widget;
54 | }
55 |
56 | void DoxygenSettings::apply()
57 | {
58 | if (!m_widget)
59 | return;
60 | setSettings(m_widget->settings());
61 | }
62 |
63 | void DoxygenSettings::finish()
64 | {
65 | }
66 |
67 | DoxygenSettingsStruct DoxygenSettings::settings() const
68 | {
69 | return m_settings;
70 | }
71 |
72 | void DoxygenSettings::setSettings(const DoxygenSettingsStruct& s)
73 | {
74 | if (s != m_settings) {
75 | m_settings = s;
76 | if (QSettings* settings = Core::ICore::instance()->settings())
77 | m_settings.toSettings(settings);
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/doxygenfilesdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DoxygenFilesDialog
4 |
5 |
6 | Qt::ApplicationModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 400
13 | 300
14 |
15 |
16 |
17 | Select files to document
18 |
19 |
20 | true
21 |
22 |
23 | -
24 |
25 |
26 | true
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 | 0
40 | 50
41 |
42 |
43 |
44 | QFrame::StyledPanel
45 |
46 |
47 | QFrame::Raised
48 |
49 |
50 |
-
51 |
52 |
53 | Select All
54 |
55 |
56 |
57 | -
58 |
59 |
60 | Select None
61 |
62 |
63 |
64 | -
65 |
66 |
67 | Qt::Horizontal
68 |
69 |
70 |
71 | 40
72 | 20
73 |
74 |
75 |
76 |
77 | -
78 |
79 |
80 | Ok
81 |
82 |
83 |
84 | -
85 |
86 |
87 | Cancel
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/doxygen.pro:
--------------------------------------------------------------------------------
1 | DEFINES += DOXYGEN_LIBRARY
2 |
3 | # Doxygen files
4 |
5 | SOURCES += doxygenplugin.cpp \
6 | doxygensettings.cpp \
7 | doxygensettingsstruct.cpp \
8 | doxygensettingswidget.cpp \
9 | doxygen.cpp \
10 | doxygenfilesdialog.cpp
11 |
12 | HEADERS += doxygenplugin.h \
13 | doxygen_global.h \
14 | doxygenconstants.h \
15 | doxygensettings.h \
16 | doxygensettingsstruct.h \
17 | doxygensettingswidget.h \
18 | doxygen.h \
19 | doxygenfilesdialog.h
20 |
21 | FORMS += \
22 | doxygensettingswidget.ui \
23 | doxygenfilesdialog.ui
24 |
25 | RESOURCES += doxygen.qrc
26 |
27 | # Qt Creator linking
28 |
29 | ## set the QTC_SOURCE variable to override the setting here
30 | QTCREATOR_SOURCES = $$QTC_SOURCE
31 | unix:isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=$$(HOME)/src/qt-creator-opensource-src-4.10.0
32 | win32:isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=C:\src\qt-creator-opensource-src-4.10.0
33 |
34 | ## set the QTC_BUILD variable to override the setting here
35 | IDE_BUILD_TREE = $$QTC_BUILD
36 | unix:isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=$$(HOME)/Qt/Tools/QtCreator
37 | win32:isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=C:\src\build-qtcreator-Desktop_Qt_5_11_2_MSVC2015_32bit2-Release
38 |
39 | ## set the QTC_LIB_BASENAME variable to override the setting here
40 | ## this variable points to the library installation path, relative to IDE_BUILD_TREE,
41 | ## so that $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/qtcreator will be used by
42 | ## qtcreatorplugin.pri automatically as the qtcreator library path
43 | IDE_LIBRARY_BASENAME = $$QTC_LIB_BASENAME
44 |
45 | ## uncomment to build plugin into user config directory
46 | ## /plugins/
47 | ## where is e.g.
48 | ## "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
49 | ## "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
50 | ## "~/Library/Application Support/QtProject/Qt Creator" on Mac
51 |
52 | #isEmpty(USE_USER_DESTDIR):USE_USER_DESTDIR=yes
53 |
54 | ###### If the plugin can be depended upon by other plugins, this code needs to be outsourced to
55 | ###### _dependencies.pri, where is the name of the directory containing the
56 | ###### plugin's sources.
57 |
58 | QTC_PLUGIN_NAME = Doxygen
59 | QTC_LIB_DEPENDS += \
60 | # nothing here at this time
61 |
62 | QTC_PLUGIN_DEPENDS += \
63 | coreplugin \
64 | cpptools \
65 | cppeditor \
66 | projectexplorer \
67 | texteditor
68 |
69 | QTC_PLUGIN_RECOMMENDS += \
70 | # optional plugin dependencies. nothing here at this time
71 |
72 | ###### End _dependencies.pri contents ######
73 |
74 | include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)
75 |
76 | DEFINES -= QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
77 |
78 | DISTFILES += \
79 | Doxygen.json.in
80 |
81 |
--------------------------------------------------------------------------------
/doxygensettingsstruct.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #ifndef DOXYGENSETTINGSSTRUCT_H
23 | #define DOXYGENSETTINGSSTRUCT_H
24 |
25 | #include
26 |
27 | namespace DoxyPlugin {
28 | namespace Internal {
29 |
30 | enum DoxygenStyle {
31 | javaDoc = 0,
32 | qtDoc = 1,
33 | customDoc = 2
34 | };
35 |
36 | enum Files2Comment {
37 | headers = 0,
38 | implementations = 1,
39 | /*qml = 2,*/ // For future use
40 | /*bothqt = 3,*/ // For future use
41 | all = 2
42 | };
43 |
44 | struct DoxygenSettingsStruct
45 | {
46 | DoxygenSettingsStruct();
47 | void fromSettings(QSettings *);
48 | void toSettings(QSettings *);
49 | // add options to command line
50 | QStringList addOptions(const QStringList &args) const;
51 | // Format arguments for log windows hiding passwords, etc.
52 | static QString formatArguments(const QStringList &args);
53 |
54 | bool equals(const DoxygenSettingsStruct &s) const;
55 |
56 | QString doxyfileFileName;
57 | QString doxygenCommand;
58 | QString doxywizardCommand;
59 | DoxygenStyle style;
60 | Files2Comment fcomment;
61 | bool printBrief;
62 | bool shortVarDoc;
63 | bool verbosePrinting;
64 | bool automaticReturnType;
65 |
66 | bool fileCommentsEnabled;
67 | bool fileCommentHeaders;
68 | bool fileCommentImpl;
69 | QString fileComment;
70 |
71 |
72 | // Custom style
73 | QString customBegin;
74 | QString customBrief;
75 | QString customEmptyLine;
76 | QString customNewLine;
77 | QString customEnding;
78 | QString customShortDoc;
79 | QString customShortDocEnd;
80 |
81 | // Support javadoc, Qt & custom style documentation
82 | struct DoxygenComment
83 | {
84 | QString doxBegin; // = "/**\n";
85 | QString doxBrief; // = "* @brief";
86 | QString doxEmptyLine; // = "*\n";
87 | QString doxNewLine;// " " * @";
88 | QString doxEnding;// = " */";
89 | QString doxShortVarDoc;
90 | QString doxShortVarDocEnd;
91 | } DoxyComment;
92 | void setDoxygenCommentStyle(DoxygenStyle s);
93 | };
94 |
95 | inline bool operator==(const DoxygenSettingsStruct &p1, const DoxygenSettingsStruct &p2)
96 | { return p1.equals(p2); }
97 | inline bool operator!=(const DoxygenSettingsStruct &p1, const DoxygenSettingsStruct &p2)
98 | { return !p1.equals(p2); }
99 |
100 | } // namespace Internal
101 | } // namespace DoxyPlugin
102 |
103 | Q_DECLARE_METATYPE(DoxyPlugin::Internal::DoxygenSettingsStruct)
104 |
105 | #endif // DOXYGENSETTINGSSTRUCT_H
106 |
--------------------------------------------------------------------------------
/doxygenplugin.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #ifndef DOXYGENPLUGIN_H
23 | #define DOXYGENPLUGIN_H
24 |
25 | #include "doxygen_global.h"
26 |
27 | #include
28 | #include
29 | #include
30 | #include "doxygensettings.h"
31 | #include "doxygensettingsstruct.h"
32 | #include
33 |
34 | namespace DoxyPlugin {
35 | namespace Internal {
36 |
37 | struct DoxygenResponse
38 | {
39 | DoxygenResponse() : error(false) {}
40 | bool error;
41 | QString stdOut;
42 | QString stdErr;
43 | QString message;
44 | };
45 |
46 | class DoxygenPlugin : public ExtensionSystem::IPlugin
47 | {
48 | Q_OBJECT
49 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Doxygen.json")
50 |
51 | public:
52 | DoxygenPlugin();
53 | ~DoxygenPlugin();
54 |
55 | bool initialize(const QStringList &arguments, QString *errorString);
56 | void extensionsInitialized();
57 | ShutdownFlag aboutToShutdown();
58 |
59 | void setSettings(const DoxygenSettingsStruct &s);
60 | DoxygenSettingsStruct settings() const;
61 | void runDoxygen(const QStringList &arguments,
62 | QString workingDirectory = QString());
63 |
64 | static DoxygenPlugin* instance();
65 |
66 | private:
67 | static DoxygenPlugin* m_instance;
68 | DoxygenSettings* m_settings;
69 | QAction* m_doxygenCreateDocumentationAction;
70 | QAction* m_doxygenDocumentFileAction;
71 | QAction* m_doxygenDocumentOpenedProjectAction;
72 | QAction* m_doxygenDocumentActiveProjectAction;
73 | QAction* m_doxygenBuildDocumentationAction;
74 | QAction* m_doxygenDoxyfileWizardAction;
75 | QProcess* m_process;
76 |
77 | signals:
78 | void doxyDocumentEntity(const DoxygenSettingsStruct &DoxySettings, Core::IEditor *editor);
79 | void doxyDocumentFile(const DoxygenSettingsStruct &DoxySettings, Core::IEditor *editor);
80 | void doxyDocumentSpecificProject(const DoxygenSettingsStruct &DoxySettings);
81 | void doxyDocumentCurrentProject(const DoxygenSettingsStruct &DoxySettingss);
82 |
83 | private slots:
84 | void documentEntity();
85 | void documentFile();
86 | void documentSpecificProject();
87 | void documentCurrentProject();
88 |
89 | bool buildDocumentation();
90 | void doxyfileWizard();
91 | void externalString(const QString&);
92 |
93 | void processExited(int returnCode, QProcess::ExitStatus exitStatus);
94 | void readProcessOutput(void);
95 | };
96 |
97 | } // namespace Internal
98 | } // namespace Doxygen
99 |
100 | #endif // DOXYGENPLUGIN_H
101 |
102 |
--------------------------------------------------------------------------------
/doxygenfilesdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "doxygenfilesdialog.h"
2 | #include "ui_doxygenfilesdialog.h"
3 |
4 | DoxygenFilesDialog::DoxygenFilesDialog(QWidget* parent)
5 | : QDialog(parent)
6 | , ui(new Ui::DoxygenFilesDialog)
7 | {
8 | ui->setupUi(this);
9 |
10 | connect(ui->b_all, SIGNAL(clicked(bool)), this, SLOT(checkAll()));
11 | connect(ui->b_none, SIGNAL(clicked(bool)), this, SLOT(checkNone()));
12 | connect(ui->b_cancel, SIGNAL(clicked(bool)), this, SLOT(reject()));
13 | connect(ui->b_ok, SIGNAL(clicked(bool)), this, SLOT(accept()));
14 |
15 | connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(updateChecks(QTreeWidgetItem*, int)));
16 | }
17 |
18 | DoxygenFilesDialog::~DoxygenFilesDialog()
19 | {
20 | delete ui;
21 | }
22 |
23 | void DoxygenFilesDialog::initFileTree(ProjectExplorer::Node* rootNode)
24 | {
25 | createLeaf(rootNode, new QTreeWidgetItem(ui->treeWidget, QStringList(rootNode->displayName())));
26 | ui->treeWidget->expandAll();
27 | }
28 |
29 | void DoxygenFilesDialog::createLeaf(ProjectExplorer::Node* parentNode, QTreeWidgetItem* parentItem)
30 | {
31 | parentItem->setCheckState(0, Qt::Checked);
32 |
33 | if (parentNode->asFolderNode()) {
34 | ProjectExplorer::FolderNode* currentFolderNode = parentNode->asFolderNode();
35 |
36 | parentItem->setIcon(0, currentFolderNode->icon());
37 |
38 | foreach (ProjectExplorer::FileNode* fileNode, currentFolderNode->fileNodes()) {
39 | QString fileName = fileNode->filePath().toString();
40 |
41 | if ((QRegExp("\\.(h|hpp|c|cpp)$").indexIn(fileName)) != -1) {
42 | QTreeWidgetItem* child = new QTreeWidgetItem(parentItem, QStringList(fileName));
43 | child->setCheckState(0, Qt::Checked);
44 | parentItem->addChild(child);
45 | }
46 | }
47 |
48 | foreach (ProjectExplorer::FolderNode* folderNode, currentFolderNode->folderNodes()) {
49 | createLeaf(folderNode, new QTreeWidgetItem(parentItem, QStringList(folderNode->displayName())));
50 | }
51 | } else if (parentNode->asProjectNode()) {
52 | ProjectExplorer::ProjectNode* currentProjectNode = parentNode->asProjectNode();
53 |
54 | parentItem->setIcon(0, currentProjectNode->icon());
55 |
56 | foreach (ProjectExplorer::FileNode* fileNode, currentProjectNode->fileNodes()) {
57 | QString fileName = fileNode->filePath().toString();
58 |
59 | if ((QRegExp("\\.(h|hpp|c|cpp)$").indexIn(fileName)) != -1) {
60 | QTreeWidgetItem* child = new QTreeWidgetItem(parentItem, QStringList(fileName));
61 | child->setCheckState(0, Qt::Checked);
62 | parentItem->addChild(child);
63 | }
64 | }
65 |
66 | foreach (ProjectExplorer::FolderNode* folderNode, currentProjectNode->folderNodes()) {
67 | createLeaf(folderNode, new QTreeWidgetItem(parentItem, QStringList(folderNode->displayName())));
68 | }
69 |
70 | createLeaf(currentProjectNode, new QTreeWidgetItem(parentItem, QStringList(currentProjectNode->displayName())));
71 | }
72 |
73 | if (parentItem->childCount() == 0) {
74 | delete (parentItem);
75 | }
76 | }
77 |
78 | uint DoxygenFilesDialog::getFilesList(QTreeWidgetItem* parent, QStringList* out, int count)
79 | {
80 | if (!parent->childCount()) {
81 | if (parent->checkState(0) == Qt::Checked) {
82 | out->append(parent->text(0));
83 | count++;
84 | }
85 | } else {
86 | for (int i = 0; i < parent->childCount(); i++) {
87 | getFilesList(parent->child(i), out, count);
88 | }
89 | }
90 |
91 | return count;
92 | }
93 |
94 | uint DoxygenFilesDialog::getFilesList(QStringList* out)
95 | {
96 | uint count = 0;
97 | for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
98 | getFilesList(ui->treeWidget->topLevelItem(i), out, count);
99 | }
100 | return count;
101 | }
102 |
103 | void DoxygenFilesDialog::changeCheckState(QTreeWidgetItem* parent, Qt::CheckState state)
104 | {
105 | if (!parent->childCount()) {
106 | if (parent->checkState(0) != state) {
107 | parent->setCheckState(0, state);
108 | }
109 | } else {
110 | for (int i = 0; i < parent->childCount(); i++) {
111 | changeCheckState(parent->child(i), state);
112 | }
113 | }
114 | }
115 |
116 | void DoxygenFilesDialog::checkAll()
117 | {
118 | for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
119 | changeCheckState(ui->treeWidget->topLevelItem(i), Qt::Checked);
120 | }
121 | }
122 |
123 | void DoxygenFilesDialog::checkNone()
124 | {
125 | for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
126 | changeCheckState(ui->treeWidget->topLevelItem(i), Qt::Unchecked);
127 | }
128 | }
129 |
130 | void DoxygenFilesDialog::updateChecks(QTreeWidgetItem* item, int column)
131 | {
132 | bool diff = false;
133 |
134 | if (column != 0 && column != -1) {
135 | return;
136 | }
137 |
138 | if (item->childCount() != 0 && item->checkState(0) != Qt::PartiallyChecked && column != -1) {
139 | Qt::CheckState checkState = item->checkState(0);
140 | for (int i = 0; i < item->childCount(); ++i) {
141 | item->child(i)->setCheckState(0, checkState);
142 | }
143 | } else if (item->childCount() == 0 || column == -1) {
144 | if (item->parent() == nullptr) {
145 | return;
146 | }
147 | for (int j = 0; j < item->parent()->childCount(); ++j) {
148 | if (j != item->parent()->indexOfChild(item) && item->checkState(0) != item->parent()->child(j)->checkState(0)) {
149 | diff = true;
150 | }
151 | }
152 | if (diff) {
153 | item->parent()->setCheckState(0, Qt::PartiallyChecked);
154 | } else {
155 | item->parent()->setCheckState(0, item->checkState(0));
156 | }
157 | if (item->parent() != nullptr) {
158 | updateChecks(item->parent(), -1);
159 | }
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/doxygensettingswidget.cpp:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #include "doxygensettingswidget.h"
23 | #include "ui_doxygensettingswidget.h"
24 |
25 | DoxygenSettingsWidget::DoxygenSettingsWidget(QWidget* parent)
26 | : QWidget(parent)
27 | , ui(new Ui::DoxygenSettingsWidget)
28 | {
29 | ui->setupUi(this);
30 | ui->pathChooser_doxygen->setExpectedKind(Utils::PathChooser::Command);
31 | ui->pathChooser_doxygen->setPromptDialogTitle(tr("Doxygen Command"));
32 | ui->pathChooser_wizard->setExpectedKind(Utils::PathChooser::Command);
33 | ui->pathChooser_wizard->setPromptDialogTitle(tr("DoxyWizard Command"));
34 | // Why do I *have* to call processEvents() to get my QComboBox display the right value?!
35 | qApp->processEvents();
36 | connect(ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCustomWidgetPart(int)));
37 | }
38 |
39 | DoxygenSettingsWidget::~DoxygenSettingsWidget()
40 | {
41 | delete ui;
42 | }
43 |
44 | void DoxygenSettingsWidget::changeEvent(QEvent* e)
45 | {
46 | QWidget::changeEvent(e);
47 | switch (e->type()) {
48 | case QEvent::LanguageChange:
49 | ui->retranslateUi(this);
50 | break;
51 | default:
52 | break;
53 | }
54 | }
55 |
56 | DoxygenSettingsStruct DoxygenSettingsWidget::settings() const
57 | {
58 | DoxygenSettingsStruct rc;
59 | rc.doxygenCommand = ui->pathChooser_doxygen->path();
60 | rc.doxyfileFileName = ui->edit_doxyfileName->text();
61 | rc.doxywizardCommand = ui->pathChooser_wizard->path();
62 | rc.style = DoxygenStyle(ui->styleChooser->currentIndex());
63 | rc.fcomment = Files2Comment(ui->fcommentChooser->currentIndex());
64 | rc.printBrief = ui->printBriefTag->isChecked();
65 | rc.shortVarDoc = ui->shortVariableDoc->isChecked();
66 | rc.verbosePrinting = ui->verbosePrinting->isChecked();
67 | rc.customBegin = QString(ui->edit_beginTag->text()).replace("\\n", "\n");
68 | rc.customBrief = QString(ui->edit_briefTag->text()).replace("\\n", "\n");
69 | rc.customEmptyLine = QString(ui->edit_emptyLineTag->text()).replace("\\n", "\n");
70 | rc.customEnding = QString(ui->edit_endTag->text()).replace("\\n", "\n");
71 | rc.customNewLine = QString(ui->edit_newLine->text()).replace("\\n", "\n");
72 | rc.customShortDoc = QString(ui->edit_shortTag->text()).replace("\\n", "\n");
73 | rc.customShortDocEnd = QString(ui->edit_shortTagEnd->text()).replace("\\n", "\n");
74 | rc.fileComment = ui->fileCommentText->toPlainText();
75 | rc.fileCommentHeaders = ui->commentHeaderFiles->isChecked();
76 | rc.fileCommentImpl = ui->commentImplementationFiles->isChecked();
77 | rc.fileCommentsEnabled = ui->fileComments->isChecked();
78 | rc.automaticReturnType = ui->autoAddReturnTypes->isChecked();
79 | return rc;
80 | }
81 |
82 | void DoxygenSettingsWidget::setSettings(const DoxygenSettingsStruct& s)
83 | {
84 | ui->pathChooser_doxygen->setPath(s.doxygenCommand);
85 | ui->pathChooser_wizard->setPath(s.doxywizardCommand);
86 | ui->edit_doxyfileName->setText(s.doxyfileFileName);
87 | ui->styleChooser->setCurrentIndex(s.style);
88 | ui->fcommentChooser->setCurrentIndex(s.fcomment);
89 | ui->printBriefTag->setChecked(s.printBrief);
90 | ui->shortVariableDoc->setChecked(s.shortVarDoc);
91 | ui->verbosePrinting->setChecked(s.verbosePrinting);
92 | ui->edit_beginTag->setText(QString(s.customBegin).replace("\n", "\\n"));
93 | ui->edit_briefTag->setText(QString(s.customBrief).replace("\n", "\\n"));
94 | ui->edit_emptyLineTag->setText(QString(s.customEmptyLine).replace("\n", "\\n"));
95 | ui->edit_endTag->setText(QString(s.customEnding).replace("\n", "\\n"));
96 | ui->edit_newLine->setText(QString(s.customNewLine).replace("\n", "\\n"));
97 | ui->edit_shortTag->setText(QString(s.customShortDoc).replace("\n", "\\n"));
98 | ui->edit_shortTagEnd->setText(QString(s.customShortDocEnd).replace("\n", "\\n"));
99 | ui->fileCommentText->setPlainText(s.fileComment);
100 | ui->fileComments->setChecked(s.fileCommentsEnabled);
101 | ui->commentHeaderFiles->setChecked(s.fileCommentHeaders);
102 | ui->commentImplementationFiles->setChecked(s.fileCommentImpl);
103 | ui->autoAddReturnTypes->setChecked(s.automaticReturnType);
104 |
105 | updateCustomWidgetPart(s.style);
106 | on_fileComments_clicked(s.fileCommentsEnabled);
107 | }
108 |
109 | void DoxygenSettingsWidget::updateCustomWidgetPart(int index)
110 | {
111 | ui->customCommentsSettings->setEnabled(index == customDoc);
112 | }
113 |
114 | void DoxygenSettingsWidget::on_fileComments_clicked(bool checked)
115 | {
116 | Files2Comment toComment = Files2Comment(ui->fcommentChooser->currentIndex());
117 | ui->fileCommentText->setEnabled(checked);
118 | if (checked == false || toComment == all) {
119 | checked = false;
120 | ui->label_filecommentHeaders->setVisible(checked);
121 | ui->label_filecommentImpl->setVisible(checked);
122 | ui->commentHeaderFiles->setVisible(checked);
123 | ui->commentImplementationFiles->setVisible(checked);
124 | } else if (toComment == headers) {
125 | ui->label_filecommentHeaders->setVisible(false);
126 | ui->label_filecommentImpl->setVisible(true);
127 |
128 | ui->commentHeaderFiles->setVisible(false);
129 | ui->commentImplementationFiles->setVisible(true);
130 | } else if (toComment == implementations) {
131 | ui->label_filecommentHeaders->setVisible(true);
132 | ui->label_filecommentImpl->setVisible(false);
133 | ui->commentHeaderFiles->setVisible(true);
134 | ui->commentImplementationFiles->setVisible(false);
135 | }
136 | }
137 |
138 | void DoxygenSettingsWidget::on_fcommentChooser_currentIndexChanged(int index)
139 | {
140 | Q_UNUSED(index)
141 | on_fileComments_clicked(ui->fileComments->isChecked());
142 | }
143 |
--------------------------------------------------------------------------------
/.github/workflows/build_qmake.yml:
--------------------------------------------------------------------------------
1 | name: QMake Build Matrix
2 |
3 | on: [push]
4 |
5 | env:
6 | QT_VERSION: 5.15.1
7 | QT_CREATOR_VERSION: 4.13.0
8 | PLUGIN_PRO: doxygen.pro
9 | PLUGIN_NAME: Doxygen
10 |
11 | jobs:
12 | build:
13 | name: ${{ matrix.config.name }}
14 | runs-on: ${{ matrix.config.os }}
15 | strategy:
16 | matrix:
17 | config:
18 | - {
19 | name: "Windows Latest x64", artifact: "Windows-x64.zip",
20 | msvc: win64_msvc2017_64,
21 | os: windows-latest,
22 | environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
23 | }
24 | - {
25 | name: "Windows Latest x86", artifact: "Windows-x86.zip",
26 | msvc: win32_msvc2017,
27 | os: windows-latest,
28 | environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
29 | }
30 | - {
31 | name: "Linux Latest x64", artifact: "Linux-x64.zip",
32 | os: ubuntu-latest
33 | }
34 | - {
35 | name: "macOS Latest x64", artifact: "macOS-x64.zip",
36 | os: macos-latest
37 | }
38 |
39 | steps:
40 | - uses: actions/checkout@v1
41 |
42 | - name: Installing system libs
43 | shell: cmake -P {0}
44 | run: |
45 | if ("${{ runner.os }}" STREQUAL "Linux")
46 | execute_process(
47 | COMMAND sudo apt install libgl1-mesa-dev
48 | )
49 | endif()
50 |
51 | - name: Download Qt
52 | id: qt
53 | uses: fpoussin/install-qt-action@v2
54 | with:
55 | aqtversion: master
56 | version: "${{ env.QT_VERSION }}"
57 | modules: qtdeclarative qttools qtsvg
58 | tools:
59 | - name: qtcreator
60 | version: "${{ env.QT_CREATOR_VERSION }}"
61 | - name: qtcreatordev
62 | version: "${{ env.QT_CREATOR_VERSION }}"
63 | arch: "${{ matrix.config.msvc }}"
64 |
65 | - name: Configure
66 | shell: cmake -P {0}
67 | run: |
68 | if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
69 | execute_process(
70 | COMMAND "${{ matrix.config.environment_script }}" && set
71 | OUTPUT_FILE environment_script_output.txt
72 | )
73 | file(STRINGS environment_script_output.txt output_lines)
74 | foreach(line IN LISTS output_lines)
75 | if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
76 | set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
77 |
78 | # Set for other steps
79 | message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}")
80 | endif()
81 | endforeach()
82 | endif()
83 |
84 | file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir)
85 |
86 | execute_process(
87 | COMMAND qmake
88 | $ENV{PLUGIN_PRO}
89 | CONFIG+=release
90 | QTC_SOURCE="${qtcreator_dir}"
91 | QTC_BUILD="${qtcreator_dir}"
92 | RESULT_VARIABLE result
93 | )
94 | if (NOT result EQUAL 0)
95 | message(FATAL_ERROR "Bad exit status")
96 | endif()
97 |
98 | - name: Build
99 | shell: cmake -P {0}
100 | run: |
101 | if (NOT "${{ runner.os }}" STREQUAL "Windows")
102 | set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}")
103 | endif()
104 |
105 | include(ProcessorCount)
106 | ProcessorCount(N)
107 |
108 | set(make_program make -j ${N})
109 | if ("${{ runner.os }}" STREQUAL "Windows")
110 | set(make_program "qtcreator/bin/jom")
111 | endif()
112 |
113 | execute_process(
114 | COMMAND ${make_program}
115 | RESULT_VARIABLE result
116 | )
117 | if (NOT result EQUAL 0)
118 | message(FATAL_ERROR "Bad exit status")
119 | endif()
120 |
121 | file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact)
122 |
123 | execute_process(COMMAND
124 | ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}"
125 | WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}"
126 | )
127 |
128 | - uses: actions/upload-artifact@v1
129 | id: upload_artifact
130 | with:
131 | path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
132 | name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
133 |
134 | release:
135 | if: contains(github.ref, 'tags/v')
136 | runs-on: ubuntu-latest
137 | needs: build
138 |
139 | steps:
140 | - name: Create Release
141 | id: create_release
142 | uses: actions/create-release@v1.0.0
143 | env:
144 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145 | with:
146 | tag_name: ${{ github.ref }}
147 | release_name: Release ${{ github.ref }}
148 | draft: false
149 | prerelease: false
150 |
151 | - name: Store Release url
152 | run: |
153 | echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
154 |
155 | - uses: actions/upload-artifact@v1
156 | with:
157 | path: ./upload_url
158 | name: upload_url
159 |
160 | publish:
161 | if: contains(github.ref, 'tags/v')
162 |
163 | name: ${{ matrix.config.name }}
164 | runs-on: ${{ matrix.config.os }}
165 | strategy:
166 | matrix:
167 | config:
168 | - {
169 | name: "Windows Latest x64", artifact: "Windows-x64.zip",
170 | os: ubuntu-latest
171 | }
172 | - {
173 | name: "Windows Latest x86", artifact: "Windows-x86.zip",
174 | os: ubuntu-latest
175 | }
176 | - {
177 | name: "Linux Latest x64", artifact: "Linux-x64.zip",
178 | os: ubuntu-latest
179 | }
180 | - {
181 | name: "macOS Latest x64", artifact: "macOS-x64.zip",
182 | os: macos-latest
183 | }
184 | needs: release
185 |
186 | steps:
187 | - name: Download artifact
188 | uses: actions/download-artifact@v1
189 | with:
190 | name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
191 | path: ./
192 |
193 | - name: Download URL
194 | uses: actions/download-artifact@v1
195 | with:
196 | name: upload_url
197 | path: ./
198 | - id: set_upload_url
199 | run: |
200 | upload_url=`cat ./upload_url`
201 | echo ::set-output name=upload_url::$upload_url
202 |
203 | - name: Upload to Release
204 | id: upload_to_release
205 | uses: actions/upload-release-asset@v1.0.1
206 | env:
207 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208 | with:
209 | upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
210 | asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
211 | asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
212 | asset_content_type: application/zip
213 |
--------------------------------------------------------------------------------
/doxygensettingsstruct.cpp:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #include "doxygensettingsstruct.h"
23 | #include
24 | #include
25 | using namespace DoxyPlugin;
26 | using namespace DoxyPlugin::Internal;
27 |
28 | static const char* groupC = "Doxygen";
29 | static const char* commandKeyC = "Command";
30 | static const char* doxyfilePathKeyC = "DoxyConfigFile";
31 | static const char* wizardcommandKeyC = "Wizard";
32 | static const char* styleKeyC = "Style";
33 | static const char* fcommentKeyC = "Files2Comment";
34 | static const char* printBriefKeyC = "PrintBrief";
35 | static const char* printShortVarDocKeyC = "PrintShortVarDoc";
36 | static const char* verbosePrintingKeyC = "VerbosePrinting";
37 | static const char* automaticAddReturnType = "AutomaticAddReturnType";
38 | static const char* customBeginKeyC = "CustomBegin";
39 | static const char* customBriefKeyC = "CustomBrief";
40 | static const char* customEmptyLineKeyC = "CustomEmptyLine";
41 | static const char* customNewLineKeyC = "CustomNewLine";
42 | static const char* customEndingKeyC = "CustomEnding";
43 | static const char* customShortDocKeyC = "CustomShortDoc";
44 | static const char* customShortDocEndKeyC = "CustomShortDocEnd";
45 | static const char* fileCommentEnabledKeyC = "FileComments";
46 | static const char* fileCommentHeadersKeyC = "FileCommentHeaders";
47 | static const char* fileCommentImplKeyC = "FileCommentImplementations";
48 | static const char* fileCommentKeyC = "FileComment";
49 |
50 | static QString defaultCommand()
51 | {
52 | QString rc = QLatin1String("doxygen");
53 | #if defined(Q_OS_WIN32)
54 | rc.append(QLatin1String(".exe"));
55 | #endif
56 | return rc;
57 | }
58 |
59 | static QString defaultWizardCommand()
60 | {
61 | QString rc = QLatin1String("doxywizard");
62 | #if defined(Q_OS_WIN32)
63 | rc.append(QLatin1String(".exe"));
64 | #endif
65 | return rc;
66 | }
67 |
68 | static QString defaultDoxyFile()
69 | {
70 | return QLatin1String("Doxyfile");
71 | }
72 |
73 | DoxygenSettingsStruct::DoxygenSettingsStruct()
74 | : doxyfileFileName(defaultDoxyFile())
75 | , doxygenCommand(defaultCommand())
76 | , doxywizardCommand(defaultWizardCommand())
77 | , style(qtDoc)
78 | , fcomment(headers)
79 | , printBrief(true)
80 | , shortVarDoc(true)
81 | , verbosePrinting(false)
82 | , automaticReturnType(true)
83 | {
84 | qRegisterMetaType("DoxygenSettingsStruct");
85 | }
86 |
87 | void DoxygenSettingsStruct::fromSettings(QSettings* settings)
88 | {
89 | settings->beginGroup(QLatin1String(groupC));
90 | doxygenCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
91 | doxyfileFileName = settings->value(QLatin1String(doxyfilePathKeyC), defaultDoxyFile()).toString();
92 | doxywizardCommand = settings->value(QLatin1String(wizardcommandKeyC), defaultWizardCommand()).toString();
93 | style = DoxygenStyle(settings->value(QLatin1String(styleKeyC), 0).toInt());
94 | fcomment = Files2Comment(settings->value(QLatin1String(fcommentKeyC), 0).toInt());
95 | printBrief = settings->value(QLatin1String(printBriefKeyC), 1).toBool();
96 | shortVarDoc = settings->value(QLatin1String(printShortVarDocKeyC), 1).toBool();
97 | verbosePrinting = settings->value(QLatin1String(verbosePrintingKeyC), 0).toBool();
98 | automaticReturnType = settings->value(QLatin1String(automaticAddReturnType), true).toBool();
99 | customBegin = settings->value(QLatin1String(customBeginKeyC), "").toString();
100 | customBrief = settings->value(QLatin1String(customBriefKeyC), "").toString();
101 | customEmptyLine = settings->value(QLatin1String(customEmptyLineKeyC), "").toString();
102 | customNewLine = settings->value(QLatin1String(customNewLineKeyC), "").toString();
103 | customEnding = settings->value(QLatin1String(customEndingKeyC), "").toString();
104 | customShortDoc = settings->value(QLatin1String(customShortDocKeyC), "").toString();
105 | customShortDocEnd = settings->value(QLatin1String(customShortDocEndKeyC), "").toString();
106 | fileCommentsEnabled = settings->value(QLatin1String(fileCommentEnabledKeyC), false).toBool();
107 | fileCommentHeaders = settings->value(QLatin1String(fileCommentHeadersKeyC), false).toBool();
108 | fileCommentImpl = settings->value(QLatin1String(fileCommentImplKeyC), false).toBool();
109 | fileComment = settings->value(QLatin1String(fileCommentKeyC), "").toString();
110 |
111 | settings->endGroup();
112 |
113 | // Support java, qt and custom styles
114 | setDoxygenCommentStyle(style);
115 | }
116 |
117 | void DoxygenSettingsStruct::toSettings(QSettings* settings)
118 | {
119 | settings->beginGroup(QLatin1String(groupC));
120 | settings->setValue(QLatin1String(commandKeyC), doxygenCommand);
121 | settings->setValue(QLatin1String(doxyfilePathKeyC), doxyfileFileName);
122 | settings->setValue(QLatin1String(wizardcommandKeyC), doxywizardCommand);
123 | settings->setValue(QLatin1String(styleKeyC), style);
124 | settings->setValue(QLatin1String(fcommentKeyC), fcomment);
125 | settings->setValue(QLatin1String(printBriefKeyC), printBrief);
126 | settings->setValue(QLatin1String(printShortVarDocKeyC), shortVarDoc);
127 | settings->setValue(QLatin1String(verbosePrintingKeyC), verbosePrinting);
128 | settings->setValue(QLatin1String(automaticAddReturnType), automaticReturnType);
129 | settings->setValue(QLatin1String(customBeginKeyC), customBegin);
130 | settings->setValue(QLatin1String(customBriefKeyC), customBrief);
131 | settings->setValue(QLatin1String(customEmptyLineKeyC), customEmptyLine);
132 | settings->setValue(QLatin1String(customNewLineKeyC), customNewLine);
133 | settings->setValue(QLatin1String(customEndingKeyC), customEnding);
134 | settings->setValue(QLatin1String(customShortDocKeyC), customShortDoc);
135 | settings->setValue(QLatin1String(customShortDocEndKeyC), customShortDocEnd);
136 | settings->setValue(QLatin1String(fileCommentEnabledKeyC), fileCommentsEnabled);
137 | settings->setValue(QLatin1String(fileCommentHeadersKeyC), fileCommentHeaders);
138 | settings->setValue(QLatin1String(fileCommentImplKeyC), fileCommentImpl);
139 | settings->setValue(QLatin1String(fileCommentKeyC), fileComment);
140 | settings->endGroup();
141 |
142 | // Support java, qt and custom styles
143 | setDoxygenCommentStyle(style);
144 | }
145 |
146 | bool DoxygenSettingsStruct::equals(const DoxygenSettingsStruct& s) const
147 | {
148 |
149 | return doxygenCommand == s.doxygenCommand
150 | && doxywizardCommand == s.doxywizardCommand
151 | && doxyfileFileName == s.doxyfileFileName
152 | && style == s.style
153 | && fcomment == s.fcomment
154 | && printBrief == s.printBrief
155 | && shortVarDoc == s.shortVarDoc
156 | && verbosePrinting == s.verbosePrinting
157 | && automaticReturnType == s.automaticReturnType
158 | && customBegin == s.customBegin
159 | && customBrief == s.customBrief
160 | && customEmptyLine == s.customEmptyLine
161 | && customNewLine == s.customNewLine
162 | && customEnding == s.customEnding
163 | && customShortDoc == s.customShortDoc
164 | && customShortDocEnd == s.customShortDocEnd
165 | && fileComment == s.fileComment
166 | && fileCommentHeaders == s.fileCommentHeaders
167 | && fileCommentImpl == s.fileCommentImpl
168 | && fileCommentsEnabled == s.fileCommentsEnabled;
169 | }
170 |
171 | QStringList DoxygenSettingsStruct::addOptions(const QStringList& args) const
172 | {
173 | // TODO, look at possible doxygen args in the manual and act here...
174 | return args;
175 | }
176 |
177 | QString DoxygenSettingsStruct::formatArguments(const QStringList& args)
178 | {
179 | // TODO find out if it can really be useful or get rid of it
180 | QString rc;
181 | QTextStream str(&rc);
182 | const int size = args.size();
183 | for (int i = 0; i < size; i++) {
184 | const QString& arg = args.at(i);
185 | if (i)
186 | str << ' ';
187 | str << arg;
188 | }
189 |
190 | return rc;
191 | }
192 |
193 | void DoxygenSettingsStruct::setDoxygenCommentStyle(DoxygenStyle s)
194 | {
195 | switch (s) {
196 | case javaDoc: {
197 | DoxyComment.doxBegin = "/**\n";
198 | DoxyComment.doxBrief = " * @brief \n";
199 | DoxyComment.doxEmptyLine = " *\n";
200 | DoxyComment.doxNewLine = " * @";
201 | DoxyComment.doxEnding = " */\n";
202 | DoxyComment.doxShortVarDoc = " /**< ";
203 | DoxyComment.doxShortVarDocEnd = " */";
204 | break;
205 | }
206 | case customDoc: {
207 | DoxyComment.doxBegin = customBegin;
208 | DoxyComment.doxBrief = customBrief;
209 | DoxyComment.doxEmptyLine = customEmptyLine;
210 | DoxyComment.doxNewLine = customNewLine;
211 | DoxyComment.doxEnding = customEnding;
212 | DoxyComment.doxShortVarDoc = customShortDoc;
213 | DoxyComment.doxShortVarDocEnd = customShortDocEnd;
214 | break;
215 | }
216 | default: //case qtDoc:
217 | {
218 | DoxyComment.doxBegin = "/*!\n";
219 | DoxyComment.doxBrief = " \\brief \n";
220 | DoxyComment.doxEmptyLine = "\n";
221 | DoxyComment.doxNewLine = " \\";
222 | DoxyComment.doxEnding = "*/\n";
223 | DoxyComment.doxShortVarDoc = " /*!< ";
224 | DoxyComment.doxShortVarDocEnd = " */";
225 | break;
226 | }
227 | }
228 | }
229 |
--------------------------------------------------------------------------------
/doxygenplugin.cpp:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #include "doxygenplugin.h"
23 | #include "doxygen.h"
24 | #include "doxygenconstants.h"
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 |
42 | #include
43 | #include
44 | #include
45 | #include
46 |
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #include
54 | #include
55 | #include
56 |
57 | #include
58 |
59 | using namespace ExtensionSystem;
60 | using namespace DoxyPlugin;
61 | using namespace DoxyPlugin::Internal;
62 |
63 | // Timeout for building documentation
64 | enum { doxygenTimeOut = 120 };
65 |
66 | static const char CMD_ID_DOXYGEN_MAINVIEW[] = "Doxygen.MainView";
67 | static const char CMD_ID_DOXYGEN_MENU[] = "Doxygen.Menu";
68 | static const char CMD_ID_CREATEDOCUMENTATION[] = "Doxygen.CreateDocumentation";
69 | static const char CMD_ID_DOCUMENTFILE[] = "Doxygen.DocumentFile";
70 | static const char CMD_ID_DOCUMENTOPENEDPROJECT[] = "Doxygen.DocumentOpenedProject";
71 | static const char CMD_ID_DOCUMENTACTIVEPROJECT[] = "Doxygen.DocumentActiveProject";
72 | static const char CMD_ID_BUILDDOCUMENTATION[] = "Doxygen.BuildDocumentation";
73 | static const char CMD_ID_DOXYFILEWIZARD[] = "Doxygen.RunWizard";
74 |
75 | DoxygenPlugin* DoxygenPlugin::m_instance = nullptr;
76 |
77 | DoxygenPlugin::DoxygenPlugin()
78 | {
79 | m_instance = this;
80 | }
81 |
82 | DoxygenPlugin::~DoxygenPlugin()
83 | {
84 | // Unregister objects from the plugin manager's object pool
85 | // Delete members
86 | m_instance = nullptr;
87 | m_settings->deleteLater();
88 | }
89 |
90 | bool DoxygenPlugin::initialize(const QStringList& arguments, QString* errorString)
91 | {
92 | // Register objects in the plugin manager's object pool
93 | // Load settings
94 | // Add actions to menus
95 | // Connect to other plugins' signals
96 | // In the initialize function, a plugin can be sure that the plugins it
97 | // depends on have initialized their members.
98 |
99 | using namespace Constants;
100 | using namespace Core::Constants;
101 | using namespace ExtensionSystem;
102 |
103 | Q_UNUSED(arguments);
104 | Q_UNUSED(errorString);
105 |
106 | // settings dialog :)
107 | m_settings = new DoxygenSettings;
108 | //addAutoReleasedObject(m_settings);
109 |
110 | Core::ActionManager* am = Core::ActionManager::instance();
111 | Core::Context globalcontext(C_GLOBAL);
112 | //Core::Context context(CMD_ID_DOXYGEN_MAINVIEW);
113 | Core::ActionContainer* toolsContainer = am->actionContainer(Core::Constants::M_TOOLS);
114 | Core::ActionContainer* doxygenMenu = am->createMenu(Utils::Id(CMD_ID_DOXYGEN_MENU));
115 | doxygenMenu->menu()->setTitle(tr("&Doxygen"));
116 | toolsContainer->addMenu(doxygenMenu);
117 |
118 | // put action in our own menu in "Tools"
119 | // create documentation for symbol under cursor
120 | Core::Command* command;
121 | m_doxygenCreateDocumentationAction = new QAction(tr("Document current entity"), this);
122 | command = am->registerAction(m_doxygenCreateDocumentationAction, CMD_ID_CREATEDOCUMENTATION, globalcontext);
123 | command->setAttribute(Core::Command::CA_UpdateText);
124 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F9")));
125 | connect(m_doxygenCreateDocumentationAction, SIGNAL(triggered(bool)), this, SLOT(documentEntity()));
126 | doxygenMenu->addAction(command);
127 | // Don't forget the contextual menu
128 | Core::ActionContainer* contextMenu = am->createMenu(CppEditor::Constants::M_CONTEXT);
129 | contextMenu->addAction(command);
130 |
131 | // create documentation for a whole file
132 | m_doxygenDocumentFileAction = new QAction(tr("Document current file"), this);
133 | command = am->registerAction(m_doxygenDocumentFileAction, CMD_ID_DOCUMENTFILE, globalcontext);
134 | command->setAttribute(Core::Command::CA_UpdateText);
135 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F5")));
136 | connect(m_doxygenDocumentFileAction, SIGNAL(triggered(bool)), this, SLOT(documentFile()));
137 | doxygenMenu->addAction(command);
138 | /*
139 | // create documentation for a whole project of the currently opened file
140 | m_doxygenDocumentOpenedProjectAction = new QAction(tr("Document whole project of opened file"), this);
141 | command = am->registerAction(m_doxygenDocumentOpenedProjectAction,
142 | CMD_ID_DOCUMENTOPENEDPROJECT, globalcontext);
143 | command->setAttribute(Core::Command::CA_UpdateText);
144 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F7")));
145 | connect(m_doxygenDocumentOpenedProjectAction, SIGNAL(triggered(bool)),
146 | this, SLOT(documentOpenedProject()));
147 | doxygenMenu->addAction(command);
148 | */
149 | // create documentation for a whole project
150 | m_doxygenDocumentActiveProjectAction = new QAction(tr("Document current project"), this);
151 | command = am->registerAction(m_doxygenDocumentActiveProjectAction,
152 | CMD_ID_DOCUMENTACTIVEPROJECT, globalcontext);
153 | command->setAttribute(Core::Command::CA_UpdateText);
154 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F8")));
155 | connect(m_doxygenDocumentActiveProjectAction, SIGNAL(triggered(bool)),
156 | this, SLOT(documentCurrentProject()));
157 | doxygenMenu->addAction(command);
158 |
159 | // "compile" documentation action
160 | m_doxygenBuildDocumentationAction = new QAction(tr("Build Doxygen Documentation"), this);
161 | command = am->registerAction(m_doxygenBuildDocumentationAction, CMD_ID_BUILDDOCUMENTATION, globalcontext);
162 | command->setAttribute(Core::Command::CA_UpdateText);
163 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F4")));
164 | connect(m_doxygenBuildDocumentationAction, SIGNAL(triggered(bool)), this, SLOT(buildDocumentation()));
165 | doxygenMenu->addAction(command);
166 |
167 | // edit Doxyfile action
168 | m_doxygenDoxyfileWizardAction = new QAction(tr("Edit Doxyfile"), this);
169 | command = am->registerAction(m_doxygenDoxyfileWizardAction, CMD_ID_DOXYFILEWIZARD, globalcontext);
170 | command->setAttribute(Core::Command::CA_UpdateText);
171 | command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F6")));
172 | connect(m_doxygenDoxyfileWizardAction, SIGNAL(triggered(bool)), this, SLOT(doxyfileWizard()));
173 | doxygenMenu->addAction(command);
174 |
175 | // Internal connections
176 | Doxygen* dox = Doxygen::instance();
177 |
178 | connect(dox, SIGNAL(message(QString)), this, SLOT(externalString(QString)));
179 |
180 | connect(this, SIGNAL(doxyDocumentEntity(DoxygenSettingsStruct, Core::IEditor*)),
181 | dox, SLOT(documentEntity(DoxygenSettingsStruct, Core::IEditor*)));
182 | connect(this, SIGNAL(doxyDocumentFile(DoxygenSettingsStruct, Core::IEditor*)),
183 | dox, SLOT(documentFile(DoxygenSettingsStruct, Core::IEditor*)));
184 | connect(this, SIGNAL(doxyDocumentCurrentProject(DoxygenSettingsStruct)),
185 | dox, SLOT(documentCurrentProject(DoxygenSettingsStruct)));
186 |
187 | // Process connection for Doxygen
188 | m_process = new QProcess();
189 | connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
190 | this, SLOT(processExited(int, QProcess::ExitStatus)));
191 | connect(m_process, SIGNAL(readyRead()),
192 | this, SLOT(readProcessOutput()));
193 |
194 | return true;
195 | }
196 |
197 | void DoxygenPlugin::extensionsInitialized()
198 | {
199 | // Retrieve objects from the plugin manager's object pool
200 | // In the extensionsInitialized function, a plugin can be sure that all
201 | // plugins that depend on it are completely initialized.
202 | }
203 |
204 | ExtensionSystem::IPlugin::ShutdownFlag DoxygenPlugin::aboutToShutdown()
205 | {
206 | // Save settings
207 | // Disconnect from signals that are not needed during shutdown
208 | // Hide UI (if you add UI that is not in the main window directly)
209 | return SynchronousShutdown;
210 | }
211 |
212 | void DoxygenPlugin::documentEntity()
213 | {
214 | Core::IEditor* editor = Core::EditorManager::instance()->currentEditor();
215 | emit doxyDocumentEntity(settings(), editor);
216 | }
217 |
218 | void DoxygenPlugin::documentFile()
219 | {
220 | if (QMessageBox::question((QWidget*)this->parent(),
221 | "Doxygen", "Document current File?",
222 | QMessageBox::Yes, QMessageBox::No)
223 | == QMessageBox::Yes) {
224 | Core::IEditor* editor = Core::EditorManager::instance()->currentEditor();
225 | emit doxyDocumentFile(settings(), editor);
226 | }
227 | }
228 |
229 | void DoxygenPlugin::documentSpecificProject()
230 | {
231 | Doxygen::instance()->documentSpecificProject(settings());
232 | }
233 |
234 | void DoxygenPlugin::documentCurrentProject()
235 | {
236 | emit doxyDocumentCurrentProject(settings());
237 | }
238 |
239 | bool DoxygenPlugin::buildDocumentation() // TODO: refactor
240 | {
241 | // TODO, allow configuration of the command
242 | // the default here will just run doxygen at the project root
243 |
244 | ProjectExplorer::Project* p = ProjectExplorer::ProjectTree::currentProject();
245 | if (!p) {
246 | QMessageBox::warning((QWidget*)parent(),
247 | tr("Doxygen"),
248 | tr("You don't have any current project."),
249 | QMessageBox::Close, QMessageBox::NoButton);
250 | return false;
251 | }
252 |
253 | QString projectRoot = Doxygen::getProjectRoot();
254 | if (!projectRoot.size())
255 | return false;
256 |
257 | QString doxyFile = projectRoot;
258 | doxyFile += settings().doxyfileFileName;
259 | QStringList args;
260 |
261 | // create default Doxyfile if it doesn't exist
262 | QFileInfo doxyFileInfo(doxyFile);
263 |
264 | if (!doxyFileInfo.exists()) {
265 | args << "-g" << doxyFile;
266 | runDoxygen(args, projectRoot);
267 | return true;
268 | }
269 | args << doxyFile;
270 | runDoxygen(args, projectRoot);
271 | return false;
272 | }
273 |
274 | void DoxygenPlugin::doxyfileWizard() // TODO: refactor
275 | {
276 | // prevent a crash if user launches this command with no project opened
277 | // You don't need to have an editor open for that.
278 | ProjectExplorer::Project* p = ProjectExplorer::ProjectTree::currentProject();
279 | if (!p) {
280 | QMessageBox::warning((QWidget*)parent(),
281 | tr("Doxygen"),
282 | tr("You don't have any current project."),
283 | QMessageBox::Close, QMessageBox::NoButton);
284 | return;
285 | }
286 |
287 | QString projectRoot = p->projectDirectory().toString();
288 | QString executable = settings().doxywizardCommand;
289 | QStringList arglist(settings().doxyfileFileName);
290 |
291 | bool ret = QProcess::startDetached(settings().doxywizardCommand, arglist, projectRoot);
292 |
293 | if (!ret) {
294 | const QString outputText = tr("Failed to launch %1\n").arg(executable);
295 | externalString(outputText);
296 | }
297 | }
298 |
299 | void DoxygenPlugin::runDoxygen(const QStringList& arguments, QString workingDirectory)
300 | {
301 | const QString executable = settings().doxygenCommand;
302 | if (executable.isEmpty()) {
303 | externalString(tr("No doxygen executable specified"));
304 | return;
305 | }
306 | const QStringList allArgs = settings().addOptions(arguments);
307 | const QString outputText = tr("Executing: %1 %2\n").arg(executable).arg(DoxygenSettingsStruct::formatArguments(allArgs));
308 | externalString(outputText);
309 |
310 | m_process->close();
311 | m_process->waitForFinished();
312 |
313 | m_process->setWorkingDirectory(workingDirectory);
314 |
315 | m_process->start(executable, allArgs);
316 | if (!m_process->waitForStarted(5000))
317 | qDebug("Could not start %s within 5 seconds", executable.toStdString().c_str());
318 |
319 | return;
320 | }
321 |
322 | void DoxygenPlugin::externalString(const QString& text)
323 | {
324 | Core::MessageManager::write(text);
325 | Core::MessageManager::showOutputPane();
326 | }
327 |
328 | void DoxygenPlugin::processExited(int returnCode, QProcess::ExitStatus exitStatus)
329 | {
330 | DoxygenResponse response;
331 | response.error = true;
332 | response.stdErr = QLatin1String(m_process->readAllStandardError());
333 | response.stdOut = QLatin1String(m_process->readAllStandardOutput());
334 | switch (exitStatus) {
335 | case QProcess::NormalExit:
336 | response.error = false;
337 | break;
338 | case QProcess::CrashExit:
339 | response.message = tr("The process terminated with exit code %1.").arg(returnCode);
340 | break;
341 | }
342 | if (response.error)
343 | externalString(response.message);
344 | else
345 | externalString(tr("Doxygen ran successfully"));
346 | }
347 |
348 | void DoxygenPlugin::readProcessOutput()
349 | {
350 | externalString(QLatin1String(m_process->readAll()));
351 | }
352 |
353 | DoxygenSettingsStruct DoxygenPlugin::settings() const
354 | {
355 | return m_settings->settings();
356 | }
357 |
358 | DoxygenPlugin* DoxygenPlugin::instance()
359 | {
360 | return m_instance;
361 | }
362 |
--------------------------------------------------------------------------------
/doxygensettingswidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DoxygenSettingsWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 700
10 | 450
11 |
12 |
13 |
14 |
15 | 255
16 | 255
17 |
18 |
19 |
20 |
21 | 650
22 | 450
23 |
24 |
25 |
26 |
27 | 750
28 | 550
29 |
30 |
31 |
32 | Doxygen Settings
33 |
34 |
35 |
36 | QLayout::SetDefaultConstraint
37 |
38 | -
39 |
40 |
41 |
42 | 0
43 | 0
44 |
45 |
46 |
47 | Doxygen Configuration
48 |
49 |
50 | false
51 |
52 |
53 |
54 | QFormLayout::ExpandingFieldsGrow
55 |
56 |
-
57 |
58 |
59 | Doxyfile filename (should be at project root):
60 |
61 |
62 |
63 | -
64 |
65 |
66 |
67 | 10
68 | 20
69 |
70 |
71 |
72 |
73 | -
74 |
75 |
76 | Doxygen command:
77 |
78 |
79 |
80 | -
81 |
82 |
83 | true
84 |
85 |
86 |
87 | 10
88 | 20
89 |
90 |
91 |
92 |
93 | -
94 |
95 |
96 | DoxyWizard comand:
97 |
98 |
99 |
100 | -
101 |
102 |
103 |
104 | 10
105 | 20
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | -
114 |
115 |
116 |
117 | 0
118 | 0
119 |
120 |
121 |
122 | Comments Settings
123 |
124 |
125 |
-
126 |
127 |
128 | QFormLayout::AllNonFixedFieldsGrow
129 |
130 |
-
131 |
132 |
133 | Comments style:
134 |
135 |
136 |
137 | -
138 |
139 |
140 | QComboBox::AdjustToContentsOnFirstShow
141 |
142 |
-
143 |
144 | JavaDoc
145 |
146 |
147 | -
148 |
149 | Qt
150 |
151 |
152 | -
153 |
154 | Custom
155 |
156 |
157 |
158 |
159 | -
160 |
161 |
162 | Files to comment:
163 |
164 |
165 |
166 | -
167 |
168 |
-
169 |
170 | Headers
171 |
172 |
173 | -
174 |
175 | Implementations
176 |
177 |
178 | -
179 |
180 | All
181 |
182 |
183 |
184 |
185 | -
186 |
187 |
188 | Print brief tag
189 |
190 |
191 |
192 | -
193 |
194 |
195 |
196 |
197 |
198 |
199 | -
200 |
201 |
202 | Short Variable documentation:
203 |
204 |
205 |
206 | -
207 |
208 |
209 |
210 |
211 |
212 |
213 | -
214 |
215 |
216 | Verbose (fn, var, class file...):
217 |
218 |
219 |
220 | -
221 |
222 |
223 |
224 |
225 |
226 |
227 | -
228 |
229 |
230 | Comment files
231 |
232 |
233 |
234 | -
235 |
236 |
237 |
238 |
239 |
240 |
241 | -
242 |
243 |
244 | Comment headers
245 |
246 |
247 |
248 | -
249 |
250 |
251 |
252 |
253 |
254 |
255 | -
256 |
257 |
258 | Comment implementation
259 |
260 |
261 |
262 | -
263 |
264 |
265 |
266 |
267 |
268 |
269 | -
270 |
271 |
272 | Automatically add return type:
273 |
274 |
275 |
276 | -
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 | -
286 |
287 |
288 | 0
289 |
290 |
291 |
292 | File comments Settings
293 |
294 |
295 |
-
296 |
297 |
298 |
299 |
300 |
301 |
302 | Cutom comments Settings
303 |
304 |
305 | -
306 |
307 |
308 |
-
309 |
310 |
311 | Begin tag:
312 |
313 |
314 |
315 | -
316 |
317 |
318 |
319 | 0
320 | 20
321 |
322 |
323 |
324 |
325 | -
326 |
327 |
328 | Brief tag:
329 |
330 |
331 |
332 | -
333 |
334 |
335 |
336 | 0
337 | 20
338 |
339 |
340 |
341 |
342 | -
343 |
344 |
345 | Empty line tag:
346 |
347 |
348 |
349 | -
350 |
351 |
352 |
353 | 0
354 | 20
355 |
356 |
357 |
358 |
359 | -
360 |
361 |
362 | New line tag:
363 |
364 |
365 |
366 | -
367 |
368 |
369 |
370 | 0
371 | 20
372 |
373 |
374 |
375 |
376 | -
377 |
378 |
379 | End tag:
380 |
381 |
382 |
383 | -
384 |
385 |
386 |
387 | 0
388 | 20
389 |
390 |
391 |
392 |
393 | -
394 |
395 |
396 | Short doc tag:
397 |
398 |
399 |
400 | -
401 |
402 |
403 |
404 | 0
405 | 20
406 |
407 |
408 |
409 |
410 | -
411 |
412 |
413 | Short doc end:
414 |
415 |
416 |
417 | -
418 |
419 |
420 |
421 | 0
422 | 20
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 | Utils::PathChooser
442 | QWidget
443 |
444 | 1
445 |
446 | editingFinished()
447 | browsingFinished()
448 |
449 |
450 |
451 |
452 |
453 |
454 |
--------------------------------------------------------------------------------
/doxygen.cpp:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | **
3 | ** This file is part of Doxygen plugin for Qt Creator
4 | **
5 | ** Copyright (c) 2009 Kevin Tanguy (kofee@kofee.org).
6 | ** Copyright (c) 2015 Fabien Poussin (fabien.poussin@gmail.com).
7 | **
8 | ** This plugin is free software: you can redistribute it and/or modify
9 | ** it under the terms of the GNU Lesser General Public License as
10 | ** published by the Free Software Foundation, either version 2.1
11 | ** of the License, or (at your option) any later version.
12 | **
13 | ** This plugin is distributed in the hope that it will be useful,
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ** GNU Lesser General Public License for more details.
17 | **
18 | ** You should have received a copy of the GNU General Public License
19 | ** along with Doxygen Plugin. If not, see .
20 | **/
21 |
22 | #include "doxygen.h"
23 | #include "doxygenfilesdialog.h"
24 |
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 |
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 |
54 | using namespace CPlusPlus;
55 | using namespace ProjectExplorer;
56 | using namespace DoxyPlugin;
57 | using namespace DoxyPlugin::Internal;
58 |
59 | Doxygen* Doxygen::m_instance = nullptr;
60 |
61 | Doxygen::Doxygen(QObject* parent)
62 | : QObject(parent)
63 | {
64 | m_cancel = false;
65 |
66 | m_projectProgress = new QProgressDialog();
67 | m_projectProgress->setWindowModality(Qt::WindowModal);
68 | m_projectProgress->setMinimumWidth(300);
69 | m_projectProgress->setMinimum(0);
70 | m_projectProgress->setWindowTitle("Processing project...");
71 | m_projectProgress->close();
72 |
73 | m_fileProgress = new QProgressDialog();
74 | m_fileProgress->setWindowModality(Qt::WindowModal);
75 | m_fileProgress->setMinimumWidth(300);
76 | m_fileProgress->setMinimum(0);
77 | m_fileProgress->setWindowTitle("Processing file...");
78 | m_fileProgress->close();
79 |
80 | connect(m_projectProgress, SIGNAL(canceled()), this, SLOT(cancelOperation()));
81 | connect(m_fileProgress, SIGNAL(canceled()), this, SLOT(cancelOperation()));
82 | }
83 |
84 | Doxygen::~Doxygen()
85 | {
86 | disconnect(m_projectProgress, SIGNAL(canceled()), this, SLOT(cancelOperation()));
87 | disconnect(m_fileProgress, SIGNAL(canceled()), this, SLOT(cancelOperation()));
88 |
89 | delete m_projectProgress;
90 | delete m_fileProgress;
91 | }
92 |
93 | Doxygen* Doxygen::instance()
94 | {
95 | if (!m_instance)
96 | m_instance = new Doxygen;
97 | return m_instance;
98 | }
99 |
100 | // TODO, get rid of it.
101 | QStringList scopesForSymbol(const Symbol* symbol)
102 | {
103 | const Scope* scope = symbol->asScope();
104 | QStringList scopes;
105 |
106 | if (symbol->isFunction()) {
107 | const Name* name = symbol->name();
108 | Overview overview;
109 | overview.showArgumentNames = false;
110 | overview.showReturnTypes = false;
111 | scopes.prepend(overview.prettyName(name));
112 | return scopes;
113 | }
114 |
115 | for (; scope; scope = scope->enclosingScope()) {
116 | Symbol* owner = scope->memberAt(0);
117 |
118 | if (owner && owner->name() && !scope->isEnum()) {
119 | const Name* name = owner->name();
120 | Overview overview;
121 | overview.showArgumentNames = false;
122 | overview.showReturnTypes = false;
123 | scopes.prepend(overview.prettyName(name));
124 | }
125 | }
126 | return scopes;
127 | }
128 |
129 | Symbol* currentSymbol(Core::IEditor* editor)
130 | {
131 | CppTools::CppModelManager* modelManager = CppTools::CppModelManager::instance();
132 | if (!modelManager) {
133 | return nullptr;
134 | }
135 |
136 | const Snapshot snapshot = modelManager->snapshot();
137 | Document::Ptr doc = snapshot.document(editor->document()->filePath());
138 | if (!doc) {
139 | return nullptr;
140 | }
141 |
142 | Symbol* last = doc->lastVisibleSymbolAt(editor->currentLine(), editor->currentColumn());
143 | return last;
144 | }
145 |
146 | // TODO: Recode it entirely.
147 | bool Doxygen::documentEntity(const DoxygenSettingsStruct& DoxySettings, Core::IEditor* editor)
148 | {
149 | // before continuing, test if the editor is actually showing a file.
150 | if (!editor)
151 | return false;
152 |
153 | // get the widget for later.
154 | TextEditor::TextEditorWidget* editorWidget = qobject_cast(
155 | editor->widget());
156 |
157 | // get our symbol
158 | Symbol* lastSymbol = currentSymbol(editor);
159 | editorWidget->gotoLineStart();
160 | int lastLine = editor->currentLine();
161 | int lastColumn = editor->currentColumn();
162 | while (lastSymbol
163 | && (lastSymbol->line() != static_cast(lastLine)
164 | || lastSymbol->column() != static_cast(lastColumn))) {
165 | //qDebug() << "lastSymbol: " << lastSymbol->line() << " " << lastSymbol->column();
166 | //qDebug() << "lastLine: " << lastLine << " " << lastColumn;
167 | editorWidget->gotoNextWord();
168 | // infinite loop prevention
169 | if (lastLine == editor->currentLine() && lastColumn == editor->currentColumn())
170 | return false;
171 | lastLine = editor->currentLine();
172 | lastColumn = editor->currentColumn();
173 | lastSymbol = currentSymbol(editor);
174 | }
175 | //qDebug() << lastLine << " " << lastColumn;
176 | if (!lastSymbol) {
177 | return false;
178 | }
179 |
180 | // We don't want to document multiple times.
181 | // TODO: Find a better, faster way.
182 | QRegExp commentClosing("\\*/");
183 | QString text(editorWidget->document()->toPlainText());
184 | QStringList lines(text.split(QRegExp("\n|\r\n|\r")));
185 |
186 | // We check the 4 previous lines for comments block closing.
187 | for (int i = 1; i <= 4; i++) {
188 | int prevLine = lastLine - i;
189 | if (prevLine < 0)
190 | break;
191 | QString checkText(lines.at(prevLine));
192 | if (checkText.contains(commentClosing)) {
193 | //qDebug() << "Duplicate found in" << editor->document()->filePath().toString() << prevLine;
194 | //qDebug() << checkText;
195 | return false;
196 | }
197 | }
198 |
199 | QStringList scopes = scopesForSymbol(lastSymbol);
200 | Overview overview;
201 | overview.showArgumentNames = true;
202 | overview.showDefaultArguments = false;
203 | overview.showTemplateParameters = false;
204 | overview.showReturnTypes = true;
205 | overview.showFunctionSignatures = true;
206 | const Name* name = lastSymbol->name();
207 | scopes.append(overview.prettyName(name));
208 | //qDebug() << overview.prettyName(name);
209 | //qDebug() << overview.prettyType(lastSymbol->type(), name);
210 | //qDebug() << scopes;
211 |
212 | QString docToWrite;
213 | // Do we print a short documentation block at end of line?
214 | bool printAtEnd = false;
215 |
216 | // Get current indentation as per bug #5
217 | QString indent;
218 | editorWidget->gotoLineStart();
219 | editorWidget->gotoLineStartWithSelection();
220 | QString currentText = editorWidget->textCursor().selectedText();
221 | QStringList textList = currentText.split(QRegExp("\\b"));
222 | indent = textList.at(0);
223 |
224 | // quickfix when calling the method on "};" (end class) or "}" (end namespace)
225 | if (indent.contains(QRegExp("^\\};?"))) {
226 | return false;
227 | }
228 |
229 | if (indent.endsWith('~'))
230 | indent.chop(1);
231 |
232 | if (lastSymbol->isClass()) {
233 | docToWrite += indent + DoxySettings.DoxyComment.doxBegin;
234 | if (DoxySettings.printBrief) {
235 | docToWrite += indent + DoxySettings.DoxyComment.doxBrief;
236 | docToWrite += indent + DoxySettings.DoxyComment.doxEmptyLine;
237 | }
238 | if (DoxySettings.verbosePrinting) {
239 | QString projectRoot = getProjectRoot();
240 | QString fileNameStr = editor->document()->filePath().toString();
241 | QString fileName = fileNameStr.remove(0, fileNameStr.lastIndexOf("/") + 1);
242 | QString fileNameProj = fileNameStr.remove(projectRoot);
243 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "class " + overview.prettyName(name) + " " + fileName + " \"" + fileNameProj + "\"\n";
244 | }
245 | docToWrite += indent + DoxySettings.DoxyComment.doxEnding;
246 | } else if (lastSymbol->isTypedef()) {
247 | docToWrite += indent + DoxySettings.DoxyComment.doxBegin;
248 | if (DoxySettings.printBrief) {
249 | docToWrite += indent + DoxySettings.DoxyComment.doxBrief;
250 | docToWrite += indent + DoxySettings.DoxyComment.doxEmptyLine;
251 | }
252 | if (DoxySettings.verbosePrinting)
253 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "typedef " + overview.prettyName(name);
254 | docToWrite += indent + DoxySettings.DoxyComment.doxEnding;
255 | } else if (lastSymbol->isEnum()) {
256 | docToWrite += indent + DoxySettings.DoxyComment.doxBegin;
257 | if (DoxySettings.printBrief)
258 | docToWrite += indent + DoxySettings.DoxyComment.doxBrief;
259 | docToWrite += indent + DoxySettings.DoxyComment.doxEmptyLine;
260 | if (DoxySettings.verbosePrinting)
261 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "enum " + overview.prettyName(name) + "\n";
262 | docToWrite += indent + DoxySettings.DoxyComment.doxEnding;
263 | }
264 | // Here comes the bitch.
265 | else if (lastSymbol->isDeclaration() || lastSymbol->isFunction()) {
266 | overview.showArgumentNames = true;
267 | overview.showReturnTypes = false;
268 | overview.showDefaultArguments = false;
269 | overview.showTemplateParameters = false;
270 | overview.showFunctionSignatures = true;
271 |
272 | QString arglist = overview.prettyType(lastSymbol->type(), name);
273 | docToWrite += indent + DoxySettings.DoxyComment.doxBegin;
274 | if (DoxySettings.printBrief) {
275 | docToWrite += indent + DoxySettings.DoxyComment.doxBrief;
276 | docToWrite += indent + DoxySettings.DoxyComment.doxEmptyLine;
277 | }
278 |
279 | // if variable, do it quickly...
280 | if (!arglist.contains('(')) {
281 | if (DoxySettings.shortVarDoc) {
282 | printAtEnd = true;
283 | docToWrite = DoxySettings.DoxyComment.doxShortVarDoc + "TODO: describe" + DoxySettings.DoxyComment.doxShortVarDocEnd;
284 | } else {
285 | if (DoxySettings.verbosePrinting)
286 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "var " + overview.prettyName(name) + "\n" + indent + DoxySettings.DoxyComment.doxEnding;
287 | else
288 | docToWrite += indent + DoxySettings.DoxyComment.doxEmptyLine + indent + DoxySettings.DoxyComment.doxEnding;
289 | }
290 | } else {
291 | // Never noticed it before, a useless comment block because of the Q_OBJECT macro
292 | // so let's just ignore that will we?
293 | if (overview.prettyName(name) == "qt_metacall")
294 | return false;
295 |
296 | if (DoxySettings.verbosePrinting)
297 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "fn " + overview.prettyName(name) + "\n";
298 |
299 | // Check parameters
300 | // Do it the naive way first before finding better in the API
301 | arglist.remove(0, arglist.indexOf("(") + 1);
302 | arglist.remove(arglist.lastIndexOf(")"), arglist.size() - arglist.lastIndexOf(")"));
303 |
304 | QStringList args = arglist.trimmed().split(',', QString::SkipEmptyParts);
305 |
306 | Q_FOREACH (QString singleArg, args) {
307 | singleArg.remove(QRegExp("\\s*=.*")); // FIXME probably don't need the * after \\s but...
308 | singleArg.replace("*", "");
309 | singleArg.replace("&", "");
310 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "param " + singleArg.section(' ', -1) + "\n";
311 | }
312 |
313 | // And now check the return type
314 | overview.showArgumentNames = false;
315 | overview.showDefaultArguments = false;
316 | overview.showTemplateParameters = false;
317 | overview.showReturnTypes = true;
318 | overview.showFunctionSignatures = false;
319 |
320 | arglist = overview.prettyType(lastSymbol->type(), name);
321 |
322 | // FIXME this check is just insane...
323 | if (arglist.contains(' ')
324 | && ((lastSymbol->isFunction() && !overview.prettyName(name).contains("::~"))
325 | || (lastSymbol->isDeclaration() && overview.prettyName(name).at(0) != '~'))) {
326 | QRegExp rx("void *");
327 | rx.setPatternSyntax(QRegExp::Wildcard);
328 | if (!rx.exactMatch(arglist)) {
329 | // dirty workarround
330 | int last;
331 | if (arglist.contains('>'))
332 | last = arglist.lastIndexOf('>') + 1;
333 | else
334 | last = arglist.lastIndexOf(' ');
335 |
336 | arglist.chop(arglist.size() - last);
337 | if (DoxySettings.automaticReturnType == false) {
338 | arglist.clear();
339 | }
340 |
341 | docToWrite += indent + DoxySettings.DoxyComment.doxNewLine + "return " + arglist + "\n";
342 | }
343 | }
344 | docToWrite += indent + DoxySettings.DoxyComment.doxEnding;
345 | }
346 | }
347 |
348 | // Write the documentation in the editor
349 | if (editorWidget) {
350 | if (printAtEnd)
351 | editorWidget->moveCursor(QTextCursor::EndOfLine);
352 | else
353 | editorWidget->moveCursor(QTextCursor::StartOfBlock);
354 |
355 | editorWidget->insertPlainText(docToWrite);
356 | return true;
357 | }
358 | return false;
359 | }
360 |
361 | bool Doxygen::addFileComment(const DoxygenSettingsStruct& DoxySettings, Core::IEditor* editor)
362 | {
363 | // before continuing, test if the editor is actually showing a file.
364 | if (!editor)
365 | return false;
366 |
367 | // get the widget for later.
368 | TextEditor::TextEditorWidget* editorWidget = qobject_cast(
369 | editor->widget());
370 |
371 | QString text = DoxySettings.DoxyComment.doxBegin + DoxySettings.DoxyComment.doxNewLine;
372 | text += "file " + editor->document()->filePath().fileName() + "\n";
373 | text += DoxySettings.DoxyComment.doxEmptyLine;
374 | text += DoxySettings.fileComment;
375 | text += DoxySettings.DoxyComment.doxEnding + "\n";
376 |
377 | // get our symbol
378 | editorWidget->gotoLine(1, 0);
379 | editorWidget->insertPlainText(text);
380 |
381 | return true;
382 | }
383 |
384 | void Doxygen::addSymbol(const CPlusPlus::Symbol* symbol, QList& symmap)
385 | {
386 | if (!symbol || symbol->isBaseClass() || symbol->isGenerated())
387 | return;
388 |
389 | if (symbol->isArgument()
390 | || symbol->isFunction()
391 | || symbol->isDeclaration()
392 | || symbol->isEnum()) {
393 | symmap.append(symbol);
394 | return;
395 | } else if (symbol->isClass()) {
396 | symmap.append(symbol);
397 | }
398 |
399 | const CPlusPlus::Scope* scopedSymbol = symbol->asScope();
400 | if (scopedSymbol) {
401 | int nbmembers = scopedSymbol->memberCount();
402 | for (int i = 0; i < nbmembers; ++i) {
403 | addSymbol(scopedSymbol->memberAt(i), symmap);
404 | }
405 | }
406 | }
407 |
408 | uint Doxygen::documentFile(const DoxygenSettingsStruct& DoxySettings, Core::IEditor* editor)
409 | {
410 | // before continuing, test if the editor is actually showing a file.
411 | if (!editor) {
412 | //qDebug() << "No editor";
413 | return 0;
414 | }
415 |
416 | m_cancel = false;
417 |
418 | CppTools::CppModelManager* modelManager = CppTools::CppModelManager::instance();
419 | //ExtensionSystem::PluginManager::instance()->getObject();
420 | if (!modelManager) {
421 | //qDebug() << "No modelManager";
422 | return 0;
423 | }
424 |
425 | const Snapshot snapshot = modelManager->snapshot();
426 | Document::Ptr doc = snapshot.document(editor->document()->filePath());
427 | if (!doc) {
428 | //qDebug() << "No document";
429 | return 0;
430 | }
431 |
432 | // TODO : check
433 | int globalSymbols = doc->globalSymbolCount();
434 | if (!globalSymbols) {
435 | if (DoxySettings.fileCommentsEnabled) {
436 | addFileComment(DoxySettings, editor);
437 | }
438 | //qDebug() << "No global symbols";
439 | return 0;
440 | }
441 |
442 | // check that as well...
443 | Scope* scope = doc->scopeAt(0, 0);
444 | if (!scope) {
445 | if (DoxySettings.fileCommentsEnabled) {
446 | addFileComment(DoxySettings, editor);
447 | }
448 | //qDebug() << "No scope";
449 | return 0;
450 | }
451 |
452 | unsigned symbolcount = scope->memberCount();
453 |
454 | QList symmap;
455 | for (unsigned i = 0; i < symbolcount; ++i)
456 | addSymbol(scope->memberAt(i), symmap);
457 |
458 | // sanity check, it's expensive and ugly but the result isn't pretty on some codes if not done.
459 | unsigned oldline = 0;
460 | Q_FOREACH (const Symbol* sym, symmap) {
461 | if (sym->line() == oldline)
462 | symmap.removeOne(sym);
463 | oldline = sym->line();
464 | }
465 |
466 | const int symCount = symmap.size();
467 | const int symMin = 100;
468 | TextEditor::TextEditorWidget* editorWidget = qobject_cast(editor->widget());
469 | QString fileName("Processing " + editor->document()->filePath().fileName() + "...");
470 |
471 | uint count = 0;
472 | emit message(fileName);
473 |
474 | if (symCount > symMin) {
475 | m_fileProgress->setLabelText(fileName);
476 | m_fileProgress->setMaximum(symCount);
477 | m_fileProgress->setValue(0);
478 | m_fileProgress->show();
479 | }
480 |
481 | if (editorWidget) {
482 | QList::iterator it = symmap.end();
483 | for (int i = 0; it != symmap.begin(); --it) {
484 | if (symCount > symMin && i++ % 20 == 0) // Every n occurences
485 | {
486 | if (m_cancel) {
487 | break;
488 | }
489 |
490 | m_fileProgress->setValue(i);
491 | m_fileProgress->update();
492 | }
493 | const Symbol* sym = *(it - 1);
494 | editorWidget->gotoLine(sym->line());
495 | if (documentEntity(DoxySettings, editor))
496 | count++;
497 | }
498 |
499 | if (DoxySettings.fileCommentsEnabled) {
500 | if (addFileComment(DoxySettings, editor))
501 | count++;
502 | }
503 | }
504 |
505 | if (symCount > symMin)
506 | m_fileProgress->setValue(symCount);
507 |
508 | return count;
509 | }
510 |
511 | // TODO: fix this! Unused at the moment.
512 | uint Doxygen::documentSpecificProject(const DoxygenSettingsStruct& DoxySettings)
513 | {
514 | return documentProject(ProjectExplorer::SessionManager::startupProject(), DoxySettings);
515 | }
516 |
517 | uint Doxygen::documentCurrentProject(const DoxygenSettingsStruct& DoxySettings)
518 | {
519 | return documentProject(ProjectExplorer::ProjectTree::currentProject(), DoxySettings);
520 | }
521 |
522 | void Doxygen::cancelOperation()
523 | {
524 | m_cancel = true;
525 | emit message("Operation canceled");
526 | }
527 |
528 | uint Doxygen::documentProject(ProjectExplorer::Project* p, const DoxygenSettingsStruct& DoxySettings)
529 | {
530 | // prevent a crash if user launches this command with no project opened
531 | // You don't need to have an editor open for that.
532 | if (!p) {
533 | QMessageBox::warning((QWidget*)parent(),
534 | tr("Doxygen"),
535 | tr("You don't have any current project."),
536 | QMessageBox::Close, QMessageBox::NoButton);
537 | return 0;
538 | }
539 |
540 | uint count = 0;
541 | m_cancel = false;
542 | Core::EditorManager* editorManager = Core::EditorManager::instance();
543 |
544 | QStringList files;
545 |
546 | DoxygenFilesDialog* dialog = new DoxygenFilesDialog();
547 | dialog->initFileTree(p->rootProjectNode());
548 |
549 | if (dialog->exec() != QDialog::Accepted) {
550 | delete dialog;
551 | return 0;
552 | }
553 | dialog->getFilesList(&files);
554 | delete dialog;
555 |
556 | m_projectProgress->setMaximum(files.size());
557 | m_projectProgress->show();
558 |
559 | for (int i = 0; i < files.size(); ++i) {
560 | bool documented = false;
561 | m_projectProgress->setValue(i);
562 | //qDebug() << "Current file:" << i;
563 | if (m_cancel) {
564 | break;
565 | }
566 |
567 | QFileInfo fileInfo(files[i]);
568 | QString fileExtension = fileInfo.suffix();
569 | //qDebug() << "Current file:" << files.at(i);
570 | if (
571 | (
572 | (DoxySettings.fcomment == headers /*|| DoxySettings.fcomment == bothqt*/ || DoxySettings.fcomment == all)
573 | && (fileExtension == "hpp" || fileExtension == "h"))
574 | || ((DoxySettings.fcomment == implementations /*|| DoxySettings.fcomment == bothqt*/ || DoxySettings.fcomment == all)
575 | && (fileExtension == "cpp" || fileExtension == "c"))) { /*|| ( //TODO: add documentation of QML files (see doxyqml comments interpretation)
576 | (DoxySettings.fcomment == qml || DoxySettings.fcomment == all)
577 | && fileExtension == "qml"
578 | )
579 | ) {*/
580 | Core::IEditor* editor = editorManager->openEditor(files[i], Utils::Id(),
581 | Core::EditorManager::DoNotChangeCurrentEditor
582 | | Core::EditorManager::IgnoreNavigationHistory
583 | | Core::EditorManager::DoNotMakeVisible);
584 | if (editor) {
585 | documented = true;
586 | count += documentFile(DoxySettings, editor);
587 | }
588 | }
589 |
590 | if (DoxySettings.fileCommentsEnabled && documented == false) {
591 | bool commentFile = false;
592 | //qDebug() << "FileCommentHeaders: " << DoxySettings.fileCommentHeaders;
593 | //qDebug() << "FileCommentImpl: " << DoxySettings.fileCommentImpl;
594 | if (DoxySettings.fileCommentHeaders && (fileExtension == "hpp" || fileExtension == "h")) {
595 | commentFile = true;
596 | } else if (DoxySettings.fileCommentImpl && (fileExtension == "cpp" || fileExtension == "c")) {
597 | commentFile = true;
598 | }
599 |
600 | if (commentFile) {
601 | Core::IEditor* editor = editorManager->openEditor(files[i]);
602 | if (editor)
603 | count += addFileComment(DoxySettings, editor);
604 | }
605 | }
606 | }
607 | m_projectProgress->setValue(files.size());
608 |
609 | QString msg;
610 | msg.sprintf("Doxygen blocs generated: %u", count);
611 | emit message(msg);
612 |
613 | return count;
614 | }
615 |
616 | QString Doxygen::getProjectRoot()
617 | {
618 | QString projectRoot;
619 | Project* proj = ProjectTree::currentProject();
620 | if (proj) {
621 | projectRoot = proj->projectDirectory().toString() + "/";
622 | }
623 |
624 | return projectRoot;
625 | }
626 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 2.1, February 1999
3 |
4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | [This is the first released version of the Lesser GPL. It also counts
10 | as the successor of the GNU Library Public License, version 2, hence
11 | the version number 2.1.]
12 |
13 | Preamble
14 |
15 | The licenses for most software are designed to take away your
16 | freedom to share and change it. By contrast, the GNU General Public
17 | Licenses are intended to guarantee your freedom to share and change
18 | free software--to make sure the software is free for all its users.
19 |
20 | This license, the Lesser General Public License, applies to some
21 | specially designated software packages--typically libraries--of the
22 | Free Software Foundation and other authors who decide to use it. You
23 | can use it too, but we suggest you first think carefully about whether
24 | this license or the ordinary General Public License is the better
25 | strategy to use in any particular case, based on the explanations below.
26 |
27 | When we speak of free software, we are referring to freedom of use,
28 | not price. Our General Public Licenses are designed to make sure that
29 | you have the freedom to distribute copies of free software (and charge
30 | for this service if you wish); that you receive source code or can get
31 | it if you want it; that you can change the software and use pieces of
32 | it in new free programs; and that you are informed that you can do
33 | these things.
34 |
35 | To protect your rights, we need to make restrictions that forbid
36 | distributors to deny you these rights or to ask you to surrender these
37 | rights. These restrictions translate to certain responsibilities for
38 | you if you distribute copies of the library or if you modify it.
39 |
40 | For example, if you distribute copies of the library, whether gratis
41 | or for a fee, you must give the recipients all the rights that we gave
42 | you. You must make sure that they, too, receive or can get the source
43 | code. If you link other code with the library, you must provide
44 | complete object files to the recipients, so that they can relink them
45 | with the library after making changes to the library and recompiling
46 | it. And you must show them these terms so they know their rights.
47 |
48 | We protect your rights with a two-step method: (1) we copyright the
49 | library, and (2) we offer you this license, which gives you legal
50 | permission to copy, distribute and/or modify the library.
51 |
52 | To protect each distributor, we want to make it very clear that
53 | there is no warranty for the free library. Also, if the library is
54 | modified by someone else and passed on, the recipients should know
55 | that what they have is not the original version, so that the original
56 | author's reputation will not be affected by problems that might be
57 | introduced by others.
58 |
59 | Finally, software patents pose a constant threat to the existence of
60 | any free program. We wish to make sure that a company cannot
61 | effectively restrict the users of a free program by obtaining a
62 | restrictive license from a patent holder. Therefore, we insist that
63 | any patent license obtained for a version of the library must be
64 | consistent with the full freedom of use specified in this license.
65 |
66 | Most GNU software, including some libraries, is covered by the
67 | ordinary GNU General Public License. This license, the GNU Lesser
68 | General Public License, applies to certain designated libraries, and
69 | is quite different from the ordinary General Public License. We use
70 | this license for certain libraries in order to permit linking those
71 | libraries into non-free programs.
72 |
73 | When a program is linked with a library, whether statically or using
74 | a shared library, the combination of the two is legally speaking a
75 | combined work, a derivative of the original library. The ordinary
76 | General Public License therefore permits such linking only if the
77 | entire combination fits its criteria of freedom. The Lesser General
78 | Public License permits more lax criteria for linking other code with
79 | the library.
80 |
81 | We call this license the "Lesser" General Public License because it
82 | does Less to protect the user's freedom than the ordinary General
83 | Public License. It also provides other free software developers Less
84 | of an advantage over competing non-free programs. These disadvantages
85 | are the reason we use the ordinary General Public License for many
86 | libraries. However, the Lesser license provides advantages in certain
87 | special circumstances.
88 |
89 | For example, on rare occasions, there may be a special need to
90 | encourage the widest possible use of a certain library, so that it becomes
91 | a de-facto standard. To achieve this, non-free programs must be
92 | allowed to use the library. A more frequent case is that a free
93 | library does the same job as widely used non-free libraries. In this
94 | case, there is little to gain by limiting the free library to free
95 | software only, so we use the Lesser General Public License.
96 |
97 | In other cases, permission to use a particular library in non-free
98 | programs enables a greater number of people to use a large body of
99 | free software. For example, permission to use the GNU C Library in
100 | non-free programs enables many more people to use the whole GNU
101 | operating system, as well as its variant, the GNU/Linux operating
102 | system.
103 |
104 | Although the Lesser General Public License is Less protective of the
105 | users' freedom, it does ensure that the user of a program that is
106 | linked with the Library has the freedom and the wherewithal to run
107 | that program using a modified version of the Library.
108 |
109 | The precise terms and conditions for copying, distribution and
110 | modification follow. Pay close attention to the difference between a
111 | "work based on the library" and a "work that uses the library". The
112 | former contains code derived from the library, whereas the latter must
113 | be combined with the library in order to run.
114 |
115 | GNU LESSER GENERAL PUBLIC LICENSE
116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117 |
118 | 0. This License Agreement applies to any software library or other
119 | program which contains a notice placed by the copyright holder or
120 | other authorized party saying it may be distributed under the terms of
121 | this Lesser General Public License (also called "this License").
122 | Each licensee is addressed as "you".
123 |
124 | A "library" means a collection of software functions and/or data
125 | prepared so as to be conveniently linked with application programs
126 | (which use some of those functions and data) to form executables.
127 |
128 | The "Library", below, refers to any such software library or work
129 | which has been distributed under these terms. A "work based on the
130 | Library" means either the Library or any derivative work under
131 | copyright law: that is to say, a work containing the Library or a
132 | portion of it, either verbatim or with modifications and/or translated
133 | straightforwardly into another language. (Hereinafter, translation is
134 | included without limitation in the term "modification".)
135 |
136 | "Source code" for a work means the preferred form of the work for
137 | making modifications to it. For a library, complete source code means
138 | all the source code for all modules it contains, plus any associated
139 | interface definition files, plus the scripts used to control compilation
140 | and installation of the library.
141 |
142 | Activities other than copying, distribution and modification are not
143 | covered by this License; they are outside its scope. The act of
144 | running a program using the Library is not restricted, and output from
145 | such a program is covered only if its contents constitute a work based
146 | on the Library (independent of the use of the Library in a tool for
147 | writing it). Whether that is true depends on what the Library does
148 | and what the program that uses the Library does.
149 |
150 | 1. You may copy and distribute verbatim copies of the Library's
151 | complete source code as you receive it, in any medium, provided that
152 | you conspicuously and appropriately publish on each copy an
153 | appropriate copyright notice and disclaimer of warranty; keep intact
154 | all the notices that refer to this License and to the absence of any
155 | warranty; and distribute a copy of this License along with the
156 | Library.
157 |
158 | You may charge a fee for the physical act of transferring a copy,
159 | and you may at your option offer warranty protection in exchange for a
160 | fee.
161 |
162 | 2. You may modify your copy or copies of the Library or any portion
163 | of it, thus forming a work based on the Library, and copy and
164 | distribute such modifications or work under the terms of Section 1
165 | above, provided that you also meet all of these conditions:
166 |
167 | a) The modified work must itself be a software library.
168 |
169 | b) You must cause the files modified to carry prominent notices
170 | stating that you changed the files and the date of any change.
171 |
172 | c) You must cause the whole of the work to be licensed at no
173 | charge to all third parties under the terms of this License.
174 |
175 | d) If a facility in the modified Library refers to a function or a
176 | table of data to be supplied by an application program that uses
177 | the facility, other than as an argument passed when the facility
178 | is invoked, then you must make a good faith effort to ensure that,
179 | in the event an application does not supply such function or
180 | table, the facility still operates, and performs whatever part of
181 | its purpose remains meaningful.
182 |
183 | (For example, a function in a library to compute square roots has
184 | a purpose that is entirely well-defined independent of the
185 | application. Therefore, Subsection 2d requires that any
186 | application-supplied function or table used by this function must
187 | be optional: if the application does not supply it, the square
188 | root function must still compute square roots.)
189 |
190 | These requirements apply to the modified work as a whole. If
191 | identifiable sections of that work are not derived from the Library,
192 | and can be reasonably considered independent and separate works in
193 | themselves, then this License, and its terms, do not apply to those
194 | sections when you distribute them as separate works. But when you
195 | distribute the same sections as part of a whole which is a work based
196 | on the Library, the distribution of the whole must be on the terms of
197 | this License, whose permissions for other licensees extend to the
198 | entire whole, and thus to each and every part regardless of who wrote
199 | it.
200 |
201 | Thus, it is not the intent of this section to claim rights or contest
202 | your rights to work written entirely by you; rather, the intent is to
203 | exercise the right to control the distribution of derivative or
204 | collective works based on the Library.
205 |
206 | In addition, mere aggregation of another work not based on the Library
207 | with the Library (or with a work based on the Library) on a volume of
208 | a storage or distribution medium does not bring the other work under
209 | the scope of this License.
210 |
211 | 3. You may opt to apply the terms of the ordinary GNU General Public
212 | License instead of this License to a given copy of the Library. To do
213 | this, you must alter all the notices that refer to this License, so
214 | that they refer to the ordinary GNU General Public License, version 2,
215 | instead of to this License. (If a newer version than version 2 of the
216 | ordinary GNU General Public License has appeared, then you can specify
217 | that version instead if you wish.) Do not make any other change in
218 | these notices.
219 |
220 | Once this change is made in a given copy, it is irreversible for
221 | that copy, so the ordinary GNU General Public License applies to all
222 | subsequent copies and derivative works made from that copy.
223 |
224 | This option is useful when you wish to copy part of the code of
225 | the Library into a program that is not a library.
226 |
227 | 4. You may copy and distribute the Library (or a portion or
228 | derivative of it, under Section 2) in object code or executable form
229 | under the terms of Sections 1 and 2 above provided that you accompany
230 | it with the complete corresponding machine-readable source code, which
231 | must be distributed under the terms of Sections 1 and 2 above on a
232 | medium customarily used for software interchange.
233 |
234 | If distribution of object code is made by offering access to copy
235 | from a designated place, then offering equivalent access to copy the
236 | source code from the same place satisfies the requirement to
237 | distribute the source code, even though third parties are not
238 | compelled to copy the source along with the object code.
239 |
240 | 5. A program that contains no derivative of any portion of the
241 | Library, but is designed to work with the Library by being compiled or
242 | linked with it, is called a "work that uses the Library". Such a
243 | work, in isolation, is not a derivative work of the Library, and
244 | therefore falls outside the scope of this License.
245 |
246 | However, linking a "work that uses the Library" with the Library
247 | creates an executable that is a derivative of the Library (because it
248 | contains portions of the Library), rather than a "work that uses the
249 | library". The executable is therefore covered by this License.
250 | Section 6 states terms for distribution of such executables.
251 |
252 | When a "work that uses the Library" uses material from a header file
253 | that is part of the Library, the object code for the work may be a
254 | derivative work of the Library even though the source code is not.
255 | Whether this is true is especially significant if the work can be
256 | linked without the Library, or if the work is itself a library. The
257 | threshold for this to be true is not precisely defined by law.
258 |
259 | If such an object file uses only numerical parameters, data
260 | structure layouts and accessors, and small macros and small inline
261 | functions (ten lines or less in length), then the use of the object
262 | file is unrestricted, regardless of whether it is legally a derivative
263 | work. (Executables containing this object code plus portions of the
264 | Library will still fall under Section 6.)
265 |
266 | Otherwise, if the work is a derivative of the Library, you may
267 | distribute the object code for the work under the terms of Section 6.
268 | Any executables containing that work also fall under Section 6,
269 | whether or not they are linked directly with the Library itself.
270 |
271 | 6. As an exception to the Sections above, you may also combine or
272 | link a "work that uses the Library" with the Library to produce a
273 | work containing portions of the Library, and distribute that work
274 | under terms of your choice, provided that the terms permit
275 | modification of the work for the customer's own use and reverse
276 | engineering for debugging such modifications.
277 |
278 | You must give prominent notice with each copy of the work that the
279 | Library is used in it and that the Library and its use are covered by
280 | this License. You must supply a copy of this License. If the work
281 | during execution displays copyright notices, you must include the
282 | copyright notice for the Library among them, as well as a reference
283 | directing the user to the copy of this License. Also, you must do one
284 | of these things:
285 |
286 | a) Accompany the work with the complete corresponding
287 | machine-readable source code for the Library including whatever
288 | changes were used in the work (which must be distributed under
289 | Sections 1 and 2 above); and, if the work is an executable linked
290 | with the Library, with the complete machine-readable "work that
291 | uses the Library", as object code and/or source code, so that the
292 | user can modify the Library and then relink to produce a modified
293 | executable containing the modified Library. (It is understood
294 | that the user who changes the contents of definitions files in the
295 | Library will not necessarily be able to recompile the application
296 | to use the modified definitions.)
297 |
298 | b) Use a suitable shared library mechanism for linking with the
299 | Library. A suitable mechanism is one that (1) uses at run time a
300 | copy of the library already present on the user's computer system,
301 | rather than copying library functions into the executable, and (2)
302 | will operate properly with a modified version of the library, if
303 | the user installs one, as long as the modified version is
304 | interface-compatible with the version that the work was made with.
305 |
306 | c) Accompany the work with a written offer, valid for at
307 | least three years, to give the same user the materials
308 | specified in Subsection 6a, above, for a charge no more
309 | than the cost of performing this distribution.
310 |
311 | d) If distribution of the work is made by offering access to copy
312 | from a designated place, offer equivalent access to copy the above
313 | specified materials from the same place.
314 |
315 | e) Verify that the user has already received a copy of these
316 | materials or that you have already sent this user a copy.
317 |
318 | For an executable, the required form of the "work that uses the
319 | Library" must include any data and utility programs needed for
320 | reproducing the executable from it. However, as a special exception,
321 | the materials to be distributed need not include anything that is
322 | normally distributed (in either source or binary form) with the major
323 | components (compiler, kernel, and so on) of the operating system on
324 | which the executable runs, unless that component itself accompanies
325 | the executable.
326 |
327 | It may happen that this requirement contradicts the license
328 | restrictions of other proprietary libraries that do not normally
329 | accompany the operating system. Such a contradiction means you cannot
330 | use both them and the Library together in an executable that you
331 | distribute.
332 |
333 | 7. You may place library facilities that are a work based on the
334 | Library side-by-side in a single library together with other library
335 | facilities not covered by this License, and distribute such a combined
336 | library, provided that the separate distribution of the work based on
337 | the Library and of the other library facilities is otherwise
338 | permitted, and provided that you do these two things:
339 |
340 | a) Accompany the combined library with a copy of the same work
341 | based on the Library, uncombined with any other library
342 | facilities. This must be distributed under the terms of the
343 | Sections above.
344 |
345 | b) Give prominent notice with the combined library of the fact
346 | that part of it is a work based on the Library, and explaining
347 | where to find the accompanying uncombined form of the same work.
348 |
349 | 8. You may not copy, modify, sublicense, link with, or distribute
350 | the Library except as expressly provided under this License. Any
351 | attempt otherwise to copy, modify, sublicense, link with, or
352 | distribute the Library is void, and will automatically terminate your
353 | rights under this License. However, parties who have received copies,
354 | or rights, from you under this License will not have their licenses
355 | terminated so long as such parties remain in full compliance.
356 |
357 | 9. You are not required to accept this License, since you have not
358 | signed it. However, nothing else grants you permission to modify or
359 | distribute the Library or its derivative works. These actions are
360 | prohibited by law if you do not accept this License. Therefore, by
361 | modifying or distributing the Library (or any work based on the
362 | Library), you indicate your acceptance of this License to do so, and
363 | all its terms and conditions for copying, distributing or modifying
364 | the Library or works based on it.
365 |
366 | 10. Each time you redistribute the Library (or any work based on the
367 | Library), the recipient automatically receives a license from the
368 | original licensor to copy, distribute, link with or modify the Library
369 | subject to these terms and conditions. You may not impose any further
370 | restrictions on the recipients' exercise of the rights granted herein.
371 | You are not responsible for enforcing compliance by third parties with
372 | this License.
373 |
374 | 11. If, as a consequence of a court judgment or allegation of patent
375 | infringement or for any other reason (not limited to patent issues),
376 | conditions are imposed on you (whether by court order, agreement or
377 | otherwise) that contradict the conditions of this License, they do not
378 | excuse you from the conditions of this License. If you cannot
379 | distribute so as to satisfy simultaneously your obligations under this
380 | License and any other pertinent obligations, then as a consequence you
381 | may not distribute the Library at all. For example, if a patent
382 | license would not permit royalty-free redistribution of the Library by
383 | all those who receive copies directly or indirectly through you, then
384 | the only way you could satisfy both it and this License would be to
385 | refrain entirely from distribution of the Library.
386 |
387 | If any portion of this section is held invalid or unenforceable under any
388 | particular circumstance, the balance of the section is intended to apply,
389 | and the section as a whole is intended to apply in other circumstances.
390 |
391 | It is not the purpose of this section to induce you to infringe any
392 | patents or other property right claims or to contest validity of any
393 | such claims; this section has the sole purpose of protecting the
394 | integrity of the free software distribution system which is
395 | implemented by public license practices. Many people have made
396 | generous contributions to the wide range of software distributed
397 | through that system in reliance on consistent application of that
398 | system; it is up to the author/donor to decide if he or she is willing
399 | to distribute software through any other system and a licensee cannot
400 | impose that choice.
401 |
402 | This section is intended to make thoroughly clear what is believed to
403 | be a consequence of the rest of this License.
404 |
405 | 12. If the distribution and/or use of the Library is restricted in
406 | certain countries either by patents or by copyrighted interfaces, the
407 | original copyright holder who places the Library under this License may add
408 | an explicit geographical distribution limitation excluding those countries,
409 | so that distribution is permitted only in or among countries not thus
410 | excluded. In such case, this License incorporates the limitation as if
411 | written in the body of this License.
412 |
413 | 13. The Free Software Foundation may publish revised and/or new
414 | versions of the Lesser General Public License from time to time.
415 | Such new versions will be similar in spirit to the present version,
416 | but may differ in detail to address new problems or concerns.
417 |
418 | Each version is given a distinguishing version number. If the Library
419 | specifies a version number of this License which applies to it and
420 | "any later version", you have the option of following the terms and
421 | conditions either of that version or of any later version published by
422 | the Free Software Foundation. If the Library does not specify a
423 | license version number, you may choose any version ever published by
424 | the Free Software Foundation.
425 |
426 | 14. If you wish to incorporate parts of the Library into other free
427 | programs whose distribution conditions are incompatible with these,
428 | write to the author to ask for permission. For software which is
429 | copyrighted by the Free Software Foundation, write to the Free
430 | Software Foundation; we sometimes make exceptions for this. Our
431 | decision will be guided by the two goals of preserving the free status
432 | of all derivatives of our free software and of promoting the sharing
433 | and reuse of software generally.
434 |
435 | NO WARRANTY
436 |
437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446 |
447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456 | DAMAGES.
457 |
458 | END OF TERMS AND CONDITIONS
459 |
460 | How to Apply These Terms to Your New Libraries
461 |
462 | If you develop a new library, and you want it to be of the greatest
463 | possible use to the public, we recommend making it free software that
464 | everyone can redistribute and change. You can do so by permitting
465 | redistribution under these terms (or, alternatively, under the terms of the
466 | ordinary General Public License).
467 |
468 | To apply these terms, attach the following notices to the library. It is
469 | safest to attach them to the start of each source file to most effectively
470 | convey the exclusion of warranty; and each file should have at least the
471 | "copyright" line and a pointer to where the full notice is found.
472 |
473 |
474 | Copyright (C)
475 |
476 | This library is free software; you can redistribute it and/or
477 | modify it under the terms of the GNU Lesser General Public
478 | License as published by the Free Software Foundation; either
479 | version 2.1 of the License, or (at your option) any later version.
480 |
481 | This library is distributed in the hope that it will be useful,
482 | but WITHOUT ANY WARRANTY; without even the implied warranty of
483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484 | Lesser General Public License for more details.
485 |
486 | You should have received a copy of the GNU Lesser General Public
487 | License along with this library; if not, write to the Free Software
488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489 |
490 | Also add information on how to contact you by electronic and paper mail.
491 |
492 | You should also get your employer (if you work as a programmer) or your
493 | school, if any, to sign a "copyright disclaimer" for the library, if
494 | necessary. Here is a sample; alter the names:
495 |
496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the
497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498 |
499 | , 1 April 1990
500 | Ty Coon, President of Vice
501 |
502 | That's all there is to it!
503 |
504 |
505 |
--------------------------------------------------------------------------------