forked from KangLin/RabbitIm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·87 lines (78 loc) · 3.11 KB
/
main.cpp
File metadata and controls
executable file
·87 lines (78 loc) · 3.11 KB
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
86
87
#include "MainWindow.h"
#include <QApplication>
#include <QTranslator>
#include "Widgets/FrmVideo/FrmPlayer.h"
#include "Tool.h"
#include <QDebug>
#include "Global.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//设置插件路径(msvc 下没有用)
a.addLibraryPath(a.applicationDirPath() + QDir::separator() + "plugins");
a.addLibraryPath(a.applicationDirPath());
a.addLibraryPath(CGlobal::Instance()->GetDirApplication());
a.addLibraryPath(CGlobal::Instance()->GetDirApplication() + QDir::separator() + "plugins");
CTool::SetFFmpegLog();
/*
QString szLocale = QLocale::system().name();
LOG_MODEL_DEBUG("main", "locale language:%s", szLocale.toStdString().c_str());
//本地化QT资源
QTranslator qtTranslator;
#ifdef DEBUG
qtTranslator.load("qt_" + szLocale,
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
LOG_MODEL_DEBUG("main",
QLibraryInfo::location(QLibraryInfo::TranslationsPath).toStdString().c_str());
#else
qtTranslator.load("qt_" + szLocale,
QCoreApplication::applicationDirPath());
#endif
qApp->installTranslator(&qtTranslator);
//本地化程序资源
QTranslator myappTranslator;
//把翻译文件放在了应用程序目录下,这样可以结约内存,适用于很多语言版本
//myappTranslator.load("app_" + locale, a.applicationDirPath());
//把翻译文件放在了程序资源中
myappTranslator.load(":/translations/" + szLocale);
qApp->installTranslator(&myappTranslator);//*/
//*从配置文件中加载应用程序样式
QSettings conf(CGlobal::Instance()->GetApplicationConfigureFile(), QSettings::IniFormat);
QString szFile(conf.value("UI/StyleSheet", ":/sink/Blue").toString());
QFile file(szFile);//从资源文件中加载
if(file.open(QFile::ReadOnly))
{
QString stylesheet= file.readAll();
qApp->setStyleSheet(stylesheet);
file.close();
}
else
{
LOG_MODEL_ERROR("app", "file open file [%s] fail:%d",
szFile.toStdString().c_str(), file.error());
}//*/
//*
QDesktopWidget *pDesk = QApplication::desktop();
MainWindow w;
#ifdef MOBILE
QScreen* pScreen = QApplication::primaryScreen();
LOG_MODEL_DEBUG("main", "DeskWidth:%d;height:%d;w:%d;h:%d;screenWidth:%d;height:%d;w%d;h%d",
pDesk->geometry().width(),
pDesk->geometry().height(),
pDesk->availableGeometry().width(),
pDesk->availableGeometry().height(),
pScreen->geometry().width(),
pScreen->geometry().height(),
pScreen->availableGeometry().width(),
pScreen->availableGeometry().height()
);
w.setGeometry(pDesk->geometry());
#else
w.move((pDesk->width() - w.width()) / 2, (pDesk->height() - w.height()) / 2);
#endif
w.show();//*/
/*以下为视频捕获、显示测试代码(CFrmPlayer::TestCamera())
CFrmPlayer player;
player.show();//*/
return a.exec();
}