Skip to content

Commit

Permalink
Fix the books example. Port to new API.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveire committed Mar 3, 2010
1 parent 4af8d0f commit ab359bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/books/bookwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ BookWindow::BookWindow()

connect(ui.exportButton, SIGNAL(pressed()), SLOT(renderBooks()));

Grantlee::Engine *engine = Grantlee::Engine::instance();
m_engine = new Grantlee::Engine();
Grantlee::FileSystemTemplateLoader::Ptr loader = Grantlee::FileSystemTemplateLoader::Ptr( new Grantlee::FileSystemTemplateLoader() );
loader->setTemplateDirs( QStringList() << GRANTLEE_TEMPLATE_PATH );
engine->addTemplateLoader(loader);
m_engine->addTemplateLoader(loader);

engine->setPluginDirs( QStringList() << GRANTLEE_PLUGIN_PATH );
m_engine->setPluginDirs( QStringList() << GRANTLEE_PLUGIN_PATH );
}

void BookWindow::showError(const QSqlError &err)
Expand Down Expand Up @@ -156,8 +156,8 @@ void BookWindow::renderBooks()
QString themeName = ui.exportTheme->currentText();

Grantlee::Context c(mapping);
Grantlee::Engine *engine = Grantlee::Engine::instance();
Grantlee::Template t = engine->loadByName( themeName + ".html" );

Grantlee::Template t = m_engine->loadByName( themeName + ".html" );
if (!t)
{
return;
Expand Down
5 changes: 5 additions & 0 deletions examples/books/bookwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@

#include "ui_bookwindow.h"

namespace Grantlee
{
class Engine;
}

class BookWindow: public QMainWindow
{
Expand All @@ -62,6 +66,7 @@ protected Q_SLOTS:
Ui::BookWindow ui;
QSqlRelationalTableModel *model;
int authorIdx, genreIdx;
Grantlee::Engine *m_engine;
};

#endif

0 comments on commit ab359bf

Please sign in to comment.