/**
 \brief Set the current view to <var>view</var>.

 Deactivates and hides the current view, and then activates and shows the new view.
 */
void ViewController::setCurrent(ControllableView *view) {
    // TO DO: Add transition animations.
    
    int index = m_views.indexOf(view);
    if(index != -1) {
        if(index != m_currentViewIndex || !currentView()->isActive()) {
            emit currentViewChanging();
            
            if(currentView() && currentView()->isActive()) {
                hideCurrentView();
                currentView()->deactivate();
            }

            m_currentViewIndex = index;

            if(!currentView()->isActive()) currentView()->activate();
            showCurrentView();

            emit currentViewChanged();
        }
    }
    else {
        qWarning() << "ViewController::setCurrent: view not found. " << view->objectName();
    }
}
Exemplo n.º 2
0
// QPROPERTY - Setter
void Battleships::setCurrentView(const QString &view)
{
    if (m_currentView != view) {
        m_currentView = view;
        emit currentViewChanged();
    }
}
Exemplo n.º 3
0
SBI_ZoomWidget::SBI_ZoomWidget(BrowserWindow* parent)
    : QSlider(parent)
    , m_window(parent)
{
    setOrientation(Qt::Horizontal);
    setFixedWidth(100);
    setMaximumHeight(20);

    setPageStep(2);
    setSingleStep(1);
    setRange(0, WebView::zoomLevels().count() - 1);

    connect(this, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int)));
    connect(m_window->tabWidget(), SIGNAL(currentChanged(int)), this, SLOT(currentViewChanged()));

    currentViewChanged();
}
Exemplo n.º 4
0
  ChromeWidget::ChromeWidget(QGraphicsItem * parent, Qt::WindowFlags wFlags)
    : QObject(0),
      m_renderer(0),
      m_dom(0),
      m_viewController(new ViewController()),
      m_jsObject(new ChromeWidgetJSObject(0, this)),
      m_localeDelegate(new LocaleDelegate(this)),
      m_downloads(new Downloads())
  {
    m_layout = new ChromeLayout(parent, wFlags);
    QObject::connect(m_layout, SIGNAL(resizing(QSizeF)), this, SLOT(onResize(QSizeF)));
    QObject::connect(m_layout, SIGNAL(aspectChanged(int)), this, SLOT(onAspectChanged(int)));

    DeviceImpl *deviceImpl = new DEVICEIMPL();
    NetworkImpl *networkImpl = new NETWORKIMPL();
    m_deviceDelegate = new DeviceDelegate(deviceImpl);
    m_networkDelegate = new NetworkDelegate(networkImpl);

    BEDROCK_PROVISIONING::BedrockProvisioning *provisioning = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
    ChromeEffect::disabledColor.setNamedColor(provisioning->valueAsString("DisabledColor", "#FFFFFF"));
    ChromeEffect::disabledOpacity = static_cast<qreal>(provisioning->valueAsString("DisabledOpacity", "0.65").toFloat());

#ifndef __gva_no_chrome__
    m_snippets = new Snippets(this, this);
#endif
#ifndef __gva_no_chrome__
    m_page =  static_cast<QWebPage *>(new GVA::WebPageWrapper(this, "Chrome Javascript error"));
    m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
#endif
    m_viewController->setObjectName("views");

    connect(m_viewController, SIGNAL(currentViewChanged()), this, SLOT(onCurrentViewChanged()));
#ifndef __gva_no_chrome__

    m_jsObject->setObjectName("chrome");

    // Pass some signals from this object to the Javascript object.
    QObject::connect(this, SIGNAL(chromeComplete()), m_jsObject, SIGNAL(chromeComplete()));
    QObject::connect(this, SIGNAL(aspectChanged(int)), m_jsObject, SIGNAL(aspectChanged(int)));
    QObject::connect(this, SIGNAL(prepareForGeometryChange()), m_jsObject, SIGNAL(prepareForGeometryChange()));
    QObject::connect(this, SIGNAL(symbianCarriageReturn()), m_jsObject, SIGNAL(symbianCarriageReturn()));
    QObject::connect(this, SIGNAL(popupShown(const QString &)), m_jsObject, SIGNAL(popupShown(const QString &)));
    QObject::connect(this, SIGNAL(popupHidden(const QString &)), m_jsObject, SIGNAL(popupHidden(const QString &)));

    //addJSObjectToEngine(this);

    m_app = new GinebraApplication();
    QObject::connect(this, SIGNAL(goToBackground()), m_app, SLOT(sendToBackground()));

    //addJSObjectToEngine(m_app);

    QObject::connect(
            WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)),
            this, SLOT(pageCreated(WRT::WrtBrowserContainer*)));

    QObject::connect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
    QObject::connect(m_page, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
    QObject::connect(m_page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exportJSObjects()));

#endif

    ViewStack * vs = ViewStack::getSingleton();
    vs->setViewController(m_viewController);
    vs->setChromeWidget(this);

    // TO DO: need a better home for this.
    qMetaTypeId<QObjectList>();
    qRegisterMetaType<QObjectList>("QObjectList");
	
	//for QA Automation test tool purpose
#if !defined(QT_NO_LIBRARY)
    QLibrary testLib("qttestability");
    if(testLib.load()){
        typedef void (*TasInitialize)(void);
        TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
#ifdef Q_OS_SYMBIAN
        //not found so use ordinal
        if(!initFunction){
            initFunction = (TasInitialize)testLib.resolve("1");
        }
#endif
        if(initFunction){
            initFunction();
        }
    }
#endif
  }