------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2010 Vadim Godunko <vgodunko@gmail.com>                 --
--                                                                          --
-- QtAda is free software;  you can  redistribute it and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion. QtAda is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License distributed with QtAda;  see file COPYING.  If not, write --
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3769 $ $Date: 2010-10-24 03:16:28 +0400 (Sun, 24 Oct 2010) $
------------------------------------------------------------------------------
with Qt_Ada.Application;
with Qt4.Strings;
with Qt4.Sql_Databases;
with Qt4.Sql_Relational_Table_Models.Constructors;
with Qt4.Table_Views;

with Connection;
with Relational_Table_Models;

procedure Main is
begin
   Qt_Ada.Application.Initialize;

   declare
      DB : Qt4.Sql_Databases.Q_Sql_Database;

   begin
      Connection.Create_Connection (DB);

      declare
         Model : constant access
           Qt4.Sql_Relational_Table_Models.Q_Sql_Relational_Table_Model'Class
             := Qt4.Sql_Relational_Table_Models.Constructors.Create (null, DB);
         View  : access Qt4.Table_Views.Q_Table_View;

      begin
         Relational_Table_Models.Create_Relational_Tables (DB);
         Relational_Table_Models.Initialize_Model (Model);
         View := Relational_Table_Models.Create_View
                  (Qt4.Strings.From_Utf_16 ("Relational Table Model"), Model);
         View.Show;
         Qt_Ada.Application.Execute;
      end;
   end;
end Main;
