This commit is contained in:
DavidXanatos 2022-07-10 18:28:10 +02:00
parent 1db1fa3524
commit 990bb00369
27 changed files with 567 additions and 345 deletions

View File

@ -330,6 +330,47 @@ bool ReadFromDevice(QIODevice* dev, char* data, int len, int timeout)
return dev->read(data, len) == len;
}
uint8_t clamp(float v) //define a function to bound and round the input float value to 0-255
{
if (v < 0)
return 0;
if (v > 255)
return 255;
return (uint8_t)v;
}
// http://beesbuzz.biz/code/16-hsv-color-transforms
QRgb change_hsv_c(QRgb rgb, float fHue, float fSat, float fVal)
{
float in_r = qRed(rgb);
float in_g = qGreen(rgb);
float in_b = qBlue(rgb);
const float cosA = fSat*cos(fHue*3.14159265f/180); //convert degrees to radians
const float sinA = fSat*sin(fHue*3.14159265f/180); //convert degrees to radians
//helpers for faster calc //first 2 could actually be precomputed
const float aThird = 1.0f/3.0f;
const float rootThird = sqrtf(aThird);
const float oneMinusCosA = (1.0f - cosA);
const float aThirdOfOneMinusCosA = aThird * oneMinusCosA;
const float rootThirdTimesSinA = rootThird * sinA;
const float plus = aThirdOfOneMinusCosA +rootThirdTimesSinA;
const float minus = aThirdOfOneMinusCosA -rootThirdTimesSinA;
//calculate the rotation matrix
float matrix[3][3] = {
{ cosA + oneMinusCosA / 3.0f , minus , plus },
{ plus , cosA + aThirdOfOneMinusCosA , minus },
{ minus , plus , cosA + aThirdOfOneMinusCosA }
};
//Use the rotation matrix to convert the RGB directly
float out_r = clamp((in_r*matrix[0][0] + in_g*matrix[0][1] + in_b*matrix[0][2])*fVal);
float out_g = clamp((in_r*matrix[1][0] + in_g*matrix[1][1] + in_b*matrix[1][2])*fVal);
float out_b = clamp((in_r*matrix[2][0] + in_g*matrix[2][1] + in_b*matrix[2][2])*fVal);
return qRgb(out_r, out_g, out_b);
}
void GrayScale (QImage& Image)
{

View File

@ -84,7 +84,7 @@ private:
MISCHELPERS_EXPORT bool ReadFromDevice(QIODevice* dev, char* data, int len, int timeout = 5000);
QRgb MISCHELPERS_EXPORT change_hsv_c(QRgb rgb, float fHue, float fSat, float fVal);
MISCHELPERS_EXPORT void GrayScale (QImage& Image);
MISCHELPERS_EXPORT QIcon MakeNormalAndGrayIcon(QIcon Icon);

View File

@ -187,7 +187,44 @@
<layout class="QGridLayout" name="gridLayout_14">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<item row="11" column="0">
<item row="11" column="1" colspan="2">
<widget class="QComboBox" name="cmbOnClose"/>
</item>
<item row="4" column="1" colspan="3">
<widget class="QCheckBox" name="chkShellMenu">
<property name="text">
<string>Add 'Run Sandboxed' to the explorer context menu</string>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QCheckBox" name="chkCompactTray">
<property name="text">
<string>Use Compact Box List</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QComboBox" name="cmbTrayBoxes"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Run Sandboxed - Actions</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Show Icon in Systray:</string>
@ -200,60 +237,17 @@
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QCheckBox" name="chkAlwaysDefault">
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Always use DefaultBox</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QComboBox" name="cmbSysTray"/>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="15" column="3" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="2" colspan="3">
<widget class="QCheckBox" name="chkShellMenu2">
<property name="text">
<string>Add 'Run Un-Sandboxed' to the context menu</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QCheckBox" name="chkShellMenu">
<property name="text">
<string>Add 'Run Sandboxed' to the explorer context menu</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="chkSvcStart">
<property name="text">
<string>Start UI when a sandboxed process is started</string>
<string>Systray options</string>
</property>
</widget>
</item>
@ -270,7 +264,40 @@
</property>
</spacer>
</item>
<item row="15" column="1">
<item row="12" column="3" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="chkBoxOpsNotify">
<property name="text">
<string>Show a tray notification when automatic box operations are started</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Show boxes in tray list:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -283,92 +310,26 @@
</property>
</spacer>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
<item row="3" column="2">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>Start Menu Integration</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="12" column="1" colspan="2">
<widget class="QComboBox" name="cmbTrayBoxes"/>
<item row="8" column="1" colspan="2">
<widget class="QComboBox" name="cmbSysTray"/>
</item>
<item row="13" column="1" colspan="3">
<widget class="QCheckBox" name="chkBoxOpsNotify">
<item row="5" column="2" colspan="3">
<widget class="QCheckBox" name="chkAlwaysDefault">
<property name="text">
<string>Show a tray notification when automatic box operations are started</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Run Sandboxed - Actions</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="chkScanMenu">
<property name="text">
<string>Scan shell folders and offer links in run menu</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>On main window close:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Systray options</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="chkAutoStart">
<property name="text">
<string>Start UI with Windows</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Show boxes in tray list:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<string>Always use DefaultBox</string>
</property>
</widget>
</item>
@ -386,24 +347,36 @@
</property>
</widget>
</item>
<item row="14" column="1" colspan="2">
<widget class="QComboBox" name="cmbOnClose"/>
</item>
<item row="9" column="0" colspan="2">
<widget class="QLabel" name="label_22">
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="chkAutoStart">
<property name="text">
<string>Integrate boxes with Host Start Menu</string>
<string>Start UI with Windows</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>On main window close:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</widget>
</item>
<item row="6" column="2" colspan="3">
<widget class="QCheckBox" name="chkShellMenu2">
<property name="text">
<string>Add 'Run Un-Sandboxed' to the context menu</string>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QComboBox" name="cmbIntegrateMenu"/>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="chkSvcStart">
<property name="text">
<string>Start UI when a sandboxed process is started</string>
</property>
</widget>
</item>
</layout>
</item>
@ -416,10 +389,10 @@
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_15">
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="chkNoIcons">
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkBackground">
<property name="text">
<string>Don't show icons in menus *</string>
<string>Show &quot;Pizza&quot; Background in box list*</string>
</property>
<property name="tristate">
<bool>true</bool>
@ -433,36 +406,30 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkBackground">
<item row="10" column="2" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Show &quot;Pizza&quot; Background in box list*</string>
<string>* indetermined means depanding on the view mode</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QCheckBox" name="chkColorIcons">
<property name="text">
<string>Make Box Icons match the Border Color</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="chkOptTree">
<property name="text">
<string>Use a Page Tree in the Box Options instead of Nested Tabs *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkLargeIcons">
<property name="text">
<string>Use large icons in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="cmbFontScale">
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="cmbDPI"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
@ -477,13 +444,29 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Font Scaling</string>
<item row="9" column="1">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="cmbDPI"/>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkLargeIcons">
<property name="text">
<string>Use large icons in box list *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
@ -497,6 +480,23 @@
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="cmbFontScale">
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="chkNoIcons">
<property name="text">
<string>Don't show icons in menus *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkDarkTheme">
<property name="text">
@ -507,7 +507,17 @@
</property>
</widget>
</item>
<item row="8" column="3">
<item row="8" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Font Scaling</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="3">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -520,36 +530,6 @@
</property>
</spacer>
</item>
<item row="8" column="1">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="2" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>* indetermined means depanding on the view mode</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="chkOptTree">
<property name="text">
<string>Use a Page Tree in the Box Options instead of Nested Tabs *</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -116,8 +116,11 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
QHash<QVariant, STreeNode*> Old = m_Map;
bool bGroupsFirst = theConf->GetBool("Options/SortGroupsFirst", false);
bool bWatchSize = theConf->GetBool("Options/WatchBoxSize", false);
bool ColorIcons = theConf->GetBool("Options/ColorBoxIcons", false);
bool bPlus = (theAPI->GetFeatureFlags() & CSbieAPI::eSbieFeatureCert) != 0;
if (theConf->GetInt("Options/ViewMode", 1) == 2)
bPlus = false;
foreach(const QString& Group, Groups.keys())
{
@ -139,7 +142,7 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
New[pNode->Path].append(pNode);
Added.append(ID);
QIcon Icon = theGUI->GetBoxIcon(CSandBoxPlus::eDefault, false);
QIcon Icon = QIcon(bPlus ? ":/Boxes/Group2" : ":/Boxes/Group"); // theGUI->GetBoxIcon(CSandBoxPlus::eDefault, false);
if (m_LargeIcons) // but not for boxes
Icon = QIcon(Icon.pixmap(QSize(32,32)).scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
pNode->Icon = Icon;
@ -214,14 +217,19 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
bool inUse = Sync(pBox, pNode->Path, ProcessList, New, Old, Added);
bool Busy = pBoxEx->IsBusy();
int boxType = pBoxEx->GetType();
int boxColor = pBoxEx->GetColor();
QIcon Icon;
if (pNode->inUse != inUse || (pNode->busyState || Busy) || pNode->boxType != boxType)
if (pNode->inUse != inUse || (pNode->busyState || Busy) || pNode->boxType != boxType || pNode->boxColor != boxColor)
{
pNode->inUse = inUse;
pNode->boxType = boxType;
pNode->boxColor = boxColor;
//pNode->Icon = pNode->inUse ? m_BoxInUse : m_BoxEmpty;
Icon = theGUI->GetBoxIcon(boxType, inUse);
if(ColorIcons)
Icon = theGUI->GetColorIcon(boxColor, inUse);
else
Icon = theGUI->GetBoxIcon(boxType, inUse);
}
if (!Icon.isNull()) {

View File

@ -65,12 +65,13 @@ protected:
struct SSandBoxNode: STreeNode
{
SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = false; busyState = 0; boxType = -1; OrderNumber = 0; }
SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = false; busyState = 0; boxType = -1; boxColor = 0; OrderNumber = 0; }
CSandBoxPtr pBox;
bool inUse;
int busyState;
int boxType;
int boxColor;
int OrderNumber;
CBoxedProcessPtr pProcess;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

View File

@ -90,6 +90,13 @@
<file alias="Empty6">Boxes/sandbox-o-empty.png</file>
<file alias="Full6">Boxes/sandbox-o-full.png</file>
<file alias="Busy">Boxes/BusyOverlay.png</file>
<file alias="Frame">Boxes/sandbox-frame.png</file>
<file alias="Items">Boxes/sandbox-items.png</file>
<file alias="Sand">Boxes/sandbox-sand.png</file>
<file alias="Empty7">Boxes/sandbox-w-empty.png</file>
<file alias="Full7">Boxes/sandbox-w-full.png</file>
<file alias="Group">Boxes/sandbox-group.png</file>
<file alias="Group2">Boxes/sandbox-group+.png</file>
</qresource>
<qresource prefix="/Assets">
<file>Advanced.png</file>

View File

@ -148,9 +148,18 @@ CSandMan::CSandMan(QWidget *parent)
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_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);
m_BoxColors[CSandBoxPlus::eDefaultPlus] = qRgb(1,133,248);
m_BoxColors[CSandBoxPlus::eDefault] = qRgb(246,246,2);
m_BoxColors[CSandBoxPlus::eAppBoxPlus] = qRgb(3,232,232);
m_BoxColors[CSandBoxPlus::eAppBox] = qRgb(0,253,0);
m_BoxColors[CSandBoxPlus::eInsecure] = qRgb(244,3,244);
m_BoxColors[CSandBoxPlus::eOpen] = qRgb(255,255,255);
CreateTrayIcon();
LoadState();
@ -312,7 +321,7 @@ void CSandMan::CreateViewBaseMenu()
m_pViewMode = new QActionGroup(m_pMenuView);
MakeAction(m_pViewMode, m_pMenuView, tr("Simple View"), 0);
MakeAction(m_pViewMode, m_pMenuView, tr("Advanced View"), 1);
MakeAction(m_pViewMode, m_pMenuView, tr("Classic View"), 2);
MakeAction(m_pViewMode, m_pMenuView, tr("Vintage View (like SbieCtrl)"), 2);
connect(m_pViewMode, SIGNAL(triggered(QAction*)), this, SLOT(OnViewMode(QAction*)));
m_pMenuView->addSeparator();
@ -511,6 +520,8 @@ void CSandMan::CreateOldMenus()
m_pSandbox = menuBar()->addMenu(tr("&Sandbox"));
connect(m_pSandbox, SIGNAL(hovered(QAction*)), this, SLOT(OnBoxMenuHover(QAction*)));
m_pSandbox->addSeparator();
m_pNewBox = m_pSandbox->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnSandBoxAction()));
m_pNewGroup = m_pSandbox->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnSandBoxAction()));
@ -775,6 +786,7 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
EBoxColors color = eYellow;
int iViewMode = theConf->GetInt("Options/ViewMode", 1);
if (iViewMode != 2) {
//return GetColorIcon(m_BoxColors[boxType], inUse);
switch (boxType) {
case CSandBoxPlus::eHardenedPlus: color = eRed; break;
case CSandBoxPlus::eHardened: color = eOrang; break;
@ -783,6 +795,7 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
case CSandBoxPlus::eAppBoxPlus: color = eCyan; break;
case CSandBoxPlus::eAppBox: color = eGreen; break;
case CSandBoxPlus::eInsecure: color = eMagenta; break;
case CSandBoxPlus::eOpen: color = eWhite; break;
}
}
//if (inBusy)
@ -792,6 +805,46 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy)
return m_BoxIcons[color].Empty;
}
QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse)
{
static QPixmap Sand;
if(Sand.isNull())
Sand = QPixmap(":/Boxes/Sand");
static QPixmap Frame;
if(Frame.isNull())
Frame = QPixmap(":/Boxes/Frame");
static QPixmap Items;
if(Items.isNull())
Items = QPixmap(":/Boxes/Items");
QRgb rgb = boxColor.rgba();
QImage MySand = Sand.toImage();
for (QRgb* c = (QRgb*)MySand.bits(); c != (QRgb*)(MySand.bits() + MySand.byteCount ()); c++) {
if(*c == 0xFFFFFFFF)
*c = rgb;
}
QPixmap result(32, 32);
result.fill(Qt::transparent); // force alpha channel
QPainter painter(&result);
painter.drawPixmap(0, 0, QPixmap::fromImage(MySand));
painter.drawPixmap(0, 0, Frame);
if (inUse)
{
rgb = change_hsv_c(rgb, -60, 2, 1); // yellow -> red
QImage MyItems = Items.toImage();
for (QRgb* c = (QRgb*)MyItems.bits(); c != (QRgb*)(MyItems.bits() + MyItems.byteCount()); c++) {
if (*c == 0xFF000000)
*c = rgb;
}
painter.drawPixmap(0, 0, QPixmap::fromImage(MyItems));
}
return QIcon(result);
}
QIcon CSandMan::MakeIconBusy(const QIcon& Icon, int Index)
{
static QPixmap overlay;
@ -1539,21 +1592,6 @@ void CSandMan::OnNotAuthorized(bool bLoginRequired, bool& bRetry)
LoginOpen = false;
}
void CSandMan::OnBoxMenu(const QPoint & point)
{
QPoint pos = ((QWidget*)m_pTrayBoxes->parent())->mapFromParent(point);
QTreeWidgetItem* pItem = m_pTrayBoxes->itemAt(pos);
if (!pItem)
return;
m_pTrayBoxes->setCurrentItem(pItem);
CTrayBoxesItemDelegate::m_Hold = true;
m_pBoxView->PopUpMenu(pItem->data(0, Qt::UserRole).toString());
CTrayBoxesItemDelegate::m_Hold = false;
//m_pBoxMenu->popup(QCursor::pos());
}
void CSandMan::OnBoxDblClick(QTreeWidgetItem* pItem)
{
m_pBoxView->ShowOptions(pItem->data(0, Qt::UserRole).toString());
@ -1863,7 +1901,7 @@ void CSandMan::OnSettings()
void CSandMan::UpdateSettings(bool bRebuildUI)
{
m_pTrayBoxes->clear(); // force refresh
if(m_pTrayBoxes) m_pTrayBoxes->clear(); // force refresh
//GetBoxView()->UpdateRunMenu();
@ -1896,7 +1934,8 @@ void CSandMan::UpdateSettings(bool bRebuildUI)
OnStatusChanged();
SetUITheme();
m_pTrayBoxes->setStyle(QStyleFactory::create(m_DefaultStyle));
if(m_pTrayBoxes) m_pTrayBoxes->setStyle(QStyleFactory::create(m_DefaultStyle));
}
}

