-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
73 lines (48 loc) · 1.49 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <memory>
#include <stdexcept>
#include <neon/ne_socket.h>
#include <QApplication>
#include <QDesktopServices>
#include <QTextCodec>
#include "settings/settings.h"
#include "database/fs/fs.h"
#include "main_window.h"
#include "types.h"
struct application: public QApplication {
application(int& argc, char** argv)
: QApplication(argc, argv)
{}
virtual bool notify(QObject* obj, QEvent* event)
{
try {
return QApplication::notify(obj, event);
}
catch(std::exception& e) {
qDebug() << "Unhandled exception in notify: " << e.what();
qDebug() << "In object:" << obj->staticMetaObject.className() << obj->objectName() << "Event:" << event->type();
Q_ASSERT(false);
}
return false;
}
};
int main(int argc, char** argv)
{
try {
if (ne_sock_init() != 0)
throw std::runtime_error("Can't init libneon");
application app(argc, argv);
app.setOrganizationName("gkb");
app.setApplicationName("davqt");
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
QDir::addSearchPath("icons", QString(":icons/images/"));
QDir::addSearchPath("images", QString(":icons/images/"));
main_window_t m;
m.show();
return app.exec();
}
catch (std::exception& e) {
std::cerr << "exception:" << e.what() << std::endl;
}
return 0;
}