src/bmsapp.cpp

changeset 3
4b95e33ee476
parent 2
a1e435907f3a
child 6
f8474f2c5db9
equal deleted inserted replaced
2:a1e435907f3a 3:4b95e33ee476
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 #include "bmsapp.h" 17 #include "bmsapp.h"
18 #include "config.h" 18 #include "config.h"
19 19 #include "MainWindow.h"
20 20
21 21
22 bool Bmsapp::ensureDirectoriesExist() 22 bool Bmsapp::ensureDirectoriesExist()
23 { 23 {
24 QDir resourceDir = Bmsapp::getResourceDir(); 24 QDir resourceDir = Bmsapp::getResourceDir();
29 }; 29 };
30 qCritical() << Q_FUNC_INFO << errMsg; 30 qCritical() << Q_FUNC_INFO << errMsg;
31 } 31 }
32 32
33 return resourceDirSuccess; 33 return resourceDirSuccess;
34 // return resourceDirSuccess && createDir(PersistentSettings::getUserDir());
35 } 34 }
36 35
37 36
38 QDir Bmsapp::getResourceDir() 37 QDir Bmsapp::getResourceDir()
39 { 38 {
51 { 50 {
52 ensureDirectoriesExist(); 51 ensureDirectoriesExist();
53 readsettings(); 52 readsettings();
54 53
55 qDebug() << "Loading Database..."; 54 qDebug() << "Loading Database...";
55
56 db = new DataBase();
57 db->connectToDataBase();
58
56 return true; 59 return true;
57 } 60 }
58 61
59 62
60 63
61 void Bmsapp::cleanup() 64 void Bmsapp::cleanup()
62 { 65 {
63 qDebug() << "BMSapp is cleaning up."; 66 qDebug() << "BMSapp is cleaning up.";
67
64 writesettings(); 68 writesettings();
65 } 69 }
66 70
67 71
68 72
156 if (! initialize()) { 160 if (! initialize()) {
157 cleanup(); 161 cleanup();
158 return 1; 162 return 1;
159 } 163 }
160 164
165 MainWindow w;
166 w.show();
161 rc = qApp->exec(); 167 rc = qApp->exec();
162 168
163 cleanup(); 169 cleanup();
164 170
165 qDebug() << Q_FUNC_INFO << "Cleaned up. Returning " << rc; 171 qDebug() << Q_FUNC_INFO << "Cleaned up. Returning " << rc;

mercurial