bool CSettingsMenu::OnSaveButtonClick(const CEGUI::EventArgs &eventArgs) { bool bWindowed = ((CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox)->isSelected(); bool bShowFPS = ((CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox)->isSelected(); String strNick(m_GUIElements.pNickEditBox->getText().c_str()); String strFont(m_GUIElements.pChatFontEditBox->getText().c_str()); String strFontSize(m_GUIElements.pChatFontSizeEditBox->getText().c_str()); String strBackgroundAlpha(m_GUIElements.pChatBGColorAEditBox->getText().c_str()); String strBackgroundRed(m_GUIElements.pChatBGColorREditBox->getText().c_str()); String strBackgroundGreen(m_GUIElements.pChatBGColorGEditBox->getText().c_str()); String strBackgroundBlue(m_GUIElements.pChatBGColorBEditBox->getText().c_str()); CVAR_SET_BOOL("windowed", bWindowed); CVAR_SET_BOOL("fps", g_pClient->GetFPSToggle()); g_pClient->SetFPSToggle(bShowFPS); CVAR_SET_INTEGER("chatfont", strFont.ToInteger()); CVAR_SET_INTEGER("chatsize", strFontSize.ToInteger()); CVAR_SET_INTEGER("chatbga", strBackgroundAlpha.ToInteger()); CVAR_SET_INTEGER("chatbgr", strBackgroundRed.ToInteger()); CVAR_SET_INTEGER("chatbgg", strBackgroundGreen.ToInteger()); CVAR_SET_INTEGER("chatbgb", strBackgroundBlue.ToInteger()); // Init the chat window font and background g_pClient->GetChatWindow()->InitFontAndBackground(); if(CVAR_GET_STRING("nick").Compare(strNick) != 0) { CVAR_SET_STRING("nick", strNick); g_pClient->SetNick(strNick); CNetworkManager * pNetworkManager = g_pClient->GetNetworkManager(); if(pNetworkManager && pNetworkManager->IsConnected()) { CBitStream bsSend; bsSend.Write(strNick); pNetworkManager->RPC(RPC_NameChange, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED); } } if(bWindowed != g_pClient->IsWindowedMode()) g_pClient->GetGUI()->ShowMessageBox("You must restart IV:MP for the windowed mode option to take effect", "Information."); SetVisible(false); return true; }
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Create actions for color-scheme menu items. */ m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this); m_pGreenOnBlackAction->setCheckable(true); m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1); m_pGreenOnBlackAction->setData((int)kGreenOnBlack); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); m_pBlackOnWhiteAction->setData((int)kBlackOnWhite); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme())); /* Create action group for grouping of exclusive color-scheme menu items. */ QActionGroup *pActionColorGroup = new QActionGroup(this); pActionColorGroup->addAction(m_pGreenOnBlackAction); pActionColorGroup->addAction(m_pBlackOnWhiteAction); pActionColorGroup->setExclusive(true); /* * Create actions for font menu items. */ m_pCourierFontAction = new QAction(tr("Courier"), this); m_pCourierFontAction->setCheckable(true); m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D); m_pCourierFontAction->setData((int)kFontType_Courier); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); m_pMonospaceFontAction->setData((int)kFontType_Monospace); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); /* Create action group for grouping of exclusive font menu items. */ QActionGroup *pActionFontGroup = new QActionGroup(this); pActionFontGroup->addAction(m_pCourierFontAction); pActionFontGroup->addAction(m_pMonospaceFontAction); pActionFontGroup->setExclusive(true); /* * Create actions for font size menu. */ uint32_t const uDefaultFontSize = font().pointSize(); m_pActionFontSizeGroup = new QActionGroup(this); for (uint32_t i = 0; i < RT_ELEMENTS(m_apFontSizeActions); i++) { char szTitle[32]; RTStrPrintf(szTitle, sizeof(szTitle), s_uMinFontSize + i != uDefaultFontSize ? "%upt" : "%upt (default)", s_uMinFontSize + i); m_apFontSizeActions[i] = new QAction(tr(szTitle), this); m_apFontSizeActions[i]->setCheckable(true); m_apFontSizeActions[i]->setData(i + s_uMinFontSize); connect(m_apFontSizeActions[i], SIGNAL(triggered()), this, SLOT(sltSelectFontSize())); m_pActionFontSizeGroup->addAction(m_apFontSizeActions[i]); } /* * Set the defaults (which syncs with the menu item checked state). */ /* color scheme: */ com::Bstr bstrColor; HRESULT hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), bstrColor.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0) setColorScheme(kBlackOnWhite, false /*fSaveIt*/); else setColorScheme(kGreenOnBlack, false /*fSaveIt*/); /* font: */ com::Bstr bstrFont; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), bstrFont.asOutParam()) : E_FAIL; if ( SUCCEEDED(hrc) && bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0) setFontType(kFontType_Monospace, false /*fSaveIt*/); else setFontType(kFontType_Courier, false /*fSaveIt*/); /* font size: */ com::Bstr bstrFontSize; hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/FontSize").raw(), bstrFontSize.asOutParam()) : E_FAIL; if (SUCCEEDED(hrc)) { com::Utf8Str strFontSize(bstrFontSize); uint32_t uFontSizePrf = strFontSize.strip().toUInt32(); if ( uFontSizePrf - s_uMinFontSize < (uint32_t)RT_ELEMENTS(m_apFontSizeActions) && uFontSizePrf != uDefaultFontSize) setFontSize(uFontSizePrf, false /*fSaveIt*/); } NOREF(pszName); }