Reading platforms from database and creating a table to platform dialog.
[emufront] / src / main.cpp
1 #include <QApplication>
2 #include <QTextStream>
3 #include <iostream>
4 #include "mainwindow.h"
5 #include "db/databasemanager.h"
6 //#include "dialogs/platformnamedialog.h"
7
8 int main(int argc, char *argv[])
9 {
10         QApplication app(argc, argv);
11         QTextStream cout(stdout, QIODevice::WriteOnly);
12
13     if (DatabaseManager::openDB())
14         cout << " Database opened succesflly!" << endl;
15         else cout << " Database connection failed!" << endl;
16
17     if (DatabaseManager::dbExists())
18                 cout << " Database exists!" << endl;
19         else 
20         {
21                 cout << " Database is missing!" << endl;
22         if (DatabaseManager::createDB())
23                         cout << " Database created succesfully!" << endl;
24                 else {
25                         cout << "Failed creating database!" << endl;
26                         exit(1);
27                 }
28          }
29      /*
30
31         if (dbm.insertPerson("Testi","Tapaus",1) > 0)
32                 cout << "Database insert successfull!" << endl;
33         else cout << "Database insert failed!" << endl;
34
35
36         cout << "Trying to select from database: " << dbm.getName(1) << endl;
37         */
38
39         /*PlatformNameDialog *nameDialog = new PlatformNameDialog;
40         nameDialog->show();*/
41         MainWindow *mw = new MainWindow;
42         mw->show();
43         return app.exec();
44 }