Ejemplo n.º 1
0
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, const QString& /* htmlPrefix */, const QString& /* htmlSuffix */)
{
    kDebug() << "Navigation widget for Declaration requested";
    m_topContext = topContext;
    
    initBrowser(400);
    
    DeclarationNavigationContext* context = new DeclarationNavigationContext(declaration, m_topContext);
    m_startContext = context;
    setContext(m_startContext);
    
    m_fullyQualifiedModuleIdentifier = context->m_fullyQualifiedModuleIdentifier;
    kDebug() << "Identifier: " << m_fullyQualifiedModuleIdentifier;
    if ( m_fullyQualifiedModuleIdentifier.length() ) {
        kDebug() << "Checking wether doc server is running";
        QTcpSocket* sock = new QTcpSocket();
        sock->connectToHost(QHostAddress::LocalHost, 1050, QTcpSocket::ReadOnly);
        bool running = sock->waitForConnected(300);
        if ( ! running ) {
            kDebug() << "Not running, starting pydoc server";
            QProcess::startDetached("/usr/bin/env", QStringList() << "python" << QString(INSTALL_PATH) + "/pydoc.py" << "-p" << "1050");
            usleep(100000); // give pydoc server 100ms to start up
        }
        else {
            sock->disconnectFromHost();
        }
        delete sock;
        
        m_documentationWebView = new QWebView(this);
        m_documentationWebView->load(QUrl("http://localhost:1050/" + m_fullyQualifiedModuleIdentifier + ".html"));
        connect( m_documentationWebView, SIGNAL(loadFinished(bool)), SLOT(addDocumentationData(bool)) );
    }
}
Ejemplo n.º 2
0
/**
* Constructor called when browser is launched from the application plugin tool bar
* @param parent - Pointer the to parent QWidget for modality
* @param interface - Pointer to the application interface
* @param fl - Window flags
*/
eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WindowFlags fl )
    : QDialog( parent, fl )
{
  setupUi( this );

  QSettings settings;
  restoreGeometry( settings.value( "/eVis/browser-geometry" ).toByteArray() );

  mCurrentFeatureIndex = 0;
  mInterface = interface;
  mDataProvider = nullptr;
  mVectorLayer = nullptr;
  mCanvas = nullptr;

  mIgnoreEvent = false;

  if ( initBrowser() )
  {
    loadRecord();
    show();
  }
  else
  {
    close();
  }
}
Ejemplo n.º 3
0
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext,
                                   const QString& /* htmlPrefix */, const QString& /* htmlSuffix */, KDevelop::AbstractNavigationWidget::DisplayHints hints)
    : KDevelop::AbstractNavigationWidget()
{
    m_topContext = topContext;
    setDisplayHints(hints);

    initBrowser(400);
    auto realDeclaration = DeclarationPointer(Helper::resolveAliasDeclaration(declaration.data()));
    m_startContext = new DeclarationNavigationContext(realDeclaration, m_topContext);
    setContext(m_startContext);
}
/**
* Constructor called when browser is launched from the application plugin tool bar
* @param parent - Pointer the to parent QWidget for modality
* @param interface - Pointer to the application interface
* @param fl - Window flags
*/
eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgisInterface *interface, Qt::WindowFlags fl )
  : QDialog( parent, fl )
{
  setupUi( this );
  connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked );
  connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged );
  connect( cboxEventImagePathField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged );
  connect( cboxCompassBearingField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged );
  connect( cboxCompassOffsetField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged );
  connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged );
  connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged );
  connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged );
  connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged );
  connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged );
  connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged );
  connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked );
  connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked );
  connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked );
  connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked );
  connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked );
  connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked );
  connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked );
  connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked );
  connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked );
  connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked );
  connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled );
  connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked );

  QSettings settings;
  restoreGeometry( settings.value( QStringLiteral( "eVis/browser-geometry" ) ).toByteArray() );

  mCurrentFeatureIndex = 0;
  mInterface = interface;
  mDataProvider = nullptr;
  mVectorLayer = nullptr;
  mCanvas = nullptr;

  mIgnoreEvent = false;

  if ( initBrowser() )
  {
    loadRecord();
    show();
  }
  else
  {
    close();
  }
}
Ejemplo n.º 5
0
OnyxDictFrame::OnyxDictFrame(QWidget *parent,
                             DictionaryManager & dict,
                             tts::TTS *tts,
                             bool exit_by_menu)
    : OnyxDialog(parent)
    , big_layout_(&content_widget_)
    , line_edit_layout_(0)
    , dict_menu_layout_(0)
    , line_edit_(0, this)
    , explanation_(0)
    , list_widget_(0, 0)
    , help_widget_(tr("No dictionary found. Please put dictionaries in SD Card or internal flash's \"dicts\" folder."), this)
    , dictionary_menu_(0, this)
    , tts_button_view_(0, this)
    , keyboard_(this)
    , status_bar_(this, MENU | MESSAGE | BATTERY | CLOCK | SCREEN_REFRESH | INPUT_TEXT)
    , dict_mgr_(dict)
    , tts_engine_(tts)
    , internal_state_(-1)
    , similar_words_checked_(false)
    , exit_by_menu_(exit_by_menu)
{
#ifndef Q_WS_QWS
    resize(600, 800);
#else
    resize(qApp->desktop()->screenGeometry().size());
#endif

    createLayout();
    initBrowser();
    initDictionaries();

    connectWithChildren();
    connect(&status_bar_, SIGNAL(menuClicked()), this, SLOT(popupMenu()));
    connect(&status_bar_, SIGNAL(requestInputText()), this, SLOT(onHideKeyboard()));
#ifdef Q_WS_QWS
    connect(qApp->desktop(), SIGNAL(resized(int)), this, SLOT(onScreenSizeChanged(int)), Qt::QueuedConnection);
#endif

    // connect the signals with sys_state_
    SysStatus & sys_status = SysStatus::instance();
    connect(&sys_status, SIGNAL(volumeChanged(int, bool)), this, SLOT(onSystemVolumeChanged(int, bool)));

    connect(&explanation_, SIGNAL(highlighted(QString)), this, SLOT(lookup(QString)));
    explanation_.installEventFilter(this);
    list_widget_.installEventFilter(this);
}
Ejemplo n.º 6
0
DictFrame::DictFrame(QWidget *parent, DictionaryManager & dict, tts::TTS *tts)
    : OnyxDialog(parent)
    , vlayout_(&content_widget_)
    , hlayout1_(0)
    , hlayout2_(0)
    , dict_edit_(QString(), 0)
    , details_(0)
    , list_widget_(0, 0)
    , keyboard_(0)
    , status_bar_(this, MENU | MESSAGE | BATTERY | CLOCK | SCREEN_REFRESH | INPUT_TEXT)
    , clear_button_(QApplication::tr("Clear"), 0)
    , dict_list_button_(tr("Dictionaries"), 0)
    , lookup_button_(tr("Lookup"), 0)
    , word_list_button_(tr("Similar Words"), 0)
    , details_button_(tr("Explanation"), 0)
    , speak_button_(tr(""), 0)
    , dict_mgr_(dict)
    , tts_engine_(tts)
    , internal_state_(-1)
{
#ifndef Q_WS_QWS
    resize(600, 800);
#else
    resize(qApp->desktop()->screenGeometry().size());
#endif

    createLayout();
    initBrowser();
    initDictionaries();

    connect(&status_bar_, SIGNAL(menuClicked()), this, SLOT(popupMenu()));
    connect(&status_bar_, SIGNAL(requestInputText()), this, SLOT(onInputText()));
#ifdef Q_WS_QWS
    connect(qApp->desktop(), SIGNAL(resized(int)), this, SLOT(onScreenSizeChanged(int)), Qt::QueuedConnection);
#endif

    // connect the signals with sys_state_
    SysStatus & sys_status = SysStatus::instance();
    connect(&sys_status, SIGNAL(volumeChanged(int, bool)), this, SLOT(onSystemVolumeChanged(int, bool)));
}
Ejemplo n.º 7
0
/**
* Constructor called when browser is launched by the eVisEventIdTool
* \param parent - Pointer to the parent QWidget for modality
* \param canvas - Pointer to the map canvas
* \param fl - Window flags
*/
eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl )
  : QDialog( parent, fl )
  , mCanvas( canvas )
{
  setupUi( this );
  connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked );
  connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged );
  connect( cboxEventImagePathField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged );
  connect( cboxCompassBearingField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged );
  connect( cboxCompassOffsetField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged );
  connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged );
  connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged );
  connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged );
  connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged );
  connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged );
  connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged );
  connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked );
  connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked );
  connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked );
  connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked );
  connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked );
  connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked );
  connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked );
  connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked );
  connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked );
  connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked );
  connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled );
  connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked );

  if ( initBrowser() )
  {
    loadRecord();
    show();
  }
  else
  {
    close();
  }
}
Ejemplo n.º 8
0
/**
* Constructor called when browser is launched by the eVisEventIdTool
* @param parent - Pointer to the parent QWidget for modality
* @param canvas - Pointer to the map canvas
* @param fl - Window flags
*/
eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgsMapCanvas* canvas, Qt::WindowFlags fl )
    : QDialog( parent, fl )
{
  setupUi( this );

  mCurrentFeatureIndex = 0;
  mInterface = nullptr;
  mDataProvider = nullptr;
  mVectorLayer = nullptr;
  mCanvas = canvas;

  mIgnoreEvent = false;

  if ( initBrowser() )
  {
    loadRecord();
    show();
  }
  else
  {
    close();
  }
}
Ejemplo n.º 9
0
/**
* Constructor called when browser is launched from the application plugin tool bar
* @param parent - Pointer the to parent QWidget for modality
* @param interface - Pointer the the application interface
* @param fl - Window flags
*/
eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WFlags fl )
    : QDialog( parent, fl )
{
  setupUi( this );

  mCurrentFeatureIndex = 0;
  mInterface = interface;
  mDataProvider = 0;
  mVectorLayer = 0;
  mCanvas = 0;

  mIgnoreEvent = false;

  if ( initBrowser( ) )
  {
    loadRecord( );
    show( );
  }
  else
  {
    close( );
  }
}
Ejemplo n.º 10
0
void MediaPluginWebKit::receiveMessage(const char *message_string)
{
//	std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl;
    LLPluginMessage message_in;

    if(message_in.parse(message_string) >= 0)
    {
        std::string message_class = message_in.getClass();
        std::string message_name = message_in.getName();
        if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE)
        {
            if(message_name == "init")
            {
                LLPluginMessage message("base", "init_response");
                LLSD versions = LLSD::emptyMap();
                versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
                versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION;
                versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER] = LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER_VERSION;
                message.setValueLLSD("versions", versions);

                std::string plugin_version = "Webkit media plugin, Webkit version ";
                plugin_version += LLQtWebKit::getInstance()->getVersion();
                message.setValue("plugin_version", plugin_version);
                sendMessage(message);
            }
            else if(message_name == "idle")
            {
                // no response is necessary here.
                F64 time = message_in.getValueReal("time");

                // Convert time to milliseconds for update()
                update((int)(time * 1000.0f));
            }
            else if(message_name == "cleanup")
            {
                // DTOR most likely won't be called but the recent change to the way this process
                // is (not) killed means we see this message and can do what we need to here.
                // Note: this cleanup is ultimately what writes cookies to the disk
                LLQtWebKit::getInstance()->remObserver( mBrowserWindowId, this );
                LLQtWebKit::getInstance()->reset();
            }
            else if(message_name == "shm_added")
            {
                SharedSegmentInfo info;
                info.mAddress = message_in.getValuePointer("address");
                info.mSize = (size_t)message_in.getValueS32("size");
                std::string name = message_in.getValue("name");

//				std::cerr << "MediaPluginWebKit::receiveMessage: shared memory added, name: " << name
//					<< ", size: " << info.mSize
//					<< ", address: " << info.mAddress
//					<< std::endl;

                mSharedSegments.insert(SharedSegmentMap::value_type(name, info));

            }
            else if(message_name == "shm_remove")
            {
                std::string name = message_in.getValue("name");

//				std::cerr << "MediaPluginWebKit::receiveMessage: shared memory remove, name = " << name << std::endl;

                SharedSegmentMap::iterator iter = mSharedSegments.find(name);
                if(iter != mSharedSegments.end())
                {
                    if(mPixels == iter->second.mAddress)
                    {
                        // This is the currently active pixel buffer.  Make sure we stop drawing to it.
                        mPixels = NULL;
                        mTextureSegmentName.clear();
                    }
                    mSharedSegments.erase(iter);
                }
                else
                {
//					std::cerr << "MediaPluginWebKit::receiveMessage: unknown shared memory region!" << std::endl;
                }

                // Send the response so it can be cleaned up.
                LLPluginMessage message("base", "shm_remove_response");
                message.setValue("name", name);
                sendMessage(message);
            }
            else
            {
//				std::cerr << "MediaPluginWebKit::receiveMessage: unknown base message: " << message_name << std::endl;
            }
        }
        else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
        {
            if(message_name == "set_volume")
            {
                F32 volume = message_in.getValueReal("volume");
                setVolume(volume);
            }
        }
        else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
        {
            if(message_name == "init")
            {
                mTarget = message_in.getValue("target");

                // This is the media init message -- all necessary data for initialization should have been received.
                if(initBrowser())
                {

                    // Plugin gets to decide the texture parameters to use.
                    mDepth = 4;

                    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
                    message.setValueS32("default_width", 1024);
                    message.setValueS32("default_height", 1024);
                    message.setValueS32("depth", mDepth);
                    message.setValueU32("internalformat", GL_RGBA);
#if LL_QTWEBKIT_USES_PIXMAPS
                    message.setValueU32("format", GL_BGRA_EXT); // I hope this isn't system-dependant... is it?  If so, we'll have to check the root window's pixel layout or something... yuck.
#else
                    message.setValueU32("format", GL_RGBA);
#endif // LL_QTWEBKIT_USES_PIXMAPS
                    message.setValueU32("type", GL_UNSIGNED_BYTE);
                    message.setValueBoolean("coords_opengl", true);
                    sendMessage(message);
                }
                else
                {
                    // if initialization failed, we're done.
                    mDeleteMe = true;
                }

            }
            else if(message_name == "set_user_data_path")
            {
                std::string user_data_path = message_in.getValue("path"); // n.b. always has trailing platform-specific dir-delimiter
                mProfileDir = user_data_path + "browser_profile";

                // FIXME: Should we do anything with this if it comes in after the browser has been initialized?
            }
            else if(message_name == "set_language_code")
            {
                mHostLanguage = message_in.getValue("language");

                // FIXME: Should we do anything with this if it comes in after the browser has been initialized?
            }
            else if(message_name == "plugins_enabled")
            {
                mPluginsEnabled = message_in.getValueBoolean("enable");
            }
            else if(message_name == "javascript_enabled")
            {
                mJavascriptEnabled = message_in.getValueBoolean("enable");
            }
            else if(message_name == "size_change")
            {
                std::string name = message_in.getValue("name");
                S32 width = message_in.getValueS32("width");
                S32 height = message_in.getValueS32("height");
                S32 texture_width = message_in.getValueS32("texture_width");
                S32 texture_height = message_in.getValueS32("texture_height");
                mBackgroundR = message_in.getValueReal("background_r");
                mBackgroundG = message_in.getValueReal("background_g");
                mBackgroundB = message_in.getValueReal("background_b");
//				mBackgroundA = message_in.setValueReal("background_a");		// Ignore any alpha

                if(!name.empty())
                {
                    // Find the shared memory region with this name
                    SharedSegmentMap::iterator iter = mSharedSegments.find(name);
                    if(iter != mSharedSegments.end())
                    {
                        mPixels = (unsigned char*)iter->second.mAddress;
                        mWidth = width;
                        mHeight = height;

                        if(initBrowserWindow())
                        {

                            // size changed so tell the browser
                            LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight );

                            //						std::cerr << "webkit plugin: set size to " << mWidth << " x " << mHeight
                            //								<< ", rowspan is " << LLQtWebKit::getInstance()->getBrowserRowSpan(mBrowserWindowId) << std::endl;

                            S32 real_width = LLQtWebKit::getInstance()->getBrowserRowSpan(mBrowserWindowId) / LLQtWebKit::getInstance()->getBrowserDepth(mBrowserWindowId);

                            // The actual width the browser will be drawing to is probably smaller... let the host know by modifying texture_width in the response.
                            if(real_width <= texture_width)
                            {
                                texture_width = real_width;
                            }
                            else
                            {
                                // This won't work -- it'll be bigger than the allocated memory.  This is a fatal error.
                                //							std::cerr << "Fatal error: browser rowbytes greater than texture width" << std::endl;
                                mDeleteMe = true;
                                return;
                            }
                        }
                        else
                        {
                            // Setting up the browser window failed.  This is a fatal error.
                            mDeleteMe = true;
                        }


                        mTextureWidth = texture_width;
                        mTextureHeight = texture_height;

                    };
                };

                LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
                message.setValue("name", name);
                message.setValueS32("width", width);
                message.setValueS32("height", height);
                message.setValueS32("texture_width", texture_width);
                message.setValueS32("texture_height", texture_height);
                sendMessage(message);

            }
            else if(message_name == "load_uri")
            {
                std::string uri = message_in.getValue("uri");

//				std::cout << "loading URI: " << uri << std::endl;

                if(!uri.empty())
                {
                    if(mInitState >= INIT_STATE_NAVIGATE_COMPLETE)
                    {
                        LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, uri );
                    }
                    else
                    {
                        mInitialNavigateURL = uri;
                    }
                }
            }
            else if(message_name == "mouse_event")
            {
                std::string event = message_in.getValue("event");
                S32 button = message_in.getValueS32("button");
                mLastMouseX = message_in.getValueS32("x");
                mLastMouseY = message_in.getValueS32("y");
                std::string modifiers = message_in.getValue("modifiers");

                // Treat unknown mouse events as mouse-moves.
                LLQtWebKit::EMouseEvent mouse_event = LLQtWebKit::ME_MOUSE_MOVE;
                if(event == "down")
                {
                    mouse_event = LLQtWebKit::ME_MOUSE_DOWN;
                }
                else if(event == "up")
                {
                    mouse_event = LLQtWebKit::ME_MOUSE_UP;
                }
                else if(event == "double_click")
                {
                    mouse_event = LLQtWebKit::ME_MOUSE_DOUBLE_CLICK;
                }

                LLQtWebKit::getInstance()->mouseEvent( mBrowserWindowId, mouse_event, button, mLastMouseX, mLastMouseY, decodeModifiers(modifiers));
                checkEditState();
            }
            else if(message_name == "scroll_event")
            {
                S32 x = message_in.getValueS32("x");
                S32 y = message_in.getValueS32("y");
                std::string modifiers = message_in.getValue("modifiers");

                // Incoming scroll events are adjusted so that 1 detent is approximately 1 unit.
                // Qt expects 1 detent to be 120 units.
                // It also seems that our y scroll direction is inverted vs. what Qt expects.

                x *= 120;
                y *= -120;

                LLQtWebKit::getInstance()->scrollWheelEvent(mBrowserWindowId, mLastMouseX, mLastMouseY, x, y, decodeModifiers(modifiers));
            }
            else if(message_name == "key_event")
            {
                std::string event = message_in.getValue("event");
                S32 key = message_in.getValueS32("key");
                std::string modifiers = message_in.getValue("modifiers");
                LLSD native_key_data = message_in.getValueLLSD("native_key_data");

                // Treat unknown events as key-up for safety.
                LLQtWebKit::EKeyEvent key_event = LLQtWebKit::KE_KEY_UP;
                if(event == "down")
                {
                    key_event = LLQtWebKit::KE_KEY_DOWN;
                }
                else if(event == "repeat")
                {
                    key_event = LLQtWebKit::KE_KEY_REPEAT;
                }

                keyEvent(key_event, key, decodeModifiers(modifiers), native_key_data);
            }
            else if(message_name == "text_event")
            {
                std::string text = message_in.getValue("text");
                std::string modifiers = message_in.getValue("modifiers");
                LLSD native_key_data = message_in.getValueLLSD("native_key_data");

                unicodeInput(text, decodeModifiers(modifiers), native_key_data);
            }
            if(message_name == "edit_cut")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_EDIT_CUT );
                checkEditState();
            }
            if(message_name == "edit_copy")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_EDIT_COPY );
                checkEditState();
            }
            if(message_name == "edit_paste")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_EDIT_PASTE );
                checkEditState();
            }
            if(message_name == "pick_file_response")
            {
                onPickFileResponse(message_in.getValue("file"));
            }
            else
            {
//				std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl;
            }
        }
        else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER)
        {
            if(message_name == "focus")
            {
                bool val = message_in.getValueBoolean("focused");
                LLQtWebKit::getInstance()->focusBrowser( mBrowserWindowId, val );

                if(mFirstFocus && val)
                {
                    // On the first focus, post a tab key event.  This fixes a problem with initial focus.
                    std::string empty;
                    keyEvent(LLQtWebKit::KE_KEY_DOWN, KEY_TAB, decodeModifiers(empty));
                    keyEvent(LLQtWebKit::KE_KEY_UP, KEY_TAB, decodeModifiers(empty));
                    mFirstFocus = false;
                }
            }
            else if(message_name == "clear_cache")
            {
                LLQtWebKit::getInstance()->clearCache();
            }
            else if(message_name == "clear_cookies")
            {
                LLQtWebKit::getInstance()->clearAllCookies();
            }
            else if(message_name == "enable_cookies")
            {
                mCookiesEnabled = message_in.getValueBoolean("enable");
                LLQtWebKit::getInstance()->enableCookies( mCookiesEnabled );
            }
            else if(message_name == "enable_plugins")
            {
                mPluginsEnabled = message_in.getValueBoolean("enable");
                LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled );
            }
            else if(message_name == "enable_javascript")
            {
                mJavascriptEnabled = message_in.getValueBoolean("enable");
                //LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
            }
            else if(message_name == "set_cookies")
            {
                LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies"));
            }
            else if(message_name == "proxy_setup")
            {
                bool val = message_in.getValueBoolean("enable");
                std::string host = message_in.getValue("host");
                int port = message_in.getValueS32("port");
                LLQtWebKit::getInstance()->enableProxy( val, host, port );
            }
            else if(message_name == "browse_stop")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_STOP );
            }
            else if(message_name == "browse_reload")
            {
                // foo = message_in.getValueBoolean("ignore_cache");
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_RELOAD );
            }
            else if(message_name == "browse_forward")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD );
            }
            else if(message_name == "browse_back")
            {
                LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK );
            }
            else if(message_name == "set_status_redirect")
            {
                int code = message_in.getValueS32("code");
                std::string url = message_in.getValue("url");
                if ( 404 == code )	// browser lib only supports 404 right now
                {
                    LLQtWebKit::getInstance()->set404RedirectUrl( mBrowserWindowId, url );
                };
            }
            else if(message_name == "set_user_agent")
            {
                mUserAgent = message_in.getValue("user_agent");
                LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
            }
            else if(message_name == "init_history")
            {
                // Initialize browser history
                LLSD history = message_in.getValueLLSD("history");
                // First, clear the URL history
                LLQtWebKit::getInstance()->clearHistory(mBrowserWindowId);
                // Then, add the history items in order
                LLSD::array_iterator iter_history = history.beginArray();
                LLSD::array_iterator end_history = history.endArray();
                for(; iter_history != end_history; ++iter_history)
                {
                    std::string url = (*iter_history).asString();
                    if(! url.empty()) {
                        LLQtWebKit::getInstance()->prependHistoryUrl(mBrowserWindowId, url);
                    }
                }
            }
            else if(message_name == "proxy_window_opened")
            {
                std::string target = message_in.getValue("target");
                std::string uuid = message_in.getValue("uuid");
                LLQtWebKit::getInstance()->proxyWindowOpened(mBrowserWindowId, target, uuid);
            }
            else if(message_name == "proxy_window_closed")
            {
                std::string uuid = message_in.getValue("uuid");
                LLQtWebKit::getInstance()->proxyWindowClosed(mBrowserWindowId, uuid);
            }
            else
            {
//				std::cerr << "MediaPluginWebKit::receiveMessage: unknown media_browser message: " << message_string << std::endl;
            };
        }
        else
        {
//			std::cerr << "MediaPluginWebKit::receiveMessage: unknown message class: " << message_class << std::endl;
        };
    }
}