-From:
-http://iconeden.com/icon/milky-a-free-vector-iconset.html
-
-License Agreement
-
-This is a legal agreement between you (the downloader) and IconEden.com. On download of any royalty-free icons from our website you agree to the following:
-
-All of the icons remain the property of IconEden.com. The icons can be used royalty-free by the license for any personal or commercial project including web application, web design, software application, mobile application, documentation, presentation, computer game, advertising, film, video.
-
-You may modify the icons in shape, color, and/or file format and use the modified icons royalty-free according to the license terms for any personal or commercial product.
-
-The license does not permit the following uses:
-
- 1. The icons may not be resold, sublicensed, rented, transferred or otherwise made available for use or detached from a product, software application or web page;
- 2. The icons may not be placed on any electronic bulletin board or downloadable format;
-
-You may not use, or allow anyone else to use the icons to create pornographic, libelous, obscene, or defamatory material.
-
+From:\r
+http://iconeden.com/icon/milky-a-free-vector-iconset.html\r
+\r
+License Agreement\r
+\r
+This is a legal agreement between you (the downloader) and IconEden.com. On download of any royalty-free icons from our website you agree to the following:\r
+\r
+All of the icons remain the property of IconEden.com. The icons can be used royalty-free by the license for any personal or commercial project including web application, web design, software application, mobile application, documentation, presentation, computer game, advertising, film, video.\r
+\r
+You may modify the icons in shape, color, and/or file format and use the modified icons royalty-free according to the license terms for any personal or commercial product.\r
+\r
+The license does not permit the following uses:\r
+\r
+ 1. The icons may not be resold, sublicensed, rented, transferred or otherwise made available for use or detached from a product, software application or web page;\r
+ 2. The icons may not be placed on any electronic bulletin board or downloadable format;\r
+\r
+You may not use, or allow anyone else to use the icons to create pornographic, libelous, obscene, or defamatory material.\r
+\r
All icon files are provided "as is". You agree not to hold IconEden.com liable for any damages that may occur due to use, or inability to use, icons or image data from IconEden.com.
\ No newline at end of file
#include <window_QT.h>
//Static and global first
-static GuiReceiver guiMainThread;
+static GuiReceiver *guiMainThread = NULL;
static int parameterSystemC = 1;
static char* parameterSystemV[] = {""};
static bool multiThreads = false;
CV_IMPL void cvAddText( CvArr* img, const char* text, CvPoint org, CvFont* font)
{
- QMetaObject::invokeMethod(&guiMainThread,
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"putText",
Qt::AutoConnection,
Q_ARG(void*, (void*) img),
double cvGetRatioWindow_QT(const char* name)
{
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
double result = -1;
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"getRatioWindow",
//Qt::DirectConnection,
Qt::AutoConnection,
void cvSetRatioWindow_QT(const char* name,double prop_value)
{
- QMetaObject::invokeMethod(&guiMainThread,
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"setRatioWindow",
Qt::AutoConnection,
Q_ARG(QString, QString(name)),
double cvGetPropWindow_QT(const char* name)
{
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
double result = -1;
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"getPropWindow",
//Qt::DirectConnection,
Qt::AutoConnection,
void cvSetPropWindow_QT(const char* name,double prop_value)
{
- QMetaObject::invokeMethod(&guiMainThread,
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"setPropWindow",
Qt::AutoConnection,
Q_ARG(QString, QString(name)),
void cvSetModeWindow_QT(const char* name, double prop_value)
{
- QMetaObject::invokeMethod(&guiMainThread,
+
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"toggleFullScreen",
Qt::AutoConnection,
Q_ARG(QString, QString(name)),
double cvGetModeWindow_QT(const char* name)
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
double result = -1;
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"isFullScreen",
Qt::AutoConnection,
Q_RETURN_ARG(double, result),
CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"displayInfo",
Qt::AutoConnection,
//Qt::DirectConnection,
CV_IMPL void cvSaveWindowParameters(const char* name)
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"saveWindowParameters",
Qt::AutoConnection,
Q_ARG(QString, QString(name)));
CV_IMPL void cvLoadWindowParameters(const char* name)
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"loadWindowParameters",
Qt::AutoConnection,
Q_ARG(QString, QString(name)));
CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"displayStatusBar",
Qt::AutoConnection,
//Qt::DirectConnection,
//cannot use wait here because events will not be distributed before processEvents (the main eventLoop is broken)
//so I create a Thread for the QTimer
- QTimer timer(&guiMainThread);
- QObject::connect(&timer, SIGNAL(timeout()), &guiMainThread, SLOT(timeOut()));
+ QTimer timer(guiMainThread);
+ QObject::connect(&timer, SIGNAL(timeout()), guiMainThread, SLOT(timeOut()));
timer.setSingleShot(true);
if (arg>0)
//QMutex dummy;
- while(!guiMainThread._bTimeOut)
+ while(!guiMainThread->_bTimeOut)
{
qApp->processEvents(QEventLoop::AllEvents);
}
}
- guiMainThread._bTimeOut = false;
+ guiMainThread->_bTimeOut = false;
}
{
multiThreads = true;
QFuture<int> future = QtConcurrent::run(pt2Func,argc,argv);
- return guiMainThread.start();
+ return guiMainThread->start();
}
CV_IMPL void cvStopLoop()
CV_IMPL int cvNamedWindow( const char* name, int flags )
{
+ if (!guiMainThread)
+ guiMainThread = new GuiReceiver;
+
if (multiThreads)
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"createWindow",
//Qt::AutoConnection,
Qt::BlockingQueuedConnection,
Q_ARG(QString, QString(name)),
Q_ARG(int, flags));
else
- guiMainThread.createWindow(QString(name),flags);
+ guiMainThread->createWindow(QString(name),flags);
return 1;//Dummy value
}
CV_IMPL void cvDestroyWindow( const char* name )
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"destroyWindow",
//Qt::BlockingQueuedConnection,
Qt::AutoConnection,
CV_IMPL void cvDestroyAllWindows(void)
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"destroyAllWindow",
//Qt::BlockingQueuedConnection,
Qt::AutoConnection
);
-
}
CV_IMPL void* cvGetWindowHandle( const char* name )
CV_IMPL void cvMoveWindow( const char* name, int x, int y )
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"moveWindow",
//Qt::BlockingQueuedConnection,
Qt::AutoConnection,
CV_IMPL void cvResizeWindow(const char* name, int width, int height )
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"resizeWindow",
//Qt::BlockingQueuedConnection,
Qt::AutoConnection,
CV_IMPL int cvCreateTrackbar( const char* name_bar, const char* window_name, int* value, int count, CvTrackbarCallback on_change)
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"addSlider",
Qt::AutoConnection,
Q_ARG(QString, QString(name_bar)),
CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, void* userdata , int button_type, int initial_button_state )
{
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
if (initial_button_state < 0 || initial_button_state > 1)
return 0;
- QMetaObject::invokeMethod(&guiMainThread,
+ QMetaObject::invokeMethod(guiMainThread,
"addButton",
Qt::AutoConnection,
Q_ARG(QString, QString(button_name)),
CV_IMPL void cvCreateOpenGLCallback( const char* window_name, CvOpenGLCallback callbackOpenGL, void* userdata, double angle, double zmin, double zmax)
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
+
+ QMetaObject::invokeMethod(guiMainThread,
"setOpenGLCallback",
Qt::AutoConnection,
Q_ARG(QString, QString(window_name)),
CV_IMPL void cvShowImage( const char* name, const CvArr* arr )
{
- QMetaObject::invokeMethod(&guiMainThread,
+ if (!guiMainThread)
+ guiMainThread = new GuiReceiver;
+
+ QMetaObject::invokeMethod(guiMainThread,
"showImage",
//Qt::BlockingQueuedConnection,
Qt::DirectConnection,
GuiReceiver::GuiReceiver() : _bTimeOut(false)
{
icvInitSystem();
- qApp->setQuitOnLastWindowClosed ( false );//maybe the user would like to access this setting
+ //qApp->setQuitOnLastWindowClosed ( false );//maybe the user would like to access this setting
}
void GuiReceiver::putText(void* arg1, QString text, QPoint org, void* arg2)
#endif
//Now disable matrixWorld for overlay display
- //myPainter.setWorldMatrixEnabled (false );
+ myPainter.setWorldMatrixEnabled (false );
//in mode zoom/panning
if (param_matrixWorld.m11()>1)