Commit cf92cece authored by Jekyll Wu's avatar Jekyll Wu

Remove leading white spaces in blank lines to make them really empty

parent 8cd63d96
......@@ -219,7 +219,7 @@ void Application::processTabsFromFileArgs(KCmdLineArgs* args, MainWindow* window
<< tabsFileName.toLocal8Bit().data();
quit();
}
unsigned int sessions = 0;
while (!tabsFile.atEnd()) {
QString lineString(tabsFile.readLine());
......@@ -277,7 +277,7 @@ void Application::createTabFromArgs(KCmdLineArgs* args, MainWindow* window, cons
if(!newProfile->isEmpty()) {
window->setDefaultProfile(newProfile);
}
// Create the new session
Session* session = createSession(window->defaultProfile(), QString(), window->viewManager());
session->setTabTitleFormat(Session::LocalTabTitle, title);
......@@ -289,13 +289,13 @@ void Application::createTabFromArgs(KCmdLineArgs* args, MainWindow* window, cons
if (!window->testAttribute(Qt::WA_Resized)) {
window->resize(window->sizeHint());
}
// Reset the profile to default. Otherwise, the next manually
// created tab would have the command above!
newProfile = Profile::Ptr(new Profile(defaultProfile));
newProfile->setHidden(true);
window->setDefaultProfile(newProfile);
}
MainWindow* Application::processWindowArgs(KCmdLineArgs* args)
......@@ -312,7 +312,7 @@ MainWindow* Application::processWindowArgs(KCmdLineArgs* args)
break;
}
}
if ( window == 0 )
{
window = newMainWindow();
......@@ -364,7 +364,7 @@ void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window
foreach( const QString &value , args->getOptionList("p") )
{
ProfileCommandParser parser;
QHashIterator<Profile::Property,QVariant> iter(parser.parse(value));
while ( iter.hasNext() )
{
......
......@@ -54,7 +54,7 @@ Q_OBJECT
public:
/** Constructs a new Konsole application. */
Application();
virtual ~Application();
/** Creates a new main window and opens a default terminal session */
......
......@@ -117,7 +117,7 @@ const Block* BlockArray::at(size_t i)
//kDebug() << "BlockArray::at() i > index\n";
return 0;
}
// if (index - i >= length) {
// kDebug() << "BlockArray::at() index - i >= length\n";
// return 0;
......
/* This file was part of the KDE libraries
Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
......
/* This file was part of the KDE libraries
Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
......
/*
This file is part of Konsole, KDE's terminal.
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
......@@ -120,7 +120,7 @@ public:
* or not the character has the RE_BOLD rendition flag.
*/
ColorEntry::FontWeight fontWeight(const ColorEntry* base) const;
/**
* returns true if the format (color, rendition flag) of the compared characters is equal
*/
......@@ -136,7 +136,7 @@ public:
* renditions or colors.
*/
friend bool operator != (const Character& a, const Character& b);
inline bool isLineChar() const
{
if ( rendition & RE_EXTENDED_CHAR )
......@@ -144,12 +144,12 @@ public:
return isSupportedLineChar(character);
}
inline bool isSpace() const
{
return (rendition & RE_EXTENDED_CHAR) ? false : QChar(character).isSpace();
}
};
inline bool operator == (const Character& a, const Character& b)
......@@ -179,7 +179,7 @@ inline bool Character::equalsFormat(const Character& other) const
backgroundColor == other.backgroundColor &&
foregroundColor == other.foregroundColor &&
rendition == other.rendition;
}
}
inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const
{
......
/*
This file is part of Konsole, KDE's terminal.
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
......@@ -76,7 +76,7 @@ public:
* with the transparent and bold flags set to false.
*/
ColorEntry() : transparent(false), fontWeight(UseCurrentFormat) {}
/**
* Sets the color, transparency and boldness of this color to those of @p rhs.
*/
......@@ -202,7 +202,7 @@ public:
{
return _colorSpace != COLOR_SPACE_UNDEFINED;
}
/**
* Set this color as an intensive system color.
*
......@@ -218,7 +218,7 @@ public:
* it is ignored.
*/
QColor color(const ColorEntry* palette) const;
/**
* Compares two colors and returns true if they represent the same color value and
* use the same color space.
......@@ -261,7 +261,7 @@ inline const QColor color256(quint8 u, const ColorEntry* base)
if (u < 216) return QColor(((u/36)%6) ? (40*((u/36)%6)+55) : 0,
((u/ 6)%6) ? (40*((u/ 6)%6)+55) : 0,
((u/ 1)%6) ? (40*((u/ 1)%6)+55) : 0); u -= 216;
// 232..255: gray, leaving out black and white
int gray = u*10+8; return QColor(gray,gray,gray);
}
......
......@@ -168,7 +168,7 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry)
for (int i=0;i<TABLE_COLORS;i++)
_table[i] = defaultTable[i];
}
_table[index] = entry;
}
ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const
......@@ -185,14 +185,14 @@ ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const
!_randomTable[index].isNull() )
{
const RandomizationRange& range = _randomTable[index];
int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0;
int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0;
int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0;
QColor& color = entry.color;
int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE );
int newValue = qMin( qAbs(color.value() + valueDifference) , 255 );
int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 );
......@@ -288,7 +288,7 @@ void ColorScheme::write(KConfig& config) const
configGroup.writeEntry("Description",_description);
configGroup.writeEntry("Opacity",_opacity);
configGroup.writeEntry("Wallpaper", _wallpaper->path());
for (int i=0 ; i < TABLE_COLORS ; i++)
{
RandomizationRange random = _randomTable != 0 ? _randomTable[i] : RandomizationRange();
......@@ -311,7 +311,7 @@ QString ColorScheme::translatedColorNameForIndex(int index)
void ColorScheme::readColorEntry(KConfig& config , int index)
{
KConfigGroup configGroup(&config,colorNameForIndex(index));
ColorEntry entry;
entry.color = configGroup.readEntry("Color",QColor());
......@@ -520,7 +520,7 @@ bool KDE3ColorSchemeReader::readColorLine(const QString& line,ColorScheme* schem
return false;
if (list.first() != "color")
return false;
int index = list[1].toInt();
int red = list[2].toInt();
int green = list[3].toInt();
......@@ -579,7 +579,7 @@ void ColorSchemeManager::loadAllColorSchemes()
int failed = 0;
QList<QString> nativeColorSchemes = listColorSchemes();
QListIterator<QString> nativeIter(nativeColorSchemes);
while ( nativeIter.hasNext() )
{
......@@ -630,7 +630,7 @@ bool ColorSchemeManager::loadKDE3ColorScheme(const QString& filePath)
delete scheme;
return false;
}
QFileInfo info(filePath);
if ( !_colorSchemes.contains(info.baseName()) )
......@@ -660,7 +660,7 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath)
return false;
QFileInfo info(filePath);
KConfig config(filePath , KConfig::NoGlobals);
ColorScheme* scheme = new ColorScheme();
scheme->setName(info.baseName());
......@@ -681,7 +681,7 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath)
{
kDebug() << "color scheme with name" << scheme->name() << "has already been" <<
"found, ignoring.";
delete scheme;
}
......@@ -692,7 +692,7 @@ QList<QString> ColorSchemeManager::listKDE3ColorSchemes()
return KGlobal::dirs()->findAllResources("data",
"konsole/*.schema",
KStandardDirs::NoDuplicates);
}
QList<QString> ColorSchemeManager::listColorSchemes()
{
......
......@@ -114,7 +114,7 @@ public:
* palette to be randomized. The seed is used to pick the random color.
*/
void getColorTable(ColorEntry* table, uint randomSeed = 0) const;
/**
* Retrieves a single color entry from the table.
*
......@@ -304,7 +304,7 @@ public:
* Returns the default color scheme for Konsole
*/
const ColorScheme* defaultColorScheme() const;
/**
* Returns the color scheme with the given name or 0 if no
* scheme with that name exists. If @p name is empty, the
......
......@@ -118,7 +118,7 @@ void ColorSchemeEditor::editColorItem( QTableWidgetItem* item )
ColorEntry entry( _colors->colorEntry(item->row()) );
entry.color = color;
_colors->setColorTableEntry( item->row(), entry );
emit colorsChanged( _colors );
}
......@@ -154,7 +154,7 @@ void ColorSchemeEditor::setDescription(const QString& text)
void ColorSchemeEditor::setTransparencyPercentLabel(int percent)
{
_ui->transparencyPercentLabel->setText( QString("%1%").arg(percent) );
qreal opacity = ( 100.0 - percent ) / 100.0;
_colors->setOpacity(opacity);
}
......@@ -172,7 +172,7 @@ void ColorSchemeEditor::setup(const ColorScheme* scheme)
// setup transparency slider
const int transparencyPercent = qRound( (1-_colors->opacity())*100 );
_ui->transparencySlider->setValue(transparencyPercent);
setTransparencyPercentLabel(transparencyPercent);
......
......@@ -85,4 +85,4 @@ private:
}
#endif // COLORSCHEMEEDITOR_H
#endif // COLORSCHEMEEDITOR_H
......@@ -131,7 +131,7 @@ void CheckableSessionModel::setCheckColumn(int column)
Qt::ItemFlags CheckableSessionModel::flags(const QModelIndex& index) const
{
Session* session = (Session*)index.internalPointer();
if (_fixedSessions.contains(session))
return SessionListModel::flags(index) & ~Qt::ItemIsEnabled;
else
......
......@@ -216,7 +216,7 @@ void EditProfileDialog::preparePage(int page)
Q_ASSERT( info );
QWidget* pageWidget = _ui->tabWidget->widget(page);
if ( _pageNeedsUpdate[page] )
{
if ( pageWidget == _ui->generalTab )
......@@ -501,13 +501,13 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
{
ColorSchemeViewDelegate* delegate = new ColorSchemeViewDelegate(this);
_ui->colorSchemeList->setItemDelegate(delegate);
_colorSchemeAnimationTimeLine = new QTimeLine( 500 , this );
delegate->setEntryTimeLine(_colorSchemeAnimationTimeLine);
connect( _colorSchemeAnimationTimeLine , SIGNAL(valueChanged(qreal)) , this ,
SLOT(colorSchemeAnimationUpdate()) );
_ui->transparencyWarningWidget->setVisible(false);
_ui->editColorSchemeButton->setEnabled(false);
......@@ -515,7 +515,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
// setup color list
updateColorSchemeList(true);
_ui->colorSchemeList->setMouseTracking(true);
_ui->colorSchemeList->installEventFilter(this);
_ui->colorSchemeList->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
......@@ -525,7 +525,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
, this , SLOT(colorSchemeSelected()) );
connect( _ui->colorSchemeList , SIGNAL(entered(QModelIndex)) , this ,
SLOT(previewColorScheme(QModelIndex)) );
updateColorSchemeButtons();
connect( _ui->editColorSchemeButton , SIGNAL(clicked()) , this ,
......@@ -593,7 +593,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_ui->colorSchemeList->model());
Q_ASSERT(model);
model->clear();
QList<const ColorScheme*> schemeList = ColorSchemeManager::instance()->allColorSchemes();
......@@ -607,7 +607,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
QStandardItem* item = new QStandardItem(colors->description());
item->setData( QVariant::fromValue(colors) , Qt::UserRole + 1);
item->setFlags( item->flags() );
if ( currentScheme == colors )
selectedItem = item;
......@@ -636,7 +636,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
KeyboardTranslatorManager* keyManager = KeyboardTranslatorManager::instance();
const KeyboardTranslator* currentTranslator = keyManager->findTranslator(name);
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_ui->keyBindingList->model());
Q_ASSERT(model);
......@@ -664,7 +664,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
}
model->sort(0);
if ( selectCurrentTranslator && selectedItem )
{
_ui->keyBindingList->selectionModel()->setCurrentIndex( selectedItem->index() ,
......@@ -710,10 +710,10 @@ void EditProfileDialog::unpreviewAll()
void EditProfileDialog::unpreview(int property)
{
_delayedPreviewProperties.remove(property);
if (!_previewedProperties.contains(property))
return;
QHash<Profile::Property,QVariant> map;
map.insert((Profile::Property)property,_previewedProperties[property]);
SessionManager::instance()->changeProfile(_profile,map,false);
......@@ -777,7 +777,7 @@ void EditProfileDialog::removeColorScheme()
if ( !selected.isEmpty() )
{
const QString& name = selected.first().data(Qt::UserRole+1).value<const ColorScheme*>()->name();
if (ColorSchemeManager::instance()->deleteColorScheme(name))
_ui->colorSchemeList->model()->removeRow(selected.first().row());
}
......@@ -808,7 +808,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
if ( isNewScheme )
editor->setDescription(i18n("New Color Scheme"));
if ( dialog->exec() == QDialog::Accepted )
{
ColorScheme* newScheme = new ColorScheme(*editor->colorScheme());
......@@ -818,7 +818,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
newScheme->setName(newScheme->description());
ColorSchemeManager::instance()->addColorScheme( newScheme );
updateColorSchemeList(true);
preview(Profile::ColorScheme,newScheme->name());
......@@ -842,7 +842,7 @@ void EditProfileDialog::colorSchemeSelected()
const ColorScheme* colors = model->data(selected.first(),Qt::UserRole+1).value<const ColorScheme*>();
//kDebug() << "Setting temp profile color to" << colors->name();
updateTempProfileProperty(Profile::ColorScheme,colors->name());
previewColorScheme(selected.first());
......@@ -1002,7 +1002,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
KeyBindingEditor* editor = new KeyBindingEditor;
dialog->setMainWidget(editor);
if ( translator )
editor->setup(translator);
......@@ -1019,7 +1019,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
KeyboardTranslatorManager::instance()->addTranslator( newTranslator );
updateKeyBindingsList();
const QString& currentTranslator = lookupProfile()
->property<QString>(Profile::KeyBindings);
......@@ -1055,7 +1055,7 @@ void EditProfileDialog::setupRadio( RadioOption* possibilities , int actual )
possibilities->button->setChecked(true);
else
possibilities->button->setChecked(false);
connect( possibilities->button , SIGNAL(clicked()) , this , possibilities->slot );
++possibilities;
......@@ -1066,7 +1066,7 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile)
{
// setup scrollbar radio
int scrollBarPosition = profile->property<int>(Profile::ScrollBarPosition);
RadioOption positions[] = { {_ui->scrollBarHiddenButton,Profile::ScrollBarHidden,SLOT(hideScrollBar())},
{_ui->scrollBarLeftButton,Profile::ScrollBarLeft,SLOT(showScrollBarLeft())},
{_ui->scrollBarRightButton,Profile::ScrollBarRight,SLOT(showScrollBarRight())},
......@@ -1074,16 +1074,16 @@ void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile)
};
setupRadio( positions , scrollBarPosition );
// setup scrollback type radio
int scrollBackType = profile->property<int>(Profile::HistoryMode);
RadioOption types[] = { {_ui->disableScrollbackButton,Profile::DisableHistory,SLOT(noScrollBack())},
{_ui->fixedScrollbackButton,Profile::FixedSizeHistory,SLOT(fixedScrollBack())},
{_ui->unlimitedScrollbackButton,Profile::UnlimitedHistory,SLOT(unlimitedScrollBack())},
{0,0,0} };
setupRadio( types , scrollBackType );
// setup scrollback line count spinner
int historySize = profile->property<int>(Profile::HistorySize);
_ui->scrollBackLinesSpinner->setValue( historySize );
......@@ -1245,7 +1245,7 @@ void EditProfileDialog::fontSelected(const QFont& font)
setFontSliderValue(font);
_ui->fontPreviewLabel->setFont(previewFont);
preview(Profile::Font,font);
updateTempProfileProperty(Profile::Font,font);
......@@ -1253,7 +1253,7 @@ void EditProfileDialog::fontSelected(const QFont& font)
void EditProfileDialog::showFontDialog()
{
QFont currentFont = _ui->fontPreviewLabel->font();
KFontDialog* dialog = new KFontDialog(this, KFontChooser::FixedFontsOnly);
dialog->setFont(currentFont, true);
......@@ -1333,11 +1333,11 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
// a darker version at the outer edge
QColor color = scheme->backgroundColor();
QRectF backgroundRect = QRectF(option.rect).adjusted(1.5,1.5,-1.5,-1.5);
QRadialGradient backgroundGradient(backgroundRect.center() , backgroundRect.width() / 2);
backgroundGradient.setColorAt( 0 , color.lighter(105) );
backgroundGradient.setColorAt( 1 , color.darker(115) );
const int backgroundRectXRoundness = 4;
const int backgroundRectYRoundness = 30;
......@@ -1388,7 +1388,7 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
painter->setBrush( QBrush(Qt::NoBrush) );
QPen pen;
QColor highlightColor = option.palette.highlight().color();
if ( isSelected )
......@@ -1399,7 +1399,7 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
pen.setBrush(highlightColor);
pen.setWidth(selectedBorderWidth);
pen.setJoinStyle(Qt::MiterJoin);
painter->setPen(pen);
......
......@@ -147,7 +147,7 @@ private slots:
void noScrollBack();
void fixedScrollBack();
void unlimitedScrollBack();
void scrollBackLinesChanged(int);
void hideScrollBar();
......@@ -249,7 +249,7 @@ private:
// after an update by a call to ensurePageLoaded()
QVector<bool> _pageNeedsUpdate;
QHash<int,QVariant> _previewedProperties;
QTimeLine* _colorSchemeAnimationTimeLine;
QHash<int,QVariant> _delayedPreviewProperties;
......
......@@ -277,7 +277,7 @@ void Emulation::receiveData(const char* text, int length)
/*void Emulation::onRcvBlock(const char *s, int len)
{
emit notifySessionState(NOTIFYACTIVITY);
bufferedUpdate();
for (int i = 0; i < len; i++)
{
......@@ -452,7 +452,7 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor
// if hash is already used by another, different sequence of unicode character
// points then try next hash
hash++;
if (hash == initialHash)
{
if (!triedCleaningSolution)
......@@ -467,10 +467,10 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor
foreach(const TerminalDisplay* td, s->views())
{
usedExtendedChars += td->screenWindow()->screen()->usedExtendedChars();
}
}
QHash<ushort,ushort*>::iterator it = extendedCharTable.begin();
QHash<ushort,ushort*>::iterator itEnd = extendedCharTable.end();
while (it != itEnd)
......@@ -494,14 +494,14 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor
}
}
// add the new sequence to the table and
// return that index
ushort* buffer = new ushort[length+1];
buffer[0] = length;
for ( int i = 0 ; i < length ; i++ )
buffer[i+1] = unicodePoints[i];
extendedCharTable.insert(hash,buffer);
return hash;
......
/*
This file is part of Konsole, an X terminal.
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
......@@ -123,7 +123,7 @@ class KONSOLEPRIVATE_EXPORT Emulation : public QObject
Q_OBJECT
public:
/** Constructs a new terminal emulation */
Emulation();
~Emulation();
......@@ -169,7 +169,7 @@ public:
* @param endLine Index of last line to copy
*/
virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine);
/** Returns the codec used to decode incoming characters. See setCodec() */
const QTextCodec* codec() const { return _codec; }
/** Sets the codec used to decode incoming characters. */
......@@ -182,7 +182,7 @@ public:
*/
bool utf8() const
{ Q_ASSERT(_codec); return _codec->mibEnum() == 106; }
/** Returns the special character used for erasing character. */
virtual char eraseChar() const;
......@@ -220,7 +220,7 @@ public slots:
/** Change the size of the emulation's image */
virtual void setImageSize(int lines, int columns);
/**
* Interprets a sequence of characters and sends the result to the terminal.
* This is equivalent to calling sendKeyEvent() for each character in @p text in succession.
......@@ -232,13 +232,13 @@ public slots:
* the resulting character stream.
*/
virtual void sendKeyEvent(QKeyEvent*);
/**
* Converts information about a mouse event into an xterm-compatible escape
* sequence and emits the character sequence via sendData()
*/
virtual void sendMouseEvent(int buttons, int column, int line, int eventType);
/**
* Sends a string of characters to the foreground terminal process.
*
......@@ -411,17 +411,17 @@ signals:
* screen is in use.
*/
void primaryScreenInUse(bool use);
/**
* Emitted when the text selection is changed
*/
void selectedText(const QString & text);
protected:
virtual void setMode(int mode) = 0;
virtual void resetMode(int mode) = 0;
/**
* Processes an incoming character. See receiveData()
* @p ch A unicode character code.
......@@ -446,7 +446,7 @@ protected:
QList<ScreenWindow*> _windows;
Screen* _currentScreen; // pointer to the screen which is currently active,
// this is one of the elements in the screen[] array
......@@ -454,8 +454,8 @@ protected:
// scrollbars are enabled in this mode )
// 1 = alternate ( used by vi , emacs etc.
// scrollbars are not enabled in this mode )
//decodes an incoming C-style character stream into a unicode QString using
//the current text codec. (this allows for rendering of non-ASCII characters in text files etc.)
const QTextCodec* _codec;
......@@ -472,7 +472,7 @@ protected slots:
// used to emit the primaryScreenInUse(bool) signal
void checkScreenInUse();
// used to emit the selectedText(QString) signal
void checkSelectedText();