git-svn-id: svn://ultimatepp.org/upp/trunk@2400 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-05-17 07:07:00 +00:00
commit a8a2e0ac7e
13 changed files with 262 additions and 0 deletions

View file

@ -0,0 +1,17 @@
target
libtest.so;
library
"QtCore QtGui";
options
"-DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -lQtGui -lQtCore";
options(GCC) -fPIC;
file
main.cpp;
mainconfig
"" = "DLL";

View file

@ -0,0 +1,3 @@
#ifndef _UppTestLib_icpp_init_stub
#define _UppTestLib_icpp_init_stub
#endif

View file

@ -0,0 +1,56 @@
#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