culturered_client/PhotoPrintPlayer/main.cpp

84 lines
2.2 KiB
C++
Raw Normal View History

2024-09-07 03:34:44 +00:00
// FlightController.cpp: 定义应用程序的入口点。
//
#include <QApplication>
#include <QProcess>
#include <QFile>
#include "SpdLog.h"
#include "VlcMediaPlayer.h"
#include "MainWindow.h"
using namespace std;
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
InitSpdlog("PhotoPrintPlayer_log", "logs/PhotoPrintPlayer_log.txt", 5);
VlcMediaPlayer::Init();
//QString batFile = app.applicationDirPath() + "/PhototPrintPlayer";
//QProcess process;
//process.setWorkingDirectory(batFile);
//process.start(batFile + "/runbat.vbs");
// 等待批处理文件执行完成
// process.waitForFinished();
// 获取批处理文件的输出信息
//QByteArray output = process.readAllStandardOutput();
// 打印输出信息
//qDebug() << "Output: " << output;
QTimer::singleShot(5000, []() {
MainWindow* mainWindow = new MainWindow;
mainWindow->showFullScreen();
});
//MainWindow mainWindow;
//QList<QScreen*> screens = QGuiApplication::screens();
//// 检查屏幕索引是否有效
//int screenIndex = 1; // 替换为实际的屏幕索引
//if (screenIndex >= 0 && screenIndex < screens.size()) {
// // 获取指定索引的屏幕
// QScreen* targetScreen = screens[screenIndex];
// // 获取屏幕的几何属性
// QRect screenGeometry = targetScreen->geometry();
// // 移除边框和标题栏
// mainWindow.setWindowFlags(Qt::FramelessWindowHint);
// // 设置窗口的几何属性
// mainWindow.setGeometry(screenGeometry);
// // 将窗口移动到指定屏幕
// mainWindow.move(screenGeometry.topLeft());
// // 设置窗口大小与屏幕相同
// mainWindow.resize(screenGeometry.size());
// // 显示窗口
// mainWindow.show();
// // 将窗口移动到指定屏幕
// mainWindow.move(screenGeometry.topLeft());
//}
/*mainWindow.setGeometry(0, 0, 1920, 1080);*/
//mainWindow.showFullScreen();
// mainWindow.show();
int ret = app.exec();
VlcMediaPlayer::Uninit();
QString batFile = app.applicationDirPath() + "/PhotoPrintPlayer";
QProcess process1;
process1.setWorkingDirectory(batFile);
process1.start(batFile + "/kill.bat");
process1.waitForFinished();
UninitSpdlog();
return ret;
}