Skip to content

Commit

Permalink
Default stylesheets revision + clean-up (FreeCAD#13772)
Browse files Browse the repository at this point in the history
* Added the new QSS file with images

Added the new QSS file with images

* fixed some disabled colors to be the same everywhere.

* update

* big update fixed the scrollbars and lots more.

* small tweaks

* small fixes

* fixed groupbox in qsint

* Added light classic

This light theme is basicallyt exactly no-stylesheet.

* fixed the tabs

* fixed background reportview

* updated overlay stylesheets

* Added preference settings from Opentheme @obelisk79

* tabbar tweaks

* forgot the gradients on dark

* Overlay stylesheets clean-up +move icon to folder.

* removing old stylesheets

removing old stylesheets

* it was icons not icon, fixed it.

* updated cmake and package.xml

* to many spaces

* removing old theme's

* updated default overlay qss

* removed my settings files

* updated cfg files

* Bunch of fixes

I compiled it and didn't see any issues anymore. Could be some discussions about the new startpage thumbnails.

* fixed up double arrows and the correct logo!

* updated the work file for the icons

* Sets no-stylesheet overlay to a stylesheet.

* type in cmakelist

* type in filename

* oeps did set the dark theme

* Update OverlayManager.cpp

I removed a bit to much reverting this line

* fixed text color issue in Qsint on the light theme and dark background

* Update Light Theme + Dark Background.qss

Fine tuning the treeview it now works good for ligth theme and dark brackgrounds.

* removed prodark added back Behave dark overlay

@Syres916 I deleted the overlay qss behave dark by accident.
But you might want to check this PR out since it changes a lot.

I deleted Pro-dark since it was not updated and is outdated and it looks also a lot like the default dark.

* Update Light Theme + Light Background.qss

Fixes

* small fixes

small fixes

* remove ProDark

* Update CMakeLists.txt

* changed the thumbnails

Also removed teh dimensions in the filename since that got annoying real fast :)

* Updated other overlay stylesheets

* missing extension

* cleanup and some fixes to the overlay.

* Update Dark Theme + Light Background.qss

udpated the dark theme overaly with light background for all you maniacs who use this.

* Title bar fix for windows

This makes it so that it uses black title bar in windows if you have dark mode

* updated white background and some colors

* I think I fix merge issue now.

* Some cleanup on the thumbnails

* Create CMakePresets.json

* idk

* trying to fix conflicts

* removing old themes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Some fixes for Qsint sketcher toolbars icons

* fixed merge issue with maingui

* trying to fix merge conflicts

* and removing again.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
MisterMakerNL and pre-commit-ci[bot] authored Jun 14, 2024
1 parent ca00ba8 commit b205922
Show file tree
Hide file tree
Showing 220 changed files with 9,325 additions and 17,190 deletions.
34 changes: 17 additions & 17 deletions src/Gui/CommandView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ void StdCmdToggleTransparency::activated(int iMsg)
if (!obj)
continue;

bool isGroup = dynamic_cast<App::Part*>(obj)
bool isGroup = dynamic_cast<App::Part*>(obj)
|| dynamic_cast<App::LinkGroup*>(obj)
|| dynamic_cast<App::DocumentObjectGroup*>(obj);

Expand Down Expand Up @@ -2605,9 +2605,9 @@ class SelectionCallbackHandler {
bool prevSelectionEn;

public:
// Creates a selection handler used to implement the common behaviour of BoxZoom, BoxSelection and BoxElementSelection.
// Creates a selection handler used to implement the common behaviour of BoxZoom, BoxSelection and BoxElementSelection.
// Takes the viewer, a selection mode, a cursor, a function pointer to be called on success and a void pointer for user data to be passed to the given function.
// The selection handler class stores all necessary previous states, registers a event callback and starts the selection in the given mode.
// The selection handler class stores all necessary previous states, registers a event callback and starts the selection in the given mode.
// If there is still a selection handler active, this call will generate a message and returns.
static void Create(View3DInventorViewer* viewer, View3DInventorViewer::SelectionMode selectionMode,
const QCursor& cursor, FnCb doFunction= nullptr, void* ud=nullptr)
Expand Down Expand Up @@ -2637,8 +2637,8 @@ class SelectionCallbackHandler {
return userData;
}

// Implements the event handler. In the normal case the provided function is called.
// Also supports aborting the selection mode by pressing (releasing) the Escape key.
// Implements the event handler. In the normal case the provided function is called.
// Also supports aborting the selection mode by pressing (releasing) the Escape key.
static void selectionCallback(void * ud, SoEventCallback * n)
{
auto selectionHandler = static_cast<SelectionCallbackHandler*>(ud);
Expand Down Expand Up @@ -3708,7 +3708,7 @@ StdCmdDockOverlayAll::StdCmdDockOverlayAll()

void StdCmdDockOverlayAll::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleAll);
}

