mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Massive automated whitespace cleanup
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									006265d7a0
								
							
						
					
					
						commit
						76e6420f6b
					
				
					 114 changed files with 4370 additions and 3717 deletions
				
			
		|  | @ -14,18 +14,18 @@ TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NUL | |||
| 	qreal h, s, l, a; | ||||
| 	textColor.getHslF(&h, &s, &l, &a); | ||||
| 	// I use dark themes
 | ||||
| 	if (l <= 0.3 ) { // very dark text. get a brigth background
 | ||||
| 		addColor( QColor(Qt::red).lighter(120) ); | ||||
| 		addColor( QColor(Qt::green).lighter(120) ); | ||||
| 		addColor( QColor(Qt::blue).lighter(120) ); | ||||
| 	} else if ( l <= 0.6 ) { // moderated dark text. get a somewhat brigth background
 | ||||
| 		addColor( QColor(Qt::red).lighter(60) ); | ||||
| 		addColor( QColor(Qt::green).lighter(60) ); | ||||
| 		addColor( QColor(Qt::blue).lighter(60) ); | ||||
| 	if (l <= 0.3) { // very dark text. get a brigth background
 | ||||
| 		addColor(QColor(Qt::red).lighter(120)); | ||||
| 		addColor(QColor(Qt::green).lighter(120)); | ||||
| 		addColor(QColor(Qt::blue).lighter(120)); | ||||
| 	} else if (l <= 0.6) { // moderated dark text. get a somewhat brigth background
 | ||||
| 		addColor(QColor(Qt::red).lighter(60)); | ||||
| 		addColor(QColor(Qt::green).lighter(60)); | ||||
| 		addColor(QColor(Qt::blue).lighter(60)); | ||||
| 	} else { | ||||
| 		addColor( QColor(Qt::red).darker(120) ); | ||||
| 		addColor( QColor(Qt::green).darker(120) ); | ||||
| 		addColor( QColor(Qt::blue).darker(120) ); | ||||
| 		addColor(QColor(Qt::red).darker(120)); | ||||
| 		addColor(QColor(Qt::green).darker(120)); | ||||
| 		addColor(QColor(Qt::blue).darker(120)); | ||||
| 	} // light text. get a dark background.
 | ||||
| 	setFocusPolicy(Qt::StrongFocus); | ||||
| } | ||||
|  | @ -38,13 +38,14 @@ void TagWidget::setCompleter(QCompleter *completer) | |||
| 	connect(m_completer, SIGNAL(highlighted(QString)), this, SLOT(completionSelected(QString))); | ||||
| } | ||||
| 
 | ||||
