Commit 91961ab45902a14f00134533c27592f7d52c6b1d
1 parent
be351d6a
reintroduced useGui flag so it can be overridden
Showing
2 changed files
with
6 additions
and
7 deletions
openbr/openbr_plugin.cpp
| ... | ... | @@ -895,15 +895,13 @@ bool br::Context::checkSDKPath(const QString &sdkPath) |
| 895 | 895 | // We create our own when the user hasn't |
| 896 | 896 | static QCoreApplication *application = NULL; |
| 897 | 897 | |
| 898 | -void br::Context::initialize(int &argc, char *argv[], QString sdkPath) | |
| 898 | +void br::Context::initialize(int &argc, char *argv[], QString sdkPath, bool useGui) | |
| 899 | 899 | { |
| 900 | 900 | qInstallMessageHandler(messageHandler); |
| 901 | 901 | |
| 902 | -#ifdef _WIN32 | |
| 903 | - bool useGui = true; | |
| 904 | -#else // not _WIN32 | |
| 905 | - bool useGui = (getenv("DISPLAY") != NULL); | |
| 906 | -#endif // _WIN32 | |
| 902 | +#ifndef _WIN32 | |
| 903 | + useGui = useGui && (getenv("DISPLAY") != NULL); | |
| 904 | +#endif // not _WIN32 | |
| 907 | 905 | |
| 908 | 906 | // We take in argc as a reference due to: |
| 909 | 907 | // https://bugreports.qt-project.org/browse/QTBUG-5637 | ... | ... |
openbr/openbr_plugin.h
| ... | ... | @@ -794,11 +794,12 @@ public: |
| 794 | 794 | * By default <tt>share/openbr/openbr.bib</tt> will be searched for relative to: |
| 795 | 795 | * -# The working directory |
| 796 | 796 | * -# The executable's location |
| 797 | + * \param useGui Create a QApplication instead of a QCoreApplication. | |
| 797 | 798 | * \note Tiggers \em abort() on failure to locate <tt>share/openbr/openbr.bib</tt>. |
| 798 | 799 | * \note <a href="http://qt-project.org/">Qt</a> users should instead call this <i>after</i> initializing QApplication. |
| 799 | 800 | * \see finalize |
| 800 | 801 | */ |
| 801 | - static void initialize(int &argc, char *argv[], QString sdkPath = ""); | |
| 802 | + static void initialize(int &argc, char *argv[], QString sdkPath = "", bool useGui = true); | |
| 802 | 803 | |
| 803 | 804 | /*! |
| 804 | 805 | * \brief Call \em once at the end of the application to deallocate global variables. | ... | ... |