Expand All @@ -3733,7 +3733,7 @@ StdCmdDockOverlayTransparentAll::StdCmdDockOverlayTransparentAll()

void StdCmdDockOverlayTransparentAll::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleTransparentAll);
}

Expand All @@ -3757,7 +3757,7 @@ StdCmdDockOverlayToggle::StdCmdDockOverlayToggle()

void StdCmdDockOverlayToggle::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleActive);
}

Expand All @@ -3782,7 +3782,7 @@ StdCmdDockOverlayToggleTransparent::StdCmdDockOverlayToggleTransparent()

void StdCmdDockOverlayToggleTransparent::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleTransparent);
}

Expand All @@ -3801,13 +3801,13 @@ StdCmdDockOverlayToggleLeft::StdCmdDockOverlayToggleLeft()
sWhatsThis = "Std_DockOverlayToggleLeft";
sStatusTip = sToolTipText;
sAccel = "Ctrl+Left";
sPixmap = "qss:overlay/close.svg";
sPixmap = "qss:overlay/icons/close.svg";
eType = 0;
}

void StdCmdDockOverlayToggleLeft::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleLeft);
}

Expand All @@ -3826,13 +3826,13 @@ StdCmdDockOverlayToggleRight::StdCmdDockOverlayToggleRight()
sWhatsThis = "Std_DockOverlayToggleRight";
sStatusTip = sToolTipText;
sAccel = "Ctrl+Right";
sPixmap = "qss:overlay/close.svg";
sPixmap = "qss:overlay/icons/close.svg";
eType = 0;
}

void StdCmdDockOverlayToggleRight::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleRight);
}

Expand All @@ -3851,13 +3851,13 @@ StdCmdDockOverlayToggleTop::StdCmdDockOverlayToggleTop()
sWhatsThis = "Std_DockOverlayToggleTop";
sStatusTip = sToolTipText;
sAccel = "Ctrl+Up";
sPixmap = "qss:overlay/close.svg";
sPixmap = "qss:overlay/icons/close.svg";
eType = 0;
}

void StdCmdDockOverlayToggleTop::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleTop);
}

Expand All @@ -3876,13 +3876,13 @@ StdCmdDockOverlayToggleBottom::StdCmdDockOverlayToggleBottom()
sWhatsThis = "Std_DockOverlayToggleBottom";
sStatusTip = sToolTipText;
sAccel = "Ctrl+Down";
sPixmap = "qss:overlay/close.svg";
sPixmap = "qss:overlay/icons/close.svg";
eType = 0;
}

void StdCmdDockOverlayToggleBottom::activated(int iMsg)
{
Q_UNUSED(iMsg);
Q_UNUSED(iMsg);
OverlayManager::instance()->setOverlayMode(OverlayManager::OverlayMode::ToggleBottom);
}

