Browse Source

Added qtcuve theme engine


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-style-qtcurve@1090657 283d02a7-25f6-0310-bc7c-ecb5cbfe19
tpearson 9 years ago
commit
f5a83a9959

+ 57
- 0
CMakeLists.txt View File

@@ -0,0 +1,57 @@
1
+project(QtCurve-KDE3)
2
+cmake_minimum_required(VERSION 2.4.0)
3
+
4
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
5
+set(CPACK_GENERATOR "DEB;RPM;TGZ")
6
+set(DEBIAN_PACKAGE_DESCRIPTION "QtCurve for Qt3/KDE3")
7
+set(DEBIAN_PACKAGE_SECTION "kde")
8
+set(CPACK_SOURCE_GENERATOR "TBZ2")
9
+set(CPACK_PACKAGE_VERSION_MAJOR "0")
10
+set(CPACK_PACKAGE_VERSION_MINOR "55")
11
+set(CPACK_PACKAGE_VERSION_PATCH "2")
12
+set(CPACK_PACKAGE_CONTACT "Craig Drummond <Craig.Drummond@lycos.co.uk>")
13
+set(QTCURVE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
14
+set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
15
+set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}")
16
+set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}")
17
+include(CPack)
18
+
19
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
20
+
21
+find_package(KDE3 REQUIRED)
22
+include(KDE3Macros)
23
+
24
+exec_program(kde-config
25
+             ARGS --prefix
26
+             OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX)
27
+
28
+file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
29
+
30
+# For KDE4 kde-config has been renamed to kde4-config
31
+find_program(KDE4_KDECONFIG_EXECUTABLE
32
+             NAMES kde4-config
33
+             PATHS ${CMAKE_INSTALL_PREFIX}/bin ${_KDEDIRS} /usr/local/bin /usr/bin /opt/kde4/bin NO_DEFAULT_PATH)
34
+
35
+if (NOT KDE4_KDECONFIG_EXECUTABLE)
36
+   find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config )
37
+endif (NOT KDE4_KDECONFIG_EXECUTABLE)
38
+
39
+if(KDE4_KDECONFIG_EXECUTABLE)
40
+    exec_program(${KDE4_KDECONFIG_EXECUTABLE}
41
+                 ARGS --prefix
42
+                 OUTPUT_VARIABLE KDE4PREFIX)
43
+endif(KDE4_KDECONFIG_EXECUTABLE)
44
+
45
+if(NOT KDE4PREFIX)
46
+    set(KDE4PREFIX ${KDE3PREFIX})
47
+endif(NOT KDE4PREFIX)
48
+
49
+configure_file (config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
50
+add_definitions(${QT_DEFINITIONS} ${KDE3_DEFINITIONS})
51
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDES})
52
+
53
+set(DATA_INSTALL_DIR ${KDE3PREFIX}/share/apps)
54
+add_subdirectory(style)
55
+add_subdirectory(config)
56
+add_subdirectory(themes)
57
+

+ 340
- 0
COPYING View File

@@ -0,0 +1,340 @@
1
+		    GNU GENERAL PUBLIC LICENSE
2
+		       Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+			    Preamble
10
+
11
+  The licenses for most software are designed to take away your
12
+freedom to share and change it.  By contrast, the GNU General Public
13
+License is intended to guarantee your freedom to share and change free
14
+software--to make sure the software is free for all its users.  This
15
+General Public License applies to most of the Free Software
16
+Foundation's software and to any other program whose authors commit to
17
+using it.  (Some other Free Software Foundation software is covered by
18
+the GNU Library General Public License instead.)  You can apply it to
19
+your programs, too.
20
+
21
+  When we speak of free software, we are referring to freedom, not
22
+price.  Our General Public Licenses are designed to make sure that you
23
+have the freedom to distribute copies of free software (and charge for
24
+this service if you wish), that you receive source code or can get it
25
+if you want it, that you can change the software or use pieces of it
26
+in new free programs; and that you know you can do these things.
27
+
28
+  To protect your rights, we need to make restrictions that forbid
29
+anyone to deny you these rights or to ask you to surrender the rights.
30
+These restrictions translate to certain responsibilities for you if you
31
+distribute copies of the software, or if you modify it.
32
+
33
+  For example, if you distribute copies of such a program, whether
34
+gratis or for a fee, you must give the recipients all the rights that
35
+you have.  You must make sure that they, too, receive or can get the
36
+source code.  And you must show them these terms so they know their
37
+rights.
38
+
39
+  We protect your rights with two steps: (1) copyright the software, and
40
+(2) offer you this license which gives you legal permission to copy,
41
+distribute and/or modify the software.
42
+
43
+  Also, for each author's protection and ours, we want to make certain
44
+that everyone understands that there is no warranty for this free
45
+software.  If the software is modified by someone else and passed on, we
46
+want its recipients to know that what they have is not the original, so
47
+that any problems introduced by others will not reflect on the original
48
+authors' reputations.
49
+
50
+  Finally, any free program is threatened constantly by software
51
+patents.  We wish to avoid the danger that redistributors of a free
52
+program will individually obtain patent licenses, in effect making the
53
+program proprietary.  To prevent this, we have made it clear that any
54
+patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+  The precise terms and conditions for copying, distribution and
57
+modification follow.
58
+
59
+		    GNU GENERAL PUBLIC LICENSE
60
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+  0. This License applies to any program or other work which contains
63
+a notice placed by the copyright holder saying it may be distributed
64
+under the terms of this General Public License.  The "Program", below,
65
+refers to any such program or work, and a "work based on the Program"
66
+means either the Program or any derivative work under copyright law:
67
+that is to say, a work containing the Program or a portion of it,
68
+either verbatim or with modifications and/or translated into another
69
+language.  (Hereinafter, translation is included without limitation in
70
+the term "modification".)  Each licensee is addressed as "you".
71
+
72
+Activities other than copying, distribution and modification are not
73
+covered by this License; they are outside its scope.  The act of
74
+running the Program is not restricted, and the output from the Program
75
+is covered only if its contents constitute a work based on the
76
+Program (independent of having been made by running the Program).
77
+Whether that is true depends on what the Program does.
78
+
79
+  1. You may copy and distribute verbatim copies of the Program's
80
+source code as you receive it, in any medium, provided that you
81
+conspicuously and appropriately publish on each copy an appropriate
82
+copyright notice and disclaimer of warranty; keep intact all the
83
+notices that refer to this License and to the absence of any warranty;
84
+and give any other recipients of the Program a copy of this License
85
+along with the Program.
86
+
87
+You may charge a fee for the physical act of transferring a copy, and
88
+you may at your option offer warranty protection in exchange for a fee.
89
+
90
+  2. You may modify your copy or copies of the Program or any portion
91
+of it, thus forming a work based on the Program, and copy and
92
+distribute such modifications or work under the terms of Section 1
93
+above, provided that you also meet all of these conditions:
94
+
95
+    a) You must cause the modified files to carry prominent notices
96
+    stating that you changed the files and the date of any change.
97
+
98
+    b) You must cause any work that you distribute or publish, that in
99
+    whole or in part contains or is derived from the Program or any
100
+    part thereof, to be licensed as a whole at no charge to all third
101
+    parties under the terms of this License.
102
+
103
+    c) If the modified program normally reads commands interactively
104
+    when run, you must cause it, when started running for such
105
+    interactive use in the most ordinary way, to print or display an
106
+    announcement including an appropriate copyright notice and a
107
+    notice that there is no warranty (or else, saying that you provide
108
+    a warranty) and that users may redistribute the program under
109
+    these conditions, and telling the user how to view a copy of this
110
+    License.  (Exception: if the Program itself is interactive but
111
+    does not normally print such an announcement, your work based on
112
+    the Program is not required to print an announcement.)
113
+
114
+These requirements apply to the modified work as a whole.  If
115
+identifiable sections of that work are not derived from the Program,
116
+and can be reasonably considered independent and separate works in
117
+themselves, then this License, and its terms, do not apply to those
118
+sections when you distribute them as separate works.  But when you
119
+distribute the same sections as part of a whole which is a work based
120
+on the Program, the distribution of the whole must be on the terms of
121
+this License, whose permissions for other licensees extend to the
122
+entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+Thus, it is not the intent of this section to claim rights or contest
125
+your rights to work written entirely by you; rather, the intent is to
126
+exercise the right to control the distribution of derivative or
127
+collective works based on the Program.
128
+
129
+In addition, mere aggregation of another work not based on the Program
130
+with the Program (or with a work based on the Program) on a volume of
131
+a storage or distribution medium does not bring the other work under
132
+the scope of this License.
133
+
134
+  3. You may copy and distribute the Program (or a work based on it,
135
+under Section 2) in object code or executable form under the terms of
136
+Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+    a) Accompany it with the complete corresponding machine-readable
139
+    source code, which must be distributed under the terms of Sections
140
+    1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+    b) Accompany it with a written offer, valid for at least three
143
+    years, to give any third party, for a charge no more than your
144
+    cost of physically performing source distribution, a complete
145
+    machine-readable copy of the corresponding source code, to be
146
+    distributed under the terms of Sections 1 and 2 above on a medium
147
+    customarily used for software interchange; or,
148
+
149
+    c) Accompany it with the information you received as to the offer
150
+    to distribute corresponding source code.  (This alternative is
151
+    allowed only for noncommercial distribution and only if you
152
+    received the program in object code or executable form with such
153
+    an offer, in accord with Subsection b above.)
154
+
155
+The source code for a work means the preferred form of the work for
156
+making modifications to it.  For an executable work, complete source
157
+code means all the source code for all modules it contains, plus any
158
+associated interface definition files, plus the scripts used to
159
+control compilation and installation of the executable.  However, as a
160
+special exception, the source code distributed need not include
161
+anything that is normally distributed (in either source or binary
162
+form) with the major components (compiler, kernel, and so on) of the
163
+operating system on which the executable runs, unless that component
164
+itself accompanies the executable.
165
+
166
+If distribution of executable or object code is made by offering
167
+access to copy from a designated place, then offering equivalent
168
+access to copy the source code from the same place counts as
169
+distribution of the source code, even though third parties are not
170
+compelled to copy the source along with the object code.
171
+
172
+  4. You may not copy, modify, sublicense, or distribute the Program
173
+except as expressly provided under this License.  Any attempt
174
+otherwise to copy, modify, sublicense or distribute the Program is
175
+void, and will automatically terminate your rights under this License.
176
+However, parties who have received copies, or rights, from you under
177
+this License will not have their licenses terminated so long as such
178
+parties remain in full compliance.
179
+
180
+  5. You are not required to accept this License, since you have not
181
+signed it.  However, nothing else grants you permission to modify or
182
+distribute the Program or its derivative works.  These actions are
183
+prohibited by law if you do not accept this License.  Therefore, by
184
+modifying or distributing the Program (or any work based on the
185
+Program), you indicate your acceptance of this License to do so, and
186
+all its terms and conditions for copying, distributing or modifying
187
+the Program or works based on it.
188
+
189
+  6. Each time you redistribute the Program (or any work based on the
190
+Program), the recipient automatically receives a license from the
191
+original licensor to copy, distribute or modify the Program subject to
192
+these terms and conditions.  You may not impose any further
193
+restrictions on the recipients' exercise of the rights granted herein.
194
+You are not responsible for enforcing compliance by third parties to
195
+this License.
196
+
197
+  7. If, as a consequence of a court judgment or allegation of patent
198
+infringement or for any other reason (not limited to patent issues),
199
+conditions are imposed on you (whether by court order, agreement or
200
+otherwise) that contradict the conditions of this License, they do not
201
+excuse you from the conditions of this License.  If you cannot
202
+distribute so as to satisfy simultaneously your obligations under this
203
+License and any other pertinent obligations, then as a consequence you
204
+may not distribute the Program at all.  For example, if a patent
205
+license would not permit royalty-free redistribution of the Program by
206
+all those who receive copies directly or indirectly through you, then
207
+the only way you could satisfy both it and this License would be to
208
+refrain entirely from distribution of the Program.
209
+
210
+If any portion of this section is held invalid or unenforceable under
211
+any particular circumstance, the balance of the section is intended to
212
+apply and the section as a whole is intended to apply in other
213
+circumstances.
214
+
215
+It is not the purpose of this section to induce you to infringe any
216
+patents or other property right claims or to contest validity of any
217
+such claims; this section has the sole purpose of protecting the
218
+integrity of the free software distribution system, which is
219
+implemented by public license practices.  Many people have made
220
+generous contributions to the wide range of software distributed
221
+through that system in reliance on consistent application of that
222
+system; it is up to the author/donor to decide if he or she is willing
223
+to distribute software through any other system and a licensee cannot
224
+impose that choice.
225
+
226
+This section is intended to make thoroughly clear what is believed to
227
+be a consequence of the rest of this License.
228
+
229
+  8. If the distribution and/or use of the Program is restricted in
230
+certain countries either by patents or by copyrighted interfaces, the
231
+original copyright holder who places the Program under this License
232
+may add an explicit geographical distribution limitation excluding
233
+those countries, so that distribution is permitted only in or among
234
+countries not thus excluded.  In such case, this License incorporates
235
+the limitation as if written in the body of this License.
236
+
237
+  9. The Free Software Foundation may publish revised and/or new versions
238
+of the General Public License from time to time.  Such new versions will
239
+be similar in spirit to the present version, but may differ in detail to
240
+address new problems or concerns.
241
+
242
+Each version is given a distinguishing version number.  If the Program
243
+specifies a version number of this License which applies to it and "any
244
+later version", you have the option of following the terms and conditions
245
+either of that version or of any later version published by the Free
246
+Software Foundation.  If the Program does not specify a version number of
247
+this License, you may choose any version ever published by the Free Software
248
+Foundation.
249
+
250
+  10. If you wish to incorporate parts of the Program into other free
251
+programs whose distribution conditions are different, write to the author
252
+to ask for permission.  For software which is copyrighted by the Free
253
+Software Foundation, write to the Free Software Foundation; we sometimes
254
+make exceptions for this.  Our decision will be guided by the two goals
255
+of preserving the free status of all derivatives of our free software and
256
+of promoting the sharing and reuse of software generally.
257
+
258
+			    NO WARRANTY
259
+
260
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
262
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
266
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
267
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+REPAIR OR CORRECTION.
269
+
270
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+POSSIBILITY OF SUCH DAMAGES.
279
+
280
+		     END OF TERMS AND CONDITIONS
281
+
282
+	    How to Apply These Terms to Your New Programs
283
+
284
+  If you develop a new program, and you want it to be of the greatest
285
+possible use to the public, the best way to achieve this is to make it
286
+free software which everyone can redistribute and change under these terms.
287
+
288
+  To do so, attach the following notices to the program.  It is safest
289
+to attach them to the start of each source file to most effectively
290
+convey the exclusion of warranty; and each file should have at least
291
+the "copyright" line and a pointer to where the full notice is found.
292
+
293
+    <one line to give the program's name and a brief idea of what it does.>
294
+    Copyright (C) <year>  <name of author>
295
+
296
+    This program is free software; you can redistribute it and/or modify
297
+    it under the terms of the GNU General Public License as published by
298
+    the Free Software Foundation; either version 2 of the License, or
299
+    (at your option) any later version.
300
+
301
+    This program is distributed in the hope that it will be useful,
302
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
304
+    GNU General Public License for more details.
305
+
306
+    You should have received a copy of the GNU General Public License
307
+    along with this program; if not, write to the Free Software
308
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
309
+
310
+
311
+Also add information on how to contact you by electronic and paper mail.
312
+
313
+If the program is interactive, make it output a short notice like this
314
+when it starts in an interactive mode:
315
+
316
+    Gnomovision version 69, Copyright (C) year  name of author
317
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
+    This is free software, and you are welcome to redistribute it
319
+    under certain conditions; type `show c' for details.
320
+
321
+The hypothetical commands `show w' and `show c' should show the appropriate
322
+parts of the General Public License.  Of course, the commands you use may
323
+be called something other than `show w' and `show c'; they could even be
324
+mouse-clicks or menu items--whatever suits your program.
325
+
326
+You should also get your employer (if you work as a programmer) or your
327
+school, if any, to sign a "copyright disclaimer" for the program, if
328
+necessary.  Here is a sample; alter the names:
329
+
330
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
+
333
+  <signature of Ty Coon>, 1 April 1989
334
+  Ty Coon, President of Vice
335
+
336
+This General Public License does not permit incorporating your program into
337
+proprietary programs.  If your program is a subroutine library, you may
338
+consider it more useful to permit linking proprietary applications with the
339
+library.  If this is what you want to do, use the GNU Library General
340
+Public License instead of this License.

