mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
ebac81b784
commit
f26896da1b
1 changed files with 63 additions and 84 deletions
|
@ -478,14 +478,16 @@ void MainWindow::on_actionViewAll_triggered()
|
||||||
redrawProfile();
|
redrawProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::beginChangeState(CurrentState s) {
|
void MainWindow::beginChangeState(CurrentState s)
|
||||||
|
{
|
||||||
if (state == VIEWALL && state != s) {
|
if (state == VIEWALL && state != s) {
|
||||||
saveSplitterSizes();
|
saveSplitterSizes();
|
||||||
}
|
}
|
||||||
state = s;
|
state = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveSplitterSizes() {
|
void MainWindow::saveSplitterSizes()
|
||||||
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
settings.setValue("mainSplitter", ui.mainSplitter->saveState());
|
settings.setValue("mainSplitter", ui.mainSplitter->saveState());
|
||||||
|
@ -604,11 +606,21 @@ void MainWindow::initialUiSetup()
|
||||||
|
|
||||||
state = (CurrentState)settings.value("lastState", 0).toInt();
|
state = (CurrentState)settings.value("lastState", 0).toInt();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case VIEWALL: on_actionViewAll_triggered(); break;
|
case VIEWALL:
|
||||||
case GLOBE_MAXIMIZED : on_actionViewGlobe_triggered(); break;
|
on_actionViewAll_triggered();
|
||||||
case INFO_MAXIMIZED : on_actionViewInfo_triggered(); break;
|
break;
|
||||||
case LIST_MAXIMIZED : on_actionViewList_triggered(); break;
|
case GLOBE_MAXIMIZED:
|
||||||
case PROFILE_MAXIMIZED : on_actionViewProfile_triggered(); break;
|
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();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -635,7 +647,6 @@ void MainWindow::readSettings()
|
||||||
ui.profPO2->setChecked(s.value("po2graph").toBool());
|
ui.profPO2->setChecked(s.value("po2graph").toBool());
|
||||||
ui.profRuler->setChecked(s.value("rulergraph").toBool());
|
ui.profRuler->setChecked(s.value("rulergraph").toBool());
|
||||||
ui.profSAC->setChecked(s.value("show_sac").toBool());
|
ui.profSAC->setChecked(s.value("show_sac").toBool());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeSettings()
|
void MainWindow::writeSettings()
|
||||||
|
@ -700,42 +711,29 @@ void MainWindow::loadRecentFiles(QSettings *s)
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
s->beginGroup("Recent_Files");
|
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);
|
QString key = QString("File_%1").arg(c);
|
||||||
if (s->contains(key))
|
if (s->contains(key)) {
|
||||||
{
|
|
||||||
QString file = s->value(key).toString();
|
QString file = s->value(key).toString();
|
||||||
|
|
||||||
if (QFile::exists(file))
|
if (QFile::exists(file)) {
|
||||||
{
|
|
||||||
files.append(file);
|
files.append(file);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modified)
|
if (modified) {
|
||||||
{
|
for (int c = 0; c < 4; c++) {
|
||||||
for (int c = 0; c < 4; c++)
|
|
||||||
{
|
|
||||||
QString key = QString("File_%1").arg(c + 1);
|
QString key = QString("File_%1").arg(c + 1);
|
||||||
|
|
||||||
if (files.count() > c)
|
if (files.count() > c) {
|
||||||
{
|
|
||||||
s->setValue(key, files.at(c));
|
s->setValue(key, files.at(c));
|
||||||
}
|
} else {
|
||||||
else
|
if (s->contains(key)) {
|
||||||
{
|
|
||||||
if (s->contains(key))
|
|
||||||
{
|
|
||||||
s->remove(key);
|
s->remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -745,19 +743,15 @@ void MainWindow::loadRecentFiles(QSettings *s)
|
||||||
}
|
}
|
||||||
s->endGroup();
|
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));
|
QAction *action = this->findChild<QAction *>(QString("actionRecent%1").arg(c + 1));
|
||||||
|
|
||||||
if (files.count() > c)
|
if (files.count() > c) {
|
||||||
{
|
|
||||||
QFileInfo fi(files.at(c));
|
QFileInfo fi(files.at(c));
|
||||||
action->setText(fi.fileName());
|
action->setText(fi.fileName());
|
||||||
action->setToolTip(fi.absoluteFilePath());
|
action->setToolTip(fi.absoluteFilePath());
|
||||||
action->setVisible(true);
|
action->setVisible(true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
action->setVisible(false);
|
action->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,63 +762,48 @@ void MainWindow::addRecentFile(const QStringList &newFiles)
|
||||||
QStringList files;
|
QStringList files;
|
||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
||||||
if (newFiles.isEmpty())
|
if (newFiles.isEmpty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.beginGroup("Recent_Files");
|
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);
|
QString key = QString("File_%1").arg(c);
|
||||||
if (s.contains(key))
|
if (s.contains(key)) {
|
||||||
{
|
|
||||||
QString file = s.value(key).toString();
|
QString file = s.value(key).toString();
|
||||||
|
|
||||||
files.append(file);
|
files.append(file);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const QString &file, newFiles)
|
foreach(const QString & file, newFiles) {
|
||||||
{
|
|
||||||
int index = files.indexOf(file);
|
int index = files.indexOf(file);
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0) {
|
||||||
{
|
|
||||||
files.removeAt(index);
|
files.removeAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const QString &file, newFiles)
|
foreach(const QString & file, newFiles) {
|
||||||
{
|
if (QFile::exists(file)) {
|
||||||
if (QFile::exists(file))
|
|
||||||
{
|
|
||||||
files.prepend(file);
|
files.prepend(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(files.count() > 4)
|
while (files.count() > 4) {
|
||||||
{
|
|
||||||
files.removeLast();
|
files.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int c = 0; c < 4; c++)
|
for (int c = 0; c < 4; c++) {
|
||||||
{
|
|
||||||
QString key = QString("File_%1").arg(c + 1);
|
QString key = QString("File_%1").arg(c + 1);
|
||||||
|
|
||||||
if (files.count() > c)
|
if (files.count() > c) {
|
||||||
{
|
|
||||||
s.setValue(key, files.at(c));
|
s.setValue(key, files.at(c));
|
||||||
}
|
} else {
|
||||||
else
|
if (s.contains(key)) {
|
||||||
{
|
|
||||||
if (s.contains(key))
|
|
||||||
{
|
|
||||||
s.remove(key);
|
s.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue