2021-10-16 16:19:51 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
|
|
|
|
#include "../MiscHelpers/Common/Settings.h"
|
|
|
|
#include "../MiscHelpers/Common/TreeViewEx.h"
|
|
|
|
#include "../MiscHelpers/Common/PanelView.h"
|
|
|
|
#include "../MiscHelpers/Common/ProgressDialog.h"
|
|
|
|
#include <QTranslator>
|
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
|
|
|
|
//#include "../QSbieAPI/SbieAPI.h"
|
|
|
|
#include "SbiePlusAPI.h"
|
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
class CPopUpWindow;
|
2021-10-16 16:19:51 +01:00
|
|
|
class CSbieView;
|
2022-07-11 18:30:09 +01:00
|
|
|
class CFileView;
|
2021-10-16 16:19:51 +01:00
|
|
|
class CBoxBorder;
|
2023-07-02 17:09:18 +01:00
|
|
|
class CSbieTemplatesEx;
|
2021-10-16 16:19:51 +01:00
|
|
|
class CTraceView;
|
2023-07-08 10:46:29 +01:00
|
|
|
class CScriptManager;
|
2023-07-01 17:54:53 +01:00
|
|
|
class CAddonManager;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-05-25 23:47:39 +01:00
|
|
|
struct ToolBarAction {
|
2024-02-27 16:18:29 +00:00
|
|
|
// Identifier of action stored in ini. Empty for separator.
|
2023-06-01 06:28:35 +01:00
|
|
|
QString scriptName = "";
|
2023-05-25 23:47:39 +01:00
|
|
|
|
|
|
|
// Not owned. Null for special cases.
|
|
|
|
QAction* action;
|
2023-06-01 06:28:35 +01:00
|
|
|
|
|
|
|
// Display name override for display in toolbar config menu. Empty if no override.
|
|
|
|
QString nameOverride = "";
|
2023-05-25 23:47:39 +01:00
|
|
|
};
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
class CSandMan : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CSandMan(QWidget *parent = Q_NULLPTR);
|
|
|
|
virtual ~CSandMan();
|
|
|
|
|
2023-07-02 17:09:18 +01:00
|
|
|
CSbieTemplatesEx* GetCompat() { return m_SbieTemplates; }
|
2023-07-01 17:54:53 +01:00
|
|
|
void CheckCompat(QObject* receiver, const char* member);
|
2023-07-08 10:46:29 +01:00
|
|
|
CScriptManager* GetScripts() { return m_SbieScripts; }
|
2023-07-01 17:54:53 +01:00
|
|
|
CAddonManager* GetAddonManager() { return m_AddonManager; }
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2024-04-26 08:01:16 +01:00
|
|
|
static QString GetVersion(bool bWithUpdates = false);
|
2024-04-08 18:24:26 +01:00
|
|
|
static void ShowMessageBox(QWidget* Widget, QMessageBox::Icon Icon, const QString& Message);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-08-24 17:39:00 +01:00
|
|
|
bool IsImDiskReady() const { return m_ImDiskReady; }
|
|
|
|
|
2023-05-21 14:25:51 +01:00
|
|
|
bool IsWFPEnabled() const;
|
2023-05-21 13:48:58 +01:00
|
|
|
|
2023-05-08 20:35:13 +01:00
|
|
|
SB_PROGRESS RecoverFiles(const QString& BoxName, const QList<QPair<QString, QString>>& FileList, QWidget* pParent, int Action = 0);
|
2023-07-01 17:54:53 +01:00
|
|
|
static QStringList GetFileCheckers(const CSandBoxPtr& pBox);
|
2023-01-25 14:55:30 +00:00
|
|
|
SB_PROGRESS CheckFiles(const QString& BoxName, const QStringList& Files);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-02-18 19:09:35 +00:00
|
|
|
enum EDelMode {
|
2023-07-01 17:54:53 +01:00
|
|
|
eCleanUp,
|
2022-02-18 19:09:35 +00:00
|
|
|
eAuto,
|
|
|
|
eForDelete
|
|
|
|
};
|
|
|
|
|
2023-02-03 07:00:11 +00:00
|
|
|
SB_STATUS DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteSnapshots = true);
|
2022-02-13 11:55:52 +00:00
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
void UpdateProcesses();
|
|
|
|
|
|
|
|
SB_STATUS AddAsyncOp(const CSbieProgressPtr& pProgress, bool bWait = false, const QString& InitialMsg = QString(), QWidget* pParent = NULL);
|
2021-10-16 16:19:51 +01:00
|
|
|
static QString FormatError(const SB_STATUS& Error);
|
2023-07-01 17:54:53 +01:00
|
|
|
void CheckResults(QList<SB_STATUS> Results, QWidget* pParent, bool bAsync = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-11-05 13:53:44 +00:00
|
|
|
static QIcon GetIcon(const QString& Name, int iAction = 1);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
bool IsFullyPortable();
|
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
bool IsShowHidden() { return m_pShowHidden && m_pShowHidden->isChecked(); }
|
2023-07-01 17:54:53 +01:00
|
|
|
bool KeepTerminated();
|
2022-07-09 10:46:07 +01:00
|
|
|
bool ShowAllSessions() { return m_pShowAllSessions && m_pShowAllSessions->isChecked(); }
|
2022-12-15 13:06:58 +00:00
|
|
|
bool IsSilentMode();
|
|
|
|
bool IsDisableRecovery() {return IsSilentMode() || m_pDisableRecovery && m_pDisableRecovery->isChecked();}
|
|
|
|
bool IsDisableMessages() {return IsSilentMode() || m_pDisableMessages && m_pDisableMessages->isChecked();}
|
2021-10-16 16:19:51 +01:00
|
|
|
CSbieView* GetBoxView() { return m_pBoxView; }
|
2022-07-13 16:00:03 +01:00
|
|
|
CFileView* GetFileView() { return m_pFileView; }
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
QString FormatSbieMessage(quint32 MsgCode, const QStringList& MsgData, QString ProcessName, QString* pLink = NULL);
|
|
|
|
QString MakeSbieMsgLink(quint32 MsgCode, const QStringList& MsgData, QString ProcessName);
|
|
|
|
|
2024-04-20 13:32:15 +01:00
|
|
|
static void SafeShow(QWidget* pWidget);
|
2023-05-25 17:33:24 +01:00
|
|
|
int SafeExec(QDialog* pDialog);
|
|
|
|
|
2024-05-18 09:49:20 +01:00
|
|
|
bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString(), bool bShowFCP = false);
|
|
|
|
SB_RESULT(quint32) RunStart(const QString& BoxName, const QString& Command, CSbieAPI::EStartFlags Flags = CSbieAPI::eStartDefault, const QString& WorkingDir = QString(), QProcess* pProcess = NULL);
|
2023-08-24 17:39:00 +01:00
|
|
|
SB_STATUS ImBoxMount(const CSandBoxPtr& pBox, bool bAutoUnmount = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-07-31 07:30:20 +01:00
|
|
|
void EditIni(const QString& IniPath, bool bPlus = false);
|
|
|
|
|
2023-10-19 17:34:09 +01:00
|
|
|
void UpdateDrives();
|
|
|
|
void UpdateForceUSB();
|
|
|
|
|
2023-08-24 08:36:51 +01:00
|
|
|
QIcon GetBoxIcon(int boxType, bool inUse = false);
|
2022-07-10 17:28:10 +01:00
|
|
|
QRgb GetBoxColor(int boxType) { return m_BoxColors[boxType]; }
|
2022-09-29 17:28:48 +01:00
|
|
|
QIcon GetColorIcon(QColor boxColor, bool inUse = false/*, bool bOut = false*/);
|
2022-07-09 10:46:07 +01:00
|
|
|
QIcon MakeIconBusy(const QIcon& Icon, int Index = 0);
|
2023-01-28 20:49:24 +00:00
|
|
|
QIcon IconAddOverlay(const QIcon& Icon, const QString& Name, int Size = 24);
|
2021-10-16 16:19:51 +01:00
|
|
|
QString GetBoxDescription(int boxType);
|
2024-02-27 16:18:29 +00:00
|
|
|
|
2023-10-26 09:33:53 +01:00
|
|
|
bool CheckCertificate(QWidget* pWidget, int iType = 0);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-10-21 21:15:07 +01:00
|
|
|
bool IsAlwaysOnTop() const;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void UpdateTheme();
|
2022-10-05 19:16:24 +01:00
|
|
|
void UpdateTitleTheme(const HWND& hwnd);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-08-15 08:49:03 +01:00
|
|
|
SB_STATUS ReloadCert(QWidget* pWidget = NULL);
|
2022-01-13 22:52:58 +00:00
|
|
|
void UpdateCertState();
|
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
void SaveMessageLog(QIODevice* pFile);
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
signals:
|
2023-10-19 17:34:09 +01:00
|
|
|
void DrivesChanged();
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
void CertUpdated();
|
|
|
|
|
2023-02-01 21:16:41 +00:00
|
|
|
void Closed();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
protected:
|
2022-11-20 16:23:15 +00:00
|
|
|
friend class COnlineUpdater;
|
2022-02-02 18:31:03 +00:00
|
|
|
SB_RESULT(void*) ConnectSbie();
|
2021-10-16 16:19:51 +01:00
|
|
|
SB_STATUS ConnectSbieImpl();
|
|
|
|
SB_STATUS DisconnectSbie();
|
2022-02-02 18:31:03 +00:00
|
|
|
SB_RESULT(void*) StopSbie(bool andRemove = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-05-08 20:35:13 +01:00
|
|
|
static void RecoverFilesAsync(QPair<const CSbieProgressPtr&,QWidget*> pParam, const QString& BoxName, const QList<QPair<QString, QString>>& FileList, const QStringList& Checkers, int Action = 0);
|
2023-01-25 14:55:30 +00:00
|
|
|
static void CheckFilesAsync(const CSbieProgressPtr& pProgress, const QString& BoxName, const QStringList &Files, const QStringList& Checkers);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
void AddLogMessage(const QDateTime& TimeStamp, const QString& Message, const QString& Link = QString());
|
2023-07-06 20:12:22 +01:00
|
|
|
|
2023-02-07 20:50:06 +00:00
|
|
|
QIcon GetTrayIcon(bool isConnected = true, bool bSun = false);
|
2022-02-18 19:09:35 +00:00
|
|
|
QString GetTrayText(bool isConnected = true);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-08-09 17:19:46 +01:00
|
|
|
void CheckSupport();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void closeEvent(QCloseEvent* e);
|
2023-09-02 09:50:25 +01:00
|
|
|
void changeEvent(QEvent* e);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
void dragEnterEvent(QDragEnterEvent* e);
|
|
|
|
void dropEvent(QDropEvent* e);
|
|
|
|
|
|
|
|
void timerEvent(QTimerEvent* pEvent);
|
|
|
|
int m_uTimerID;
|
|
|
|
bool m_bConnectPending;
|
|
|
|
bool m_bStopPending;
|
|
|
|
CBoxBorder* m_pBoxBorder;
|
2023-07-02 17:09:18 +01:00
|
|
|
CSbieTemplatesEx* m_SbieTemplates;
|
2023-08-15 08:49:03 +01:00
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
CScriptManager* m_SbieScripts;
|
2023-07-01 17:54:53 +01:00
|
|
|
CAddonManager* m_AddonManager;
|
2024-02-27 16:18:29 +00:00
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
QMap<CSbieProgress*, QPair<CSbieProgressPtr, QPointer<QWidget>>> m_pAsyncProgress;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2024-01-29 08:21:13 +00:00
|
|
|
QMap<QString, QSet<QString>> m_MissingTemplates;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
enum EBoxColors
|
|
|
|
{
|
|
|
|
eYellow = 0,
|
|
|
|
eRed,
|
|
|
|
eGreen,
|
|
|
|
eBlue,
|
|
|
|
eCyan,
|
|
|
|
eMagenta,
|
|
|
|
eOrang,
|
2022-07-10 17:28:10 +01:00
|
|
|
eWhite,
|
2021-10-16 16:19:51 +01:00
|
|
|
eMaxColor
|
|
|
|
};
|
|
|
|
|
2022-07-10 17:28:10 +01:00
|
|
|
QMap<int, QRgb> m_BoxColors;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
class UGlobalHotkeys* m_pHotkeyManager;
|
|
|
|
|
2023-07-06 20:12:22 +01:00
|
|
|
bool m_ImDiskReady;
|
|
|
|
|
|
|
|
struct SSbieMsg {
|
|
|
|
QDateTime TimeStamp;
|
|
|
|
quint32 MsgCode;
|
2024-02-27 16:18:29 +00:00
|
|
|
QStringList MsgData;
|
2023-07-08 10:46:29 +01:00
|
|
|
QString ProcessName;
|
2023-07-06 20:12:22 +01:00
|
|
|
};
|
|
|
|
QVector<SSbieMsg> m_MessageLog;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
public slots:
|
2022-09-01 18:29:07 +01:00
|
|
|
void OnBoxSelected();
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
void OnMessage(const QString& MsgData);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
void OnStatusChanged();
|
|
|
|
void OnLogMessage(const QString& Message, bool bNotify = false);
|
|
|
|
void OnLogSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId);
|
|
|
|
|
|
|
|
void OnNotAuthorized(bool bLoginRequired, bool& bRetry);
|
|
|
|
|
|
|
|
void OnQueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data);
|
|
|
|
void OnFileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId);
|
2022-06-08 16:23:19 +01:00
|
|
|
void OnFileRecovered(const QString& BoxName, const QString& FilePath, const QString& BoxPath);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-02-03 07:00:11 +00:00
|
|
|
bool OpenRecovery(const CSandBoxPtr& pBox, bool& DeleteSnapshots, bool bCloseEmpty = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
class CRecoveryWindow* ShowRecovery(const CSandBoxPtr& pBox, bool bFind = true);
|
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
void TryFix(quint32 MsgCode, const QStringList& MsgData, const QString& ProcessName, const QString& BoxName);
|
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
void OpenCompat();
|
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
void UpdateSettings(bool bRebuildUI);
|
2022-08-28 11:43:08 +01:00
|
|
|
void RebuildUI();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnIniReloaded();
|
|
|
|
|
|
|
|
void SetupHotKeys();
|
|
|
|
void OnHotKey(size_t id);
|
|
|
|
|
|
|
|
void OnAsyncFinished();
|
|
|
|
void OnAsyncFinished(CSbieProgress* pProgress);
|
|
|
|
void OnAsyncMessage(const QString& Text);
|
|
|
|
void OnAsyncProgress(int Progress);
|
|
|
|
void OnCancelAsync();
|
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
void OnBoxAdded(const CSandBoxPtr& pBox);
|
2022-06-13 19:12:53 +01:00
|
|
|
void OnBoxClosed(const CSandBoxPtr& pBox);
|
2023-01-29 09:49:41 +00:00
|
|
|
void OnBoxCleaned(CSandBoxPlus* pBoxEx);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
void OnStartMenuChanged();
|
|
|
|
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void OpenUrl(const QString& url) { OpenUrl(QUrl(url)); }
|
|
|
|
void OpenUrl(const QUrl& url);
|
|
|
|
|
2023-05-08 20:33:50 +01:00
|
|
|
int ShowQuestion(const QString& question, const QString& checkBoxText, bool* checkBoxSetting, int buttons, int defaultButton, int type, QWidget* pParent);
|
2022-09-29 17:28:48 +01:00
|
|
|
void ShowMessage(const QString& message, int type);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
void OnBoxMenu(const QPoint &);
|
|
|
|
void OnBoxDblClick(QTreeWidgetItem*);
|
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
void SyncStartMenu();
|
|
|
|
void ClearStartMenu();
|
|
|
|
|
2022-08-09 17:19:46 +01:00
|
|
|
void UpdateLabel();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void OnMenuHover(QAction* action);
|
2022-07-10 17:28:10 +01:00
|
|
|
void OnBoxMenuHover(QAction* action);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
void OnSandBoxAction();
|
2022-07-11 18:30:09 +01:00
|
|
|
void OnSettingsAction();
|
2024-03-24 11:47:08 +00:00
|
|
|
void OnPauseAll();
|
2023-09-30 17:17:26 +01:00
|
|
|
void OnEmptyAll();
|
|
|
|
void OnLockAll();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnWndFinder();
|
2023-07-01 17:54:53 +01:00
|
|
|
void OnBoxAssistant();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnDisableForce();
|
|
|
|
void OnDisableForce2();
|
2022-08-10 19:14:37 +01:00
|
|
|
void OnDisablePopUp();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnMaintenance();
|
|
|
|
|
|
|
|
void OnViewMode(QAction* action);
|
|
|
|
void OnAlwaysTop();
|
2022-07-11 18:30:09 +01:00
|
|
|
void OnView(QAction* action);
|
2022-05-16 20:30:40 +01:00
|
|
|
void OnRefresh();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnCleanUp();
|
|
|
|
void OnProcView();
|
2022-07-11 18:30:09 +01:00
|
|
|
void OnRecoveryLog();
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
void OnSettings();
|
|
|
|
void OnResetMsgs();
|
2022-02-02 20:04:37 +00:00
|
|
|
void OnResetGUI();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnEditIni();
|
|
|
|
void OnReloadIni();
|
2022-07-09 10:46:07 +01:00
|
|
|
void OnMonitoring();
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
void OnSymbolStatus(const QString& Message);
|
|
|
|
|
2022-08-09 17:19:46 +01:00
|
|
|
void CheckForUpdates(bool bManual = true);
|
|
|
|
|
2024-02-27 10:39:27 +00:00
|
|
|
void OnRestartAsAdmin();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnExit();
|
|
|
|
void OnHelp();
|
|
|
|
void OnAbout();
|
|
|
|
|
|
|
|
void OnShowHide();
|
|
|
|
void OnSysTray(QSystemTrayIcon::ActivationReason Reason);
|
|
|
|
|
|
|
|
void SetUITheme();
|
2022-10-05 19:16:24 +01:00
|
|
|
void SetTitleTheme(const HWND& hwnd);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
void AddLogMessage(const QString& Message);
|
|
|
|
void AddFileRecovered(const QString& BoxName, const QString& FilePath);
|
|
|
|
|
2022-10-07 11:53:45 +01:00
|
|
|
void commitData(QSessionManager& manager);
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
private:
|
2022-07-09 10:46:07 +01:00
|
|
|
|
|
|
|
void CreateUI();
|
|
|
|
|
|
|
|
void CreateMenus(bool bAdvanced);
|
|
|
|
void CreateOldMenus();
|
|
|
|
void CreateMaintenanceMenu();
|
|
|
|
void CreateViewBaseMenu();
|
|
|
|
void CreateHelpMenu(bool bAdvanced);
|
2023-05-25 23:47:39 +01:00
|
|
|
void CreateToolBar(bool bRebuild);
|
2022-08-10 19:14:37 +01:00
|
|
|
void CreateLabel();
|
2022-07-11 18:30:09 +01:00
|
|
|
void CreateView(int iViewMode);
|
2022-07-09 10:46:07 +01:00
|
|
|
void CreateTrayIcon();
|
2022-05-08 13:41:49 +01:00
|
|
|
void CreateTrayMenu();
|
2022-07-10 17:28:10 +01:00
|
|
|
void CreateBoxMenu(QMenu* pMenu, int iOffset = 0, int iSysTrayFilter = 0);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-02-02 18:31:03 +00:00
|
|
|
void HandleMaintenance(SB_RESULT(void*) Status);
|
|
|
|
|
2022-08-10 20:38:52 +01:00
|
|
|
void LoadState(bool bFull = true);
|
2021-10-16 16:19:51 +01:00
|
|
|
void StoreState();
|
|
|
|
|
2022-12-30 21:41:24 +00:00
|
|
|
void UpdateState();
|
|
|
|
|
2023-01-29 16:10:11 +00:00
|
|
|
struct SBoxLink {
|
|
|
|
QString RelPath; // key
|
|
|
|
QString FullPath;
|
|
|
|
QString Target;
|
|
|
|
};
|
|
|
|
|
|
|
|
void EnumBoxLinks(QMap<QString, QMap<QString, SBoxLink> >& BoxLinks, const QString& Prefix, const QString& Folder, bool bWithSubDirs = true);
|
2022-09-29 17:28:48 +01:00
|
|
|
void CleanupShortcutPath(const QString& Path);
|
|
|
|
void DeleteShortcut(const QString& Path);
|
2023-01-29 16:10:11 +00:00
|
|
|
void CleanUpStartMenu(QMap<QString, QMap<QString, SBoxLink> >& BoxLinks);
|
2022-09-29 17:28:48 +01:00
|
|
|
|
2023-05-25 23:47:39 +01:00
|
|
|
QSet<QString> GetToolBarItemsConfig();
|
|
|
|
void SetToolBarItemsConfig(const QSet<QString>& items);
|
|
|
|
QList<ToolBarAction> GetAvailableToolBarActions();
|
|
|
|
void CreateToolBarConfigMenu(const QList<ToolBarAction>& actions, const QSet<QString>& currentSet);
|
|
|
|
void OnToolBarMenuItemClicked(const QString& scriptName);
|
|
|
|
void OnResetToolBarMenuConfig();
|
|
|
|
|
2023-06-01 06:28:35 +01:00
|
|
|
const QString ToolBarConfigKey = "UIConfig/ToolBarItems";
|
2023-05-25 23:47:39 +01:00
|
|
|
|
|
|
|
// per 1.9.3 menu. no whitespace!
|
2023-06-01 06:28:35 +01:00
|
|
|
const QStringList DefaultToolBarItems = QString(
|
|
|
|
"Settings,KeepTerminated,CleanUpMenu,BrowseFiles,EditIni,EnableMonitor"
|
|
|
|
).split(',');
|
2023-05-25 23:47:39 +01:00
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
QWidget* m_pMainWidget;
|
|
|
|
QVBoxLayout* m_pMainLayout;
|
|
|
|
|
|
|
|
QToolBar* m_pToolBar;
|
|
|
|
QSplitter* m_pPanelSplitter;
|
|
|
|
QSplitter* m_pLogSplitter;
|
|
|
|
|
2022-07-11 18:30:09 +01:00
|
|
|
QStackedLayout* m_pViewStack;
|
|
|
|
QComboBox* m_pBoxCombo;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
CSbieView* m_pBoxView;
|
2022-07-11 18:30:09 +01:00
|
|
|
CFileView* m_pFileView;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
QTabWidget* m_pLogTabs;
|
|
|
|
CPanelWidgetEx* m_pMessageLog;
|
|
|
|
CTraceView* m_pTraceView;
|
2022-06-08 16:23:19 +01:00
|
|
|
CPanelWidgetEx* m_pRecoveryLog;
|
2022-07-11 18:30:09 +01:00
|
|
|
class CRecoveryLogWnd* m_pRecoveryLogWnd;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-08-10 19:14:37 +01:00
|
|
|
QMenuBar* m_pMenuBar;
|
|
|
|
QHBoxLayout* m_pMenuLayout;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
QMenu* m_pMenuFile;
|
2024-02-27 10:39:27 +00:00
|
|
|
QAction* m_pRestart;
|
2022-12-06 12:48:18 +00:00
|
|
|
QAction* m_pRunBoxed;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pNewBox;
|
|
|
|
QAction* m_pNewGroup;
|
2022-11-12 09:45:35 +00:00
|
|
|
QAction* m_pImportBox;
|
2024-03-24 11:47:08 +00:00
|
|
|
QAction* m_pPauseAll;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pEmptyAll;
|
2023-08-24 17:39:00 +01:00
|
|
|
QAction* m_pLockAll;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pWndFinder;
|
|
|
|
QAction* m_pDisableForce;
|
|
|
|
QAction* m_pDisableForce2;
|
2022-06-13 19:12:53 +01:00
|
|
|
QAction* m_pDisableRecovery;
|
|
|
|
QAction* m_pDisableMessages;
|
2023-05-15 19:28:21 +01:00
|
|
|
QAction* m_pDismissUpdate;
|
2021-10-16 16:19:51 +01:00
|
|
|
QMenu* m_pMaintenance;
|
|
|
|
QAction* m_pConnect;
|
|
|
|
QAction* m_pDisconnect;
|
|
|
|
QMenu* m_pMaintenanceItems;
|
|
|
|
QAction* m_pInstallDrv;
|
|
|
|
QAction* m_pStartDrv;
|
|
|
|
QAction* m_pStopDrv;
|
|
|
|
QAction* m_pUninstallDrv;
|
|
|
|
QAction* m_pInstallSvc;
|
|
|
|
QAction* m_pStartSvc;
|
|
|
|
QAction* m_pStopSvc;
|
|
|
|
QAction* m_pUninstallSvc;
|
|
|
|
QAction* m_pStopAll;
|
2023-08-24 17:39:00 +01:00
|
|
|
QAction* m_pImDiskCpl;
|
2022-01-29 09:18:22 +00:00
|
|
|
QAction* m_pUninstallAll;
|
2022-05-14 14:42:10 +01:00
|
|
|
QAction* m_pSetupWizard;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pExit;
|
|
|
|
|
|
|
|
QMenu* m_pMenuView;
|
|
|
|
QActionGroup* m_pViewMode;
|
|
|
|
QAction* m_pShowHidden;
|
|
|
|
QAction* m_pWndTopMost;
|
2022-07-11 18:30:09 +01:00
|
|
|
QAction* m_pMenuBrowse;
|
2022-05-16 20:30:40 +01:00
|
|
|
QAction* m_pRefreshAll;
|
2021-10-16 16:19:51 +01:00
|
|
|
QMenu* m_pCleanUpMenu;
|
|
|
|
QAction* m_pCleanUpProcesses;
|
|
|
|
QAction* m_pCleanUpMsgLog;
|
|
|
|
QAction* m_pCleanUpTrace;
|
2022-06-08 16:23:19 +01:00
|
|
|
QAction* m_pCleanUpRecovery;
|
2021-10-16 16:19:51 +01:00
|
|
|
QToolButton* m_pCleanUpButton;
|
2023-06-04 15:27:49 +01:00
|
|
|
QToolButton* m_pNewBoxButton;
|
|
|
|
QToolButton* m_pEditIniButton;
|
2023-01-29 14:12:01 +00:00
|
|
|
//QToolButton* m_pEditButton;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pKeepTerminated;
|
|
|
|
QAction* m_pShowAllSessions;
|
2022-07-11 18:30:09 +01:00
|
|
|
QAction* m_pArrangeGroups;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
QMenu* m_pMenuOptions;
|
|
|
|
QAction* m_pMenuSettings;
|
|
|
|
QAction* m_pMenuResetMsgs;
|
2022-02-02 20:04:37 +00:00
|
|
|
QAction* m_pMenuResetGUI;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pEditIni;
|
2023-01-29 14:12:01 +00:00
|
|
|
QAction* m_pEditIni2;
|
|
|
|
QAction* m_pEditIni3;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pReloadIni;
|
|
|
|
QAction* m_pEnableMonitoring;
|
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
//QMenu* m_pMenuTools;
|
|
|
|
QAction* m_pBoxAssistant;
|
|
|
|
|
2022-05-13 22:12:20 +01:00
|
|
|
QAction* m_pSeparator;
|
|
|
|
QLabel* m_pLabel;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
QMenu* m_pMenuHelp;
|
2023-01-29 14:12:01 +00:00
|
|
|
//QAction* m_pSupport;
|
2022-12-20 13:18:57 +00:00
|
|
|
QAction* m_pContribution;
|
2021-10-16 16:19:51 +01:00
|
|
|
QAction* m_pForum;
|
|
|
|
QAction* m_pManual;
|
|
|
|
QAction* m_pUpdate;
|
|
|
|
QAction* m_pAbout;
|
|
|
|
QAction* m_pAboutQt;
|
|
|
|
|
2023-01-07 15:57:55 +00:00
|
|
|
QLabel* m_pTraceInfo;
|
2022-08-10 19:14:37 +01:00
|
|
|
QLabel* m_pDisabledForce;
|
|
|
|
QLabel* m_pDisabledRecovery;
|
|
|
|
QLabel* m_pDisabledMessages;
|
2023-08-24 17:39:00 +01:00
|
|
|
QLabel* m_pRamDiskInfo;
|
2022-07-09 10:46:07 +01:00
|
|
|
|
|
|
|
// for old menu
|
|
|
|
QMenu* m_pSandbox;
|
|
|
|
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
QSystemTrayIcon* m_pTrayIcon;
|
|
|
|
QMenu* m_pTrayMenu;
|
|
|
|
QWidgetAction* m_pTrayList;
|
|
|
|
QTreeWidget* m_pTrayBoxes;
|
2022-07-10 17:28:10 +01:00
|
|
|
int m_iTrayPos;
|
2021-10-16 16:19:51 +01:00
|
|
|
//QMenu* m_pBoxMenu;
|
|
|
|
bool m_bIconEmpty;
|
2023-01-07 15:57:55 +00:00
|
|
|
int m_iIconDisabled;
|
2022-02-18 19:09:35 +00:00
|
|
|
bool m_bIconBusy;
|
2023-02-07 20:50:06 +00:00
|
|
|
bool m_bIconSun;
|
2022-02-18 19:09:35 +00:00
|
|
|
int m_iDeletingContent;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-10-21 21:15:07 +01:00
|
|
|
bool m_bOnTop;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
bool m_bExit;
|
|
|
|
|
|
|
|
CProgressDialog* m_pProgressDialog;
|
|
|
|
bool m_pProgressModal;
|
|
|
|
CPopUpWindow* m_pPopUpWindow;
|
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
bool m_StartMenuUpdatePending;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
bool m_ThemeUpdatePending;
|
|
|
|
QString m_DefaultStyle;
|
|
|
|
QPalette m_DefaultPalett;
|
2022-07-09 10:46:07 +01:00
|
|
|
double m_DefaultFontSize;
|
2022-08-09 17:19:46 +01:00
|
|
|
QPalette m_DarkPalett;
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
void LoadLanguage();
|
2021-10-19 08:34:10 +01:00
|
|
|
void LoadLanguage(const QString& Lang, const QString& Module, int Index);
|
|
|
|
QTranslator m_Translator[2];
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
public:
|
2022-11-20 16:23:15 +00:00
|
|
|
class COnlineUpdater*m_pUpdater;
|
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
QString m_Language;
|
2021-10-16 16:19:51 +01:00
|
|
|
quint32 m_LanguageId;
|
|
|
|
bool m_DarkTheme;
|
|
|
|
};
|
|
|
|
|
2022-07-11 18:30:09 +01:00
|
|
|
|
|
|
|
class CRecoveryLogWnd : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CRecoveryLogWnd(QWidget *parent = Q_NULLPTR);
|
|
|
|
~CRecoveryLogWnd();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnDblClick(QTreeWidgetItem* pItem);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void Closed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
friend class CSandMan;
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
|
|
|
|
CPanelWidgetEx* m_pRecoveryLog;
|
|
|
|
};
|
|
|
|
|
2022-07-20 08:35:07 +01:00
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
class CTreeItemDelegate : public QStyledItemDelegate
|
|
|
|
{
|
|
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
QStyleOptionViewItem opt(option);
|
|
|
|
opt.state &= ~QStyle::State_HasFocus;
|
|
|
|
QStyledItemDelegate::paint(painter, opt, index);
|
|
|
|
}
|
|
|
|
};
|
2022-07-11 18:30:09 +01:00
|
|
|
|
2022-08-08 09:07:38 +01:00
|
|
|
class CTreeItemDelegate2 : public CTreeItemDelegate
|
|
|
|
{
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
|
|
|
size.setHeight(32);
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
extern CSandMan* theGUI;
|