| QPair<int,int> TagWidget::getCursorTagPosition() { | ||||
| QPair<int, int> TagWidget::getCursorTagPosition() | ||||
| { | ||||
| 	int i = 0, start = 0, end = 0; | ||||
| 	/* Parse string near cursor */ | ||||
| 	i = cursorPosition(); | ||||
| 	while (--i > 0) { | ||||
| 		if (text().at(i) == ',') { | ||||
| 			if (i > 0 && text().at(i-1) != '\\') { | ||||
| 			if (i > 0 && text().at(i - 1) != '\\') { | ||||
| 				i++; | ||||
| 				break; | ||||
| 			} | ||||
|  | @ -53,7 +54,7 @@ QPair<int,int> TagWidget::getCursorTagPosition() { | |||
| 	start = i; | ||||
| 	while (++i < text().length()) { | ||||
| 		if (text().at(i) == ',') { | ||||
| 			if (i > 0 && text().at(i-1) != '\\') | ||||
| 			if (i > 0 && text().at(i - 1) != '\\') | ||||
| 				break; | ||||
| 		} | ||||
| 	} | ||||
|  | @ -62,24 +63,28 @@ QPair<int,int> TagWidget::getCursorTagPosition() { | |||
| 		start = 0; | ||||
| 		end = 0; | ||||
| 	} | ||||
| 	return qMakePair(start,end); | ||||
| 	return qMakePair(start, end); | ||||
| } | ||||
| 
 | ||||
| enum ParseState {FINDSTART, FINDEND}; | ||||
| enum ParseState { | ||||
| 	FINDSTART, | ||||
| 	FINDEND | ||||
| }; | ||||
| 
 | ||||
| void TagWidget::highlight() { | ||||
| void TagWidget::highlight() | ||||
| { | ||||
| 	int i = 0, start = 0, end = 0; | ||||
| 	ParseState state = FINDEND; | ||||
| 	removeAllBlocks(); | ||||
| 
 | ||||
| 	while(i < text().length()) { | ||||
| 	while (i < text().length()) { | ||||
| 		if (text().at(i) == ',') { | ||||
| 			if (state == FINDSTART) { | ||||
| 				/* Detect empty tags */ | ||||
| 			} else if (state == FINDEND) { | ||||
| 				/* Found end of tag */ | ||||
| 				if (i > 1) { | ||||
| 					if (text().at(i-1) != '\\') { | ||||
| 					if (text().at(i - 1) != '\\') { | ||||
| 						addBlock(start, end); | ||||
| 						state = FINDSTART; | ||||
| 					} | ||||
|  | @ -102,7 +107,7 @@ void TagWidget::highlight() { | |||
| 	} | ||||
| 	if (state == FINDEND) { | ||||
| 		if (end < start) | ||||
| 			end = text().length()-1; | ||||
| 			end = text().length() - 1; | ||||
| 		if (text().length() > 0) | ||||
| 			addBlock(start, end); | ||||
| 	} | ||||
|  | @ -111,10 +116,10 @@ void TagWidget::highlight() { | |||
| void TagWidget::reparse() | ||||
| { | ||||
| 	highlight(); | ||||
| 	QPair<int,int> pos = getCursorTagPosition(); | ||||
| 	QPair<int, int> pos = getCursorTagPosition(); | ||||
| 	QString currentText; | ||||
| 	if (pos.first >= 0 && pos.second > 0) | ||||
| 		currentText = text().mid(pos.first, pos.second-pos.first).trimmed(); | ||||
| 		currentText = text().mid(pos.first, pos.second - pos.first).trimmed(); | ||||
| 	else | ||||
| 		currentText = ""; | ||||
| 	if (m_completer) { | ||||
|  | @ -133,12 +138,13 @@ void TagWidget::reparse() | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void TagWidget::completionSelected(QString completion) { | ||||
| 	QPair <int,int> pos; | ||||
| void TagWidget::completionSelected(QString completion) | ||||
| { | ||||
| 	QPair<int, int> pos; | ||||
| 	pos = getCursorTagPosition(); | ||||
| 	if (pos.first >= 0 && pos.second > 0) { | ||||
| 		setText(text().remove(pos.first, pos.second-pos.first).insert(pos.first, completion)); | ||||
| 		setCursorPosition(pos.first+completion.length()); | ||||
| 		setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion)); | ||||
| 		setCursorPosition(pos.first + completion.length()); | ||||
| 	} else { | ||||
| 		setText(completion.append(", ")); | ||||
| 		setCursorPosition(text().length()); | ||||
|  | @ -146,26 +152,30 @@ void TagWidget::completionSelected(QString completion) { | |||
| 	emit(textChanged()); | ||||
| } | ||||
| 
 | ||||
| void TagWidget::setCursorPosition(int position) { | ||||
| void TagWidget::setCursorPosition(int position) | ||||
| { | ||||
| 	blockSignals(true); | ||||
| 	GroupedLineEdit::setCursorPosition(position); | ||||
| 	blockSignals(false); | ||||
| } | ||||
| 
 | ||||
| void TagWidget::setText(QString text) { | ||||
| void TagWidget::setText(QString text) | ||||
| { | ||||
| 	blockSignals(true); | ||||
| 	GroupedLineEdit::setText(text); | ||||
| 	blockSignals(false); | ||||
| 	highlight(); | ||||
| } | ||||
| 
 | ||||
| void TagWidget::clear() { | ||||
| void TagWidget::clear() | ||||
| { | ||||
| 	blockSignals(true); | ||||
| 	GroupedLineEdit::clear(); | ||||
| 	blockSignals(false); | ||||
| } | ||||
| 
 | ||||
| void TagWidget::keyPressEvent(QKeyEvent *e) { | ||||
| void TagWidget::keyPressEvent(QKeyEvent *e) | ||||
| { | ||||
| 	switch (e->key()) { | ||||
| 	case Qt::Key_Return: | ||||
| 	case Qt::Key_Enter: | ||||
|  | @ -188,7 +198,8 @@ void TagWidget::keyPressEvent(QKeyEvent *e) { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| void TagWidget::wheelEvent(QWheelEvent *event) { | ||||
| void TagWidget::wheelEvent(QWheelEvent *event) | ||||
| { | ||||
| 	if (hasFocus()) { | ||||
| 		GroupedLineEdit::wheelEvent(event); | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue