Use QSettings to lookup location of schema files #34

Merged
merged 2 commits into from Apr 6, 2012
View
@@ -1,29 +1,22 @@
-INCLUDE_DIR :=${STAGING_DIR}/include
-STAGING_INCDIR := ${INCLUDE_DIR}
-LIB_DIR :=${STAGING_DIR}/lib
-STAGING_LIBDIR := ${LIB_DIR}
-STAGING_BINDIR_NATIVE ?=${STAGING_DIR}/bin
+STAGING_INCDIR := ${STAGING_DIR}/include
+STAGING_LIBDIR := ${STAGING_DIR}/lib
ISIS_ROOT_DIR := ${HOME}/.isis
BUILD_TYPE := debug
PLATFORM ?= x86
MACHINE := desktop
-MOC := ${STAGING_BINDIR_NATIVE}/moc
+MOC := ${QT_INSTALL_PREFIX}/bin/moc
INCLUDES := \
- -isystem $(INCLUDE_DIR) \
- -isystem $(INCLUDE_DIR)/webkit \
+ -isystem $(STAGING_INCDIR) \
+ -isystem $(STAGING_INCDIR)/webkit \
-I./Src \
-I./Yap \
- -I$(INCLUDE_DIR) \
- -I$(INCLUDE_DIR)/ime \
- -I$(INCLUDE_DIR)/Qt \
- -I$(INCLUDE_DIR)/QtCore \
- -I$(INCLUDE_DIR)/QtGui \
- -I$(INCLUDE_DIR)/QtNetwork \
- -I$(INCLUDE_DIR)/QtWebKit \
- -I$(INCLUDE_DIR)/WebKitSupplemental \
+ -I$(STAGING_INCDIR) \
+ -I$(STAGING_INCDIR)/ime \
+ -I$(STAGING_INCDIR)/QtWebKit \
+ -I$(STAGING_INCDIR)/WebKitSupplemental \
-I$(QT_INSTALL_PREFIX)/include/ \
-I$(QT_INSTALL_PREFIX)/include/Qt \
-I$(QT_INSTALL_PREFIX)/include/QtCore \
@@ -33,7 +26,7 @@ INCLUDES := \
LIBS := \
-L$(QT_INSTALL_PREFIX)/lib \
- -L$(LIB_DIR) \
+ -L$(STAGING_LIBDIR) \
-lQtWebKit \
-lQtGui \
-lQtNetwork \
@@ -54,7 +47,7 @@ else
FLAGS_OPT := -O2 $(FLAGS_OPT)
endif
-LOCAL_CFLAGS := $(CXXFLAGS) -Wall -Werror $(FLAGS_OPT) -DQT_WEBOS
+LOCAL_CFLAGS := $(CXXFLAGS) -Wall -Werror $(FLAGS_OPT) -DQT_WEBOS -DISIS_DESKTOP
LOCAL_LFLAGS := $(LDFLAGS) $(FLAGS_OPT) $(LIBS)
@@ -116,21 +109,23 @@ stage: $(TARGET_APP) $(OBJDIR)/libYap.a
install -m 444 Src/BrowserOffscreenCalculations.h $(STAGING_INCDIR)
install -d $(STAGING_LIBDIR)
install -m 444 $(OBJDIR)/libYap.a $(STAGING_LIBDIR)/libYap.a
- mkdir -p $(LUNA_STAGING)/bin
- install -m 0775 $(BUILD_TYPE)-$(PLATFORM)/BrowserServer $(STAGING_DIR)/bin/BrowserServer
- mkdir -p $(ISIS_ROOT_DIR)/etc/palm
- install -m 0755 BrowserServer.conf $(ISIS_ROOT_DIR)/etc/palm/BrowserServer.conf
+ mkdir -p $(STAGING_DIR)/bin
+ install -m 0775 $(TARGET_APP) $(STAGING_DIR)/bin/BrowserServer
+ mkdir -p $(ISIS_ROOT_DIR)/conf
+ install -m 644 BrowserServer.conf $(ISIS_ROOT_DIR)/conf
+ install -m 644 schema/HitTest.schema $(ISIS_ROOT_DIR)/conf
+ install -m 644 schema/InteractiveWidgetRect.schema $(ISIS_ROOT_DIR)/conf
$(TARGET_LIB): $(LIB_OBJS)
$(AR) rcs $(TARGET_LIB) $(LIB_OBJS)
$(TARGET_APP): $(APP_OBJS) $(TARGET_LIB)
$(CXX) -o $(TARGET_APP) $(APP_OBJS) $(LIB_OBJS) $(LOCAL_LFLAGS)
-qwebkitplatformplugin.moc.cpp: $(INCLUDE_DIR)/WebKitSupplemental/qwebkitplatformplugin.h
+qwebkitplatformplugin.moc.cpp: $(STAGING_INCDIR)/WebKitSupplemental/qwebkitplatformplugin.h
$(MOC) -o $@ $<
-WebOSPlatformPlugin.moc.cpp: $(INCLUDE_DIR)/WebKitSupplemental/WebOSPlatformPlugin.h
+WebOSPlatformPlugin.moc.cpp: $(STAGING_INCDIR)/WebKitSupplemental/WebOSPlatformPlugin.h
$(MOC) -o $@ $<
BrowserComboBox.moc.cpp: BrowserComboBox.h
@@ -155,8 +150,9 @@ $(OBJDIR)/%.o: %.cpp
.PHONY: clean
clean:
rm -rf $(OBJDIR)
- rm -rf $(STAGING_INCDIR)/Yap
rm -f $(OBJDIR)/libYap.a
+ rm -rf $(STAGING_INCDIR)/Yap
+ rm -rf $(STAGING_INCDIR)/Yap
rm -f $(STAGING_LIBDIR)/libYap.a
rm -f $(TARGET_APP)
rm -f BrowserPage.moc.cpp
@@ -165,10 +161,6 @@ clean:
rm -f qwebkitplatformplugin.moc.cpp
rm -f WebOSPlatformPlugin.moc.cpp
-.PHONY: install
-install:
- mkdir -p $(INSTALL_DIR)/usr/bin
- install -m 0775 $(BUILD_TYPE)-$(PLATFORM)/BrowserServer $(INSTALL_DIR)/usr/bin/BrowserServer
CodeGen/CodeGen: CodeGen/YapCodeGen.cpp CodeGen/BrowserYapCommandMessages.defs
bash -c "pushd CodeGen && qmake && popd"
View
@@ -34,6 +34,7 @@ LICENSE@@@ */
#include <QtGui>
#include <QtNetwork>
+#include <QtCore/QSettings>
#include <qpersistentcookiejar.h>
#include <qwebevent.h>
@@ -2765,9 +2766,12 @@ void BrowserPage::addInteractiveWidgetRect(uintptr_t id, int x, int y, int width
rectArrayJson.append(rectJson);
+ QSettings settings;
+ QString schemaFile = settings.value("InteractiveWidgetRectSchema").toString();
+
std::string result;
- if (!jValueToJsonStringUsingSchemaFile(result, rectArrayJson, "/etc/palm/browser/InteractiveWidgetRect.schema")) {
- BERR("Error generating JSON");
+ if (!jValueToJsonStringUsingSchemaFile(result, rectArrayJson, qPrintable(schemaFile))) {
+ BERR("Error generating JSON.\nSchema file: %s", qPrintable(schemaFile));
} else {
BDBG("Generated JSON:\n %s\n", result.c_str());
// send json string to BrowserAdapter
@@ -49,6 +49,7 @@ LICENSE@@@ */
#include "qwebkitplatformplugin.h"
#include "WebOSPlatformPlugin.h"
+#include <QtCore/QSettings>
#ifdef USE_CERT_MGR
#include <cert_mgr.h>
@@ -1791,9 +1792,12 @@ void BrowserServer::asyncCmdHitTest(YapProxy *proxy, int32_t queryNum, int32_t c
}
}
+ QSettings settings;
+ QString schemaFile = settings.value("HitTestSchema").toString();
+
std::string json;
- if (!jValueToJsonStringUsingSchemaFile(json, obj, "/etc/palm/browser/HitTest.schema")) {
- BERR("Error generating JSON");
+ if (!jValueToJsonStringUsingSchemaFile(json, obj, qPrintable(schemaFile))) {
+ BERR("Error generating JSON.\nSchema file: %s", qPrintable(schemaFile));
} else {
BDBG("Generated JSON:\n %s\n", json.c_str());
msgHitTestResponse(proxy, queryNum, json.c_str());
View
@@ -18,6 +18,8 @@ LICENSE@@@ */
#include "Settings.h"
#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtCore/QSettings>
#include <weboswebsettings.h>
@@ -27,14 +29,10 @@ bool InitSettings()
map.insert("CacheEnabled", true);
map.insert("CacheMaxSize", "50M");
- map.insert("CachePath", "/media/cryptofs/.browser/cache");
- map.insert("CookieJarPath", "/media/cryptofs/.browser/cookies");
- map.insert("DownloadPath", "/media/internal/downloads");
map.insert("MaxPixelsPerDecodedImage", 16777216);
map.insert("RemoteInspectorPort", 0);
- map.insert("ImageResourcesPath","/usr/palm/webkit/images");
- map.insert("SelectionColor","#ffffcc");
- map.insert("HighlightedTextColor","#000000");
+ map.insert("SelectionColor", "#ffffcc");
+ map.insert("HighlightedTextColor", "#000000");
// WebSettings
map.insert("WebSettings/AcceleratedCompositingEnabled", true);
@@ -44,14 +42,45 @@ bool InitSettings()
map.insert("WebSettings/OfflineStorageDefaultQuota", "5M");
map.insert("WebSettings/OfflineWebApplicationCacheQuota", "10M");
map.insert("WebSettings/PersistentStorageEnabled", true);
- map.insert("WebSettings/PersistentStoragePath", "/media/cryptofs/.browser");
map.insert("WebSettings/PluginsEnabled", true);
- map.insert("WebSettings/PluginSupplementalPath","/usr/lib/BrowserServerPlugins");
- map.insert("WebSettings/PluginSupplementalUserPath","/media/cryptofs/apps/usr/lib/BrowserServerPlugins");
map.insert("WebSettings/TiledBackingStoreEnabled", false);
map.insert("WebSettings/WebGLEnabled", true);
- return webOS::WebSettings::initSettings(map);
+#ifdef ISIS_DESKTOP
+ QString root = QString("%1/.isis").arg(QDir::homePath());
+
+ map.insert("CachePath", root + "/cache");
+ map.insert("CookieJarPath", root + "/cookies");
+ map.insert("ImageResourcesPath", root + "/images");
+ map.insert("DownloadPath", QDir::homePath() + "/Downloads");
+ map.insert("HitTestSchema", root + "/conf/HitTest.schema");
+ map.insert("InteractiveWidgetRectSchema", root + "/conf/InteractiveWidgetRect.schema");
+
+ // WebSettings
+ map.insert("WebSettings/PersistentStoragePath", root + "/plugins");
+
+ QString file = QString ("%1/conf/%2.conf").arg(root).arg(QCoreApplication::applicationName());
+#else
+ map.insert("CachePath", "/media/cryptofs/.browser/cache");
+ map.insert("CookieJarPath", "/media/cryptofs/.browser/cookies");
+ map.insert("DownloadPath", "/media/internal/downloads");
+ map.insert("ImageResourcesPath","/usr/palm/webkit/images");
+
+ map.insert("HitTestSchema", "/etc/palm/browser/HitTest.schema");
+ map.insert("InteractiveWidgetRectSchema", "/etc/palm/browser/InteractiveWidgetRect.schema");
+
+ // WebSettings
+ map.insert("WebSettings/PersistentStoragePath", "/media/cryptofs/.browser");
+ map.insert("WebSettings/PluginSupplementalPath","/usr/lib/BrowserServerPlugins");
+ map.insert("WebSettings/PluginSupplementalUserPath","/media/cryptofs/apps/usr/lib/BrowserServerPlugins");
+
+ QString userScope("/var/tmp");
+ QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, userScope);
+
+ QString file = QString ("/etc/palm/%1.conf").arg(QCoreApplication::applicationName());
+#endif
+
+ return webOS::WebSettings::initSettings(map, file);
}
@@ -1,6 +1,7 @@
#
# This is the configuration file for the BrowserServer.
-# Keep it in /etc/palm/BrowserServer.conf
+# Keep it in /etc/palm/BrowserServer.conf for embedded devices
+# Keep it in $(HOME)/.isis/conf/BrowserServer.conf for desktop
#
[General]
@@ -1,17 +1,12 @@
-#
-# This is the configuration file for the BrowserServer.
-# Keep it in ISIS_ROOT_DIR/etc/palm/BrowserServer.conf
-#
-
[General]
CacheEnabled=true
CacheMaxSize=50M
-CachePath=ISIS_ROOT_DIR/media/cryptofs/.browser/cache
-CookieJarPath=ISIS_ROOT_DIR/media/cryptofs/.browser/cookies
-DownloadPath=ISIS_ROOT_DIR/media/internal/downloads
+CachePath=ISIS_ROOT_DIR/cache
+CookieJarPath=ISIS_ROOT_DIR/cookies
+DownloadPath=ISIS_ROOT_DIR/Downloads
MaxPixelsPerDecodedImage=16777216
RemoteInspectorPort=0
-ImageResourcesPath=ISIS_ROOT_DIR/usr/palm/webkit/images
+ImageResourcesPath=ISIS_ROOT_DIR/images
SelectionColor=#ffff66
HighlightedTextColor=#000000
UserAgent="Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.4; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.76 Safari/534.6 TouchPad/1.0"
@@ -24,10 +19,9 @@ JavascriptEnabled=true
OfflineStorageDefaultQuota=5M
OfflineWebApplicationCacheQuota=10M
PersistentStorageEnabled=true
-PersistentStoragePath=ISIS_ROOT_DIR/media/cryptofs/.browser
+PersistentStoragePath=ISIS_ROOT_DIR
PluginsEnabled=true
-PluginSupplementalPath=ISIS_ROOT_DIR/usr/lib/BrowserServerPlugins
-PluginSupplementalUserPath=ISIS_ROOT_DIR/media/cryptofs/apps/usr/lib/BrowserServerPlugins
+PluginSupplementalPath=ISIS_ROOT_DIR/plugins
TiledBackingStoreEnabled=false
WebGLEnabled=true
FrameFlatteningEnabled=true