Expand Down
109 changes: 23 additions & 86 deletions src/Gui/OverlayManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static inline OverlayTabWidget *findTabWidget(QWidget *widget=nullptr, bool filt
widget = qApp->focusWidget();
for(auto w=widget; w; w=w->parentWidget()) {
auto tabWidget = qobject_cast<OverlayTabWidget*>(w);
if(tabWidget)
if(tabWidget)
return tabWidget;
auto proxy = qobject_cast<OverlayProxyWidget*>(w);
if(proxy)
Expand All @@ -95,7 +95,7 @@ class OverlayStyleSheet: public ParameterGrp::ObserverType {
OverlayStyleSheet() {
handle = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/MainWindow");

update();

handle->Attach(this);
Expand Down Expand Up @@ -146,18 +146,18 @@ class OverlayStyleSheet: public ParameterGrp::ObserverType {
if (overlayStyleSheet.isEmpty()) {
// User did not choose any stylesheet, we need to choose one based on main stylesheet
if (mainStyleSheet.contains(QStringLiteral("light"), Qt::CaseInsensitive)) {
overlayStyleSheet = QStringLiteral("overlay:Light-Outline.qss");
overlayStyleSheet = QStringLiteral("overlay:Light Theme + Dark Background.qss");
}
else {
// by default FreeCAD uses somewhat dark background for 3D View.
// if user has not explicitly selected light theme, the "Dark Outline" looks best
overlayStyleSheet = QStringLiteral("overlay:Dark-Outline.qss");
overlayStyleSheet = QStringLiteral("overlay:Dark Theme + Dark Background.qss");
}
}
else if (!overlayStyleSheet.isEmpty() && !QFile::exists(overlayStyleSheet)) {
// User did choose one of predefined stylesheets, we need to qualify it with namespace
overlayStyleSheet = QStringLiteral("overlay:%1").arg(overlayStyleSheet);
}
overlayStyleSheet = QStringLiteral("overlay:%1").arg(overlayStyleSheet);
}

return overlayStyleSheet;
}
Expand All @@ -177,70 +177,7 @@ class OverlayStyleSheet: public ParameterGrp::ObserverType {
static const QString _default;
};

const QString OverlayStyleSheet::_default = QStringLiteral(
"* {alternate-background-color: rgba(250,250,250,120)}"

"QComboBox, QComboBox:editable, QComboBox:!editable, QLineEdit,"
"QTextEdit, QPlainTextEdit, QAbstractSpinBox, QDateEdit, QDateTimeEdit,"
"Gui--PropertyEditor--PropertyEditor QLabel "
"{background : palette(base);}"

"QScrollBar { background: rgba(0,0,0,10);}"
"QTabWidget::pane { background-color: transparent; border: transparent }"
"Gui--OverlayTabWidget { qproperty-effectColor: rgba(0,0,0,0) }"
"Gui--OverlayTabWidget::pane { background-color: rgba(250,250,250,80) }"

"QTabBar {border : none;}"
"QTabBar::tab {color: palette(text);"
"background-color: rgba(100,100,100,50);"
"padding: 5px}"
"QTabBar::tab:selected {background-color: rgba(250,250,250,80);}"
"QTabBar::tab:hover {background-color: rgba(250,250,250,200);}"

"QHeaderView { background:transparent }"
"QHeaderView::section {color: palette(text);"
"background-color: rgba(250,250,250,50);"
"border: 1px solid palette(dark);"
"padding: 2px}"

"QTreeView, QListView, QTableView {"
"background: rgb(250,250,250);"
"border: transparent;"
"selection-background-color: rgba(94, 144, 250, 0.7);}"
"QListView::item:selected, QTreeView::item:selected {"
"background-color: rgba(94, 144, 250, 0.7);}"

"Gui--PropertyEditor--PropertyEditor {"
"border: 1px solid palette(dark);"
"qproperty-groupTextColor: rgb(100, 100, 100);"
"qproperty-groupBackground: rgba(180, 180, 180, 0.7);}"

"QToolTip {background-color: rgba(250,250,250,180);}"

"Gui--TreeWidget QHeaderView:section {"
"height: 0px;"
"background-color: transparent;"
"padding: 0px;"
"border: transparent;}"

"Gui--CallTipsList::item { background-color: rgba(200,200,200,200);}"
"Gui--CallTipsList::item::selected { background-color: palette(highlight);}"

"QPushButton { background: rgba(250,250,250,80);padding: 2px 4px;}"
"QPushButton::hover { background: rgba(250,250,250,200);}"
"QPushButton::focus { background: rgba(250,250,250,255);}"
"QPushButton::pressed { background-color: #5e90fa;"
"border: 1px inset palette(dark) }"
"QPushButton::checked { background: rgba(100,100,100,100);"
"border: 1px inset palette(dark) }"
"QPushButton::checked:hover { background: rgba(150,150,150,200);"
"border: 1px inset palette(dark) }"
"Gui--OverlayToolButton { background: transparent; padding: 0px; border: none }"
"Gui--OverlayTitleBar,"
"Gui--OverlaySplitterHandle { background-color: rgba(200, 200, 200, 150); }"
"QWidget#ClippingScrollAreaContents, "
"QScrollArea#ClippingScrollArea { border: none; background-color: #a0e6e6e6; }"
"Gui--PropertyEditor--PropertyEditor > QWidget > QPushButton {text-align:left;padding-left:2px;}"
const QString OverlayStyleSheet::_default = QStringLiteral("overlay:Light Theme + Dark Background.qss"
);

// -----------------------------------------------------------
Expand Down Expand Up @@ -270,7 +207,7 @@ struct OverlayInfo {
if (hGrp == Param && Name && !tabWidget->isSaving()) {
// This will prevent saving settings which will mess up the
// just restored ones
tabWidget->restore(nullptr);
tabWidget->restore(nullptr);
OverlayManager::instance()->reload();
}
});
Expand Down Expand Up @@ -411,7 +348,7 @@ class OverlayManager::Private {
,_overlayInfos({&_left,&_right,&_top,&_bottom})
,_actions({&_actOverlay,&_actFloat,&_actClose})
{
_Overlays = {OverlayTabWidget::_LeftOverlay,
_Overlays = {OverlayTabWidget::_LeftOverlay,
OverlayTabWidget::_RightOverlay,
OverlayTabWidget::_TopOverlay,
OverlayTabWidget::_BottomOverlay};
Expand Down Expand Up @@ -465,9 +402,9 @@ class OverlayManager::Private {

void refreshIcons()
{
_actFloat.setIcon(BitmapFactory().pixmap("qss:overlay/float.svg"));
_actOverlay.setIcon(BitmapFactory().pixmap("qss:overlay/overlay.svg"));
_actClose.setIcon(BitmapFactory().pixmap("qss:overlay/close.svg"));
_actFloat.setIcon(BitmapFactory().pixmap("qss:overlay/icons/float.svg"));
_actOverlay.setIcon(BitmapFactory().pixmap("qss:overlay/icons/overlay.svg"));
_actClose.setIcon(BitmapFactory().pixmap("qss:overlay/icons/close.svg"));
for (OverlayTabWidget *tabWidget : _Overlays) {
tabWidget->refreshIcons();
for (auto handle : tabWidget->findChildren<OverlaySplitterHandle*>())
Expand Down Expand Up @@ -610,7 +547,7 @@ class OverlayManager::Private {
updateFocus = true;
else if(o->tabWidget == active)
updateActive = true;
else
else
o->tabWidget->setOverlayMode(true);
}
if(!o->tabWidget->getRevealTime().isNull()) {
Expand All @@ -628,12 +565,12 @@ class OverlayManager::Private {
focus->raise();
if(reveal == focus)
reveal = nullptr;
} else
} else
focus->updateSplitterHandles();
}

if(active) {
if(active != focus && (active->isOverlaid(OverlayTabWidget::QueryOption::TransparencyChanged) || updateActive))
if(active != focus && (active->isOverlaid(OverlayTabWidget::QueryOption::TransparencyChanged) || updateActive))
active->setOverlayMode(false);
active->raise();
if(reveal == active)
Expand All @@ -646,7 +583,7 @@ class OverlayManager::Private {
}

for(auto o : _overlayInfos) {
if(o->tabWidget != focus
if(o->tabWidget != focus
&& o->tabWidget != active
&& o->tabWidget != reveal
&& o->tabWidget->count()
Expand Down Expand Up @@ -703,7 +640,7 @@ class OverlayManager::Private {
_bottom.tabWidget->setRect(QRect(ofs.width(),h-rect.height(),bw,rect.height()));

if (_bottom.tabWidget->count()
&& _bottom.tabWidget->isVisible()
&& _bottom.tabWidget->isVisible()
&& _bottom.tabWidget->getState() <= OverlayTabWidget::State::Normal)
rectBottom = _bottom.tabWidget->getRect();

Expand All @@ -722,7 +659,7 @@ class OverlayManager::Private {
_left.tabWidget->setRect(QRect(ofs.height(),ofs.width(),rect.width(),lh));

if (_left.tabWidget->count()
&& _left.tabWidget->isVisible()
&& _left.tabWidget->isVisible()
&& _left.tabWidget->getState() <= OverlayTabWidget::State::Normal)
rectLeft = _left.tabWidget->getRect();

Expand All @@ -742,7 +679,7 @@ class OverlayManager::Private {
_right.tabWidget->setRect(QRect(w-rect.width(),ofs.width(),rect.width(),rh));

if (_right.tabWidget->count()
&& _right.tabWidget->isVisible()
&& _right.tabWidget->isVisible()
&& _right.tabWidget->getState() <= OverlayTabWidget::State::Normal)
rectRight = _right.tabWidget->getRect();

Expand Down Expand Up @@ -1030,7 +967,7 @@ class OverlayManager::Private {
dock->show();
dock->setFloating(true);
refresh();
} else
} else
dock->setFloating(!dock->isFloating());
}
return;
Expand Down Expand Up @@ -1220,7 +1157,7 @@ class OverlayManager::Private {
resizeOffset = -1;
++i;
}
else
else
rect.setHeight(size/2);
}
else if (pos.x() > pt.x() + size/2) {
Expand Down Expand Up @@ -1480,7 +1417,7 @@ class OverlayManager::Private {

void unregisterDockWidget(const QString &name, OverlayTabWidget *widget) {
auto it = _dockWidgetNameMap.find(name);
if (it != _dockWidgetNameMap.end() && it->second == widget)
if (it != _dockWidgetNameMap.end() && it->second == widget)
_dockWidgetNameMap.erase(it);
}

Expand Down Expand Up @@ -2024,7 +1961,7 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev)
case QEvent::ContextMenu: {
auto ce = static_cast<QContextMenuEvent*>(ev);
lastIntercept = getChildAt(widget, ce->globalPos());
QContextMenuEvent contextMenuEvent(ce->reason(),
QContextMenuEvent contextMenuEvent(ce->reason(),
lastIntercept->mapFromGlobal(ce->globalPos()),
ce->globalPos());
QApplication::sendEvent(lastIntercept, &contextMenuEvent);
Expand Down
Loading

0 comments on commit b205922

Please sign in to comment.