#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -37,81 +37,80 @@
#include <QFileInfo>
#include <QMdiSubWindow>
CAF_CMD_SOURCE_INIT(RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature");
CAF_CMD_SOURCE_INIT( RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::saveSnapshotAs(const QString& fileName, RimViewWindow* viewWindow)
void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow )
{
if (viewWindow)
if ( viewWindow )
{
QImage image = viewWindow->snapshotWindowContent();
saveSnapshotAs(fileName, image);
saveSnapshotAs( fileName, image );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::saveSnapshotAs(const QString& fileName, const QImage& image)
void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, const QImage& image )
{
if (!image.isNull())
if ( !image.isNull() )
{
if (image.save(fileName))
if ( image.save( fileName ) )
{
RiaLogging::info(QString("Exported snapshot image to %1").arg(fileName));
RiaLogging::info( QString( "Exported snapshot image to %1" ).arg( fileName ) );
}
else
{
RiaLogging::error(QString("Error when trying to export snapshot image to %1").arg(fileName));
RiaLogging::error( QString( "Error when trying to export snapshot image to %1" ).arg( fileName ) );
}
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::saveToFile(const QImage& image, const QString& defaultFileBaseName)
void RicSnapshotViewToFileFeature::saveToFile( const QImage& image, const QString& defaultFileBaseName )
{
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
QString startPath;
if (!proj->fileName().isEmpty())
if ( !proj->fileName().isEmpty() )
{
QFileInfo fi(proj->fileName());
QFileInfo fi( proj->fileName() );
startPath = fi.absolutePath();
}
else
{
startPath = app->lastUsedDialogDirectory("IMAGE_SNAPSHOT");
startPath = app->lastUsedDialogDirectory( "IMAGE_SNAPSHOT" );
}
QString defaultAbsFileName = caf::Utils::constructFullFileName(startPath, defaultFileBaseName, ".png");
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Export to File"), defaultAbsFileName);
if (fileName.isEmpty())
QString defaultAbsFileName = caf::Utils::constructFullFileName( startPath, defaultFileBaseName, ".png" );
QString fileName = QFileDialog::getSaveFileName( nullptr, tr( "Export to File" ), defaultAbsFileName );
if ( fileName.isEmpty() )
{
return;
}
// Remember the directory to next time
app->setLastUsedDialogDirectory("IMAGE_SNAPSHOT", QFileInfo(fileName).absolutePath());
app->setLastUsedDialogDirectory( "IMAGE_SNAPSHOT", QFileInfo( fileName ).absolutePath() );
RicSnapshotViewToFileFeature::saveSnapshotAs(fileName, image);
RicSnapshotViewToFileFeature::saveSnapshotAs( fileName, image );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QIcon RicSnapshotViewToFileFeature::icon()
{
return QIcon(":/SnapShotSave.png");
return QIcon( ":/SnapShotSave.png" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicSnapshotViewToFileFeature::text()
{
@@ -119,7 +118,7 @@ QString RicSnapshotViewToFileFeature::text()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicSnapshotViewToFileFeature::isCommandEnabled()
{
@@ -127,31 +126,31 @@ bool RicSnapshotViewToFileFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
void RicSnapshotViewToFileFeature::onActionTriggered( bool isChecked )
{
// Get active view window before displaying the file selection dialog
// If this is done after the file save dialog is displayed (and closed)
// app->activeViewWindow() returns nullptr on Linux
RimViewWindow* viewWindow = RiaGuiApplication::activeViewWindow();
if (!viewWindow)
if ( !viewWindow )
{
RiaLogging::error("No view window is available, nothing to do");
RiaLogging::error( "No view window is available, nothing to do" );
return;
}
QImage image = viewWindow->snapshotWindowContent();
saveToFile(image, RicSnapshotFilenameGenerator::generateSnapshotFileName(viewWindow));
saveToFile( image, RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicSnapshotViewToFileFeature::setupActionLook(QAction* actionToSetup)
void RicSnapshotViewToFileFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText(text());
actionToSetup->setIcon(icon());
actionToSetup->setText( text() );
actionToSetup->setIcon( icon() );
}