+ 1040
- 0
ChangeLog
File diff suppressed because it is too large
View File


+ 58
- 0
README View File

@@ -0,0 +1,58 @@
1
+Installation
2
+------------
3
+To build and install:
4
+
5
+1. mkdir build
6
+2. cd build
7
+3. cmake ..
8
+4. make
9
+5. make install
10
+
11
+
12
+Themes
13
+------
14
+As of v0.55, you can create QtCurve based themes. These will appear with KDE's style
15
+control panel's combobox of styles. To create a new theme, select 'QtCurve' from
16
+within KDE's style panel, then configure QtCurve as required. After this, in QtCurve's
17
+config dialog, select 'Export theme' from the options menu button. You will then be
18
+prompted to give your new 'theme' a name, and a comment. QtCurve will then create a file
19
+named 'qtc_<name>.themerc (e.g. qtc_klearlooks.themerc) - this will have the following
20
+format:
21
+
22
+    [Misc]
23
+    Name=KlearLooks
24
+    Comment=Clearlooks inspired style
25
+    [KDE]
26
+    WidgetStyle=qtc_klearlooks
27
+    [Settings]
28
+    animatedProgress=false
29
+    appearance=gradient
30
+    ....rest of qtcurve settings...
31
+
32
+To use this theme, either copy qtc_<name>.themerc to
33
+$KDEHOME/share/apps/kstyle/themes/ (usually ~/.kde/share/apps/kstyle/themes/)
34
+or copy to <kde install prefix>/share/apps/kstyle/themes/ (usually
35
+/usr/share/apps/kstyle/themes/)
36
+
37
+When KDE's style panel is restarted, your new theme should appear in the list.
38
+
39
+
40
+Creating Distribution Packages
41
+------------------------------
42
+
43
+CMake (as of v2.4.x) does not support building rpm or deb packages, and a simple
44
+checkinstall will not work. CMake 2.6 should support rpm and deb packages, but until
45
+then I have supplied a simple shell script to build a package with checkinstall.
46
+To use this:
47
+
48
+1. Install QtCurve as described above
49
+2. From within the 'build' folder from step 2 above, call ../common/mkpkg
50
+3. Answer the checkinstall questions.
51
+
52
+
53
+pixmaps.h
54
+---------
55
+
56
+To regenerate this, run the following:
57
+
58
+    qembed radio_frame.png radio_light.png radio_on.png check_on.png slider.png slider_light.png slider_v.png slider_light_v.png check_x_on.png > pixmaps.h

+ 18
- 0
TODO View File

@@ -0,0 +1,18 @@
1
+--new--
2
+
3
+KDE: Better konqueror active (?) icon border.
4
+KDE: Combobox popup should be drawn as a popup menu - ala Gtk.
5
+ALL: Highlight tab bar? Not sure Gtk can do this :-( (qt gtk theme engine doesn't!)
6
+--app specific--
7
+
8
+OO.o:
9
+KDE: 2.x no highlight on combofocus.
10
+
11
+KDE: Combo box has a lighter grey when disabled
12
+KDE: Slight re-draw error on tabs if width of all tabs= width of tab bar -- but
13
+     all KDE themes seem to suffer from this.
14
+KDE: Mising white pixel when last tab is selected, if its added then the above 
15
+     suffers even more!
16
+KDE: V3 Combobox list needs to be rounded in rounded mode - missing pixels, etc.
17
+     Also take into account scrollbar pos? i.e. draw line 1 pixel less on right?
18
+ALL: GTK/KDE have different disabled text behaviour when contrast setting changed!

BIN
common/check_on.png View File


BIN
common/check_x_on.png View File


+ 955
- 0
common/common.h View File

@@ -0,0 +1,955 @@
1
+#ifndef __COMMON_H__
2
+#define __COMMON_H__
3
+
4
+/*
5
+  QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
6
+
7
+  ----
8
+
9
+  This program is free software; you can redistr ibute it and/or
10
+  modify it under the terms of the GNU General Public
11
+  License version 2 as published by the Free Software Foundation.
12
+
13
+  This program is distributed in the hope that it will be useful,
14
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+  General Public License for more details.
17
+
18
+  You should have received a copy of the GNU General Public License
19
+  along with this program; see the file COPYING.  If not, write to
20
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
+  Boston, MA 02110-1301, USA.
22
+*/
23
+
24
+/* This file is quite 'hacky' as it contains lots of static function definitions - but I want to share the code
25
+   between Qt and Gtk, but not polute the namespace with exported functions... */
26
+
27
+#include <string.h>
28
+#include <math.h>
29
+#include "config.h"
30
+
31
+/*
32
+    The following #define disables the rounding when scrollbar type==none.
33
+#define QTC_SIMPLE_SCROLLBARS
34
+*/
35
+
36
+/*
37
+    The following #define disables the custom focus rectangle
38
+#define QTC_PLAIN_FOCUS_ONLY
39
+*/
40
+
41
+/*
42
+    The following #define controls whether a scrollbar's slider should overlap
43
+    the scrollbar buttons when at min/max. This removes the thick looking line
44
+    between the slider and the buttons.
45
+*/
46
+#define QTC_INCREASE_SB_SLIDER
47
+
48
+/*
49
+    Enable this to do focus highlighting for scrollviews... NOTE: Gtk2 currently does not do this.
50
+#define QTC_HIGHLIGHT_SCROLVIEWS
51
+*/
52
+
53
+/*
54
+    Control shading used for glass variants.
55
+    0 => As used in 0.51.1 +
56
+    1 => As used in 0.51
57
+    2 => As used in <0.51
58
+*/
59
+#define QTC_GLASS_SHADING 0
60
+
61
+typedef enum
62
+{
63
+    SHADING_SIMPLE=0,
64
+    SHADING_HSL=1,
65
+    SHADING_HSV=2
66
+} EShading;
67
+
68
+#if (!defined QTC_CONFIG_DIALOG) && (!defined QTC_KWIN)
69
+static EShading shading=SHADING_HSL;
70
+#endif
71
+
72
+#ifdef __cplusplus
73
+#include <qconfig.h>
74
+#ifdef QTC_CONFIG_DIALOG
75
+#include <qapplication.h>
76
+#endif
77
+#else
78
+#include <glib.h>
79
+#endif
80
+
81
+#ifdef __cplusplus
82
+typedef QColor color;
83
+#else
84
+typedef gboolean bool;
85
+typedef GdkColor color;
86
+#define true TRUE
87
+#define false FALSE
88
+#endif
89
+
90
+#define QTC_GROUP        "Settings"
91
+/*#define QTC_DESCR_GROUP  "Description"*/
92
+
93
+/* qtc_<theme name>.themerc support */
94
+#define KDE_PREFIX(V) ((4==(V)) ? KDE4PREFIX : KDE3PREFIX)
95
+#define QTC_THEME_DIR    "/share/apps/kstyle/themes/"
96
+#define QTC_THEME_PREFIX "qtc_"
97
+#define QTC_THEME_SUFFIX ".themerc"
98
+
99
+
100
+#define QTC_CHECK_SIZE   13
101
+#define QTC_RADIO_SIZE   13
102
+#define QTC_MIN_BTN_SIZE 8
103
+#define QTC_LV_SIZE      7
104
+
105
+#define LARGE_ARR_WIDTH  7
106
+#define LARGE_ARR_HEIGHT 4
107
+#define SMALL_ARR_WIDTH  5
108
+#define SMALL_ARR_HEIGHT 3
109
+
110
+#define NUM_STD_SHADES   6
111
+#define NUM_EXTRA_SHADES 3
112
+
113
+#define TOTAL_SHADES     NUM_STD_SHADES+NUM_EXTRA_SHADES
114
+#define ORIGINAL_SHADE   TOTAL_SHADES
115
+
116
+#define SHADE_ORIG_HIGHLIGHT NUM_STD_SHADES
117
+#define SHADE_4_HIGHLIGHT    NUM_STD_SHADES+1
118
+#define SHADE_2_HIGHLIGHT    NUM_STD_SHADES+2
119
+
120
+/* 3d effect - i.e. buttons, etc */
121
+#define QTC_SHADES \
122
+    static const double shades[2][11][NUM_STD_SHADES]=\
123
+    { \
124
+        { /* HSV & HSL */ \
125
+            { 1.05, 1.04, 0.90, 0.800, 0.830, 0.82 }, \
126
+            { 1.06, 1.04, 0.90, 0.790, 0.831, 0.78 }, \
127
+            { 1.07, 1.04, 0.90, 0.785, 0.832, 0.75 }, \
128
+            { 1.08, 1.05, 0.90, 0.782, 0.833, 0.72 }, \
129
+            { 1.09, 1.05, 0.90, 0.782, 0.834, 0.70 }, \
130
+            { 1.10, 1.06, 0.90, 0.782, 0.836, 0.68 }, \
131
+            { 1.12, 1.06, 0.90, 0.782, 0.838, 0.63 }, \
132
+            { 1.16, 1.07, 0.90, 0.782, 0.840, 0.62 }, /* default */ \
133
+            { 1.18, 1.07, 0.90, 0.783, 0.842, 0.60 }, \
134
+            { 1.20, 1.08, 0.90, 0.784, 0.844, 0.58 }, \
135
+            { 1.22, 1.08, 0.90, 0.786, 0.848, 0.55 }  \
136
+        }, \
137
+        { /* SIMPLE */ \
138
+            { 1.07, 1.03, 0.91, 0.780, 0.834, 0.75 }, \
139
+            { 1.08, 1.03, 0.91, 0.781, 0.835, 0.74 }, \
140
+            { 1.09, 1.03, 0.91, 0.782, 0.836, 0.73 }, \
141
+            { 1.10, 1.04, 0.91, 0.783, 0.837, 0.72 }, \
142
+            { 1.11, 1.04, 0.91, 0.784, 0.838, 0.71 }, \
143
+            { 1.12, 1.05, 0.91, 0.785, 0.840, 0.70 }, \
144
+            { 1.13, 1.05, 0.91, 0.786, 0.842, 0.69 }, \
145
+            { 1.14, 1.06, 0.91, 0.787, 0.844, 0.68 }, /* default */ \
146
+            { 1.16, 1.06, 0.91, 0.788, 0.846, 0.66 }, \
147
+            { 1.18, 1.07, 0.91, 0.789, 0.848, 0.64 }, \
148
+            { 1.20, 1.07, 0.91, 0.790, 0.850, 0.62 }  \
149
+        } \
150
+    } ;
151
+
152
+#define QTC_SIMPLE_SHADING (!shading)
153
+
154
+#define QT_STD_BORDER      5
155
+#define QT_DISABLED_BORDER QT_STD_BORDER /*3*/
156
+#define QT_BORDER(E) (/*(E) ?*/ QT_STD_BORDER/* : QT_DISABLED_BORDER*/)
157
+
158
+#define QT_FRAME_DARK_SHADOW 2
159
+#define QT_FOCUS             3
160
+
161
+#define QTC_SHADE(c, s) \
162
+    (c>10 || c<0 || s>=NUM_STD_SHADES || s<0 \
163
+        ? 1.0 \
164
+        : opts.darkerBorders && (QT_STD_BORDER==i || QT_DISABLED_BORDER==i) \
165
+            ? shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] - 0.1 \
166
+            : shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] )
167
+
168
+#define TAB_APPEARANCE(A)   (A) /* (APPEARANCE_GLASS==(A) ? APPEARANCE_GRADIENT : (A)) */
169
+#define QTC_COLOR_SEL_TAB_FACTOR 1.2
170
+
171
+#define QTC_ROUNDED (ROUND_NONE!=opts.round)
172
+
173
+#define QTC_ETCHED_DARK            0.95
174
+#define SHADE_BEVEL_GRAD_LIGHT     (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
175
+#define SHADE_BEVEL_GRAD_DARK      (QTC_SIMPLE_SHADING ? 0.93 : 0.91)
176
+#define SHADE_BEVEL_GRAD_SEL_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
177
+#define SHADE_BEVEL_GRAD_SEL_DARK  (QTC_SIMPLE_SHADING ? 0.95 : 0.93)
178
+
179
+#define SHADE_BEVEL_MENU_ITEM_LIGHT (QTC_SIMPLE_SHADING ? 1.07 : 1.09)
180
+#define SHADE_BEVEL_MENU_ITEM_DARK  (QTC_SIMPLE_SHADING ? 0.85 : 0.83)
181
+
182
+#define SHADE_SLIDER_LIGHT          1.1
183
+#define SHADE_SLIDER_DARK           0.8
184
+
185
+#define SHADE_SBAR_LIGHT            1.02
186
+#define SHADE_SBAR_DARK             0.95
187
+
188
+#define SHADE_MENU_LIGHT            1.02
189
+#define SHADE_MENU_DARK             0.96
190
+
191
+#define SHADE_TAB_SEL_LIGHT         1.1
192
+#define SHADE_TAB_SEL_DARK          1.0
193
+
194
+#define SHADE_BOTTOM_TAB_SEL_LIGHT  1.0
195
+#define SHADE_BOTTOM_TAB_SEL_DARK   0.96
196
+
197
+#define SPLIT_GRADIENT_FACTOR       0.415
198
+
199
+#if !defined QTC_GLASS_SHADING || QTC_GLASS_SHADING==0
200
+
201
+    #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
202
+                                        ? (WIDGET_DEF_BUTTON==W ? 0.99 : 0.98) \
203
+                                        : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.55))
204
+    #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A \
205
+                                        ? (WIDGET_DEF_BUTTON==W ? 0.94 : 0.92) \
206
+                                        : 0.92)
207
+    #define SHADE_GLASS_BOT_A(A) (APPEARANCE_DULL_GLASS==A ? 1.02 : 0.99)
208
+    #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.10 : 1.16)
209
+
210
+#elif QTC_GLASS_SHADING==1
211
+
212
+    #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
213
+                                        ? (WIDGET_DEF_BUTTON==W ? 1.0 : 1.0) \
214
+                                        : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
215
+    #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A ? 0.96 : 0.96)
216
+    #define SHADE_GLASS_BOT_A(A) 0.99
217
+    #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
218
+
219
+#else
220
+
221
+    #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
222
+                                        ? (WIDGET_DEF_BUTTON==W ? 1.05 : 1.05) \
223
+                                        : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
224
+    #define SHADE_GLASS_TOP_B(A, W) 0.96
225
+    #define SHADE_GLASS_BOT_A(A) 0.99
226
+    #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
227
+
228
+#endif
229
+
230
+#define IS_GLASS(A) (APPEARANCE_DULL_GLASS==A || APPEARANCE_SHINY_GLASS==A)
231
+#define IS_FLAT(A)  (APPEARANCE_FLAT==A || APPEARANCE_RAISED==A)
232
+#define SHADE_SELECTION_TOP 1.15
233
+#define SHADE_SELECTION_BOT 0.9
234
+
235
+#ifdef __cplusplus
236
+#define MENUBAR_DARK_LIMIT 160
237
+#define TOO_DARK(A) ((A).red()<MENUBAR_DARK_LIMIT || (A).green()<MENUBAR_DARK_LIMIT || (A).blue()<MENUBAR_DARK_LIMIT)
238
+#else
239
+#define MENUBAR_DARK_LIMIT (160<<8)
240
+#define TOO_DARK(A) ((A).red<MENUBAR_DARK_LIMIT || (A).green<MENUBAR_DARK_LIMIT || (A).blue<MENUBAR_DARK_LIMIT)
241
+#endif
242
+
243
+#define DEFAULT_HIGHLIGHT_FACTOR   1.05
244
+#define MAX_HIGHLIGHT_FACTOR         50
245
+#define MIN_HIGHLIGHT_FACTOR        -50
246
+#define MENUBAR_DARK_FACTOR        0.97
247
+#define POPUPMENU_LIGHT_FACTOR     1.15
248
+#define INACTIVE_HIGHLIGHT_FACTOR  1.20
249
+
250
+#define USE_SHADED_MENU_BAR_COLORS (SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars)
251
+#define MENUBAR_GLASS_SELECTED_DARK_FACTOR 0.9
252
+#define GLASS_BORDER         0.4
253
+#define BEVEL_BORDER(w)      (WIDGET_LISTVIEW_HEADER==w ? 6 : 4)
254
+#define SHADE_BEVEL_TOP      1.07
255
+#define SHADE_BEVEL_MID_TOP  1.03
256
+#define SHADE_BEVEL_MID_BOT  0.975
257
+#define SHADE_BEVEL_BOT(w)   (WIDGET_LISTVIEW_HEADER==(w) ? 0.88 : 0.90)
258
+
259
+#define NUM_SPLITTER_DASHES 21
260
+
261
+#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || WIDGET_CHECKBOX==w)
262
+#ifdef __cplusplus
263
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w)
264
+#else
265
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || \
266
+                        WIDGET_SPIN_UP==w || WIDGET_SPIN_DOWN==w)
267
+#endif
268
+#define COLORED_BORDER_SIZE 3
269
+#define PROGRESS_CHUNK_WIDTH 10
270
+#define QTC_DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \
271
+    ((!SUKEN && IS_GLASS(APP) && WIDGET_MENU_ITEM!=WIDGET && WIDGET_DEF_BUTTON!=WIDGET) || \
272
+                          (WIDGET_PROGRESSBAR==WIDGET && APPEARANCE_FLAT!=APP && \
273
+                           APPEARANCE_RAISED!=APP && APPEARANCE_INVERTED!=APP))
274
+
275
+#define PROGRESS_ANIMATION 100
276
+#define MIN_SLIDER_SIZE(A) (LINE_DOTS==A ? 24 : 20)
277
+
278
+#define QTC_NORM_TAB_APP (APPEARANCE_BEVELLED==opts.tabAppearance || APPEARANCE_SPLIT_GRADIENT==opts.appearance \
279
+                            ? APPEARANCE_GRADIENT : opts.tabAppearance)
280
+#define QTC_SEL_TAB_APP (APPEARANCE_INVERTED==opts.tabAppearance ? APPEARANCE_FLAT : (QTC_NORM_TAB_APP))
281
+#define QTC_SLIDER_MO_SHADE  (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE))
282
+#define QTC_SLIDER_MO_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1)
283
+#define QTC_SLIDER_MO_LEN (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3))
284
+#define QTC_SB_SLIDER_MO_LEN(A) ((A)<22 && ROUND_FULL!=opts.round \
285
+                                    ? 2 \
286
+                                    : ((A)<32 || (SHADE_SELECTED!=opts.shadeSliders && SHADE_BLEND_SELECTED!=opts.shadeSliders) \
287
+                                        ? 4 \
288
+                                        : 6))
289
+
290
+#define QTC_CR_MO_FILL          (SHADE_BLEND_SELECTED==opts.shadeCheckRadio || SHADE_SELECTED==opts.shadeCheckRadio ? 1 : 2)
291
+#define QTC_MO_DEF_BTN          2
292
+#define QTC_MO_PLASTIK_DARK(W)  (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */
293
+#define QTC_MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */
294
+
295
+#define QTC_MO_STD_DARK(W)     QTC_MO_PLASTIK_DARK(W)  /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) */
296
+#define QTC_MO_STD_LIGHT(W, S) QTC_MO_PLASTIK_LIGHT(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 2 : (S ? 1 : 0))*/
297
+
298
+#define QTC_DO_EFFECT          (ROUND_FULL==opts.round && EFFECT_NONE!=opts.buttonEffect)
299
+
300
+#ifdef __cplusplus
301
+#include <qstyle.h>
302
+typedef enum
303
+{
304
+    QtC_Round = QStyle::PM_CustomBase
305
+} QtCMetrics;
306
+#endif
307
+
308
+typedef enum
309
+{
310
+    EFFECT_NONE,
311
+    EFFECT_ETCH,
312
+    EFFECT_SHADOW
313
+} EEffect;
314
+
315
+typedef enum
316
+{
317
+    PIX_RADIO_BORDER,
318
+    PIX_RADIO_LIGHT,
319
+    PIX_RADIO_ON,
320
+    PIX_CHECK,
321
+    PIX_SLIDER,
322
+    PIX_SLIDER_LIGHT,
323
+    PIX_SLIDER_V,
324
+    PIX_SLIDER_LIGHT_V
325
+} EPixmap;
326
+
327
+typedef enum
328
+{
329
+    WIDGET_TAB_TOP,
330
+    WIDGET_TAB_BOT,
331
+    WIDGET_STD_BUTTON,
332
+    WIDGET_DEF_BUTTON,
333
+    WIDGET_LISTVIEW_HEADER,
334
+    WIDGET_SLIDER,
335
+    WIDGET_SLIDER_TROUGH,
336
+    WIDGET_SB_SLIDER,
337
+    WIDGET_SB_BUTTON,
338
+    WIDGET_TROUGH,
339
+    WIDGET_CHECKBOX,
340
+    WIDGET_TOGGLE_BUTTON,
341
+    WIDGET_MENU_ITEM,
342
+    WIDGET_PROGRESSBAR,
343
+#ifndef __cplusplus
344
+    WIDGET_SPIN_UP,
345
+    WIDGET_SPIN_DOWN,
346
+#endif
347
+    WIDGET_SPIN,
348
+#ifdef __cplusplus
349
+    WIDGET_CHECKBUTTON,  // Qt4 only
350
+    WIDGET_MDI_WINDOW,   // Qt4 only
351
+    WIDGET_MDI_WINDOW_TITLE,   // Qt4 only
352
+    WIDGET_ENTRY,
353
+    WIDGET_FRAME,
354
+    WIDGET_NO_ETCH_BTN,
355
+#endif
356
+    WIDGET_OTHER
357
+} EWidget;
358
+
359
+typedef enum
360
+{
361
+    APPEARANCE_FLAT,
362
+    APPEARANCE_RAISED,
363
+    APPEARANCE_DULL_GLASS,
364
+    APPEARANCE_SHINY_GLASS,
365
+    APPEARANCE_GRADIENT,
366
+    APPEARANCE_INVERTED,
367
+    APPEARANCE_SPLIT_GRADIENT,
368
+    APPEARANCE_BEVELLED
369
+} EAppearance;
370
+
371
+#define IS_SLIDER(W)        (WIDGET_SLIDER==W || WIDGET_SB_SLIDER==W)
372
+#define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==W || WIDGET_CHECKBOX==W)
373
+
374
+typedef enum
375
+{
376
+    CORNER_TL = 0x1,
377
+    CORNER_TR = 0x2,
378
+    CORNER_BR = 0x4,
379
+    CORNER_BL = 0x8
380
+} ECornerBits;
381
+
382
+#define ROUNDED_NONE            0x0
383
+#define ROUNDED_TOP             (CORNER_TL|CORNER_TR)
384
+#define ROUNDED_BOTTOM          (CORNER_BL|CORNER_BR)
385
+#define ROUNDED_LEFT            (CORNER_TL|CORNER_BL)
386
+#define ROUNDED_RIGHT           (CORNER_TR|CORNER_BR)
387
+#define ROUNDED_TOPRIGHT        CORNER_TR
388
+#define ROUNDED_BOTTOMRIGHT     CORNER_BR
389
+#define ROUNDED_TOPLEFT         CORNER_TL
390
+#define ROUNDED_BOTTOMLEFT      CORNER_BL
391
+#define ROUNDED_ALL             (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL)
392
+
393
+typedef enum
394
+{
395
+    IND_CORNER,
396
+    IND_FONT_COLOR,
397
+    IND_COLORED,
398
+    IND_NONE
399
+} EDefBtnIndicator;
400
+
401
+typedef enum
402
+{
403
+    LINE_SUNKEN,
404
+    LINE_FLAT,
405
+    LINE_DOTS,
406
+    LINE_DASHES
407
+} ELine;
408
+
409
+#define LINE_NONE LINE_DASHES
410
+
411
+typedef enum
412
+{
413
+    TB_NONE,
414
+    TB_LIGHT,
415
+    TB_DARK,
416
+    TB_LIGHT_ALL,
417
+    TB_DARK_ALL,
418
+} ETBarBorder;
419
+
420
+typedef enum
421
+{
422
+    BORDER_FLAT,
423
+    BORDER_RAISED,
424
+    BORDER_SUNKEN
425
+} EBorder;
426
+
427
+/*
428
+    This whole EShade enum is a complete mess!
429
+    For menubars, we dont blend - so blend is selected, and selected is darken
430
+    For check/radios - we dont blend, so blend is selected, and we dont allow darken
431
+*/
432
+typedef enum
433
+{
434
+    SHADE_NONE,
435
+    SHADE_CUSTOM,
436
+    SHADE_BLEND_SELECTED,  /* In the case of check/radios this is SHADE_SELECTED */
437
+      SHADE_SELECTED,
438
+      SHADE_DARKEN = SHADE_SELECTED ,  /* For menubar only! */
439
+} EShade;
440
+
441
+typedef enum
442
+{
443
+    ROUND_NONE,
444
+    ROUND_SLIGHT,
445
+    ROUND_FULL
446
+} ERound;
447
+
448
+typedef enum
449
+{
450
+    SCROLLBAR_KDE,
451
+    SCROLLBAR_WINDOWS,
452
+    SCROLLBAR_PLATINUM,
453
+    SCROLLBAR_NEXT,
454
+    SCROLLBAR_NONE
455
+} EScrollbar;
456
+
457
+typedef enum
458
+{
459
+    MO_NONE,
460
+    MO_COLORED,
461
+    MO_PLASTIK
462
+} EMouseOver;
463
+
464
+typedef enum
465
+{
466
+    STRIPE_NONE,
467
+    STRIPE_PLAIN,
468
+    STRIPE_DIAGONAL
469
+} EStripe;
470
+
471
+typedef enum
472
+{
473
+    SLIDER_PLAIN,
474
+    SLIDER_ROUND,
475
+    SLIDER_TRIANGULAR,
476
+} ESliderStyle;
477
+
478
+#define DEF_IND_STR                "fontcolor"
479
+#define DEF_LINE_STR               "dots"
480
+#define DEF_TB_BORDER              "none"
481
+#define DEF_APPEARANCE_STR         "bevelled"
482
+#define DEF_MENU_APPEARANCE_STR    "gradient"
483
+#define DEF_TOOLBAR_APPEARANCE_STR "gradient"
484
+#define DEF_SLIDER_SHADE_STR       "selected"
485
+#define DEF_TBS_STR                "dots"
486
+#define DEF_COLOR_STR              "background"
487
+#define DEF_TOOLBAR_SHADE_STR      "none"
488
+
489
+#ifdef QTC_COMMON_FUNCTIONS
490
+static double getWidgetShade(EWidget w, bool light, bool sunken, EAppearance app)
491
+{
492
+    switch(w)
493
+    {
494
+        case WIDGET_TROUGH:
495
+            return light ? SHADE_SBAR_LIGHT : SHADE_SBAR_DARK;
496
+        case WIDGET_SLIDER_TROUGH:
497
+            return light ? SHADE_SLIDER_LIGHT : SHADE_SLIDER_DARK;
498
+        case WIDGET_MENU_ITEM:
499
+            if(APPEARANCE_DULL_GLASS!=app && APPEARANCE_SHINY_GLASS!=app)
500
+                return light ? SHADE_BEVEL_MENU_ITEM_LIGHT : SHADE_BEVEL_MENU_ITEM_DARK;
501
+        default:
502
+            return light
503
+                    ? sunken
504
+                        ? SHADE_BEVEL_GRAD_SEL_LIGHT
505
+                        : SHADE_BEVEL_GRAD_LIGHT
506
+                    : sunken
507
+                        ? SHADE_BEVEL_GRAD_SEL_DARK
508
+                        : SHADE_BEVEL_GRAD_DARK;
509
+    }
510
+}
511
+
512
+#define QTC_MIN(a, b) ((a) < (b) ? (a) : (b))
513
+#define QTC_MAX(a, b) ((b) < (a) ? (a) : (b))
514
+
515
+static bool equal(double d1, double d2)
516
+{
517
+    return (fabs(d1 - d2) < 0.0001);
518
+}
519
+
520
+/* Taken from rgb->hsl routines taken from KColor
521
+    Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
522
+*/
523
+static inline double normalize(double a)
524
+{
525
+    return (a < 0.0 ? 0.0 : a > 1.0 ? 1.0 : a);
526
+}
527
+
528
+static inline double mix(double a, double b, double k)
529
+{
530
+    return a + ( ( b - a ) * k );
531
+}
532
+
533
+static inline double wrap(double a, double d)
534
+{
535
+    register double r = fmod( a, d );
536
+    return ( r < 0.0 ? d + r : ( r > 0.0 ? r : 0.0 ) );
537
+}
538
+
539
+static inline double h2c(double h, double m1, double m2)
540
+{
541
+    h = wrap( h, 6.0 );
542
+
543
+    if ( h < 1.0 )
544
+        return mix( m1, m2, h );
545
+    if ( h < 3.0 )
546
+        return m2;
547
+    if ( h < 4.0 )
548
+        return mix( m1, m2, 4.0 - h );
549
+    return m1;
550
+}
551
+
552
+static inline void rgbToHsl(double r, double g, double b, double *h, double *s, double *l)
553
+{
554
+    double min=QTC_MIN(QTC_MIN(r, g), b),
555
+           max=QTC_MAX(QTC_MAX(r, g), b);
556
+
557
+    *l = 0.5 * (max + min);
558
+    *s = 0.0;
559
+    *h = 0.0;
560
+
561
+    if (max != min)
562
+    {
563
+        double delta = max - min;
564
+
565
+        if ( *l <= 0.5 )
566
+            *s = delta / ( max + min );
567
+        else
568
+            *s = delta / ( 2.0 - max - min );
569
+
570
+        if ( r == max )
571
+            *h = ( g - b ) / delta;
572
+        else if ( g == max )
573
+            *h = 2.0 + ( b - r ) / delta;
574
+        else if ( b == max )
575
+            *h = 4.0 + ( r - g ) / delta;
576
+
577
+        *h /= 6.0;
578
+        if ( *h < 0.0 )
579
+            (*h) += 1.0;
580
+    }
581
+}
582
+
583
+static inline void hslToRgb(double h, double s, double l, double *r, double *g, double *b)
584
+{
585
+    double m1, m2;
586
+
587
+    // TODO h2rgb( h, r, g, b );
588
+    h *= 6.0;
589
+
590
+    if ( l <= 0.5 )
591
+        m2 = l * ( 1.0 + s );
592
+    else
593
+        m2 = l + s * ( 1.0 - l );
594
+    m1 = 2.0 * l - m2;
595
+
596
+    *r = h2c( h + 2.0, m1, m2 );
597
+    *g = h2c( h,       m1, m2 );
598
+    *b = h2c( h - 2.0, m1, m2 );
599
+}
600
+
601
+static void rgbToHsv(double r, double g, double b, double *h, double *s, double *v)
602
+{
603
+    double min=QTC_MIN(QTC_MIN(r, g), b),
604
+           max=QTC_MAX(QTC_MAX(r, g), b),
605
+           delta=max - min;
606
+
607
+    *v=max;
608
+    if(max != 0)
609
+        *s=delta / max;
610
+    else
611
+    {
612
+        /* r=g=b=0                  s=0, v is undefined */
613
+        *s=0;
614
+        *h=-1;
615
+        return;
616
+    }
617
+    if(r == max)
618
+        *h=(g - b) / delta;         /* between yellow & magenta */
619
+    else if(g == max)
620
+        *h=2 + (b - r) / delta;     /* between cyan & yellow */
621
+    else
622
+        *h=4 + (r - g) / delta;     /* between magenta & cyan */
623
+    *h *= 60;                       /* degrees */
624
+    if(*h < 0)
625
+        *h += 360;
626
+}
627
+
628
+static void hsvToRgb(double *r, double *g, double *b, double h, double s, double v)
629
+{
630
+    if(0==s)
631
+        *r=*g=*b=v;
632
+    else
633
+    {
634
+        int    i;
635
+        double f,
636
+               p;
637
+
638
+        h /= 60;                      /* sector 0 to 5 */
639
+        i=(int)floor(h);
640
+        f=h - i;                      /* factorial part of h */
641
+        p=v * (1 - s);
642
+        switch(i)
643
+        {
644
+            case 0:
645
+                *r=v;
646
+                *g=v * (1 - s * (1 - f));
647
+                *b=p;
648
+                break;
649
+            case 1:
650
+                *r=v * (1 - s * f);
651
+                *g=v;
652
+                *b=p;
653
+                break;
654
+            case 2:
655
+                *r=p;
656
+                *g=v;
657
+                *b=v * (1 - s * (1 - f));
658
+                break;
659
+            case 3:
660
+                *r=p;
661
+                *g=v * (1 - s * f);
662
+                *b=v;
663
+                break;
664
+            case 4:
665
+                *r=v * (1 - s * (1 - f));
666
+                *g=p;
667
+                *b=v;
668
+                break;
669
+            /* case 5: */
670
+            default:
671
+                *r=v;
672
+                *g=p;
673
+                *b=v * (1 - s * f);
674
+                break;
675
+        }
676
+    }
677
+}
678
+
679
+#ifdef __cplusplus
680
+inline int limit(double c)
681
+{
682
+    return c < 0.0 ? 0 : (c > 255.0  ? 255 : (int)c);
683
+}
684
+#else
685
+inline int limit(double c)
686
+{
687
+    return c < 0.0
688
+               ? 0
689
+               : c > 65535.0
690
+                     ? 65535
691
+                     : (int)c;
692
+}
693
+#endif
694
+
695
+#ifdef __cplusplus
696
+static void shade(const color &ca, color *cb, double k)
697
+#else
698
+static void shade(const color *ca, color *cb, double k)
699
+#endif
700
+{
701
+    if(equal(k, 1.0))
702
+    {
703
+#ifdef __cplusplus
704
+        *cb=ca;
705
+#else
706
+        cb->red = ca->red;
707
+        cb->green = ca->green;
708
+        cb->blue = ca->blue;
709
+#endif
710
+    }
711
+    else
712
+        switch(shading)
713
+        {
714
+            case SHADING_SIMPLE:
715
+            {
716
+    #ifdef __cplusplus
717
+                int v=(int)(255.0*(k-1.0));
718
+
719
+                cb->setRgb(limit(ca.red()+v), limit(ca.green()+v), limit(ca.blue()+v));
720
+    #else
721
+                double v=65535.0*(k-1.0);
722
+
723
+                cb->red = limit(ca->red+v);
724
+                cb->green = limit(ca->green+v);
725
+                cb->blue = limit(ca->blue+v);
726
+    #endif
727
+                break;
728
+            }
729
+            case SHADING_HSL:
730
+            {
731
+    #ifdef __cplusplus
732
+                double r(ca.red()/255.0),
733
+                       g(ca.green()/255.0),
734
+                       b(ca.blue()/255.0);
735
+    #else
736
+                double r=ca->red/65535.0,
737
+                       g=ca->green/65535.0,
738
+                       b=ca->blue/65535.0;
739
+    #endif
740
+                double h, s, l;
741
+
742
+                rgbToHsl(r, g, b, &h, &s, &l);
743
+                l=normalize(l*k);
744
+                s=normalize(s*k);
745
+                hslToRgb(h, s, l, &r, &g, &b);
746
+    #ifdef __cplusplus
747
+                cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0));
748
+    #else
749
+                cb->red=limit(r*65535.0);
750
+                cb->green=limit(g*65535.0);
751
+                cb->blue=limit(b*65535.0);
752
+    #endif
753
+                break;
754
+            }
755
+            case SHADING_HSV:
756
+            {
757
+    #ifdef __cplusplus
758
+                double r(ca.red()/255.0),
759
+                       g(ca.green()/255.0),
760
+                       b(ca.blue()/255.0);
761
+    #else
762
+                double r=ca->red/65535.0,
763
+                       g=ca->green/65535.0,
764
+                       b=ca->blue/65535.0;
765
+    #endif
766
+                double h, s, v;
767
+
768
+                rgbToHsv(r, g, b, &h, &s, &v);
769
+
770
+                v*=k;
771
+                if (v > 1.0)
772
+                {
773
+                    s -= v - 1.0;
774
+                    if (s < 0)
775
+                        s = 0;
776
+                    v = 1.0;
777
+                }
778
+                hsvToRgb(&r, &g, &b, h, s, v);
779
+    #ifdef __cplusplus
780
+                cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0));
781
+    #else
782
+                cb->red=limit(r*65535.0);
783
+                cb->green=limit(g*65535.0);
784
+                cb->blue=limit(b*65535.0);
785
+    #endif
786
+            }
787
+        }
788
+}
789
+
790
+static unsigned char checkBounds(int num)
791
+{
792
+    return num < 0   ? 0   :
793
+           num > 255 ? 255 :
794
+                       num;
795
+}
796
+
797
+static void adjustPix(unsigned char *data, int numChannels, int w, int h, int stride,
798
+                      int ro, int go, int bo, double shade)
799
+{
800
+    int width=w*numChannels,
801
+        offset=0,
802
+        row,
803
+        r=(int)((ro*shade)+0.5),
804
+        g=(int)((go*shade)+0.5),
805
+        b=(int)((bo*shade)+0.5);
806
+
807
+    for(row=0; row<h; ++row)
808
+    {
809
+        int column;
810
+
811
+        for(column=0; column<width; column+=numChannels)
812
+        {
813
+            unsigned char source=data[offset+column+1];
814
+
815
+#if defined  __cplusplus
816
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
817
+            /* ARGB */
818
+            data[offset+column+1] = checkBounds(r-source);
819
+            data[offset+column+2] = checkBounds(g-source);
820
+            data[offset+column+3] = checkBounds(b-source);
821
+#else
822
+            /* BGRA */
823
+            data[offset+column] = checkBounds(b-source);
824
+            data[offset+column+1] = checkBounds(g-source);
825
+            data[offset+column+2] = checkBounds(r-source);
826
+#endif
827
+#else
828
+            /* GdkPixbuf is RGBA */
829
+            data[offset+column] = checkBounds(r-source);
830
+            data[offset+column+1] = checkBounds(g-source);
831
+            data[offset+column+2] = checkBounds(b-source);
832
+#endif
833
+
834
+        }
835
+        offset+=stride;
836
+    }
837
+}
838
+#endif /* QTC_COMMON_NO_FUNCTIONS */
839
+
840
+#ifdef __cplusplus
841
+struct Options
842
+#else
843
+typedef struct
844
+#endif
845
+{
846
+    int              contrast,
847
+                     passwordChar;
848
+    double           highlightFactor;
849
+    ERound           round;
850
+    bool             embolden,
851
+                     lighterPopupMenuBgnd,
852
+                     highlightTab,
853
+                     colorSelTab,
854
+                     animatedProgress,
855
+                     fixParentlessDialogs,
856
+                     customMenuTextColor,
857
+                     menubarMouseOver,
858
+                     shadeMenubarOnlyWhenActive,
859
+                     thinnerMenuItems,
860
+#ifndef QTC_PLAIN_FOCUS_ONLY
861
+                     stdFocus,
862
+#endif
863
+                     lvLines,
864
+                     drawStatusBarFrames,
865
+                     fillSlider,
866
+                     roundMbTopOnly,
867
+                     gradientPbGroove,
868
+#ifdef __cplusplus
869
+                     stdSidebarButtons,
870
+                     gtkScrollViews,
871
+                     gtkComboMenus,
872
+/*
873
+#else
874
+                     setDialogButtonOrder,
875
+*/
876
+#endif
877
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
878
+                     mapKdeIcons,
879
+#endif
880
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
881
+                     gtkButtonOrder,
882
+#endif
883
+                     borderMenuitems,
884
+                     colorMenubarMouseOver,
885
+                     darkerBorders,
886
+                     vArrows,
887
+                     xCheck,
888
+                     framelessGroupBoxes,
889
+                     inactiveHighlight;
890
+    EStripe          stripedProgress;
891
+    ESliderStyle     sliderStyle;
892
+    EMouseOver       coloredMouseOver;
893
+    ETBarBorder      toolbarBorders;
894
+    EDefBtnIndicator defBtnIndicator;
895
+    ELine            sliderThumbs,
896
+                     handles,
897
+                     toolbarSeparators,
898
+                     splitters;
899
+    EAppearance      appearance,
900
+                     menubarAppearance,
901
+                     menuitemAppearance,
902
+                     toolbarAppearance,
903
+                     lvAppearance,
904
+                     tabAppearance,
905
+                     sliderAppearance,
906
+                     progressAppearance;
907
+    EShade           shadeSliders,
908
+                     shadeMenubars,
909
+                     shadeCheckRadio;
910
+    EEffect          buttonEffect;
911
+    EScrollbar       scrollbarType;
912
+    color            customMenubarsColor,
913
+                     customSlidersColor,
914
+                     customMenuNormTextColor,
915
+                     customMenuSelTextColor,
916
+                     customCheckRadioColor;
917
+    #ifdef QTC_CONFIG_DIALOG
918
+    EShading         shading;
919
+    #endif
920
+#ifndef __cplusplus
921
+} Options;
922
+#else
923
+};
924
+#endif
925
+
926
+#if defined QTC_COMMON_FUNCTIONS && !defined QTC_CONFIG_DIALOG
927
+static EAppearance widgetApp(EWidget w, const Options *opts)
928
+{
929
+    switch(w)
930
+    {
931
+        case WIDGET_LISTVIEW_HEADER:
932
+            return opts->lvAppearance;
933
+        case WIDGET_SB_BUTTON:
934
+        case WIDGET_SLIDER:
935
+        case WIDGET_SB_SLIDER:
936
+            return opts->sliderAppearance;
937
+        case WIDGET_TAB_TOP:
938
+        case WIDGET_TAB_BOT:
939
+            return opts->tabAppearance;
940
+        case WIDGET_MENU_ITEM:
941
+            return opts->menuitemAppearance;
942
+        case WIDGET_PROGRESSBAR:
943
+            return opts->progressAppearance;
944
+        case WIDGET_SLIDER_TROUGH:
945
+            return APPEARANCE_FLAT==opts->appearance || APPEARANCE_RAISED==opts->appearance
946
+                    ? APPEARANCE_FLAT : APPEARANCE_GRADIENT;
947
+        default:
948
+            break;
949
+    }
950
+
951
+    return opts->appearance;
952
+};
953
+#endif
954
+
955
+#endif

