How to make Qt support HTML 5 database? - c++

I am using Qt 4.7.1 and embedded a webview in my app. But I got the following error when trying to visit http://webkit.org/demos/sticky-notes/ to test the HTML 5 database feature
Failed to open the database on disk. This is probably because the version
was bad or there is not enough space left in this domain's quota
I compiled my static Qt library with the following command:
configure --prefix=/usr/local/qt-static-release-db --accessibility --multimedia
--audio-backend --svg --webkit --javascript-jit --script --scripttools
--declarative --release -nomake examples -nomake demos --static --openssl -I
/usr/local/ssl/include -L /usr/local/ssl/lib -confirm-license -sql-qsqlite
-sql-qmysql -sql-qodbc

Check QWebSettings documentation.
In particular, you have to use setAttribute to enable QWebSettings::OfflineStorageDatabaseEnabled and point out the local storage location using setOfflineStoragePath (e.g. QDesktopServices::DataLocation).
You might want to do it per-page, but as an example, doing it globally can be done using:
QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
QWebSettings::globalSettings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));

Related

Breakpad Client not generated when cross-compiling

I'm trying to cross-compile Google Breakpad. I'm executing the following commands:
$ ./configure --prefix=/opt/breakpad CFLAGS="-Os" CC=PATH_ARM_COMPILER/arm-linux-gcc CXX=PATH_ARM_COMPILER/arm-linux-g++ --host=arm
$ make
$ make install
It generates and installs some files in the prefix path. In the include path it has:
|-common
|-google_breakpad
|-processor
but it should has:
|-client
|-common
|-google_breakpad
|-processor
|-third_party
It seems to be a problem related to Breakpad client. What should be the right way to cross-compile Breakpad?
My host is a Ubuntu 18.04 x86-64, target ARM-32.
I have reproduced your problem on my side. In fact, the issue is related to --host compilation flag.
Breakpad documentation shows that:
when building on Linux it will also build the client libraries.
So, In order to get the client binaries and headers, you should use the correct compiler prefix.
For example if you are using the GNU cross compiler arm-linux-gnueabihf-gcc, the --host flag value should be arm-linux-gnueabihf.
In your case (arm-linux-gcc) try to change your configure command as following:
./configure --prefix=/opt/breakpad CFLAGS="-Os" CC=PATH_ARM_COMPILER/arm-linux-gcc CXX=PATH_ARM_COMPILER/arm-linux-g++ --host=arm-linux

Gstreamer qmlgl plug-in enable via Yocto

I would like to use qmlgl plug-in (qmlglsink, qmlglsrc) in my application, but it is not available in the image.
Also, my environment is ARM-based board - Phytec_nunki.
gst-inspect-1.0 | grep qml does not receive any result.
I use Yocto for building images. As I understand from this link - qmlgl is located in "GStreamer Good Plug-in" bunch, but it is not enables by default.
I inspected the sources of gstreamer which is downloaded by Yocto - the files with "qmlgl" are there. So I guess I have to enable it in some config file.
I tried to add
CORE_IMAGE_EXTRA_INSTALL += " \
gst-plugins-good-qmlgl\
"
into my local.conf file. Bitbake was executed successfully but the plug-in was not appeared.
So, does anyone have an idea for solving it?
#UncleSav using your own layer, do:
Example your layer is meta-xpto.
meta-xpto/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend
Inside the .bbappend add:
inherit qmake5_paths
PACKAGECONFIG[qt5] = '--enable-qt \
--with-moc="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/moc" \
--with-uic="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/uic" \
--with-rcc="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/rcc" \
,--disable-qt,gstreamer1.0-plugins-base qtbase qtdeclarative qtbase-native'
PACKAGECONFIG_append = "qt5"
With this change, we inform gstreamer1.0-plugins-good that we want to compile with the qt flag and inform the necessary dependencies.
Additionally, if you are using i.MX8 with newer BSPs especially with 5.x Linux kernel, the packageconfig option should be:
QT5WAYLANDDEPENDS = "${#bb.utils.contains("DISTRO_FEATURES", "wayland", "qtwayland", "", d)}"
PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native ${QT5WAYLANDDEPENDS}"
PACKAGECONFIG_append = "qt5"

Qt static compile cannot read path

