This commit is contained in:
DavidXanatos 2022-07-11 19:30:09 +02:00
parent 9e1f7ea216
commit 864f1b43d7
13 changed files with 465 additions and 251 deletions

View File

@ -12,7 +12,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added Vintage View Mode to make sandman UI look just lien sbietrl on the first glance
- added alternative tray menu mechanics
- added ability to auto generate sandbox icons based on the border color
- added dedicated box group icon
### Changed
- changed box group icon to a dedicated one
- browse content is now available as a side panel in the main window
### Fixed
- fixed DPI issue on Windows 7

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FileBrowserWindow</class>
<widget class="QWidget" name="FileBrowserWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>573</width>
<height>451</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>SandboxiePlus - Snapshots</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeView" name="treeFiles"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -25,6 +25,7 @@
#include "Helpers/WinAdmin.h"
#include "../MiscHelpers/Common/OtherFunctions.h"
#include "../MiscHelpers/Common/Common.h"
#include "Views/FileView.h"
CSbiePlusAPI* theAPI = NULL;
@ -280,7 +281,12 @@ void CSandMan::CreateUI()
if(iViewMode == 1)
CreateToolBar();
CreateView(iViewMode == 1);
CreateView(iViewMode);
if (iViewMode != 2) {
m_pMenuBrowse->setChecked(theConf->GetBool("Options/ShowFilePanel", false));
m_pFileView->setVisible(m_pMenuBrowse->isChecked());
}
foreach(QAction * pAction, m_pViewMode->actions())
pAction->setChecked(pAction->data().toInt() == iViewMode);
@ -399,6 +405,13 @@ void CSandMan::CreateMenus(bool bAdvanced)
CreateViewBaseMenu();
m_pMenuView->addSeparator();
m_pMenuBrowse = m_pMenuView->addAction(CSandMan::GetIcon("Tree"), tr("Show File Panel"), this, SLOT(OnProcView()));
m_pMenuBrowse->setCheckable(true);
m_pMenuBrowse->setShortcut(QKeySequence("Ctrl+D"));
m_pMenuBrowse->setShortcutContext(Qt::WidgetWithChildrenShortcut);
this->addAction(m_pMenuBrowse);
if(bAdvanced) {
m_pMenuView->addSeparator();
@ -443,6 +456,8 @@ void CSandMan::CreateMenus(bool bAdvanced)
m_pEnableMonitoring = m_pMenuView->addAction(CSandMan::GetIcon("SetLogging"), tr("Trace Logging"), this, SLOT(OnMonitoring()));
if (bAdvanced)
m_pEnableMonitoring->setCheckable(true);
if (!bAdvanced)
m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Recovery Log"), this, SLOT(OnRecoveryLog()));
m_pMenuOptions = menuBar()->addMenu(tr("&Options"));
@ -506,10 +521,20 @@ void CSandMan::CreateOldMenus()
CreateViewBaseMenu();
m_pMenuView->addSeparator();
m_pRefreshAll = m_pMenuView->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh View"), this, SLOT(OnRefresh()));
m_pRefreshAll->setShortcut(QKeySequence("F5"));
m_pRefreshAll->setShortcutContext(Qt::WidgetWithChildrenShortcut);
this->addAction(m_pRefreshAll);
QActionGroup* m_pView = new QActionGroup(m_pMenuView);
MakeAction(m_pView, m_pMenuView, tr("Programs"), 0);
MakeAction(m_pView, m_pMenuView, tr("Files and Folders"), 1);
m_pView->actions().first()->setChecked(true);
connect(m_pView, SIGNAL(triggered(QAction*)), this, SLOT(OnView(QAction*)));
m_pMenuView->addSeparator();
m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Recovery Log"), this, SLOT(OnRecoveryLog()));
//m_pMenuView->addSeparator();
//m_pRefreshAll = m_pMenuView->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh View"), this, SLOT(OnRefresh()));
//m_pRefreshAll->setShortcut(QKeySequence("F5"));
//m_pRefreshAll->setShortcutContext(Qt::WidgetWithChildrenShortcut);
//this->addAction(m_pRefreshAll);
m_pRefreshAll = NULL;
m_pCleanUpMenu = NULL;
m_pCleanUpProcesses = NULL;
@ -525,11 +550,12 @@ void CSandMan::CreateOldMenus()
m_pSandbox->addSeparator();
m_pNewBox = m_pSandbox->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Sandbox"), this, SLOT(OnSandBoxAction()));
m_pNewGroup = m_pSandbox->addAction(CSandMan::GetIcon("Group"), tr("Create New Group"), this, SLOT(OnSandBoxAction()));
m_pSandbox->addSeparator();
QAction* m_pSetContainer = m_pSandbox->addAction(CSandMan::GetIcon("Advanced"), tr("Set Container Folder"), this, SLOT(OnSandBoxAction()));
QAction* m_pSetContainer = m_pSandbox->addAction(CSandMan::GetIcon("Advanced"), tr("Set Container Folder"), this, SLOT(OnSettingsAction()));
m_pSetContainer->setData(CSettingsWindow::eAdvanced);
m_pArrangeGroups = m_pSandbox->addAction(tr("Set Layout and Groups"), this, SLOT(OnSandBoxAction()));
m_pArrangeGroups = m_pSandbox->addAction(tr("Set Layout and Groups"), this, SLOT(OnSettingsAction()));
m_pArrangeGroups->setCheckable(true);
m_pShowHidden = m_pSandbox->addAction(tr("Reveal Hidden Boxes"));
@ -542,17 +568,17 @@ void CSandMan::CreateOldMenus()
m_pMenuSettings = m_pMenuOptions->addAction(CSandMan::GetIcon("Settings"), tr("Global Settings"), this, SLOT(OnSettings()));
m_pMenuOptions->addSeparator();
QAction* m_pProgramAlert = m_pMenuOptions->addAction(CSandMan::GetIcon("Ampel"), tr("Program Alerts"), this, SLOT(OnSandBoxAction()));
QAction* m_pProgramAlert = m_pMenuOptions->addAction(CSandMan::GetIcon("Ampel"), tr("Program Alerts"), this, SLOT(OnSettingsAction()));
m_pProgramAlert->setData(CSettingsWindow::eProgCtrl);
QAction* m_pWindowsShell = m_pMenuOptions->addAction(CSandMan::GetIcon("Shell"), tr("Windows Shell Integration"), this, SLOT(OnSandBoxAction()));
QAction* m_pWindowsShell = m_pMenuOptions->addAction(CSandMan::GetIcon("Shell"), tr("Windows Shell Integration"), this, SLOT(OnSettingsAction()));
m_pWindowsShell->setData(CSettingsWindow::eShell);
QAction* m_pCompatibility = m_pMenuOptions->addAction(CSandMan::GetIcon("Compatibility"), tr("Software Compatibility"), this, SLOT(OnSandBoxAction()));
QAction* m_pCompatibility = m_pMenuOptions->addAction(CSandMan::GetIcon("Compatibility"), tr("Software Compatibility"), this, SLOT(OnSettingsAction()));
m_pCompatibility->setData(CSettingsWindow::eSoftCompat);
m_pMenuResetMsgs = m_pMenuOptions->addAction(tr("Reset all hidden messages"), this, SLOT(OnResetMsgs()));
m_pMenuResetGUI = m_pMenuOptions->addAction(tr("Reset all GUI options"), this, SLOT(OnResetGUI()));
m_pMenuOptions->addSeparator();
QAction* m_pConfigLock = m_pMenuOptions->addAction(CSandMan::GetIcon("Lock"), tr("Lock Configuration"), this, SLOT(OnSandBoxAction()));
QAction* m_pConfigLock = m_pMenuOptions->addAction(CSandMan::GetIcon("Lock"), tr("Lock Configuration"), this, SLOT(OnSettingsAction()));
m_pConfigLock->setData(CSettingsWindow::eConfigLock);
m_pEditIni = m_pMenuOptions->addAction(CSandMan::GetIcon("EditIni"), tr("Edit ini file"), this, SLOT(OnEditIni()));
m_pReloadIni = m_pMenuOptions->addAction(CSandMan::GetIcon("ReloadIni"), tr("Reload ini file"), this, SLOT(OnReloadIni()));
@ -561,6 +587,19 @@ void CSandMan::CreateOldMenus()
}
void CSandMan::OnView(QAction* pAction)
{
int iView = pAction->data().toInt();
if(m_pViewStack) m_pViewStack->setCurrentIndex(iView);
if (iView == 1) { // files
m_pBoxCombo->clear();
foreach(const CSandBoxPtr & pBox, theAPI->GetAllBoxes())
m_pBoxCombo->addItem(tr("Sandbox %1").arg(pBox->GetName().replace("_", "")), pBox->GetName());
m_pBoxCombo->setCurrentIndex(m_pBoxCombo->findData("DefaultBox"));
}
}
void CSandMan::CreateToolBar()
{
m_pToolBar = new QToolBar();
@ -641,13 +680,36 @@ void CSandMan::UpdateLabel()
m_pLabel->setToolTip(LabelTip);
}
void CSandMan::CreateView(bool bAdvanced)
void CSandMan::CreateView(int iViewMode)
{
m_pBoxView = new CSbieView();
m_pFileView = new CFileView();
if (!bAdvanced)
if (iViewMode != 1)
m_pRecoveryLogWnd = new CRecoveryLogWnd(m_pMainWidget);
else
m_pRecoveryLogWnd = NULL;
if (iViewMode == 2)
{
m_pMainLayout->addWidget(m_pBoxView);
m_pViewStack = new QStackedLayout();
m_pViewStack->addWidget(m_pBoxView);
QWidget* pFileView = new QWidget();
QGridLayout* pFileLayout = new QGridLayout(pFileView);
pFileLayout->setMargin(0);
pFileLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0, 1, 1);
m_pBoxCombo = new QComboBox();
pFileLayout->addWidget(m_pBoxCombo, 0, 1);
pFileLayout->addWidget(m_pFileView, 1, 0, 1, 2);
m_pViewStack->addWidget(pFileView);
m_pMainLayout->addLayout(m_pViewStack);
m_pPanelSplitter = NULL;
m_pLogSplitter = NULL;
@ -661,58 +723,80 @@ void CSandMan::CreateView(bool bAdvanced)
return;
}
m_pLogSplitter = new QSplitter();
m_pLogSplitter->setOrientation(Qt::Vertical);
m_pMainLayout->addWidget(m_pLogSplitter);
m_pViewStack = NULL;
m_pBoxCombo = NULL;
if (iViewMode == 1)
{
m_pLogSplitter = new QSplitter();
m_pLogSplitter->setOrientation(Qt::Vertical);
m_pMainLayout->addWidget(m_pLogSplitter);
}
m_pPanelSplitter = new QSplitter();
m_pPanelSplitter->setOrientation(Qt::Horizontal);
m_pLogSplitter->addWidget(m_pPanelSplitter);
if (iViewMode == 1)
m_pLogSplitter->addWidget(m_pPanelSplitter);
else
m_pMainLayout->addWidget(m_pPanelSplitter);
m_pPanelSplitter->addWidget(m_pBoxView);
m_pPanelSplitter->addWidget(m_pFileView);
//m_pPanelSplitter->addWidget();
m_pPanelSplitter->setCollapsible(0, false);
//m_pPanelSplitter->setCollapsible(1, false);
if (iViewMode == 1)
{
m_pLogTabs = new QTabWidget();
m_pLogSplitter->addWidget(m_pLogTabs);
// Message Log
m_pMessageLog = new CPanelWidgetEx();
//m_pMessageLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pMessageLog->GetView())->setHeaderLabels(tr("Time|Message").split("|"));
m_pMessageLog->GetMenu()->insertAction(m_pMessageLog->GetMenu()->actions()[0], m_pCleanUpMsgLog);
m_pMessageLog->GetMenu()->insertSeparator(m_pMessageLog->GetMenu()->actions()[0]);
m_pMessageLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pMessageLog->GetView()->setSortingEnabled(false);
m_pLogTabs->addTab(m_pMessageLog, tr("Sbie Messages"));
//
m_pTraceView = new CTraceView(false, this);
m_pTraceView->AddAction(m_pCleanUpTrace);
m_pLogTabs->addTab(m_pTraceView, tr("Trace Log"));
m_pLogTabs = new QTabWidget();
m_pLogSplitter->addWidget(m_pLogTabs);
// Recovery Log
m_pRecoveryLog = new CPanelWidgetEx();
// Message Log
m_pMessageLog = new CPanelWidgetEx();
//m_pRecoveryLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pRecoveryLog->GetView())->setHeaderLabels(tr("Time|Box Name|File Path").split("|"));
//m_pMessageLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pMessageLog->GetView())->setHeaderLabels(tr("Time|Message").split("|"));
m_pRecoveryLog->GetMenu()->insertAction(m_pRecoveryLog->GetMenu()->actions()[0], m_pCleanUpRecovery);
m_pRecoveryLog->GetMenu()->insertSeparator(m_pRecoveryLog->GetMenu()->actions()[0]);
m_pMessageLog->GetMenu()->insertAction(m_pMessageLog->GetMenu()->actions()[0], m_pCleanUpMsgLog);
m_pMessageLog->GetMenu()->insertSeparator(m_pMessageLog->GetMenu()->actions()[0]);
m_pRecoveryLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pRecoveryLog->GetView()->setSortingEnabled(false);
m_pMessageLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pMessageLog->GetView()->setSortingEnabled(false);
m_pLogTabs->addTab(m_pRecoveryLog, tr("Recovery Log"));
//
}
else {
m_pLogSplitter = NULL;
m_pLogTabs->addTab(m_pMessageLog, tr("Sbie Messages"));
//
m_pLogTabs = NULL;
m_pTraceView = new CTraceView(false, this);
m_pTraceView->AddAction(m_pCleanUpTrace);
m_pLogTabs->addTab(m_pTraceView, tr("Trace Log"));
// Recovery Log
m_pRecoveryLog = new CPanelWidgetEx();
//m_pRecoveryLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pRecoveryLog->GetView())->setHeaderLabels(tr("Time|Box Name|File Path").split("|"));
m_pRecoveryLog->GetMenu()->insertAction(m_pRecoveryLog->GetMenu()->actions()[0], m_pCleanUpMsgLog);
m_pRecoveryLog->GetMenu()->insertSeparator(m_pRecoveryLog->GetMenu()->actions()[0]);
m_pRecoveryLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pRecoveryLog->GetView()->setSortingEnabled(false);
m_pLogTabs->addTab(m_pRecoveryLog, tr("Recovery Log"));
//
m_pMessageLog = NULL;
m_pTraceView = NULL;
m_pRecoveryLog = NULL;
}
}
#include "SandManTray.cpp"
@ -1011,6 +1095,30 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
m_pTraceView->setEnabled(bIsMonitoring);
}
CSandBoxPtr pBox;
if (m_pPanelSplitter) {
QList<CSandBoxPtr> boxes = m_pBoxView->GetSelectedBoxes();
if (m_pPanelSplitter->sizes().at(1) > 0 && boxes.count() == 1)
pBox = boxes.first();
}
// for old menu
if (m_pBoxCombo) {
QString Name = m_pBoxCombo->currentData().toString();
if (Name.isEmpty())
Name = "DefaultBox";
pBox = theAPI->GetBoxByName(Name);
}
if (!pBox.isNull()) {
if (!m_pFileView->isEnabled()) m_pFileView->setEnabled(true);
if (pBox != m_pFileView->GetBox()) m_pFileView->SetBox(pBox);
}
else if (m_pFileView->isEnabled()) {
m_pFileView->setEnabled(false);
m_pFileView->SetBox(CSandBoxPtr());
}
QMap<quint32, CBoxedProcessPtr> Processes = theAPI->GetAllProcesses();
int ActiveProcesses = 0;
if (KeepTerminated()) {
@ -1360,42 +1468,9 @@ void CSandMan::OnMenuHover(QAction* action)
//m_pMenuStopAll - always enabled
}
static QMenu* pEmptyMenu = new QMenu();
if (menuBar()->actions().at(2) == action && m_pSandbox)
{
while (!m_pSandbox->actions().first()->data().toString().isEmpty())
m_pSandbox->removeAction(m_pSandbox->actions().first());
CreateBoxMenu(m_pSandbox);
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
QAction* pPos = m_pSandbox->actions().first();
foreach(const CSandBoxPtr & pBox, Boxes)
{
if (!pBox->IsEnabled())
continue;
QAction* pBoxAction = new QAction(pBox->GetName().replace("_", " "));
pBoxAction->setData(pBox->GetName());
pBoxAction->setMenu(pEmptyMenu);
//pBoxAction->setIcon
//connect(pBoxAction, SIGNAL(triggered()), this, SLOT(OnBoxMenu()));
m_pSandbox->insertAction(pPos, pBoxAction);
}
}
if (action->data().type() == QVariant::String) {
QString Name = action->data().toString();
static QPointer<QAction> pPrev = NULL;
if (pPrev.data() != action) {
if (!pPrev.isNull()) {
pPrev->menu()->close();
pPrev->setMenu(new QMenu());
}
pPrev = action;
QMenu* pMenu = theGUI->GetBoxView()->GetMenu(Name);
action->setMenu(pMenu);
}
}
}
#define HK_PANIC 1
@ -1608,19 +1683,6 @@ void CSandMan::OnSandBoxAction()
else if(pAction == m_pNewGroup)
GetBoxView()->AddNewGroup();
else if (pAction == m_pArrangeGroups)
{
QMessageBox *msgBox = new QMessageBox(this);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setWindowTitle("Sandboxie-Plus");
msgBox->setText(tr("In the Plus UI this functionality has been integrated into the main sandbox list view."));
msgBox->setInformativeText(tr("Using the box/group context menu you can move boxes and groups to other groups. You can also use drag an drop to move the items around. "
"Alternatively you can also use the arow keys while holding ALT down to move items up and down within thair group.<br />"
"You can create new boxes and groups from the Sandbox menu."));
QPixmap pic(":/Assets/LayoutAndGroups.png");
msgBox->setIconPixmap(pic.scaled(pic.width() * 3/4, pic.height() * 3/4, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
SafeExec(msgBox);
}
// for old menu
else
{
@ -1898,6 +1960,11 @@ void CSandMan::OnProcView()
{
if(m_pKeepTerminated) theConf->SetValue("Options/KeepTerminated", m_pKeepTerminated->isChecked());
if(m_pShowAllSessions) theConf->SetValue("Options/ShowAllSessions", m_pShowAllSessions->isChecked());
if (m_pMenuBrowse) {
theConf->SetValue("Options/ShowFilePanel", m_pMenuBrowse->isChecked());
m_pFileView->setVisible(m_pMenuBrowse->isChecked());
}
}
void CSandMan::OnSettings()
@ -1914,6 +1981,33 @@ void CSandMan::OnSettings()
}
}
// for old menu
void CSandMan::OnSettingsAction()
{
QAction* pAction = qobject_cast<QAction*>(sender());
if (pAction == m_pArrangeGroups)
{
QMessageBox *msgBox = new QMessageBox(this);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setWindowTitle("Sandboxie-Plus");
msgBox->setText(tr("In the Plus UI this functionality has been integrated into the main sandbox list view."));
msgBox->setInformativeText(tr("Using the box/group context menu you can move boxes and groups to other groups. You can also use drag an drop to move the items around. "
"Alternatively you can also use the arow keys while holding ALT down to move items up and down within thair group.<br />"
"You can create new boxes and groups from the Sandbox menu."));
QPixmap pic(":/Assets/LayoutAndGroups.png");
msgBox->setIconPixmap(pic.scaled(pic.width() * 3/4, pic.height() * 3/4, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
SafeExec(msgBox);
}
else
{
CSettingsWindow* pSettingsWindow = new CSettingsWindow(this);
connect(pSettingsWindow, SIGNAL(OptionsChanged(bool)), this, SLOT(UpdateSettings(bool)));
int Tab = pAction->data().toInt();
pSettingsWindow->showTab(Tab, true);
}
}
void CSandMan::UpdateSettings(bool bRebuildUI)
{
if(m_pTrayBoxes) m_pTrayBoxes->clear(); // force refresh

View File

@ -17,6 +17,7 @@
#include "SbiePlusAPI.h"
class CSbieView;
class CFileView;
class CBoxBorder;
class CSbieTemplates;
class CTraceView;
@ -180,6 +181,7 @@ private slots:
void OnBoxMenuHover(QAction* action);
void OnSandBoxAction();
void OnSettingsAction();
void OnEmptyAll();
void OnWndFinder();
void OnDisableForce();
@ -188,9 +190,11 @@ private slots:
void OnViewMode(QAction* action);
void OnAlwaysTop();
void OnView(QAction* action);
void OnRefresh();
void OnCleanUp();
void OnProcView();
void OnRecoveryLog();
void OnSettings();
void OnResetMsgs();
@ -229,7 +233,7 @@ private:
void CreateViewBaseMenu();
void CreateHelpMenu(bool bAdvanced);
void CreateToolBar();
void CreateView(bool bAdvanced);
void CreateView(int iViewMode);
void CreateTrayIcon();
void CreateTrayMenu();
void CreateBoxMenu(QMenu* pMenu, int iOffset = 0, int iSysTrayFilter = 0);
@ -243,19 +247,21 @@ private:
QVBoxLayout* m_pMainLayout;
QToolBar* m_pToolBar;
QSplitter* m_pPanelSplitter;
QSplitter* m_pLogSplitter;
QStackedLayout* m_pViewStack;
QComboBox* m_pBoxCombo;
CSbieView* m_pBoxView;
CFileView* m_pFileView;
QTabWidget* m_pLogTabs;
CPanelWidgetEx* m_pMessageLog;
CTraceView* m_pTraceView;
CPanelWidgetEx* m_pRecoveryLog;
class CRecoveryLogWnd* m_pRecoveryLogWnd;
QMenu* m_pMenuFile;
@ -288,6 +294,7 @@ private:
QActionGroup* m_pViewMode;
QAction* m_pShowHidden;
QAction* m_pWndTopMost;
QAction* m_pMenuBrowse;
QAction* m_pRefreshAll;
QMenu* m_pCleanUpMenu;
QAction* m_pCleanUpProcesses;
@ -297,6 +304,7 @@ private:
QToolButton* m_pCleanUpButton;
QAction* m_pKeepTerminated;
QAction* m_pShowAllSessions;
QAction* m_pArrangeGroups;
QMenu* m_pMenuOptions;
QAction* m_pMenuSettings;
@ -353,4 +361,27 @@ public:
bool m_DarkTheme;
};
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;
};
extern CSandMan* theGUI;

View File

@ -240,9 +240,9 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Views\FileView.cpp" />
<ClCompile Include="Views\SbieView.cpp" />
<ClCompile Include="Views\TraceView.cpp" />
<ClCompile Include="Windows\FileBrowserWindow.cpp" />
<ClCompile Include="Windows\NewBoxWindow.cpp" />
<ClCompile Include="Windows\OptionsAccess.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -313,8 +313,8 @@
<ClCompile Include="Wizards\SetupWizard.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="Views\FileView.h" />
<QtMoc Include="Wizards\SetupWizard.h" />
<QtMoc Include="Windows\FileBrowserWindow.h" />
<QtMoc Include="Windows\SelectBoxWindow.h" />
<QtMoc Include="Views\TraceView.h" />
<QtMoc Include="Windows\NewBoxWindow.h" />
@ -351,7 +351,6 @@
<Image Include="Resources\SandMan.ico" />
</ItemGroup>
<ItemGroup>
<QtUic Include="Forms\FileBrowserWindow.ui" />
<QtUic Include="Forms\NewBoxWindow.ui" />
<QtUic Include="Forms\OptionsWindow.ui" />
<QtUic Include="Forms\PopUpWindow.ui" />

View File

@ -138,9 +138,6 @@
<ClCompile Include="Windows\OptionsTemplates.cpp">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="Windows\FileBrowserWindow.cpp">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="BoxJob.cpp">
<Filter>SandMan</Filter>
</ClCompile>
@ -174,6 +171,9 @@
<ClCompile Include="SandManTray.cpp">
<Filter>SandMan</Filter>
</ClCompile>
<ClCompile Include="Views\FileView.cpp">
<Filter>Views</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -244,9 +244,6 @@
<QtMoc Include="Windows\SelectBoxWindow.h">
<Filter>Windows</Filter>
</QtMoc>
<QtMoc Include="Windows\FileBrowserWindow.h">
<Filter>Windows</Filter>
</QtMoc>
<QtMoc Include="BoxJob.h">
<Filter>SandMan</Filter>
</QtMoc>
@ -262,6 +259,9 @@
<QtMoc Include="BoxMonitor.h">
<Filter>SandMan</Filter>
</QtMoc>
<QtMoc Include="Views\FileView.h">
<Filter>Views</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtRcc Include="Resources\SandMan.qrc">
@ -301,9 +301,6 @@
<QtUic Include="Forms\SelectBoxWindow.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="Forms\FileBrowserWindow.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="sandman_de.ts">

View File

@ -143,16 +143,19 @@ void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QStrin
void CSandMan::AddFileRecovered(const QString& BoxName, const QString& FilePath)
{
if (!m_pRecoveryLog)
return;
CPanelWidgetEx* pRecoveryLog = m_pRecoveryLog;
if (pRecoveryLog == NULL) {
pRecoveryLog = m_pRecoveryLogWnd->m_pRecoveryLog;
if (!pRecoveryLog) return;
}
QTreeWidgetItem* pItem = new QTreeWidgetItem(); // Time|Box|FilePath
pItem->setText(0, QDateTime::currentDateTime().toString("hh:mm:ss.zzz"));
pItem->setText(1, BoxName);
pItem->setText(2, FilePath);
m_pRecoveryLog->GetTree()->addTopLevelItem(pItem);
pRecoveryLog->GetTree()->addTopLevelItem(pItem);
m_pRecoveryLog->GetView()->verticalScrollBar()->setValue(m_pRecoveryLog->GetView()->verticalScrollBar()->maximum());
pRecoveryLog->GetView()->verticalScrollBar()->setValue(pRecoveryLog->GetView()->verticalScrollBar()->maximum());
}
void CSandMan::OnFileRecovered(const QString& BoxName, const QString& FilePath, const QString& BoxPath)
@ -163,3 +166,73 @@ void CSandMan::OnFileRecovered(const QString& BoxName, const QString& FilePath,
if (pBox)
pBox.objectCast<CSandBoxPlus>()->UpdateSize();
}
////////////////////////////////////////////////////////////////////////////////////////
// CRecoveryLogWnd
CRecoveryLogWnd::CRecoveryLogWnd(QWidget *parent)
: QDialog(parent)
{
Qt::WindowFlags flags = windowFlags();
flags |= Qt::CustomizeWindowHint;
//flags &= ~Qt::WindowContextHelpButtonHint;
//flags &= ~Qt::WindowSystemMenuHint;
//flags &= ~Qt::WindowMinMaxButtonsHint;
//flags |= Qt::WindowMinimizeButtonHint;
//flags &= ~Qt::WindowCloseButtonHint;
flags &= ~Qt::WindowContextHelpButtonHint;
//flags &= ~Qt::WindowSystemMenuHint;
setWindowFlags(flags);
this->setWindowTitle(tr("Sandboxie-Plus - Recovery Log"));
QGridLayout* pLayout = new QGridLayout();
//pLayout->setMargin(3);
m_pRecoveryLog = new CPanelWidgetEx();
//m_pRecoveryLog->GetView()->setItemDelegate(theGUI->GetItemDelegate());
((QTreeWidgetEx*)m_pRecoveryLog->GetView())->setHeaderLabels(tr("Time|Box Name|File Path").split("|"));
QAction* pAction = new QAction(tr("Cleanup Recovery Log"));
connect(pAction, SIGNAL(triggered()), m_pRecoveryLog->GetTree(), SLOT(clear()));
m_pRecoveryLog->GetMenu()->insertAction(m_pRecoveryLog->GetMenu()->actions()[0], pAction);
m_pRecoveryLog->GetMenu()->insertSeparator(m_pRecoveryLog->GetMenu()->actions()[0]);
m_pRecoveryLog->GetView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pRecoveryLog->GetView()->setSortingEnabled(false);
connect(m_pRecoveryLog->GetTree(), SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnDblClick(QTreeWidgetItem*)));
pLayout->addWidget(new QLabel(tr("the following files were recently recoered and moved oout of a sandbox.")), 0, 0);
pLayout->addWidget(m_pRecoveryLog, 1, 0);
this->setLayout(pLayout);
restoreGeometry(theConf->GetBlob("RecoveryLogWindow/Window_Geometry"));
}
CRecoveryLogWnd::~CRecoveryLogWnd()
{
theConf->SetBlob("RecoveryLogWindow/Window_Geometry", saveGeometry());
}
void CRecoveryLogWnd::closeEvent(QCloseEvent *e)
{
emit Closed();
//this->deleteLater();
}
void CRecoveryLogWnd::OnDblClick(QTreeWidgetItem* pItem)
{
ShellExecute(NULL, NULL, L"explorer.exe", (L"/select,\"" + pItem->text(2).toStdWString() + L"\"").c_str(), NULL, SW_SHOWNORMAL);
}
void CSandMan::OnRecoveryLog()
{
if (!m_pRecoveryLogWnd->isVisible()) {
bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false);
m_pRecoveryLogWnd->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop);
SafeShow(m_pRecoveryLogWnd);
}
}

