diff --git a/SandboxiePlus/MiscHelpers/Common/Common.cpp b/SandboxiePlus/MiscHelpers/Common/Common.cpp index 9f9c54f3..c78ae29b 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Common.cpp @@ -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) { diff --git a/SandboxiePlus/MiscHelpers/Common/Common.h b/SandboxiePlus/MiscHelpers/Common/Common.h index bb05bafc..500113c5 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.h +++ b/SandboxiePlus/MiscHelpers/Common/Common.h @@ -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); diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index 090d0184..49c53012 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -187,7 +187,44 @@ - + + + + + + + Add 'Run Sandboxed' to the explorer context menu + + + + + + + Use Compact Box List + + + true + + + + + + + + + + + 75 + true + true + + + + Run Sandboxed - Actions + + + + Show Icon in Systray: @@ -200,60 +237,17 @@ - - + + + + + 75 + true + true + + - Always use DefaultBox - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add 'Run Un-Sandboxed' to the context menu - - - - - - - Add 'Run Sandboxed' to the explorer context menu - - - - - - - Start UI when a sandboxed process is started + Systray options @@ -270,7 +264,40 @@ - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Show a tray notification when automatic box operations are started + + + + + + + Show boxes in tray list: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + Qt::Vertical @@ -283,92 +310,26 @@ - - - - - 75 - true - true - + + + + Qt::Horizontal - - Start Menu Integration + + + 40 + 20 + - + - - + + - - + + - Show a tray notification when automatic box operations are started - - - - - - - - 75 - true - true - - - - Run Sandboxed - Actions - - - - - - - Scan shell folders and offer links in run menu - - - - - - - On main window close: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 75 - true - true - - - - Systray options - - - - - - - Start UI with Windows - - - - - - - Show boxes in tray list: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true + Always use DefaultBox @@ -386,24 +347,36 @@ - - - - - + + - Integrate boxes with Host Start Menu + Start UI with Windows + + + + + + + On main window close: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - true + + + + + + Add 'Run Un-Sandboxed' to the context menu - - + + + + Start UI when a sandboxed process is started + + @@ -416,10 +389,10 @@ - - + + - Don't show icons in menus * + Show "Pizza" Background in box list* true @@ -433,36 +406,30 @@ - - + + - Show "Pizza" Background in box list* + * indetermined means depanding on the view mode + + + + + + + Make Box Icons match the Border Color + + + + + + + Use a Page Tree in the Box Options instead of Nested Tabs * true - - - - Use large icons in box list * - - - true - - - - - - - false - - - - - - @@ -477,13 +444,29 @@ - - - - Font Scaling + + + + Qt::Vertical - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 20 + 40 + + + + + + + + + + + Use large icons in box list * + + + true @@ -497,6 +480,23 @@ + + + + false + + + + + + + Don't show icons in menus * + + + true + + + @@ -507,7 +507,17 @@ - + + + + Font Scaling + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Qt::Horizontal @@ -520,36 +530,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - * indetermined means depanding on the view mode - - - - - - - Use a Page Tree in the Box Options instead of Nested Tabs * - - - true - - - diff --git a/SandboxiePlus/SandMan/Models/SbieModel.cpp b/SandboxiePlus/SandMan/Models/SbieModel.cpp index 20554e7c..a023b447 100644 --- a/SandboxiePlus/SandMan/Models/SbieModel.cpp +++ b/SandboxiePlus/SandMan/Models/SbieModel.cpp @@ -116,8 +116,11 @@ QList CSbieModel::Sync(const QMap& BoxList, cons QHash 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 CSbieModel::Sync(const QMap& 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 CSbieModel::Sync(const QMap& 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()) { diff --git a/SandboxiePlus/SandMan/Models/SbieModel.h b/SandboxiePlus/SandMan/Models/SbieModel.h index 2f722761..7369fe47 100644 --- a/SandboxiePlus/SandMan/Models/SbieModel.h +++ b/SandboxiePlus/SandMan/Models/SbieModel.h @@ -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; diff --git a/SandboxiePlus/SandMan/Resources/Boxes/BusyOverlay.png b/SandboxiePlus/SandMan/Resources/Boxes/BusyOverlay.png index cc2d9d99..21673d80 100644 Binary files a/SandboxiePlus/SandMan/Resources/Boxes/BusyOverlay.png and b/SandboxiePlus/SandMan/Resources/Boxes/BusyOverlay.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-frame.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-frame.png new file mode 100644 index 00000000..c7d142e6 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-frame.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group+.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group+.png new file mode 100644 index 00000000..c5597895 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group+.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group.png new file mode 100644 index 00000000..2be19027 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-group.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-items.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-items.png new file mode 100644 index 00000000..28d20169 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-items.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-sand.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-sand.png new file mode 100644 index 00000000..db1fed86 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-sand.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-empty.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-empty.png new file mode 100644 index 00000000..ff204cb3 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-empty.png differ diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-full.png new file mode 100644 index 00000000..1427aa53 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-w-full.png differ diff --git a/SandboxiePlus/SandMan/Resources/SandMan.qrc b/SandboxiePlus/SandMan/Resources/SandMan.qrc index f936b008..9fb3d65c 100644 --- a/SandboxiePlus/SandMan/Resources/SandMan.qrc +++ b/SandboxiePlus/SandMan/Resources/SandMan.qrc @@ -90,6 +90,13 @@ Boxes/sandbox-o-empty.png Boxes/sandbox-o-full.png Boxes/BusyOverlay.png + Boxes/sandbox-frame.png + Boxes/sandbox-items.png + Boxes/sandbox-sand.png + Boxes/sandbox-w-empty.png + Boxes/sandbox-w-full.png + Boxes/sandbox-group.png + Boxes/sandbox-group+.png Advanced.png diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index b20bec14..fc925282 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -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)); } } diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 1cdd105d..18ad5df7 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -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 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; diff --git a/SandboxiePlus/SandMan/SandManTray.cpp b/SandboxiePlus/SandMan/SandManTray.cpp index c145ec33..09689266 100644 --- a/SandboxiePlus/SandMan/SandManTray.cpp +++ b/SandboxiePlus/SandMan/SandManTray.cpp @@ -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 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(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 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 Boxes = theAPI->GetAllBoxes(); - int iSysTrayFilter = theConf->GetInt("Options/SysTrayFilter", 0); - bool bAdded = false; - if (m_pTrayBoxes->topLevelItemCount() == 0) - bAdded = true; // triger size refresh - - QMap 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 Boxes = theAPI->GetAllBoxes(); - CSandBoxPlus* pBoxEx = qobject_cast(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 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(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()); +} diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 2bbee777..bfbbd28a 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -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; diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h index 67ff611e..391e8ae6 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.h +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -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 m_RecentPrograms; + + EBoxTypes m_BoxType; + QRgb m_BoxColor; }; diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 409610e6..58110120 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -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 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; } diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index 010f67fa..c8784bb4 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -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); diff --git a/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp b/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp index 9a251134..0be65a98 100644 --- a/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/NewBoxWindow.cpp @@ -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()) diff --git a/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp b/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp index 38abadf9..f41b47b7 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp @@ -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; diff --git a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp index 328a8459..bc8b7ff5 100644 --- a/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SelectBoxWindow.cpp @@ -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 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(); -} \ No newline at end of file +} diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index d72c7ddf..8774e2f7 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -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()); diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.h b/SandboxiePlus/SandMan/Windows/SettingsWindow.h index 820e2b13..8df5dc39 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.h +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.h @@ -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(); diff --git a/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp b/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp index 24e4233b..b4563b5f 100644 --- a/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp +++ b/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp @@ -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);