i use Qt5.6.0 msvc , and vs 2013, and install python-2.7.12 also, when I compile Qt to build static, i get this error,
Note: driver E not the main drive
Cannot read E:/Qt/qt-everywhere-opensource-src-5.6.0/qtbase/mkspecs /win32-msvc20
13 /qmake.conf: The system cannot find the path specified.
Could not read qmake configuration file E:/Qt/qt-everywhere-opensource-src-5.6.0
/qtbase/mkspecs/win32-msvc2013 /qmake.conf.
Error processing project file: E:\Qt\qt-everywhere-opensource-src-5.6.0\qt.pro
Qmake failed, return code 3
this is the what i used in Developer Command Prompt for VS2013
- set QMAKESPEC=win32-msvc2013
- set QTDIR=E:\Qt\QT-EVE~1.0\qtbase
- set PATH=E:\Qt\QT-EVE~1.0\qtbase\bin;%PATH%
- set PYTHONPATH=%E:\Python27%;E:\Python27\Lib
- cd E:\Qt\qt-everywhere-opensource-src-5.6.0
- configure -static -platform win32-msvc2013 -nomake examples -nomake tests -mp
ok problem solved, Just add in Environment Variables shorted path for Qt
E:\Qt\QT-EVE~1.0\qtbase\bin;%PATH%;E:\Python27;E:\Python27\Lib

Connecting Redland to Virtuoso through Virtuoso's ODBC/iODBC on MacOS X Environment

In order to install Virtuoso on my MacOS X environment, i used the brew port, that is:
brew install virtuoso
By doing so, it automatically installed some ODBC/iODBC drivers, that could not be overwritte by any other unixodbc setup. In particular if I try to link such library:
$ brew link unixodbc
Linking /usr/local/Cellar/unixodbc/2.3.4...
Error: Could not symlink bin/isql
Target /usr/local/bin/isql
is a symlink belonging to virtuoso. You can unlink it:
brew unlink virtuoso
To force the link and overwrite all conflicting files:
brew link --overwrite unixodbc
To list all files that would be deleted:
brew link --overwrite --dry-run unixodbc
By the way, I do not want to unlink this version. So I tried to compile Redland from scratch and download it from GitHub. In particular, I used two possible configurations:
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-virtuoso --with-odbc=/usr/local/Cellar/virtuoso/7.2.4.2
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-virtuoso --with-iodbc=/usr/local/Cellar/virtuoso/7.2.4.2
After adding rdf_hash_internal.h and rdf_heuristics.h in my project manually, everything just goes smoothly and everything gets both compiled and linked. In my C++ app, I'm trying to access the database with the following code:
world = librdf_new_world();
librdf_world_open(world);
storage = librdf_new_storage(world,"virtuoso",graphName.c_str(),"dsn='Local Virtuoso',user='dba',password='dba'");
model = librdf_new_model(world,storage,NULL);
context_node = librdf_new_node_from_uri_string(world,(const unsigned char*)defaultContext.c_str());
/* librdf_model_transaction_commit(this->super->model) */
librdf_model_size(super->model)
If either I disable the transaction or not, anyway I got the following error at line 941 of "rdf_storage_virtuoso.c":
rc = SQLDriverConnect(connection->hdbc, 0,(UCHAR *) context->conn_str,
SQL_NTS, context->outdsn,
LIBRDF_VIRTUOSO_CONTEXT_DSN_SIZE,
&buflen, SQL_DRIVER_COMPLETE);
Hence, I suppose there is a connection error at the ODBC/iODBC level. By the way, I could connect to virtuoso with the following command:
$ isql localhost:1111 dba dba
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL>
Is there any way to connect the Redland library with ODBC library by Virtuoso? Thanks in advance.
All those troubles were due to a configuration issue that AFIK was described in no guide (Correct me if I'm wrong, I'd like to find more details on both Virtuoso and Redland/librdf). Hereby, as I told in the comments, the problem was in ODBC, but the reason was that there is no mention in no Virtuoso guide how to configure their driver. This is the way to go:
/Library/ODBC/odbc.ini
[ODBC Data Sources]
VOS = virtuoso-odbc
[VOS]
Driver = /usr/local/Cellar/virtuoso/7.2.4.2/lib/virtodbc.so
Description = Virtuoso Open-Source Edition
Address = localhost:1111
UserName = dba
User = dba
/Library/ODBC/odbcinst.ini
[ODBC Drivers]
virtuoso-odbc = Installed
[virtuoso-odbc]
Driver = /usr/local/Cellar/virtuoso/7.2.4.2/lib/virtodbc.so
Consequently, even the configuration parameters required to access through Redland has to change.
storage=librdf_new_storage(world, "virtuoso","db1","dsn='VOS',user='dba',password='dba'");
Where VOS is the configuration definition within ODBC.
Moreover, the specific ContextNode specifies which is the Named Graph to be used.
I don't know much about brew, but is it possible to modify its package-definition so that it renames our isql binary, e.g. to isql-vt instead?
We already do this in our Debian/Ubuntu packaging by calling
./configure --program-transform-name='s/isql$$/isql-vt/;s/isqlw/isqlw-vt/'
See https://github.com/openlink/virtuoso-opensource/blob/develop/7/debian/rules#L31
I don't see the error you get from line 941, but two things concerning ODBC connections:
1) your --with-iodbc= must point to a copy of iodbc, not to virtuoso (you can get it from http://iodbc.org/ or your distribution probably has a package e.g. libiodbc2-dev on debian/ubuntu)
2) Virtuoso's isql tests a direct connection to virtuoso; to check that the driver manager is configured properly, use iodbctest (or unixODBC's isql that caused the conflict above in the first place).
First thing, iODBC is the ODBC driver manager Apple builds into OS X, and users are usually better off sticking with it -- though we (OpenLink Software, maintainers of iODBC) do recommend updating to the curent version, as Apple is typically many updates behind.
Related to that, Apple doesn't bundle the full iODBC SDK. They leave out the Frameworks, among other things.
Generally speaking, UnixODBC doesn't fully integrate with GUI-space OS X apps nor drivers, and there are various other issues that surface over time. Current iODBC doesn't care whether you're working in GUI or command-line, Carbon or Cocoa, 32-bit or 64-bit... It all just works (and if it doesn't work, we want to know, so we can fix it).
MacPorts and other packagers I've used have had ways to switch between UnixODBC and iODBC (e.g., variants); I can't quickly find such for Homebrew, but maybe you can?