View File

@ -1,69 +1,60 @@
#include "stdafx.h"
#include "FileBrowserWindow.h"
#include "FileView.h"
#include "SandMan.h"
#include "../MiscHelpers/Common/Settings.h"
#include "../MiscHelpers/Common/TreeItemModel.h"
#include "../MiscHelpers/Common/OtherFunctions.h"
#include "../QSbieAPI/SbieUtils.h"
CFileBrowserWindow::CFileBrowserWindow(const CSandBoxPtr& pBox, QWidget *parent)
: QDialog(parent)
CFileView::CFileView(QWidget *parent)
: QWidget(parent)
{
Qt::WindowFlags flags = windowFlags();
flags |= Qt::CustomizeWindowHint;
//flags &= ~Qt::WindowContextHelpButtonHint;
//flags &= ~Qt::WindowSystemMenuHint;
//flags &= ~Qt::WindowMinMaxButtonsHint;
flags |= Qt::WindowMinimizeButtonHint;
//flags &= ~Qt::WindowCloseButtonHint;
setWindowFlags(flags);
m_pMainLayout = new QGridLayout();
m_pMainLayout->setMargin(0);
this->setLayout(m_pMainLayout);
bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false);
this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop);
ui.setupUi(this);
this->setWindowTitle(tr("%1 - Files").arg(pBox->GetName()));
m_pBox = pBox;
m_pTreeView = new QTreeView();
m_pMainLayout->addWidget(m_pTreeView, 0, 0);
m_pFileModel = new QFileSystemModel(this);
m_pFileModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::System);
m_pFileModel->setRootPath(pBox->GetFileRoot());
ui.treeFiles->setModel(m_pFileModel);
ui.treeFiles->setRootIndex(m_pFileModel->setRootPath(pBox->GetFileRoot()));
ui.treeFiles->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pTreeView->setModel(m_pFileModel);
m_pTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
#ifdef WIN32
QStyle* pStyle = QStyleFactory::create("windows");
ui.treeFiles->setStyle(pStyle);
m_pTreeView->setStyle(pStyle);
#endif
ui.treeFiles->setExpandsOnDoubleClick(false);
m_pTreeView->setExpandsOnDoubleClick(false);
ui.treeFiles->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui.treeFiles, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnFileMenu(const QPoint &)));
connect(ui.treeFiles, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OnFileDblClick(const QModelIndex &)));
m_pTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pTreeView, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnFileMenu(const QPoint &)));
connect(m_pTreeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OnFileDblClick(const QModelIndex &)));
//statusBar();
restoreGeometry(theConf->GetBlob("FileBrowserWindow/Window_Geometry"));
QByteArray Columns = theConf->GetBlob("FileBrowserWindow/FileTree_Columns");
QByteArray Columns = theConf->GetBlob("MainWindow/FileTree_Columns");
if (!Columns.isEmpty())
ui.treeFiles->header()->restoreState(Columns);
m_pTreeView->header()->restoreState(Columns);
}
CFileBrowserWindow::~CFileBrowserWindow()
CFileView::~CFileView()
{
theConf->SetBlob("FileBrowserWindow/Window_Geometry",saveGeometry());
theConf->SetBlob("FileBrowserWindow/FileTree_Columns", ui.treeFiles->header()->saveState());
theConf->SetBlob("MainWindow/FileTree_Columns", m_pTreeView->header()->saveState());
}
void CFileBrowserWindow::closeEvent(QCloseEvent *e)
void CFileView::SetBox(const CSandBoxPtr& pBox)
{
emit Closed();
this->deleteLater();
m_pBox = pBox;
QString Root;
if (!pBox.isNull()) {
Root = pBox->GetFileRoot();
QDir().mkpath(Root);
}
else
Root = theAPI->GetSbiePath();
//m_pFileModel->setRootPath(Root);
m_pTreeView->setRootIndex(m_pFileModel->setRootPath(Root));
}
#include <windows.h>
#include <Shlobj.h>
#include <atlbase.h>
@ -126,15 +117,15 @@ int openShellContextMenu(const QStringList& Files, void * parentWindow)
{
addSeparatorToShellContextMenu(hMenu);
std::wstring Str1 = CFileBrowserWindow::tr("Create Shortcut").toStdWString();
std::wstring Str1 = CFileView::tr("Create Shortcut").toStdWString();
if (Files.count() == 1) {
addItemToShellContextMenu(hMenu, Str1.c_str(), MENU_CREATE_SHORTCUT);
addSeparatorToShellContextMenu(hMenu);
}
std::wstring Str2 = CFileBrowserWindow::tr("Recover to Any Folder").toStdWString();
std::wstring Str2 = CFileView::tr("Recover to Any Folder").toStdWString();
addItemToShellContextMenu(hMenu, Str2.c_str(), MENU_RECOVER_TO_ANY);
std::wstring Str3 = CFileBrowserWindow::tr("Recover to Same Folder").toStdWString();
std::wstring Str3 = CFileView::tr("Recover to Same Folder").toStdWString();
addItemToShellContextMenu(hMenu, Str3.c_str(), MENU_RECOVER);
POINT point;
@ -163,10 +154,10 @@ int openShellContextMenu(const QStringList& Files, void * parentWindow)
}
void CFileBrowserWindow::OnFileMenu(const QPoint&)
void CFileView::OnFileMenu(const QPoint&)
{
QStringList Files;
foreach(const QModelIndex & Index, ui.treeFiles->selectionModel()->selectedIndexes()) {
foreach(const QModelIndex & Index, m_pTreeView->selectionModel()->selectedIndexes()) {
QString BoxedPath = m_pFileModel->fileInfo(Index).absoluteFilePath().replace("/", "\\");
if (m_pFileModel->fileInfo(Index).isDir())
BoxedPath += "\\";
@ -194,7 +185,7 @@ void CFileBrowserWindow::OnFileMenu(const QPoint&)
switch (iCmd)
{
case MENU_RECOVER_TO_ANY:
RecoveryFolder = QFileDialog::getExistingDirectory(this, CFileBrowserWindow::tr("Select Directory")).replace("/", "\\");
RecoveryFolder = QFileDialog::getExistingDirectory(this, CFileView::tr("Select Directory")).replace("/", "\\");
if (RecoveryFolder.isEmpty())
break;
case MENU_RECOVER:
@ -256,9 +247,52 @@ void CFileBrowserWindow::OnFileMenu(const QPoint&)
}
void CFileBrowserWindow::OnFileDblClick(const QModelIndex &)
void CFileView::OnFileDblClick(const QModelIndex &)
{
QString BoxedPath = m_pFileModel->fileInfo(ui.treeFiles->currentIndex()).absoluteFilePath();
QString BoxedPath = m_pFileModel->fileInfo(m_pTreeView->currentIndex()).absoluteFilePath();
ShellExecute(NULL, NULL, BoxedPath.toStdWString().c_str(), NULL, m_pBox->GetFileRoot().toStdWString().c_str(), SW_SHOWNORMAL);
}
////////////////////////////////////////////////////////////////////////////////////////
// CFileBrowserWindow
CFileBrowserWindow::CFileBrowserWindow(const CSandBoxPtr& pBox, QWidget *parent)
: QDialog(parent)
{
Qt::WindowFlags flags = windowFlags();
flags |= Qt::CustomizeWindowHint;
//flags &= ~Qt::WindowContextHelpButtonHint;
//flags &= ~Qt::WindowSystemMenuHint;
//flags &= ~Qt::WindowMinMaxButtonsHint;
flags |= Qt::WindowMinimizeButtonHint;
//flags &= ~Qt::WindowCloseButtonHint;
setWindowFlags(flags);
bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false);
this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop);
m_pMainLayout = new QGridLayout(this);
m_FileView = new CFileView();
m_FileView->SetBox(pBox);
m_pMainLayout->addWidget(m_FileView, 0, 0);
this->setWindowTitle(tr("%1 - Files").arg(pBox->GetName()));
//statusBar();
restoreGeometry(theConf->GetBlob("FileBrowserWindow/Window_Geometry"));
}
CFileBrowserWindow::~CFileBrowserWindow()
{
theConf->SetBlob("FileBrowserWindow/Window_Geometry",saveGeometry());
}
void CFileBrowserWindow::closeEvent(QCloseEvent *e)
{
emit Closed();
this->deleteLater();
}

View File

@ -0,0 +1,59 @@
#pragma once
//#include "../../MiscHelpers/Common/PanelView.h"
#include "../../MiscHelpers/Common/TreeviewEx.h"
#include "SbiePlusAPI.h"
#include <QFileSystemModel>
class CFileView : public QWidget
{
Q_OBJECT
public:
CFileView(QWidget *parent = Q_NULLPTR);
~CFileView();
void SetBox(const CSandBoxPtr& pBox);
const CSandBoxPtr& GetBox() const { return m_pBox; }
private slots:
void OnFileMenu(const QPoint &);
void OnFileDblClick(const QModelIndex &);
protected:
CSandBoxPtr m_pBox;
private:
QGridLayout* m_pMainLayout;
QTreeView* m_pTreeView;
QFileSystemModel* m_pFileModel;
};
////////////////////////////////////////////////////////////////////////////////////////
// CFileBrowserWindow
class CFileBrowserWindow : public QDialog
{
Q_OBJECT
public:
CFileBrowserWindow(const CSandBoxPtr& pBox, QWidget *parent = Q_NULLPTR);
~CFileBrowserWindow();
virtual void accept() {}
virtual void reject() { this->close(); }
signals:
void Closed();
protected:
void closeEvent(QCloseEvent *e);
private:
QGridLayout* m_pMainLayout;
CFileView* m_FileView;
};

View File

@ -11,7 +11,7 @@
#include "../../MiscHelpers/Common/CheckableMessageBox.h"
#include "../Windows/RecoveryWindow.h"
#include "../Windows/NewBoxWindow.h"
#include "../Windows/FileBrowserWindow.h"
#include "../Views/FileView.h"
#include "qt_windows.h"
#include "qwindowdefs_win.h"
@ -157,8 +157,9 @@ void CSbieView::CreateMenu()
m_iMenuRun = m_pMenuRun->actions().count();
m_pMenuEmptyBox = m_pMenu->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Programs"), this, SLOT(OnSandBoxAction()));
m_pMenu->addSeparator();
m_pMenuBrowse = m_pMenu->addAction(CSandMan::GetIcon("Tree"), tr("Browse Content"), this, SLOT(OnSandBoxAction()));
m_pMenuContent = m_pMenu->addMenu(CSandMan::GetIcon("Compatibility"), tr("Box Content"));
m_pMenuBrowse = m_pMenuContent->addAction(CSandMan::GetIcon("Tree"), tr("Browse Files"), this, SLOT(OnSandBoxAction()));
m_pMenuContent->addSeparator();
m_pMenuRefresh = m_pMenuContent->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh Info"), this, SLOT(OnSandBoxAction()));
m_pMenuMkLink = m_pMenuContent->addAction(CSandMan::GetIcon("MkLink"), tr("Create Shortcut"), this, SLOT(OnSandBoxAction()));
m_pMenuContent->addSeparator();

View File

@ -629,6 +629,9 @@ CTraceWindow::CTraceWindow(QWidget *parent)
this->setWindowTitle(tr("Sandboxie-Plus - Trace Monitor"));
bool bAlwaysOnTop = theConf->GetBool("Options/AlwaysOnTop", false);
this->setWindowFlag(Qt::WindowStaysOnTopHint, bAlwaysOnTop);
QGridLayout* pLayout = new QGridLayout();
pLayout->setMargin(3);
pLayout->addWidget(new CTraceView(true, this), 0, 0);
@ -641,7 +644,7 @@ CTraceWindow::~CTraceWindow()
{
theConf->SetBlob("TraceWindow/Window_Geometry", saveGeometry());
theAPI->EnableMonitor(false);
if(!theAPI) theAPI->EnableMonitor(false);
}
void CTraceWindow::closeEvent(QCloseEvent *e)

View File

@ -1,35 +0,0 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_FileBrowserWindow.h"
#include "SbiePlusAPI.h"
#include <QFileSystemModel>
class CFileBrowserWindow : public QDialog
{
Q_OBJECT
public:
CFileBrowserWindow(const CSandBoxPtr& pBox, QWidget *parent = Q_NULLPTR);
~CFileBrowserWindow();
virtual void accept() {}
virtual void reject() { this->close(); }
signals:
void Closed();
private slots:
void OnFileMenu(const QPoint &);
void OnFileDblClick(const QModelIndex &);
protected:
void closeEvent(QCloseEvent *e);
CSandBoxPtr m_pBox;
private:
Ui::FileBrowserWindow ui;
QFileSystemModel* m_pFileModel;
};

View File

@ -107,6 +107,7 @@ using namespace std;
#include <QToolButton>
#include <QScreen>
#include <QRadioButton>
#include <QGridLayout>
// other includes