1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-17 07:54:17 +01:00

OP-910: generate synthetic AuthorsModel.qml using CREDITS.txt

This commit is contained in:
Oleg Semyonov 2013-06-05 16:01:16 +03:00
parent 0a53a1a89d
commit 0018a3c04a
5 changed files with 179 additions and 0 deletions

77
CREDITS.txt Normal file
View File

@ -0,0 +1,77 @@
Connor Abbott
David Ankers
Sergiy Anikeyev
Pedro Assuncao
Fredrik Arvidsson
Werner Backes
Jose Barros
Pete Boehl
David Carlson
James Cotton
Steve Doll
Piotr Esden-Tempski
Richard Flay
Peter Farnworth
Ed Faulkner
Darren Furniss
Frederic Goddeeris
Daniel Godin
Bani Greyling
Nuno Guedes
Erik Gustavsson
Peter Gunnarsson
Dean Hall
Joe Hlebasko
Andy Honecker
Ryan Hunt
Mark James
Sami Korhonen
Thorsten Klose
Hallvard Kristiansen
Edouard Lafargue
Mike Labranche
Fredrik Larsson
Pablo Lema
David Llama
Matt Lipski
Les Newell
Ken Northup
Greg Matthews
Guy McCaldin
Gary Mortimer
Alessio Morale
Cathy Moss
Angus Peart
Dmytro Poplavskiy
Eric Price
Richard Querin
Randy Ram
Philippe Renon
Laurent Ribon
Mathieu Rondonneau
Julien Rouviere
Jackson Russell
Zik Saleeba
Professor Dale Schinstock
Professor Kenn Sebesta
Oleg Semyonov
Stacey Sheldon
Troy Schultz
Dr. Erhard Siegl
Mike Smith
Alex Sowa
Pete Stapley
Vova Starikh
Rowan Taubitz
Andrew Thoms
Philippe Vanhaesendonck
Jasper van Loenen
Vassilis Varveropoulos
Kevin Vertucio
Alex Vrubel
Brian Webb
Justin Welander
Mat Wellington
Kendal Wells
David Willis
Dmitriy Zaitsev

View File

@ -0,0 +1,41 @@
include(../../python.pri)
#
# This qmake code generates AuthorsModel.qml using CREDITS.txt.
#
# This is a bit tricky since the script should be run always and before
# the other dependencies evaluation.
#
# Since debug_and_release option is set, we need this
!debug_and_release|build_pass {
# Define other variables
AUTHORS_SCRIPT = $$GCS_SOURCE_TREE/src/plugins/coreplugin/authorsdialog.py
AUTHORS_COMMAND = $$PYTHON \"$$AUTHORS_SCRIPT\"
AUTHORS_SOURCE = $$ROOT_DIR/CREDITS.txt
AUTHORS_TEMPLATE = $$GCS_SOURCE_TREE/src/plugins/coreplugin/qml/AuthorsModel.qml.template
AUTHORS_DIR = $$GCS_BUILD_TREE/../openpilotgcs-synthetics
AUTHORS_FILE = $$AUTHORS_DIR/AuthorsModel.qml
# Create custom authors target which generates a real file
authors.target = $$AUTHORS_FILE
authors.commands = -$(MKDIR) $$targetPath($$AUTHORS_DIR) $$addNewline()
authors.commands += $$AUTHORS_COMMAND \
--infile=\"$$AUTHORS_SOURCE\" \
--template=\"$$AUTHORS_TEMPLATE\" \
--outfile=\"$$AUTHORS_FILE\"
authors.depends = FORCE
QMAKE_EXTRA_TARGETS += authors
# Hook authors target in between qmake's Makefile update and
# the actual project target
authors_hook.depends = authors
debug_and_release {
CONFIG(debug,debug|release):authors_hook.target = Makefile.Debug
CONFIG(release,debug|release):authors_hook.target = Makefile.Release
} else {
authors_hook.target = Makefile
}
QMAKE_EXTRA_TARGETS += authors_hook
}

View File

@ -0,0 +1,52 @@
#!/usr/bin/env python
#
# Helper function to generate a QML list of contributors
#
# (c) 2013, The OpenPilot Team, http://www.openpilot.org
# See also: The GNU Public License (GPL) Version 3
#
import optparse
import sys
def create_qml_file(args):
"""This function reads input and template files and writes output QML file"""
assert args.infile is not None
assert args.outfile is not None
assert args.template is not None
with open(args.infile, "rt") as input_file:
names = input_file.readlines()
names_list = ""
for name in names:
if name.strip():
names_list += " ListElement { name: \"" + name.strip() + "\" }\n"
with open(args.template, "rt") as template_file, open(args.outfile, "wt") as output_file:
template = template_file.read()
output_file.write(template.replace("${LIST_ELEMENTS}\n", names_list))
return 0
def main():
"""Helper function to generate a QML list of contributors"""
parser = optparse.OptionParser(description = main.__doc__);
parser.add_option('--infile', action='store',
help='name of input file, one name per line');
parser.add_option('--outfile', action='store',
help='name of output QML file');
parser.add_option('--template', action='store',
help='name of QML template file');
(args, positional_args) = parser.parse_args()
if (len(positional_args) != 0) or (len(sys.argv) == 1):
parser.error("incorrect number of arguments, try --help for help")
return create_qml_file(args)
if __name__ == "__main__":
sys.exit(main())

View File

@ -14,6 +14,7 @@ include(../../libs/utils/utils.pri)
include(../../libs/version_info/version_info.pri)
include(../../shared/scriptwrapper/scriptwrapper.pri)
include(coreplugin_dependencies.pri)
include(authorsdialog.pri)
INCLUDEPATH += dialogs \
uavgadgetmanager \

View File

@ -0,0 +1,8 @@
/*
This list model was created for the AuthorsDialog.
*/
import QtQuick 1.1
ListModel {
${LIST_ELEMENTS}
}