diff --git a/utils_ide/qtcreator/externaltools/qtc_doxy_file.py b/utils_ide/qtcreator/externaltools/qtc_doxy_file.py new file mode 100755 index 0000000000000000000000000000000000000000..5034cf93c8204824b3f2475363b1e64afa70c215 --- /dev/null +++ b/utils_ide/qtcreator/externaltools/qtc_doxy_file.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +""" +This script takes 2-3 args: [--browse] <Doxyfile> <sourcefile> + +--browse will open the resulting docs in a web browser. +""" +import sys +import os +import subprocess +import tempfile + +def find_gitroot(filepath_reference): + path = filepath_reference + path_prev = "" + while not os.path.exists(os.path.join(path, ".git")) and path != path_prev: + path_prev = path + path = os.path.dirname(path) + return path + +def find_doxy(filepath_reference): + root = find_gitroot(filepath_reference) + + # project specific! + return os.path.join(root, "doc", "doxygen", "Doxyfile") + +sourcefile = sys.argv[-1] + +doxyfile = find_doxy(sourcefile) +os.chdir(os.path.dirname(doxyfile)) + +tempfile = tempfile.NamedTemporaryFile(mode='w+b') +doxyfile_tmp = tempfile.name +tempfile.write(open(doxyfile, "r+b").read()) +tempfile.write(b'\n\n') +tempfile.write(b'INPUT=' + os.fsencode(sourcefile) + b'\n') +tempfile.flush() + +subprocess.call(("doxygen", doxyfile_tmp)) +del tempfile + +# Maybe handy, but also annoying? +if "--browse" in sys.argv: + import webbrowser + webbrowser.open("html/files.html") diff --git a/utils_ide/qtcreator/externaltools/qtc_doxy_file.xml b/utils_ide/qtcreator/externaltools/qtc_doxy_file.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a2ac13e3c1e3cbae26776ab56c0d0444681935d --- /dev/null +++ b/utils_ide/qtcreator/externaltools/qtc_doxy_file.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<externaltool id="qtc_doxygen_file"> + <description>Doxygen a single file</description> + <displayname>Doxygen File</displayname> + <category>Documentation</category> + <executable output="showinpane" error="showinpane" modifiesdocument="no"> + <path>qtc_doxy_file.py</path> + <arguments>--browse %{CurrentDocument:FilePath}</arguments> + <workingdirectory>%{CurrentProject:BuildPath}</workingdirectory> + </executable> +</externaltool> diff --git a/utils_ide/qtcreator/readme.rst b/utils_ide/qtcreator/readme.rst new file mode 100644 index 0000000000000000000000000000000000000000..1e0239a400f8b310f49a32ee53e9d6ed12fce1d9 --- /dev/null +++ b/utils_ide/qtcreator/readme.rst @@ -0,0 +1,44 @@ +This repository contains utilities to perform various editing operations as well as some utilities to integrate +Uncrustify and Meld. + + +This is for my own personal use, but I have tried to make the tools generic (where possible) and useful to others. + + +Installing +========== + +All the scripts install to QtCreators ``externaltools`` path: + +eg: +``~/.config/QtProject/qtcreator/externaltools/`` + +Currently QtCreator has no way to reference commands relative to this directory so the ``externaltools`` dir **must** +be added to the systems ``PATH``. + + +Tools +===== + +Here are a list of the tools with some details on how they work. + + +Assembler Preview +----------------- + +``External Tools -> Compiler -> Assembler Preview`` + +This tool generates the assembly for the current open document, +saving it to a file in the same path with an ".asm" extension. + +This can be handy for checking if the compiler is really optimizing out code as expected. + +Or if some change really does't change any functionality. + +The way it works is to get a list of the build commands that would run, and get those commands for the current file. + +Then this command runs, swapping out object creation args for arguments that create the assembly. + +.. note:: It would be nice to open this file, but currently this isnt supported. its just created along side the source. + +.. note:: Currently only GCC is supported.