1
/****************************************************************************
2
 *  main.cpp
3
 *
4
 *  Copyright (c) 2009 by Nigmatullin Ruslan <euroelessar@gmail.com>
5
 *                2009 by Sidorov Aleksey <sauron@citadelspb.com>
6
 *
7
 ***************************************************************************
8
 *                                                                         *
9
 *   This program is free software; you can redistribute it and/or modify  *
10
 *   it under the terms of the GNU General Public License as published by  *
11
 *   the Free Software Foundation; either version 2 of the License, or     *
12
 *   (at your option) any later version.                                   *
13
 *                                                                         *
14
 ***************************************************************************
15
*****************************************************************************/
16
17
#include <QApplication>
18
#include <QTextCodec>
19
20
#include <cstdlib>
21
#include <ctime>
22
23
#include "src/modulemanagerimpl.h"
24
#include <QTime>
25
#include <fstream>
26
27
#if defined(STATIC_IMAGE_PLUGINS)
28
Q_IMPORT_PLUGIN(qjpeg)
29
Q_IMPORT_PLUGIN(qgif)
30
#endif
31
32
//using namespace std;
33
//ofstream logfile;
34
35
//#ifdef Q_OS_SYMBIAN
36
//void SymbianLoggingHandler(QtMsgType type, const char *msg) {
37
//switch (type) {
38
//	case QtDebugMsg:
39
//		logfile << QTime::currentTime().toString().toLatin1().data() << " Debug: " << msg << "\n";
40
//		break;
41
//	case QtCriticalMsg:
42
//		logfile << QTime::currentTime().toString().toLatin1().data() << " Critical: " << msg << "\n";
43
//		break;
44
//	case QtWarningMsg:
45
//		logfile << QTime::currentTime().toString().toLatin1().data() << " Warning: " << msg << "\n";
46
//		break;
47
//	case QtFatalMsg:
48
//		logfile << QTime::currentTime().toString().toLatin1().data() <<  " Fatal: " << msg << "\n";
49
//		abort();
50
//	}
51
//}
52
//#endif
53
54
int main(int argc, char *argv[])
55
{
56
	QApplication app(argc, argv);
57
	QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
58
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8"));
59
	
60
//#ifdef Q_OS_SYMBIAN
61
//	logfile.open("c:\\data\\logfile.txt", ios::app);
62
//	qInstallMsgHandler(SymbianLoggingHandler);
63
//#endif
64
65
	Core::ModuleManagerImpl core_init;
66
67
	// At first time use current time with pointers to initiators
68
	qsrand(uint(std::time(0)) ^ (qHash(&core_init) ^ (qHash(&app))));
69
	// At second random value
70
	qsrand(uint(qrand()));
71
	// It looks like Qt doesn't always use srand as backend of qsrand
72
	srand(uint(qrand()));
73
74
	return app.exec();
75
}