View File

@ -62,6 +62,8 @@ public:
bool RunSandboxed(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString());
QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false);
QRgb GetBoxColor(int boxType) { return m_BoxColors[boxType]; }
QIcon GetColorIcon(QColor boxColor, bool inUse = false);
QIcon MakeIconBusy(const QIcon& Icon, int Index = 0);
QString GetBoxDescription(int boxType);
@ -116,9 +118,12 @@ protected:
eCyan,
eMagenta,
eOrang,
eWhite,
eMaxColor
};
QMap<int, QRgb> m_BoxColors;
struct SBoxIcon {
QIcon Empty;
QIcon InUse;
@ -172,6 +177,7 @@ public slots:
private slots:
void OnMenuHover(QAction* action);
void OnBoxMenuHover(QAction* action);
void OnSandBoxAction();
void OnEmptyAll();
@ -226,6 +232,7 @@ private:
void CreateView(bool bAdvanced);
void CreateTrayIcon();
void CreateTrayMenu();
void CreateBoxMenu(QMenu* pMenu, int iOffset = 0, int iSysTrayFilter = 0);
void HandleMaintenance(SB_RESULT(void*) Status);
@ -317,9 +324,9 @@ private:
QSystemTrayIcon* m_pTrayIcon;
QMenu* m_pTrayMenu;
QAction* m_pTraySeparator;
QWidgetAction* m_pTrayList;
QTreeWidget* m_pTrayBoxes;
int m_iTrayPos;
//QMenu* m_pBoxMenu;
bool m_bIconEmpty;
bool m_bIconDisabled;

View File

@ -48,46 +48,55 @@ void CSandMan::CreateTrayMenu()
pShowHide->setFont(f);
m_pTrayMenu->addSeparator();
m_pTrayList = new QWidgetAction(m_pTrayMenu);
m_iTrayPos = m_pTrayMenu->actions().count();
QWidget* pWidget = new CActionWidget();
QHBoxLayout* pLayout = new QHBoxLayout();
pLayout->setMargin(0);
pWidget->setLayout(pLayout);
if (!theConf->GetBool("Options/CompactTray", false))
{
m_pTrayBoxes = NULL;
connect(m_pTrayMenu, SIGNAL(hovered(QAction*)), this, SLOT(OnBoxMenuHover(QAction*)));
}
else
{
m_pTrayList = new QWidgetAction(m_pTrayMenu);
m_pTrayBoxes = new QTreeWidget();
QWidget* pWidget = new CActionWidget();
QHBoxLayout* pLayout = new QHBoxLayout();
pLayout->setMargin(0);
pWidget->setLayout(pLayout);
m_pTrayBoxes->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum);
m_pTrayBoxes->setRootIsDecorated(false);
//m_pTrayBoxes->setHeaderLabels(tr(" Sandbox").split("|"));
m_pTrayBoxes->setHeaderHidden(true);
m_pTrayBoxes->setSelectionMode(QAbstractItemView::NoSelection);
//m_pTrayBoxes->setSelectionMode(QAbstractItemView::ExtendedSelection);
//m_pTrayBoxes->setStyleSheet("QTreeView::item:hover{background-color:#FFFF00;}");
m_pTrayBoxes->setItemDelegate(new CTrayBoxesItemDelegate());
m_pTrayBoxes = new QTreeWidget();
m_pTrayBoxes->setStyle(QStyleFactory::create(m_DefaultStyle));
m_pTrayBoxes->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum);
m_pTrayBoxes->setRootIsDecorated(false);
//m_pTrayBoxes->setHeaderLabels(tr(" Sandbox").split("|"));
m_pTrayBoxes->setHeaderHidden(true);
m_pTrayBoxes->setSelectionMode(QAbstractItemView::NoSelection);
//m_pTrayBoxes->setSelectionMode(QAbstractItemView::ExtendedSelection);
//m_pTrayBoxes->setStyleSheet("QTreeView::item:hover{background-color:#FFFF00;}");
m_pTrayBoxes->setItemDelegate(new CTrayBoxesItemDelegate());
pLayout->insertSpacing(0, 1);// 32);
m_pTrayBoxes->setStyle(QStyleFactory::create(m_DefaultStyle));
/*QFrame* vFrame = new QFrame;
vFrame->setFixedWidth(1);
vFrame->setFrameShape(QFrame::VLine);
vFrame->setFrameShadow(QFrame::Raised);
pLayout->addWidget(vFrame);*/
pLayout->addWidget(m_pTrayBoxes);
pLayout->insertSpacing(0, 1);// 32);
m_pTrayList->setDefaultWidget(pWidget);
m_pTrayMenu->addAction(m_pTrayList);
//QFrame* vFrame = new QFrame;
//vFrame->setFixedWidth(1);
//vFrame->setFrameShape(QFrame::VLine);
//vFrame->setFrameShadow(QFrame::Raised);
//pLayout->addWidget(vFrame);
pLayout->addWidget(m_pTrayBoxes);
m_pTrayBoxes->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pTrayBoxes, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnBoxMenu(const QPoint &)));
connect(m_pTrayBoxes, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnBoxDblClick(QTreeWidgetItem*)));
//m_pBoxMenu
m_pTrayList->setDefaultWidget(pWidget);
m_pTrayMenu->addAction(m_pTrayList);
m_pTraySeparator = m_pTrayMenu->addSeparator();
m_pTrayBoxes->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pTrayBoxes, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnBoxMenu(const QPoint&)));
connect(m_pTrayBoxes, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnBoxDblClick(QTreeWidgetItem*)));
//m_pBoxMenu
}
m_pTrayMenu->addSeparator();
m_pTrayMenu->addAction(m_pEmptyAll);
m_pDisableForce2 = m_pTrayMenu->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce2()));
m_pDisableForce2->setCheckable(true);
@ -180,6 +189,76 @@ void CSandMan::OnShowHide()
show();
}
void CSandMan::CreateBoxMenu(QMenu* pMenu, int iOffset, int iSysTrayFilter)
{
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
static QMenu* pEmptyMenu = new QMenu();
while (!pMenu->actions().at(iOffset)->data().toString().isEmpty())
pMenu->removeAction(pMenu->actions().at(iOffset));
int iNoIcons = theConf->GetInt("Options/NoIcons", 2);
if (iNoIcons == 2)
iNoIcons = theConf->GetInt("Options/ViewMode", 1) == 2 ? 1 : 0;
QFileIconProvider IconProvider;
bool ColorIcons = theConf->GetBool("Options/ColorBoxIcons", false);
QAction* pPos = pMenu->actions().at(iOffset);
foreach(const CSandBoxPtr & pBox, Boxes)
{
if (!pBox->IsEnabled())
continue;
CSandBoxPlus* pBoxEx = qobject_cast<CSandBoxPlus*>(pBox.data());
if (iSysTrayFilter == 2) { // pinned only
if (!pBox->GetBool("PinToTray", false))
continue;
}
else if (iSysTrayFilter == 1) { // active + pinned
if (pBoxEx->GetActiveProcessCount() == 0 && !pBox->GetBool("PinToTray", false))
continue;
}
QAction* pBoxAction = new QAction(pBox->GetName().replace("_", " "));
if (!iNoIcons) {
QIcon Icon;
if (ColorIcons)
Icon = theGUI->GetColorIcon(pBoxEx->GetColor(), pBox->GetActiveProcessCount());
else
Icon = theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount() != 0);
pBoxAction->setIcon(Icon);
}
pBoxAction->setData("box:" + pBox->GetName());
pBoxAction->setMenu(pEmptyMenu);
//pBoxAction->setIcon
//connect(pBoxAction, SIGNAL(triggered()), this, SLOT(OnBoxMenu()));
pMenu->insertAction(pPos, pBoxAction);
}
}
void CSandMan::OnBoxMenuHover(QAction* action)
{
if (action->data().type() != QVariant::String)
return;
QString Str = action->data().toString();
if (Str.left(4) != "box:")
return;
QString Name = Str.mid(4);
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);
}
}
void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason)
{
static bool TriggerSet = false;
@ -188,83 +267,95 @@ void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason)
{
case QSystemTrayIcon::Context:
{
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
int iSysTrayFilter = theConf->GetInt("Options/SysTrayFilter", 0);
bool bAdded = false;
if (m_pTrayBoxes->topLevelItemCount() == 0)
bAdded = true; // triger size refresh
QMap<QString, QTreeWidgetItem*> OldBoxes;
for(int i = 0; i < m_pTrayBoxes->topLevelItemCount(); ++i)
if(!m_pTrayBoxes)
CreateBoxMenu(m_pTrayMenu, m_iTrayPos, iSysTrayFilter);
else
{
QTreeWidgetItem* pItem = m_pTrayBoxes->topLevelItem(i);
QString Name = pItem->data(0, Qt::UserRole).toString();
OldBoxes.insert(Name,pItem);
}
foreach(const CSandBoxPtr & pBox, Boxes)
{
if (!pBox->IsEnabled())
continue;
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
CSandBoxPlus* pBoxEx = qobject_cast<CSandBoxPlus*>(pBox.data());
bool bAdded = false;
if (m_pTrayBoxes->topLevelItemCount() == 0)
bAdded = true; // triger size refresh
if (iSysTrayFilter == 2) { // pinned only
if (!pBox->GetBool("PinToTray", false))
continue;
}
else if (iSysTrayFilter == 1) { // active + pinned
if (pBoxEx->GetActiveProcessCount() == 0 && !pBox->GetBool("PinToTray", false))
continue;
}
QTreeWidgetItem* pItem = OldBoxes.take(pBox->GetName());
if(!pItem)
QMap<QString, QTreeWidgetItem*> OldBoxes;
for (int i = 0; i < m_pTrayBoxes->topLevelItemCount(); ++i)
{
pItem = new QTreeWidgetItem();
pItem->setData(0, Qt::UserRole, pBox->GetName());
pItem->setText(0, " " + pBox->GetName().replace("_", " "));
m_pTrayBoxes->addTopLevelItem(pItem);
bAdded = true;
QTreeWidgetItem* pItem = m_pTrayBoxes->topLevelItem(i);
QString Name = pItem->data(0, Qt::UserRole).toString();
OldBoxes.insert(Name, pItem);
}
QIcon Icon = theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount() != 0);
pItem->setData(0, Qt::DecorationRole, Icon);
}
QFileIconProvider IconProvider;
bool ColorIcons = theConf->GetBool("Options/ColorBoxIcons", false);
foreach(QTreeWidgetItem* pItem, OldBoxes)
delete pItem;
foreach(const CSandBoxPtr & pBox, Boxes)
{
if (!pBox->IsEnabled())
continue;
if (!OldBoxes.isEmpty() || bAdded)
{
auto palette = m_pTrayBoxes->palette();
palette.setColor(QPalette::Base, m_pTrayMenu->palette().color(m_DarkTheme ? QPalette::Base : QPalette::Window));
m_pTrayBoxes->setPalette(palette);
m_pTrayBoxes->setFrameShape(QFrame::NoFrame);
CSandBoxPlus* pBoxEx = qobject_cast<CSandBoxPlus*>(pBox.data());
//const int FrameWidth = m_pTrayBoxes->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
int Height = 0; //m_pTrayBoxes->header()->height() + (2 * FrameWidth);
if (iSysTrayFilter == 2) { // pinned only
if (!pBox->GetBool("PinToTray", false))
continue;
}
else if (iSysTrayFilter == 1) { // active + pinned
if (pBoxEx->GetActiveProcessCount() == 0 && !pBox->GetBool("PinToTray", false))
continue;
}
for (QTreeWidgetItemIterator AllIterator(m_pTrayBoxes, QTreeWidgetItemIterator::All); *AllIterator; ++AllIterator)
Height += m_pTrayBoxes->visualItemRect(*AllIterator).height();
QTreeWidgetItem* pItem = OldBoxes.take(pBox->GetName());
if (!pItem)
{
pItem = new QTreeWidgetItem();
pItem->setData(0, Qt::UserRole, pBox->GetName());
pItem->setText(0, " " + pBox->GetName().replace("_", " "));
m_pTrayBoxes->addTopLevelItem(pItem);
QRect scrRect = this->screen()->availableGeometry();
int MaxHeight = scrRect.height() / 2;
if (Height > MaxHeight) {
Height = MaxHeight;
if (Height < 64)
Height = 64;
bAdded = true;
}
QIcon Icon;
if (ColorIcons)
Icon = theGUI->GetColorIcon(pBoxEx->GetColor(), pBox->GetActiveProcessCount());
else
Icon = theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount() != 0);
pItem->setData(0, Qt::DecorationRole, Icon);
}
m_pTrayBoxes->setFixedHeight(Height);
foreach(QTreeWidgetItem * pItem, OldBoxes)
delete pItem;
m_pTrayMenu->removeAction(m_pTrayList);
m_pTrayMenu->insertAction(m_pTraySeparator, m_pTrayList);
if (!OldBoxes.isEmpty() || bAdded)
{
auto palette = m_pTrayBoxes->palette();
palette.setColor(QPalette::Base, m_pTrayMenu->palette().color(m_DarkTheme ? QPalette::Base : QPalette::Window));
m_pTrayBoxes->setPalette(palette);
m_pTrayBoxes->setFrameShape(QFrame::NoFrame);
m_pTrayBoxes->setFocus();
//const int FrameWidth = m_pTrayBoxes->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
int Height = 0; //m_pTrayBoxes->header()->height() + (2 * FrameWidth);
for (QTreeWidgetItemIterator AllIterator(m_pTrayBoxes, QTreeWidgetItemIterator::All); *AllIterator; ++AllIterator)
Height += m_pTrayBoxes->visualItemRect(*AllIterator).height();
QRect scrRect = this->screen()->availableGeometry();
int MaxHeight = scrRect.height() / 3;
if (Height > MaxHeight) {
Height = MaxHeight;
if (Height < 64)
Height = 64;
}
m_pTrayBoxes->setFixedHeight(Height);
m_pTrayMenu->removeAction(m_pTrayList);
m_pTrayMenu->insertAction(m_pTrayMenu->actions().at(m_iTrayPos), m_pTrayList);
m_pTrayBoxes->setFocus();
}
}
m_pTrayMenu->popup(QCursor::pos());
@ -303,3 +394,18 @@ void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason)
break;
}
}
void CSandMan::OnBoxMenu(const QPoint & point)
{
QPoint pos = ((QWidget*)m_pTrayBoxes->parent())->mapFromParent(point);
QTreeWidgetItem* pItem = m_pTrayBoxes->itemAt(pos);
if (!pItem)
return;
m_pTrayBoxes->setCurrentItem(pItem);
CTrayBoxesItemDelegate::m_Hold = true;
m_pBoxView->PopUpMenu(pItem->data(0, Qt::UserRole).toString());
CTrayBoxesItemDelegate::m_Hold = false;
//m_pBoxMenu->popup(QCursor::pos());
}

View File

@ -164,6 +164,11 @@ void CSandBoxPlus::UpdateDetails()
m_bPrivacyEnhanced = (m_iUnsecureDebugging != 1 || m_bApplicationCompartment) && (GetBool("UsePrivacyMode", false)); // app compartments are inhenrently insecure
CSandBox::UpdateDetails();
m_BoxType = GetTypeImpl();
QStringList BorderCfg = GetText("BorderColor").split(",");
m_BoxColor = QColor("#" + BorderCfg[0].mid(5, 2) + BorderCfg[0].mid(3, 2) + BorderCfg[0].mid(1, 2)).rgb();
}
void CSandBoxPlus::SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath)
@ -292,7 +297,7 @@ QString CSandBoxPlus::GetStatusStr() const
return Status.join(", ");
}
CSandBoxPlus::EBoxTypes CSandBoxPlus::GetType() const
CSandBoxPlus::EBoxTypes CSandBoxPlus::GetTypeImpl() const
{
if (m_bApplicationCompartment && m_bPrivacyEnhanced)
return eAppBoxPlus;

View File

@ -103,11 +103,13 @@ public:
eAppBoxPlus,
eAppBox,
eInsecure,
eOpen,
eUnknown
};
EBoxTypes GetType() const;
EBoxTypes GetType() const { return m_BoxType; }
QRgb GetColor() const { return m_BoxColor; }
class COptionsWindow* m_pOptionsWnd;
class CRecoveryWindow* m_pRecoveryWnd;
@ -125,6 +127,7 @@ protected:
friend class CSbiePlusAPI;
virtual bool CheckUnsecureConfig() const;
EBoxTypes GetTypeImpl() const;
virtual bool TestProgramGroup(const QString& Group, const QString& ProgName);
virtual void EditProgramGroup(const QString& Group, const QString& ProgName, bool bSet);
@ -152,4 +155,7 @@ protected:
QSet<QString> m_RecentPrograms;
EBoxTypes m_BoxType;
QRgb m_BoxColor;
};

