282
282
fontChange(font);
283
emit vtFontChanged();
287
void TerminalDisplay::setBoldIntense(bool value)
289
if ( _boldIntense != value ) {
290
_boldIntense = value;
291
emit boldIntenseChanged();
286
295
void TerminalDisplay::setFont(const QFont &f)
289
// ignore font change request if not coming from konsole itself
298
// ignore font change request if not coming from konsole itself
292
301
/* ------------------------------------------------------------------------- */
329
338
,_cursorBlinking(false)
330
339
,_hasBlinkingCursor(false)
331
340
,_allowBlinkingText(true)
332
,_dragMode(CtrlModifierDrag)
333
342
,_tripleClickMode(SelectWholeLine)
334
343
,_isFixedSize(false)
335
344
,_possibleTripleClick(false)
345
354
,mMotionAfterPasting(NoMoveScreenWindow)
346
355
,m_font("Monospace", 12)
347
356
,m_color_role(QPalette::Background)
357
,m_full_cursor_height(false)
349
359
// terminal applications are not designed with Right-To-Left in mind,
350
360
// so the layout is forced to Left-To-Right
1270
1280
//drawBackground(*painter, rect, m_palette.background().color(), false /* use opacity setting */);
1271
1281
drawContents(*painter, dirtyRect);
1273
emit imagePainted();
1275
1283
//drawInputMethodPreeditString(*painter, preeditRect());
1276
1284
//paintFilters(painter);
1805
1813
selected = _screenWindow->isSelected(pos.x(),pos.y());
1807
if (((_dragMode == DragMode::CtrlModifierDrag && ev->modifiers() & Qt::ControlModifier) ||
1808
_dragMode == DragMode::NoModifierDrag) && selected ) {
1815
if ((!_ctrlDrag || ev->modifiers() & Qt::ControlModifier) && selected ) {
1809
1816
// The user clicked inside selected text
1810
1817
dragInfo.state = diPending;
1811
1818
dragInfo.start = ev->pos();
2571
2578
emitSelection(true,false);
2574
// TODO: These 2 functions are not in the upstream LxQt version
2575
// See https://code.launchpad.net/~mcintire-evan/ubuntu-terminal-app/disable-paste/+merge/283244/comments/725331
2576
bool TerminalDisplay::isClipboardEmpty()
2578
return QApplication::clipboard()->text().isEmpty();
2581
bool TerminalDisplay::isSelectionEmpty()
2583
return _screenWindow->selectedText(_preserveLineBreaks).isEmpty();
2586
2581
/* ------------------------------------------------------------------------- */
2999
2994
if (event->mimeData()->hasFormat("text/plain"))
3000
2995
event->acceptProposedAction();
3001
if (event->mimeData()->urls().count());
2996
if (event->mimeData()->urls().count())
3002
2997
event->acceptProposedAction();
3101
3096
void TerminalDisplay::setLineSpacing(uint i)
3104
setVTFont(font()); // Trigger an update.
3098
if ( i != _lineSpacing ) {
3100
setVTFont(font()); // Trigger an update.
3101
emit lineSpacingChanged();
3107
3105
AutoScrollHandler::AutoScrollHandler(QWidget* parent)
3182
3180
// QQuickPaintedItem::update(rect.adjusted(-1, -1, +1, +1));
3184
3182
QQuickPaintedItem::update(region.boundingRect().adjusted(-1, -1, +1, +1));
3183
emit imagePainted();
3187
3186
void TerminalDisplay::update()
3242
3241
void TerminalDisplay::setColorScheme(const QString &name)
3244
const ColorScheme *cs;
3245
// avoid legacy (int) solution
3246
if (!availableColorSchemes().contains(name))
3247
cs = ColorSchemeManager::instance()->defaultColorScheme();
3249
cs = ColorSchemeManager::instance()->findColorScheme(name);
3253
qDebug() << "Cannot load color scheme: " << name;
3243
if ( name != _colorScheme ) {
3244
const ColorScheme *cs;
3245
// avoid legacy (int) solution
3246
if (!availableColorSchemes().contains(name))
3247
cs = ColorSchemeManager::instance()->defaultColorScheme();
3249
cs = ColorSchemeManager::instance()->findColorScheme(name);
3253
qDebug() << "Cannot load color scheme: " << name;
3257
ColorEntry table[TABLE_COLORS];
3258
cs->getColorTable(table);
3259
setColorTable(table);
3261
setFillColor(cs->backgroundColor());
3262
_colorScheme = name;
3263
emit colorSchemeChanged();
3257
ColorEntry table[TABLE_COLORS];
3258
cs->getColorTable(table);
3259
setColorTable(table);
3261
setFillColor(cs->backgroundColor());
3264
void TerminalDisplay::simulateKeyPress(int key, int modifiers, bool pressed, quint32 nativeScanCode, QString text)
3267
QString TerminalDisplay::colorScheme() const
3269
return _colorScheme;
3272
void TerminalDisplay::simulateKeyPress(int key, int modifiers, bool pressed, quint32 nativeScanCode, const QString &text)
3266
3274
Q_UNUSED(nativeScanCode);
3268
// TODO WORKAROUND: If text is not given we try to guess it from the unicode value.
3269
// This solution is probably not complete on the domain, but works for the most common cases.
3270
if (text.isEmpty()) {
3271
bool shiftMod = modifiers & Qt::ShiftModifier;
3272
text = QString(shiftMod ? QChar(key) : QChar(key).toLower());
3275
3275
QEvent::Type type = pressed ? QEvent::KeyPress : QEvent::KeyRelease;
3276
3276
QKeyEvent event = QKeyEvent(type, key, (Qt::KeyboardModifier) modifiers, text);
3277
3277
keyPressedSignal(&event);
3332
3332
return QSize(_fontWidth, _fontHeight);
3335
void TerminalDisplay::setFullCursorHeight(bool val)
3337
if ( m_full_cursor_height != val ) {
3338
m_full_cursor_height = val;
3339
emit fullCursorHeightChanged();
3343
bool TerminalDisplay::fullCursorHeight() const
3345
return m_full_cursor_height;
3335
3348
void TerminalDisplay::itemChange(ItemChange change, const ItemChangeData & value)
3337
3350
switch (change) {