2009-07-23 18:53:06 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
main.cpp
|
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
2009-07-23 18:53:06 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2009-07-23 18:53:06 +02:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2009-07-23 18:53:06 +02:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#define __MAIN_CPP
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-11-30 22:56:58 +01:00
|
|
|
#include <QDateTime>
|
|
|
|
|
2010-11-11 18:43:14 +01:00
|
|
|
#include "ccookiejar.h"
|
|
|
|
#include "cwebhittest.h"
|
2009-07-25 02:56:59 +02:00
|
|
|
#include "cwebsettings.h"
|
2012-11-30 22:56:58 +01:00
|
|
|
#include "cwebelement.h"
|
2009-07-24 15:05:24 +02:00
|
|
|
#include "cwebframe.h"
|
2010-11-13 00:42:01 +01:00
|
|
|
#include "cwebdownload.h"
|
2009-07-23 18:53:06 +02:00
|
|
|
#include "cwebview.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
GB_INTERFACE GB EXPORT;
|
|
|
|
QT_INTERFACE QT;
|
|
|
|
|
|
|
|
GB_DESC *GB_CLASSES[] EXPORT =
|
|
|
|
{
|
2010-11-13 00:42:01 +01:00
|
|
|
CWebDownloadDesc,
|
|
|
|
CWebDownloadsDesc,
|
2010-11-11 18:43:14 +01:00
|
|
|
CWebHitTestDesc,
|
|
|
|
CCookieDesc,
|
2009-07-25 02:56:59 +02:00
|
|
|
CWebSettingsIconDatabaseDesc,
|
2009-12-07 18:14:32 +01:00
|
|
|
CWebSettingsCacheDesc,
|
2011-08-24 09:26:09 +02:00
|
|
|
CWebSettingsFontsDesc,
|
2011-08-20 17:06:56 +02:00
|
|
|
CWebSettingsProxyDesc,
|
2009-07-25 02:56:59 +02:00
|
|
|
CWebSettingsDesc,
|
2012-11-30 22:56:58 +01:00
|
|
|
WebElementStyleDesc,
|
|
|
|
WebElementDesc,
|
2009-07-24 15:05:24 +02:00
|
|
|
CWebFrameChildrenDesc,
|
|
|
|
CWebFrameDesc,
|
2009-07-25 02:56:59 +02:00
|
|
|
CWebViewSettingsDesc,
|
|
|
|
CWebViewAuthDesc,
|
2010-11-13 00:42:01 +01:00
|
|
|
CWebViewDesc,
|
2009-07-23 18:53:06 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
int EXPORT GB_INIT(void)
|
|
|
|
{
|
|
|
|
GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT);
|
2010-01-10 14:40:48 +01:00
|
|
|
return 0;
|
2009-07-23 18:53:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EXPORT GB_EXIT()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-11-30 22:56:58 +01:00
|
|
|
void MAIN_return_qvariant(const QVariant &result)
|
|
|
|
{
|
|
|
|
GB_DATE date;
|
|
|
|
GB_DATE_SERIAL ds;
|
|
|
|
QDateTime qdate;
|
|
|
|
|
|
|
|
switch (result.type())
|
|
|
|
{
|
|
|
|
case QVariant::Bool:
|
|
|
|
GB.ReturnBoolean(result.toBool());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QVariant::Date:
|
|
|
|
case QVariant::DateTime:
|
|
|
|
qdate = result.toDateTime();
|
|
|
|
ds.year = qdate.date().year();
|
|
|
|
ds.month = qdate.date().month();
|
|
|
|
ds.day = qdate.date().day();
|
|
|
|
ds.hour = qdate.time().hour();
|
|
|
|
ds.min = qdate.time().minute();
|
|
|
|
ds.sec = qdate.time().second();
|
|
|
|
ds.msec = qdate.time().msec();
|
|
|
|
GB.MakeDate(&ds, &date);
|
|
|
|
GB.ReturnDate(&date);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QVariant::Double:
|
|
|
|
GB.ReturnFloat(result.toDouble());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QVariant::Int:
|
|
|
|
case QVariant::UInt:
|
|
|
|
GB.ReturnInteger(result.toInt());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QVariant::LongLong:
|
|
|
|
case QVariant::ULongLong:
|
|
|
|
GB.ReturnLong(result.toLongLong());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QVariant::String:
|
|
|
|
GB.ReturnNewZeroString(TO_UTF8(result.toString()));
|
|
|
|
break;
|
|
|
|
|
|
|
|
// TODO: Handle these three datatypes
|
|
|
|
case QVariant::Hash:
|
|
|
|
case QVariant::List:
|
|
|
|
case QVariant::RegExp:
|
|
|
|
default:
|
|
|
|
GB.ReturnNull();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GB.ReturnConvVariant();
|
|
|
|
}
|
|
|
|
|