This commit is contained in:
DavidXanatos 2022-09-01 19:29:07 +02:00
parent 6e18b9807e
commit 42560dbe2c
6 changed files with 83 additions and 46 deletions

View File

@ -4,6 +4,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.3.3 / 5.58.3] - 2022-08-??
### Fixed
- fixed issues with group moving drag and drop
- approved more requied sys calls
- fixed issues when deleting box content and the view files panel is open
## [1.3.2 / 5.58.2] - 2022-08-30
### Added

View File

@ -3652,6 +3652,10 @@ ApproveWinNtSysCall=DeviceIoControlFile
ApproveWinNtSysCall=QueryAttributesFile
ApproveWinNtSysCall=QueryFullAttributesFile
# Windows Notification Facility
ApproveWinNtSysCall=SubscribeWnfStateChange
ApproveWinNtSysCall=UnsubscribeWnfStateChange
# token stuff
ApproveWinNtSysCall=DuplicateToken

View File

@ -197,10 +197,10 @@ CSandMan::CSandMan(QWidget *parent)
connect(m_pHotkeyManager, SIGNAL(activated(size_t)), SLOT(OnHotKey(size_t)));
SetupHotKeys();
for (int i = 0; i < eMaxColor; i++) {
m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i));
m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i));
}
//for (int i = 0; i < eMaxColor; i++) {
// m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i));
// m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i));
//}
m_BoxColors[CSandBoxPlus::eHardenedPlus] = qRgb(238,35,4);
m_BoxColors[CSandBoxPlus::eHardened] = qRgb(247,125,2);
@ -850,6 +850,7 @@ void CSandMan::UpdateLabel()
void CSandMan::CreateView(int iViewMode)
{
m_pBoxView = new CSbieView();
connect(m_pBoxView, SIGNAL(BoxSelected()), this, SLOT(OnBoxSelected()));
m_pFileView = new CFileView();
if (iViewMode != 1)
@ -869,6 +870,7 @@ void CSandMan::CreateView(int iViewMode)
pFileLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0, 1, 1);
m_pBoxCombo = new QComboBox();
connect(m_pBoxCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBoxSelected()));
pFileLayout->addWidget(m_pBoxCombo, 0, 1);
pFileLayout->addWidget(m_pFileView, 1, 0, 1, 2);
@ -1046,11 +1048,11 @@ void CSandMan::closeEvent(QCloseEvent *e)
QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
{
EBoxColors color = eYellow;
//EBoxColors color = eYellow;
int iViewMode = theConf->GetInt("Options/ViewMode", 1);
if (iViewMode != 2) {
//return GetColorIcon(m_BoxColors[boxType], inUse);
switch (boxType) {
return GetColorIcon(m_BoxColors[boxType], inUse);
/*switch (boxType) {
case CSandBoxPlus::eHardenedPlus: color = eRed; break;
case CSandBoxPlus::eHardened: color = eOrang; break;
case CSandBoxPlus::eDefaultPlus: color = eBlue; break;
@ -1059,13 +1061,14 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
case CSandBoxPlus::eAppBox: color = eGreen; break;
case CSandBoxPlus::eInsecure: color = eMagenta; break;
case CSandBoxPlus::eOpen: color = eWhite; break;
}
}*/
}
//if (inBusy)
// return m_BoxIcons[color].Busy;
if (inUse)
/*if (inUse)
return m_BoxIcons[color].InUse;
return m_BoxIcons[color].Empty;
return m_BoxIcons[color].Empty;*/
return GetColorIcon(m_BoxColors[CSandBoxPlus::eDefault], inUse);
}
QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse)
@ -1107,6 +1110,7 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse)
if (hsv.h < 0) hsv.h += 360;
else if (hsv.h >= 360) hsv.h -= 360;
hsv.s = 1; // make the content always fully saturated
my_rgb rgb2 = hsv2rgb(hsv);
rgb = qRgb(rgb2.r, rgb2.g, rgb2.b);
@ -1288,30 +1292,6 @@ 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 && m_pFileView->isVisible() && boxes.count() == 1)
pBox = boxes.first();
}
// for old menu
if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) {
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()) {
@ -1417,6 +1397,33 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
}
}
void CSandMan::OnBoxSelected()
{
CSandBoxPtr pBox;
if (m_pPanelSplitter) {
QList<CSandBoxPtr> boxes = m_pBoxView->GetSelectedBoxes();
if (m_pPanelSplitter->sizes().at(1) > 0 && m_pFileView->isVisible() && boxes.count() == 1)
pBox = boxes.first();
}
// for vintage mode
if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) {
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());
}
}
SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots)
{
SB_STATUS Ret = SB_OK;

View File

@ -122,16 +122,18 @@ protected:
QMap<int, QRgb> m_BoxColors;
struct SBoxIcon {
QIcon Empty;
QIcon InUse;
//QIcon Busy;
};
QMap<int, SBoxIcon> m_BoxIcons;
//struct SBoxIcon {
// QIcon Empty;
// QIcon InUse;
// //QIcon Busy;
//};
//QMap<int, SBoxIcon> m_BoxIcons;
class UGlobalHotkeys* m_pHotkeyManager;
public slots:
void OnBoxSelected();
void OnMessage(const QString& MsgData);
void OnStatusChanged();

View File

@ -773,7 +773,7 @@ void CSbieView::OnGroupAction(QAction* Action)
if (List.isEmpty())
return;
m_Groups[""].removeAll(Name);
m_Groups[List.first()].append(Name);
}
else if (Action == m_pRenGroupe)
@ -841,11 +841,13 @@ void CSbieView::OnGroupAction(QAction* Action)
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
int pos = I->indexOf(Name);
if (pos != -1) {
if ((Offset < 0 && pos > Offset + 1) ||(Offset > 0 && pos < I->count() - Offset)){
QString Temp = I.value()[pos+Offset];
I.value()[pos+Offset] = I.value()[pos];
if ((Offset < 0 && pos > Offset + 1) || (Offset > 0 && pos < I->count() - Offset)) {
QString Temp = I.value()[pos + Offset];
I.value()[pos + Offset] = I.value()[pos];
I.value()[pos] = Temp;
}
else // out of bounds
QApplication::beep();
bFound = true;
break;
}
@ -896,8 +898,15 @@ bool CSbieView::MoveItem(const QString& Name, const QString& To, int pos)
// remove from old
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
if (I.value().removeAll(Name))
From = I.key();
for (int i = 0; i < I.value().count(); i++) {
if (I.value().at(i) == Name) {
I.value().removeAt(i);
From = I.key();
if(From == To && i < pos)
pos--;
break;
}
}
}
// add to new
@ -1534,6 +1543,8 @@ void CSbieView::ProcessSelection(const QItemSelection& selected, const QItemSele
}
selectionModel->select(invalid, QItemSelectionModel::Deselect);
emit BoxSelected();
}
QList<CSandBoxPtr> CSbieView::GetSelectedBoxes()

View File

@ -33,6 +33,9 @@ public:
QMap<QString, QStringList> GetGroups() { return m_Groups; }
signals:
void BoxSelected();
public slots:
void Clear();
void Refresh();