View File

@ -34,8 +34,6 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
m_pSortProxy->setSourceModel(m_pSbieModel);
m_pSortProxy->setDynamicSortFilter(true);
QStyle* pStyle = QStyleFactory::create("windows");
// SbieTree
m_pSbieTree = new QTreeViewEx();
m_pSbieTree->setExpandsOnDoubleClick(false);
@ -62,6 +60,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
//m_pSbieTree->header()->setSectionsClickable(true);
connect(m_pSbieTree->header(), SIGNAL(sectionClicked(int)), this, SLOT(OnCustomSortByColumn(int)));
QStyle* pStyle = QStyleFactory::create("windows");
m_pSbieTree->setStyle(pStyle);
m_pSbieTree->setContextMenuPolicy(Qt::CustomContextMenu);
@ -510,7 +509,7 @@ void CSbieView::OnCustomSortByColumn(int column)
}
}
bool CSbieView::UpdateMenu(const CSandBoxPtr &pBox, int iSandBoxeCount, bool bBoxBusy, const CBoxedProcessPtr &pProcess, int iProcessCount, int iGroupe)
bool CSbieView::UpdateMenu(bool bAdvanced, const CSandBoxPtr &pBox, int iSandBoxeCount, bool bBoxBusy, const CBoxedProcessPtr &pProcess, int iProcessCount, int iGroupe)
{
QList<QAction*> MenuActions = m_pMenu->actions();
@ -613,12 +612,9 @@ bool CSbieView::UpdateMenu(const CSandBoxPtr &pBox, int iSandBoxeCount, bool bBo
// pAction->setEnabled(false);
//}
bool bCtrl = theConf->GetInt("Options/ViewMode", 1) == 1
|| (QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0;
m_pCopyCell->setVisible(bCtrl);
m_pCopyRow->setVisible(bCtrl);
m_pCopyPanel->setVisible(bCtrl);
m_pCopyCell->setVisible(bAdvanced);
m_pCopyRow->setVisible(bAdvanced);
m_pCopyPanel->setVisible(bAdvanced);
return bBoxBusy == false;
}
@ -668,7 +664,10 @@ bool CSbieView::UpdateMenu()
iGroupe = 0;
}
return UpdateMenu(pBox, iSandBoxeCount, bBoxBusy, pProcess, iProcessCount, iGroupe);
bool bAdvanced = theConf->GetInt("Options/ViewMode", 1) == 1
|| (QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0;
return UpdateMenu(bAdvanced, pBox, iSandBoxeCount, bBoxBusy, pProcess, iProcessCount, iGroupe);
}
void CSbieView::OnMenu(const QPoint& Point)
@ -1615,7 +1614,7 @@ void CSbieView::PopUpMenu(const QString& Name)
{
//SelectBox(Name);
CSandBoxPtr pBox = theAPI->GetBoxByName(Name);
if (pBox.isNull() || !UpdateMenu(pBox)) return;
if (pBox.isNull() || !UpdateMenu(false, pBox)) return;
m_pMenu2->exec(QCursor::pos());
//m_pMenu2->popup(QCursor::pos());
//OnMenu(QCursor::pos());
@ -1625,7 +1624,7 @@ QMenu* CSbieView::GetMenu(const QString& Name)
{
CSandBoxPtr pBox = theAPI->GetBoxByName(Name);
if (pBox.isNull()) return NULL;
UpdateMenu(pBox);
UpdateMenu(false, pBox);
return m_pMenu;
}

View File

@ -78,7 +78,7 @@ private:
void CreateOldMenu();
void CreatTrayMenu();
bool UpdateMenu(const CSandBoxPtr &pBox, int iSandBoxeCount = 1, bool bBoxBusy = false, const CBoxedProcessPtr &pProcess = CBoxedProcessPtr(), int iProcessCount = 0, int iGroupe = 0);
bool UpdateMenu(bool bAdvanced, const CSandBoxPtr &pBox, int iSandBoxeCount = 1, bool bBoxBusy = false, const CBoxedProcessPtr &pProcess = CBoxedProcessPtr(), int iProcessCount = 0, int iGroupe = 0);
bool UpdateMenu();
void UpdateGroupMenu();
void RenameGroup(const QString OldName, const QString NewName);

View File

@ -108,6 +108,9 @@ void CNewBoxWindow::CreateBox()
//pBox->InsertText("Template", "NoUACProxy"); // proxy is always needed for exes in the box
break;
}
QRgb rgb = theGUI->GetBoxColor(BoxType);
pBox->SetText("BorderColor", QString("#%1%2%3").arg(qBlue(rgb), 2, 16, QChar('0')).arg(qGreen(rgb), 2, 16, QChar('0')).arg(qRed(rgb), 2, 16, QChar('0')) + ",ttl");
}
if(Status.IsError())

