Commit bc1fb9d0 authored by Robert Knight's avatar Robert Knight
Browse files

* Consistant naming for private fields in TerminalDisplay class.

* KConfig -> KConfigGroup porting
* KKeyDialog -> KShortcutsDialog
* Adapt to KFontDialog changes


svn path=/branches/work/konsole-split-view/; revision=650337
parent d0afc223
......@@ -98,7 +98,7 @@ KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(const QString& nam
QFile source(_paths[name]); // TODO get correct path here
source.open(QIODevice::ReadOnly);
KeyboardTranslatorReader reader(device);
KeyboardTranslatorReader reader(&source);
while ( reader.hasNextEntry() )
translator->addEntry(reader.nextEntry());
......@@ -142,10 +142,6 @@ QList<QString> KeyboardTranslatorManager::availableTranslators() const
return _translators.keys();
}
char* KeyboardTranslator::Entry::_textBuffer = 0;
int KeyboardTranslator::Entry::_textBufferUsedLength = 0;
int KeyboardTranslator::Entry::_textBufferSize = 0;
KeyboardTranslator::Entry::Entry( int keyCode,
Qt::KeyboardModifier modifiers,
State flags,
......
......@@ -217,18 +217,18 @@ class KeyboardTranslatorReader
{
public:
/** Constructs a new reader which parses the given @p source */
KeyboardTranslatorReader( QIODevice* source );
KeyboardTranslatorReader( QIODevice* source ) {};
/** Returns true if there is another entry in the source stream */
bool hasNextEntry();
bool hasNextEntry() { return false; };
/** Returns the next entry found in the source stream */
KeyboardTranslator::Entry nextEntry();
KeyboardTranslator::Entry nextEntry() { return KeyboardTranslator::Entry(Qt::Key_unknown,Qt::NoModifier,KeyboardTranslator::NoState,"",KeyboardTranslator::NoCommand); };
/**
* Returns true if an error occurred whilst parsing the input or
* false if no error occurred.
*/
bool parseError();
bool parseError() { return false; };
};
/**
......@@ -283,7 +283,7 @@ inline KeyboardTranslator::Command KeyboardTranslator::Entry::command() const
{
return _command;
}
inline char* KeyboardTranslator::Entry::text() const
inline const char* KeyboardTranslator::Entry::text() const
{
return _text;
}
......
......@@ -24,7 +24,7 @@
#include <KAction>
#include <KActionCollection>
#include <KActionMenu>
#include <KKeyDialog>
#include <KShortcutsDialog>
#include <KLocale>
#include <KMenu>
#include <KMenuBar>
......@@ -140,7 +140,7 @@ void MainWindow::newWindow()
void MainWindow::showShortcutsDialog()
{
KKeyDialog::configure( actionCollection() );
KShortcutsDialog::configure( actionCollection() );
}
void MainWindow::sessionSelected(const QString& key)
......
......@@ -429,8 +429,8 @@ void Session::updateTerminalSize()
TerminalDisplay* view = viewIter.next();
if ( view->isHidden() == false )
{
minLines = (minLines == -1) ? view->Lines() : qMin( minLines , view->Lines() );
minColumns = (minColumns == -1) ? view->Columns() : qMin( minColumns , view->Columns() );
minLines = (minLines == -1) ? view->lines() : qMin( minLines , view->lines() );
minColumns = (minColumns == -1) ? view->columns() : qMin( minColumns , view->columns() );
}
}
......
This diff is collapsed.
......@@ -81,30 +81,47 @@ class TerminalDisplay : public QFrame
Q_OBJECT
public:
/** Constructs a new terminal display widget with the specified parent. */
TerminalDisplay(QWidget *parent=0);
virtual ~TerminalDisplay();
void setBlendColor(const QRgb color) { blend_color = color; }
void setBlendColor(const QRgb color) { _blendColor = color; }
/** Sets the default background color for the display. */
void setDefaultBackColor(const QColor& color);
QColor getDefaultBackColor();
/** Returns the default background color for the display */
QColor defaultBackColor();
/** Returns the terminal color palette used by the display. */
const ColorEntry* colorTable() const;
void setColorTable(const ColorEntry table[]);
/** Sets the terminal color palette used by the display. */
void setColorTable(const ColorEntry table[]);
void setScrollbarLocation(int loc);
enum
/**
* This enum describes the location where the scroll bar is positioned in the display widget.
*/
enum ScrollBarLocation
{
/** Do not show the scroll bar. */
SCROLLBAR_NONE=0,
/** Show the scroll bar on the left side of the display. */
SCROLLBAR_LEFT=1,
/** Show the scroll bar on the right side of the display. */
SCROLLBAR_RIGHT=2
};
/**
* Specifies whether the terminal display has a vertical scroll bar, and if so whether it
* is shown on the left or right side of the display.
*/
void setScrollBarLocation(ScrollBarLocation loc);
/**
* Sets the current position and range of the display's scroll bar.
*
* @param cursor The position of the scroll bar's thumb.
* @param lines The maximum value of the scroll bar.
*/
void setScroll(int cursor, int lines);
void doScroll(int lines);
int scrollPosition();
bool scrollAtEnd();
/**
* Returns the display's filter chain. When the image for the display is updated,
......@@ -120,28 +137,29 @@ public:
FilterChain* filterChain() const;
void processFilters();
bool blinkingCursor() { return hasBlinkingCursor; }
/** Returns true if the cursor is set to blink or false otherwise. */
bool blinkingCursor() { return _hasBlinkingCursor; }
/** Specifies whether or not the cursor blinks. */
void setBlinkingCursor(bool blink);
void setCtrlDrag(bool enable) { ctrldrag=enable; }
bool ctrlDrag() { return ctrldrag; }
void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
bool ctrlDrag() { return _ctrlDrag; }
void setCutToBeginningOfLine(bool enable) { cuttobeginningofline=enable; }
bool cutToBeginningOfLine() { return cuttobeginningofline; }
void setCutToBeginningOfLine(bool enable) { _cutToBeginningOfLine=enable; }
bool cutToBeginningOfLine() { return _cutToBeginningOfLine; }
void setLineSpacing(uint);
uint lineSpacing() const;
void emitSelection(bool useXselection,bool appendReturn);
void setCursorPos(const int curx, const int cury);
int Lines() { return lines; }
int Columns() { return columns; }
int lines() { return _lines; }
int columns() { return _columns; }
int fontHeight() { return font_h; }
int fontWidth() { return font_w; }
int fontHeight() { return _fontHeight; }
int fontWidth() { return _fontWidth; }
void calcGeometry();
void propagateSize();
......@@ -151,10 +169,10 @@ public:
QSize sizeHint() const;
void setWordCharacters(QString wc);
QString wordCharacters() { return word_characters; }
QString wordCharacters() { return _wordCharacters; }
void setBellMode(int mode);
int bellMode() { return m_bellMode; }
int bellMode() { return _bellMode; }
enum { BELLSYSTEM=0, BELLNOTIFY=1, BELLVISUAL=2, BELLNONE=3 };
void setSelection(const QString &t);
......@@ -179,16 +197,16 @@ public:
static void setStandalone( bool standalone ) { s_standalone = standalone; }
static bool standalone() { return s_standalone; }
void setTerminalSizeHint(bool on) { terminalSizeHint=on; }
bool isTerminalSizeHint() { return terminalSizeHint; }
void setTerminalSizeStartup(bool on) { terminalSizeStartup=on; }
void setTerminalSizeHint(bool on) { _terminalSizeHint=on; }
bool isTerminalSizeHint() { return _terminalSizeHint; }
void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; }
void setBidiEnabled(bool set) { bidiEnabled=set; }
bool isBidiEnabled() { return bidiEnabled; }
void setBidiEnabled(bool set) { _bidiEnabled=set; }
bool isBidiEnabled() { return _bidiEnabled; }
void print(QPainter &paint, bool friendly, bool exact);
void setRim(int rim) { rimX=rim; rimY=rim; }
void setRim(int rim) { _rimX=rim; _rimY=rim; }
void setScreenWindow( ScreenWindow* window );
ScreenWindow* screenWindow() const;
......@@ -333,6 +351,11 @@ protected Q_SLOTS:
//after emitting the first in a sequence of bell events.
void enableBell();
private Q_SLOTS:
void drop_menu_activated(QAction*);
void swapColorTable();
void tripleClickTimeout(); // resets possibleTripleClick
private:
// maps a point on the widget to the position ( ie. line and column ) of the character
......@@ -347,137 +370,135 @@ private:
// or negative ( to scroll the image up )
void scrollImage(int lines);
void makeImage();
// the window onto the terminal screen which this display
// is currently showing.
ScreenWindow* _screenWindow;
bool allowBell;
bool _allowBell;
QGridLayout* gridLayout;
QGridLayout* _gridLayout;
bool fixed_font; // has fixed pitch
int font_h; // height
int font_w; // width
int font_a; // ascend
bool _fixedFont; // has fixed pitch
int _fontHeight; // height
int _fontWidth; // width
int _fontAscent; // ascend
int bX; // offset
int bY; // offset
int _bX; // offset
int _bY; // offset
int lines; // the number of lines that can be displayed in the widget
int columns; // the number of columns that can be displayed in the widget
int _lines; // the number of lines that can be displayed in the widget
int _columns; // the number of columns that can be displayed in the widget
int usedLines; // the number of lines that are actually being used, this will be less
int _usedLines; // the number of lines that are actually being used, this will be less
// than 'lines' if the character image provided with setImage() is smaller
// than the maximum image size which can be displayed
int usedColumns; // the number of columns that are actually being used, this will be less
int _usedColumns; // the number of columns that are actually being used, this will be less
// than 'columns' if the character image provided with setImage() is smaller
// than the maximum image size which can be displayed
int contentHeight;
int contentWidth;
Character *image; // [lines][columns]
int _contentHeight;
int _contentWidth;
Character* _image; // [lines][columns]
// only the area [usedLines][usedColumns] in the image contains valid data
int image_size;
QVector<LineProperty> lineProperties;
ColorEntry color_table[TABLE_COLORS];
QColor defaultBgColor;
bool resizing;
bool terminalSizeHint,terminalSizeStartup;
bool bidiEnabled;
bool mouse_marks;
void makeImage();
QPoint iPntSel; // initial selection point
QPoint pntSel; // current selection point
QPoint tripleSelBegin; // help avoid flicker
int actSel; // selection state
bool word_selection_mode;
bool line_selection_mode;
bool preserve_line_breaks;
bool column_selection_mode;
QClipboard* cb;
QScrollBar* scrollbar;
int scrollLoc;
QString word_characters;
int m_bellMode;
bool blinking; // hide text in paintEvent
bool hasBlinker; // has characters to blink
bool cursorBlinking; // hide cursor in paintEvent
bool hasBlinkingCursor; // has blinking cursor enabled
bool ctrldrag; // require Ctrl key for drag
bool cuttobeginningofline; // triple click only selects forward
bool isPrinting; // Paint job is intended for printer
bool printerFriendly; // paint printer friendly, save ink
bool printerBold; // Use a bold font instead of overstrike for bold
bool isFixedSize; //Columns / lines are locked.
QTimer* blinkT; // active when hasBlinker
QTimer* blinkCursorT; // active when hasBlinkingCursor
KMenu* m_drop;
QString dropText;
int m_dnd_file_count;
bool possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
int _imageSize;
QVector<LineProperty> _lineProperties;
ColorEntry _colorTable[TABLE_COLORS];
QColor _defaultBgColor;
bool _resizing;
bool _terminalSizeHint;
bool _terminalSizeStartup;
bool _bidiEnabled;
bool _mouseMarks;
QPoint _iPntSel; // initial selection point
QPoint _pntSel; // current selection point
QPoint _tripleSelBegin; // help avoid flicker
int _actSel; // selection state
bool _wordSelectionMode;
bool _lineSelectionMode;
bool _preserveLineBreaks;
bool _columnSelectionMode;
QClipboard* _clipboard;
QScrollBar* _scrollBar;
ScrollBarLocation _scrollbarLocation;
QString _wordCharacters;
int _bellMode;
bool _blinking; // hide text in paintEvent
bool _hasBlinker; // has characters to blink
bool _cursorBlinking; // hide cursor in paintEvent
bool _hasBlinkingCursor; // has blinking cursor enabled
bool _ctrlDrag; // require Ctrl key for drag
bool _cutToBeginningOfLine; // triple click only selects forward
bool _isPrinting; // Paint job is intended for printer
bool _printerFriendly; // paint printer friendly, save ink
bool _printerBold; // Use a bold font instead of overstrike for bold
bool _isFixedSize; //Columns / lines are locked.
QTimer* _blinkTimer; // active when hasBlinker
QTimer* _blinkCursorTimer; // active when hasBlinkingCursor
KMenu* _drop;
QString _dropText;
int _dndFileCount;
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
// after QApplication::doubleClickInterval() delay
static bool s_antialias; // do we antialias or not
static bool s_standalone; // are we part of a standalone konsole?
QFrame *mResizeWidget;
QLabel *mResizeLabel;
QTimer *mResizeTimer;
QFrame* _resizeWidget;
QLabel* _resizeLabel;
QTimer* _resizeTimer;
//widgets related to the warning message that appears when the user presses Ctrl+S to suspend
//terminal output - informing them what has happened and how to resume output
QLabel* outputSuspendedLabel;
QLabel* _outputSuspendedLabel;
uint m_lineSpacing;
uint _lineSpacing;
QRect cursorRect; //for quick changing of cursor
QRect _cursorRect; //for quick changing of cursor
QPoint configureRequestPoint; // remember right mouse button click position
bool colorsSwapped; // true during visual bell
QPoint _configureRequestPoint; // remember right mouse button click position
bool _colorsInverted; // true during visual bell
// the rim should normally be 1, 0 only when running in full screen mode.
int rimX; // left/right rim width
int rimY; // top/bottom rim high
QSize m_size;
int _rimX; // left/right rim width
int _rimY; // top/bottom rim high
QSize _size;
QString m_imPreeditText;
int m_imPreeditLength;
int m_imStart;
int m_imStartLine;
int m_imEnd;
int m_imSelStart;
int m_imSelEnd;
int m_cursorLine;
int m_cursorCol;
bool m_isIMEdit;
bool m_isIMSel;
QRgb blend_color;
QAction* m_pasteAction;
QAction* m_cdAction;
QAction* m_cpAction;
QAction* m_mvAction;
QAction* m_lnAction;
QString _imPreeditText;
int _imPreeditLength;
int _imStart;
int _imStartLine;
int _imEnd;
int _imSelStart;
int _imSelEnd;
int _cursorLine;
int _cursorCol;
bool _isIMEdit;
bool _isIMSel;
QRgb _blendColor;
QAction* _pasteAction;
QAction* _cdAction;
QAction* _cpAction;
QAction* _mvAction;
QAction* _lnAction;
TerminalImageFilterChain* _filterChain;
QRect _mouseOverHotspotArea;
//the delay in milliseconds between redrawing blinking text
static const int BLINK_DELAY = 750;
private Q_SLOTS:
void drop_menu_activated(QAction*);
void swapColorTable();
void tripleClickTimeout(); // resets possibleTripleClick
};
};
......
......@@ -457,7 +457,7 @@ TerminalDisplay* ViewManager::createTerminalDisplay()
display->setCutToBeginningOfLine(true);
display->setTerminalSizeStartup(false);
display->setSize(80,40);
display->setScrollbarLocation(TerminalDisplay::SCROLLBAR_RIGHT);
display->setScrollBarLocation(TerminalDisplay::SCROLLBAR_RIGHT);
return display;
}
......
......@@ -61,7 +61,6 @@
#include "KeyTrans.h"
#include "schema.h"
#include "Session.h"
#include "TerminalDisplay.h"
extern "C"
{
......@@ -595,7 +594,22 @@ void konsolePart::readProperties()
b_histEnabled = cg.readEntry("historyenabled", true);
n_bell = qMin(cg.readEntry("bellmode",uint(TerminalDisplay::BELLSYSTEM)),3u);
n_keytab=cg.readEntry("keytab",0); // act. the keytab for this session
n_scroll = qMin(cg.readEntry("scrollbar",uint(TerminalDisplay::SCROLLBAR_RIGHT)),2u);
// TODO Find a more elegant way to read the scroll-bar enum value from the configuration
switch ( qMin(cg.readEntry("scrollbar",uint(TerminalDisplay::SCROLLBAR_RIGHT)),2u) )
{
case TerminalDisplay::SCROLLBAR_NONE:
n_scroll = TerminalDisplay::SCROLLBAR_NONE;
break;
case TerminalDisplay::SCROLLBAR_LEFT:
n_scroll = TerminalDisplay::SCROLLBAR_LEFT;
break;
case TerminalDisplay::SCROLLBAR_RIGHT:
n_scroll = TerminalDisplay::SCROLLBAR_RIGHT;
break;
}
m_histSize = cg.readEntry("history",DEFAULT_HISTORY_SIZE);
s_word_seps= cg.readEntry("wordseps",":@-./_~");
......@@ -627,7 +641,9 @@ void konsolePart::readProperties()
te->setBlinkingCursor(cg.readEntry("BlinkingCursor", false));
te->setFrameStyle( b_framevis?(QFrame::WinPanel|QFrame::Sunken):QFrame::NoFrame );
te->setLineSpacing( cg.readEntry( "LineSpacing", 0 ) );
te->setScrollbarLocation(n_scroll);
te->setScrollBarLocation( n_scroll );
te->setWordCharacters(s_word_seps);
if ( !b_useKonsoleSettings )
......@@ -636,7 +652,7 @@ void konsolePart::readProperties()
config = new KConfig("konsolerc");
}
cg = config->group("Desktop Entry");
te->setTerminalSizeHint( config->readEntry("TerminalSizeHint", true) );
te->setTerminalSizeHint( cg.readEntry("TerminalSizeHint", true) );
delete config;
}
......@@ -659,7 +675,7 @@ void konsolePart::saveProperties()
cg.writeEntry("has frame",b_framevis);
cg.writeEntry("LineSpacing", te->lineSpacing());
cg.writeEntry("schema",s_kconfigSchema);
cg.writeEntry("scrollbar",n_scroll);
cg.writeEntry("scrollbar",(int)n_scroll);
cg.writeEntry("wordseps",s_word_seps);
cg.writeEntry("encoding",n_encoding);
cg.writeEntry("use_konsole_settings",m_useKonsoleSettings->isChecked());
......@@ -688,15 +704,15 @@ void konsolePart::slotToggleFrame()
void konsolePart::slotSelectScrollbar()
{
if ( ! se ) return;
n_scroll = selectScrollbar->currentItem();
te->setScrollbarLocation(n_scroll);
n_scroll = (TerminalDisplay::ScrollBarLocation)selectScrollbar->currentItem();
te->setScrollBarLocation(n_scroll);
}
void konsolePart::slotSelectFont() {
if ( !se ) return;
QFont font = te->getVTFont();
if ( KFontDialog::getFont( font, true ) != QDialog::Accepted )
if ( KFontDialog::getFont( font, KFontChooser::FixedFontsOnly ) != QDialog::Accepted )
return;
te->setVTFont(font);
......@@ -828,7 +844,7 @@ void konsolePart::pixmap_menu_activated(int item)
pmPath = "";
item = 1;
QPalette palette;
palette.setColor(te->backgroundRole(), te->getDefaultBackColor());
palette.setColor(te->backgroundRole(), te->defaultBackColor());
te->setPalette(palette);
return;
}
......@@ -845,7 +861,7 @@ void konsolePart::pixmap_menu_activated(int item)
break;
case 3: // center
{ QPixmap bgPixmap( te->size() );
bgPixmap.fill(te->getDefaultBackColor());
bgPixmap.fill(te->defaultBackColor());
bitBlt( &bgPixmap, ( te->size().width() - pm.width() ) / 2,
( te->size().height() - pm.height() ) / 2,
&pm, 0, 0,
......
......@@ -33,6 +33,7 @@
// Konsole
#include "schema.h"
#include "Session.h"
#include "TerminalDisplay.h"
class KComponentData;
class QPushButton;
......@@ -184,7 +185,7 @@ Q_SIGNALS:
int n_bell;
int n_keytab;
int n_render;
int n_scroll;
TerminalDisplay::ScrollBarLocation n_scroll;
unsigned m_histSize;
bool m_runningShell;
bool m_streamEnabled;
......
......@@ -176,17 +176,17 @@ ColorSchema::ColorSchema(KConfig& c)
{
clearSchema();
c.setGroup("SchemaGeneral");
KConfigGroup cg = c.group("SchemaGeneral");
m_title = c.readEntry("Title",i18n("[no title]"));
m_imagePath = c.readEntry("ImagePath");
m_alignment = c.readEntry("ImageAlignment", int(1));
m_useTransparency = c.readEntry("UseTransparency", false);
m_title = cg.readEntry("Title",i18n("[no title]"));
m_imagePath = cg.readEntry("ImagePath");
m_alignment = cg.readEntry("ImageAlignment", int(1));
m_useTransparency = cg.readEntry("UseTransparency", false);
m_tr_r = c.readEntry("TransparentR", int(0));
m_tr_g = c.readEntry("TransparentG", int(0));
m_tr_b = c.readEntry("TransparentB", int(0));
m_tr_x = c.readEntry("TransparentX", double(0.0));
m_tr_r = cg.readEntry("TransparentR", int(0));
m_tr_g = cg.readEntry("TransparentG", int(0));
m_tr_b = cg.readEntry("TransparentB", int(0));
m_tr_x = cg.readEntry("TransparentX", double(0.0));
for (int i=0; i < TABLE_COLORS; i++)
{
......@@ -281,16 +281,16 @@ void ColorSchema::writeConfig(const QString& path) const
KConfig c( path, KConfig::NoGlobals );