forked from KangLin/RabbitIm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
85 lines (75 loc) · 2.54 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "MainWindow.h"
#include "Widgets/FrmVideo/FrmPlayer.h"
#include "Global/Global.h"
#include "Tool.h"
#include <QDebug>
#include <QApplication>
#include <QTranslator>
int main(int argc, char *argv[])
{
#ifdef ANDROID
Q_INIT_RESOURCE(Android);
#endif
#if defined(ANDROID) || defined(RABBITIM_STATIC)
Q_INIT_RESOURCE(Resource);
Q_INIT_RESOURCE(style);
Q_INIT_RESOURCE(Translations);
#endif
QApplication app(argc, argv);
app.setApplicationName("RabbitIm");
app.setOrganizationName("KangLin studio");
//QFontDatabase::addApplicationFont("://DejaVuSans.ttf");
//a.setFont(QFont(DejaVuSans));
LOG_MODEL_DEBUG("main", "font:%s;codec:%s",
app.font().family().toStdString().c_str(),
QTextCodec::codecForLocale()->name().data());
//设置插件路径(msvc 下没有用)
app.addLibraryPath(CGlobalDir::Instance()->GetDirApplication());
app.addLibraryPath(CGlobalDir::Instance()->GetDirApplication()
+ QDir::separator() + "plugins");
CManager manager;
CGlobal::Instance()->SetManager(&manager);
#ifdef RABBITIM_USE_FFMPEG
CTool::SetFFmpegLog();
#endif
//*
MainWindow w;
#ifndef MOBILE
//加载窗口位置
QSettings conf(CGlobalDir::Instance()->GetApplicationConfigureFile(),
QSettings::IniFormat);
QScreen *pScreen = QGuiApplication::primaryScreen();
int top = conf.value("UI/MainWindow/top",
pScreen->availableGeometry().height() > w.height()
? (pScreen->availableGeometry().height() - w.height()) >> 1
: 60
).toInt();
int left = conf.value("UI/MainWindow/left",
pScreen->availableGeometry().width() > w.width()
? (pScreen->availableGeometry().width() - w.width()) >> 1
: 60
).toInt();
int Width = conf.value("UI/MainWindow/width",
pScreen->availableGeometry().width() > w.width()
? w.geometry().width()
: pScreen->availableGeometry().width() - 120
).toInt();
int Height = conf.value("UI/MainWindow/height",
pScreen->availableGeometry().height() > w.height()
? w.geometry().height()
: pScreen->availableGeometry().height() - 120
).toInt();
w.resize(Width, Height);
w.move(left, top);
#endif
w.show();
//*/
/*以下为视频捕获、显示测试代码(CFrmPlayer::TestCamera())
#ifdef DEBUG
CFrmPlayer player;
player.TestCamera();
player.show();
#endif
//*/
return app.exec();
}