Automated whitespace / coding style correction

First attempt to use the tools on one of our source files.
So far so good. Not perfect, but a HUGE improvement.

Most importantly it effortlessly fixed the Allman style braces introduced
in commit 51220f26ef ("Add recent files to main menu.").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-02-13 22:11:05 -08:00
parent ebac81b784
commit f26896da1b

View file

@ -478,14 +478,16 @@ void MainWindow::on_actionViewAll_triggered()
redrawProfile();
}
void MainWindow::beginChangeState(CurrentState s) {
void MainWindow::beginChangeState(CurrentState s)
{
if (state == VIEWALL && state != s) {
saveSplitterSizes();
}
state = s;
}
void MainWindow::saveSplitterSizes() {
void MainWindow::saveSplitterSizes()
{
QSettings settings;
settings.beginGroup("MainWindow");
settings.setValue("mainSplitter", ui.mainSplitter->saveState());
@ -604,11 +606,21 @@ void MainWindow::initialUiSetup()
state = (CurrentState)settings.value("lastState", 0).toInt();
switch (state) {
case VIEWALL: on_actionViewAll_triggered(); break;
case GLOBE_MAXIMIZED : on_actionViewGlobe_triggered(); break;
case INFO_MAXIMIZED : on_actionViewInfo_triggered(); break;
case LIST_MAXIMIZED : on_actionViewList_triggered(); break;
case PROFILE_MAXIMIZED : on_actionViewProfile_triggered(); break;
case VIEWALL:
on_actionViewAll_triggered();
break;
case GLOBE_MAXIMIZED:
on_actionViewGlobe_triggered();
break;
case INFO_MAXIMIZED:
on_actionViewInfo_triggered();
break;
case LIST_MAXIMIZED:
on_actionViewList_triggered();
break;
case PROFILE_MAXIMIZED:
on_actionViewProfile_triggered();
break;
}
settings.endGroup();
}
@ -635,7 +647,6 @@ void MainWindow::readSettings()
ui.profPO2->setChecked(s.value("po2graph").toBool());
ui.profRuler->setChecked(s.value("rulergraph").toBool());
ui.profSAC->setChecked(s.value("show_sac").toBool());
}
void MainWindow::writeSettings()
@ -700,42 +711,29 @@ void MainWindow::loadRecentFiles(QSettings *s)
bool modified = false;
s->beginGroup("Recent_Files");
for (int c = 1; c <= 4; c++)
{
for (int c = 1; c <= 4; c++) {
QString key = QString("File_%1").arg(c);
if (s->contains(key))
{
if (s->contains(key)) {
QString file = s->value(key).toString();
if (QFile::exists(file))
{
if (QFile::exists(file)) {
files.append(file);
}
else
{
} else {
modified = true;
}
}
else
{
} else {
break;
}
}
if (modified)
{
for (int c = 0; c < 4; c++)
{
if (modified) {
for (int c = 0; c < 4; c++) {
QString key = QString("File_%1").arg(c + 1);
if (files.count() > c)
{
if (files.count() > c) {
s->setValue(key, files.at(c));
}
else
{
if (s->contains(key))
{
} else {
if (s->contains(key)) {
s->remove(key);
}
}
@ -745,19 +743,15 @@ void MainWindow::loadRecentFiles(QSettings *s)
}
s->endGroup();
for (int c = 0; c < 4; c++)
{
for (int c = 0; c < 4; c++) {
QAction *action = this->findChild<QAction *>(QString("actionRecent%1").arg(c + 1));
if (files.count() > c)
{
if (files.count() > c) {
QFileInfo fi(files.at(c));
action->setText(fi.fileName());
action->setToolTip(fi.absoluteFilePath());
action->setVisible(true);
}
else
{
} else {
action->setVisible(false);
}
}
@ -768,63 +762,48 @@ void MainWindow::addRecentFile(const QStringList &newFiles)
QStringList files;
QSettings s;
if (newFiles.isEmpty())
{
if (newFiles.isEmpty()) {
return;
}
s.beginGroup("Recent_Files");
for (int c = 1; c <= 4; c++)
{
for (int c = 1; c <= 4; c++) {
QString key = QString("File_%1").arg(c);
if (s.contains(key))
{
if (s.contains(key)) {
QString file = s.value(key).toString();
files.append(file);
}
else
{
} else {
break;
}
}
foreach(const QString &file, newFiles)
{
foreach(const QString & file, newFiles) {
int index = files.indexOf(file);
if (index >= 0)
{
if (index >= 0) {
files.removeAt(index);
}
}
foreach(const QString &file, newFiles)
{
if (QFile::exists(file))
{
foreach(const QString & file, newFiles) {
if (QFile::exists(file)) {
files.prepend(file);
}
}
while(files.count() > 4)
{
while (files.count() > 4) {
files.removeLast();
}
for (int c = 0; c < 4; c++)
{
for (int c = 0; c < 4; c++) {
QString key = QString("File_%1").arg(c + 1);
if (files.count() > c)
{
if (files.count() > c) {
s.setValue(key, files.at(c));
}
else
{
if (s.contains(key))
{
} else {
if (s.contains(key)) {
s.remove(key);
}
}