void PostWindow::applySettings(Settings::Manager * settings) { int scrollback = settings->value("IDE/postWindow/scrollback").toInt(); QFont font = settings->codeFont(); QPalette palette; settings->beginGroup("IDE/editor/colors"); if (settings->contains("text")) { QTextCharFormat format = settings->value("text").value<QTextCharFormat>(); QBrush bg = format.background(); QBrush fg = format.foreground(); if (bg.style() != Qt::NoBrush) palette.setBrush(QPalette::Base, bg); if (fg.style() != Qt::NoBrush) palette.setBrush(QPalette::Text, fg); } settings->endGroup(); // colors bool lineWrap = settings->value("IDE/postWindow/lineWrap").toBool(); setMaximumBlockCount(scrollback); setFont(font); setPalette(palette); setLineWrap( lineWrap ); QFontMetrics metrics (font); QString stringOfSpaces (settings->value("IDE/editor/indentWidth").toInt(), QChar(' ')); setTabStopWidth(metrics.width(stringOfSpaces)); updateActionShortcuts(settings); }
void PostWindow::applySettings(Settings::Manager * settings) { int scrollback = settings->value("IDE/postWindow/scrollback").toInt(); QFont font = settings->codeFont(); QPalette palette; settings->beginGroup("IDE/editor/colors"); if (settings->contains("text")) { QTextCharFormat format = settings->value("text").value<QTextCharFormat>(); QBrush bg = format.background(); QBrush fg = format.foreground(); if (bg.style() != Qt::NoBrush) palette.setBrush(QPalette::Base, bg); if (fg.style() != Qt::NoBrush) palette.setBrush(QPalette::Text, fg); } settings->endGroup(); // colors bool lineWrap = settings->value("IDE/postWindow/lineWrap").toBool(); setMaximumBlockCount(scrollback); setFont(font); setPalette(palette); setLineWrap( lineWrap ); }
int QTextDocument::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 14) qt_static_metacall(this, _c, _id, _a); _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break; case 1: *reinterpret_cast< bool*>(_v) = isModified(); break; case 2: *reinterpret_cast< QSizeF*>(_v) = pageSize(); break; case 3: *reinterpret_cast< QFont*>(_v) = defaultFont(); break; case 4: *reinterpret_cast< bool*>(_v) = useDesignMetrics(); break; case 5: *reinterpret_cast< QSizeF*>(_v) = size(); break; case 6: *reinterpret_cast< qreal*>(_v) = textWidth(); break; case 7: *reinterpret_cast< int*>(_v) = blockCount(); break; case 8: *reinterpret_cast< qreal*>(_v) = indentWidth(); break; case 9: *reinterpret_cast< QString*>(_v) = defaultStyleSheet(); break; case 10: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break; case 11: *reinterpret_cast< qreal*>(_v) = documentMargin(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break; case 1: setModified(*reinterpret_cast< bool*>(_v)); break; case 2: setPageSize(*reinterpret_cast< QSizeF*>(_v)); break; case 3: setDefaultFont(*reinterpret_cast< QFont*>(_v)); break; case 4: setUseDesignMetrics(*reinterpret_cast< bool*>(_v)); break; case 6: setTextWidth(*reinterpret_cast< qreal*>(_v)); break; case 8: setIndentWidth(*reinterpret_cast< qreal*>(_v)); break; case 9: setDefaultStyleSheet(*reinterpret_cast< QString*>(_v)); break; case 10: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break; case 11: setDocumentMargin(*reinterpret_cast< qreal*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }
ConsoleWidget::ConsoleWidget(MainWindow *main) : QPlainTextEdit((QWidget *)main) { m_main = main; m_color = CW_DEFAULT_COLOR; m_suppress = false; // a block is a line, so this is the maximum number of lines to buffer setMaximumBlockCount(CW_SCROLLHEIGHT); acceptInput(false); }
void OutputWindow::appendMessage(const QString &output, OutputFormat format) { const QString out = SynchronousProcess::normalizeNewlines(output); setMaximumBlockCount(d->maxLineCount); const bool atBottom = isScrollbarAtBottom() || m_scrollTimer.isActive(); if (format == ErrorMessageFormat || format == NormalMessageFormat) { d->formatter->appendMessage(doNewlineEnforcement(out), format); } else { bool sameLine = format == StdOutFormatSameLine || format == StdErrFormatSameLine; if (sameLine) { d->scrollToBottom = true; int newline = -1; bool enforceNewline = d->enforceNewline; d->enforceNewline = false; if (!enforceNewline) { newline = out.indexOf(QLatin1Char('\n')); moveCursor(QTextCursor::End); if (newline != -1) d->formatter->appendMessage(out.left(newline), format);// doesn't enforce new paragraph like appendPlainText } QString s = out.mid(newline+1); if (s.isEmpty()) { d->enforceNewline = true; } else { if (s.endsWith(QLatin1Char('\n'))) { d->enforceNewline = true; s.chop(1); } d->formatter->appendMessage(QLatin1Char('\n') + s, format); } } else { d->formatter->appendMessage(doNewlineEnforcement(out), format); } } if (atBottom) { if (m_lastMessage.elapsed() < 5) { m_scrollTimer.start(); } else { m_scrollTimer.stop(); scrollToBottom(); } } m_lastMessage.start(); enableUndoRedo(); }
QTerminalEdit::QTerminalEdit(QWidget *parent) : QPlainTextEdit(parent) { echoBytes = false; hexMode = false; setFont(QFont("Consolas")); setWordWrapMode(QTextOption::WrapAnywhere); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setMaximumBlockCount(100); }
ConsoleWidget::ConsoleWidget(MainWindow *main) : QPlainTextEdit((QWidget *)main) { m_main = main; m_suppress = false; m_histIndex = -1; // a block is a line, so this is the maximum number of lines to buffer setMaximumBlockCount(CW_SCROLLHEIGHT); acceptInput(false); connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleTimer())); }
QmtxLogBox::QmtxLogBox( QWidget * parent ) : QPlainTextEdit(parent) { setFont( QFont( "Consolas", 8, QFont::Normal ) ) ; setReadOnly( true ) ; setMaximumBlockCount( 1024 ) ; setCenterOnScroll( true ) ; // only first if ( single == NULL ) single = this ; }
LogView::LogView(QWidget *parent) : QPlainTextEdit(parent) { setReadOnly(true); setMaximumBlockCount(200); setCenterOnScroll(true); setFrameStyle(QFrame::NoFrame); // Init actions m_saveToFileAction = KStandardAction::saveAs(this, SLOT(slotSaveToFile()), this); m_clearLogAction = KStandardAction::clear(this, SLOT(clear()), this); }
Log::Log(QWidget * parent) : QPlainTextEdit(parent) { setReadOnly(true); setMaximumBlockCount(500); setStyleSheet("color: #333;"); QFont font("Monospace"); font.setFamily("Terminus"); font.setStyleHint(QFont::TypeWriter); setFont(font); QDate date = QDate::currentDate(); appendHtml("[" + date.toString("dd.MM.yy") + "] <b>New relace</b>"); receiveLog("Welcome to puzzleSEQ"); }
TextDocument::TextDocument(IrcBuffer* buffer) : QTextDocument(buffer) { qRegisterMetaType<TextDocument*>(); d.uc = 0; d.dirty = -1; d.rebuild = -1; d.lowlight = -1; d.clone = false; d.buffer = buffer; d.visible = false; d.formatter = new MessageFormatter(this); d.formatter->setBuffer(buffer); setUndoRedoEnabled(false); setMaximumBlockCount(1000); connect(buffer->connection(), SIGNAL(disconnected()), this, SLOT(lowlight())); connect(buffer, SIGNAL(messageReceived(IrcMessage*)), this, SLOT(receiveMessage(IrcMessage*))); }
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; }
int QTextDocument::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: contentsChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 1: contentsChanged(); break; case 2: undoAvailable((*reinterpret_cast< bool(*)>(_a[1]))); break; case 3: redoAvailable((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: undoCommandAdded(); break; case 5: modificationChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 6: cursorPositionChanged((*reinterpret_cast< const QTextCursor(*)>(_a[1]))); break; case 7: blockCountChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: documentLayoutChanged(); break; case 9: undo(); break; case 10: redo(); break; case 11: appendUndoItem((*reinterpret_cast< QAbstractUndoItem*(*)>(_a[1]))); break; case 12: setModified((*reinterpret_cast< bool(*)>(_a[1]))); break; case 13: setModified(); break; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled(); break; case 1: *reinterpret_cast< bool*>(_v) = isModified(); break; case 2: *reinterpret_cast< QSizeF*>(_v) = pageSize(); break; case 3: *reinterpret_cast< QFont*>(_v) = defaultFont(); break; case 4: *reinterpret_cast< bool*>(_v) = useDesignMetrics(); break; case 5: *reinterpret_cast< QSizeF*>(_v) = size(); break; case 6: *reinterpret_cast< qreal*>(_v) = textWidth(); break; case 7: *reinterpret_cast< int*>(_v) = blockCount(); break; case 8: *reinterpret_cast< qreal*>(_v) = indentWidth(); break; case 9: *reinterpret_cast< QString*>(_v) = defaultStyleSheet(); break; case 10: *reinterpret_cast< int*>(_v) = maximumBlockCount(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setUndoRedoEnabled(*reinterpret_cast< bool*>(_v)); break; case 1: setModified(*reinterpret_cast< bool*>(_v)); break; case 2: setPageSize(*reinterpret_cast< QSizeF*>(_v)); break; case 3: setDefaultFont(*reinterpret_cast< QFont*>(_v)); break; case 4: setUseDesignMetrics(*reinterpret_cast< bool*>(_v)); break; case 6: setTextWidth(*reinterpret_cast< qreal*>(_v)); break; case 8: setIndentWidth(*reinterpret_cast< qreal*>(_v)); break; case 9: setDefaultStyleSheet(*reinterpret_cast< QString*>(_v)); break; case 10: setMaximumBlockCount(*reinterpret_cast< int*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
void OutputWindow::enableUndoRedo() { setMaximumBlockCount(0); setUndoRedoEnabled(true); }
void OutputWindow::setMaxLineCount(int count) { d->maxLineCount = count; setMaximumBlockCount(d->maxLineCount); }
FileNameTextEdit::FileNameTextEdit(QWidget *parent) : QPlainTextEdit(parent) , m_completer(0) { setMaximumBlockCount(1); }