How to create a Linux desktop icon cross desktop (KDE, GNOME) with xdg-desktop-icon?

I'd like to use the xdg-desktop-icon tool because it can be scripted and works cross desktop (at least on Linux with Gnome and KDE). At least it is supposed to do so according to freedesktop.org. 1
Made a minimal file: test.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=test
Icon=test
Name=test
Used xdg-desktop-icon...
xdg-desktop-icon install --novendor test.desktop
Exit code is 0. (Success.) But... I do not see any new icons on my desktop. Also not after reboot. This failed on Ubuntu Precise 12.04 with KDE and on Debian Wheezy with KDE.
How to use the xdg-desktop-icon tool correctly?
The problem on KDE has something to do with the desktop settings. Folder view, Newspaper view and so on.
xdg-desktop-icon relies on xdg-user-dir to determine the user desktop directory. You can check either against that command and the settings of your file manager (or program handling the desktop).
Assuming by default it would be /home/user/Desktop, then you have to check the file name there. If the file is there, then xdg-desktop-icon is working as expected.
You have to consider that the icon (test in your case) has to be installed separately using xdg-icon-resource. That is, if you are not using a stock icon or custom icon already installed or you are not using an absolute path for the icon.
Do not forget that xdg-desktop-icon only copies the .desktop file in a specific directory. No more no less.
If I am working on ~/myapp directory, I would check by doing:
$ xdg-user-dir
/home/user/Desktop
$ ls `xdg-user-dir`/test.desktop
ls: cannot access /home/user/Desktop/test.desktop: No such file or directory
$ xdg-desktop-icon install --novendor test.desktop
$ ls `xdg-user-dir`/test.desktop
/home/user/Desktop/test.desktop
Eventually, you can run with any xdg- script with:
$ XDG_DEBUG_LEVEL=1 xdg-desktop-icon ...
Which will give you an extra line telling you where the desktop file was installed. At this point, if the icon has not been installed, it might appear an ugly default icon.