2 * Copyright (C) 2014 Dan Dennedy <dan@dennedy.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <QApplication>
23 #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
27 bool createQApplicationIfNeeded(mlt_service service)
30 #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
32 if (getenv("DISPLAY") == 0) {
33 mlt_log_error(service,
34 "The MLT Qt module requires a X11 environment.\n"
35 "Please either run melt from an X session or use a fake X server like xvfb:\n"
36 "xvfb-run -a melt (...)\n" );
40 if (!mlt_properties_get(mlt_global_properties(), "qt_argv"))
41 mlt_properties_set(mlt_global_properties(), "qt_argv", "MLT");
43 static char* argv[] = { mlt_properties_get(mlt_global_properties(), "Qt argv") };
44 new QApplication(argc, argv);
45 const char *localename = mlt_properties_get_lcnumeric(MLT_SERVICE_PROPERTIES(service));
46 QLocale::setDefault(QLocale(localename));