skulpture-0.2.4/ 0000755 0001750 0000144 00000000000 11333667520 012443 5 ustar pepo users skulpture-0.2.4/README.html 0000600 0001750 0000144 00000004611 11333641652 014256 0 ustar pepo users
Skulpture
Skulpture
About Skulpture
Skulpture is a GUI style addon for KDE programs. It features a classical
three-dimensional artwork with shadows and smooth gradients to enhance the
visual experience.
Skulpture has been designed to be light and easy on eyes; many distracting
borders or graphical elements have been removed or replaced by simpler
artwork.
You can set Skulpture as the KDE default style with the "System Settings"
program. Skulpture includes a style for applications, color schemes, and a
theme for the KDE window manager. For a matching Plasma style, install the
Atelier theme.
Skulpture can also be used with Qt programs. To do so, use the command line
option "-style Skulpture" when invoking the Qt program. Additionally, you
can set this style as the Qt default style with the "qtconfig" program.
Version Information
This is version 0.2.4 of Skulpture, released on 08-Feb-2010. See NEWS for
a summary of changes relative to the previous version, and NOTES for
additional information for this version. Some features are still missing;
see BUGS for details.
To find out if a newer version of Skulpture is available, please visit the
Skulpture homepage.
Legal
Skulpture is Copyright 2007-2010 Christoph Feck. See AUTHORS for ways to
contact him.
Skulpture 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 3 of the License, or (at your option)
any later version.
Skulpture 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 COPYING for more details.
skulpture-0.2.4/README 0000600 0001750 0000144 00000003372 11333641316 013313 0 ustar pepo users === Skulpture ===
*** About Skulpture ***
Skulpture is a GUI style addon for KDE programs. It features a classical
three-dimensional artwork with shadows and smooth gradients to enhance the
visual experience.
Skulpture has been designed to be light and easy on eyes; many distracting
borders or graphical elements have been removed or replaced by simpler
artwork.
You can set Skulpture as the KDE default style with the "System Settings"
program. Skulpture includes a style for applications, color schemes, and a
theme for the KDE window manager. For a matching Plasma style, install the
Atelier theme.
Skulpture can also be used with Qt programs. To do so, use the command line
option "-style Skulpture" when invoking the Qt program. Additionally, you
can set this style as the Qt default style with the "qtconfig" program.
*** Version Information ***
This is version 0.2.4 of Skulpture, released on 08-Feb-2010. See NEWS for
a summary of changes relative to the previous version, and NOTES for
additional information for this version. Some features are still missing;
see BUGS for details.
To find out if a newer version of Skulpture is available, please visit the
Skulpture homepage at http://skulpture.maxiom.de/
*** Legal ***
Skulpture is Copyright 2007-2010 Christoph Feck. See AUTHORS for ways to
contact him.
Skulpture 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 3 of the License, or (at your option)
any later version.
Skulpture 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 COPYING for more details.
skulpture-0.2.4/CMakeLists.txt 0000600 0001750 0000144 00000003476 11127453455 015206 0 ustar pepo users project (skulpture)
cmake_minimum_required (VERSION 2.4)
find_package (KDE4)
add_definitions (-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_KEYWORDS -DQT_STRICT_ITERATORS -DQT_NO_DYNAMIC_CAST)
configure_file (config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
if (KDE4_FOUND)
include (KDE4Defaults)
include (MacroLibrary)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${KDE4_INCLUDES} ${CMAKE_BINARY_DIR})
# find_package (KDE4Workspace QUIET)
set (KDE4WORKSPACE_FOUND OFF)
if (KDE4WORKSPACE_FOUND)
message (STATUS "Found KDE4Workspace")
include_directories (${KDE4WORKSPACE_INCLUDE_DIR})
set (BUILD_KWIN_CLIENT ON)
else (KDE4WORKSPACE_FOUND)
message (STATUS "Looking for kwinglobals.h")
find_file (KWINGLOBALS_H kwinglobals.h ${KDE4_INCLUDES})
if (KWINGLOBALS_H)
message (STATUS "Looking for kwinglobals.h - found")
set (BUILD_KWIN_CLIENT ON)
else (KWINGLOBALS_H)
message (STATUS "Looking for kwinglobals.h - not found.")
endif (KWINGLOBALS_H)
endif (KDE4WORKSPACE_FOUND)
else (KDE4_FOUND)
set (QT_MIN_VERSION "4.1.0")
find_package (Qt4 REQUIRED)
include (UseQt4)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories (${CMAKE_BINARY_DIR})
endif (KDE4_FOUND)
add_subdirectory (src)
if (KDE4_FOUND)
macro_optional_add_subdirectory (color-schemes)
macro_optional_add_subdirectory (desktoptheme)
if (BUILD_KWIN_CLIENT)
add_subdirectory (kwin-client)
else (BUILD_KWIN_CLIENT)
message ("WARNING: *** KWin headers not found, building without Skulpture window decoration ***")
endif (BUILD_KWIN_CLIENT)
else (KDE4_FOUND)
message ("WARNING: *** KDE4 not found, building a Qt-only version of Skulpture ***")
endif (KDE4_FOUND)
skulpture-0.2.4/NEWS 0000600 0001750 0000144 00000025124 11333575642 013141 0 ustar pepo users New in 0.2.4:
Bugfixes:
* fixed possible crash when destroying MDI windows
* fixed possible crash when destroying menus
* fixed Tab key handling in Konversation
* fixed detection of default font (KDE 4.4)
* fixed menu item rectangle and input handler (Qt 4.6)
* fixed text rendering in vertical ProgressBar
* fixed frame in "east" TabWidget (Qt 4.6)
* fixed workaround for KIntNumInput size bug (KDE 4.4)
* fixed MDI window title placement with RTL layouts
* fixed ToolBar icon size to respect KDE setting (KDE 4.4)
* fixed single click mode to respect KDE setting (KDE 4.4)
* fixed vertical centering regressions (Qt 4.6.1)
* fixed vertical alignment of labels in FormLayout (Qt 4.6.2)
* fixed flashing of ScrollBar in PlacesPanel
* fixed widget flags in KWin window decoration client
* fixed menubar margin for improved full-screen usability
* fixed "Alternate Background" color in Skulpture color schemes
* fixed build warnings (KDE 4.3)
* fixed build failure with Qt 4.1
New in 0.2.3:
Bugfixes:
* fixed ToolButton with menu (Qt 4.5)
* fixed detection of Dolphin InformationPanel (KDE 4.3)
* fixed rendering of transparent gradients (Qt 4.5)
* fixed black frame in KRunner LineEdit
* fixed MDI title shadow with raster graphics system (Qt 4.5.0 bug)
* fixed ButtonMargin pixel metric regression
* fixed menus not working after hovering menu titles
* fixed focus rendering on menu titles
* fixed corner buttons on document mode TabBar (Qt 4.5)
* fixed shortcut underlines in preview (KDE 4.3)
* fixed Esc key clearing preview window
* fixed corner buttons on "south" TabWidget (Konversation)
* fixed eliding of tabs in small TabBar
* fixed disabled ToolButton in inactive windows
* fixed "south" document mode tabs (Konsole 4.3)
* fixed Dial tickmarks (Qt 4.6)
* fixed right shadow on frameless spinbox
* fixed a few build warnings
New in 0.2.2:
New Style Configuration Options:
* added option to change text cursor width (Qt 4.4)
* added option to change submenu delay
* added "KDE Style" to ScrollBar arrow placement options
New KWin Decoration Configuration Options:
* added option to change title bar height and symbol sizes
* added option to center title bar on full window width
* added option to configure pixel-exact border sizes
Bugfixes:
* fixed arrow placement configuration in non english locales
* fixed submenus appearing only when not moving the mouse (Qt bug)
* fixed cursor indication to follow mouse on hover in LineEdit
* fixed wrong color role on non-raised ToolButton/ToolBox labels
* fixed keyboard focus indicator for view items
* fixed double frame in KMail (KDE 4.2)
* fixed build with KDE 4.0
New in 0.2.1:
New Style Configuration Options:
* added option to change TabBar size
* added option to change Slider and minimum ScrollBar length
* added option to change ScrollBar arrow placement
* added option to make PlacesPanel transparent
New KWin Decoration Configuration Options:
* added option to adjust vertical text shift
* added option to change horizontal text alignment
* added option to disable inactive frame coloring
Bugfixes:
* fixed possible crash when destroying TextEdit widgets
* fixed Slider to have the specified pixel size
* fixed large icons to only use standard sizes
* fixed KLineEdit's clear button not respecting font size
* fixed preview window to respect KDE UI standards
* fixed clipped text on ToolButton with text under icon
* fixed memory leak in ToolBar handle
* fixed hover feedback of icon in KWin window decoration client
* fixed tabs with icons (Qt 4.5)
* fixed user installation script to not fail when installing twice
New in 0.2.0:
New Configuration Options (requires KDE 4):
* added option to respect "Disabled" colors from System Settings
* added option to adjust vertical text shift
* added option to change ScrollBar, Slider, and menu sizes
* added option to change widget margins and spacing
* added option to change password character
* added option to disable icon in KWin window decoration client
Visual Improvements:
* improved appearance of CheckBox, RadioButton, and ProgressBar
* implemented rendering of Qt 3 support elements
* implemented rendering of KMenu titles (KDE 4.1)
* unified appearance of SpinBox and ComboBox
* made small visual improvements to other elements
Bugfixes:
* fixed slow cursor movement in large TextEdit fields
* fixed hover feedback of selected CheckBox
* fixed CheckBox and RadioButton in dark color schemes
* fixed NoButtons/PlusMinus SpinBox button modes
* fixed ScrollBar slider covering both arrows at the same time
* fixed layout and rendering with non-zero global strut
* fixed tree expanders not respecting font size
* fixed frameless SpinBox and ComboBox
* fixed wrong usage of color roles in various places
* fixed missing icons in MenuBar
* fixed missing etching of disabled texts in menus
* fixed check indicators covering menu icons
* fixed missing separator texts in menus
* fixed frames and shadows in more widgets
* fixed HMTLView frame
* fixed wrong frame in ComboBox popup menu
* fixed missing shadow for views in menus
* fixed missing shadow in sunken ScrollArea
* fixed shadow in KColorSelector
* fixed Restore decoration button to not look identical to Maximize
* fixed vertical alignment of labels in FormLayout (Qt 4.4)
* fixed password character to fall back to ASCII symbol
* fixed LineEdit focus highlight in Arora (Qt 4 demo browser)
* fixed user installation script to find KDE4 on Kubuntu
* fixed build failure if KWin headers are not found
* fixed memory leak
Other Changes:
* improved support for custom Qt style sheets
* improved user installation script with build log file generation
* refactored code to only depend on QCommonStyle
* backported to Qt 4.2 for LSB 4.0 conformant systems
* added a Skulpture web log
New in 0.1.3:
* fixed black background on transparent buttons
* fixed black background on LineEdit with certain style sheets
* some other small fixes and improvements:
* fixed title bar Help button to not depend on font shape
* fixed MDI window shadows to not expand outside of MDI area
* fixed title bar caption and buttons in vertical docks
* fixed Menu icon column without icons (Qt 4.5)
* improved arrows in MenuBar and ToolBar extender
* added support for ToolButton with menu arrow in vertical ToolBar
* improved ToolButton with menu arrow
* fixed rendering of vertical tabs
* improved scroll buttons in TabBar
* fixed TabWidget corner buttons (KTorrent)
* fixed wrong font on dragged item view header section
* removed dash pattern from selection rubberband
* fixed ScrollBar size to not depend on content font size
New in 0.1.2:
* initial work on title bar decoration buttons (KWin, MDI, docks)
* fixed custom KWin button placement
* fixed crash in styled ItemView (Qt 4.4)
* some other small fixes and improvements:
* fixed size and disabled state for check indicators in MenuItem
* fixed menu stripe in RTL layouts
* improved size of submenu arrow
* added clipping of window caption
* added support for remaining KWin buttons (see NOTES)
* fixed MDI window title bar to use KWin colors (see NOTES)
* added mouse over highlight to flat PushButton
* fixed arrow position on menu PushButton
* implemented rendering of KLineEdit's clear button
* implemented rendering of ToolBox (Marble, Kalzium)
* implemented rendering of ToolBar handles
* fixed item highlight border on Table without grid
* initial work on color schemes (Skulpture in different flavors)
New in 0.1.1:
* fixed missing check indicator in checked MenuItem with icon
* fixed initial green title bar in KWin decoration (again)
* some other small fixes and improvements:
* fixed TabWidget without tabs
* fixed shadow in editable ComboBox with icon
* fixed separator line in Dolphin information panel
* fixed MenuBar height in Konqueror
* removed frame from TabWidget corner buttons
* restored normal size of ComboBox in ToolBar
New in 0.1.0:
* improved support for KDE color schemes
* added preview to configuration page (KDE4)
* added support for Qt 4.4.0
* many other small fixes and improvements:
* implemented rendering of dock titles
* implemented rendering of tree lines and expanders
* implemented rendering of resize grip
* implemented rendering of view item backgrounds (Qt 4.4)
* added button-like highlight of menu items
* added shadows to MDI windows
* added a slight shadow to Slider handles
* added automatic cursor size depending on font width
* added current line highlight to PlainTextEdit (Qt 4.4)
* added mouse over hightlight to clickable header sections
* fixed frames and shadows in more widgets
* fixed rendering of TabBar background in Konquerer
* fixed rendering of "south" tabs (Konsole, docks)
* fixed corner rendering in scroll areas
* fixed wrong palette on Qt 4.4
* fixed initial green title bar in KWin decoration (Qt 4.4)
* fixed background in KDE font selection preview
* improved some layouting values (ComboBox, MDI buttons)
* added RSS feed to Skulpture website
New in 0.0.4:
* initial work on KWin window decoration client (KDE4)
* fixed rendering of Slider with tickmarks
* fixed bogus frames and shadows
* improved appearance of arrows
* some other small fixes and improvements
New in 0.0.3:
* fixed margins of SpinBox and ComboBox on Qt 4.3.1
* improved rendering of Dial and TabBar
* some other small fixes and improvements
* renamed to Skulpture (old name: Skandale)
New in 0.0.2:
* initial work on ComboBox, SpinBox, ScrollBar, and Slider
* initial work on Window (MDI), FocusFrame, and ToolButton
* made Dial useable
* fixed crash in TextEdit
* fixed rendering of wide PushButton and non-editable ComboBox
New in 0.0.1:
* imagery for RadioButton and CheckBox
* more flat PushButton, with improved visual feedback
* improved HeaderView
* initial work on TabBar and Dial
* highlight current line in TextEdit (same as in LineEdit)
skulpture-0.2.4/INSTALL 0000600 0001750 0000144 00000001176 11333642147 013467 0 ustar pepo users === Installing Skulpture ===
*** Installation ***
Installation from source requires CMake. To install, type the following at
the shell prompt within the "skulpture-0.2.4" directory, including the
dot. Note that you are prompted for the root password during installation.
sh install.sh
You should restart the system after installation, so that KWin sees the
freshly installed style.
*** Deinstallation ***
To uninstall, type the following at the shell prompt within the directory
from which you installed. If you deleted that directory, just install it
again. Again, you are prompted for the root password.
sh uninstall.sh
skulpture-0.2.4/src/ 0000700 0001750 0000144 00000000000 11333667520 013220 5 ustar pepo users skulpture-0.2.4/src/CMakeLists.txt 0000600 0001750 0000144 00000001264 11067742764 015775 0 ustar pepo users project (kstyle-skulpture)
set (skulpture_SOURCES skulpture.cpp)
#if (KDE4_FOUND)
# kde4_add_plugin (skulpture ${skulpture_SOURCES})
# target_link_libraries (skulpture ${KDE4_KDEUI_LIBS})
# install (TARGETS skulpture DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles)
#else (KDE4_FOUND)
qt4_automoc (${skulpture_SOURCES})
add_library (skulpture SHARED ${skulpture_SOURCES})
target_link_libraries (skulpture ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
install (TARGETS skulpture LIBRARY DESTINATION ${QT_PLUGINS_DIR}/styles)
#endif (KDE4_FOUND)
if (KDE4_FOUND)
install (FILES skulpture.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes)
add_subdirectory (config)
endif (KDE4_FOUND)
skulpture-0.2.4/src/.directory 0000600 0001750 0000144 00000000047 10773730665 015240 0 ustar pepo users [Dolphin]
Timestamp=2008,3,30,17,28,53
skulpture-0.2.4/src/config/ 0000700 0001750 0000144 00000000000 11333667520 014465 5 ustar pepo users skulpture-0.2.4/src/config/sk_dialog.ui 0000600 0001750 0000144 00000074171 11161735514 016772 0 ustar pepo users
SkulptureStyleDialog
-
QFrame::StyledPanel
QFrame::Sunken
-
0
General
-
Style Options
-
Hide shortcut underlines
true
-
Appearance
-
false
Use selection color for checked indicators
-
Make disabled widgets transparent
true
-
-
0
0
Text shift:
-
0
0
-9
9
-
(only applies to default font)
-
Qt::Horizontal
QSizePolicy::Expanding
40
20
-
Qt::Vertical
20
0
Layout
-
false
Many applications, especially KDE dialogs, ignore the style's spacing and margin values. Setting this option tries to force the values on all applications.
Force spacing and margin values on all layouts
-
-
Sizes
-
Widgets:
-
(default)
pixels
-1
-1
-
Push buttons:
-
(default)
pixels
-1
-1
-
Tool buttons:
-
(default)
pixels
-1
-1
-
Tab bars:
-
(default)
pixels
-1
-1
-
Spacing and Margins
-
Horizontal:
-
(default)
pixels
-1
-1
-
Vertical:
-
(default)
pixels
-1
-1
-
Labels:
-
(default)
pixels
-1
-1
-
Groups:
-
(default)
pixels
-1
-1
-
Dialogs:
-
(default)
pixels
-1
-1
Menus
-
Sizes
-
Menu bar:
-
(default)
pixels
-1
-1
-
Menu items:
-
(default)
pixels
-1
-1
-
false
Appearance
-
Use icon column for check indicators
-
Use selection color for selected items
-
Usability
-
Submenu delay:
-
ms
2000
50
100
-
Qt::Vertical
20
27
Sliders
-
Scroll Bar Arrow Position
-
Vertical arrows:
-
-
Covered
-
Bottom
-
Bottom/Top
-
KDE Style
-
Top
-
None
-
Horizontal arrows:
-
-
Covered
-
Right
-
Right/Left
-
KDE Style
-
Left
-
None
-
Sizes
-
Slider thickness:
-
Scroll bar thickness:
-
-
(default)
pixels
-1
2
-1
-
Length:
-
(default)
pixels
-1
-1
-
-
(default)
pixels
-1
2
-1
-
Length:
-
(default)
pixels
-1
-1
-
Qt::Vertical
0
0
Miscellaneous
-
Progress Bars
-
Animate progress bars
true
-
Text Fields
-
(default)
pixels
1
8.000000000000000
-
Cursor width:
-
true
-
✷
-
●
-
•
-
*
-
Password character:
-
Places Panel
-
Use transparent places panel
-
false
Buttons
-
Roundness:
-
9
Qt::Horizontal
-
Gradient:
-
-50
50
Qt::Horizontal
-
Qt::Vertical
20
0
KTabWidget
QTabWidget
1
KComboBox
QComboBox
skulpture-0.2.4/src/config/sk_preview1.ui 0000600 0001750 0000144 00000046116 11333366247 017277 0 ustar pepo users
SkulpturePreview1
-
Qt::Horizontal
-
Show Disabled
true
false
false
-
-
Group
-
Check Box
true
-
Radio Button
true
-
Radio Button
-
Qt::Vertical
QSizePolicy::MinimumExpanding
20
0
-
Push Button
false
0
0
0
272
210
Widgets
-
-
Text Line Edit
LineEdit (empty)
true
-
-
Combo Box
-
Element
-
-
-
-
100
70
-
70
-
100
70
Qt::Horizontal
-
0
0
50
50
50
50
100
70
true
-
Qt::Vertical
QSizePolicy::MinimumExpanding
20
0
-
Qt::Horizontal
-
70
0
0
272
210
Text
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
<tr>
<td style="border: none;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600;">Skulpture</span></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><span style=" font-weight:400;">Version 0.2.4</span></p>
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://skulpture.maxiom.de/"><span style=" text-decoration: underline; color:#0057ae;">http://skulpture.maxiom.de/</span></a></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Copyright © 2007-2010 Christoph Feck</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></td></tr></table></body></html>
0
0
272
210
Tree
-
Column 1
Column 2
-
Element
(expandable)
-
Element
Line 1
-
Element
Line 2
-
Element
Line 3
-
Element
(not expandable)
0
0
272
210
Table
-
Column 1
Column 2
Column 3
Column 4
KLineEdit
QLineEdit
KTextEdit
QTextEdit
KComboBox
QComboBox
KTabWidget
QTabWidget
dial
valueChanged(int)
progressBar
setValue(int)
375
126
337
219
dial
valueChanged(int)
lcdNumber
display(int)
374
131
287
133
dial
valueChanged(int)
spinBox
setValue(int)
375
111
302
106
spinBox
valueChanged(int)
progressBar
setValue(int)
245
110
308
220
spinBox
valueChanged(int)
lcdNumber
display(int)
339
121
339
139
spinBox
valueChanged(int)
dial
setValue(int)
236
108
379
122
horizontalSlider
valueChanged(int)
progressBar
setValue(int)
323
79
380
223
horizontalSlider
valueChanged(int)
lcdNumber
display(int)
359
82
256
136
horizontalSlider
valueChanged(int)
spinBox
setValue(int)
285
78
260
107
horizontalSlider
valueChanged(int)
dial
setValue(int)
300
80
380
123
pushButton_2
toggled(bool)
groupBox
setDisabled(bool)
106
24
104
43
pushButton_2
toggled(bool)
Text
setDisabled(bool)
117
26
137
40
pushButton_2
toggled(bool)
comboBox
setDisabled(bool)
83
25
93
191
pushButton_2
toggled(bool)
pushButton
setDisabled(bool)
66
23
80
225
dial
valueChanged(int)
horizontalSlider
setValue(int)
376
135
374
83
spinBox
valueChanged(int)
horizontalSlider
setValue(int)
216
108
225
83
skulpture-0.2.4/src/config/sk_preview2.ui 0000600 0001750 0000144 00000012707 11333366225 017273 0 ustar pepo users
SkulpturePreview2
0
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:16px; margin-bottom:16px; margin-left:16px; margin-right:16px;">
<tr>
<td style="border: none;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600;">Skulpture</span></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><span style=" font-weight:400;">Version 0.2.4</span></p>
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://skulpture.maxiom.de/"><span style=" text-decoration: underline; color:#0057ae;">http://skulpture.maxiom.de/</span></a></p>
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Copyright © 2007-2010 Christoph Feck</span></p>
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-size:10pt;">This is a demonstration window only</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Lorem ipsum dolor sit amet, consectetuer sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></td></tr></table></body></html>
true
KXmlGuiWindow
QMainWindow
skulpture-0.2.4/src/config/CMakeLists.txt 0000600 0001750 0000144 00000001007 11115155423 017215 0 ustar pepo users set (kstyle_skulpture_config_SOURCES sk_config.cpp)
kde4_add_ui_files (kstyle_skulpture_config_SOURCES sk_dialog.ui sk_preview1.ui sk_preview2.ui)
kde4_add_plugin (kstyle_skulpture_config ${kstyle_skulpture_config_SOURCES})
target_link_libraries (kstyle_skulpture_config ${KDE4_KDEUI_LIBS})
install (FILES skulpture.png DESTINATION ${DATA_INSTALL_DIR}/skulpture/pics)
install( FILES skulptureui.rc DESTINATION ${DATA_INSTALL_DIR}/skulpture)
install (TARGETS kstyle_skulpture_config DESTINATION ${PLUGIN_INSTALL_DIR})
skulpture-0.2.4/src/config/configmanager.h 0000600 0001750 0000144 00000021527 11123603732 017437 0 ustar pepo users /*
* configmanager.h - Classical Three-Dimensional Artwork for Qt 4
*
* Copyright (c) 2008 Christoph Feck
*
* 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 3 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef CONFIGMANAGER_H
#define CONFIGMANAGER_H 1
/*-----------------------------------------------------------------------*/
#include
#include
#include
#include
#include
#include
#include
class ConfigManager
{
public:
ConfigManager() {
/* */
}
~ConfigManager() {
/* */
}
public:
void addWidgets(QWidget *parent) {
typedef QList WidgetList;
WidgetList widgets = parent->findChildren(QRegExp(QLatin1String("^cm_")));
for (WidgetList::const_iterator i = widgets.constBegin(); i != widgets.constEnd(); ++i) {
QWidget *widget = *i;
if (widget->isEnabled()) {
items.append(ConfigItem(widget, QVariant()));
items.last().configDefault = items.last().value();
}
}
}
void connectConfigChanged(QObject *receiver, const char slot[]) const {
for (ItemList::const_iterator item = items.constBegin(); item != items.constEnd(); ++item) {
item->connectValueChanged(receiver, slot);
}
}
void save(QSettings &settings) const {
for (ItemList::const_iterator item = items.constBegin(); item != items.constEnd(); ++item) {
QVariant value = item->value();
if (!value.isNull()) {
if (value == item->configDefault) {
settings.remove(item->configLabel());
} else {
settings.setValue(item->configLabel(), item->value());
}
}
}
}
void load(const QSettings &settings) const {
for (ItemList::const_iterator item = items.constBegin(); item != items.constEnd(); ++item) {
item->setValue(((ConfigItem) *item).configSaved = settings.value(item->configLabel(), item->configDefault));
}
}
bool hasChanged() const {
for (ItemList::const_iterator item = items.constBegin(); item != items.constEnd(); ++item) {
if (item->configSaved != item->value()) {
return true;
}
}
return false;
}
void defaults() const {
for (ItemList::const_iterator item = items.constBegin(); item != items.constEnd(); ++item) {
item->setValue(item->configDefault);
}
}
private:
class ConfigItem
{
public:
ConfigItem(QWidget *widget, const QVariant &def = QVariant())
: configWidget(widget), configDefault(def) {
/* */
}
public:
void setValue(const QVariant &value) const;
QVariant value() const;
void connectValueChanged(QObject *receiver, const char slot[]) const;
QString configLabel() const;
QString comboLabel(int index) const;
public:
QWidget *configWidget;
QVariant configDefault;
QVariant configSaved;
};
private:
typedef QList ItemList;
private:
ItemList items;
};
void ConfigManager::ConfigItem::setValue(const QVariant &value) const
{
if (QCheckBox *widget = qobject_cast(configWidget)) {
widget->setChecked(value.toBool());
} else if (QSpinBox *widget = qobject_cast(configWidget)) {
widget->setValue(value.toInt());
} else if (QDoubleSpinBox *widget = qobject_cast(configWidget)) {
widget->setValue(value.toDouble());
} else if (QAbstractSlider *widget = qobject_cast(configWidget)) {
widget->setValue(value.toInt());
} else if (QLineEdit *widget = qobject_cast(configWidget)) {
widget->setText(value.toString());
} else if (QComboBox *widget = qobject_cast(configWidget)) {
int index;
if (widget->isEditable()) {
index = widget->findText(value.toString());
if (index < 0) {
if (widget->isEditable()) {
widget->addItem(value.toString());
index = widget->findText(value.toString());
} else {
return;
}
}
} else {
index = 0;
for (int i = widget->count(); --i >= 0; ) {
if (value.toString() == comboLabel(i)) {
index = i;
break;
}
}
}
widget->setCurrentIndex(index);
}
}
QVariant ConfigManager::ConfigItem::value() const
{
if (QCheckBox *widget = qobject_cast(configWidget)) {
return widget->isChecked();
} else if (QSpinBox *widget = qobject_cast(configWidget)) {
return widget->value();
} else if (QDoubleSpinBox *widget = qobject_cast(configWidget)) {
return widget->value();
} else if (QAbstractSlider *widget = qobject_cast(configWidget)) {
return widget->value();
} else if (QLineEdit *widget = qobject_cast(configWidget)) {
return widget->text();
} else if (QComboBox *widget = qobject_cast(configWidget)) {
if (widget->isEditable()) {
return widget->currentText();
} else {
return comboLabel(widget->currentIndex());
}
}
return QVariant();
}
void ConfigManager::ConfigItem::connectValueChanged(QObject *receiver, const char slot[]) const
{
if (QCheckBox *widget = qobject_cast(configWidget)) {
QObject::connect(widget, SIGNAL(toggled(bool)), receiver, slot);
} else if (QSpinBox *widget = qobject_cast(configWidget)) {
QObject::connect(widget, SIGNAL(valueChanged(int)), receiver, slot);
} else if (QDoubleSpinBox *widget = qobject_cast(configWidget)) {
QObject::connect(widget, SIGNAL(valueChanged(double)), receiver, slot);
} else if (QAbstractSlider *widget = qobject_cast(configWidget)) {
QObject::connect(widget, SIGNAL(valueChanged(int)), receiver, slot);
} else if (QLineEdit *widget = qobject_cast(configWidget)) {
QObject::connect(widget, SIGNAL(textChanged(QString)), receiver, slot);
} else if (QComboBox *widget = qobject_cast(configWidget)) {
if (widget->isEditable()) {
QObject::connect(widget, SIGNAL(editTextChanged(QString)), receiver, slot);
} else {
QObject::connect(widget, SIGNAL(currentIndexChanged(int)), receiver, slot);
}
}
}
QString ConfigManager::ConfigItem::configLabel() const
{
QString cmName = configWidget->objectName().mid(3);
if (QComboBox *widget = qobject_cast(configWidget)) {
if (!widget->isEditable()) {
int index = -1;
for (int i = widget->count(); --i >= 0;) {
index = cmName.lastIndexOf(QChar('_', 0), index - 1);
}
cmName = cmName.left(index);
}
}
return cmName.replace(QChar('_', 0), QChar('/', 0));
}
QString ConfigManager::ConfigItem::comboLabel(int index) const
{
QString cmName = configWidget->objectName().mid(3);
int scanIndex = -1;
int lastIndex = -1; // avoid warning
for (int i = qobject_cast(configWidget)->count() - index; --i >= 0; ) {
lastIndex = scanIndex;
scanIndex = cmName.lastIndexOf(QChar('_', 0), scanIndex - 1);
}
++scanIndex;
if (lastIndex == -1) {
cmName = cmName.mid(scanIndex);
} else {
cmName = cmName.mid(scanIndex, lastIndex - scanIndex);
}
return cmName;
}
/*-----------------------------------------------------------------------*/
#endif
skulpture-0.2.4/src/config/skulptureui.rc 0000644 0001750 0000144 00000000366 11115100410 017400 0 ustar pepo users
Go ToolBar
skulpture-0.2.4/src/config/sk_config.cpp 0000600 0001750 0000144 00000035373 11333366417 017151 0 ustar pepo users /*
* sk_config.cpp - Classical Three-Dimensional Artwork for Qt 4
*
* Copyright (c) 2008 Christoph Feck
*
* 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 3 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "sk_config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*-----------------------------------------------------------------------*/
extern "C" KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent)
{
return new SkulptureStyleConfig(parent);
}
/*-----------------------------------------------------------------------*/
#include "ui_sk_preview1.h"
class Preview1Window : public QDialog, private Ui::SkulpturePreview1
{
public:
explicit Preview1Window(QWidget *parent = 0);
public:
virtual void closeEvent(QCloseEvent *e);
QLayout *dialogLayout() const {
return verticalLayout_9;
}
private:
void init();
};
Preview1Window::Preview1Window(QWidget *parent)
: QDialog(parent)
{
init();
}
void Preview1Window::closeEvent(QCloseEvent *e)
{
e->ignore();
}
void Preview1Window::init()
{
setWindowFlags(Qt::Widget);
setupUi(this);
}
/*-----------------------------------------------------------------------*/
#include "ui_sk_preview2.h"
class Preview2Window : public KXmlGuiWindow, private Ui::SkulpturePreview2
{
public:
explicit Preview2Window(QWidget *parent, const KComponentData &componentData);
public:
virtual void closeEvent(QCloseEvent *e);
private:
void init(const KComponentData &componentData);
};
Preview2Window::Preview2Window(QWidget *parent, const KComponentData &componentData)
: KXmlGuiWindow(parent)
{
init(componentData);
}
void Preview2Window::closeEvent(QCloseEvent *e)
{
e->ignore();
}
static const KStandardAction::StandardAction standardAction[] = {
KStandardAction::New, KStandardAction::Open, KStandardAction::OpenRecent, KStandardAction::Save, KStandardAction::SaveAs, KStandardAction::Revert, KStandardAction::Close,
// Print, PrintPreview, Mail,
KStandardAction::Quit, // KStandardAction::Undo, KStandardAction::Redo,
KStandardAction::Cut, KStandardAction::Copy, KStandardAction::Paste,
// SelectAll, Deselect,
KStandardAction::Find, KStandardAction::FindNext, KStandardAction::FindPrev, KStandardAction::Replace,
// ActualSize, FitToPage, FitToWidth, FitToHeight, ZoomIn, ZoomOut, Zoom, Redisplay,
KStandardAction::Up, KStandardAction::Back, KStandardAction::Forward, KStandardAction::Home,
// Prior, Next, Goto, GotoPage, GotoLine,
// FirstPage, LastPage, DocumentBack, DocumentForward,
// AddBookmark, EditBookmarks, Spelling,
KStandardAction::ShowMenubar, KStandardAction::ShowToolbar, KStandardAction::ShowStatusbar,
/*SaveOptions, */ KStandardAction::KeyBindings,
/*Preferences, */ KStandardAction::ConfigureToolbars,
// Help, HelpContents, WhatsThis, ReportBug, AboutApp, AboutKDE,
// TipofDay, ConfigureNotifications, FullScreen, Clear,
// PasteText, SwitchApplicationLanguage,
KStandardAction::ActionNone
};
void Preview2Window::init(const KComponentData &componentData)
{
setWindowFlags(Qt::Widget);
setupUi(this);
setHelpMenuEnabled(false);
setComponentData(componentData);
for (uint i = 0; i < sizeof(standardAction) / sizeof(standardAction[0]); ++i) {
if (standardAction[i] != KStandardAction::ActionNone) {
actionCollection()->addAction(standardAction[i]);
}
}
createGUI();
//menuBar()->removeAction(menuBar()->actions().last());
KHelpMenu *helpMenu = new KHelpMenu(this, componentData.aboutData(), false);
menuBar()->addMenu((QMenu *) helpMenu->menu());
statusBar()->setSizeGripEnabled(true);
//setToolButtonStyle(Qt::ToolButtonIconOnly);
}
/*-----------------------------------------------------------------------*/
void SkulptureStyleConfig::subWindowActivated(QMdiSubWindow *window)
{
if (window) {
QWidget *parent = window->parentWidget();
if (parent) {
const QList children = parent->children();
Q_FOREACH (QObject *child, children) {
QWidget *widget = qobject_cast(child);
if (widget) {
widget->setWindowTitle(QLatin1String(child == window ? "Active Window" : "Inactive Window"));
}
}
}
}
}
void SkulptureStyleConfig::updatePreview()
{
QStyle *style = QStyleFactory::create(QLatin1String("skulpture"));
if (style) {
int index = style->metaObject()->indexOfMethod("skulpturePrivateMethod(SkulpturePrivateMethod,void*)");
if (index >= 0) {
QUuid uuid = QUuid::createUuid();
QDir tempDir = QDir::temp();
// ### we may add a way to avoid the file completely.
QString fileName = QLatin1String("skulpture-temp-settings-") + uuid.toString() + QLatin1String(".ini");
QString absFileName = tempDir.absoluteFilePath(fileName);
{
QSettings s(absFileName, QSettings::IniFormat);
configManager.save(s);
// make visible in other process
s.sync();
}
SkMethodDataSetSettingsFileName data;
data.version = 1;
data.fileName = absFileName;
int result;
int id = SkulptureStyle::SPM_SetSettingsFileName;
void *dat = &data;
void *param[] = {&result, &id, &dat};
style->qt_metacall(QMetaObject::InvokeMetaMethod, index, param);
tempDir.remove(fileName);
int margin = style->pixelMetric(QStyle::PM_DefaultTopLevelMargin);
dialogLayout->setContentsMargins(margin, margin, margin, margin);
QList windows = mdiArea->findChildren();
Q_FOREACH (QMdiSubWindow *window, windows) {
window->setFocusPolicy(Qt::FocusPolicy(window->focusPolicy() & ~Qt::TabFocus));
QList widgets = window->widget()->findChildren();
Q_FOREACH (QWidget *widget, widgets) {
// TODO: only update widgets that have changes in settings
widget->setStyle(style);
if (widget->inherits("QTextEdit") || (widget->parentWidget() && widget->parentWidget()->inherits("QTextEdit"))) {
widget->setFocusPolicy(Qt::ClickFocus);
} else {
widget->setFocusPolicy(Qt::FocusPolicy(widget->focusPolicy() & ~Qt::TabFocus));
}
}
}
}
}
if (oldStyle) {
delete oldStyle;
}
oldStyle = style;
}
/*-----------------------------------------------------------------------*/
SkulptureStyleConfig::SkulptureStyleConfig(QWidget *parent)
: QWidget(parent), oldStyle(0)
{
init();
}
enum PreviewPosition
{
PP_Auto,
PP_Hidden,
PP_InTab,
PP_Left,
PP_Top,
PP_Right,
PP_Bottom
};
void SkulptureStyleConfig::init()
{
aboutData = new KAboutData("skulpture", 0, ki18n("Sculpture"), "0.2.4",
ki18n("Three-dimensional classical artwork."),
#if KDE_IS_VERSION(4,1,0)
KAboutData::License_GPL_V3,
#else
KAboutData::License_GPL,
#endif
ki18n("(c) 2007-2010, Christoph Feck"), KLocalizedString(),
"http://skulpture.maxiom.de/", "christoph@maxiom.de");
KComponentData tempComponentData(aboutData);
aboutData->addAuthor(ki18n("Christoph Feck"), ki18n("Developer"), "christoph@maxiom.de", "http://kdepepo.wordpress.com/");
QString imageFileName = KStandardDirs::locate("appdata", QLatin1String("pics/skulpture.png"), tempComponentData);
aboutData->setProgramLogo(QImage(imageFileName));
componentData = new KComponentData(aboutData);
KGlobal::locale()->insertCatalog(QLatin1String("kstyle_skulpture_config"));
setupUi(this);
QList children = tabWidget->findChildren();
Q_FOREACH (QWidget *child, children) {
if (!(child->isEnabled())) {
child->hide();
}
}
QSize availableSize = QApplication::desktop()->availableGeometry(this).size();
QSettings s(QSettings::IniFormat, QSettings::UserScope, QLatin1String("SkulptureStyle"), QLatin1String(""));
QString previewPositionText = s.value(QLatin1String("ConfigDialog/PreviewPosition"), QLatin1String("auto")).toString().toLower();
PreviewPosition previewPosition = PP_Auto;
switch (previewPositionText.at(0).unicode()) {
case 'a':
default:
previewPosition = PP_Auto;
break;
case 'l':
previewPosition = PP_Left;
break;
case 't':
previewPosition = PP_Top;
break;
case 'b':
previewPosition = PP_Bottom;
break;
case 'r':
previewPosition = PP_Right;
break;
case 'c': // center
case 'i':
previewPosition = PP_InTab;
break;
case 'n': // none
case 'h':
previewPosition = PP_Hidden;
break;
}
if (previewPosition == PP_Auto) {
if (availableSize.height() < 700) {
if (availableSize.width() < 800) {
previewPosition = PP_InTab;
} else {
previewPosition = PP_Left;
}
} else {
previewPosition = PP_Top;
}
}
switch (previewPosition) {
case PP_Left:
mdiArea->setMinimumSize(QSize(qMin(570, availableSize.width() - 400), 290));
vboxLayout->setDirection(QBoxLayout::LeftToRight);
break;
case PP_Top:
mdiArea->setMinimumSize(QSize(570, 290));
break;
case PP_Right:
mdiArea->setMinimumSize(QSize(qMin(570, availableSize.width() - 400), 290));
vboxLayout->setDirection(QBoxLayout::RightToLeft);
break;
case PP_Bottom:
mdiArea->setMinimumSize(QSize(570, 290));
vboxLayout->setDirection(QBoxLayout::BottomToTop);
break;
case PP_InTab:
tabWidget->addTab(mdiArea, QLatin1String("Preview"));
break;
case PP_Hidden:
mdiArea->hide();
break;
case PP_Auto: // avoid warning
break;
}
mdiArea->setBackground(QColor(120, 120, 150));
tabWidget->setCurrentIndex(0);
// KConfig wm(QLatin1String("kwinskulpturerc"), KConfig::FullConfig);
// KConfigGroup group = wm.group("WM");
// QColor activeBackground;
// QString c = group.readEntry("activeBackground");
// qDebug() << "activeBackground = " << c;
connect(this, SIGNAL(changed(bool)), this, SLOT(updatePreview()));
connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow *)));
configManager.addWidgets(this);
configManager.load(s);
if (cm_General_TextShift->value() > 0) {
cm_General_TextShift->setPrefix(QLatin1String("+"));
} else {
cm_General_TextShift->setPrefix(QString());
}
#if 1
#if 1
QMdiSubWindow *previewwindow2 = new QMdiSubWindow(mdiArea);
// previewwindow2->setObjectName(QLatin1String("SkulpturePreviewWindow"));
// previewwindow2->setProperty("sk_kwin_activeBackground",
previewwindow2->setStyle(QStyleFactory::create(QLatin1String("skulpture")));
previewWindow = new Preview2Window(previewwindow2, *componentData);
previewwindow2->setWidget(previewWindow);
previewwindow2->setGeometry(107, 7, 450, 265);
#endif
#if 1
QMdiSubWindow *previewwindow1 = new QMdiSubWindow(mdiArea);
// previewwindow1->setObjectName(QLatin1String("SkulpturePreviewWindow"));
previewwindow1->setStyle(QStyleFactory::create(QLatin1String("skulpture")));
Preview1Window *preview = new Preview1Window(previewwindow1);
previewwindow1->setWidget(preview);
previewwindow1->setGeometry(7, 35, 450, 245);
dialogLayout = preview->dialogLayout();
#endif
updatePreview();
#else
mdiArea->hide();
#endif
KAcceleratorManager::manage(this);
configManager.connectConfigChanged(this, SLOT(updateChanged()));
}
void SkulptureStyleConfig::showEvent(QShowEvent *)
{
cm_General_TextShift->setFocus(Qt::ActiveWindowFocusReason);
}
QSize SkulptureStyleConfig::sizeHint() const
{
return QSize(570, 0);
}
SkulptureStyleConfig::~SkulptureStyleConfig()
{
KGlobal::locale()->removeCatalog(QLatin1String("kstyle_skulpture_config"));
if (previewWindow) {
previewWindow->hide();
previewWindow->setParent(0);
#if KDE_IS_VERSION(4,1,1)
KGlobal::setAllowQuit(false);
delete previewWindow;
KGlobal::setAllowQuit(true);
#else
// ### replacement code for older KDE versions?
//KGlobal::ref();
delete previewWindow;
//KGlobal::deref();
#endif
}
delete componentData;
delete aboutData;
}
/*-----------------------------------------------------------------------*/
void SkulptureStyleConfig::save()
{
QSettings s(QSettings::IniFormat, QSettings::UserScope, QLatin1String("SkulptureStyle"), QLatin1String(""));
configManager.save(s);
}
void SkulptureStyleConfig::defaults()
{
configManager.defaults();
}
void SkulptureStyleConfig::updateChanged()
{
if (cm_General_TextShift->value() > 0) {
cm_General_TextShift->setPrefix(QLatin1String("+"));
} else {
cm_General_TextShift->setPrefix(QString());
}
Q_EMIT changed(configManager.hasChanged());
}
/*-----------------------------------------------------------------------*/
#include "sk_config.moc"
skulpture-0.2.4/src/config/skulpture.png 0000644 0001750 0000144 00000000256 11115155316 017237 0 ustar pepo users PNG
IHDR @ @ PLTEϫܕ* TIDATXA
Q+GZDqH =p P$Z -0j] oVhQE` IENDB` skulpture-0.2.4/src/config/sk_config.h 0000600 0001750 0000144 00000005033 11163031264 016572 0 ustar pepo users /*
* sk_config.h - Classical Three-Dimensional Artwork for Qt 4
*
* Copyright (c) 2008 Christoph Feck
*
* 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 3 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef SKULPTURE_CONFIG_H
#define SKULPTURE_CONFIG_H 1
/*-----------------------------------------------------------------------*/
#include
#include "ui_sk_dialog.h"
#include "configmanager.h"
class QSettings;
class QMdiSubWindow;
class KXmlGuiWindow;
class KAboutData;
class KComponentData;
class SkulptureStyleConfig : public QWidget, private Ui::SkulptureStyleDialog
{
Q_OBJECT
public:
explicit SkulptureStyleConfig(QWidget* parent = 0);
virtual ~SkulptureStyleConfig();
virtual QSize sizeHint() const;
Q_SIGNALS:
void changed(bool);
public Q_SLOTS:
void save();
void defaults();
protected Q_SLOTS:
void updateChanged();
void updatePreview();
private Q_SLOTS:
void subWindowActivated(QMdiSubWindow *window);
protected:
void showEvent(QShowEvent *);
private:
void init();
private:
ConfigManager configManager;
QLayout *dialogLayout;
KXmlGuiWindow *previewWindow;
KAboutData *aboutData;
KComponentData *componentData;
QStyle *oldStyle;
};
/*-----------------------------------------------------------------------*/
#include
struct SkMethodData
{
int version;
};
struct SkMethodDataSetSettingsFileName : public SkMethodData
{
// in version 1
QString fileName;
};
class SkulptureStyle : public QStyle
{
Q_OBJECT
public:
// internal, reserved for future use
enum SkulpturePrivateMethod {
SPM_SupportedMethods = 0,
SPM_SetSettingsFileName = 1
};
public Q_SLOTS:
int skulpturePrivateMethod(SkulpturePrivateMethod /*id*/, void */*data*/ = 0) {
return 0;
}
};
/*-----------------------------------------------------------------------*/
#endif
skulpture-0.2.4/src/skulpture.cpp 0000644 0001750 0000144 00001414137 11333667520 016007 0 ustar pepo users /*
* Skulpture - Classical Three-Dimensional Artwork for Qt 4
*
* Copyright (c) 2007-2010 Christoph Feck
*
* 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 3 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
// ### This file is a mess
#include "skulpture_p.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
#include
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
#include
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*-----------------------------------------------------------------------*/
#include
class SkulptureStylePlugin : public QStylePlugin
{
public:
QStringList keys() const {
return QStringList(QLatin1String("Skulpture"));
}
QStyle *create(const QString &key) {
if (key.toLower() == QLatin1String("skulpture")) {
return new SkulptureStyle;
}
return 0;
}
};
Q_EXPORT_PLUGIN2(skulpture, SkulptureStylePlugin)
/*-----------------------------------------------------------------------*/
SkulptureStyle::SkulptureStyle()
: d(new Private)
{
d->q = this;
}
SkulptureStyle::~SkulptureStyle()
{
delete d;
}
/*-----------------------------------------------------------------------*/
void SkulptureStyle::polish(QApplication *application)
{
// ParentStyle::polish(application);
// return;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0))
QString recursionCheck = QLatin1String("\n/* -skulpture-recursion-check- */\n");
if (!d->styleSheetFileName.isEmpty()) {
QString oldStyle = application->styleSheet();
if (!oldStyle.contains(recursionCheck)) {
QFile file(d->styleSheetFileName);
if (file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
QString newStyle = stream.readAll();
application->setStyleSheet(newStyle + recursionCheck + oldStyle);
}
}
}
#endif
ParentStyle::polish(application);
application->installEventFilter(d->shortcut_handler);
#if 0
QPalette palette;
polish(palette);
application->setPalette(palette);
#endif
// if (application->inherits("KApplication")) {
// qDebug() << "KApplication is a" << application->metaObject()->className() << "(" << "object name:" << application->objectName() << ")";
// }
// QFontMetrics fm = QFontMetrics(QFont());
// printf("h:%d, s:%d, xh:%d, xb:%d, Xb:%d, Xyb: %d\n", fm.height(), fm.lineSpacing(), fm.xHeight(), fm.boundingRect(QChar('x', 0)).height(), fm.boundingRect(QChar('X', 0)).height(), fm.boundingRect(QLatin1String("Xy")).height());
}
void SkulptureStyle::unpolish(QApplication *application)
{
application->removeEventFilter(d->shortcut_handler);
ParentStyle::unpolish(application);
}
/*-----------------------------------------------------------------------*/
enum SidebarViewMode {
DefaultSidebar,
TransparentSidebar
};
static void polishSidebarView(QAbstractItemView *view, SidebarViewMode viewMode)
{
QWidget *viewport = view->viewport();
QPalette palette = view->palette();
if (viewMode == TransparentSidebar) {
if (viewport->autoFillBackground()) {
viewport->setAutoFillBackground(false);
QPalette::ColorRole textRole = viewport->foregroundRole();
if (textRole != QPalette::WindowText) {
palette.setBrush(QPalette::Active, textRole, palette.brush(QPalette::Active, QPalette::WindowText));
palette.setBrush(QPalette::Inactive, textRole, palette.brush(QPalette::Inactive, QPalette::WindowText));
palette.setBrush(QPalette::Disabled, textRole, palette.brush(QPalette::Disabled, QPalette::WindowText));
viewport->setPalette(palette);
}
}
view->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
} else {
if (viewport->autoFillBackground()) {
palette.setBrush(QPalette::Active, QPalette::Window, palette.brush(QPalette::Active, QPalette::Base));
palette.setBrush(QPalette::Inactive, QPalette::Window, palette.brush(QPalette::Inactive, QPalette::Base));
palette.setBrush(QPalette::Disabled, QPalette::Window, palette.brush(QPalette::Disabled, QPalette::Base));
} else {
viewport->setAutoFillBackground(true);
}
view->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
viewport->setPalette(palette);
}
}
/*-----------------------------------------------------------------------*/
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
static WidgetShadow *findShadow(QWidget *widget)
{
QWidget *parent = widget->parentWidget();
if (parent) {
QList shadows = parent->findChildren();
Q_FOREACH (WidgetShadow *shadow, shadows) {
if (shadow->widget() == widget) {
return shadow;
}
}
}
return 0;
}
#endif
void SkulptureStyle::polish(QWidget *widget)
{
// ParentStyle::polish(widget);
// return;
#if 1
//printf("polishing a \"%s\" (which is a \"%s\")\n", widget->metaObject()->className(), widget->metaObject()->superClass()->className());
#if 0
QPalette palette = widget->palette();
polish(palette);
widget->setPalette(palette);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
if (QMdiArea *area = qobject_cast(widget)) {
area->installEventFilter(d);
}
if (qobject_cast(widget)) {
WidgetShadow *shadow = findShadow(widget);
if (!shadow) {
widget->installEventFilter(d);
if (widget->parentWidget()) {
WidgetShadow *shadow = new WidgetShadow(widget->parentWidget());
shadow->setWidget(widget);
shadow->updateZOrder();
shadow->show();
}
}
}
#endif
#if 1
if (QLCDNumber *lcd = qobject_cast(widget)) {
QPalette palette;
palette.setColor(QPalette::Base, QColor(220, 230, 210));
palette.setColor(QPalette::WindowText, QColor(60, 60, 60));
// lcd->setPalette(palette);
// lcd->installEventFilter(d);
// lcd->setContentsMargins(8, 8, 8, 8);
lcd->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
lcd->setSegmentStyle(QLCDNumber::Flat);
}
#endif
#if 1
if (QDialog *dialog = qobject_cast(widget)) {
dialog->installEventFilter(d);
}
#endif
#if 0
if (QMainWindow *window = qobject_cast(widget)) {
window->setBackgroundRole(QPalette::Dark);
}
if (QDockWidget *dock = qobject_cast(widget)) {
dock->installEventFilter(d);
}
if (QStatusBar *bar = qobject_cast(widget)) {
bar->installEventFilter(d);
}
#endif
if (QToolBox *toolBox = qobject_cast(widget)) {
toolBox->setBackgroundRole(QPalette::Window);
// toolBox->setContentsMargins(2, 2, 2, 2);
// toolBox->installEventFilter(d);
toolBox->layout()->setSpacing(0);
}
if (widget->inherits("KTitleWidget")) {
// widget->setMaximumHeight(0);
#if 0
QPalette palette = widget->palette();
palette.setColor(QPalette::Base, palette.color(QPalette::Window));
palette.setColor(QPalette::Text, palette.color(QPalette::WindowText));
widget->setPalette(palette);
#endif
}
if (qobject_cast(widget)) {
widget->installEventFilter(d);
widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
}
if (QFrame *frame = qobject_cast(widget)) {
switch (frame->frameShape()) {
case QFrame::Panel:
case QFrame::WinPanel:
case QFrame::Box:
frame->setFrameShape(QFrame::StyledPanel);
break;
case QFrame::HLine:
case QFrame::VLine:
frame->setEnabled(false);
break;
default:
break;
}
if (frame->frameShadow() == QFrame::Plain && frame->backgroundRole() == QPalette::Base) {
if (frame->parentWidget() && frame->parentWidget()->inherits("KTitleWidget")) {
frame->setBackgroundRole(QPalette::Window);
}
}
#if 1
if (!strcmp(widget->metaObject()->className(), "QListWidget")
&& widget->parentWidget()
&& !strcmp(widget->parentWidget()->metaObject()->className(), "Sidebar")) {
//(static_cast(widget))->setFrameStyle(QFrame::Plain | QFrame::StyledPanel);
(static_cast(widget))->setFrameStyle(QFrame::NoFrame);
}
if (!strcmp(widget->metaObject()->className(), "Kontact::Navigator")) {
// (static_cast(widget))->viewport()->setBackgroundRole(QPalette::Base);
// (static_cast(widget))->viewport()->setAutoFillBackground(true);
(static_cast(widget))->setFrameStyle(QFrame::Plain | QFrame::StyledPanel);
// polishSidebarView(static_cast(widget), d->transparentPlacesPanel ? TransparentSidebar : DefaultSidebar);
}
if (widget->inherits("SidebarTreeView")) {
polishSidebarView(static_cast(widget), DefaultSidebar);
}
if (widget->inherits("KHTMLView")) {
// QPalette palette = widget->palette();
// palette.setColor(QPalette::Window, palette.color(QPalette::Base));
// ((QAbstractScrollArea *) widget)->viewport()->setPalette(palette);
// printf("frame style is 0x%08x\n", ((QFrame *) widget)->frameStyle());
if (d->expensiveShadows) {
((QFrame *) widget)->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
}
}
#endif
#if 1
if (widget->inherits("KFilePlacesView")) {
polishSidebarView(static_cast(widget), d->transparentPlacesPanel ? TransparentSidebar : DefaultSidebar);
}
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
if (widget->inherits("QPlainTextEdit")) {
QPlainTextEdit *edit = static_cast(widget);
// QPalette palette = edit->palette();
// palette.setColor(QPalette::Window, QColor(245, 245, 245));
// edit->setPalette(palette);
// edit->viewport()->setPalette(palette);
edit->setBackgroundVisible(false);
edit->viewport()->installEventFilter(d);
edit->installEventFilter(d);
widget->setAttribute(Qt::WA_Hover, true);
}
#endif
#if 1
if (QTextEdit *edit = qobject_cast(widget)) {
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
if (!qstrcmp(widget->metaObject()->className(), "SampleEdit")) {
QWidget *bg = new QWidget(widget);
bg->lower();
bg->setObjectName(QLatin1String("sample_background"));
bg->setGeometry(2, 2, widget->width() - 4, widget->height() - 4);
bg->setAutoFillBackground(true);
bg->show();
} else
#endif
{
d->mapper.setMapping(edit, edit);
connect(edit, SIGNAL(textChanged()), &d->mapper, SLOT(map()));
connect(&d->mapper, SIGNAL(mapped(QWidget *)), d, SLOT(textEditSourceChanged(QWidget *)));
d->updateTextEditMargins(edit);
}
edit->viewport()->installEventFilter(d);
edit->installEventFilter(d);
widget->setAttribute(Qt::WA_Hover, true);
if (qstrcmp(widget->metaObject()->className(), "IRCInput")) {
if (!d->allowTabulations) {
edit->setTabChangesFocus(true);
}
}
#if 0
if (QTextBrowser *browser = qobject_cast(widget)) {
connect(browser, SIGNAL(sourceChanged()), &d->mapper, SLOT(map()));
}
#endif
}
#endif
}
#if 0
if (QComboBox *combo = qobject_cast(widget)) {
if (!combo->isEditable()) {
combo->setBackgroundRole(QPalette::Button);
combo->setForegroundRole(QPalette::ButtonText);
}
}
if (qobject_cast(widget)
|| qobject_cast(widget)) {
widget->setBackgroundRole(QPalette::Window);
widget->setForegroundRole(QPalette::WindowText);
}
#endif
if (qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)) {
widget->setAttribute(Qt::WA_Hover, true);
}
#if 0
if (d->allowScrollBarSliderToCoverArrows && qobject_cast(widget)) {
widget->installEventFilter(d);
}
#endif
#if 0
if (widget->inherits("Q3ProgressBar")) {
widget->installEventFilter(d);
if (widget->isVisible()) {
d->setAnimated(widget, true);
}
}
#endif
if (QProgressBar *pbar = qobject_cast(widget)) {
pbar->installEventFilter(d);
if (pbar->isVisible() && !widget->inherits("StatusBarSpaceInfo")) {
d->setAnimated(pbar, true);
}
}
#if 1
if (qobject_cast(widget)) {
widget->installEventFilter(d);
}
if (QToolBar *toolbar = qobject_cast(widget)) {
QFont font;
font.setPointSizeF(font.pointSizeF() / (1.19));
QList children = toolbar->findChildren();
Q_FOREACH (QToolButton *child, children) {
if (!child->icon().isNull()) {
child->setFont(font);
}
}
connect(toolbar, SIGNAL(orientationChanged(Qt::Orientation)), d, SLOT(updateToolBarOrientation(Qt::Orientation)));
toolbar->setBackgroundRole(QPalette::Window);
}
if (widget->inherits("Q3ToolBar")) {
widget->setBackgroundRole(QPalette::Window);
}
#endif
#if 0
// FIXME does not work
if (QMenu *menu = qobject_cast(widget)) {
#if 1
QFont font;
QFont oldfont;
oldfont.setPointSizeF(oldfont.pointSizeF() * 1.0001);
font.setPointSizeF(font.pointSizeF() / (1.19 /* * 1.19*/));
font.setBold(true);
menu->setFont(font);
/* QAction *action = menu->menuAction();
action->setFont(oldfont);
QList children = action->findChildren();
Q_FOREACH (QAction *child, children) {
child->setFont(oldfont);
}*/
#else
menu->setStyleSheet(QLatin1String("font-size: 6.5")/*.arg(menu->font().pointSizeF() / (1.19 * 1.19))*/);
#endif
}
#endif
#if 0
// FIXME does not work
if (QGroupBox *group = qobject_cast(widget)) {
QFont oldfont;
#if 0
if (group->testAttribute(Qt::WA_SetFont)) {
QFont oldfont = group->fontInfo();
}
#endif
QFont font = oldfont;
font.setPointSizeF(font.pointSizeF() * 1.19);
font.setBold(true);
group->setFont(font);
QList children = group->findChildren();
Q_FOREACH (QWidget *child, children) {
if (1 || !(child->testAttribute(Qt::WA_SetFont))) {
printf("reset\n");
child->setFont(oldfont);
}
}
}
#endif
#if 1
if (widget->inherits("Q3Header")) {
QFont font;
font.setPointSizeF(font.pointSizeF() / (1.19 /* 1.19*/));
font.setBold(true);
widget->setFont(font);
}
#endif
if (QAbstractScrollArea *area = qobject_cast(widget)) {
if (QAbstractItemView *iv = qobject_cast(widget)) {
#if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0))
// ### Qt issue
// iv->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
// iv->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
// QApplication::setWheelScrollLines(64);
iv = iv;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
iv->viewport()->setAttribute(Qt::WA_Hover);
if (QTreeView *tree = qobject_cast(widget)) {
iv->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
if (tree->uniformRowHeights()) {
iv->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
} else if (QListView *list = qobject_cast(widget)) {
if (list->uniformItemSizes()) {
iv->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
iv->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
} else if (qobject_cast(widget)) {
iv->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
iv->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
#endif
#if 1
if (QHeaderView *header = qobject_cast(widget)) {
QFont font;
font.setPointSizeF(font.pointSizeF() / (1.19 /* 1.19*/));
font.setBold(true);
header->setFont(font);
// FIXME workaround for Qt 4.3
header->headerDataChanged(header->orientation(), 0, 0);
header->updateGeometry();
}
#endif
}
if (area->frameStyle() == (QFrame::StyledPanel | QFrame::Sunken)) {
d->installFrameShadow(area);
}
}
if (d->expensiveShadows) {
if (widget->inherits("Konsole::TerminalDisplay")
|| widget->inherits("KTextEditor::View")
|| widget->inherits("KHTMLView")) {
// ((QFrame *) widget)->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
d->installFrameShadow(widget);
}
}
#if 0
if (widget->inherits("KTextEditor::View")) {
QWidget *parent = widget->parentWidget();
if (parent) {
QFrame *frame = new QFrame(parent);
if (frame) {
frame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
widget->setParent(frame);
}
}
}
#endif
#if 1
if (widget->inherits("KCharSelectTable")) {
QPalette palette;
widget->setPalette(palette);
}
#endif
#if 1
if (widget->inherits("KFadeWidgetEffect")) {
widget->installEventFilter(d);
}
#endif
if (widget->inherits("Q3ScrollView")) {
QFrame *frame = qobject_cast(widget);
if (frame && frame->frameStyle() == (QFrame::StyledPanel | QFrame::Sunken)) {
d->installFrameShadow(widget);
}
}
#endif
#if 0
if (QTabWidget *tab = qobject_cast(widget)) {
if (QToolButton *button = qobject_cast(tab->cornerWidget(Qt::TopRightCorner))) {
button->setAutoRaise(true);
}
if (QToolButton *button = qobject_cast(tab->cornerWidget(Qt::TopLeftCorner))) {
button->setAutoRaise(true);
}
}
#endif
#if 1
if (QToolButton *button = qobject_cast(widget)) {
if (qobject_cast(button->parentWidget())) {
button->setAutoRaise(true);
}
}
#endif
if (!qstrcmp(widget->metaObject()->className(), "QToolBoxButton")) {
widget->setAttribute(Qt::WA_Hover, true);
}
if (!qstrcmp(widget->metaObject()->className(), "KLineEditButton")) {
widget->installEventFilter(d);
widget->setAttribute(Qt::WA_Hover, true);
}
if (qobject_cast(widget)) {
widget->unsetCursor();
widget->installEventFilter(d);
widget->setMouseTracking(true);
}
if (QLayout *layout = widget->layout()) {
// explicitely check public layout classes, QMainWindowLayout doesn't work here
if (qobject_cast(layout)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
|| qobject_cast(layout)
#endif
|| qobject_cast(layout)
|| qobject_cast(layout)) {
d->polishLayout(layout);
}
}
if (!qstrcmp(widget->metaObject()->className(), "InfoSidebarPage")
|| !qstrcmp(widget->metaObject()->className(), "InformationPanel")) {
widget->installEventFilter(d);
}
#if 0//(QT_VERSION >= QT_VERSION_CHECK(4, 5, 0))
if (widget->inherits("KTabWidget") && widget->property("closeButtonEnabled").toBool()) {
widget->setProperty("tabsClosable", true);
widget->setProperty("closeButtonEnabled", false);
connect(widget, SIGNAL(tabCloseRequested(int)), widget, SIGNAL(closeRequest(int)));
}
if (widget->inherits("KTabBar")) {
widget->setProperty("tabsClosable", true);
connect(widget, SIGNAL(tabCloseRequested(int)), widget, SIGNAL(closeRequest(int)));
}
#endif
if (d->visualizeLayouts) {
widget->installEventFilter(d);
}
ParentStyle::polish(widget);
}
void SkulptureStyle::unpolish(QWidget *widget)
{
ParentStyle::unpolish(widget);
if (d->visualizeLayouts) {
widget->removeEventFilter(d);
}
// return;
if (qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
// || qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)
|| qobject_cast(widget)) {
widget->setAttribute(Qt::WA_Hover, false);
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
if (qobject_cast(widget)) {
widget->removeEventFilter(d);
}
if (QMdiSubWindow *win = qobject_cast(widget)) {
win->removeEventFilter(d);
WidgetShadow *shadow = findShadow(win);
if (shadow) {
shadow->hide();
shadow->setParent(0);
shadow->deleteLater();
}
}
#endif
#if 1
if (QDialog *dialog = qobject_cast(widget)) {
dialog->removeEventFilter(d);
}
#endif
#if 0
if (QLCDNumber *lcd = qobject_cast(widget)) {
lcd->removeEventFilter(d);
}
if (QToolBox *toolBox = qobject_cast(widget)) {
toolBox->removeEventFilter(d);
}
if (QDockWidget *dock = qobject_cast(widget)) {
dock->removeEventFilter(d);
}
if (QStatusBar *status = qobject_cast(widget)) {
status->removeEventFilter(d);
}
#endif
#if 0
if (/*d->allowScrollBarSliderToCoverArrows &&*/ qobject_cast(widget)) {
widget->installEventFilter(d);
}
#endif
if (QProgressBar *pbar = qobject_cast(widget)) {
pbar->removeEventFilter(d);
d->setAnimated(pbar, false);
return;
}
if (QAbstractScrollArea *area = qobject_cast(widget)) {
area->removeEventFilter(d);
if (/*QAbstractItemView *iv =*/qobject_cast(widget)) {
#if 1
if (QHeaderView *header = qobject_cast(widget)) {
QFont font;
// font.setPointSizeF(font.pointSizeF() / (1.19 * 1.19));
// font.setBold(true);
header->setFont(font);
// FIXME workaround for Qt 4.3
header->headerDataChanged(header->orientation(), 0, 0);
header->updateGeometry();
}
#endif
}
/* if (QMdiArea *area = qobject_cast(widget)) {
area->viewport()->removeEventFilter(d);
}
*/
d->removeFrameShadow(area);
}
if (d->expensiveShadows) {
if (widget->inherits("Konsole::TerminalDisplay")
|| widget->inherits("KTextEditor::View")
|| widget->inherits("KHTMLView")) {
widget->removeEventFilter(d);
d->removeFrameShadow(widget);
}
}
if (widget->inherits("Q3ScrollView")) {
widget->removeEventFilter(d);
d->removeFrameShadow(widget);
}
#if 1
if (widget->inherits("KFadeWidgetEffect")) {
widget->removeEventFilter(d);
}
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
if (widget->inherits("QPlainTextEdit")) {
QPlainTextEdit *edit = static_cast(widget);
edit->viewport()->removeEventFilter(d);
edit->removeEventFilter(d);
}
#endif
if (qobject_cast(widget)) {
widget->removeEventFilter(d);
widget->setAttribute(Qt::WA_OpaquePaintEvent, true);
}
if (QTextEdit *edit = qobject_cast(widget)) {
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
if (!qstrcmp(widget->metaObject()->className(), "SampleEdit")) {
QList children = widget->children();
Q_FOREACH (QObject *child, children) {
if (child->objectName() == QLatin1String("sample_background")) {
child->setParent(0);
child->deleteLater();
}
}
} else
#endif
{
d->mapper.removeMappings(edit);
}
edit->viewport()->removeEventFilter(d);
edit->removeEventFilter(d);
}
if (QToolBar *toolbar = qobject_cast(widget)) {
QFont font;
// font.setPointSizeF(font.pointSizeF() / (1.19));
QList children = toolbar->findChildren();
Q_FOREACH (QToolButton *child, children) {
if (!child->icon().isNull()) {
child->setFont(font);
}
}
disconnect(toolbar, SIGNAL(orientationChanged(Qt::Orientation)), d, SLOT(updateToolBarOrientation(Qt::Orientation)));
}
if (!qstrcmp(widget->metaObject()->className(), "KLineEditButton")) {
widget->removeEventFilter(d);
}
if (qobject_cast(widget)) {
widget->setMouseTracking(false);
widget->removeEventFilter(d);
widget->setCursor(Qt::IBeamCursor);
}
if (!d->postEventWidgets.isEmpty()) {
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
d->postEventWidgets.removeOne(widget);
#else
d->postEventWidgets.removeAll(widget);
#endif
}
if ((QWidget *) d->oldEdit == widget) {
d->oldEdit = 0;
}
if (!qstrcmp(widget->metaObject()->className(), "InfoSidebarPage")
|| !qstrcmp(widget->metaObject()->className(), "InformationPanel")) {
widget->removeEventFilter(d);
}
if (qobject_cast(widget)) {
widget->removeEventFilter(d);
}
}
/*-----------------------------------------------------------------------*/
extern void lineEditMouseMoved(QLineEdit *lineEdit, QMouseEvent *event);
void SkulptureStyle::Private::processPostEventWidgets()
{
QWidget *widget;
while (!postEventWidgets.isEmpty() && (widget = postEventWidgets.takeFirst())) {
if (QTextEdit *edit = qobject_cast(widget)) {
handleCursor(edit);
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
else if (QPlainTextEdit *edit = qobject_cast(widget)) {
handleCursor(edit);
}
#endif
}
}
void SkulptureStyle::Private::addPostEventWidget(QWidget *widget)
{
if (qobject_cast(widget)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
|| qobject_cast(widget)
#endif
) {
if (!postEventWidgets.contains(widget)) {
bool signal = postEventWidgets.isEmpty();
postEventWidgets.append(widget);
if (signal) {
QTimer::singleShot(0, this, SLOT(processPostEventWidgets()));
}
}
}
}
static void visualizeLayoutSpacing(QLayout *layout, QPainter *painter)
{
layout->activate();
QColor color;
int spacing = -1;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
if (QFormLayout *formLayout = qobject_cast(layout)) {
spacing = formLayout->spacing();
} else
#endif
if (QGridLayout *gridLayout = qobject_cast(layout)) {
spacing = gridLayout->spacing();
} else if (QBoxLayout *boxLayout = qobject_cast(layout)) {
spacing = boxLayout->spacing();
} else {
spacing = layout->spacing();
}
if (spacing == 0) {
color = Qt::green;
} else if (spacing > 0) {
color = Qt::red;
}
if (color.isValid()) {
color.setAlpha(30);
painter->fillRect(layout->geometry(), color);
} else {
painter->setPen(QColor(0, 150, 0, 50));
painter->drawRect(layout->geometry().adjusted(0, 0, -1, -1));
}
if (qobject_cast(layout)) {
painter->setPen(QColor(200, 0, 0, 150));
painter->drawRect(layout->geometry().adjusted(0, 0, -1, -1));
}
for (int i = 0; i < layout->count(); ++i) {
if (QLayout *childLayout = layout->itemAt(i)->layout()) {
visualizeLayoutSpacing(childLayout, painter);
}
}
}
bool SkulptureStyle::Private::eventFilter(QObject *watched, QEvent *event)
{
#if 0
// can't happen, because widgets are the only ones to install it
if (!watched->isWidgetType()) {
return QObject::eventFilter(watched, event);
}
#endif
QWidget *widget = reinterpret_cast(watched);
#if 0
if (event->type() != QEvent::UpdateRequest && event->type() != QEvent::Paint) {
qDebug() << "handling" << event->type() << "for object" << widget->objectName() << "which is a" << widget->metaObject()->className() << " which is a" << widget->metaObject()->superClass()->className();
}
#endif
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
if (QMenu *menu = qobject_cast(widget)) {
if (runtimeQtVersion() < QT_VERSION_CHECK(4, 6, 0)) {
return menuEventFilter(menu, event);
}
}
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
if (qobject_cast(widget)) {
WidgetShadow *shadow = findShadow(widget);
switch (event->type()) {
case QEvent::Move:
case QEvent::Resize:
if (shadow) {
shadow->updateGeometry();
}
break;
case QEvent::ZOrderChange:
if (shadow) {
shadow->updateZOrder();
}
break;
case QEvent::Hide:
case QEvent::Destroy:
if (shadow) {
shadow->setParent(0);
shadow->hide();
shadow->deleteLater();
}
break;
case QEvent::Show:
if (!shadow) {
if (widget->parentWidget()) {
shadow = new WidgetShadow(widget->parentWidget());
shadow->setWidget(widget);
shadow->updateZOrder();
}
} else {
shadow->updateZOrder();
}
default:
break;
}
}
#endif
if (event->type() == QEvent::Hide || event->type() == QEvent::Destroy) {
if (!postEventWidgets.isEmpty()) {
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
postEventWidgets.removeOne(widget);
#else
postEventWidgets.removeAll(widget);
#endif
}
if ((QWidget *) oldEdit == widget) {
oldEdit = 0;
}
} else if (event->type() != QEvent::Paint) {
addPostEventWidget(widget);
if (QWidget *parent = widget->parentWidget()) {
addPostEventWidget(parent);
if ((parent = parent->parentWidget())) {
addPostEventWidget(parent);
}
}
}
switch (event->type()) {
case QEvent::Paint:
#if 1 // highlight current line in QTextEdit / QPlainTextEdit
if (widget->objectName() == QLatin1String("qt_scrollarea_viewport")) {
if (QTextEdit *edit = qobject_cast(widget->parent())) {
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
if (!qstrcmp(edit->metaObject()->className(), "SampleEdit")) {
QList children = edit->children();
Q_FOREACH (QObject *child, children) {
if (child->objectName() == QLatin1String("sample_background")) {
QWidget *bg = qobject_cast(child);
if (bg) {
QPalette palette = edit->palette();
palette.setColor(QPalette::Window, palette.color(QPalette::Base));
bg->setPalette(palette);
}
}
}
}
#endif
// updateTextEditMargins(edit);
paintCursorLine(edit);
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
else if (widget->parent()->inherits("QPlainTextEdit")) {
paintCursorLine(static_cast(widget->parent()));
}
#endif
}
#endif
#if 1
if (visualizeLayouts) {
if (!widget->font().isCopyOf(QApplication::font())) {
if (widget->font() == QApplication::font()) {
QPainter painter(widget);
painter.fillRect(widget->rect(), QColor(255, 0, 0, 200));
}
}
if (!widget->palette().isCopyOf(QApplication::palette())) {
if (true/*widget->palette() == QApplication::palette()*/) {
QPainter painter(widget);
painter.fillRect(widget->rect(), QColor(0, 200, 255, 200));
}
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0))
if (!widget->styleSheet().isEmpty()) {
QPainter painter(widget);
painter.fillRect(widget->rect(), QColor(255, 0, 255, 100));
}
#endif
if (QLayout *layout = widget->layout()) {
if (!(qobject_cast(widget))) {
// explicitely check public layout classes, QMainWindowLayout doesn't work here
if (qobject_cast(layout)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
|| qobject_cast(layout)
#endif
|| qobject_cast(layout)
|| qobject_cast(layout)) {
QPainter painter(widget);
visualizeLayoutSpacing(layout, &painter);
}
}
}
}
#endif
#if 0
if (QDialog *dialog = qobject_cast(widget)) {
QPainter painter(dialog);
QRect r = dialog->rect();
QLinearGradient dialogGradient1(r.topLeft(), r.bottomRight());
dialogGradient1.setColorAt(0.0, QColor(255, 255, 255, 30));
dialogGradient1.setColorAt(1.0, QColor(0, 0, 0, 10));
// painter.fillRect(r, dialogGradient1);
QRadialGradient dialogGradient2(r.left() + r.width() / 2, r.top(), r.height());
dialogGradient2.setColorAt(0.0, QColor(255, 255, 225, 160));
dialogGradient2.setColorAt(1.0, QColor(0, 0, 0, 0));
// painter.fillRect(r, dialogGradient2);
QLinearGradient dialogGradient3(r.topLeft(), r.bottomLeft());
dialogGradient3.setColorAt(0.0, QColor(255, 255, 255, 30));
dialogGradient3.setColorAt(1.0, QColor(0, 0, 0, 20));
painter.fillRect(r, dialogGradient3);
paintThinFrame(&painter, dialog->rect().adjusted(0, 0, 0, 0), dialog->palette(), 60, -20);
paintThinFrame(&painter, dialog->rect().adjusted(1, 1, -1, -1), dialog->palette(), -20, 60);
}
#endif
#if 0
if (QStatusBar *status = qobject_cast(widget)) {
QPainter painter(status);
paintThinFrame(&painter, status->rect(), status->palette(), -20, 60);
}
if (QToolBox *toolBox = qobject_cast(widget)) {
QPainter painter(toolBox);
paintThinFrame(&painter, toolBox->rect(), toolBox->palette(), 60, -20);
paintThinFrame(&painter, toolBox->rect().adjusted(1, 1, -1, -1), toolBox->palette(), -60, 140);
}
if (QLCDNumber *lcd = qobject_cast(watched)) {
// TODO nicer digits, antialiased, slight italics
}
if (QDockWidget *dock = qobject_cast(widget)) {
// ### rendering a frame around dock widgets does not work, because
// the subwidgets are placed at the edges.
}
#endif
if (!qstrcmp(widget->metaObject()->className(), "InfoSidebarPage")
|| !qstrcmp(widget->metaObject()->className(), "InformationPanel")) {
QPainter painter(widget);
paintThinFrame(&painter, widget->rect().adjusted(0, 0, 0, 0), widget->palette(), 60, -20);
paintThinFrame(&painter, widget->rect().adjusted(1, 1, -1, -1), widget->palette(), -20, 60);
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
if (!qstrcmp(widget->metaObject()->className(), "KLineEditButton")) {
QPainter painter(widget);
QStyleOption option;
option.initFrom(widget);
QIcon::Mode iconMode = QIcon::Normal;
if (option.state & QStyle::State_Enabled && option.state & QStyle::State_MouseOver) {
//iconMode = QIcon::Active;
// painter.fillRect(widget->rect(), Qt::red);
} else {
//iconMode = QIcon::Disabled;
painter.setOpacity(0.2);
}
QRect r = QRect(widget->rect().center() - QPoint(6, 5), QSize(12, 12));
painter.drawPixmap(r, q->standardIcon(QStyle::SP_TitleBarCloseButton, &option, widget).pixmap(12, 12, iconMode));
event->accept();
return true;
}
if (widget->inherits("KFadeWidgetEffect")) {
// widget->hide();
event->accept();
// widget->removeEventFilter(this);
return true;
}
break;
#endif
case QEvent::MouseMove:
if (QLineEdit *lineEdit = qobject_cast(watched)) {
lineEditMouseMoved(lineEdit, static_cast(event));
}
break;
case QEvent::Show:
if (QProgressBar *pbar = qobject_cast(watched)) {
if (!widget->inherits("StatusBarSpaceInfo")) {
setAnimated(pbar, true);
}
}
/* fall through */
case QEvent::Move:
case QEvent::Resize:
if (QTextEdit *edit = qobject_cast(widget)) {
#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 0))
if (!qstrcmp(widget->metaObject()->className(), "SampleEdit")) {
QList children = widget->children();
Q_FOREACH (QObject *child, children) {
if (child->objectName() == QLatin1String("sample_background")) {
QWidget *bg = qobject_cast(child);
if (bg) {
bg->setGeometry(2, 2, widget->width() - 4, widget->height() - 4);
}
}
}
} else
#endif
{
textEditSourceChanged(edit);
}
}
#if (QT_VERSION >= QT_VERSION_CHECK(4, 3, 0))
else if (qobject_cast(widget)) {
QList shadows = widget->findChildren();
Q_FOREACH (WidgetShadow *shadow, shadows) {
shadow->updateGeometry();
}
}
#endif
if (qobject_cast(widget)
|| widget->inherits("Q3ScrollView")
#if 1
|| widget->inherits("Konsole::TerminalDisplay")
|| widget->inherits("KTextEditor::View")
|| widget->inherits("KHTMLView")
#endif
) {
updateFrameShadow(widget);
}
break;
case QEvent::Destroy:
case QEvent::Hide:
setAnimated(reinterpret_cast