+ 1238
- 0
common/config_file.c
File diff suppressed because it is too large
View File


+ 1238
- 0
common/config_file.c-orig
File diff suppressed because it is too large
View File


+ 7
- 0
common/mkpkg View File

@@ -0,0 +1,7 @@
1
+version=`grep "#define VERSION" config.h  | awk -F\" '{print $2}'`
2
+packageName=`grep CPACK_PACKAGE_NAME CPackSourceConfig.cmake | grep -v "Package project name" | awk -F\" '{print $2}' | sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/`
3
+maintainer=`grep $USER /etc/passwd | awk -F: '{print $5}'`
4
+
5
+checkinstall --nodoc --pkgname="$packageName" --pkgversion="$version" \
6
+             --pkgrelease="0" --exclude="/" --include=install_manifest.txt \
7
+             --pakdir="/tmp/checkinstall-$packageName" sleep 1

BIN
common/radio_frame.png View File


BIN
common/radio_light.png View File


BIN
common/radio_on.png View File


BIN
common/slider.png View File


BIN
common/slider_light.png View File


BIN
common/slider_light_v.png View File


BIN
common/slider_v.png View File


+ 1561
- 0
config.guess
File diff suppressed because it is too large
View File


+ 7
- 0
config.h.cmake View File

@@ -0,0 +1,7 @@
1
+#ifndef __CONFIG_H__
2
+#define __CONFIG_H__
3
+
4
+#define VERSION     "@QTCURVE_VERSION_FULL@"
5
+#define KDE3PREFIX  "@KDE3PREFIX@"
6
+#define KDE4PREFIX  "@KDE4PREFIX@"
7
+#endif

