ultimatepp/uppdev/Testcase/UppTestLib/main.cpp
cxl 2e4b276e07 Merge continued
git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2016-10-04 08:34:39 +00:00

56 lines
766 B
C++

#include <QtGui/QtGui>
#include <QtGui/QStyle>
#include <X11/X.h>
#include <iostream>
// #define LOG(str)
#define LOG(str) std::clog << str << std::endl
#if defined(__cplusplus)
extern "C" {
#endif
static bool initted = false;
QApplication *app = 0;
int Init()
{
if (!initted) {
int argc = 1;
char *argv[] = {"qapp", NULL};
if (!QApplication::instance()) {
app = new QApplication(argc, argv);
if (app) {
initted = true;
LOG("Init()");
return true;
}
} else {
initted = true;
return true;
}
return false;
}
}
int IsInitted()
{
LOG("IsInitted()");
return initted;
}
void UnInit()
{
if (initted) {
if (app) {
delete app;
app = 0;
}
initted = false;
}
LOG("UnInit()");
}
#if defined(__cplusplus)
}
#endif