build system: remove obsolete translation macros; simplify .ui → .h conversion

The removed macros are outdated and not used anymore.

The simplification of the generation of .h files from .ui files is done
by telling uic to use the QTR macro directly.

This may be a fix for #1812.
This commit is contained in:
Moritz Bunkus 2016-11-20 17:17:24 +01:00
parent 7e52a44c78
commit 28c5f06597
3 changed files with 2 additions and 28 deletions

View File

@ -319,23 +319,7 @@ end
# Qt files
rule '.h' => '.ui' do |t|
temp = Tempfile.new("mkvtoolnix-uic")
begin
temp.close
runq "uic", t.source, "#{c(:UIC)} -tr QPTR #{t.sources.join(" ")} > #{temp.path}"
# Convert calls to QPTR(…, 0) to QT(…)
output = IO.
readlines(temp.path).
map { |line| line.force_encoding("UTF-8").gsub(/QPTR\((.+?\"), 0\)/, 'QTR(\1)') }.
join("")
IO.write(t.name, output, encoding: "UTF-8", mode: "w")
ensure
temp.unlink
end
runq "uic", t.source, "#{c(:UIC)} --translate QTR #{t.sources.join(" ")} > #{t.name}"
end
rule '.cpp' => '.qrc' do |t|
@ -376,14 +360,9 @@ file "po/mkvtoolnix.pot" => $all_sources + $all_headers + $gui_ui_h_files + %w{R
keywords = %w{--keyword=Y --keyword=NY:1,2} # singular & plural forms returning std::string
keywords += %w{--keyword=YF --keyword=NYF:1,2} # singular & plural forms returning std::string which aren't format strings
keywords += %w{--keyword=PY:1c,2} # singular form with context returning std::string
keywords += %w{--keyword=PNY:1c,2,3} # plural form with context returning std::string
keywords += %w{--keyword=YT} # singular form returning translatable_string_c
keywords += %w{--keyword=QTR} # singular form returning QString, used by uic
keywords += %w{--keyword=QPTR:2c,1} # singular form with context returning QString, used by uic
keywords += %w{--keyword=QY --keyword=QNY:1,2} # singular & plural forms returning QString
keywords += %w{--keyword=QPY:1c,2} # singular form with context returning QString
keywords += %w{--keyword=QPNY:1c,2,3} # plural form with context returning QString
keywords += %w{--keyword=QYH} # singular form returning HTML-escaped QString
flags = %w{--flag=QY:1:no-c-format --flag=QNY:1:no-c-format}

View File

@ -78,15 +78,11 @@ namespace brng = boost::range;
# if !defined Y
# define Y(s) gettext(s)
# define NY(s_singular, s_plural, count) ngettext(s_singular, s_plural, count)
# define PY(context, s) pgettext(context, s)
# define PNY(context, s_singular, s_plural, count) pngettext(context, s_singular, s_plural, count)
# endif
#else /* HAVE_LIBINTL_H */
# if !defined Y
# define Y(s) (s)
# define NY(s_singular, s_plural, count) ((count) != 1 ? (s_plural) : (s_singular))
# define PY(context, s) (s)
# define PNY(context, s_singular, s_plural, count) ((count) != 1 ? (s_plural) : (s_singular))
# endif
#endif

View File

@ -24,8 +24,7 @@
#define QY(s) to_qs(Y(s))
#define QYH(s) to_qs(Y(s)).toHtmlEscaped()
#define QNY(singular, plural, count) to_qs(NY(singular, plural, count))
#define QTR(s) to_qs(Y(s))
#define QPTR(s, context) to_qs(PY(context, s))
#define QTR(s, dummy) to_qs(Y(s))
inline QChar
to_qs(char const source) {