Added a few more properties as well as removing some of the warnings

about missing READ members.
This commit is contained in:
ian geiser
2015-08-06 10:32:14 -04:00
parent 490eeaf195
commit ff81d5f08d
4 changed files with 102 additions and 39 deletions
+53 -19
View File
@@ -280,13 +280,22 @@ void TerminalDisplay::setVTFont(const QFont& f)
m_font = font;
fontChange(font);
emit vtFontChanged();
//}
}
void TerminalDisplay::setBoldIntense(bool value)
{
if ( _boldIntense != value ) {
_boldIntense = value;
emit boldIntenseChanged();
}
}
void TerminalDisplay::setFont(const QFont &f)
{
Q_UNUSED(f);
// ignore font change request if not coming from konsole itself
Q_UNUSED(f);
// ignore font change request if not coming from konsole itself
}
/* ------------------------------------------------------------------------- */
@@ -3086,8 +3095,11 @@ uint TerminalDisplay::lineSpacing() const
void TerminalDisplay::setLineSpacing(uint i)
{
_lineSpacing = i;
setVTFont(font()); // Trigger an update.
if ( i != _lineSpacing ) {
_lineSpacing = i;
setVTFont(font()); // Trigger an update.
emit lineSpacingChanged();
}
}
AutoScrollHandler::AutoScrollHandler(QWidget* parent)
@@ -3228,24 +3240,33 @@ QStringList TerminalDisplay::availableColorSchemes()
void TerminalDisplay::setColorScheme(const QString &name)
{
const ColorScheme *cs;
// avoid legacy (int) solution
if (!availableColorSchemes().contains(name))
cs = ColorSchemeManager::instance()->defaultColorScheme();
else
cs = ColorSchemeManager::instance()->findColorScheme(name);
if ( name != _colorScheme ) {
const ColorScheme *cs;
// avoid legacy (int) solution
if (!availableColorSchemes().contains(name))
cs = ColorSchemeManager::instance()->defaultColorScheme();
else
cs = ColorSchemeManager::instance()->findColorScheme(name);
if (! cs)
{
qDebug() << "Cannot load color scheme: " << name;
return;
if (! cs)
{
qDebug() << "Cannot load color scheme: " << name;
return;
}
ColorEntry table[TABLE_COLORS];
cs->getColorTable(table);
setColorTable(table);
setFillColor(cs->backgroundColor());
_colorScheme = name;
emit colorSchemeChanged();
}
}
ColorEntry table[TABLE_COLORS];
cs->getColorTable(table);
setColorTable(table);
setFillColor(cs->backgroundColor());
QString TerminalDisplay::colorScheme() const
{
return _colorScheme;
}
void TerminalDisplay::simulateKeyPress(int key, int modifiers, bool pressed, quint32 nativeScanCode, const QString &text)
@@ -3311,6 +3332,19 @@ QSize TerminalDisplay::getFontMetrics()
return QSize(_fontWidth, _fontHeight);
}
void TerminalDisplay::setFullCursorHeight(bool val)
{
if ( m_full_cursor_height != val ) {
m_full_cursor_height = val;
emit fullCursorHeightChanged();
}
}
bool TerminalDisplay::fullCursorHeight() const
{
return m_full_cursor_height;
}
void TerminalDisplay::itemChange(ItemChange change, const ItemChangeData & value)
{
switch (change) {
+21 -11
View File
@@ -84,10 +84,10 @@ class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(KSession* session READ getSession WRITE setSession NOTIFY sessionChanged )
Q_PROPERTY(QFont font READ getVTFont WRITE setVTFont )
Q_PROPERTY(QString colorScheme WRITE setColorScheme )
Q_PROPERTY(QFont font READ getVTFont WRITE setVTFont NOTIFY vtFontChanged )
Q_PROPERTY(QString colorScheme READ colorScheme WRITE setColorScheme NOTIFY colorSchemeChanged )
Q_PROPERTY(QSize terminalSize READ getTerminalSize NOTIFY changedContentSizeSignal)
Q_PROPERTY(int lineSpacing WRITE setLineSpacing )
Q_PROPERTY(int lineSpacing READ lineSpacing WRITE setLineSpacing NOTIFY lineSpacingChanged )
Q_PROPERTY(bool terminalUsesMouse READ getUsesMouse NOTIFY usesMouseChanged )
Q_PROPERTY(int lines READ lines NOTIFY changedContentSizeSignal)
Q_PROPERTY(int columns READ columns NOTIFY changedContentSizeSignal)
@@ -96,9 +96,10 @@ class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
Q_PROPERTY(int scrollbarMinimum READ getScrollbarMinimum NOTIFY scrollbarParamsChanged )
Q_PROPERTY(QSize fontMetrics READ getFontMetrics NOTIFY changedFontMetricSignal )
Q_PROPERTY(bool enableBold WRITE setBoldIntense)
Q_PROPERTY(bool fullCursorHeight WRITE setFullCursorHeight)
Q_PROPERTY(bool enableBold READ getBoldIntense WRITE setBoldIntense NOTIFY boldIntenseChanged )
Q_PROPERTY(bool fullCursorHeight READ fullCursorHeight WRITE setFullCursorHeight NOTIFY fullCursorHeightChanged)
Q_PROPERTY(bool antialiasText READ antialias WRITE setAntialias)
Q_PROPERTY(QStringList availableColorSchemes READ availableColorSchemes NOTIFY availableColorSchemesChanged)
public:
/** Constructs a new terminal display widget with the specified parent. */
@@ -123,6 +124,7 @@ public:
/** Sets the opacity of the terminal display. */
void setOpacity(qreal opacity);
/**
* This enum describes the location where the scroll bar is positioned in the display widget.
*/
@@ -397,7 +399,7 @@ public:
* Specifies whether characters with intense colors should be rendered
* as bold. Defaults to true.
*/
void setBoldIntense(bool value) { _boldIntense = value; }
void setBoldIntense(bool value);
/**
* Returns true if characters with intense colors are rendered in bold.
*/
@@ -548,6 +550,7 @@ public slots:
// QMLTermWidget
void setColorScheme(const QString &name);
QString colorScheme() const;
QStringList availableColorSchemes();
void simulateKeyPress(int key, int modifiers, bool pressed, quint32 nativeScanCode, const QString &text);
@@ -594,15 +597,15 @@ signals:
*/
void overrideShortcutCheck(QKeyEvent* keyEvent,bool& override);
void isBusySelecting(bool);
void isBusySelecting(bool busy);
void sendStringToEmu(const char*);
// qtermwidget signals
void copyAvailable(bool);
void copyAvailable(bool available);
void termGetFocus();
void termLostFocus();
void notifyBell(const QString&);
void notifyBell(const QString& bell);
// QMLTermWidget
void sessionChanged();
@@ -611,6 +614,12 @@ signals:
void imagePainted();
void scrollbarValueChanged();
void scrollbarParamsChanged(int value);
void vtFontChanged();
void lineSpacingChanged();
void availableColorSchemesChanged();
void colorSchemeChanged();
void fullCursorHeightChanged();
void boldIntenseChanged();
protected:
virtual bool event( QEvent * );
@@ -842,7 +851,7 @@ private:
QLabel* _outputSuspendedLabel;
uint _lineSpacing;
QString _colorScheme;
bool _colorsInverted; // true during visual bell
QSize _size;
@@ -911,13 +920,14 @@ private:
QSize getFontMetrics();
void setFullCursorHeight(bool val) { m_full_cursor_height = val; }
void setFullCursorHeight(bool val);
public:
static void setTransparencyEnabled(bool enable)
{
HAVE_TRANSPARENCY = enable;
}
bool fullCursorHeight() const;
};
class AutoScrollHandler : public QObject
+21 -7
View File
@@ -166,9 +166,11 @@ void KSession::setShellProgram(const QString &progname)
void KSession::setInitialWorkingDirectory(const QString &dir)
{
_initialWorkingDirectory = dir;
m_session->setInitialWorkingDirectory(dir);
}
if ( _initialWorkingDirectory == dir ) {
_initialWorkingDirectory = dir;
m_session->setInitialWorkingDirectory(dir);
emit initialWorkingDirectoryChanged();
} }
QString KSession::getInitialWorkingDirectory()
{
@@ -187,10 +189,22 @@ void KSession::setTextCodec(QTextCodec *codec)
void KSession::setHistorySize(int lines)
{
if (lines < 0)
m_session->setHistoryType(HistoryTypeFile());
else
m_session->setHistoryType(HistoryTypeBuffer(lines));
if ( historySize() != lines ) {
if (lines < 0)
m_session->setHistoryType(HistoryTypeFile());
else
m_session->setHistoryType(HistoryTypeBuffer(lines));
emit historySizeChanged();
}
}
int KSession::historySize() const
{
if ( m_session->historyType().isUnlimited() ) {
return -1;
} else {
return m_session->historyType().maximumLineCount();
}
}
void KSession::sendText(QString text)
+7 -2
View File
@@ -35,8 +35,8 @@ class KSession : public QObject
{
Q_OBJECT
Q_PROPERTY(QString kbScheme READ getKeyBindings WRITE setKeyBindings NOTIFY changedKeyBindings)
Q_PROPERTY(QString initialWorkingDirectory READ getInitialWorkingDirectory WRITE setInitialWorkingDirectory)
Q_PROPERTY(QString title READ getTitle NOTIFY titleChanged)
Q_PROPERTY(QString initialWorkingDirectory READ getInitialWorkingDirectory WRITE setInitialWorkingDirectory NOTIFY initialWorkingDirectoryChanged)
Q_PROPERTY(QString title READ getTitle WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(QString shellProgram WRITE setShellProgram)
public:
@@ -65,6 +65,7 @@ public:
// History size for scrolling
void setHistorySize(int lines); //infinite if lines < 0
int historySize() const;
// Sets whether flow control is enabled
void setFlowControlEnabled(bool enabled);
@@ -100,6 +101,10 @@ signals:
void titleChanged();
void historySizeChanged();
void initialWorkingDirectoryChanged();
public slots:
/*! Set named key binding for given widget