MNE-CPP  beta 1.0
main.cpp
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
41 #include "mainsplashscreen.h"
42 #include "mainwindow.h"
43 
44 
45 #include <xMeas/measurementtypes.h>
47 #include <xMeas/newnumeric.h>
48 
50 #include <mne_x/Management/pluginoutputdata.h>
53 
54 
55 #include <Eigen/Core>
56 
57 
58 //*************************************************************************************************************
59 //=============================================================================================================
60 // QT INCLUDES
61 //=============================================================================================================
62 
63 #include <QtGui>
64 #include <QApplication>
65 #include <QSharedPointer>
66 
67 
68 //*************************************************************************************************************
69 //=============================================================================================================
70 // USED NAMESPACES
71 //=============================================================================================================
72 
73 using namespace XMEASLIB;
74 using namespace MNEX;
75 using namespace Eigen;
76 
77 
78 //*************************************************************************************************************
79 //=============================================================================================================
80 // global var
81 //=============================================================================================================
82 
83 
84 QSharedPointer<MainWindow> mainWin;
85 
86 //=============================================================================================================
94 void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
95 {
96  Q_UNUSED(context);
97 
98  QString dt = QDateTime::currentDateTime().toString("dd/MM/yyyy hh:mm:ss");
99  QString txt = QString("[%1] ").arg(dt);
100 
101  if(mainWin)
102  {
103  switch (type)
104  {
105  case QtDebugMsg:
106  txt += QString("{Debug} \t\t %1").arg(msg);
107  mainWin->writeToLog(txt,_LogKndMessage, _LogLvMax);
108  break;
109  case QtWarningMsg:
110  txt += QString("{Warning} \t %1").arg(msg);
111  mainWin->writeToLog(txt,_LogKndWarning, _LogLvNormal);
112  break;
113  case QtCriticalMsg:
114  txt += QString("{Critical} \t %1").arg(msg);
115  mainWin->writeToLog(txt,_LogKndError, _LogLvMin);
116  break;
117  case QtFatalMsg:
118  txt += QString("{Fatal} \t\t %1").arg(msg);
119  mainWin->writeToLog(txt,_LogKndError, _LogLvMin);
120  abort();
121  break;
122  }
123  }
124 
125 // QFile outFile("LogFile.log");
126 // outFile.open(QIODevice::WriteOnly | QIODevice::Append);
127 
128 // QTextStream textStream(&outFile);
129 // textStream << txt << endl;
130 
131 }
132 
133 
134 
135 //void debugTest(QSharedPointer<NewRealTimeMultiSampleArray> testData)
136 //{
137 // qDebug() << "Here in debug Test Callback new";
138 
139 // QVector< VectorXd > matSamples = testData->getMultiSampleArray();
140 // qDebug() << "Received data:";
141 // for(qint32 i = 0; i < matSamples.size(); ++i)
142 // qDebug() << matSamples[i][0];
143 
144 
145 //}
146 
147 //*************************************************************************************************************
148 //=============================================================================================================
149 // MAIN
150 //=============================================================================================================
151 
152 //=============================================================================================================
161 int main(int argc, char *argv[])
162 {
163  QApplication app(argc, argv);
164 
165  //Store application info to use QSettings
166  QCoreApplication::setOrganizationName("MNE-CPP");
167  QCoreApplication::setOrganizationDomain("www.tu-ilmenau.de/mne-cpp");
168  QCoreApplication::setApplicationName(CInfo::AppNameShort());
169 
171 
172  QPixmap pixmap(":/images/splashscreen.png");
173  MainSplashScreen::SPtr splashscreen(new MainSplashScreen(pixmap));
174  splashscreen->show();
175 
176  //ToDo Debug Some waiting stuff to see splash screen -> remove this in final release
177  int time = 100;
178  for(int i=0; i < time;++i)
179  {
180  int p = (i*100)/time;
181  splashscreen->showMessage("Loading modules.."+ QString::number(p)+"%");
182  }
183 
184  mainWin = QSharedPointer<MainWindow>(new MainWindow);
185  mainWin->show();
186 
187  splashscreen->finish(mainWin.data());
188 
189  //ToDo Check the message handler and FiffSimulator
190 
191 // qInstallMessageHandler(customMessageHandler);
192 
193 
194 // //DEBUG
195 // NewRealTimeMultiSampleArray RTSATest;
196 // NewNumeric NumericTest;
197 
198 // IPlugin* pluginInterface = NULL;
199 
200 // QSharedPointer< PluginOutputData<NewRealTimeMultiSampleArray> > pluginOutputData(new PluginOutputData<NewRealTimeMultiSampleArray>(pluginInterface, QString("TestPlugin"), QString("No Descr")));
201 // QSharedPointer< PluginInputData<NewRealTimeMultiSampleArray> > pluginInputData(new PluginInputData<NewRealTimeMultiSampleArray>(pluginInterface, QString("TestPlugin2"), QString("No Descr2")));
202 // pluginInputData->setCallbackMethod(&debugTest);
203 
204 // PluginConnectorConnection outInConnection(pluginOutputData, pluginInputData);
205 
206 // pluginOutputData->data()->init(2);
207 // pluginOutputData->data()->setMultiArraySize(2);
208 
209 // VectorXd v = VectorXd::Zero(2);
210 // v[0] = 2.3;
211 // pluginOutputData->data()->setValue(v);
212 // v[0] = 4.1;
213 // pluginOutputData->data()->setValue(v);
214 // //DEBUG
215 
216  return app.exec();
217 }
Contains declaration of IPlugin interface class.
QSharedPointer< MainSplashScreen > SPtr
Contains the declaration of the PluginConnectorConnection class.
The MainSplashScreen class provides the main application splash screen.
Contains the declaration of the PluginInputData class.
Contains the declaration of the Numeric class.
Definition: arrow.h:75
Contains the declaration of the NewRealTimeMultiSampleArray class.
Contains the declaration of the MainSplashScreen class.
The MainWindow class provides the main application user interface.
Definition: mainwindow.h:119
Contains the declaration of the MeasurementTypes class.