Esempio n. 1
0
QtMainWindow::QtMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtMainWindow),
    webInspectorWindow(new QtWebInspector()),
    mainWindowCallback(NULL),
    cur_tbrp(0),
    m_alertDialog(0),
    m_LogicalDpiX(0),
    m_LogicalDpiY(0),
	firstShow(true)
    //TODO: m_SyncStatusDlg
{
#ifdef OS_WINDOWS_DESKTOP
    QPixmap icon(":/images/rho.png");
    QApplication::setWindowIcon(icon);
#endif

    ui->setupUi(this);

#ifdef RHODES_WIN32
	ui->menuSimulate->clear();
	ui->menuSimulate->setTitle("Navigate");
	ui->menuSimulate->insertAction(0, ui->actionBack);
#endif

    QWebSettings* qs = QWebSettings::globalSettings();
    qs->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    qs->setOfflineStorageDefaultQuota(1024*1024*1024);

    rho::String rs_dir = RHODESAPP().getRhoRootPath()+RHO_EMULATOR_DIR;
    qs->enablePersistentStorage(rs_dir.c_str());

	this->ui->webView->setContextMenuPolicy(Qt::NoContextMenu);
    this->ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->ui->webView->page()->mainFrame()->securityOrigin().setDatabaseQuota(1024*1024*1024);
    this->main_webView = this->ui->webView;
    this->main_webInspector = webInspectorWindow->webInspector();
    this->cur_webInspector = this->main_webInspector;

    this->move(0,0);
    this->ui->toolBar->hide();
    this->ui->toolBarRight->hide();

    // connecting WebInspector
    main_webInspector->setPage(ui->webView->page());

#ifdef OS_SYMBIAN
    QWebViewKineticScroller *newScroller = new QWebViewKineticScroller();
    newScroller->setWidget(this->ui->webView);
    QWebViewSelectionSuppressor* suppressor = new QWebViewSelectionSuppressor(this->ui->webView);
#endif

#if defined(RHODES_EMULATOR)
    webInspectorWindow->show();
#endif
}
Esempio n. 2
0
QtMainWindow::QtMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtMainWindow),
    webInspectorWindow(new QtWebInspector()),
    cb(NULL),
    cur_tbrp(0),
    m_alertDialog(0),
    m_LogicalDpiX(0),
    m_LogicalDpiY(0)
    //TODO: m_SyncStatusDlg
{
#ifdef OS_WINDOWS_DESKTOP
    QPixmap icon(":/images/rho.png");
    QApplication::setWindowIcon(icon);
#endif

    ui->setupUi(this);

    QWebSettings* qs = QWebSettings::globalSettings(); //this->ui->webView->settings();
    qs->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    qs->setAttribute(QWebSettings::LocalStorageEnabled, true);
    qs->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    qs->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
    qs->setOfflineStorageDefaultQuota(1024*1024*1024);

    rho::String rs_dir = RHODESAPP().getRhoRootPath()+RHO_EMULATOR_DIR;
    qs->setOfflineWebApplicationCachePath(rs_dir.c_str());
    qs->setLocalStoragePath(rs_dir.c_str());
    qs->setOfflineStoragePath(rs_dir.c_str());

    this->ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->ui->webView->page()->mainFrame()->securityOrigin().setDatabaseQuota(1024*1024*1024);
    this->main_webView = this->ui->webView;
    this->main_webInspector = webInspectorWindow->webInspector();
    this->cur_webInspector = this->main_webInspector;

    this->move(0,0);
    this->ui->toolBar->hide();
    this->ui->toolBarRight->hide();

    // connecting WebInspector
    main_webInspector->setPage(ui->webView->page());

#ifdef OS_SYMBIAN
    QWebViewKineticScroller *newScroller = new QWebViewKineticScroller();
    newScroller->setWidget(this->ui->webView);
    QWebViewSelectionSuppressor* suppressor = new QWebViewSelectionSuppressor(this->ui->webView);
#endif

    webInspectorWindow->show();
}
Esempio n. 3
0
QtMainWindow::QtMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtMainWindow),
    webInspectorWindow(new QtWebInspector()),
    mainWindowCallback(NULL),
    cur_tbrp(0),
    m_alertDialog(0),
    m_LogicalDpiX(0),
    m_LogicalDpiY(0),
    firstShow(true), m_bFirstLoad(true),
    toolBarSeparatorWidth(0)
    //TODO: m_SyncStatusDlg
{
#ifdef OS_WINDOWS_DESKTOP
    QPixmap icon(":/images/rho.png");
    QApplication::setWindowIcon(icon);
#endif

    ui->setupUi(this);

#ifdef OS_WINDOWS_DESKTOP
	ui->menuSimulate->clear();
	ui->menuSimulate->setTitle("Navigate");
	ui->menuSimulate->insertAction(0, ui->actionBack);
#endif

    QWebSettings* qs = QWebSettings::globalSettings();
    qs->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    qs->setOfflineStorageDefaultQuota(1024*1024*1024);

    rho::String rs_dir = RHODESAPP().getRhoRootPath()+RHO_EMULATOR_DIR;
    qs->enablePersistentStorage(rs_dir.c_str());

	this->ui->webView->setContextMenuPolicy(Qt::NoContextMenu);
	this->ui->webView->setPage(new QtWebPage());
    setUpWebPage(this->ui->webView->page());
    this->main_webView = this->ui->webView;
    this->main_webInspector = webInspectorWindow->webInspector();
    this->cur_webInspector = this->main_webInspector;

    this->move(0,0);
    this->ui->toolBar->hide();
    this->ui->toolBarRight->hide();

    this->main_webView->hide();
    //this->ui->centralWidget->hide();

    //this->ui->centralWidget->setStyleSheet("background-color: yellow");
    //this->ui->centralWidget->setStyleSheet("QWidget {background-image: url(test.jpg)}" );

#ifdef RHODES_EMULATOR
	int width = RHOSIMCONF().getInt("screen_width");
	int height = RHOSIMCONF().getInt("screen_height");
#else
	int width = RHOCONF().getInt("screen_width");
	int height = RHOCONF().getInt("screen_height");
#endif
	if ((width>0) && (height>0))
		this->setSize(width, height);
	else if (width>0)
		this->setSize(width, this->height());
	else if (height>0)
		this->setSize(this->width(), height);

#if defined(RHODES_EMULATOR)
    // connecting WebInspector
    main_webInspector->setPage(ui->webView->page());
#endif

#ifdef OS_SYMBIAN
    QWebViewKineticScroller *newScroller = new QWebViewKineticScroller();
    newScroller->setWidget(this->ui->webView);
    QWebViewSelectionSuppressor* suppressor = new QWebViewSelectionSuppressor(this->ui->webView);
#endif

#if defined(RHODES_EMULATOR)
    webInspectorWindow->show();
#endif
}
Esempio n. 4
0
QtMainWindow::QtMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtMainWindow),
    webInspectorWindow(new QtWebInspector()),
    mainWindowCallback(NULL),
    cur_tbrp(0),
    m_alertDialog(0),
    m_LogicalDpiX(0),
    m_LogicalDpiY(0),
    firstShow(true), m_bFirstLoad(true),
    toolBarSeparatorWidth(0),
    m_proxy(QNetworkProxy(QNetworkProxy::DefaultProxy)),
    m_logView(0)
    //TODO: m_SyncStatusDlg
{
#if !defined(RHODES_EMULATOR)
    QPixmap icon(QCoreApplication::applicationDirPath().append(QDir::separator()).append("icon.png"));
    QApplication::setWindowIcon(icon);
    QApplication::setApplicationDisplayName(QString::fromStdString(RHOCONF().getString("title_text")));
    QApplication::setApplicationName(QString::fromStdString(RHOCONF().getString("app_name")));
    QApplication::setApplicationVersion(QString::fromStdString(RHOCONF().getString("app_version")));
    QApplication::setOrganizationName(QString::fromStdString(RHOCONF().getString("org_name")));
#elif defined(OS_WINDOWS_DESKTOP)
    QPixmap icon(":/images/rho.png");
    QApplication::setWindowIcon(icon);
#endif
    QApplication::setStyle(new QtCustomStyle());

    ui->setupUi(this);

#ifdef OS_WINDOWS_DESKTOP
	ui->menuSimulate->clear();
	ui->menuSimulate->setTitle("Navigate");
	ui->menuSimulate->insertAction(0, ui->actionBack);
#endif

    QWebSettings* qs = QWebSettings::globalSettings();
    qs->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    qs->setOfflineStorageDefaultQuota(1024*1024*1024);

    rho::String rs_dir = RHODESAPP().getRhoRootPath()+RHO_EMULATOR_DIR;
    qs->enablePersistentStorage(rs_dir.c_str());

	this->ui->webView->setContextMenuPolicy(Qt::NoContextMenu);
	this->ui->webView->setPage(new QtWebPage());
    this->ui->webView->setAttribute(Qt::WA_AcceptTouchEvents, false);
    setUpWebPage(this->ui->webView->page());
    this->main_webView = this->ui->webView;
    this->main_webInspector = webInspectorWindow->webInspector();
    this->cur_webInspector = this->main_webInspector;

    this->move(0,0);
    this->ui->toolBar->hide();
    this->ui->toolBarRight->hide();

    this->main_webView->hide();
    //this->ui->centralWidget->hide();

    //this->ui->centralWidget->setStyleSheet("background-color: yellow");
    //this->ui->centralWidget->setStyleSheet("QWidget {background-image: url(test.jpg)}" );

#ifdef RHODES_EMULATOR
	int width = RHOSIMCONF().getInt("screen_width");
	int height = RHOSIMCONF().getInt("screen_height");
#else
	int width = RHOCONF().getInt("screen_width");
	int height = RHOCONF().getInt("screen_height");
#endif
	if ((width>0) && (height>0))
		this->setSize(width, height);
	else if (width>0)
		this->setSize(width, this->height());
	else if (height>0)
		this->setSize(this->width(), height);

#if defined(RHODES_EMULATOR)
    // connecting WebInspector
    main_webInspector->setPage(ui->webView->page());
#endif

#ifdef OS_SYMBIAN
    QWebViewKineticScroller *newScroller = new QWebViewKineticScroller();
    newScroller->setWidget(this->ui->webView);
    QWebViewSelectionSuppressor* suppressor = new QWebViewSelectionSuppressor(this->ui->webView);
#endif

#if defined(RHODES_EMULATOR)
    webInspectorWindow->show();
#endif

    if (RHOCONF().isExist("http_proxy_host"))
    {
        setProxy(QString::fromStdString(RHOCONF().getString("http_proxy_host")),
                 QString::fromStdString(RHOCONF().getString("http_proxy_port")),
                 QString::fromStdString(RHOCONF().getString("http_proxy_login")),
                 QString::fromStdString(RHOCONF().getString("http_proxy_password")));
    } else {
        unsetProxy();
    }
}