View File

@ -356,6 +356,9 @@ void COptionsWindow::OnBoxTypChanged()
break;
}
m_BorderColor = theGUI->GetBoxColor(BoxType);
ui.btnBorderColor->setStyleSheet("background-color: " + m_BorderColor.name());
m_GeneralChanged = true;
m_AccessChanged = true;
m_AdvancedChanged = true;

View File

@ -107,6 +107,9 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
Boxes = Boxes2.values();
}
QFileIconProvider IconProvider;
bool ColorIcons = theConf->GetBool("Options/ColorBoxIcons", false);
QMap<QString, QTreeWidgetItem*> GroupItems;
foreach(const CSandBoxPtr &pBox, Boxes)
{
@ -120,7 +123,12 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
QTreeWidgetItem* pItem = new QTreeWidgetItem();
pItem->setText(0, pBox->GetName().replace("_", " "));
pItem->setData(0, Qt::UserRole, pBox->GetName());
pItem->setData(0, Qt::DecorationRole, theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount()));
QIcon Icon;
if(ColorIcons)
Icon = theGUI->GetColorIcon(pBoxEx->GetColor(), pBox->GetActiveProcessCount());
else
Icon = theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount() != 0);
pItem->setData(0, Qt::DecorationRole, Icon);
if (pParent)
pParent->addChild(pItem);
else
@ -186,4 +194,4 @@ void CSelectBoxWindow::OnRun()
setResult(1);
close();
}
}

