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 ## [1.3.2 / 5.58.2] - 2022-08-30
### Added ### Added

View File

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

View File

@ -197,10 +197,10 @@ CSandMan::CSandMan(QWidget *parent)
connect(m_pHotkeyManager, SIGNAL(activated(size_t)), SLOT(OnHotKey(size_t))); connect(m_pHotkeyManager, SIGNAL(activated(size_t)), SLOT(OnHotKey(size_t)));
SetupHotKeys(); SetupHotKeys();
for (int i = 0; i < eMaxColor; i++) { //for (int i = 0; i < eMaxColor; i++) {
m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i)); // m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i));
m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%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::eHardenedPlus] = qRgb(238,35,4);
m_BoxColors[CSandBoxPlus::eHardened] = qRgb(247,125,2); m_BoxColors[CSandBoxPlus::eHardened] = qRgb(247,125,2);
@ -850,6 +850,7 @@ void CSandMan::UpdateLabel()
void CSandMan::CreateView(int iViewMode) void CSandMan::CreateView(int iViewMode)
{ {
m_pBoxView = new CSbieView(); m_pBoxView = new CSbieView();
connect(m_pBoxView, SIGNAL(BoxSelected()), this, SLOT(OnBoxSelected()));
m_pFileView = new CFileView(); m_pFileView = new CFileView();
if (iViewMode != 1) 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); pFileLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0, 1, 1);
m_pBoxCombo = new QComboBox(); m_pBoxCombo = new QComboBox();
connect(m_pBoxCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBoxSelected()));
pFileLayout->addWidget(m_pBoxCombo, 0, 1); pFileLayout->addWidget(m_pBoxCombo, 0, 1);
pFileLayout->addWidget(m_pFileView, 1, 0, 1, 2); 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) QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
{ {
EBoxColors color = eYellow; //EBoxColors color = eYellow;
int iViewMode = theConf->GetInt("Options/ViewMode", 1); int iViewMode = theConf->GetInt("Options/ViewMode", 1);
if (iViewMode != 2) { if (iViewMode != 2) {
//return GetColorIcon(m_BoxColors[boxType], inUse); return GetColorIcon(m_BoxColors[boxType], inUse);
switch (boxType) { /*switch (boxType) {
case CSandBoxPlus::eHardenedPlus: color = eRed; break; case CSandBoxPlus::eHardenedPlus: color = eRed; break;
case CSandBoxPlus::eHardened: color = eOrang; break; case CSandBoxPlus::eHardened: color = eOrang; break;
case CSandBoxPlus::eDefaultPlus: color = eBlue; 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::eAppBox: color = eGreen; break;
case CSandBoxPlus::eInsecure: color = eMagenta; break; case CSandBoxPlus::eInsecure: color = eMagenta; break;
case CSandBoxPlus::eOpen: color = eWhite; break; case CSandBoxPlus::eOpen: color = eWhite; break;
} }*/
} }
//if (inBusy) //if (inBusy)
// return m_BoxIcons[color].Busy; // return m_BoxIcons[color].Busy;
if (inUse) /*if (inUse)
return m_BoxIcons[color].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) 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; if (hsv.h < 0) hsv.h += 360;
else if (hsv.h >= 360) 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); my_rgb rgb2 = hsv2rgb(hsv);
rgb = qRgb(rgb2.r, rgb2.g, rgb2.b); rgb = qRgb(rgb2.r, rgb2.g, rgb2.b);
@ -1288,30 +1292,6 @@ void CSandMan::timerEvent(QTimerEvent* pEvent)
m_pTraceView->setEnabled(bIsMonitoring); 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(); QMap<quint32, CBoxedProcessPtr> Processes = theAPI->GetAllProcesses();
int ActiveProcesses = 0; int ActiveProcesses = 0;
if (KeepTerminated()) { 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 CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots)
{ {
SB_STATUS Ret = SB_OK; SB_STATUS Ret = SB_OK;

View File

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

View File

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

View File

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