Skip to content
Snippets Groups Projects
Commit 4aecd897 authored by Darshan Jain's avatar Darshan Jain :speech_balloon: Committed by François Cartegnie
Browse files

qt: Update CSD Icons to Segoe Fonts available in different Windows Version

parent 50486d21
No related branches found
No related tags found
1 merge request!4984qt: Update CSD icons on windows to Segoe font
Pipeline #445124 passed with stage
in 43 minutes and 29 seconds
......@@ -62,6 +62,9 @@
#include <QWindow>
#include <QScreen>
#include <QOperatingSystemVersion>
#ifdef _WIN32
#include <QFileInfo>
#endif
......@@ -129,6 +132,19 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
m_sort = new SortCtx(this);
m_search = new SearchCtx(this);
// getOSInfo();
QOperatingSystemVersion currentOS = QOperatingSystemVersion::current();
switch (currentOS.type()) {
case QOperatingSystemVersion::OSType::Windows:
m_osName = Windows;
break;
default:
m_osName = Unknown;
break;
}
m_osVersion = (currentOS.majorVersion());
loadPrefs(false);
loadFromSettingsImpl(false);
......
......@@ -123,6 +123,10 @@ class MainCtx : public QObject
Q_PROPERTY(CSDButtonModel *csdButtonModel READ csdButtonModel CONSTANT FINAL)
//Property to get Operating System info
Q_PROPERTY(OsType osName READ getOSName CONSTANT)
Q_PROPERTY(int osVersion READ getOSVersion CONSTANT)
// This Property only works if hasAcrylicSurface is set
Q_PROPERTY(bool acrylicActive READ acrylicActive WRITE setAcrylicActive NOTIFY acrylicActiveChanged FINAL)
......@@ -170,9 +174,15 @@ public:
GROUPING_NAME,
GROUPING_FOLDER
};
Q_ENUM(Grouping)
enum OsType
{
Windows,
Unknown
};
Q_ENUM(OsType)
inline bool isInterfaceFullScreen() const { return m_windowVisibility == QWindow::FullScreen; }
inline bool isInterfaceVisible() const { return m_windowVisibility != QWindow::Hidden; }
bool isMediaLibraryVisible() { return m_mediaLibraryVisible; }
......@@ -215,6 +225,9 @@ public:
inline float safeArea() const { return m_safeArea; }
inline OsType getOSName() const {return m_osName;}
inline int getOSVersion() const {return m_osVersion;}
inline bool windowSuportExtendedFrame() const { return m_windowSuportExtendedFrame; }
inline unsigned windowExtendedMargin() const { return m_windowExtendedMargin; }
void setWindowSuportExtendedFrame(bool support);
......@@ -327,6 +340,9 @@ protected:
float m_safeArea = 0.0;
OsType m_osName;
int m_osVersion;
bool m_windowSuportExtendedFrame = false;
unsigned m_windowExtendedMargin = 0;
......
......@@ -33,6 +33,8 @@ T.Button {
property bool showHovered: false
property bool isThemeDark: false
readonly property bool useWinIcons: ((MainCtx.osName === MainCtx.Windows)&&(MainCtx.osVersion >= 10))
readonly property bool _paintHovered: control.hovered || showHovered
padding: 0
......@@ -65,6 +67,14 @@ T.Button {
id: icon
anchors.centerIn: parent
text: control.iconTxt
font.family:{
if (useWinIcons)
return "Segoe Fluent Icons, Segoe MDL2 Assets"
return VLCIcons.fontFamily
}
font.pixelSize: VLCStyle.icon_CSD
color: control.color
}
......
......@@ -66,20 +66,39 @@ Row {
isThemeDark: theme.palette.isDark
iconTxt: {
iconTxt:{
switch (modelData.type) {
case CSDButton.Minimize:
return VLCIcons.window_minimize
{
if (useWinIcons)
return "\uE921"
else
return VLCIcons.window_minimize
}
case CSDButton.MaximizeRestore:
return (MainCtx.intfMainWindow.visibility === Window.Maximized)
? VLCIcons.window_restore
: VLCIcons.window_maximize
{
if (useWinIcons)
return (MainCtx.intfMainWindow.visibility === Window.Maximized)
? "\uE923"
: "\uE922"
else
return (MainCtx.intfMainWindow.visibility === Window.Maximized)
? VLCIcons.window_restore
: VLCIcons.window_maximize
}
case CSDButton.Close:
return VLCIcons.window_close
}
{
if (useWinIcons)
return "\uE8BB"
else
return VLCIcons.window_close
}
}
console.assert(false, "unreachable")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment