Changeset 103491 in vbox
- Timestamp:
- Feb 21, 2024 12:36:24 PM (9 months ago)
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbgConsole.cpp
r101107 r103491 34 34 #include "VBoxDbgGui.h" 35 35 36 #include <QAction> 37 #include <QApplication> 38 #include <QContextMenuEvent> 39 #include <QFont> 40 #include <QFontDatabase> 41 #include <QHBoxLayout> 36 42 #include <QLabel> 37 #include <QApplication>38 #include <QFont>39 43 #include <QLineEdit> 40 #include <QHBoxLayout>41 #include <QAction>42 #include <QContextMenuEvent>43 44 #include <QMenu> 44 45 #include <QScrollBar> … … 74 75 VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */, 75 76 const char *pszName/* = NULL*/) 76 : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox) 77 #ifdef VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 78 : QPlainTextEdit(pParent) 79 #else 80 : QTextEdit(pParent) 81 #endif 82 , m_uCurLine(0) 83 , m_uCurPos(0) 84 , m_hGUIThread(RTThreadNativeSelf()) 85 , m_pVirtualBox(a_pVirtualBox) 77 86 { 78 87 setReadOnly(true); … … 81 90 setPlainText(""); 82 91 setTextInteractionFlags(Qt::TextBrowserInteraction); 92 setTabChangesFocus(true); 93 #ifndef VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 83 94 setAutoFormatting(QTextEdit::AutoAll); 84 setTabChangesFocus(true);85 95 setAcceptRichText(false); 96 #endif 97 #if 0 /* @bugref{10604}: this doesn't really help with the performance issue. */ 98 setWordWrapMode(QTextOption::NoWrap); 99 # ifndef VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 100 setLineWrapMode(QPlainTextEdit::NoWrap); 101 # endif 102 #endif 86 103 87 104 /* … … 109 126 * Create actions for font menu items. 110 127 */ 128 m_pDefaultFontAction = new QAction(tr("Default Fixed Font"), this); 129 m_pDefaultFontAction->setCheckable(true); 130 m_pDefaultFontAction->setData((int)kFontType_SystemDefault); 131 connect(m_pDefaultFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); 132 111 133 m_pCourierFontAction = new QAction(tr("Courier"), this); 112 134 m_pCourierFontAction->setCheckable(true); 113 m_pCourierFontAction->setShortcut(QString("Ctrl+D"));114 135 m_pCourierFontAction->setData((int)kFontType_Courier); 115 136 connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); … … 117 138 m_pMonospaceFontAction = new QAction(tr("Monospace"), this); 118 139 m_pMonospaceFontAction->setCheckable(true); 119 m_pMonospaceFontAction->setShortcut(QString("Ctrl+M"));120 140 m_pMonospaceFontAction->setData((int)kFontType_Monospace); 121 141 connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType())); … … 123 143 /* Create action group for grouping of exclusive font menu items. */ 124 144 QActionGroup *pActionFontGroup = new QActionGroup(this); 145 pActionFontGroup->addAction(m_pDefaultFontAction); 125 146 pActionFontGroup->addAction(m_pCourierFontAction); 126 147 pActionFontGroup->addAction(m_pMonospaceFontAction); … … 148 169 */ 149 170 /* color scheme: */ 171 setColorScheme(kGreenOnBlack, false /*fSaveIt*/); 150 172 com::Bstr bstrColor; 151 173 HRESULT hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), bstrColor.asOutParam()) : E_FAIL; 152 if ( SUCCEEDED(hrc)153 && bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0)154 setColorScheme(kBlackOnWhite, false /*fSaveIt*/);155 else156 setColorScheme(kGreenOnBlack, false /*fSaveIt*/);174 if (SUCCEEDED(hrc)) 175 { 176 if (bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0) 177 setColorScheme(kBlackOnWhite, false /*fSaveIt*/); 178 } 157 179 158 180 /* font: */ 181 setFontType(kFontType_SystemDefault, false /*fSaveIt*/); 159 182 com::Bstr bstrFont; 160 183 hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), bstrFont.asOutParam()) : E_FAIL; 161 if ( SUCCEEDED(hrc) 162 && bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0) 163 setFontType(kFontType_Monospace, false /*fSaveIt*/); 164 else 165 setFontType(kFontType_Courier, false /*fSaveIt*/); 184 if (SUCCEEDED(hrc)) 185 { 186 if (bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0) 187 setFontType(kFontType_Monospace, false /*fSaveIt*/); 188 else if (bstrFont.compareUtf8("courier", com::Bstr::CaseInsensitive) == 0) 189 setFontType(kFontType_Courier, false /*fSaveIt*/); 190 } 166 191 167 192 /* font size: */ … … 206 231 207 232 QMenu *pFontMenu = pMenu->addMenu(tr("&Font Family")); 233 pFontMenu->addAction(m_pDefaultFontAction); 208 234 pFontMenu->addAction(m_pCourierFontAction); 209 235 pFontMenu->addAction(m_pMonospaceFontAction); … … 259 285 switch (enmFontType) 260 286 { 287 case kFontType_SystemDefault: 288 Font = QFontDatabase::systemFont(QFontDatabase::FixedFont); 289 pszSetting = "Default"; 290 pAction = m_pDefaultFontAction; 291 break; 292 261 293 case kFontType_Courier: 294 { 262 295 #ifdef Q_WS_MAC 263 296 Font = QFont("Monaco", Font.pointSize(), QFont::Normal, FALSE); 264 297 Font.setStyleStrategy(QFont::NoAntialias); 265 298 #else 299 Font = QFontDatabase::systemFont(QFontDatabase::FixedFont); 266 300 Font.setStyleHint(QFont::TypeWriter); 267 Font.setFamily("Courier [Monotype]"); 301 Font.setStyleStrategy(QFont::PreferAntialias); 302 QStringList Families; 303 # ifdef Q_WS_MAC 304 Families << "Monaco"; 305 # endif 306 /*Families << "Courier New [Monotype]"; - this causes peformance trouble (@bugref{10604}) */ 307 Families << "Courier New"; 308 /*Families << "Courier [Monotype]"; - this causes peformance trouble (@bugref{10604}) */ 309 Families << "Courier"; 310 Font.setFamilies(Families); 268 311 #endif 269 312 pszSetting = "Courier"; 270 313 pAction = m_pCourierFontAction; 271 314 break; 315 } 272 316 273 317 case kFontType_Monospace: 274 Font.setStyleHint(QFont::TypeWriter); 318 Font = QFontDatabase::systemFont(QFontDatabase::FixedFont); 319 Font.setStyleHint(QFont::Monospace); 275 320 Font.setStyleStrategy(QFont::PreferAntialias); 276 321 Font.setFamily("Monospace [Monotype]"); -
trunk/src/VBox/Debugger/VBoxDbgConsole.h
r98103 r103491 32 32 #endif 33 33 34 //#define VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 35 34 36 #include "VBoxDbgBase.h" 35 37 36 38 #include <QTextEdit> 39 #ifdef VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 40 # include <QPlainTextEdit> 41 #endif 37 42 #include <QComboBox> 38 43 #include <QTimer> … … 53 58 54 59 55 class VBoxDbgConsoleOutput : public QTextEdit 60 class VBoxDbgConsoleOutput 61 #ifdef VBOXDBG_WITH_CONSOLE_OUTPUT_AS_QPLAINTEXT 62 : public QPlainTextEdit 63 #else 64 : public QTextEdit 65 #endif 56 66 { 57 67 Q_OBJECT … … 89 99 QAction *m_pGreenOnBlackAction; 90 100 101 /** The action to switch to system default fixed font. */ 102 QAction *m_pDefaultFontAction; 103 /** The action to switch to Monospace font. */ 104 QAction *m_pMonospaceFontAction; 91 105 /** The action to switch to Courier font. */ 92 106 QAction *m_pCourierFontAction; 93 /** The action to switch to Monospace font. */94 QAction *m_pMonospaceFontAction;95 107 96 108 protected: 97 109 typedef enum { kGreenOnBlack, kBlackOnWhite } VBoxDbgConsoleColor; 98 typedef enum { kFontType_ Monospace, kFontType_Courier } VBoxDbgConsoleFontType;110 typedef enum { kFontType_SystemDefault, kFontType_Monospace, kFontType_Courier } VBoxDbgConsoleFontType; 99 111 100 112 /**
Note:
See TracChangeset
for help on using the changeset viewer.