From 8c442d45dbd646f0d76282861fe9c0bbbf27a096 Mon Sep 17 00:00:00 2001 From: Ralph Schurade Date: Sun, 6 Dec 2020 19:53:08 +0100 Subject: [PATCH] clang format --- src/gui/aggregatorloadgame.cpp | 11 +++-------- src/gui/aggregatorloadgame.h | 19 +++++++++---------- src/gui/xaml/LoadGameModel.cpp | 9 ++++----- src/gui/xaml/LoadGameModel.h | 2 -- src/gui/xaml/ProxyMainView.cpp | 7 +++---- src/gui/xaml/ProxyMainView.h | 6 +++--- src/gui/xaml/ViewModel.cpp | 6 +++--- src/gui/xaml/ViewModel.h | 4 ++-- src/gui/xaml/loadgameproxy.cpp | 20 ++++++++++---------- src/gui/xaml/loadgameproxy.h | 14 ++++++-------- 10 files changed, 43 insertions(+), 55 deletions(-) diff --git a/src/gui/aggregatorloadgame.cpp b/src/gui/aggregatorloadgame.cpp index cb477ad2a..a037da4c6 100644 --- a/src/gui/aggregatorloadgame.cpp +++ b/src/gui/aggregatorloadgame.cpp @@ -19,8 +19,6 @@ #include "../base/io.h" -#include - #include #include #include @@ -33,10 +31,8 @@ #include #include - AggregatorLoadGame::AggregatorLoadGame( QObject* parent ) { - } AggregatorLoadGame::~AggregatorLoadGame() @@ -45,7 +41,7 @@ AggregatorLoadGame::~AggregatorLoadGame() void AggregatorLoadGame::onRequestKingdoms() { - QString sfolder = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ) + "/My Games/Ingnomia/save/"; + QString sfolder = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ) + "/My Games/Ingnomia/save/"; m_kingdomList.clear(); @@ -111,14 +107,14 @@ void AggregatorLoadGame::onRequestSaveGames( const QString path ) GuiSaveInfo gsi; gsi.folder = path + "/" + sdir; - gsi.dir = sdir; + gsi.dir = sdir; QJsonDocument jd; IO::loadFile( gsi.folder + "/game.json", jd ); QJsonArray ja = jd.array(); QVariantMap vm = ja.toVariantList().first().toMap(); - gsi.version = IO::versionString( gsi.folder ); + gsi.version = IO::versionString( gsi.folder ); gsi.compatible = true; if ( !IO::saveCompatible( gsi.folder ) ) @@ -129,7 +125,6 @@ void AggregatorLoadGame::onRequestSaveGames( const QString path ) gsi.name = vm.value( "kingdomName" ).toString(); - QFile file( gsi.folder + "/game.json" ); QFileInfo fi( file ); gsi.date = fi.lastModified().toString(); diff --git a/src/gui/aggregatorloadgame.h b/src/gui/aggregatorloadgame.h index cbfafafdd..4eac48119 100644 --- a/src/gui/aggregatorloadgame.h +++ b/src/gui/aggregatorloadgame.h @@ -21,17 +21,16 @@ struct GuiSaveInfo { - QString name; - QString folder; - QString dir; - QString version; - QString date; - bool compatible = true; + QString name; + QString folder; + QString dir; + QString version; + QString date; + bool compatible = true; }; Q_DECLARE_METATYPE( GuiSaveInfo ) - class AggregatorLoadGame : public QObject { Q_OBJECT @@ -42,13 +41,13 @@ class AggregatorLoadGame : public QObject private: QList m_kingdomList; - QList m_gameList; + QList m_gameList; public slots: void onRequestKingdoms(); - void onRequestSaveGames( const QString path ); + void onRequestSaveGames( const QString path ); signals: void signalKingdoms( const QList& kingdoms ); - void signalSaveGames( const QList& kingdoms ); + void signalSaveGames( const QList& kingdoms ); }; diff --git a/src/gui/xaml/LoadGameModel.cpp b/src/gui/xaml/LoadGameModel.cpp index 07ef29981..a0db27b1e 100644 --- a/src/gui/xaml/LoadGameModel.cpp +++ b/src/gui/xaml/LoadGameModel.cpp @@ -16,9 +16,9 @@ along with this program. If not, see . */ #include "LoadGameModel.h" -#include "loadgameproxy.h" #include "../../base/io.h" +#include "loadgameproxy.h" #include #include @@ -42,7 +42,6 @@ SaveItem::SaveItem( QString name, QString path, QString dir, QString version, QS _version = version.toStdString().c_str(); _date = date.toStdString().c_str(); _compatible = compatible; - } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -75,7 +74,7 @@ void LoadGameModel::updateSavedKingdoms( const QList& kingdoms ) { _savedKingdoms->Clear(); - for( const auto& gsk : kingdoms ) + for ( const auto& gsk : kingdoms ) { _savedKingdoms->Add( MakePtr( gsk.name, gsk.folder, "", gsk.version, gsk.date ) ); } @@ -92,7 +91,7 @@ void LoadGameModel::updateSaveGames( const QList& saveGames ) { _savedGames->Clear(); - for( const auto& gsi : saveGames ) + for ( const auto& gsi : saveGames ) { _savedGames->Add( MakePtr( gsi.name, gsi.folder, gsi.dir, gsi.version, gsi.date, gsi.compatible ) ); } @@ -146,7 +145,7 @@ const NoesisApp::DelegateCommand* LoadGameModel::GetLoadGame() const void LoadGameModel::OnLoadGame( BaseComponent* param ) { - qDebug() << "OnLoadGame"; + qDebug() << "OnLoadGame"; if ( _selectedGame ) { qDebug() << _selectedGame->_path.Str(); diff --git a/src/gui/xaml/LoadGameModel.h b/src/gui/xaml/LoadGameModel.h index 008972a70..eba6556e0 100644 --- a/src/gui/xaml/LoadGameModel.h +++ b/src/gui/xaml/LoadGameModel.h @@ -85,8 +85,6 @@ class LoadGameModel final : public NoesisApp::NotifyPropertyChangedBase void SetSelectedGame( SaveItem* item ); SaveItem* GetSelectedGame() const; - - NoesisApp::DelegateCommand _loadGame; Noesis::Ptr> _savedKingdoms; diff --git a/src/gui/xaml/ProxyMainView.cpp b/src/gui/xaml/ProxyMainView.cpp index b6237b89d..dc25c3d1b 100644 --- a/src/gui/xaml/ProxyMainView.cpp +++ b/src/gui/xaml/ProxyMainView.cpp @@ -17,10 +17,9 @@ */ #include "ProxyMainView.h" -#include "../eventconnector.h" -#include "../aggregatorsettings.h" #include "../aggregatorloadgame.h" - +#include "../aggregatorsettings.h" +#include "../eventconnector.h" #include "ViewModel.h" ProxyMainView::ProxyMainView( QObject* parent ) : @@ -70,4 +69,4 @@ void ProxyMainView::onUIScale( float value ) void ProxyMainView::requestLoadScreenUpdate() { emit signalRequestLoadScreenUpdate(); -} \ No newline at end of file +} diff --git a/src/gui/xaml/ProxyMainView.h b/src/gui/xaml/ProxyMainView.h index 8a91d3710..74a39416a 100644 --- a/src/gui/xaml/ProxyMainView.h +++ b/src/gui/xaml/ProxyMainView.h @@ -31,7 +31,7 @@ class ProxyMainView : public QObject void setParent( IngnomiaGUI::ViewModel* parent ); - void requestLoadScreenUpdate(); + void requestLoadScreenUpdate(); private: IngnomiaGUI::ViewModel* m_parent = nullptr; @@ -40,8 +40,8 @@ private slots: void onWindowSize( int w, int h ); void onKeyEsc(); - void onUIScale( float value ); + void onUIScale( float value ); signals: - void signalRequestLoadScreenUpdate(); + void signalRequestLoadScreenUpdate(); }; diff --git a/src/gui/xaml/ViewModel.cpp b/src/gui/xaml/ViewModel.cpp index 49f3fdeff..210382122 100644 --- a/src/gui/xaml/ViewModel.cpp +++ b/src/gui/xaml/ViewModel.cpp @@ -62,7 +62,7 @@ ViewModel::ViewModel() _showMainMenu = true; _showGameGUI = false; _ingame = false; - m_scale = qMax( 1.0f, Config::getInstance().get( "uiscale" ).toFloat() ); + m_scale = qMax( 1.0f, Config::getInstance().get( "uiscale" ).toFloat() ); setWindowSize( 1920, 1080 ); } @@ -352,7 +352,7 @@ void ViewModel::OnBack( BaseComponent* ) SetState( State::Main ); } _showMainMenu = true; - _showGameGUI = false; + _showGameGUI = false; OnPropertyChanged( "ShowMainMenu" ); OnPropertyChanged( "ShowGameGui" ); GameManager::getInstance().setShowMainMenu( true ); @@ -380,7 +380,7 @@ void ViewModel::OnResume( BaseComponent* ) { SetState( State::GameRunning ); _showMainMenu = false; - _showGameGUI = true; + _showGameGUI = true; OnPropertyChanged( "ShowMainMenu" ); OnPropertyChanged( "ShowGameGui" ); GameManager::getInstance().setShowMainMenu( false ); diff --git a/src/gui/xaml/ViewModel.h b/src/gui/xaml/ViewModel.h index 05f86ea7d..20dfde820 100644 --- a/src/gui/xaml/ViewModel.h +++ b/src/gui/xaml/ViewModel.h @@ -100,7 +100,7 @@ class ViewModel final : public NoesisApp::NotifyPropertyChangedBase void OnResume( BaseComponent* param ); void OnFadeInCompleted( BaseComponent* params ); void OnPause( BaseComponent* params ); - + State GetState() const; void SetState( State value ); @@ -119,7 +119,7 @@ class ViewModel final : public NoesisApp::NotifyPropertyChangedBase NoesisApp::DelegateCommand _backToMain; NoesisApp::DelegateCommand _resume; NoesisApp::DelegateCommand _fadeInCompleted; - + State _state; NewGameModel _newGameModel; diff --git a/src/gui/xaml/loadgameproxy.cpp b/src/gui/xaml/loadgameproxy.cpp index 79279208e..e70879683 100644 --- a/src/gui/xaml/loadgameproxy.cpp +++ b/src/gui/xaml/loadgameproxy.cpp @@ -25,10 +25,10 @@ LoadGameProxy::LoadGameProxy( QObject* parent ) : QObject( parent ) { connect( this, &LoadGameProxy::signalRequestKingdoms, EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::onRequestKingdoms, Qt::QueuedConnection ); - connect( this, &LoadGameProxy::signalRequestSaveGames, EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::onRequestSaveGames, Qt::QueuedConnection ); + connect( this, &LoadGameProxy::signalRequestSaveGames, EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::onRequestSaveGames, Qt::QueuedConnection ); - connect( EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::signalKingdoms, this, &LoadGameProxy::onKingdoms, Qt::QueuedConnection ); - connect( EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::signalSaveGames, this, &LoadGameProxy::onSaveGames, Qt::QueuedConnection ); + connect( EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::signalKingdoms, this, &LoadGameProxy::onKingdoms, Qt::QueuedConnection ); + connect( EventConnector::getInstance().aggregatorLoadGame(), &AggregatorLoadGame::signalSaveGames, this, &LoadGameProxy::onSaveGames, Qt::QueuedConnection ); } void LoadGameProxy::setParent( IngnomiaGUI::LoadGameModel* parent ) @@ -38,26 +38,26 @@ void LoadGameProxy::setParent( IngnomiaGUI::LoadGameModel* parent ) void LoadGameProxy::requestKingdoms() { - emit signalRequestKingdoms(); + emit signalRequestKingdoms(); } void LoadGameProxy::onKingdoms( const QList& kingdoms ) { - if( m_parent ) + if ( m_parent ) { - m_parent->updateSavedKingdoms( kingdoms ); + m_parent->updateSavedKingdoms( kingdoms ); } } void LoadGameProxy::requestSaveGames( const QString path ) { - emit signalRequestSaveGames( path ); + emit signalRequestSaveGames( path ); } void LoadGameProxy::onSaveGames( const QList& saveGames ) { - if( m_parent ) + if ( m_parent ) { - m_parent->updateSaveGames( saveGames ); + m_parent->updateSaveGames( saveGames ); } -} \ No newline at end of file +} diff --git a/src/gui/xaml/loadgameproxy.h b/src/gui/xaml/loadgameproxy.h index 0888fc2dd..7f228345c 100644 --- a/src/gui/xaml/loadgameproxy.h +++ b/src/gui/xaml/loadgameproxy.h @@ -30,19 +30,17 @@ class LoadGameProxy : public QObject LoadGameProxy( QObject* parent = nullptr ); void setParent( IngnomiaGUI::LoadGameModel* parent ); - void requestKingdoms(); - void requestSaveGames( const QString path ); + void requestKingdoms(); + void requestSaveGames( const QString path ); private: IngnomiaGUI::LoadGameModel* m_parent = nullptr; - - private slots: - void onKingdoms( const QList& kingdoms ); - void onSaveGames( const QList& saveGames ); - + void onKingdoms( const QList& kingdoms ); + void onSaveGames( const QList& saveGames ); + signals: void signalRequestKingdoms(); - void signalRequestSaveGames( const QString path ); + void signalRequestSaveGames( const QString path ); };