2025-08-20 23:06:28 +08:00
|
|
|
#ifndef LAUNCHPAGE_H
|
|
|
|
|
#define LAUNCHPAGE_H
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
|
#include <QAction>
|
|
|
|
|
#include <QMenu>
|
2025-09-30 17:42:22 +08:00
|
|
|
#include <QHBoxLayout>
|
2025-10-14 20:05:38 +08:00
|
|
|
#include <QThread>
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include <QTextToSpeech>
|
2025-08-20 23:06:28 +08:00
|
|
|
#include <GlobalDefinitions/Variable.h>
|
2025-09-28 17:14:34 +08:00
|
|
|
#include <FileOperation/ConfigFiles.h>
|
2025-10-14 20:05:38 +08:00
|
|
|
#include <QStackedLayout>
|
2025-09-28 17:14:34 +08:00
|
|
|
|
|
|
|
|
#include <Pages/P00_PublicPage.h>
|
|
|
|
|
#include <Pages/P01_MianPage.h>
|
|
|
|
|
#include <Pages/P02_ShieldPage.h>
|
2025-10-14 20:05:38 +08:00
|
|
|
#include <Pages/P301_PumpPage.h>
|
|
|
|
|
#include <Pages/P401_CuttingPage.h>
|
|
|
|
|
#include <Pages/P501_LoaderPage.h>
|
|
|
|
|
#include <Pages/P601_TransportPage.h>
|
2025-09-28 17:14:34 +08:00
|
|
|
#include <Pages/P07_CylinderPage.h>
|
|
|
|
|
#include <Pages/P08_AlarmPage.h>
|
2025-10-14 20:05:38 +08:00
|
|
|
#include <Pages/P901_RemotePage.h>
|
|
|
|
|
#include <Pages/P902_RemotePage.h>
|
2025-09-28 17:14:34 +08:00
|
|
|
#include <Pages/P10_IntelligentPage.h>
|
|
|
|
|
#include <Pages/P11_IsolationPage.h>
|
|
|
|
|
#include <Pages/P12_NetworkPage.h>
|
|
|
|
|
#include <Pages/P13_InsPage.h>
|
|
|
|
|
#include <Pages/P14_AtlasPage.h>
|
|
|
|
|
#include <Pages/P15_ParameterPage.h>
|
|
|
|
|
#include <Pages/P16_SettingPage.h>
|
2025-10-14 20:05:38 +08:00
|
|
|
|
|
|
|
|
// 窗口工作线程类,负责数据初始化
|
|
|
|
|
class WindowWorker : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit WindowWorker(int pageIndex, QObject *parent = nullptr)
|
|
|
|
|
: QObject(parent), m_pageIndex(pageIndex), m_initialized(false) {}
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void logMessage(const QString &message);
|
|
|
|
|
void createWindowRequest(int pageIndex);
|
|
|
|
|
void initializationComplete(int pageIndex, const QVariant &data);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void initialize();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int m_pageIndex;
|
|
|
|
|
bool m_initialized;
|
|
|
|
|
};
|
2025-08-20 23:06:28 +08:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
namespace Ui { class LaunchPage; }
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
class LaunchPage : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
LaunchPage(QWidget *parent = nullptr);
|
|
|
|
|
~LaunchPage();
|
|
|
|
|
void TrayIconInit();
|
|
|
|
|
void WinInit();
|
2025-10-10 17:44:10 +08:00
|
|
|
void AddLogInfo(QString Str);
|
2025-09-30 17:42:22 +08:00
|
|
|
void loadNextWindow(QWidget *container,QHBoxLayout *hLayout);
|
2025-10-14 20:05:38 +08:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void createPages();
|
|
|
|
|
void createWindowInMainThread(int pageIndex);
|
|
|
|
|
void storeWindowData(int pageIndex, const QVariant &data);
|
|
|
|
|
// void initializeWindowWithData(QWidget *window, int pageIndex, const QVariant &data);
|
|
|
|
|
// void onThreadFinished();
|
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
signals:
|
2025-10-14 20:05:38 +08:00
|
|
|
void enterMainRequested();
|
|
|
|
|
void startWindowCreation();
|
|
|
|
|
void windowCreationCompleted();
|
2025-08-20 23:06:28 +08:00
|
|
|
private:
|
|
|
|
|
Ui::LaunchPage *ui;
|
|
|
|
|
QSystemTrayIcon *trayIcon;
|
|
|
|
|
QMenu *trayIconMenu;
|
|
|
|
|
QAction *minimizeAction;
|
|
|
|
|
QAction *restoreAction;
|
|
|
|
|
QAction *quitAction;
|
2025-10-10 17:44:10 +08:00
|
|
|
|
2025-10-14 20:05:38 +08:00
|
|
|
QTextToSpeech *tts;
|
|
|
|
|
TTSManager *ttsManager;
|
2025-10-10 17:44:10 +08:00
|
|
|
|
2025-10-14 20:05:38 +08:00
|
|
|
// 窗口相关成员
|
|
|
|
|
P00_PublicPage *pubWin = nullptr;
|
|
|
|
|
QScrollArea *scrollArea = nullptr;
|
|
|
|
|
QWidget *container = nullptr;
|
|
|
|
|
QHBoxLayout *hLayout = nullptr;
|
|
|
|
|
QList<QThread*> workerThreads;
|
|
|
|
|
QMap<int, QVariant> windowData;
|
|
|
|
|
bool isNewScrollArea;
|
|
|
|
|
uint8_t currentLoadingIndex = 0;
|
|
|
|
|
int windowsCreated = 0;
|
|
|
|
|
void adjustScrollAreaSize(); // 新增方法声明
|
|
|
|
|
void enableScrollNavigation();
|
|
|
|
|
void startNextWindowLoading();
|
2025-08-20 23:06:28 +08:00
|
|
|
};
|
|
|
|
|
#endif // LAUNCHPAGE_H
|