+ 1686
- 0
config.sub
File diff suppressed because it is too large
View File


+ 7
- 0
config/CMakeLists.txt View File

@@ -0,0 +1,7 @@
1
+set(kstyle_qtcurve_config_PART_SRCS qtcurveconfig.cpp exportthemedialog.cpp)
2
+include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/common ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR})
3
+kde3_add_ui_files(kstyle_qtcurve_config_PART_SRCS qtcurveconfigbase.ui)
4
+kde3_add_kpart(kstyle_qtcurve_config ${kstyle_qtcurve_config_PART_SRCS})
5
+kde3_automoc(${kstyle_qtcurve_config_PART_SRCS})
6
+target_link_libraries(kstyle_qtcurve_config ${KDE3_KDEUI_LIBS} ${KDE3_KIO_LIBS} ${KDE3_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
7
+install(TARGETS kstyle_qtcurve_config DESTINATION ${KDE3_LIB_DIR}/kde3)

+ 94
- 0
config/exportthemedialog.cpp View File

@@ -0,0 +1,94 @@
1
+/*
2
+  QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
3
+
4
+  ----
5
+
6
+  This program is free software; you can redistribute it and/or
7
+  modify it under the terms of the GNU General Public
8
+  License version 2 as published by the Free Software Foundation.
9
+
10
+  This program is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  General Public License for more details.
14
+
15
+  You should have received a copy of the GNU General Public License
16
+  along with this program; see the file COPYING.  If not, write to
17
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
+  Boston, MA 02110-1301, USA.
19
+*/
20
+
21
+#include "exportthemedialog.h"
22
+#include <klocale.h>
23
+#include <kurlrequester.h>
24
+#include <klineedit.h>
25
+#include <kmessagebox.h>
26
+#include <kconfig.h>
27
+#include <qdir.h>
28
+#include <qlabel.h>
29
+#include <qlayout.h>
30
+#define CONFIG_WRITE
31
+#include "config_file.c"
32
+
33
+CExportThemeDialog::CExportThemeDialog(QWidget *parent)
34
+                  : KDialogBase(parent, "ExportDialog", true, i18n("Export Theme"),
35
+                                Ok|Cancel)
36
+{
37
+    QWidget     *page = new QWidget(this);
38
+    QGridLayout *layout = new QGridLayout(page, 3, 2, 0, spacingHint());
39
+
40
+    layout->addWidget(new QLabel(i18n("Name:"), page), 0, 0);
41
+    layout->addWidget(new QLabel(i18n("Comment:"), page), 1, 0);
42
+    layout->addWidget(new QLabel(i18n("Destination folder:"), page), 2, 0);
43
+    layout->addWidget(themeName=new QLineEdit(page), 0, 1);
44
+    layout->addWidget(themeComment=new QLineEdit(i18n("QtCurve based theme"), page), 1, 1);
45
+    layout->addWidget(themeUrl=new KURLRequester(page), 2, 1);
46
+
47
+    themeUrl->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
48
+    themeUrl->lineEdit()->setReadOnly(true);
49
+    themeUrl->setURL(QDir::homeDirPath());
50
+    setMainWidget(page);
51
+}
52
+
53
+void CExportThemeDialog::run(const Options &o)
54
+{
55
+    opts=o;
56
+    exec();
57
+}
58
+
59
+void CExportThemeDialog::slotOk()
60
+{
61
+    QString name(themeName->text().stripWhiteSpace().lower());
62
+
63
+    if(name.isEmpty())
64
+        KMessageBox::error(this, i18n("Name is empty!"));
65
+    else
66
+    {
67
+        QString fileName(themeUrl->url()+"/"QTC_THEME_PREFIX+name+".themerc");
68
+
69
+        KConfig cfg(fileName, false, false);
70
+        bool    rv(!cfg.isReadOnly());
71
+
72
+        if(rv)
73
+        {
74
+            cfg.setGroup("Misc");
75
+            cfg.writeEntry("Name", themeName->text().stripWhiteSpace());
76
+            cfg.writeEntry("Comment", themeComment->text());
77
+            cfg.setGroup("KDE");
78
+            cfg.writeEntry("WidgetStyle", QTC_THEME_PREFIX+name);
79
+
80
+            rv=writeConfig(&cfg, opts, opts, true);
81
+        }
82
+
83
+        if(rv)
84
+        {
85
+            QDialog::accept();
86
+            KMessageBox::information(this, i18n("Succesfully created:\n%1").arg(fileName));
87
+        }
88
+        else
89
+            KMessageBox::error(this, i18n("Failed to create file: %1").arg(fileName));
90
+    }
91
+}
92
+
93
+#include "exportthemedialog.moc"
94
+

+ 53
- 0
config/exportthemedialog.h View File

@@ -0,0 +1,53 @@
1
+#ifndef __EXPORT_THEME_DIALOG_H__
2
+#define __EXPORT_THEME_DIALOG_H__
3
+
4
+/*
5
+  QtCurve (C) Craig Drummond, 2007 Craig.Drummond@lycos.co.uk
6
+
7
+  ----
8
+
9
+  This program is free software; you can redistribute it and/or
10
+  modify it under the terms of the GNU General Public
11
+  License version 2 as published by the Free Software Foundation.
12
+
13
+  This program is distributed in the hope that it will be useful,
14
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+  General Public License for more details.
17
+
18
+  You should have received a copy of the GNU General Public License
19
+  along with this program; see the file COPYING.  If not, write to
20
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
+  Boston, MA 02110-1301, USA.
22
+*/
23
+
24
+#include <kdialogbase.h>
25
+#define QTC_CONFIG_DIALOG
26
+#include "common.h"
27
+
28
+class KURLRequester;
29
+class QLineEdit;
30
+
31
+class CExportThemeDialog : public KDialogBase
32
+{
33
+    Q_OBJECT
34
+
35
+    public:
36
+
37
+    CExportThemeDialog(QWidget *parent);
38
+
39
+    void run(const Options &o);
40
+
41
+    private slots:
42
+
43
+    void slotOk();
44
+
45
+    private:
46
+
47
+    QLineEdit     *themeName,
48
+                  *themeComment;
49
+    KURLRequester *themeUrl;
50
+    Options       opts;
51
+};
52
+
53
+#endif

+ 720
- 0
config/qtcurveconfig.cpp View File

@@ -0,0 +1,720 @@
1
+/*
2
+  QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
3
+
4
+  ----
5
+
6
+  This program is free software; you can redistribute it and/or
7
+  modify it under the terms of the GNU General Public
8
+  License version 2 as published by the Free Software Foundation.
9
+
10
+  This program is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  General Public License for more details.
14
+
15
+  You should have received a copy of the GNU General Public License
16
+  along with this program; see the file COPYING.  If not, write to
17
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
+  Boston, MA 02110-1301, USA.
19
+*/
20
+
21
+#include "qtcurveconfig.h"
22
+#include "exportthemedialog.h"
23
+#include <qcheckbox.h>
24
+#include <qcombobox.h>
25
+#include <qgroupbox.h>
26
+#include <qradiobutton.h>
27
+#include <qlabel.h>
28
+#include <qlayout.h>
29
+#include <qframe.h>
30
+#include <qtabwidget.h>
31
+#include <qpopupmenu.h>
32
+#include <qfileinfo.h>
33
+#include <klocale.h>
34
+#include <kcolorbutton.h>
35
+#include <kconfig.h>
36
+#include <kfiledialog.h>
37
+#include <kmessagebox.h>
38
+#include <kpushbutton.h>
39
+#include <kcharselect.h>
40
+#include <kdialogbase.h>
41
+#include <knuminput.h>
42
+#include <unistd.h>
43
+#include "config.h"
44
+#define CONFIG_READ
45
+#define CONFIG_WRITE
46
+#include "config_file.c"
47
+
48
+#define QTC_EXTENSION ".qtcurve"
49
+
50
+extern "C"
51
+{
52
+    QWidget * allocate_kstyle_config(QWidget *parent)
53
+    {
54
+        KGlobal::locale()->insertCatalogue("kstyle_qtcurve_config");
55
+        return new QtCurveConfig(parent);
56
+    }
57
+}
58
+
59
+class CharSelectDialog : public KDialogBase
60
+{
61
+    public:
62
+
63
+    CharSelectDialog(QWidget *parent, int v)
64
+        : KDialogBase(Plain, i18n("Select Password Character"), Ok|Cancel, Cancel, parent)
65
+    {
66
+        QFrame *page=plainPage();
67
+
68
+        QVBoxLayout *layout=new QVBoxLayout(page, 0, KDialog::spacingHint());
69
+
70
+        itsSelector=new KCharSelect(page, 0L);
71
+        itsSelector->setChar(QChar(v));
72
+        layout->addWidget(itsSelector);
73
+    }
74
+
75
+    int currentChar() const { return itsSelector->chr().unicode(); }
76
+
77
+    private:
78
+
79
+    KCharSelect *itsSelector;
80
+};
81
+
82
+static int toInt(const QString &str)
83
+{
84
+    return str.length()>1 ? str[0].unicode() : 0;
85
+}
86
+
87
+static void insertShadeEntries(QComboBox *combo, bool withDarken, bool checkRadio=false)
88
+{
89
+    combo->insertItem(checkRadio ? i18n("Text")
90
+                                 : withDarken ? i18n("Background")
91
+                                              : i18n("Button"));
92
+    combo->insertItem(i18n("Custom:"));
93
+
94
+    if(checkRadio) // For check/radio, we dont blend, and dont allow darken
95
+        combo->insertItem(i18n("Selected background"));
96
+    else if(withDarken)
97
+    {
98
+         // For menubars we dont actually blend...
99
+        combo->insertItem(i18n("Selected background"));
100
+        combo->insertItem(i18n("Darken"));
101
+    }
102
+    else
103
+    {
104
+        combo->insertItem(i18n("Blended selected background"));
105
+        combo->insertItem(i18n("Selected background"));
106
+    }
107
+}
108
+
109
+static void insertAppearanceEntries(QComboBox *combo, bool all=true)
110
+{
111
+    combo->insertItem(i18n("Flat"));
112
+    combo->insertItem(i18n("Raised"));
113
+    combo->insertItem(i18n("Dull glass"));
114
+    combo->insertItem(i18n("Shiny glass"));
115
+    combo->insertItem(i18n("Gradient"));
116
+    combo->insertItem(i18n("Inverted gradient"));
117
+    if(all)
118
+    {
119
+        combo->insertItem(i18n("Split gradient"));
120
+        combo->insertItem(i18n("Bevelled"));
121
+    }
122
+}
123
+
124
+static void insertLineEntries(QComboBox *combo, bool none)
125
+{
126
+    combo->insertItem(i18n("Sunken lines"));
127
+    combo->insertItem(i18n("Flat lines"));
128
+    combo->insertItem(i18n("Dots"));
129
+    combo->insertItem(none ? i18n("None") : i18n("Dashes"));
130
+}
131
+
132
+static void insertDefBtnEntries(QComboBox *combo)
133
+{
134
+    combo->insertItem(i18n("Corner indicator"));
135
+    combo->insertItem(i18n("Font color thin border"));
136
+    combo->insertItem(i18n("Selected background thick border"));
137
+    combo->insertItem(i18n("None"));
138
+}
139
+
140
+static void insertScrollbarEntries(QComboBox *combo)
141
+{
142
+    combo->insertItem(i18n("KDE"));
143
+    combo->insertItem(i18n("Windows"));
144
+    combo->insertItem(i18n("Platinum"));
145
+    combo->insertItem(i18n("Next"));
146
+    combo->insertItem(i18n("No buttons"));
147
+}
148
+
149
+static void insertRoundEntries(QComboBox *combo)
150
+{
151
+    combo->insertItem(i18n("Square"));
152
+    combo->insertItem(i18n("Slightly rounded"));
153
+    combo->insertItem(i18n("Fully rounded"));
154
+}
155
+
156
+static void insertMouseOverEntries(QComboBox *combo)
157
+{
158
+    combo->insertItem(i18n("No coloration"));
159
+    combo->insertItem(i18n("Color border"));
160
+    combo->insertItem(i18n("Plastik style"));
161
+}
162
+
163
+static void insertToolbarBorderEntries(QComboBox *combo)
164
+{
165
+    combo->insertItem(i18n("None"));
166
+    combo->insertItem(i18n("Light"));
167
+    combo->insertItem(i18n("Dark"));
168
+    combo->insertItem(i18n("Light (all sides)"));
169
+    combo->insertItem(i18n("Dark (all sides)"));
170
+}
171
+
172
+static void insertEffectEntries(QComboBox *combo)
173
+{
174
+    combo->insertItem(i18n("Plain"));
175
+    combo->insertItem(i18n("Etched"));
176
+    combo->insertItem(i18n("Shadowed"));
177
+}
178
+
179
+static void insertShadingEntries(QComboBox *combo)
180
+{
181
+    combo->insertItem(i18n("Simple"));
182
+    combo->insertItem(i18n("Use HSL color space"));
183
+    combo->insertItem(i18n("Use HSV color space"));
184
+}
185
+
186
+static void insertStripeEntries(QComboBox *combo)
187
+{
188
+    combo->insertItem(i18n("Plain"));
189
+    combo->insertItem(i18n("Striped"));
190
+    combo->insertItem(i18n("Diagonal stripes"));
191
+}
192
+
193
+static void insertSliderStyleEntries(QComboBox *combo)
194
+{
195
+    combo->insertItem(i18n("Plain"));
196
+    combo->insertItem(i18n("Round"));
197
+    combo->insertItem(i18n("Triangular"));
198
+}
199
+
200
+QtCurveConfig::QtCurveConfig(QWidget *parent)
201
+             : QtCurveConfigBase(parent),
202
+               exportDialog(NULL)
203
+{
204
+    titleLabel->setText("QtCurve " VERSION " - (C) Craig Drummond, 2003-2007");
205
+    insertShadeEntries(shadeSliders, false);
206
+    insertShadeEntries(shadeMenubars, true);
207
+    insertShadeEntries(shadeCheckRadio, false, true);
208
+    insertAppearanceEntries(appearance);
209
+    insertAppearanceEntries(menubarAppearance);
210
+    insertAppearanceEntries(toolbarAppearance);
211
+    insertAppearanceEntries(lvAppearance);
212
+    insertAppearanceEntries(sliderAppearance);
213
+    insertAppearanceEntries(tabAppearance, false);
214
+    insertAppearanceEntries(progressAppearance);
215
+    insertAppearanceEntries(menuitemAppearance);
216
+    insertLineEntries(handles, false);
217
+    insertLineEntries(sliderThumbs, true);
218
+    insertLineEntries(toolbarSeparators, true);
219
+    insertLineEntries(splitters, false);
220
+    insertDefBtnEntries(defBtnIndicator);
221
+    insertScrollbarEntries(scrollbarType);
222
+    insertRoundEntries(round);
223
+    insertMouseOverEntries(coloredMouseOver);
224
+    insertToolbarBorderEntries(toolbarBorders);
225
+    insertEffectEntries(buttonEffect);
226
+    insertShadingEntries(shading);
227
+    insertStripeEntries(stripedProgress);
228
+    insertSliderStyleEntries(sliderStyle);
229
+
230
+    highlightFactor->setMinValue(MIN_HIGHLIGHT_FACTOR);
231
+    highlightFactor->setMaxValue(MAX_HIGHLIGHT_FACTOR);
232
+    highlightFactor->setValue(((int)(DEFAULT_HIGHLIGHT_FACTOR*100))-100);
233
+
234
+    connect(lighterPopupMenuBgnd, SIGNAL(toggled(bool)), SLOT(updateChanged()));
235
+    connect(round, SIGNAL(activated(int)), SLOT(updateChanged()));
236
+    connect(toolbarBorders, SIGNAL(activated(int)), SLOT(updateChanged()));
237
+    connect(sliderThumbs, SIGNAL(activated(int)), SLOT(updateChanged()));
238
+    connect(handles, SIGNAL(activated(int)), SLOT(updateChanged()));
239
+    connect(appearance, SIGNAL(activated(int)), SLOT(updateChanged()));
240
+    connect(customMenuTextColor, SIGNAL(toggled(bool)), SLOT(customMenuTextColorChanged()));
241
+    connect(stripedProgress, SIGNAL(activated(int)), SLOT(stripedProgressChanged()));
242
+    connect(animatedProgress, SIGNAL(toggled(bool)), SLOT(updateChanged()));
243
+    connect(embolden, SIGNAL(toggled(bool)), SLOT(emboldenToggled()));
244
+    connect(defBtnIndicator, SIGNAL(activated(int)), SLOT(dbiChanged()));
245
+    connect(highlightTab, SIGNAL(toggled(bool)), SLOT(updateChanged()));
246
+    connect(menubarAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
247
+    connect(toolbarAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
248
+    connect(lvAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
249
+    connect(sliderAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
250
+    connect(tabAppearance, SIGNAL(activated(int)), SLOT(tabAppearanceChanged()));
251
+    connect(toolbarSeparators, SIGNAL(activated(int)), SLOT(updateChanged()));
252
+    connect(splitters, SIGNAL(activated(int)), SLOT(updateChanged()));
253
+    connect(fixParentlessDialogs, SIGNAL(toggled(bool)), SLOT(updateChanged()));
254
+    connect(fillSlider, SIGNAL(toggled(bool)), SLOT(updateChanged()));
255
+    connect(sliderStyle, SIGNAL(activated(int)), SLOT(updateChanged()));
256
+    connect(roundMbTopOnly, SIGNAL(toggled(bool)), SLOT(updateChanged()));
257
+    connect(gradientPbGroove, SIGNAL(toggled(bool)), SLOT(updateChanged()));
258
+    connect(darkerBorders, SIGNAL(toggled(bool)), SLOT(updateChanged()));
259
+    connect(vArrows, SIGNAL(toggled(bool)), SLOT(updateChanged()));
260
+    connect(xCheck, SIGNAL(toggled(bool)), SLOT(updateChanged()));
261
+    connect(colorSelTab, SIGNAL(toggled(bool)), SLOT(updateChanged()));
262
+    connect(stdSidebarButtons, SIGNAL(toggled(bool)), SLOT(updateChanged()));
263
+    connect(borderMenuitems, SIGNAL(toggled(bool)), SLOT(updateChanged()));
264
+    connect(progressAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
265
+    connect(menuitemAppearance, SIGNAL(activated(int)), SLOT(updateChanged()));
266
+    connect(shadeCheckRadio, SIGNAL(activated(int)), SLOT(shadeCheckRadioChanged()));
267
+    connect(customCheckRadioColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged()));
268
+
269
+#ifdef QTC_PLAIN_FOCUS_ONLY
270
+    delete stdFocus;
271
+#else
272
+    connect(stdFocus, SIGNAL(toggled(bool)), SLOT(updateChanged()));
273
+#endif
274
+    connect(lvLines, SIGNAL(toggled(bool)), SLOT(updateChanged()));
275
+    connect(drawStatusBarFrames, SIGNAL(toggled(bool)), SLOT(updateChanged()));
276
+    connect(buttonEffect, SIGNAL(activated(int)), SLOT(updateChanged()));
277
+    connect(coloredMouseOver, SIGNAL(activated(int)), SLOT(updateChanged()));
278
+    connect(menubarMouseOver, SIGNAL(toggled(bool)), SLOT(updateChanged()));
279
+    connect(shadeMenubarOnlyWhenActive, SIGNAL(toggled(bool)), SLOT(updateChanged()));
280
+    connect(thinnerMenuItems, SIGNAL(toggled(bool)), SLOT(updateChanged()));
281
+    connect(customSlidersColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged()));
282
+    connect(customMenubarsColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged()));
283
+    connect(customMenuSelTextColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged()));
284
+    connect(customMenuNormTextColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged()));
285
+    connect(shadeSliders, SIGNAL(activated(int)), SLOT(shadeSlidersChanged()));
286
+    connect(shadeMenubars, SIGNAL(activated(int)), SLOT(shadeMenubarsChanged()));
287
+    connect(highlightFactor, SIGNAL(valueChanged(int)), SLOT(updateChanged()));
288
+    connect(scrollbarType, SIGNAL(activated(int)), SLOT(updateChanged()));
289
+    connect(shading, SIGNAL(activated(int)), SLOT(updateChanged()));
290
+    connect(gtkScrollViews, SIGNAL(toggled(bool)), SLOT(updateChanged()));
291
+    connect(gtkComboMenus, SIGNAL(toggled(bool)), SLOT(updateChanged()));
292
+    connect(gtkButtonOrder, SIGNAL(toggled(bool)), SLOT(updateChanged()));
293
+    connect(mapKdeIcons, SIGNAL(toggled(bool)), SLOT(updateChanged()));
294
+    connect(passwordChar, SIGNAL(clicked()), SLOT(passwordCharClicked()));
295
+    connect(framelessGroupBoxes, SIGNAL(toggled(bool)), SLOT(updateChanged()));
296
+    connect(inactiveHighlight, SIGNAL(toggled(bool)), SLOT(updateChanged()));
297
+
298
+    defaultSettings(&defaultStyle);
299
+    if(!readConfig(NULL, &currentStyle, &defaultStyle))
300
+        currentStyle=defaultStyle;
301
+
302
+    setWidgetOptions(currentStyle);
303
+
304
+    QPopupMenu *menu=new QPopupMenu(this),
305
+               *subMenu=new QPopupMenu(this);
306
+
307
+    optionBtn->setPopup(menu);
308
+
309
+    menu->insertItem(i18n("Predefined Style"), subMenu);
310
+    menu->insertSeparator();
311
+    menu->insertItem(i18n("Import..."), this, SLOT(importStyle()));
312
+    menu->insertItem(i18n("Export..."), this, SLOT(exportStyle()));
313
+    menu->insertSeparator();
314
+    menu->insertItem(i18n("Export Theme..."), this, SLOT(exportTheme()));
315
+
316
+    loadStyles(subMenu);
317
+}
318
+
319
+QtCurveConfig::~QtCurveConfig()
320
+{
321
+}
322
+
323
+void QtCurveConfig::loadStyles(QPopupMenu *menu)
324
+{
325
+    QStringList  files(KGlobal::dirs()->findAllResources("data", "QtCurve/*"QTC_EXTENSION, false, true));
326
+
327
+    files.sort();
328
+
329
+    QStringList::Iterator it(files.begin()),
330
+                          end(files.end());
331
+    Options               opts;
332
+
333
+    for(; it!=end; ++it)
334
+        if(readConfig(*it, &opts, &defaultStyle))
335
+            styles[menu->insertItem(QFileInfo(*it).fileName().remove(QTC_EXTENSION).replace('_', ' '),
336
+                                    this, SLOT(setStyle(int)))]=*it;
337
+}
338
+
339
+void QtCurveConfig::save()
340
+{
341
+    Options opts=currentStyle;
342
+
343
+    setOptions(opts);
344
+    writeConfig(NULL, opts, defaultStyle);
345
+
346
+    KSharedConfig *cfg=KGlobal::sharedConfig();
347
+    QString       grp(cfg->group());
348
+    bool          useGlobals(cfg->forceGlobal());
349
+
350
+    cfg->setForceGlobal(true);
351
+    cfg->setGroup("KDE");
352
+
353
+    if(opts.gtkButtonOrder)
354
+        cfg->writeEntry("ButtonLayout", 2);
355
+    else
356
+        cfg->deleteEntry("ButtonLayout");
357
+    cfg->setGroup(grp);
358
+    cfg->sync();
359
+    cfg->setForceGlobal(useGlobals);
360
+}
361
+
362
+void QtCurveConfig::defaults()
363
+{
364
+    setWidgetOptions(defaultStyle);
365
+    if (settingsChanged())
366
+        emit changed(true);
367
+}
368
+
369
+void QtCurveConfig::setStyle(int s)
370
+{
371
+    loadStyle(styles[s]);
372
+}
373
+
374
+void QtCurveConfig::emboldenToggled()
375
+{
376
+    if(!embolden->isChecked() && IND_NONE==defBtnIndicator->currentItem())
377
+        defBtnIndicator->setCurrentItem(IND_COLORED);
378
+    updateChanged();
379
+}
380
+
381
+void QtCurveConfig::dbiChanged()
382
+{
383
+    if(IND_NONE==defBtnIndicator->currentItem() && !embolden->isChecked())
384
+        embolden->setChecked(true);
385
+    updateChanged();
386
+}
387
+
388
+void QtCurveConfig::shadeSlidersChanged()
389
+{
390
+    customSlidersColor->setEnabled(SHADE_CUSTOM==shadeSliders->currentItem());
391
+    updateChanged();
392
+}
393
+
394
+void QtCurveConfig::shadeMenubarsChanged()
395
+{
396
+    customMenubarsColor->setEnabled(SHADE_CUSTOM==shadeMenubars->currentItem());
397
+    updateChanged();
398
+}
399
+
400
+void QtCurveConfig::shadeCheckRadioChanged()
401
+{
402
+    customCheckRadioColor->setEnabled(SHADE_CUSTOM==shadeCheckRadio->currentItem());
403
+    updateChanged();
404
+}
405
+
406
+void QtCurveConfig::customMenuTextColorChanged()
407
+{
408
+    customMenuNormTextColor->setEnabled(customMenuTextColor->isChecked());
409
+    customMenuSelTextColor->setEnabled(customMenuTextColor->isChecked());
410
+    updateChanged();
411
+}
412
+
413
+void QtCurveConfig::stripedProgressChanged()
414
+{
415
+    animatedProgress->setEnabled(STRIPE_NONE!=stripedProgress->currentItem());
416
+    if(animatedProgress->isChecked() && STRIPE_NONE==stripedProgress->currentItem())
417
+        animatedProgress->setChecked(false);
418
+    updateChanged();
419
+}
420
+
421
+void QtCurveConfig::tabAppearanceChanged()
422
+{
423
+    if(colorSelTab->isChecked() && APPEARANCE_GRADIENT!=tabAppearance->currentItem())
424
+        colorSelTab->setChecked(false);
425
+    colorSelTab->setEnabled(APPEARANCE_GRADIENT==tabAppearance->currentItem());
426
+    updateChanged();
427
+}
428
+
429
+void QtCurveConfig::passwordCharClicked()
430
+{
431
+    int              cur(toInt(passwordChar->text()));
432
+    CharSelectDialog dlg(this, cur);
433
+
434
+    if(QDialog::Accepted==dlg.exec() && dlg.currentChar()!=cur)
435
+        setPasswordChar(dlg.currentChar());
436
+}
437
+
438
+void QtCurveConfig::setPasswordChar(int ch)
439
+{
440
+    QString      str;
441
+    QTextOStream s(&str);
442
+
443
+    s.setf(QTextStream::hex);
444
+    s << QChar(ch) << " (" << ch << ')';
445
+    passwordChar->setText(str);
446
+}
447
+
448
+void QtCurveConfig::updateChanged()
449
+{
450
+    if (settingsChanged())
451
+        emit changed(true);
452
+}
453
+
454
+void QtCurveConfig::importStyle()
455
+{
456
+    QString file(KFileDialog::getOpenFileName(QString::null,
457
+                                              i18n("*"QTC_EXTENSION"|QtCurve Settings Files\n"
458
+                                                   QTC_THEME_PREFIX"*"QTC_THEME_SUFFIX"|QtCurve KDE Theme Files"),
459
+                                              this));
460
+
461
+    if(!file.isEmpty())
462
+        loadStyle(file);
463
+}
464
+
465
+void QtCurveConfig::exportStyle()
466
+{
467
+    QString file(KFileDialog::getSaveFileName(QString::null, i18n("*"QTC_EXTENSION"|QtCurve Settings Files"), this));
468
+
469
+    if(!file.isEmpty())
470
+    {
471
+        KConfig cfg(file, false, false);
472
+        bool    rv(!cfg.isReadOnly());
473
+
474
+        if(rv)
475
+        {
476
+            Options opts;
477
+
478
+            setOptions(opts);
479
+            rv=writeConfig(&cfg, opts, defaultStyle, true);
480
+        }
481
+
482
+        if(!rv)
483
+            KMessageBox::error(this, i18n("Could not write to file:\n%1").arg(file));
484
+    }
485
+}
486
+
487
+void QtCurveConfig::exportTheme()
488
+{
489
+    if(!exportDialog)
490
+        exportDialog=new CExportThemeDialog(this);
491
+
492
+    Options opts;
493
+
494
+    setOptions(opts);
495
+    exportDialog->run(opts);
496
+}
497
+
498
+void QtCurveConfig::loadStyle(const QString &file)
499
+{
500
+    Options opts;
501
+
502
+    if(readConfig(file, &opts, &defaultStyle))
503
+    {
504
+        setWidgetOptions(opts);
505
+        if (settingsChanged())
506
+            emit changed(true);
507
+    }
508
+}
509
+
510
+void QtCurveConfig::setOptions(Options &opts)
511
+{
512
+    opts.round=(ERound)round->currentItem();
513
+    opts.toolbarBorders=(ETBarBorder)toolbarBorders->currentItem();
514
+    opts.appearance=(EAppearance)appearance->currentItem();
515
+#ifndef QTC_PLAIN_FOCUS_ONLY
516
+    opts.stdFocus=stdFocus->isChecked();
517
+#endif
518
+    opts.lvLines=lvLines->isChecked();
519
+    opts.drawStatusBarFrames=drawStatusBarFrames->isChecked();
520
+    opts.buttonEffect=(EEffect)buttonEffect->currentItem();
521
+    opts.coloredMouseOver=(EMouseOver)coloredMouseOver->currentItem();
522
+    opts.menubarMouseOver=menubarMouseOver->isChecked();
523
+    opts.shadeMenubarOnlyWhenActive=shadeMenubarOnlyWhenActive->isChecked();
524
+    opts.thinnerMenuItems=thinnerMenuItems->isChecked();
525
+    opts.fixParentlessDialogs=fixParentlessDialogs->isChecked();
526
+    opts.animatedProgress=animatedProgress->isChecked();
527
+    opts.stripedProgress=(EStripe)stripedProgress->currentItem();
528
+    opts.lighterPopupMenuBgnd=lighterPopupMenuBgnd->isChecked();
529
+    opts.embolden=embolden->isChecked();
530
+    opts.scrollbarType=(EScrollbar)scrollbarType->currentItem();
531
+    opts.defBtnIndicator=(EDefBtnIndicator)defBtnIndicator->currentItem();
532
+    opts.sliderThumbs=(ELine)sliderThumbs->currentItem();
533
+    opts.handles=(ELine)handles->currentItem();
534
+    opts.highlightTab=highlightTab->isChecked();
535
+    opts.shadeSliders=(EShade)shadeSliders->currentItem();
536
+    opts.shadeMenubars=(EShade)shadeMenubars->currentItem();
537
+    opts.menubarAppearance=(EAppearance)menubarAppearance->currentItem();
538
+    opts.toolbarAppearance=(EAppearance)toolbarAppearance->currentItem();
539
+    opts.lvAppearance=(EAppearance)lvAppearance->currentItem();
540
+    opts.sliderAppearance=(EAppearance)sliderAppearance->currentItem();
541
+    opts.tabAppearance=(EAppearance)tabAppearance->currentItem();
542
+    opts.toolbarSeparators=(ELine)toolbarSeparators->currentItem();
543
+    opts.splitters=(ELine)splitters->currentItem();
544
+    opts.customSlidersColor=customSlidersColor->color();
545
+    opts.customMenubarsColor=customMenubarsColor->color();
546
+    opts.highlightFactor=((double)(highlightFactor->value()+100))/100.0;
547
+    opts.customMenuNormTextColor=customMenuNormTextColor->color();
548
+    opts.customMenuSelTextColor=customMenuSelTextColor->color();
549
+    opts.customMenuTextColor=customMenuTextColor->isChecked();
550
+    opts.fillSlider=fillSlider->isChecked();
551
+    opts.sliderStyle=(ESliderStyle)sliderStyle->currentItem();
552
+    opts.roundMbTopOnly=roundMbTopOnly->isChecked();
553
+    opts.gradientPbGroove=gradientPbGroove->isChecked();
554
+    opts.darkerBorders=darkerBorders->isChecked();
555
+    opts.vArrows=vArrows->isChecked();
556
+    opts.xCheck=xCheck->isChecked();
557
+    opts.colorSelTab=colorSelTab->isChecked();
558
+    opts.stdSidebarButtons=stdSidebarButtons->isChecked();
559
+    opts.borderMenuitems=borderMenuitems->isChecked();
560
+    opts.progressAppearance=(EAppearance)progressAppearance->currentItem();
561
+    opts.menuitemAppearance=(EAppearance)menuitemAppearance->currentItem();
562
+    opts.shadeCheckRadio=(EShade)shadeCheckRadio->currentItem();
563
+    opts.customCheckRadioColor=customCheckRadioColor->color();
564
+    opts.shading=(EShading)shading->currentItem();
565
+    opts.gtkScrollViews=gtkScrollViews->isChecked();
566
+    opts.gtkComboMenus=gtkComboMenus->isChecked();
567
+    opts.gtkButtonOrder=gtkButtonOrder->isChecked();
568
+    opts.mapKdeIcons=mapKdeIcons->isChecked();
569
+    opts.passwordChar=toInt(passwordChar->text());
570
+    opts.framelessGroupBoxes=framelessGroupBoxes->isChecked();
571
+    opts.inactiveHighlight=inactiveHighlight->isChecked();
572
+}
573
+
574
+void QtCurveConfig::setWidgetOptions(const Options &opts)
575
+{
576
+    round->setCurrentItem(opts.round);
577
+    scrollbarType->setCurrentItem(opts.scrollbarType);
578
+    lighterPopupMenuBgnd->setChecked(opts.lighterPopupMenuBgnd);
579
+    toolbarBorders->setCurrentItem(opts.toolbarBorders);
580
+    sliderThumbs->setCurrentItem(opts.sliderThumbs);
581
+    handles->setCurrentItem(opts.handles);
582
+    appearance->setCurrentItem(opts.appearance);
583
+#ifndef QTC_PLAIN_FOCUS_ONLY
584
+    stdFocus->setChecked(opts.stdFocus);
585
+#endif
586
+    lvLines->setChecked(opts.lvLines);
587
+    drawStatusBarFrames->setChecked(opts.drawStatusBarFrames);
588
+    buttonEffect->setCurrentItem(opts.buttonEffect);
589
+    coloredMouseOver->setCurrentItem(opts.coloredMouseOver);
590
+    menubarMouseOver->setChecked(opts.menubarMouseOver);
591
+    shadeMenubarOnlyWhenActive->setChecked(opts.shadeMenubarOnlyWhenActive);
592
+    thinnerMenuItems->setChecked(opts.thinnerMenuItems);
593
+    fixParentlessDialogs->setChecked(opts.fixParentlessDialogs);
594
+    animatedProgress->setChecked(opts.animatedProgress);
595
+    stripedProgress->setCurrentItem(opts.stripedProgress);
596
+    embolden->setChecked(opts.embolden);
597
+    defBtnIndicator->setCurrentItem(opts.defBtnIndicator);
598
+    highlightTab->setChecked(opts.highlightTab);
599
+    menubarAppearance->setCurrentItem(opts.menubarAppearance);
600
+    toolbarAppearance->setCurrentItem(opts.toolbarAppearance);
601
+    lvAppearance->setCurrentItem(opts.lvAppearance);
602
+    sliderAppearance->setCurrentItem(opts.sliderAppearance);
603
+    tabAppearance->setCurrentItem(opts.tabAppearance);
604
+    toolbarSeparators->setCurrentItem(opts.toolbarSeparators);
605
+    splitters->setCurrentItem(opts.splitters);
606
+    shadeSliders->setCurrentItem(opts.shadeSliders);
607
+    shadeMenubars->setCurrentItem(opts.shadeMenubars);
608
+    highlightFactor->setValue((int)(opts.highlightFactor*100)-100);
609
+    customSlidersColor->setColor(opts.customSlidersColor);
610
+    customMenubarsColor->setColor(opts.customMenubarsColor);
611
+    customMenuNormTextColor->setColor(opts.customMenuNormTextColor);
612
+    customMenuSelTextColor->setColor(opts.customMenuSelTextColor);
613
+    customMenuTextColor->setChecked(opts.customMenuTextColor);
614
+
615
+    customSlidersColor->setEnabled(SHADE_CUSTOM==opts.shadeSliders);
616
+    customMenubarsColor->setEnabled(SHADE_CUSTOM==opts.shadeMenubars);
617
+    customMenuNormTextColor->setEnabled(customMenuTextColor->isChecked());
618
+    customMenuSelTextColor->setEnabled(customMenuTextColor->isChecked());
619
+    customCheckRadioColor->setEnabled(SHADE_CUSTOM==opts.shadeCheckRadio);
620
+
621
+    animatedProgress->setEnabled(STRIPE_NONE!=stripedProgress->currentItem());
622
+
623
+    fillSlider->setChecked(opts.fillSlider);
624
+    sliderStyle->setCurrentItem(opts.sliderStyle);
625
+    roundMbTopOnly->setChecked(opts.roundMbTopOnly);
626
+    gradientPbGroove->setChecked(opts.gradientPbGroove);
627
+    darkerBorders->setChecked(opts.darkerBorders);
628
+    vArrows->setChecked(opts.vArrows);
629
+    xCheck->setChecked(opts.xCheck);
630
+    colorSelTab->setChecked(opts.colorSelTab);
631
+    stdSidebarButtons->setChecked(opts.stdSidebarButtons);
632
+    borderMenuitems->setChecked(opts.borderMenuitems);
633
+    progressAppearance->setCurrentItem(opts.progressAppearance);
634
+    menuitemAppearance->setCurrentItem(opts.menuitemAppearance);
635
+    shadeCheckRadio->setCurrentItem(opts.shadeCheckRadio);
636
+    customCheckRadioColor->setColor(opts.customCheckRadioColor);
637
+
638
+    shading->setCurrentItem(opts.shading);
639
+    gtkScrollViews->setChecked(opts.gtkScrollViews);
640
+    gtkComboMenus->setChecked(opts.gtkComboMenus);
641
+    gtkButtonOrder->setChecked(opts.gtkButtonOrder);
642
+    mapKdeIcons->setChecked(opts.mapKdeIcons);
643
+    setPasswordChar(opts.passwordChar);
644
+    framelessGroupBoxes->setChecked(opts.framelessGroupBoxes);
645
+    inactiveHighlight->setChecked(opts.inactiveHighlight);
646
+}
647
+
648
+bool QtCurveConfig::settingsChanged()
649
+{
650
+    return round->currentItem()!=currentStyle.round ||
651
+         toolbarBorders->currentItem()!=currentStyle.toolbarBorders ||
652
+         appearance->currentItem()!=(int)currentStyle.appearance ||
653
+#ifndef QTC_PLAIN_FOCUS_ONLY
654
+         stdFocus->isChecked()!=currentStyle.stdFocus ||
655
+#endif
656
+         lvLines->isChecked()!=currentStyle.lvLines ||
657
+         drawStatusBarFrames->isChecked()!=currentStyle.drawStatusBarFrames ||
658
+         buttonEffect->currentItem()!=(int)currentStyle.buttonEffect ||
659
+         coloredMouseOver->currentItem()!=(int)currentStyle.coloredMouseOver ||
660
+         menubarMouseOver->isChecked()!=currentStyle.menubarMouseOver ||
661
+         shadeMenubarOnlyWhenActive->isChecked()!=currentStyle.shadeMenubarOnlyWhenActive ||
662
+         thinnerMenuItems->isChecked()!=currentStyle.thinnerMenuItems ||
663
+         fixParentlessDialogs->isChecked()!=currentStyle.fixParentlessDialogs ||
664
+         animatedProgress->isChecked()!=currentStyle.animatedProgress ||
665
+         stripedProgress->currentItem()!=currentStyle.stripedProgress ||
666
+         lighterPopupMenuBgnd->isChecked()!=currentStyle.lighterPopupMenuBgnd ||
667
+         embolden->isChecked()!=currentStyle.embolden ||
668
+         fillSlider->isChecked()!=currentStyle.fillSlider ||
669
+         sliderStyle->currentItem()!=currentStyle.sliderStyle ||
670
+         roundMbTopOnly->isChecked()!=currentStyle.roundMbTopOnly ||
671
+         gradientPbGroove->isChecked()!=currentStyle.gradientPbGroove ||
672
+         darkerBorders->isChecked()!=currentStyle.darkerBorders ||
673
+         vArrows->isChecked()!=currentStyle.vArrows ||
674
+         xCheck->isChecked()!=currentStyle.xCheck ||
675
+         colorSelTab->isChecked()!=currentStyle.colorSelTab ||
676
+         stdSidebarButtons->isChecked()!=currentStyle.stdSidebarButtons ||
677
+         borderMenuitems->isChecked()!=currentStyle.borderMenuitems ||
678
+         defBtnIndicator->currentItem()!=(int)currentStyle.defBtnIndicator ||
679
+         sliderThumbs->currentItem()!=(int)currentStyle.sliderThumbs ||
680
+         handles->currentItem()!=(int)currentStyle.handles ||
681
+         scrollbarType->currentItem()!=(int)currentStyle.scrollbarType ||
682
+         highlightTab->isChecked()!=currentStyle.highlightTab ||
683
+         shadeSliders->currentItem()!=(int)currentStyle.shadeSliders ||
684
+         shadeMenubars->currentItem()!=(int)currentStyle.shadeMenubars ||
685
+         shadeCheckRadio->currentItem()!=(int)currentStyle.shadeCheckRadio ||
686
+         menubarAppearance->currentItem()!=currentStyle.menubarAppearance ||
687
+         toolbarAppearance->currentItem()!=currentStyle.toolbarAppearance ||
688
+         lvAppearance->currentItem()!=currentStyle.lvAppearance ||
689
+         sliderAppearance->currentItem()!=currentStyle.sliderAppearance ||
690
+         tabAppearance->currentItem()!=currentStyle.tabAppearance ||
691
+         progressAppearance->currentItem()!=currentStyle.progressAppearance ||
692
+         menuitemAppearance->currentItem()!=currentStyle.menuitemAppearance ||
693
+         toolbarSeparators->currentItem()!=currentStyle.toolbarSeparators ||
694
+         splitters->currentItem()!=currentStyle.splitters ||
695
+
696
+         shading->currentItem()!=(int)currentStyle.shading ||
697
+         gtkScrollViews->isChecked()!=currentStyle.gtkScrollViews ||
698
+         gtkComboMenus->isChecked()!=currentStyle.gtkComboMenus ||
699
+         gtkButtonOrder->isChecked()!=currentStyle.gtkButtonOrder ||
700
+         mapKdeIcons->isChecked()!=currentStyle.mapKdeIcons ||
701
+         framelessGroupBoxes->isChecked()!=currentStyle.framelessGroupBoxes ||
702
+         inactiveHighlight->isChecked()!=currentStyle.inactiveHighlight ||
703
+
704
+         toInt(passwordChar->text())!=currentStyle.passwordChar ||
705
+
706
+         (highlightFactor->value()+100)!=(int)(currentStyle.highlightFactor*100) ||
707
+         customMenuTextColor->isChecked()!=currentStyle.customMenuTextColor ||
708
+         (SHADE_CUSTOM==currentStyle.shadeSliders &&
709
+               customSlidersColor->color()!=currentStyle.customSlidersColor) ||
710
+         (SHADE_CUSTOM==currentStyle.shadeMenubars &&
711
+               customMenubarsColor->color()!=currentStyle.customMenubarsColor) ||
712
+         (SHADE_CUSTOM==currentStyle.shadeCheckRadio &&
713
+               customCheckRadioColor->color()!=currentStyle.customCheckRadioColor) ||
714
+         (customMenuTextColor->isChecked() &&
715
+               customMenuNormTextColor->color()!=currentStyle.customMenuNormTextColor) ||
716
+         (customMenuTextColor->isChecked() &&
717
+               customMenuSelTextColor->color()!=currentStyle.customMenuSelTextColor);
718
+}
719
+
720
+#include "qtcurveconfig.moc"

+ 89
- 0
config/qtcurveconfig.h View File

@@ -0,0 +1,89 @@
1
+#ifndef __QTCURVECONFIG_H__
2
+#define __QTCURVECONFIG_H__
3
+
4
+/*
5
+  QtCurve (C) Craig Drummond, 2003 - 2007 Craig.Drummond@lycos.co.uk
6
+
7
+  ----
8
+
9
+  This program is free software; you can redistribute it and/or
10
+  modify it under the terms of the GNU General Public
11
+  License version 2 as published by the Free Software Foundation.
12
+
13
+  This program is distributed in the hope that it will be useful,
14
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+  General Public License for more details.
17
+
18
+  You should have received a copy of the GNU General Public License
19
+  along with this program; see the file COPYING.  If not, write to
20
+  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
+  Boston, MA 02110-1301, USA.
22
+*/
23
+
24
+#define QTC_COMMON_ONLY_COVERTERS
25
+#define QTC_CONFIG_DIALOG
26
+
27
+#include <qtcurveconfigbase.h>
28
+#include <qmap.h>
29
+#include "common.h"
30
+
31
+class QPopupMenu;
32
+class CExportThemeDialog;
33
+
34
+class QtCurveConfig : public QtCurveConfigBase
35
+{
36
+    Q_OBJECT
37
+
38
+    public:
39
+
40
+    QtCurveConfig(QWidget *parent);
41
+    virtual ~QtCurveConfig();
42
+
43
+    signals:
44
+
45
+    void changed(bool);
46
+
47
+    private:
48
+
49
+    void loadStyles(QPopupMenu *menu);
50
+
51
+    public slots:
52
+
53
+    void save();
54
+    void defaults();
55
+
56
+    private slots:
57
+
58
+    void setStyle(int s);
59
+    void updateChanged();
60
+    void importStyle();
61
+    void exportStyle();
62
+    void exportTheme();
63
+    void emboldenToggled();
64
+    void dbiChanged();
65
+    void shadeSlidersChanged();
66
+    void shadeMenubarsChanged();
67
+    void shadeCheckRadioChanged();
68
+    void customMenuTextColorChanged();
69
+    void stripedProgressChanged();
70
+    void tabAppearanceChanged();
71
+    void passwordCharClicked();
72
+
73
+    private:
74
+
75
+    void setPasswordChar(int ch);
76
+    void loadStyle(const QString &file);
77
+    void setOptions(Options &opts);
78
+    void setWidgetOptions(const Options &opts);
79
+    bool settingsChanged();
80
+
81
+    private:
82
+
83
+    Options            currentStyle,
84
+                       defaultStyle;
85
+    QMap<int, QString> styles;
86
+    CExportThemeDialog *exportDialog;
87
+};
88
+
89
+#endif

+ 996
- 0
config/qtcurveconfigbase.ui View File

@@ -0,0 +1,996 @@
1
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
2
+<class>QtCurveConfigBase</class>
3
+<widget class="QWidget">
4
+    <property name="name">
5
+        <cstring>QtCurveConfigBase</cstring>
6
+    </property>
7
+    <property name="geometry">
8
+        <rect>
9
+            <x>0</x>
10
+            <y>0</y>
11
+            <width>666</width>
12
+            <height>556</height>
13
+        </rect>
14
+    </property>
15
+    <property name="caption">
16
+        <string>Form1</string>
17
+    </property>
18
+    <grid>
19
+        <property name="name">
20
+            <cstring>unnamed</cstring>
21
+        </property>
22
+        <property name="margin">
23
+            <number>0</number>
24
+        </property>
25
+        <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
26
+            <property name="name">
27
+                <cstring>titleLabel</cstring>
28
+            </property>
29
+            <property name="sizePolicy">
30
+                <sizepolicy>
31
+                    <hsizetype>3</hsizetype>
32
+                    <vsizetype>5</vsizetype>
33
+                    <horstretch>0</horstretch>
34
+                    <verstretch>0</verstretch>
35
+                </sizepolicy>
36
+            </property>
37
+            <property name="text">
38
+                <string>title</string>
39
+            </property>
40
+            <property name="alignment">
41
+                <set>AlignCenter</set>
42
+            </property>
43
+        </widget>
44
+        <spacer row="1" column="0">
45
+            <property name="name">
46
+                <cstring>spacer2</cstring>
47
+            </property>
48
+            <property name="orientation">
49
+                <enum>Vertical</enum>
50
+            </property>
51
+            <property name="sizeType">
52
+                <enum>Fixed</enum>
53
+            </property>
54
+            <property name="sizeHint">
55
+                <size>
56
+                    <width>20</width>
57
+                    <height>16</height>
58
+                </size>
59
+            </property>
60
+        </spacer>
61
+        <widget class="QTabWidget" row="2" column="0" rowspan="1" colspan="2">
62
+            <property name="name">
63
+                <cstring>optionsTab</cstring>
64
+            </property>
65
+            <property name="sizePolicy">
66
+                <sizepolicy>
67
+                    <hsizetype>3</hsizetype>
68
+                    <vsizetype>3</vsizetype>
69
+                    <horstretch>0</horstretch>
70
+                    <verstretch>0</verstretch>
71
+                </sizepolicy>
72
+            </property>
73
+            <widget class="QWidget">
74
+                <property name="name">
75
+                    <cstring>tab</cstring>
76
+                </property>
77
+                <attribute name="title">
78
+                    <string>General</string>
79
+                </attribute>
80
+                <grid>
81
+                    <property name="name">
82
+                        <cstring>unnamed</cstring>
83
+                    </property>
84
+                    <widget class="QLabel" row="1" column="0">
85
+                        <property name="name">
86
+                            <cstring>textLabel1_6</cstring>
87
+                        </property>
88
+                        <property name="text">
89
+                            <string>Splitters:</string>
90
+                        </property>
91
+                    </widget>
92
+                    <widget class="QLabel" row="3" column="0">
93
+                        <property name="name">
94
+                            <cstring>textLabel1_2_3</cstring>
95
+                        </property>
96
+                        <property name="text">
97
+                            <string>Scrollbars:</string>
98
+                        </property>
99
+                    </widget>
100
+                    <widget class="QLabel" row="2" column="0">
101
+                        <property name="name">
102
+                            <cstring>textLabel1_2_3_2</cstring>
103
+                        </property>
104
+                        <property name="text">
105
+                            <string>Sliders:</string>
106
+                        </property>
107
+                    </widget>
108
+                    <widget class="QLabel" row="0" column="0">
109
+                        <property name="name">
110
+                            <cstring>textLabel1_7</cstring>
111
+                        </property>
112
+                        <property name=