OSCAR-code/main.cpp

67 lines
1.6 KiB
C++
Raw Normal View History

2011-06-28 15:25:20 +00:00
/*
2011-06-26 08:30:44 +00:00
Main
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
2011-06-28 15:25:20 +00:00
*/
2011-06-26 08:30:44 +00:00
2011-06-26 11:49:40 +00:00
//#include <QtPlugin>
2011-06-26 08:30:44 +00:00
#include <QtGui/QApplication>
2011-06-26 12:25:52 +00:00
#include <QFontDatabase>
#include <QStringList>
2011-07-01 10:10:44 +00:00
#include <QDebug>
2011-06-26 08:30:44 +00:00
#include "mainwindow.h"
#include "SleepLib/profiles.h"
#include "SleepLib/loader_plugins/prs1_loader.h"
#include "SleepLib/loader_plugins/cms50_loader.h"
#include "SleepLib/loader_plugins/zeo_loader.h"
2011-06-28 02:21:38 +00:00
#include "SleepLib/loader_plugins/resmed_loader.h"
2011-06-26 08:30:44 +00:00
MainWindow *mainwin;
void MyOutputHandler(QtMsgType type, const char *msg) {
if (!mainwin) return;
switch (type) {
case QtDebugMsg:
mainwin->Log(msg);
break;
case QtWarningMsg:
mainwin->Log(QString("Warning: ")+msg);
break;
case QtFatalMsg:
mainwin->Log(QString("Fatal: ")+msg);
break;
case QtCriticalMsg:
mainwin->Log(QString("Critical: ")+msg);
break;
// Popup a messagebox
//abort();
}
}
2011-06-26 08:30:44 +00:00
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qInstallMsgHandler(MyOutputHandler);
2011-06-26 08:30:44 +00:00
2011-06-27 06:26:29 +00:00
a.setApplicationName("SleepyHead");
int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf");
QStringList ffam=QFontDatabase::applicationFontFamilies(id);
for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) {
2011-07-01 10:10:44 +00:00
qDebug() << "Loaded Font: " << (*i);
}
a.setFont(QFont("FreeSans",10));
2011-06-26 08:30:44 +00:00
PRS1Loader::Register();
CMS50Loader::Register();
ZEOLoader::Register();
2011-06-28 02:21:38 +00:00
ResmedLoader::Register();
2011-07-18 02:33:25 +00:00
MainWindow w;
mainwin=&w;
2011-06-26 08:30:44 +00:00
w.show();
return a.exec();
}