View File

@ -148,6 +148,7 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
connect(ui.chkLargeIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.chkNoIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
//connect(ui.chkOptTree, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.chkColorIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.cmbFontScale, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
@ -155,6 +156,7 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
connect(ui.cmbSysTray, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange()));
connect(ui.cmbTrayBoxes, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange()));
connect(ui.chkCompactTray, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
connect(ui.cmbOnClose, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange()));
m_FeaturesChanged = false;
@ -224,13 +226,16 @@ CSettingsWindow::~CSettingsWindow()
theConf->SetBlob("SettingsWindow/Window_Geometry",saveGeometry());
}
void CSettingsWindow::showTab(int Tab)
void CSettingsWindow::showTab(int Tab, bool bExclusive)
{
if(Tab == CSettingsWindow::eSoftCompat)
m_CompatLoaded = 2;
else if(Tab == CSettingsWindow::eSupport)
ui.chkNoCheck->setVisible(true);
if(bExclusive)
ui.tabs->tabBar()->setVisible(false);
ui.tabs->setCurrentIndex(Tab);
SafeShow(this);
}
@ -323,6 +328,7 @@ void CSettingsWindow::LoadSettings()
ui.chkLargeIcons->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/LargeIcons", 2)));
ui.chkNoIcons->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/NoIcons", 2)));
ui.chkOptTree->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/OptionTree", 2)));
ui.chkColorIcons->setChecked(theConf->GetBool("Options/ColorBoxIcons", false));
ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
@ -344,6 +350,7 @@ void CSettingsWindow::LoadSettings()
ui.cmbSysTray->setCurrentIndex(theConf->GetInt("Options/SysTrayIcon", 1));
ui.cmbTrayBoxes->setCurrentIndex(theConf->GetInt("Options/SysTrayFilter", 0));
ui.chkCompactTray->setChecked(theConf->GetBool("Options/CompactTray", false));
ui.chkBoxOpsNotify->setChecked(theConf->GetBool("Options/AutoBoxOpsNotify", false));
ui.cmbOnClose->setCurrentIndex(ui.cmbOnClose->findData(theConf->GetString("Options/OnClose", "ToTray")));
@ -462,6 +469,7 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/LargeIcons", CSettingsWindow__Chk2Int(ui.chkLargeIcons->checkState()));
theConf->SetValue("Options/NoIcons", CSettingsWindow__Chk2Int(ui.chkNoIcons->checkState()));
theConf->SetValue("Options/OptionTree", CSettingsWindow__Chk2Int(ui.chkOptTree->checkState()));
theConf->SetValue("Options/ColorBoxIcons", ui.chkColorIcons->isChecked());
theConf->SetValue("Options/FontScaling", ui.cmbFontScale->currentData());
@ -514,6 +522,7 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/SysTrayIcon", ui.cmbSysTray->currentIndex());
theConf->SetValue("Options/SysTrayFilter", ui.cmbTrayBoxes->currentIndex());
theConf->SetValue("Options/CompactTray", ui.chkCompactTray->isChecked());
theConf->SetValue("Options/AutoBoxOpsNotify", ui.chkBoxOpsNotify->isChecked());
theConf->SetValue("Options/OnClose", ui.cmbOnClose->currentData());

View File

@ -71,7 +71,7 @@ public slots:
void ok();
void apply();
void showTab(int Tab);
void showTab(int Tab, bool bExclusive = false);
private slots:
void OnChange();

View File

@ -279,7 +279,7 @@ CUIPage::CUIPage(QWidget* parent)
layout->addWidget(m_pSimple, 1, 0);
registerField("useSimple", m_pSimple);
m_pClassic = new QRadioButton(tr("&Classic Sandboxie UI"));
m_pClassic = new QRadioButton(tr("&Vintage SbieCtrl.exe UI"));
m_pClassic->setChecked(theConf->GetInt("Options/ViewMode", 1) == 2);
layout->addWidget(m_pClassic, 2, 0);
registerField("useClassic", m_pClassic);