comparison libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp @ 16688:c19cc8c158b3

Allow setting background/forground terminal colors in Unix (bug #39016) * libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp (QUnixTerminalImpl::setBackgroundColor): Provided function body. (QUnixTerminalImpl::setForegroundColor): Provided function body.
author John Donoghue <john.donoghue@ieee.org>
date Sat, 18 May 2013 23:00:19 -0400
parents ba808cd9d86c
children 1d1f02e0f6b4
comparison
equal deleted inserted replaced
16687:f4d18d3f7fd7 16688:c19cc8c158b3
135 m_terminalView->setBlinkingCursor(blinking); 135 m_terminalView->setBlinkingCursor(blinking);
136 } 136 }
137 137
138 // FIXME -- not sure how to make these work properly given the way the 138 // FIXME -- not sure how to make these work properly given the way the
139 // Unix terminal handles colors. 139 // Unix terminal handles colors.
140 void QUnixTerminalImpl::setBackgroundColor (const QColor& color) { } 140 void QUnixTerminalImpl::setBackgroundColor (const QColor& color)
141 void QUnixTerminalImpl::setForegroundColor (const QColor& color) { } 141 {
142 ColorEntry cols[TABLE_COLORS];
143
144 const ColorEntry * curr_cols = m_terminalView->colorTable();
145 for(int i=0;i<TABLE_COLORS;i++)
146 {
147 cols[i] = curr_cols[i];
148 }
149
150 cols[DEFAULT_BACK_COLOR].color = color;
151
152 m_terminalView->setColorTable(cols);
153
154 }
155 void QUnixTerminalImpl::setForegroundColor (const QColor& color)
156 {
157 ColorEntry cols[TABLE_COLORS];
158
159 const ColorEntry * curr_cols = m_terminalView->colorTable();
160 for(int i=0;i<TABLE_COLORS;i++)
161 {
162 cols[i] = curr_cols[i];
163 }
164
165 cols[DEFAULT_FORE_COLOR].color = color;
166
167 m_terminalView->setColorTable(cols);
168
169
170 }
142 void QUnixTerminalImpl::setSelectionColor (const QColor& color) { } 171 void QUnixTerminalImpl::setSelectionColor (const QColor& color) { }
143 172
144 void QUnixTerminalImpl::setCursorColor (bool useForegroundColor, 173 void QUnixTerminalImpl::setCursorColor (bool useForegroundColor,
145 const QColor& color) 174 const QColor& color)
146 { 175 {