Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
167e3ce3
Commit
167e3ce3
authored
Nov 24, 2020
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forgot to 'git add' the renamed cow_style_qt file.
parent
120d5835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
0 deletions
+108
-0
xtt/lib/cow/qt/cow_style_qt.cpp
xtt/lib/cow/qt/cow_style_qt.cpp
+108
-0
No files found.
xtt/lib/cow/qt/cow_style_qt.cpp
0 → 100644
View file @
167e3ce3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include "co_dcli.h"
#include "cow_style_qt.h"
#include <QApplication>
#include <QDialogButtonBox>
#include <QFile>
#include <QTextStream>
PwrStyle
::
PwrStyle
()
:
QProxyStyle
()
{
loadPalette
(
"$HOME/.pwr_style"
);
}
PwrStyle
::~
PwrStyle
()
{
if
(
pal
)
{
delete
pal
;
}
}
int
PwrStyle
::
pixelMetric
(
PixelMetric
which
,
const
QStyleOption
*
option
,
const
QWidget
*
widget
)
const
{
switch
(
which
)
{
case
PM_LayoutLeftMargin
:
case
PM_LayoutTopMargin
:
case
PM_LayoutRightMargin
:
case
PM_LayoutBottomMargin
:
case
PM_LayoutHorizontalSpacing
:
case
PM_LayoutVerticalSpacing
:
case
PM_ToolBarItemMargin
:
case
PM_ToolBarItemSpacing
:
return
0
;
default:
return
QProxyStyle
::
pixelMetric
(
which
,
option
,
widget
);
}
}
int
PwrStyle
::
styleHint
(
StyleHint
hint
,
const
QStyleOption
*
option
,
const
QWidget
*
widget
,
QStyleHintReturn
*
returnData
)
const
{
if
(
hint
==
SH_DialogButtonLayout
)
{
return
QDialogButtonBox
::
WinLayout
;
}
return
QProxyStyle
::
styleHint
(
hint
,
option
,
widget
,
returnData
);
}
void
PwrStyle
::
loadPalette
(
const
char
*
path
)
{
char
fname
[
200
];
dcli_translate_filename
(
fname
,
path
);
QFile
f
(
fname
);
if
(
!
f
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
{
return
;
}
pal
=
new
QPalette
(
standardPalette
());
QTextStream
in
(
&
f
);
QStringList
lines
=
in
.
readAll
().
split
(
'\n'
,
QString
::
SkipEmptyParts
);
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++
)
{
QStringList
line
=
lines
[
i
].
split
(
' '
,
QString
::
SkipEmptyParts
);
if
(
line
.
size
()
<
2
)
{
fprintf
(
stderr
,
"Error parsing line %d in file %s
\n
"
,
(
i
+
1
),
fname
);
continue
;
}
QPalette
::
ColorRole
role
=
QPalette
::
ColorRole
(
atoi
(
qPrintable
(
line
[
0
])));
pal
->
setBrush
(
QPalette
::
ColorGroup
(
0
),
role
,
QColor
(
line
[
1
]));
pal
->
setBrush
(
QPalette
::
ColorGroup
(
2
),
role
,
QColor
(
line
[
1
]));
if
(
line
.
size
()
>
2
&&
QColor
(
line
[
2
]).
isValid
())
{
pal
->
setBrush
(
QPalette
::
ColorGroup
(
1
),
role
,
QColor
(
line
[
2
]));
}
else
{
pal
->
setBrush
(
QPalette
::
ColorGroup
(
1
),
role
,
QColor
(
line
[
1
]));
}
}
QApplication
::
setPalette
(
*
pal
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment