[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krecipes] src/backends: Move all*Models() functions to RecipeDB
From:       José_Manuel_Santamaría_Lema <panfaust () gmail ! com>
Date:       2016-07-14 19:07:24
Message-ID: E1bNlym-0004u2-1S () code ! kde ! org
[Download RAW message or body]

Git commit f013c78758dae26361b1f5e561c65765cda68bc3 by José Manuel Santamaría Lema.
Committed on 14/07/2016 at 19:01.
Pushed by joselema into branch 'master'.

Move all*Models() functions to RecipeDB

This functions are SQL agnostic so RecipeDB is the correct class to have its
implementation rather than QSqlRecipeDB.

M  +0    -17   src/backends/qsqlrecipedb.cpp
M  +0    -2    src/backends/qsqlrecipedb.h
M  +17   -0    src/backends/recipedb.cpp
M  +2    -2    src/backends/recipedb.h

http://commits.kde.org/krecipes/f013c78758dae26361b1f5e561c65765cda68bc3

diff --git a/src/backends/qsqlrecipedb.cpp b/src/backends/qsqlrecipedb.cpp
index c543b0b..7a0af00 100644
--- a/src/backends/qsqlrecipedb.cpp
+++ b/src/backends/qsqlrecipedb.cpp
@@ -217,14 +217,6 @@ void QSqlRecipeDB::loadAllIngredientsModels()
 	ingredientNameModel->setDynamicSortFilter( true );
 }
 
-KreAllIngredientsModels * QSqlRecipeDB::allIngredientsModels()
-{
-	if ( !m_allIngredientsModels ) {
-		loadAllIngredientsModels();
-	}
-	return m_allIngredientsModels;
-}
-
 void QSqlRecipeDB::loadAllIngHeadersModels()
 {
 	if ( !m_allIngHeadersModels ) {
@@ -261,15 +253,6 @@ void QSqlRecipeDB::loadAllIngHeadersModels()
 	ingHeaderNameModel->setDynamicSortFilter( true );
 }
 
-KreAllIngHeadersModels * QSqlRecipeDB::allIngHeadersModels()
-{
-	if ( !m_allIngHeadersModels ) {
-		loadAllIngHeadersModels();
-	}
-	return m_allIngHeadersModels;
-}
-
-
 void QSqlRecipeDB::transaction()
 {
 	if ( m_transactionsEnabled ) {
diff --git a/src/backends/qsqlrecipedb.h b/src/backends/qsqlrecipedb.h
index 472e812..1c15e1c 100644
--- a/src/backends/qsqlrecipedb.h
+++ b/src/backends/qsqlrecipedb.h
@@ -96,9 +96,7 @@ public:
 	RecipeDB::Error connect( bool create_db, bool create_tables );
 
 	void loadAllIngredientsModels();
-	KreAllIngredientsModels * allIngredientsModels();
 	void loadAllIngHeadersModels();
-	KreAllIngHeadersModels * allIngHeadersModels();
 
 	virtual void transaction();
 	virtual void commit();
diff --git a/src/backends/recipedb.cpp b/src/backends/recipedb.cpp
index bca2dd6..1ba0d7e 100644
--- a/src/backends/recipedb.cpp
+++ b/src/backends/recipedb.cpp
@@ -141,6 +141,23 @@ RecipeDB* RecipeDB::createDatabase( const QString &dbType, const QString &host,
 	return database;
 }
 
+KreAllIngredientsModels * RecipeDB::allIngredientsModels()
+{
+	if ( !m_allIngredientsModels ) {
+		loadAllIngredientsModels();
+	}
+	return m_allIngredientsModels;
+}
+
+KreAllIngHeadersModels * RecipeDB::allIngHeadersModels()
+{
+	if ( !m_allIngHeadersModels ) {
+		loadAllIngHeadersModels();
+	}
+	return m_allIngHeadersModels;
+}
+
+
 void RecipeDB::updateCategoryCache( int limit )
 {
 	m_categoryCache = new CategoryTree;
diff --git a/src/backends/recipedb.h b/src/backends/recipedb.h
index c703804..7f3a1bb 100644
--- a/src/backends/recipedb.h
+++ b/src/backends/recipedb.h
@@ -182,9 +182,9 @@ public:
 	//Database models, they are updated automatically on database changes
 	//via signals/slots connections between themselves and RecipeDB
 	virtual void loadAllIngredientsModels() = 0;
-	virtual KreAllIngredientsModels * allIngredientsModels() = 0;
+	KreAllIngredientsModels * allIngredientsModels();
 	virtual void loadAllIngHeadersModels() = 0;
-	virtual KreAllIngHeadersModels * allIngHeadersModels() = 0;
+	KreAllIngHeadersModels * allIngHeadersModels();
 
 	//FIXME: Actually this functions shouldn't be exposed here since RecipeDB is suposed
 	//to represent a generic database which may be not be based on SQL. Not a big problem

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic