/*************************************************************************** main.cpp (c) 2000-2012 BenoƮt Minisini 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 the Free Software Foundation; either version 2, or (at your option) 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 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ #define __MAIN_CPP #include #include #include #include #include #include "ccookiejar.h" #include "cwebhittest.h" #include "cwebsettings.h" #include "cwebelement.h" #include "cwebframe.h" #include "cwebdownload.h" #include "cwebview.h" #include "main.h" extern "C" { GB_INTERFACE GB EXPORT; QT_INTERFACE QT; GB_DESC *GB_CLASSES[] EXPORT = { CWebDownloadDesc, CWebDownloadsDesc, CWebHitTestDesc, CCookieDesc, CWebSettingsIconDatabaseDesc, CWebSettingsCacheDesc, CWebSettingsFontsDesc, CWebSettingsProxyDesc, CWebSettingsDesc, WebElementStyleDesc, WebElementDesc, CWebFrameChildrenDesc, CWebFrameDesc, CWebViewSettingsDesc, CWebViewAuthDesc, CWebViewDesc, NULL }; int EXPORT GB_INIT(void) { GB.GetInterface("gb.qt4", QT_INTERFACE_VERSION, &QT); return 0; } void EXPORT GB_EXIT() { } } 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(); }