[Libreoffice-commits] core.git: sfx2/source vcl/qt5
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 27 09:51:38 UTC 2020
sfx2/source/dialog/backingwindow.cxx | 98 ++++++++++++++++++++++-------------
sfx2/source/dialog/backingwindow.hxx | 8 +-
vcl/qt5/Qt5Frame.cxx | 7 ++
3 files changed, 73 insertions(+), 40 deletions(-)
New commits:
commit 6dfbab409032516e05a63fbc777b9147d1deb4ec
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Oct 23 18:43:25 2020 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Oct 27 10:50:59 2020 +0100
tdf#136555 apply window bg color for button boxes
The default background color of the frame is APPBACKGROUND, which
is matched to GetWorkspaceColor(). That color is visible in Writer
as the default document workspace background.
Originally I just saw the dark background of the button box in the
start center, and thought the workspace color in Qt is wrong and
changed it in the reverted commit, missing the change of the color
around the Writer document.
Now that the button boxes's background color isn't fixed via the
"branding" setting, we also must react to changed style settings,
so we override the DataChanged function.
This also reverts commit e0c72e31c1d455c26110c35e8780d420e17cdea6.
Regressed-by: a927e0964ba0442d53fffb22c577e54bcf183ed7
Change-Id: I62396355054523baef1197a8a8af61c2f0d29ef3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104740
Tested-by: Jenkins
Reviewed-by: Thorsten Wagner <thorsten.wagner.4 at gmail.com>
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 44f53cfd8801..99c3990de072 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -62,7 +62,7 @@ using namespace ::com::sun::star::document;
const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess";
// increase size of the text in the buttons on the left fMultiplier-times
-float const fMultiplier = 1.4f;
+float const g_fMultiplier = 1.4f;
BackingWindow::BackingWindow(vcl::Window* i_pParent)
: InterimItemWindow(i_pParent, "sfx/ui/startcenter.ui", "StartCenter", false)
@@ -204,32 +204,77 @@ void BackingWindow::initControls()
//initialize Template view
mxLocalView->Hide();
-
//set handlers
mxLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
mxLocalView->setOpenTemplateHdl(LINK(this, BackingWindow, OpenTemplateHdl));
mxLocalView->setEditTemplateHdl(LINK(this, BackingWindow, EditTemplateHdl));
mxLocalView->ShowTooltips( true );
- setupButton(*mxOpenButton);
- setupButton(*mxRemoteButton);
- setupButton(*mxRecentButton);
- setupButton(*mxTemplateButton);
- setupButton(*mxWriterAllButton);
- setupButton(*mxDrawAllButton);
- setupButton(*mxCalcAllButton);
- setupButton(*mxDBAllButton);
- setupButton(*mxImpressAllButton);
- setupButton(*mxMathAllButton);
-
checkInstalledModules();
mxExtensionsButton->connect_clicked(LINK(this, BackingWindow, ExtLinkClickHdl));
- // setup larger font
- vcl::Font aFont(mxCreateLabel->get_font());
- aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
- mxCreateLabel->set_font(aFont);
+ mxOpenButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxRemoteButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxRecentButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxTemplateButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxWriterAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxDrawAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxCalcAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxDBAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxImpressAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+ mxMathAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
+
+ mxRecentButton->connect_selected(LINK(this, BackingWindow, MenuSelectHdl));
+ mxTemplateButton->connect_selected(LINK(this, BackingWindow, MenuSelectHdl));
+
+ ApplyStyleSettings();
+}
+
+void BackingWindow::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ if ((rDCEvt.GetType() != DataChangedEventType::SETTINGS)
+ || !(rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ {
+ InterimItemWindow::DataChanged(rDCEvt);
+ return;
+ }
+
+ ApplyStyleSettings();
+ Invalidate();
+}
+
+template <typename WidgetClass>
+void BackingWindow::setLargerFont(WidgetClass& pWidget, const vcl::Font& rFont)
+{
+ vcl::Font aFont(rFont);
+ aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * g_fMultiplier));
+ pWidget->set_font(aFont);
+}
+
+void BackingWindow::ApplyStyleSettings()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color aButtonsBackground(rStyleSettings.GetWindowColor());
+ const vcl::Font& aButtonFont(rStyleSettings.GetPushButtonFont());
+ const vcl::Font& aLabelFont(rStyleSettings.GetLabelFont());
+
+ // setup larger fonts
+ setLargerFont(mxOpenButton, aButtonFont);
+ setLargerFont(mxOpenButton, aButtonFont);
+ setLargerFont(mxRemoteButton, aButtonFont);
+ setLargerFont(mxRecentButton, aButtonFont);
+ setLargerFont(mxTemplateButton, aButtonFont);
+ setLargerFont(mxWriterAllButton, aButtonFont);
+ setLargerFont(mxDrawAllButton, aButtonFont);
+ setLargerFont(mxCalcAllButton, aButtonFont);
+ setLargerFont(mxDBAllButton, aButtonFont);
+ setLargerFont(mxImpressAllButton, aButtonFont);
+ setLargerFont(mxMathAllButton, aButtonFont);
+ setLargerFont(mxCreateLabel, aLabelFont);
+
+ mxAllButtonsBox->set_background(aButtonsBackground);
+ mxSmallButtonsBox->set_background(aButtonsBackground);
// compute the menubar height
sal_Int32 nMenuHeight = 0;
@@ -259,25 +304,6 @@ void BackingWindow::initializeLocalView()
}
}
-void BackingWindow::setupButton(weld::Button& rButton)
-{
- // the buttons should have a bit bigger font
- vcl::Font aFont(rButton.get_font());
- aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
- rButton.set_font(aFont);
- rButton.connect_clicked( LINK( this, BackingWindow, ClickHdl ) );
-}
-
-void BackingWindow::setupButton(weld::MenuButton& rButton)
-{
- vcl::Font aFont(rButton.get_font());
- aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
- rButton.set_font(aFont);
-
- rButton.connect_clicked(LINK(this, BackingWindow, ClickHdl));
- rButton.connect_selected(LINK(this, BackingWindow, MenuSelectHdl));
-}
-
void BackingWindow::checkInstalledModules()
{
SvtModuleOptions aModuleOpt;
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index f0a66edb5f77..391e582b9b22 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -78,9 +78,6 @@ class BackingWindow : public InterimItemWindow
bool mbInitControls;
std::unique_ptr<svt::AcceleratorExecute> mpAccExec;
- void setupButton(weld::Button& rButton);
- void setupButton(weld::MenuButton& rButton);
-
void dispatchURL(const OUString& i_rURL,
const OUString& i_rTarget = OUString("_default"),
const css::uno::Reference<css::frame::XDispatchProvider >& i_xProv = css::uno::Reference<css::frame::XDispatchProvider>(),
@@ -100,6 +97,11 @@ class BackingWindow : public InterimItemWindow
void checkInstalledModules();
+ void DataChanged(const DataChangedEvent&) override;
+
+ template <typename WidgetClass> void setLargerFont(WidgetClass&, const vcl::Font&);
+ void ApplyStyleSettings();
+
public:
explicit BackingWindow(vcl::Window* pParent);
virtual ~BackingWindow() override;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index b3ae786e97b0..21f00c62947a 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -1023,6 +1023,7 @@ void Qt5Frame::UpdateSettings(AllSettings& rSettings)
Color aText = toColor(pal.color(QPalette::Active, QPalette::Text));
Color aBase = toColor(pal.color(QPalette::Active, QPalette::Base));
Color aButn = toColor(pal.color(QPalette::Active, QPalette::ButtonText));
+ Color aMid = toColor(pal.color(QPalette::Active, QPalette::Mid));
Color aHigh = toColor(pal.color(QPalette::Active, QPalette::Highlight));
Color aHighText = toColor(pal.color(QPalette::Active, QPalette::HighlightedText));
Color aLink = toColor(pal.color(QPalette::Active, QPalette::Link));
@@ -1046,7 +1047,6 @@ void Qt5Frame::UpdateSettings(AllSettings& rSettings)
style.SetFieldColor(aBase);
style.SetWindowColor(aBase);
style.SetActiveTabColor(aBase);
- style.SetWorkspaceColor(aBase);
style.SetAlternatingRowColor(toColor(pal.color(QPalette::Active, QPalette::AlternateBase)));
// Buttons
@@ -1078,9 +1078,14 @@ void Qt5Frame::UpdateSettings(AllSettings& rSettings)
style.BatchSetBackgrounds(aBack);
style.SetInactiveTabColor(aBack);
+ // Workspace
+ style.SetWorkspaceColor(aMid);
+
// Selection
style.SetHighlightColor(aHigh);
style.SetHighlightTextColor(aHighText);
+ style.SetActiveColor(aHigh);
+ style.SetActiveTextColor(aHighText);
// Links
style.SetLinkColor(aLink);
More information about the Libreoffice-commits
mailing list