|
|
#pragma once
|
|
|
|
|
|
#include "iDlgBase.h"
|
|
|
#include "iCardInfo.h"
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
class ZxDataProject;
|
|
|
class iRibbonXmlGroup;
|
|
|
|
|
|
// 新版首页面
|
|
|
class M_GUI_SYSMANAGER_EXPORT iWxWelcomeNew : public QMainWindow
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
explicit iWxWelcomeNew(MainWindowOption o = MWO_WTAI,\
|
|
|
QWidget* parent = nullptr);
|
|
|
~iWxWelcomeNew();
|
|
|
|
|
|
public:
|
|
|
|
|
|
void setXmlFileGroup(iRibbonXmlGroup* p) {}
|
|
|
void changeLeft2Mode(bool bReorgUi = true) {}
|
|
|
|
|
|
void initUI();
|
|
|
|
|
|
private:
|
|
|
|
|
|
void applyStyleSheet();
|
|
|
|
|
|
QWidget* initUI_Up();
|
|
|
QBoxLayout* initUI_Up_Line();
|
|
|
void initUI_Up_Line_Sort(QToolButton* pBtnSort);
|
|
|
QWidget* initUI_Up_CardsArea();
|
|
|
QWidget* initUI_Down();
|
|
|
QWidget* initUI_Down_RecentProjs();
|
|
|
QWidget* initUI_Down_RecentDirs();
|
|
|
QWidget* initUI_Down_Updates();
|
|
|
QWidget* initUI_Bottom();
|
|
|
|
|
|
void _freshWsCount();
|
|
|
|
|
|
void onOpenDir();
|
|
|
void onOpenFile();
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void slotSbActionClicked(QString sName);
|
|
|
void slotBrowseDir();
|
|
|
void slotDirTextChanged(const QString &text);
|
|
|
void slotSearchTextChanged(const QString &text);
|
|
|
// void slotSortCbxCurIndexChanged(int index);
|
|
|
void slotSortOptionmChanged();
|
|
|
|
|
|
void slotListWxRecentProjDblClicked(QListWidgetItem* item);
|
|
|
void slotListWxRecentDirDblClicked(QListWidgetItem* item);
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void slotBtnHome();
|
|
|
|
|
|
// 按钮统一响应
|
|
|
void slotSubBtnTriggered();
|
|
|
|
|
|
void slotCardWxNew();
|
|
|
|
|
|
#ifdef _SCAN_OLD_CODES_
|
|
|
void slotCardWxOpen();
|
|
|
void slotCardWxSaveAs();
|
|
|
void slotCardWxClose();
|
|
|
void slotCardWxDelete();
|
|
|
#endif
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void slotHideBtnsTimeout();
|
|
|
void slotDelayedFreshLayout();
|
|
|
|
|
|
private:
|
|
|
|
|
|
QString getLastPrjWorkDir();
|
|
|
QStringList getProjBaseNames(QString sDir);
|
|
|
|
|
|
bool _runProjNew(QWidget* pWxCard);
|
|
|
bool _runProjOpen(QWidget* pWxCard);
|
|
|
bool _runProjSaveAs(QWidget* pWxCard);
|
|
|
bool _runProjClose(QWidget* pWxCard);
|
|
|
bool _runProjDel(QWidget* pWxCard);
|
|
|
|
|
|
/// @brief 根据路径查找当前的Card
|
|
|
/// @param sDir 比如 E:\Run\mWTAI\Bin\TestOfWTAI
|
|
|
/// @param sProjName 比如 TestDemo3
|
|
|
/// @note E:\Run\mWTAI\Bin\TestOfWTAI\TestDemo3\TestDemo3.db
|
|
|
QWidget* findWxCard(QString sDir, QString sProjName);
|
|
|
|
|
|
/// @brief 组织Url
|
|
|
/// @param sDir 比如 E:\Run\mWTAI\Bin\TestOfWTAI
|
|
|
/// @param sProjName 比如 TestDemo3
|
|
|
/// @note E:\Run\mWTAI\Bin\TestOfWTAI\TestDemo3\TestDemo3.db
|
|
|
QString sumFullUrl(QString sDir, QString sProjName);
|
|
|
|
|
|
/// @brief 解析Url
|
|
|
/// @param sUrl 比如 E:\Run\mWTAI\Bin\TestOfWTAI\TestDemo3\TestDemo3.db
|
|
|
/// @param sDir 比如 E:\Run\mWTAI\Bin\TestOfWTAI
|
|
|
/// @param sProjName 比如 TestDemo3
|
|
|
bool parseUrl(QString sUrl, QString& sDir, QString& sProjName);
|
|
|
|
|
|
void refreshCurrentProjs();
|
|
|
|
|
|
bool removeFromRecentDirs(QString sDir);
|
|
|
|
|
|
void refreshRecentProjs();
|
|
|
void addToRecentProjs(QString sUrl);
|
|
|
bool removeFromRecentProjects(QString sUrl);
|
|
|
void refreshRecentDirs();
|
|
|
void addToRecentDirs(const QString &path);
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
// Card 创建过程
|
|
|
|
|
|
// 根据缓存列表,重新创建Card
|
|
|
void rebuildAllCards();
|
|
|
|
|
|
// 只是刷新布局,比如Size改变时
|
|
|
void freshCardLayout();
|
|
|
|
|
|
// 创建Card,入口
|
|
|
QWidget* createProjCard(const iCardInfo &wscd);
|
|
|
|
|
|
// 初始化配置(常规、新建)
|
|
|
void _configWxCardNormal(QWidget* pWxCard, const iCardInfo &wscd);
|
|
|
void _configWxCardNew(QWidget* pWxCard, const iCardInfo &wscd);
|
|
|
|
|
|
// 创建Card 常规的各个部分
|
|
|
void _initLayout_CardNormal(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
void _initLayout_CardNormal_Title(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
void _initLayout_CardNormal_Desc(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
void _initLayout_CardNormal_WellAbouts(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
void _initLayout_CardNormal_Others(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
|
|
|
// 创建Card 新建
|
|
|
void _initLayout_CardNew(QWidget* pWxCard, \
|
|
|
const iCardInfo& wscd, \
|
|
|
QVBoxLayout*& pLayout);
|
|
|
|
|
|
/// @brief 清空,从布局器中清空 //
|
|
|
/// @param pWxCard 如果非空,则清空指定的Card,否则清空全部
|
|
|
void clearCardWxs(QWidget* pWxCard = nullptr);
|
|
|
|
|
|
// 工区打开与否的标识(类似激活Active)
|
|
|
void setWxCardActive(QWidget* pWxCard, bool bActive);
|
|
|
|
|
|
// 刷新当前工区对应的Card的井/成果相关内容
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
public:
|
|
|
// 当新建/删除井或者成果时,刷新
|
|
|
// 针对当前打开的工区
|
|
|
void freshWellRstAbouts(bool bWell, \
|
|
|
QStringList& listTags, \
|
|
|
TreeNodeCmd o);
|
|
|
|
|
|
private:
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
bool eventFilter(QObject* obj, QEvent* event);
|
|
|
|
|
|
signals:
|
|
|
|
|
|
// 判断是否enable
|
|
|
//void sigBtnEnabled(QString sName, int nID, bool& bEnabled);
|
|
|
|
|
|
// 选定后即将打开(因为接口的特殊性,sDir需要带有ProjName)
|
|
|
void sigProjSelected(QString sDir, QString sProj, bool& bOk);
|
|
|
|
|
|
// 获取当前打开的Project的全路径
|
|
|
//void sigGetCurProjFullpath(QString& s);
|
|
|
|
|
|
// 删除工区后的最近打开项目的刷新
|
|
|
void sigProjDeleted(QString sPath);
|
|
|
|
|
|
// 获取当前的Project
|
|
|
void sigGetCurProject(ZxDataProject*&);
|
|
|
|
|
|
// 切换视窗
|
|
|
void sigChange2Main();
|
|
|
|
|
|
// 命令传递
|
|
|
void sigAction2Main(QString sAction, bool& bExecuted);
|
|
|
|
|
|
private:
|
|
|
|
|
|
// 当前模块,默认为WTAI
|
|
|
MainWindowOption m_oMwo;
|
|
|
|
|
|
// 主布局
|
|
|
QVBoxLayout* m_pMainLayout;
|
|
|
|
|
|
// 上部区域
|
|
|
QLineEdit* m_pTbxDir;
|
|
|
QLineEdit* m_pTbxSearch;
|
|
|
int m_nSortIndex; //排序索引(潜在风险,目前暂定四种)
|
|
|
//listOptions << "TimeInc" << "TimeDesc" << "NameInc" << "NameDesc";
|
|
|
QAction* m_pLastSortAction; //上一个Checked的Action
|
|
|
QLabel* m_pLblCount;
|
|
|
|
|
|
QScrollArea* m_pAreaScroll;
|
|
|
QWidget* m_pGridContainer;
|
|
|
QGridLayout* m_pGridLayout;
|
|
|
|
|
|
// 下部左侧
|
|
|
QListWidget* m_pListWxRecentProjs;
|
|
|
int m_maxRecentProjs;
|
|
|
|
|
|
// 下部右侧
|
|
|
QListWidget* m_pListWxRecentDirs;
|
|
|
int m_maxRecentDirs;
|
|
|
|
|
|
// 定时器
|
|
|
QTimer* m_pTimerRelayout;
|
|
|
QTimer* m_pTimerHideBtns;
|
|
|
|
|
|
// 数据/子窗体
|
|
|
QList<iCardInfo> m_listCardInfos;
|
|
|
QVector<QWidget*> m_vecCardWxs; // 存储所有Card指针
|
|
|
QWidget* m_pLastWxCard;//上次选中的Card
|
|
|
|
|
|
// 按钮部分,记录每个Card的按钮
|
|
|
struct stCardWxButtons {
|
|
|
QToolButton* pBtnOpen;
|
|
|
QToolButton* pBtnSaveAs;
|
|
|
QToolButton* pBtnDelete;
|
|
|
QWidget* container;
|
|
|
};
|
|
|
QMap<QWidget*, stCardWxButtons> m_mapCardBtns;
|
|
|
|
|
|
// 筛选/查找
|
|
|
QString m_sLastSearchTag;
|
|
|
|
|
|
//
|
|
|
|
|
|
// 状态标识/是否允许信号槽
|
|
|
bool m_bUnableSP;
|
|
|
|
|
|
// 默认宽度
|
|
|
/*static*/ int m_nCardWidth;
|
|
|
};
|