ProtocolView::ProtocolView(const QCString& appId, QWidget *parent, const char *name) : QTextEdit(parent, name) , job(0) , m_isUpdateJob(false) { setReadOnly(true); setUndoRedoEnabled(false); setTabChangesFocus(true); setTextFormat(Qt::LogText); KConfig *config = CervisiaPart::config(); config->setGroup("LookAndFeel"); setFont(config->readFontEntry("ProtocolFont")); config->setGroup("Colors"); QColor defaultColor = QColor(255, 130, 130); conflictColor=config->readColorEntry("Conflict",&defaultColor); defaultColor=QColor(130, 130, 255); localChangeColor=config->readColorEntry("LocalChange",&defaultColor); defaultColor=QColor(70, 210, 70); remoteChangeColor=config->readColorEntry("RemoteChange",&defaultColor); // create a DCOP stub for the non-concurrent cvs job job = new CvsJob_stub(appId, "NonConcurrentJob"); // establish connections to the signals of the cvs job connectDCOPSignal(job->app(), job->obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true); connectDCOPSignal(job->app(), job->obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true); connectDCOPSignal(job->app(), job->obj(), "receivedStderr(QString)", "slotReceivedOutput(QString)", true); }
Wt_TextEdit::Wt_TextEdit() { QFont font; font.setFamily("monaco"); font.setFixedPitch(true); font.setPointSize(9); setFont(font); setTabStopWidth(4 * fontMetrics().width(' ')); //setStyleSheet("QPlainTextEdit {background: #262626; color:#D4D4D4}"); setStyleSheet("QPlainTextEdit {background: #373737; color:#D4D4D4;}"); //setStyleSheet("QPlainTextEdit {background: #F2F2F2; color:#D4D4D4}"); //setStyleSheet("QPlainTextEdit {background: url('bg2.png'); color:#D4D4D4}"); setLineWrapMode(QPlainTextEdit::NoWrap); setTabChangesFocus(true); highLight = new Wt_HighLight(this->document()); //QShortcut *action = new QShortcut(QKeySequence(tr("ctrl+f")),this); //connect(action, SIGNAL(activated()), this, SLOT(wt_selectionHighLight())); //connect(this, SIGNAL(selectionChanged()), this, SLOT(wt_selectionChanged())); //Wt_HighLight *searchTextHighLight = new Wt_HighLight(this->document(), Wt_HighLight::HighLightSearchText); //searchTextHighLight->initSearchTextHighlighting(tr("include")); //this->document()->setTextWidth(100); //block().blockFormat().setLineHeight(20, QTextBlockFormat::FixedHeight); }
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Font. * 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); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(setFontCourier())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(setFontMonospace())); /* 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); /* * Color scheme. * 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); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(setColorGreenOnBlack())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(setColorBlackOnWhite())); /* 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); /* * Set the defaults (which syncs with the menu item checked state). */ setFontCourier(); setColorGreenOnBlack(); NOREF(pszName); }
void OpenedFile::initialize() { setLineWrapMode(QPlainTextEdit::NoWrap); setTabChangesFocus(false); document()->setDefaultFont(QFont(DEF_FONT_INFO)); document()->setDocumentLayout(new QPlainTextDocumentLayout(document())); }
// // custom_user_field // custom_user_field::custom_user_field() { QFontMetrics m(font()) ; setFixedHeight(m.lineSpacing()*4); // 4 visible lines setMinimumWidth(50*m.width("a")); // ~70 characters setLineWrapMode(QPlainTextEdit::NoWrap); setTabChangesFocus(true); }
v_singlelineTextEdit::v_singlelineTextEdit(QWidget * parent):QTextEdit(parent){ setTabChangesFocus(true); setWordWrapMode(QTextOption::NoWrap); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); //setFixedHeight(sizeHint().height()); }
OneLineTextEdit::OneLineTextEdit(QWidget *parent) : QPlainTextEdit(parent) { setWordWrapMode (QTextOption::NoWrap); setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff); setTabChangesFocus (true); setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); }
ClientTextEdit::ClientTextEdit(QWidget* parent) : QTextEdit(parent) { setReadOnly(true); setOverwriteMode(true); setUndoRedoEnabled(false); setDocumentTitle("mClient"); setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); setTabChangesFocus(false); //_doc->setMaximumBlockCount(Config().scrollbackSize); // max number of lines? document()->setUndoRedoEnabled(false); QTextFrame* frame = document()->rootFrame(); _cursor = frame->firstCursorPosition(); // Default Colors _foregroundColor = Qt::lightGray; _backgroundColor = Qt::black; _blackColor = Qt::darkGray; _redColor = Qt::darkRed; _greenColor = Qt::darkGreen; _yellowColor = Qt::darkYellow; _blueColor = Qt::darkBlue; _magentaColor = Qt::darkMagenta; _cyanColor = Qt::darkCyan; _grayColor = Qt::lightGray; _darkGrayColor = Qt::gray; _brightRedColor = Qt::red; _brightGreenColor = Qt::green; _brightYellowColor = Qt::yellow; _brightBlueColor = Qt::blue; _brightMagentaColor = Qt::magenta; _brightCyanColor = Qt::cyan; _whiteColor = Qt::white; // Default Fonts _serverOutputFont = QFont("Monospace", 10); _inputLineFont = QFont("Monospace", 10); //QApplication::font(); _serverOutputFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias); QTextFrameFormat frameFormat = frame->frameFormat(); frameFormat.setBackground(_backgroundColor); frameFormat.setForeground(_foregroundColor); frame->setFrameFormat(frameFormat); _format = _cursor.charFormat(); setDefaultFormat(_format); _defaultFormat = _format; _cursor.setCharFormat(_format); QFontMetrics fm(_serverOutputFont); setTabStopWidth(fm.width(" ") * 8); // A tab is 8 spaces wide QScrollBar* scrollbar = verticalScrollBar(); scrollbar->setSingleStep(fm.leading()+fm.height()); connect(scrollbar, SIGNAL(sliderReleased()), this, SLOT(scrollBarReleased())); previous = 0; }
TranslationLine::TranslationLine(QWidget *parent) : QTextEdit(parent) { fixingSize=false; setWordWrapMode(QTextOption::WrapAnywhere); setTabChangesFocus(true); setAcceptRichText(false); setMinimumWidth(100); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this,SIGNAL(textChanged()),this,SLOT(textChangedSlot())); }
CodeLineEdit::CodeLineEdit(QWidget *parent) : QPlainTextEdit(parent) { setTabChangesFocus(true); setWordWrapMode(QTextOption::NoWrap); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setFixedHeight(sizeHint().height()); QPalette p = this->palette(); p.setColor(QPalette::Base, Qt::black); p.setColor(QPalette::Text, Qt::white); this->setPalette(p); }
QTextBrowserEx::QTextBrowserEx( QWidget *parent ) : QTextBrowser(parent) , m_makeCtrlEnterAsEnter( true ) , m_maxLength( -1 ) , m_isAcceptEnter(true) , m_keyEditFinish(Qt::Key_unknown) , m_moidfierEditFinish(Qt::NoModifier) , m_pasteFlags(All) { init(); connect( this, SIGNAL( anchorClicked(const QUrl& )), SLOT(on_link_clicked(const QUrl&))); setTabChangesFocus(false); }
RichTextLineEdit::RichTextLineEdit(QWidget *parent) : QTextEdit(parent) { setLineWrapMode(QTextEdit::NoWrap); setWordWrapMode(QTextOption::NoWrap); setAcceptRichText(true); setTabChangesFocus(true); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); createShortcuts(); createActions(); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(customContextMenuRequested(const QPoint&))); }
ContactListEdit::ContactListEdit(QWidget* parent) : QTextEdit(parent) { _completer = nullptr; connect(this, &QTextEdit::textChanged, this, &ContactListEdit::fitHeightToDocument); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); fitHeightToDocument(); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setTabChangesFocus(true); }
MultilineTextEdit::MultilineTextEdit(QWidget *parent) : QPlainTextEdit(parent), minLineCount_(2), maxLineCount_(10), showContextMenu_(false) { QFontMetrics fontMetric(font()); lineHeight_ = fontMetric.lineSpacing(); // enable focus switch by tab (leaving the editor and committing the changes) setTabChangesFocus(true); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); #if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) // need to enable the scrollbar for adjusting to its contents setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); #endif // make the text edit show at least n lines of text setMinimumHeight(minLineCount_ * lineHeight_); setMaximumHeight(maxLineCount_ * lineHeight_); }
Editor::Editor( QWidget* parent, const char* name ): QTextEdit( parent, name ) { d = new Private; d->eval = 0; d->index = 0; d->autoCompleteEnabled = true; d->completion = new EditorCompletion( this ); d->completionTimer = new QTimer( this ); d->autoCalcEnabled = true; d->syntaxHighlightEnabled = true; d->highlighter = new EditorHighlighter( this ); d->autoCalcTimer = new QTimer( this ); d->matchingTimer = new QTimer( this ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setWordWrap( NoWrap ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); setTextFormat( PlainText ); setAutoFormatting( AutoNone ); setTabChangesFocus( true ); setLinkUnderline( false ); connect( d->completion, SIGNAL( selectedCompletion( const QString& ) ), SLOT( autoComplete( const QString& ) ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoComplete() ) ); connect( d->completionTimer, SIGNAL( timeout() ), SLOT( triggerAutoComplete() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkMatching() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingLeft() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingRight() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoCalc() ) ); connect( d->autoCalcTimer, SIGNAL( timeout() ), SLOT( autoCalc() ) ); d->autoCalcLabel = new CalcResultLabel( 0, "autocalc", WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); d->autoCalcLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); d->autoCalcLabel->setPalette( QToolTip::palette() ); d->autoCalcLabel->hide(); setHighlightColor( Number, QColor(0,0,127) ); setHighlightColor( FunctionName, QColor(85,0,0) ); setHighlightColor( Variable, QColor(0,85,0) ); setHighlightColor( MatchedPar, QColor(255,255,183) ); }
TextEdit::TextEdit(const QString & str, QWidget *parent) : QTextEdit(parent) { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //setFrameShape(QFrame::NoFrame); setFrameShadow(QFrame::Plain); setLineWrapMode(QTextEdit::NoWrap); setAcceptRichText(false); setAutoFormatting(QTextEdit::AutoNone); setTabChangesFocus(true); setPlainText(str); CalcSize(); connect( this, SIGNAL( textChanged() ), this, SLOT( sltTextChanged() ) ); QTextCursor cursor = this->textCursor(); cursor.select(QTextCursor::LineUnderCursor); setTextCursor( cursor ); }
AnnotationWidget::AnnotationWidget(QMutex* mutex, Poppler::Annotation* annotation, QWidget* parent) : QPlainTextEdit(parent), m_mutex(mutex), m_annotation(annotation) { #ifndef HAS_POPPLER_24 QMutexLocker mutexLocker(m_mutex); #endif // HAS_POPPLER_24 setTabChangesFocus(true); setPlainText(m_annotation->contents()); connect(this, SIGNAL(textChanged()), SLOT(on_textChanged())); connect(this, SIGNAL(textChanged()), SIGNAL(wasModified())); moveCursor(QTextCursor::End); }
DisplayWidget::DisplayWidget(QWidget *parent) : QTextEdit(parent) { setReadOnly(true); setTabChangesFocus(true); setOverwriteMode(true); setAlignment(Qt::AlignCenter); resetLine(); append(tr("Welcome to the Free Group Calculator!\n")); setAlignment(Qt::AlignLeft); setFontFamily("Monaco"); setFontPointSize(12.0); append(tr("[%1 %2]:>").arg(Input).arg(lineNumber)); moveCursor(QTextCursor::End); }
//------------------------------------------------------------------------------------------------- QCommandPrompt::QCommandPrompt(QWidget *parent) :QPlainTextEdit(parent) ,m_sPrompt("Lua") ,m_sPromptChar(">") ,m_vHistory() ,m_vLineQueue() ,m_pTimerQueue(new QTimer(this)) ,m_font() ,m_mtxLineQueue() ,m_colDefault(Qt::darkBlue) ,m_nHistPos(0) ,m_nMaxLines(200) ,m_nMaxHist(5) ,m_nPromptPos() ,m_nTimerInterval(50) ,m_nBlockSize(200) ,m_bIsMuted(false) { setAcceptDrops(true); // drops will be accepted (filenames and commands) setUndoRedoEnabled(false); // undo is not necessary in a console setTabChangesFocus(false); // tab will be needed for auto completion setLineWrapMode(QPlainTextEdit::NoWrap); m_pTimerQueue->setSingleShot(false); m_pTimerQueue->start(m_nTimerInterval); connect(m_pTimerQueue, SIGNAL(timeout()), this, SLOT(writeQueue())); /* QStringList vWordList; vWordList.push_back("abcd"); vWordList.push_back("efgh"); vWordList.push_back("aaaaaa"); m_pCompleter = new QCompleter(vWordList); m_pCompleter->setCaseSensitivity(Qt::CaseSensitive); //Make caseInsensitive selection m_pCompleter->setCompletionMode(QCompleter::InlineCompletion); //Used to enable in line searching this->setCompleter(m_pCompleter); */ document()->setMaximumBlockCount(m_nMaxLines); }
Editor::Editor(QWidget* parent) : QPlainTextEdit(parent) { m_evaluator = Evaluator::instance(); m_currentHistoryIndex = 0; m_isAutoCompletionEnabled = true; m_completion = new EditorCompletion(this); m_constantCompletion = 0; m_completionTimer = new QTimer(this); m_isAutoCalcEnabled = true; m_highlighter = new SyntaxHighlighter(this); m_autoCalcTimer = new QTimer(this); m_autoCalcSelTimer = new QTimer(this); m_matchingTimer = new QTimer(this); m_isAnsAvailable = false; m_shouldPaintCustomCursor = true; setViewportMargins(0, 0, 0, 0); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); setTabChangesFocus(true); setWordWrapMode(QTextOption::NoWrap); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setCursorWidth(0); connect(m_autoCalcTimer, SIGNAL(timeout()), SLOT(autoCalc())); connect(m_autoCalcSelTimer, SIGNAL(timeout()), SLOT(autoCalcSelection())); connect(m_completion, SIGNAL(selectedCompletion(const QString&)), SLOT(autoComplete(const QString&))); connect(m_completionTimer, SIGNAL(timeout()), SLOT(triggerAutoComplete())); connect(m_matchingTimer, SIGNAL(timeout()), SLOT(doMatchingPar())); connect(this, SIGNAL(selectionChanged()), SLOT(startSelAutoCalcTimer())); connect(this, SIGNAL(textChanged()), SLOT(checkAutoCalc())); connect(this, SIGNAL(textChanged()), SLOT(checkAutoComplete())); connect(this, SIGNAL(textChanged()), SLOT(checkMatching())); adjustSize(); setFixedHeight(sizeHint().height()); }
CQExpressionWidget::CQExpressionWidget(QWidget * parent, const char * name) : QTextEdit(parent), mpValidatorExpression(NULL), mpValidatorFunction(NULL), mObjectClasses(TransientExpression), mpCurrentObject(NULL) { setObjectName(QString::fromUtf8(name)); setTabChangesFocus(true); mpExpressionHighlighter = new CQExpressionHighlighter(this); int h, s, v; mSavedColor = palette().color(backgroundRole()); mSavedColor.getHsv(&h, &s, &v); if (s < 20) s = 20; mChangedColor.setHsv(240, s, v); connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged())); }
void SimpleRichTextEdit::toggleTabChangesFocus() { setTabChangesFocus(!tabChangesFocus()); }
PlainTextEditor::PlainTextEditor( QWidget* parent ) : QPlainTextEdit( parent ) { setTabStopWidth( 40 ); setTabChangesFocus( false ); }
int QPlainTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractScrollArea::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 25) qt_static_metacall(this, _c, _id, _a); _id -= 25; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = tabChangesFocus(); break; case 1: *reinterpret_cast< QString*>(_v) = documentTitle(); break; case 2: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break; case 3: *reinterpret_cast< LineWrapMode*>(_v) = lineWrapMode(); break; case 4: *reinterpret_cast< bool*>(_v) = isReadOnly(); break; case 5: *reinterpret_cast< QString*>(_v) = toPlainText(); break; case 6: *reinterpret_cast< bool*>(_v) = overwriteMode(); break; case 7: *reinterpret_cast< int*>(_v) = tabStopWidth(); break; case 8: *reinterpret_cast< int*>(_v) = cursorWidth(); break; case 9: *reinterpret_cast< Qt::TextInteractionFlags*>(_v) = textInteractionFlags(); break; case 10: *reinterpret_cast< int*>(_v) = blockCount(); break; case 11: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break; case 12: *reinterpret_cast< bool*>(_v) = backgroundVisible(); break; case 13: *reinterpret_cast< bool*>(_v) = centerOnScroll(); break; } _id -= 14; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setTabChangesFocus(*reinterpret_cast< bool*>(_v)); break; case 1: setDocumentTitle(*reinterpret_cast< QString*>(_v)); break; case 2: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break; case 3: setLineWrapMode(*reinterpret_cast< LineWrapMode*>(_v)); break; case 4: setReadOnly(*reinterpret_cast< bool*>(_v)); break; case 5: setPlainText(*reinterpret_cast< QString*>(_v)); break; case 6: setOverwriteMode(*reinterpret_cast< bool*>(_v)); break; case 7: setTabStopWidth(*reinterpret_cast< int*>(_v)); break; case 8: setCursorWidth(*reinterpret_cast< int*>(_v)); break; case 9: setTextInteractionFlags(*reinterpret_cast< Qt::TextInteractionFlags*>(_v)); break; case 11: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break; case 12: setBackgroundVisible(*reinterpret_cast< bool*>(_v)); break; case 13: setCenterOnScroll(*reinterpret_cast< bool*>(_v)); break; } _id -= 14; } else if (_c == QMetaObject::ResetProperty) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 14; } #endif // QT_NO_PROPERTIES return _id; }
text_edit_t::text_edit_t( QWidget *parent) : QPlainTextEdit( parent) { setTabChangesFocus( true); document()->setModified( false); }
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); }