🦄 refactor(UI模块): 对界面进行重构

调整整体切换以及接口调用逻辑
This commit is contained in:
huheng@kylinos.cn 2022-11-29 20:43:38 +08:00
parent 2e376e10c6
commit bfd36b482c
2 changed files with 831 additions and 916 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@
#include <QScreen>
#include <QMetaType>
#include <QMessageBox>
#include <QMutex>
#include <kballontip.h>
#include "connectionservice.h"
@ -24,25 +25,27 @@
#include "usbmanage.h"
#include "devicemanage.h"
#include "pcscreenmanage.h"
#include "classificationlist/mobilefilesecondwidget.h"
#include "classificationlist/mobilefilewidget.h"
#include "connectinterface/connectinterface.h"
#include "connectinterface/searchdevicewin.h"
#include "connectinterface/devicecodewidget.h"
#include "storagelist/mobilestoragewidget.h"
#include "view/titlebar.h"
#include "view/homepage.h"
#include "view/mobilefilelist.h"
#include "view/transmissiondialog.h"
#include "searchserver.h"
#include "connectinterface.h"
#include "searchdevicewin.h"
#include "devicecodewidget.h"
#include "titlebar.h"
#include "homepage.h"
#include "transmissiondialog.h"
#include "loadanimation.h"
#include "view/loaddialog.h"
#include "view/connectedwin.h"
#include "loaddialog.h"
#include "connectedwin.h"
#include "suspendtabbar.h"
#include "discovery.h"
#include "fineftp/server.h"
#include "kaboutdialog.h"
#include "dirmanager.h"
#include "publicattributes.hpp"
#include "filemanagewin.h"
#include "multimediawin.h"
#include "androidhomepage.h"
#include "fileview.h"
#include "timelinelistwidget.h"
#define KYLIN_CONNECTIVITY_SEND_SERVICE "com.kylin.connectivity.send"
#define KYLIN_CONNECTIVITY_SEND_PATH "/com/kylin/connectivity"
@ -84,14 +87,6 @@ private:
WinConnected, // 已连接页面
};
enum WinFlage {
DisconnectWin = 0, // 未连接
SyncMainWin, // 文件同步首页
SyncQQWechatWin, // qq微信文件同步页面
MultFileListWin, // 分类文件列表
FileListWin, // 存储文件列表
};
enum TYPE {
None = 0,
Mobile, // 手机连接
@ -110,101 +105,33 @@ private:
bool mountFtp(QString url, QString userName, QString pwd, QString path);
bool umountFtp(QString path);
void clearConnectionInfo();
void changeLightTheme();
void changeDarkTheme();
void startTimer();
void startLoadUI();
void initUI();
void connectUI();
void updateResult();
void initMultiMediaWin(QMap<int, int> &map);
void initTransmissionDialog();
void deleteMobileListWidget();
void initMobileListWidget(int tag);
void clearView();
void setToolTipWin(QString msg, kdk::TipType type);
void uploadLocalListPath(QString itemName, const QStringList &localPath);
void initMobileConnection();
void initMobileFileSync();
bool setScreenOption();
int getScreenIndex();
void deleterUI();
void deleterDialog();
void deleteTransmissionDialog();
void deleteStackedWidget();
int getScreenIndex();
void connectMobileFileWidget();
void deleterUI();
void startLoadUI();
void startTimer();
void stopLoadUI();
void updateCurrentPath(int text);
void initPcSearchInfo();
void discInit();
void deInitDisc();
void connectMobileFileList();
void connectMobileStorage();
void addBackList(QStringList &list);
void checkAndroidHomePage();
void checkFileView(QStringList &pathList);
void crumbTagToAndroidItemType(QString tag);
void checkPage(QStringList crumbPathList);
private:
ConnectionService *m_connectionService = nullptr; // 连接服务
KMobileDiscovery::Discovery *m_discovery = nullptr; // 搜索手机设备信息
FtpManager *m_ftpClient = nullptr; // ftp服务器
DeviceManage *m_deviceManage = nullptr; // 连接手机投屏
UsbManage *m_usbManage = nullptr; // 监听USB插拔信号
WifiManager *m_wifiManager = nullptr; // 监听wifi信号
QThread *m_wifiManagerThread = nullptr; // 另起线程监听wifi信号
FileSyncManage *m_fileSyncManage = nullptr; // 文件同步
FtpServer *m_ftpServer = nullptr;
PcScreenManage *m_pcScreen = nullptr; // PC投屏
QDBusInterface *m_dbusInterface = nullptr; // 挂载ftpdubs
DirManager *m_dirManager = nullptr; // 本地用户目录信息管理
QDBusInterface *m_modeDbusInterface = nullptr; // 平板模式切换
QDBusInterface *m_activityDbusInterface = nullptr; // 防止熄屏
bool m_isConnect = false; // 当前是否连接
QString m_currentPath = ""; // 手机存储当前路径
int m_downFileType = FileSyncManage::LIST_TYPE::TYPE_FILE_NUM; // 当前下载类型
QUrl m_url; // 服务器地址
ConnectionService::ConnectionInfo m_connectInfo; // 当前连接设备信息
bool m_isDbusOperation = false; // 当前操作是否为dbus调用
bool m_isMountFtp = false; // 是否挂载ftp
QString m_wifiIp = ""; // 本机IP
bool m_isServerConnect = false; // 服务是否连接
QString m_uploadPath = ""; // 当前为上传
bool m_isPcSearchInfo = false; // 是否为PC数据库文件
QString m_reconnectAddress = ""; // 重连ip
quint32 m_inhibitValue = 0; // 熄屏参数
Titlebar *m_titlebar = nullptr; // 标题栏
HomePage *m_homepage = nullptr; // 首页
ConnectInterface *m_connectInterfaceWin = nullptr; // 连接界面
ConnectedWin *m_connectedWin = nullptr; // 已连接界面
SearchDeviceWin *m_searchDeviceWin = nullptr; // 搜索设备界面
QStackedWidget *m_mainStackedWin = nullptr; // 主界面切换堆栈窗口
MobileFileList *m_mobileFileList = nullptr; // 文件分类界面
QStackedWidget *m_stackedMobileFileListWin = nullptr; // 分类界面与文件信息界面的堆栈窗口
kdk::KAboutDialog *m_aboutWindow = nullptr; //关于窗口
MobileFileWidget *m_listItemWidget = nullptr; // 文件信息展示界面
MobileStorageWidget *m_mobileStorageWidget = nullptr; // 手机存储界面
TransmissionDialog *m_transmissionDialog = nullptr; // 传输进度窗口
MobileFileSecondWidget *m_mobileFileSecondWidget = nullptr; // QQ微信分类界面
QMessageBox *m_messageBox = nullptr; // 请求提示框
LoadDialog *m_loadDialog = nullptr; //加载动画
LoadAnimation *m_loadAnimation = nullptr; // 打开/更新加载界面
SuspendTabBar *m_suspendTabBar = nullptr; // 投屏控制
QTimer *m_timer = nullptr; // 连接加载定时器,连接超时处理
int m_fileSyncIndex = 2; // 手机文件同步堆栈窗口索引
QListView::ViewMode m_classificationMode = QListView::IconMode; // 分类列表当前视图模式
QListView::ViewMode m_storageMode = QListView::IconMode; // 手机存储当前视图模式
QString m_tipMesseage = ""; // 提示消息
WinFlage m_winFlage = WinFlage::DisconnectWin; // 当前所在界面
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light; // 主题
QPoint m_Clickpos;
bool m_bLeftClick = false;
bool m_isTable = false; //当前模式
// disc
QProcess *m_discServer = nullptr;
QProcess *m_discClient = nullptr;
bool m_isUpdated;
QString m_searchInfoPath;
QString m_searchKeyword;
QStringList m_saveListPath;
Q_SIGNALS:
// 提供dbus服务
void sigConnected(QString);
@ -212,7 +139,6 @@ Q_SIGNALS:
void sigFileInfoList(const QMap<QString, FileInfo> &);
void sigClearSearchLine();
void sigSearchUpdate();
public Q_SLOTS:
// 外部
void setLocalPathList(const QStringList &list);
@ -230,7 +156,7 @@ public Q_SLOTS:
void slotNoUsbDevice();
void slotConnectFailed();
void slotFtpConnected();
void slotCurrentDirectoryList(const QMap<QString, FileInfo> &filelist);
void slotCurrentDirectoryList(const QMap<QString, FileInfo> &map);
void slotTransferProgress(qint64 readBytes, qint64 totalBytes);
void slotDownFileFinish(QString flag, QString filepath);
void slotDownAllFileFinish(QString flag);
@ -241,25 +167,25 @@ public Q_SLOTS:
void slotAllDeviceInfo(const QMap<QString, KMobileCommon::DiscoveryDeviceInfo> &map);
void slotRequestReceived(PcScreenManage::ScreenMsg msg);
void slotModeChanged(bool isTable);
void slotSearchLoadFail();
// UI
void changeTheme();
void slotAboutWinShow();
void onRecvSearchResult(QMap<QString, FileInfo> searchResult);
void slotSearchResult(const QMap<QString, FileInfo> &searchResult);
void slotUSBConnectOnClicked();
void slotItemButtonClicked(int text);
void slotCdMobileStorageDirectory(QString path);
void slotCrumbIndexChange(QString text, QStringList &list);
void slotFileManageBtnClicked(FileManageWin::BtnType type);
void slotSearchTextChanged(QString text);
void slotDownFile(QString path, QList<FileInfo> &fileList);
void slotUploadFile(QString dirName, const QStringList &localPathList);
void slotAndroidBtnClicked(AndroidItem::Type type);
void slotCdDirectory(QString path);
void slotOpenFile(FileInfo::FileType type, QString path);
void slotFileItemSelecAll(bool isSelectAll);
void slotContinueSearch();
void slotDownThumb();
void slotMenuFilePath(QString filePath);
void slotSetLastWidget();
void slotShowMobileFileListWidget();
void slotLocalPathList(const QStringList &localPathList);
void slotShowMobileFileSecondWidget(int indexPath);
void slotShowMobileStorage();
void slotChooseFilePath(QString chooseFilePath, const QList<FileInfo> &selectFileNameList);
void slotAbortTransmission();
void slotConnectBtnClicked();
void slotSearchInitFail();
void slotInitDiscServerResult(bool);
void slotReturnHomePage();
void slotConnectServiceUI(QString address);
@ -267,10 +193,75 @@ public Q_SLOTS:
void slotExitMobileScreen();
void slotExitPcScreen();
void slotTabBtnClicked(SuspendTabBar::BtnType type);
void slotSetSearchInfoFinish(bool isUpdated, QString searchInfoPath);
void slotMobileFileListSearchClicked();
void slotSearchKeyword(QString query);
void slotSearchUpdateClicked();
void slotSearchInfoFinish(QString searchInfoPath);
private:
ConnectionService *m_connectionService = nullptr; // 连接服务
KMobileDiscovery::Discovery *m_discovery = nullptr; // 搜索手机设备信息
FtpManager *m_ftpClient = nullptr; // ftp服务器
DeviceManage *m_deviceManage = nullptr; // 连接手机投屏
UsbManage *m_usbManage = nullptr; // 监听USB插拔信号
WifiManager *m_wifiManager = nullptr; // 监听wifi信号
QThread *m_wifiManagerThread = nullptr; // 另起线程监听wifi信号
FileSyncManage *m_fileSyncManage = nullptr; // 文件同步
SearchServer *m_searchServer = nullptr; // 文件搜索
QThread *m_searchThread = nullptr; // 文件搜索线程
FtpServer *m_ftpServer = nullptr; // ftp服务器
PcScreenManage *m_pcScreen = nullptr; // PC投屏
QDBusInterface *m_dbusInterface = nullptr; // 挂载ftpdubs
DirManager *m_dirManager = nullptr; // 本地用户目录信息管理
QDBusInterface *m_modeDbusInterface = nullptr; // 平板模式切换
QDBusInterface *m_activityDbusInterface = nullptr; // 防止熄屏
QTimer *m_timer = nullptr; // 连接加载定时器,连接超时处理
// disc
QProcess *m_discServer = nullptr;
QProcess *m_discClient = nullptr;
Titlebar *m_titlebar = nullptr; // 标题栏
HomePage *m_homepage = nullptr; // 首页
ConnectInterface *m_connectInterfaceWin = nullptr; // 连接界面
ConnectedWin *m_connectedWin = nullptr; // 已连接界面
QStackedWidget *m_mainStackedWin = nullptr; // 主界面切换堆栈窗口
FileManageWin *m_fileManageWin = nullptr; // 文件管理title
AndroidHomePage *m_androidHomePage = nullptr; // 安卓文件管理首页
MultiMediaWin *m_multiMediaWin = nullptr; // QQ | 微信文件首页
TimeLineListWidget *m_timeLineView = nullptr; // 图片视频列表
FileView *m_fileView = nullptr; // 文件信息列表
kdk::KAboutDialog *m_aboutWindow = nullptr; // 关于窗口
TransmissionDialog *m_transmissionDialog = nullptr; // 传输进度窗口
QMessageBox *m_messageBox = nullptr; // 请求提示框
SuspendTabBar *m_suspendTabBar = nullptr; // 投屏控制
kdk::KBallonTip *m_tipWin; // 消息提示
LoadDialog *m_loadDialog = nullptr; // 加载等待
bool m_isConnect = false; // 当前是否连接
FileSyncManage::FileType m_downFileType = FileSyncManage::FileType::FileNum; // 当前下载类型
FileSyncManage::FileKey m_fileKey = FileSyncManage::FileKey::Default; // 当前文件同步类型
QUrl m_url; // 服务器地址
ConnectionService::ConnectionInfo m_connectInfo; // 当前连接设备信息
bool m_isDbusOperation = false; // 当前操作是否为dbus调用
bool m_isMountFtp = false; // 是否挂载ftp
QString m_wifiIp = ""; // 本机IP
bool m_isServerConnect = false; // 服务是否连接
QString m_uploadPath = ""; // 当前上传路径
bool m_isPcSearchInfo = false; // 是否为PC数据库文件
int m_searchLoadNum = 0; // 搜索数据加载次数
QString m_reconnectAddress = ""; // 重连ip
quint32 m_inhibitValue = 0; // 熄屏参数
PublicAttributes::Model m_model = PublicAttributes::Model::PcModel; // 当前模式
QList<QStringList> m_backList; // 回退列表
QList<QStringList> m_forwardList; // 前进列表
bool m_isFileViewPage = true; // 当前是否为文件视图
QStringList m_lastPathList; // 搜索文件前最后一次面包屑路径
QListView::ViewMode m_viewMode = QListView::IconMode; // 手机存储当前视图模式
QString m_tipMesseage = ""; // 提示消息
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light; // 主题
bool m_bLeftClick = false;
bool m_isTable = false; //当前模式
QString m_searchInfoPath;
QString m_searchKeyword;
QStringList m_saveListPath;
bool m_isDownloadingThumbanil = false;
};
#endif // MAINWINDOW_H