created resource which contains parsed schedule,
authorpavelpa <pavelpa@localhost>
Mon, 1 Feb 2010 09:54:29 +0000 (09:54 +0000)
committerpavelpa <pavelpa@localhost>
Mon, 1 Feb 2010 09:54:29 +0000 (09:54 +0000)
so the user doesn't have to parse it by himself

src/app/app.pro
src/app/main.cpp
src/db.qrc [new file with mode: 0644]
src/fosdem.sqlite [new file with mode: 0644]
src/sql/sqlengine.cpp

index 10ef88b..675cfd6 100644 (file)
@@ -22,7 +22,8 @@ SOURCES += main.cpp \
            appsettings.cpp
 
 RESOURCES += ../icons.qrc \
-             ../maps.qrc
+             ../maps.qrc \
+             ../db.qrc
 
 # instalation related
 
index 22445b2..fb8042e 100644 (file)
@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
 {
     Q_INIT_RESOURCE(icons);
     Q_INIT_RESOURCE(maps);
+    Q_INIT_RESOURCE(db);
 
     QApplication a(argc, argv);
     QApplication::setWindowIcon(QIcon(":/icons/fosdem.png"));
diff --git a/src/db.qrc b/src/db.qrc
new file mode 100644 (file)
index 0000000..37282e0
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>fosdem.sqlite</file>
+</qresource>
+</RCC>
+
diff --git a/src/fosdem.sqlite b/src/fosdem.sqlite
new file mode 100644 (file)
index 0000000..97d6ada
Binary files /dev/null and b/src/fosdem.sqlite differ
index 07f6024..cb07f81 100644 (file)
@@ -32,12 +32,19 @@ QString SqlEngine::login(const QString &aDatabaseType, const QString &aDatabaseN
     bool result = false;
     if(!QFile::exists(aDatabaseName)) // the DB (tables) doesn't exists, and so we have to create one
     {
+        /*
         // creating empty DB + tables
         // ??? what is the best way of creating new empty DB ???
         // we can either:
         //  - create new DB + tables by issuing corresponding queries (used solution)
         //  - create new DB from resource, which contains empty DB with tables
         result = createTables(database);
+        */
+
+        // copy conference Db from resource, instead of creating
+        // empty tables and then parsing the schedule
+        QFile(":/fosdem.sqlite").copy(aDatabaseName);
+        database.open();
     }
     else
     {