forked from qt-creator/qt-creator
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -270,9 +270,8 @@ void ProjectListWidget::addProject(Project *project)
|
||||
item->setText(displayName);
|
||||
insertItem(pos, item);
|
||||
|
||||
if (project == ProjectExplorerPlugin::instance()->startupProject()) {
|
||||
if (project == ProjectExplorerPlugin::instance()->startupProject())
|
||||
setCurrentItem(item);
|
||||
}
|
||||
|
||||
QFontMetrics fn(font());
|
||||
int width = fn.width(displayName) + padding();
|
||||
@@ -517,9 +516,8 @@ QListWidgetItem *GenericListWidget::itemForProjectConfiguration(ProjectConfigura
|
||||
{
|
||||
for (int i = 0; i < count(); ++i) {
|
||||
QListWidgetItem *lwi = item(i);
|
||||
if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc) {
|
||||
if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc)
|
||||
return lwi;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1401,11 +1399,10 @@ void MiniProjectTargetSelector::updateActionAndSummary()
|
||||
}
|
||||
}
|
||||
m_projectAction->setProperty("heading", projectName);
|
||||
if (project && project->needsConfiguration()) {
|
||||
if (project && project->needsConfiguration())
|
||||
m_projectAction->setProperty("subtitle", tr("Unconfigured"));
|
||||
} else {
|
||||
else
|
||||
m_projectAction->setProperty("subtitle", buildConfig);
|
||||
}
|
||||
m_projectAction->setIcon(targetIcon);
|
||||
QStringList lines;
|
||||
lines << tr("<b>Project:</b> %1").arg(projectName);
|
||||
|
||||
Reference in New Issue
Block a user