mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: replace KColorDialog with QColorDialog
same reason as KFontDialog Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9bfcf00c40
commit
72daced852
30 changed files with 46 additions and 3604 deletions
|
@ -46,16 +46,10 @@ install(
|
|||
KCmdLineArgs
|
||||
KCmdLineOptions
|
||||
KCodecAction
|
||||
KColor
|
||||
KColorButton
|
||||
KColorCells
|
||||
KColorCollection
|
||||
KColorCombo
|
||||
KColorDialog
|
||||
KColorMimeData
|
||||
KColorPatch
|
||||
KColorScheme
|
||||
KColorTable
|
||||
KColorUtils
|
||||
KColorValueSelector
|
||||
KComboBox
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolordialog.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolordialog.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolorcollection.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolordialog.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolordialog.h"
|
|
@ -1 +0,0 @@
|
|||
#include "../kcolordialog.h"
|
|
@ -67,12 +67,10 @@ set(kdeui_LIB_SRCS
|
|||
colors/kcolorspaces.cpp
|
||||
colors/kcolorutils.cpp
|
||||
colors/kcolorscheme.cpp
|
||||
colors/kcolorcollection.cpp
|
||||
colors/kcolorhelpers.cpp
|
||||
colors/kcolorbutton.cpp
|
||||
colors/kcolorcombo.cpp
|
||||
colors/kcolorchoosermode.cpp
|
||||
colors/kcolordialog.cpp
|
||||
colors/kcolormimedata.cpp
|
||||
colors/kcolorvalueselector.cpp
|
||||
colors/khuesaturationselect.cpp
|
||||
|
@ -275,7 +273,6 @@ qt4_add_dbus_interface(kdeui_LIB_SRCS ${kglobalaccel_component_xml} kglobalaccel
|
|||
install(FILES ${kglobalaccel_component_xml} DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR})
|
||||
|
||||
set_source_files_properties(
|
||||
${CMAKE_SOURCE_DIR}/kdeui/colors/kcolordialog.cpp
|
||||
${CMAKE_SOURCE_DIR}/kdeui/kernel/kapplication.cpp
|
||||
${CMAKE_SOURCE_DIR}/kdeui/kernel/kglobalsettings.cpp
|
||||
${CMAKE_SOURCE_DIR}/kdeui/kernel/kuniqueapplication.cpp
|
||||
|
@ -366,11 +363,9 @@ install(
|
|||
actions/ktoolbarspaceraction.h
|
||||
colors/kcolorutils.h
|
||||
colors/kcolorscheme.h
|
||||
colors/kcolorcollection.h
|
||||
colors/kcolorbutton.h
|
||||
colors/kcolorchoosermode.h
|
||||
colors/kcolorcombo.h
|
||||
colors/kcolordialog.h
|
||||
colors/kcolormimedata.h
|
||||
colors/kcolorvalueselector.h
|
||||
colors/khuesaturationselect.h
|
||||
|
@ -533,16 +528,6 @@ install(
|
|||
DESTINATION ${KDE4_BIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
colors/40.colors
|
||||
colors/Oxygen.colors
|
||||
colors/Web.colors
|
||||
colors/Royal.colors
|
||||
colors/Rainbow.colors
|
||||
DESTINATION ${KDE4_CONFIG_INSTALL_DIR}/colors
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
jobs/org.kde.JobViewServer.xml
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
KDE RGB Palette
|
||||
0 0 0 Black
|
||||
48 48 48 Almost black
|
||||
88 88 88 Very dark gray
|
||||
128 128 128 Dark gray
|
||||
160 160 160 Mid gray
|
||||
195 195 195 Light gray
|
||||
220 220 220 Very light gray
|
||||
255 255 255 White
|
||||
|
||||
64 0 0 Very dark red
|
||||
128 0 0 Dark red
|
||||
192 0 0 Mid red
|
||||
255 0 0 Red
|
||||
255 192 192 Light red
|
||||
|
||||
0 64 0 Very dark green
|
||||
0 128 0 Dark green
|
||||
0 192 0 Mid green
|
||||
0 255 0 Green
|
||||
192 255 192 Light green
|
||||
|
||||
0 0 128 Dark blue
|
||||
0 0 192 Mid blue
|
||||
0 0 255 Blue
|
||||
192 192 255 Light blue
|
||||
|
||||
64 64 0 Very dark yellow
|
||||
128 128 0 Dark yellow
|
||||
192 192 0 Mid yellow
|
||||
255 255 0 Yellow
|
||||
255 255 192 Light yellow
|
||||
|
||||
0 64 64 Very dark cyan
|
||||
0 128 128 Dark cyan
|
||||
0 192 192 Mid cyan
|
||||
0 255 255 Cyan
|
||||
192 255 255 Light cyan
|
||||
|
||||
128 0 128 Dark magenta
|
||||
192 0 192 Mid magenta
|
||||
255 0 255 Magenta
|
||||
255 192 255 Light magenta
|
||||
|
||||
192 88 0 Dark orange
|
||||
255 128 0 Orange
|
||||
255 168 88 Light orange
|
||||
255 220 168 Very light orange
|
|
@ -1,127 +0,0 @@
|
|||
GIMP Palette
|
||||
56 37 9 wood brown6
|
||||
87 64 30 wood brown5
|
||||
117 81 26 wood brown4
|
||||
143 107 50 wood brown3
|
||||
179 146 93 wood brown2
|
||||
222 188 133 wood brown1
|
||||
156 15 15 brick red6
|
||||
191 3 3 brick red5
|
||||
226 8 0 brick red4
|
||||
232 87 82 brick red3
|
||||
240 134 130 brick red2
|
||||
249 204 202 brick red1
|
||||
156 15 86 raspberry pink6
|
||||
191 3 97 raspberry pink5
|
||||
226 0 113 raspberry pink4
|
||||
232 82 144 raspberry pink3
|
||||
240 130 176 raspberry pink2
|
||||
249 202 222 raspberry pink1
|
||||
106 0 86 burgundy purple6
|
||||
133 2 108 burgundy purple5
|
||||
160 39 134 burgundy purple4
|
||||
177 79 154 burgundy purple3
|
||||
193 115 176 burgundy purple2
|
||||
232 183 215 burgundy purple1
|
||||
29 10 85 grape violet6
|
||||
52 23 110 grape violet5
|
||||
70 40 134 grape violet4
|
||||
100 74 155 grape violet3
|
||||
142 121 165 grape violet2
|
||||
195 180 218 grape violet1
|
||||
0 49 110 skyblue6
|
||||
0 67 138 skyblue5
|
||||
0 87 174 skyblue4
|
||||
44 114 199 skyblue3
|
||||
97 147 207 skyblue2
|
||||
164 192 228 skyblue1
|
||||
0 72 77 sea blue6
|
||||
0 96 102 sea blue5
|
||||
0 120 128 sea blue4
|
||||
0 167 179 sea blue3
|
||||
0 196 204 sea blue2
|
||||
168 221 224 sea blue1
|
||||
0 88 63 emerald green6
|
||||
0 115 77 emerald green5
|
||||
0 153 102 emerald green4
|
||||
0 179 119 emerald green3
|
||||
0 204 136 emerald green2
|
||||
153 220 198 emerald green1
|
||||
0 110 41 forest green6
|
||||
0 137 44 forest green5
|
||||
55 164 44 forest green4
|
||||
119 183 83 forest green3
|
||||
177 210 143 forest green2
|
||||
216 232 194 forest green1
|
||||
227 173 0 sun yellow6
|
||||
243 195 0 sun yellow5
|
||||
255 221 0 sun yellow4
|
||||
255 235 85 sun yellow3
|
||||
255 242 153 sun yellow2
|
||||
255 246 200 sun yellow1
|
||||
172 67 17 hot orange6
|
||||
207 73 19 hot orange5
|
||||
235 115 49 hot orange4
|
||||
242 155 104 hot orange3
|
||||
242 187 136 hot orange2
|
||||
255 217 176 hot orange1
|
||||
46 52 54 aluminum gray6
|
||||
85 87 83 aluminum gray5
|
||||
136 138 133 aluminum gray4
|
||||
186 189 182 aluminum gray3
|
||||
211 215 207 aluminum gray2
|
||||
238 238 236 aluminum gray1
|
||||
77 38 0 brown orange6
|
||||
128 63 0 brown orange5
|
||||
191 94 0 brown orange4
|
||||
255 126 0 brown orange3
|
||||
255 191 128 brown orange2
|
||||
255 223 191 brown orange1
|
||||
89 0 0 red6
|
||||
140 0 0 red5
|
||||
191 0 0 red4
|
||||
255 0 0 red3
|
||||
255 128 128 red2
|
||||
255 191 191 red1
|
||||
115 0 85 pink6
|
||||
163 0 123 pink5
|
||||
204 0 154 pink4
|
||||
255 0 191 pink3
|
||||
255 128 223 pink2
|
||||
255 191 240 pink1
|
||||
44 0 89 purple6
|
||||
64 0 128 purple5
|
||||
90 0 179 purple4
|
||||
128 0 255 purple3
|
||||
192 128 255 purple2
|
||||
223 191 255 purple1
|
||||
0 0 128 blue6
|
||||
0 0 191 blue5
|
||||
0 0 255 blue4
|
||||
0 102 255 blue3
|
||||
128 179 255 blue2
|
||||
191 217 255 blue1
|
||||
0 77 0 green6
|
||||
0 140 0 green5
|
||||
0 191 0 green4
|
||||
0 255 0 green3
|
||||
128 255 128 green2
|
||||
191 255 191 green1
|
||||
99 128 0 lime6
|
||||
139 179 0 lime5
|
||||
191 245 0 lime4
|
||||
229 255 0 lime3
|
||||
240 255 128 lime2
|
||||
248 255 191 lime1
|
||||
255 170 0 yellow6
|
||||
255 191 0 yellow5
|
||||
255 213 0 yellow4
|
||||
255 255 0 yellow3
|
||||
255 255 153 yellow2
|
||||
255 255 191 yellow1
|
||||
50 50 50 gray6
|
||||
85 85 85 gray5
|
||||
136 136 136 gray4
|
||||
187 187 187 gray3
|
||||
221 221 221 gray2
|
||||
238 238 238 gray1
|
|
@ -1,118 +0,0 @@
|
|||
GIMP Palette
|
||||
255 204 204
|
||||
255 230 204
|
||||
255 255 204
|
||||
230 255 204
|
||||
204 255 204
|
||||
204 255 230
|
||||
204 255 255
|
||||
204 230 255
|
||||
204 204 255
|
||||
230 204 255
|
||||
255 204 255
|
||||
255 204 230
|
||||
255 255 255
|
||||
255 153 153
|
||||
255 204 153
|
||||
255 255 153
|
||||
204 255 153
|
||||
153 255 153
|
||||
153 255 204
|
||||
153 255 255
|
||||
153 204 255
|
||||
153 153 255
|
||||
204 153 255
|
||||
255 153 255
|
||||
255 153 204
|
||||
224 224 224
|
||||
255 102 102
|
||||
255 179 102
|
||||
255 255 102
|
||||
179 255 102
|
||||
102 255 102
|
||||
102 255 179
|
||||
102 255 255
|
||||
102 179 255
|
||||
102 102 255
|
||||
179 102 255
|
||||
255 102 255
|
||||
255 102 179
|
||||
192 192 192
|
||||
255 51 51
|
||||
255 153 51
|
||||
255 255 51
|
||||
153 255 51
|
||||
51 255 51
|
||||
51 255 153
|
||||
51 255 255
|
||||
51 153 255
|
||||
51 51 255
|
||||
153 51 255
|
||||
255 51 255
|
||||
255 51 153
|
||||
160 160 160
|
||||
255 0 0
|
||||
255 128 0
|
||||
255 255 0
|
||||
128 255 0
|
||||
0 255 0
|
||||
0 255 128
|
||||
0 255 255
|
||||
0 128 255
|
||||
0 0 255
|
||||
128 0 255
|
||||
255 0 255
|
||||
255 0 128
|
||||
128 128 128
|
||||
204 0 0
|
||||
204 102 0
|
||||
204 204 0
|
||||
102 204 0
|
||||
0 204 0
|
||||
0 204 102
|
||||
0 204 204
|
||||
0 102 204
|
||||
0 0 204
|
||||
102 0 204
|
||||
204 0 204
|
||||
204 0 102
|
||||
96 96 96
|
||||
153 0 0
|
||||
153 77 0
|
||||
153 153 0
|
||||
77 153 0
|
||||
0 153 0
|
||||
0 153 77
|
||||
0 153 153
|
||||
0 77 153
|
||||
0 0 153
|
||||
77 0 153
|
||||
153 0 153
|
||||
153 0 77
|
||||
64 64 64
|
||||
102 0 0
|
||||
102 51 0
|
||||
102 102 0
|
||||
51 102 0
|
||||
0 102 0
|
||||
0 102 51
|
||||
0 102 102
|
||||
0 51 102
|
||||
0 0 102
|
||||
51 0 102
|
||||
102 0 102
|
||||
102 0 51
|
||||
32 32 32
|
||||
51 0 0
|
||||
51 26 0
|
||||
51 51 0
|
||||
26 51 0
|
||||
0 51 0
|
||||
0 51 26
|
||||
0 51 51
|
||||
0 26 51
|
||||
0 0 51
|
||||
26 0 51
|
||||
51 0 51
|
||||
51 0 26
|
||||
0 0 0
|
|
@ -1,258 +0,0 @@
|
|||
GIMP Palette
|
||||
0 0 0
|
||||
60 0 80
|
||||
60 0 80
|
||||
60 0 84
|
||||
64 0 84
|
||||
64 0 84
|
||||
64 0 88
|
||||
64 0 88
|
||||
68 0 88
|
||||
68 0 92
|
||||
68 0 92
|
||||
68 0 92
|
||||
72 0 96
|
||||
72 0 96
|
||||
72 0 96
|
||||
72 0 100
|
||||
76 0 100
|
||||
76 0 100
|
||||
76 0 104
|
||||
76 0 104
|
||||
76 0 104
|
||||
80 0 104
|
||||
80 0 108
|
||||
80 0 108
|
||||
80 0 108
|
||||
84 0 112
|
||||
84 0 112
|
||||
84 0 112
|
||||
84 0 116
|
||||
88 0 116
|
||||
88 0 116
|
||||
88 0 120
|
||||
88 0 120
|
||||
92 0 120
|
||||
92 0 124
|
||||
92 0 124
|
||||
92 0 124
|
||||
96 0 128
|
||||
96 0 128
|
||||
96 0 128
|
||||
96 0 132
|
||||
96 0 132
|
||||
100 0 132
|
||||
100 0 132
|
||||
100 0 136
|
||||
100 0 136
|
||||
104 0 136
|
||||
104 0 140
|
||||
104 0 140
|
||||
104 0 140
|
||||
108 0 144
|
||||
108 0 144
|
||||
108 0 144
|
||||
108 0 148
|
||||
112 0 148
|
||||
112 0 148
|
||||
112 0 152
|
||||
112 0 152
|
||||
116 0 152
|
||||
116 0 156
|
||||
116 0 156
|
||||
116 0 156
|
||||
120 0 160
|
||||
120 0 160
|
||||
124 4 160
|
||||
124 8 164
|
||||
128 12 164
|
||||
128 16 164
|
||||
132 20 168
|
||||
132 24 168
|
||||
136 28 168
|
||||
136 32 172
|
||||
140 36 172
|
||||
140 40 172
|
||||
144 44 176
|
||||
144 48 176
|
||||
148 52 180
|
||||
148 56 180
|
||||
152 60 180
|
||||
152 64 184
|
||||
156 68 184
|
||||
156 72 184
|
||||
160 76 188
|
||||
160 80 188
|
||||
164 84 188
|
||||
164 88 192
|
||||
168 92 192
|
||||
168 96 192
|
||||
172 100 196
|
||||
172 104 196
|
||||
176 108 200
|
||||
176 112 200
|
||||
180 116 200
|
||||
180 120 204
|
||||
184 124 204
|
||||
188 128 204
|
||||
188 132 208
|
||||
192 136 208
|
||||
192 140 208
|
||||
196 144 212
|
||||
196 148 212
|
||||
200 152 216
|
||||
200 156 216
|
||||
204 160 216
|
||||
204 164 220
|
||||
208 168 220
|
||||
208 172 220
|
||||
212 176 224
|
||||
212 180 224
|
||||
216 184 224
|
||||
216 188 228
|
||||
220 192 228
|
||||
220 196 228
|
||||
224 200 232
|
||||
224 204 232
|
||||
228 208 236
|
||||
228 212 236
|
||||
232 216 236
|
||||
232 220 240
|
||||
236 224 240
|
||||
236 228 240
|
||||
240 232 244
|
||||
240 236 244
|
||||
244 240 244
|
||||
244 244 248
|
||||
248 248 248
|
||||
252 252 252
|
||||
252 252 252
|
||||
252 252 248
|
||||
252 252 244
|
||||
252 252 240
|
||||
252 252 236
|
||||
252 252 232
|
||||
252 252 228
|
||||
252 252 224
|
||||
252 252 220
|
||||
252 252 216
|
||||
252 252 212
|
||||
252 252 208
|
||||
252 252 204
|
||||
252 252 200
|
||||
252 252 196
|
||||
252 252 192
|
||||
252 252 188
|
||||
252 252 184
|
||||
252 252 180
|
||||
252 252 176
|
||||
252 252 172
|
||||
252 252 168
|
||||
252 252 164
|
||||
252 252 160
|
||||
252 252 156
|
||||
252 252 152
|
||||
252 252 148
|
||||
252 252 144
|
||||
252 252 140
|
||||
252 252 136
|
||||
252 252 132
|
||||
252 252 128
|
||||
252 252 124
|
||||
252 252 120
|
||||
252 252 116
|
||||
252 252 112
|
||||
252 252 108
|
||||
252 252 104
|
||||
252 252 100
|
||||
252 252 96
|
||||
252 252 92
|
||||
252 252 88
|
||||
252 252 84
|
||||
252 252 80
|
||||
252 252 76
|
||||
252 252 72
|
||||
252 252 68
|
||||
252 252 64
|
||||
252 252 60
|
||||
252 252 56
|
||||
252 252 52
|
||||
252 252 48
|
||||
252 252 44
|
||||
252 252 40
|
||||
252 252 36
|
||||
252 252 32
|
||||
252 252 28
|
||||
252 252 24
|
||||
252 252 20
|
||||
252 252 16
|
||||
252 252 12
|
||||
252 252 8
|
||||
252 252 4
|
||||
252 252 0
|
||||
252 248 0
|
||||
248 244 0
|
||||
244 240 0
|
||||
240 236 4
|
||||
240 232 4
|
||||
236 228 4
|
||||
232 224 8
|
||||
228 220 8
|
||||
228 216 8
|
||||
224 212 12
|
||||
220 208 12
|
||||
216 204 12
|
||||
212 200 16
|
||||
212 196 16
|
||||
208 192 16
|
||||
204 188 20
|
||||
200 184 20
|
||||
200 180 20
|
||||
196 176 24
|
||||
192 172 24
|
||||
188 168 24
|
||||
184 164 28
|
||||
184 160 28
|
||||
180 156 28
|
||||
176 152 32
|
||||
172 148 32
|
||||
172 144 32
|
||||
168 140 36
|
||||
164 136 36
|
||||
160 132 36
|
||||
160 128 36
|
||||
156 124 40
|
||||
152 120 40
|
||||
148 116 40
|
||||
144 112 44
|
||||
144 108 44
|
||||
140 104 44
|
||||
136 100 48
|
||||
132 96 48
|
||||
132 92 48
|
||||
128 88 52
|
||||
124 84 52
|
||||
120 80 52
|
||||
116 76 56
|
||||
116 72 56
|
||||
112 68 56
|
||||
108 64 60
|
||||
104 60 60
|
||||
104 56 60
|
||||
100 52 64
|
||||
96 48 64
|
||||
92 44 64
|
||||
88 40 68
|
||||
88 36 68
|
||||
84 32 68
|
||||
80 28 72
|
||||
76 24 72
|
||||
76 20 72
|
||||
72 16 76
|
||||
68 12 76
|
||||
64 8 76
|
||||
60 0 80
|
||||
60 0 80
|
||||
60 0 80
|
||||
60 0 80
|
||||
# The royal purple ... by D. Egnor
|
|
@ -1,218 +0,0 @@
|
|||
GIMP Palette
|
||||
# Netscape -- GIMP Palette file
|
||||
255 255 255
|
||||
255 255 204
|
||||
255 255 153
|
||||
255 255 102
|
||||
255 255 51
|
||||
255 255 0
|
||||
255 204 255
|
||||
255 204 204
|
||||
255 204 153
|
||||
255 204 102
|
||||
255 204 51
|
||||
255 204 0
|
||||
255 153 255
|
||||
255 153 204
|
||||
255 153 153
|
||||
255 153 102
|
||||
255 153 51
|
||||
255 153 0
|
||||
255 102 255
|
||||
255 102 204
|
||||
255 102 153
|
||||
255 102 102
|
||||
255 102 51
|
||||
255 102 0
|
||||
255 51 255
|
||||
255 51 204
|
||||
255 51 153
|
||||
255 51 102
|
||||
255 51 51
|
||||
255 51 0
|
||||
255 0 255
|
||||
255 0 204
|
||||
255 0 153
|
||||
255 0 102
|
||||
255 0 51
|
||||
255 0 0
|
||||
204 255 255
|
||||
204 255 204
|
||||
204 255 153
|
||||
204 255 102
|
||||
204 255 51
|
||||
204 255 0
|
||||
204 204 255
|
||||
204 204 204
|
||||
204 204 153
|
||||
204 204 102
|
||||
204 204 51
|
||||
204 204 0
|
||||
204 153 255
|
||||
204 153 204
|
||||
204 153 153
|
||||
204 153 102
|
||||
204 153 51
|
||||
204 153 0
|
||||
204 102 255
|
||||
204 102 204
|
||||
204 102 153
|
||||
204 102 102
|
||||
204 102 51
|
||||
204 102 0
|
||||
204 51 255
|
||||
204 51 204
|
||||
204 51 153
|
||||
204 51 102
|
||||
204 51 51
|
||||
204 51 0
|
||||
204 0 255
|
||||
204 0 204
|
||||
204 0 153
|
||||
204 0 102
|
||||
204 0 51
|
||||
204 0 0
|
||||
153 255 255
|
||||
153 255 204
|
||||
153 255 153
|
||||
153 255 102
|
||||
153 255 51
|
||||
153 255 0
|
||||
153 204 255
|
||||
153 204 204
|
||||
153 204 153
|
||||
153 204 102
|
||||
153 204 51
|
||||
153 204 0
|
||||
153 153 255
|
||||
153 153 204
|
||||
153 153 153
|
||||
153 153 102
|
||||
153 153 51
|
||||
153 153 0
|
||||
153 102 255
|
||||
153 102 204
|
||||
153 102 153
|
||||
153 102 102
|
||||
153 102 51
|
||||
153 102 0
|
||||
153 51 255
|
||||
153 51 204
|
||||
153 51 153
|
||||
153 51 102
|
||||
153 51 51
|
||||
153 51 0
|
||||
153 0 255
|
||||
153 0 204
|
||||
153 0 153
|
||||
153 0 102
|
||||
153 0 51
|
||||
153 0 0
|
||||
102 255 255
|
||||
102 255 204
|
||||
102 255 153
|
||||
102 255 102
|
||||
102 255 51
|
||||
102 255 0
|
||||
102 204 255
|
||||
102 204 204
|
||||
102 204 153
|
||||
102 204 102
|
||||
102 204 51
|
||||
102 204 0
|
||||
102 153 255
|
||||
102 153 204
|
||||
102 153 153
|
||||
102 153 102
|
||||
102 153 51
|
||||
102 153 0
|
||||
102 102 255
|
||||
102 102 204
|
||||
102 102 153
|
||||
102 102 102
|
||||
102 102 51
|
||||
102 102 0
|
||||
102 51 255
|
||||
102 51 204
|
||||
102 51 153
|
||||
102 51 102
|
||||
102 51 51
|
||||
102 51 0
|
||||
102 0 255
|
||||
102 0 204
|
||||
102 0 153
|
||||
102 0 102
|
||||
102 0 51
|
||||
102 0 0
|
||||
51 255 255
|
||||
51 255 204
|
||||
51 255 153
|
||||
51 255 102
|
||||
51 255 51
|
||||
51 255 0
|
||||
51 204 255
|
||||
51 204 204
|
||||
51 204 153
|
||||
51 204 102
|
||||
51 204 51
|
||||
51 204 0
|
||||
51 153 255
|
||||
51 153 204
|
||||
51 153 153
|
||||
51 153 102
|
||||
51 153 51
|
||||
51 153 0
|
||||
51 102 255
|
||||
51 102 204
|
||||
51 102 153
|
||||
51 102 102
|
||||
51 102 51
|
||||
51 102 0
|
||||
51 51 255
|
||||
51 51 204
|
||||
51 51 153
|
||||
51 51 102
|
||||
51 51 51
|
||||
51 51 0
|
||||
51 0 255
|
||||
51 0 204
|
||||
51 0 153
|
||||
51 0 102
|
||||
51 0 51
|
||||
51 0 0
|
||||
0 255 255
|
||||
0 255 204
|
||||
0 255 153
|
||||
0 255 102
|
||||
0 255 51
|
||||
0 255 0
|
||||
0 204 255
|
||||
0 204 204
|
||||
0 204 153
|
||||
0 204 102
|
||||
0 204 51
|
||||
0 204 0
|
||||
0 153 255
|
||||
0 153 204
|
||||
0 153 153
|
||||
0 153 102
|
||||
0 153 51
|
||||
0 153 0
|
||||
0 102 255
|
||||
0 102 204
|
||||
0 102 153
|
||||
0 102 102
|
||||
0 102 51
|
||||
0 102 0
|
||||
0 51 255
|
||||
0 51 204
|
||||
0 51 153
|
||||
0 51 102
|
||||
0 51 51
|
||||
0 51 0
|
||||
0 0 255
|
||||
0 0 204
|
||||
0 0 153
|
||||
0 0 102
|
||||
0 0 51
|
||||
0 0 0
|
|
@ -32,9 +32,11 @@
|
|||
#include <kstandardshortcut.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qstyleoption.h>
|
||||
#include "kcolordialog.h"
|
||||
#include <QtGui/qcolordialog.h>
|
||||
#include "kcolorhelpers_p.h"
|
||||
#include "kcolormimedata.h"
|
||||
#include "kdialog.h"
|
||||
#include "klocale.h"
|
||||
#include "kdebug.h"
|
||||
#include "kwindowsystem.h"
|
||||
|
||||
|
@ -56,7 +58,7 @@ public:
|
|||
QColor col;
|
||||
QPoint mPos;
|
||||
|
||||
QWeakPointer<KColorDialog> dialogPtr;
|
||||
QWeakPointer<QColorDialog> dialogPtr;
|
||||
|
||||
void initStyleOption(QStyleOptionButton* opt) const;
|
||||
};
|
||||
|
@ -247,22 +249,24 @@ void KColorButton::mouseMoveEvent( QMouseEvent *e)
|
|||
|
||||
void KColorButton::KColorButtonPrivate::_k_chooseColor()
|
||||
{
|
||||
KColorDialog *dialog = dialogPtr.data();
|
||||
QColorDialog *dialog = dialogPtr.data();
|
||||
if (dialog) {
|
||||
dialog->show();
|
||||
KWindowSystem::forceActiveWindow(dialog->winId());
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = new KColorDialog(q);
|
||||
dialog->setColor(q->color());
|
||||
if (m_bdefaultColor) {
|
||||
dialog->setDefaultColor(m_defaultColor);
|
||||
QColor qc = q->color();
|
||||
if (!qc.isValid()) {
|
||||
qc = m_defaultColor;
|
||||
}
|
||||
dialog = new QColorDialog(q);
|
||||
dialog->setWindowTitle(KDialog::makeStandardCaption(i18n("Select Color"), q));
|
||||
dialog->setCurrentColor(qc);
|
||||
if (m_alphaChannel) {
|
||||
dialog->setOptions(QColorDialog::ShowAlphaChannel);
|
||||
}
|
||||
dialog->setAlphaChannelEnabled(m_alphaChannel);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
|
||||
connect(dialog, SIGNAL(applyClicked()), q, SLOT(_k_colorChosen()));
|
||||
connect(dialog, SIGNAL(accepted()), q, SLOT(_k_colorChosen()));
|
||||
dialogPtr = dialog;
|
||||
dialog->show();
|
||||
|
@ -270,13 +274,13 @@ void KColorButton::KColorButtonPrivate::_k_chooseColor()
|
|||
|
||||
void KColorButton::KColorButtonPrivate::_k_colorChosen()
|
||||
{
|
||||
KColorDialog *dialog = dialogPtr.data();
|
||||
QColorDialog *dialog = dialogPtr.data();
|
||||
if (!dialog) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog->color().isValid()) {
|
||||
q->setColor(dialog->color());
|
||||
if (dialog->currentColor().isValid()) {
|
||||
q->setColor(dialog->currentColor());
|
||||
} else if (m_bdefaultColor) {
|
||||
q->setColor(m_defaultColor);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ class KColorButtonPrivate;
|
|||
*
|
||||
* This widget can be used to display or allow user selection of a color.
|
||||
*
|
||||
* @see KColorDialog
|
||||
*
|
||||
* \image html kcolorbutton.png "KDE Color Button"
|
||||
*/
|
||||
class KDEUI_EXPORT KColorButton : public QPushButton
|
||||
|
|
|
@ -1,265 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
// KDE color collection
|
||||
|
||||
#include "kcolorcollection.h"
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kglobal.h>
|
||||
#include <ksavefile.h>
|
||||
|
||||
//BEGIN KColorCollectionPrivate
|
||||
class KColorCollectionPrivate
|
||||
{
|
||||
public:
|
||||
KColorCollectionPrivate(const QString&);
|
||||
KColorCollectionPrivate(const KColorCollectionPrivate&);
|
||||
~KColorCollectionPrivate() {}
|
||||
|
||||
struct ColorNode
|
||||
{
|
||||
ColorNode(const QColor &c, const QString &n)
|
||||
: color(c), name(n) {}
|
||||
QColor color;
|
||||
QString name;
|
||||
};
|
||||
QList<ColorNode> colorList;
|
||||
|
||||
QString name;
|
||||
QString desc;
|
||||
KColorCollection::Editable editable;
|
||||
};
|
||||
|
||||
KColorCollectionPrivate::KColorCollectionPrivate(const QString &_name)
|
||||
: name(_name)
|
||||
{
|
||||
if (name.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString filename = KStandardDirs::locate("config", "colors/" + name);
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFile paletteFile(filename);
|
||||
if (!paletteFile.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Read first line
|
||||
// Expected "GIMP Palette"
|
||||
QString line = QString::fromLocal8Bit(paletteFile.readLine());
|
||||
if (line.indexOf(" Palette") == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
while(!paletteFile.atEnd()) {
|
||||
line = QString::fromLocal8Bit(paletteFile.readLine());
|
||||
if (line[0] == '#') {
|
||||
// This is a comment line
|
||||
line = line.mid(1); // Strip '#'
|
||||
line = line.trimmed(); // Strip remaining white space..
|
||||
if (!line.isEmpty()) {
|
||||
desc += line+'\n'; // Add comment to description
|
||||
}
|
||||
} else {
|
||||
// This is a color line, hopefully
|
||||
line = line.trimmed();
|
||||
if (line.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
int r, g, b;
|
||||
int pos = 0;
|
||||
if (sscanf(line.toLatin1(), "%d %d %d%n", &r, &g, &b, &pos) >= 3) {
|
||||
r = qBound(0, r, 255);
|
||||
g = qBound(0, g, 255);
|
||||
b = qBound(0, b, 255);
|
||||
QString name = line.mid(pos).trimmed();
|
||||
colorList.append(ColorNode(QColor(r, g, b), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KColorCollectionPrivate::KColorCollectionPrivate(const KColorCollectionPrivate& p)
|
||||
: colorList(p.colorList), name(p.name), desc(p.desc), editable(p.editable)
|
||||
{
|
||||
}
|
||||
//END KColorCollectionPrivate
|
||||
|
||||
QStringList
|
||||
KColorCollection::installedCollections()
|
||||
{
|
||||
QStringList paletteList;
|
||||
KGlobal::dirs()->findAllResources("config", "colors/*", KStandardDirs::NoDuplicates, paletteList);
|
||||
|
||||
int strip = strlen("colors/");
|
||||
for (QStringList::Iterator it = paletteList.begin(); it != paletteList.end(); ++it) {
|
||||
(*it) = (*it).mid(strip);
|
||||
}
|
||||
|
||||
return paletteList;
|
||||
}
|
||||
|
||||
KColorCollection::KColorCollection(const QString &name)
|
||||
{
|
||||
d = new KColorCollectionPrivate(name);
|
||||
}
|
||||
|
||||
KColorCollection::KColorCollection(const KColorCollection &p)
|
||||
{
|
||||
d = new KColorCollectionPrivate(*p.d);
|
||||
}
|
||||
|
||||
KColorCollection::~KColorCollection()
|
||||
{
|
||||
// Need auto-save?
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool KColorCollection::save()
|
||||
{
|
||||
QString filename = KStandardDirs::locateLocal("config", "colors/" + d->name);
|
||||
KSaveFile sf(filename);
|
||||
if (!sf.open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream str(&sf);
|
||||
|
||||
QString description = d->desc.trimmed();
|
||||
description = '#' + description.split( '\n', QString::KeepEmptyParts).join("\n#");
|
||||
|
||||
str << "KDE RGB Palette\n";
|
||||
str << description << "\n";
|
||||
foreach (const KColorCollectionPrivate::ColorNode &node, d->colorList) {
|
||||
int r,g,b;
|
||||
node.color.getRgb(&r, &g, &b);
|
||||
str << r << " " << g << " " << b << " " << node.name << "\n";
|
||||
}
|
||||
|
||||
sf.flush();
|
||||
return sf.finalize();
|
||||
}
|
||||
|
||||
QString KColorCollection::description() const
|
||||
{
|
||||
return d->desc;
|
||||
}
|
||||
|
||||
void KColorCollection::setDescription(const QString &desc)
|
||||
{
|
||||
d->desc = desc;
|
||||
}
|
||||
|
||||
QString KColorCollection::name() const
|
||||
{
|
||||
return d->name;
|
||||
}
|
||||
|
||||
void KColorCollection::setName(const QString &name)
|
||||
{
|
||||
d->name = name;
|
||||
}
|
||||
|
||||
KColorCollection::Editable KColorCollection::editable() const
|
||||
{
|
||||
return d->editable;
|
||||
}
|
||||
|
||||
void KColorCollection::setEditable(Editable editable)
|
||||
{
|
||||
d->editable = editable;
|
||||
}
|
||||
|
||||
int KColorCollection::count() const
|
||||
{
|
||||
return d->colorList.count();
|
||||
}
|
||||
|
||||
KColorCollection& KColorCollection::operator=( const KColorCollection &p)
|
||||
{
|
||||
if (&p == this) {
|
||||
return *this;
|
||||
}
|
||||
d->colorList = p.d->colorList;
|
||||
d->name = p.d->name;
|
||||
d->desc = p.d->desc;
|
||||
d->editable = p.d->editable;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QColor KColorCollection::color(int index) const
|
||||
{
|
||||
if (index < 0 || index >= count()) {
|
||||
return QColor();
|
||||
}
|
||||
return d->colorList[index].color;
|
||||
}
|
||||
|
||||
int KColorCollection::findColor(const QColor &color) const
|
||||
{
|
||||
for (int i = 0; i < d->colorList.size(); ++i) {
|
||||
if (d->colorList[i].color == color) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString KColorCollection::name(int index) const
|
||||
{
|
||||
if (index < 0 || index >= count()) {
|
||||
return QString();
|
||||
}
|
||||
return d->colorList[index].name;
|
||||
}
|
||||
|
||||
QString KColorCollection::name(const QColor &color) const
|
||||
{
|
||||
return name(findColor(color));
|
||||
}
|
||||
|
||||
int KColorCollection::addColor(const QColor &newColor, const QString &newColorName)
|
||||
{
|
||||
d->colorList.append(KColorCollectionPrivate::ColorNode(newColor, newColorName));
|
||||
return count() - 1;
|
||||
}
|
||||
|
||||
int KColorCollection::changeColor(int index, const QColor &newColor, const QString &newColorName)
|
||||
{
|
||||
if (index < 0 || index >= count()) {
|
||||
return -1;
|
||||
}
|
||||
KColorCollectionPrivate::ColorNode& node = d->colorList[index];
|
||||
node.color = newColor;
|
||||
node.name = newColorName;
|
||||
return index;
|
||||
}
|
||||
|
||||
int KColorCollection::changeColor(const QColor &oldColor,
|
||||
const QColor &newColor,
|
||||
const QString &newColorName)
|
||||
{
|
||||
return changeColor(findColor(oldColor), newColor, newColorName);
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; version
|
||||
2 of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
// KDE color collection.
|
||||
|
||||
#ifndef KDELIBS_KCOLORCOLLECTION_H
|
||||
#define KDELIBS_KCOLORCOLLECTION_H
|
||||
|
||||
#include <kdeui_export.h>
|
||||
|
||||
#include <QtGui/QColor>
|
||||
|
||||
/**
|
||||
* Class for handling color collections ("palettes").
|
||||
*
|
||||
* This class makes it easy to handle color collections, sometimes referred to
|
||||
* as "palettes". This class can read and write collections from and to a file.
|
||||
*
|
||||
* This class uses the "GIMP" palette file format.
|
||||
*
|
||||
* @author Waldo Bastian (bastian@kde.org)
|
||||
**/
|
||||
class KDEUI_EXPORT KColorCollection
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Query which KDE color collections are installed.
|
||||
*
|
||||
* @return A list with installed color collection names.
|
||||
*/
|
||||
static QStringList installedCollections();
|
||||
|
||||
/**
|
||||
* KColorCollection constructor. Creates a KColorCollection from a file
|
||||
* the filename is derived from the name.
|
||||
* @param name The name of collection as returned by installedCollections()
|
||||
**/
|
||||
explicit KColorCollection(const QString &name=QString());
|
||||
|
||||
/**
|
||||
* KColorCollection copy constructor.
|
||||
**/
|
||||
KColorCollection(const KColorCollection &);
|
||||
|
||||
/**
|
||||
* KColorCollection destructor.
|
||||
**/
|
||||
~KColorCollection();
|
||||
|
||||
/**
|
||||
* KColorCollection assignment operator
|
||||
**/
|
||||
KColorCollection& operator=( const KColorCollection &);
|
||||
|
||||
/**
|
||||
* Save the collection
|
||||
*
|
||||
* @return 'true' if successful
|
||||
**/
|
||||
bool save();
|
||||
|
||||
/**
|
||||
* Get the description of the collection.
|
||||
* @return the description of the collection.
|
||||
**/
|
||||
QString description() const;
|
||||
|
||||
/**
|
||||
* Set the description of the collection.
|
||||
* @param desc the new description
|
||||
**/
|
||||
void setDescription(const QString &desc);
|
||||
|
||||
/**
|
||||
* Get the name of the collection.
|
||||
* @return the name of the collection
|
||||
**/
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
* Set the name of the collection.
|
||||
* @param name the name of the collection
|
||||
**/
|
||||
void setName(const QString &name);
|
||||
|
||||
/**
|
||||
* Used to specify whether a collection may be edited.
|
||||
* @see editable()
|
||||
* @see setEditable()
|
||||
*/
|
||||
enum Editable {
|
||||
Yes, ///< Collection may be edited
|
||||
No, ///< Collection may not be edited
|
||||
Ask ///< Ask user before editing
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the collection may be edited.
|
||||
* @return the state of the collection
|
||||
**/
|
||||
Editable editable() const;
|
||||
|
||||
/**
|
||||
* Change whether the collection may be edited.
|
||||
* @param editable the state of the collection
|
||||
**/
|
||||
void setEditable(Editable editable);
|
||||
|
||||
/**
|
||||
* Return the number of colors in the collection.
|
||||
* @return the number of colors
|
||||
**/
|
||||
int count() const;
|
||||
|
||||
/**
|
||||
* Find color by index.
|
||||
* @param index the index of the desired color
|
||||
* @return The @p index -th color of the collection, null if not found.
|
||||
**/
|
||||
QColor color(int index) const;
|
||||
|
||||
/**
|
||||
* Find index by @p color.
|
||||
* @param color the color to find
|
||||
* @return The index of the color in the collection or -1 if the
|
||||
* color is not found.
|
||||
**/
|
||||
int findColor(const QColor &color) const;
|
||||
|
||||
/**
|
||||
* Find color name by @p index.
|
||||
* @param index the index of the color
|
||||
* @return The name of the @p index -th color.
|
||||
* Note that not all collections have named the colors. Null is
|
||||
* returned if the color does not exist or has no name.
|
||||
**/
|
||||
QString name(int index) const;
|
||||
|
||||
/**
|
||||
* Find color name by @p color.
|
||||
* @return The name of color according to this collection.
|
||||
* Note that not all collections have named the colors.
|
||||
* Note also that each collection can give the same color
|
||||
* a different name.
|
||||
**/
|
||||
QString name(const QColor &color) const;
|
||||
|
||||
/**
|
||||
* Add a color.
|
||||
* @param newColor The color to add.
|
||||
* @param newColorName The name of the color, null to remove
|
||||
* the name.
|
||||
* @return The index of the added color.
|
||||
**/
|
||||
int addColor(const QColor &newColor,
|
||||
const QString &newColorName = QString());
|
||||
|
||||
/**
|
||||
* Change a color.
|
||||
* @param index Index of the color to change
|
||||
* @param newColor The new color.
|
||||
* @param newColorName The new color name, null to remove
|
||||
* the name.
|
||||
* @return The index of the new color or -1 if the color couldn't
|
||||
* be changed.
|
||||
**/
|
||||
int changeColor(int index,
|
||||
const QColor &newColor,
|
||||
const QString &newColorName = QString());
|
||||
|
||||
/**
|
||||
* Change a color.
|
||||
* @param oldColor The original color
|
||||
* @param newColor The new color.
|
||||
* @param newColorName The new color name, null to remove
|
||||
* the name.
|
||||
* @return The index of the new color or -1 if the color couldn't
|
||||
* be changed.
|
||||
**/
|
||||
int changeColor(const QColor &oldColor,
|
||||
const QColor &newColor,
|
||||
const QString &newColorName = QString());
|
||||
|
||||
private:
|
||||
class KColorCollectionPrivate *d;
|
||||
};
|
||||
|
||||
|
||||
#endif // KDELIBS_KCOLORCOLLECTION_H
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
#include <QtGui/QAbstractItemDelegate>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QStylePainter>
|
||||
#include <QtGui/QColorDialog>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kcolordialog.h"
|
||||
#include "klocale.h"
|
||||
#include "kdialog.h"
|
||||
|
||||
class KColorComboDelegate : public QAbstractItemDelegate
|
||||
{
|
||||
|
@ -324,7 +324,9 @@ void KColorCombo::showEmptyList()
|
|||
void KColorComboPrivate::_k_slotActivated(int index)
|
||||
{
|
||||
if (index == 0) {
|
||||
if (KColorDialog::getColor(customColor, q) == QDialog::Accepted) {
|
||||
const QColor c = QColorDialog::getColor(customColor, q, KDialog::makeStandardCaption(i18n("Select Color"), q));
|
||||
if (c.isValid()) {
|
||||
customColor = c;
|
||||
setCustomColor(customColor, false);
|
||||
}
|
||||
} else if (colorList.isEmpty()) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,345 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1997 Martin Jones (mjones@kde.org)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//----------------------------------------------------------------------
|
||||
// KDE color selection dialog.
|
||||
|
||||
// layout management added Oct 1997 by Mario Weilguni
|
||||
// <mweilguni@sime.com>
|
||||
|
||||
#ifndef KCOLORDIALOG_H
|
||||
#define KCOLORDIALOG_H
|
||||
|
||||
#include <QtGui/QTableWidget>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <kcolorchoosermode.h>
|
||||
|
||||
|
||||
/**
|
||||
* A table of editable color cells.
|
||||
*
|
||||
* @author Martin Jones <mjones@kde.org>
|
||||
*/
|
||||
class KDEUI_EXPORT KColorCells : public QTableWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool acceptDrags READ acceptDrags WRITE setAcceptDrags)
|
||||
Q_PROPERTY(bool shading READ shading WRITE setShading)
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs a new table of color cells, consisting of
|
||||
* @p rows * @p columns colors.
|
||||
*
|
||||
* @param parent The parent of the new widget
|
||||
* @param rows The number of rows in the table
|
||||
* @param columns The number of columns in the table
|
||||
*/
|
||||
KColorCells( QWidget *parent, int rows, int columns );
|
||||
~KColorCells();
|
||||
|
||||
/** Sets the color in the given index in the table */
|
||||
void setColor( int index, const QColor &col );
|
||||
/** Returns the color at a given index in the table */
|
||||
QColor color( int index ) const;
|
||||
/** Returns the total number of color cells in the table */
|
||||
int count() const;
|
||||
|
||||
void setShading(bool shade);
|
||||
bool shading() const;
|
||||
|
||||
void setAcceptDrags(bool acceptDrags);
|
||||
bool acceptDrags() const;
|
||||
|
||||
/** Sets the currently selected cell to @p index */
|
||||
void setSelected(int index);
|
||||
/** Returns the index of the cell which is currently selected */
|
||||
int selectedIndex() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/** Emitted when a color is selected in the table */
|
||||
void colorSelected( int index , const QColor& color );
|
||||
/** Emitted when a color in the table is double-clicked */
|
||||
void colorDoubleClicked( int index , const QColor& color );
|
||||
|
||||
protected:
|
||||
// the three methods below are used to ensure equal column widths and row heights
|
||||
// for all cells and to update the widths/heights when the widget is resized
|
||||
virtual int sizeHintForColumn(int column) const;
|
||||
virtual int sizeHintForRow(int column) const;
|
||||
virtual void resizeEvent( QResizeEvent* event );
|
||||
|
||||
virtual void mouseReleaseEvent( QMouseEvent * );
|
||||
virtual void mousePressEvent( QMouseEvent * );
|
||||
virtual void mouseMoveEvent( QMouseEvent * );
|
||||
virtual void dragEnterEvent( QDragEnterEvent * );
|
||||
virtual void dragMoveEvent( QDragMoveEvent * );
|
||||
virtual void dropEvent( QDropEvent *);
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * );
|
||||
|
||||
int positionToCell(const QPoint &pos, bool ignoreBorders=false) const;
|
||||
|
||||
private:
|
||||
class KColorCellsPrivate;
|
||||
friend class KColorCellsPrivate;
|
||||
KColorCellsPrivate *const d;
|
||||
|
||||
Q_DISABLE_COPY(KColorCells)
|
||||
};
|
||||
|
||||
/**
|
||||
* @short A color displayer.
|
||||
*
|
||||
* The KColorPatch widget is a (usually small) widget showing
|
||||
* a selected color e.g. in the KColorDialog. It
|
||||
* automatically handles drag and drop from and on the widget.
|
||||
*
|
||||
* \image html kcolorpatch.png "KDE Color Patch"
|
||||
*/
|
||||
class KDEUI_EXPORT KColorPatch : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
|
||||
public:
|
||||
KColorPatch( QWidget *parent );
|
||||
virtual ~KColorPatch();
|
||||
|
||||
/**
|
||||
* Get the currently displayed color
|
||||
*/
|
||||
QColor color() const;
|
||||
|
||||
/**
|
||||
* Set the color to display and update the display
|
||||
*
|
||||
* @param col color to display
|
||||
*/
|
||||
void setColor( const QColor &col );
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever the current color
|
||||
* changes due to a drop event
|
||||
*/
|
||||
void colorChanged(const QColor&);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent ( QPaintEvent * pe );
|
||||
virtual void mouseMoveEvent( QMouseEvent * );
|
||||
virtual void dragEnterEvent( QDragEnterEvent *);
|
||||
virtual void dropEvent( QDropEvent *);
|
||||
|
||||
private:
|
||||
class KColorPatchPrivate;
|
||||
KColorPatchPrivate *const d;
|
||||
|
||||
Q_DISABLE_COPY(KColorPatch)
|
||||
};
|
||||
|
||||
/**
|
||||
* @short A color selection dialog.
|
||||
*
|
||||
* <b>Features:</b>\n
|
||||
*
|
||||
* @li Color selection from a wide range of palettes.
|
||||
* @li Color selection from a palette of H vs S and V selectors.
|
||||
* @li Direct input of HSV or RGB values.
|
||||
* @li Saving of custom colors
|
||||
*
|
||||
* In most cases, you will want to use the static method KColorDialog::getColor().
|
||||
* This pops up the dialog (with an initial selection provided by you), lets the
|
||||
* user choose a color, and returns.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* \code
|
||||
* QColor myColor;
|
||||
* int result = KColorDialog::getColor( myColor );
|
||||
* if ( result == KColorDialog::Accepted )
|
||||
* ...
|
||||
* \endcode
|
||||
*
|
||||
* To react to the color selection as it is being selected, the colorSelected() signal
|
||||
* can be used. This can be used still in a modal way, for example:
|
||||
*
|
||||
* \code
|
||||
* KColorDialog dialog(this);
|
||||
* connect(&dialog, SIGNAL(colorSelected(const QColor &)), this, SLOT(temporarilyChangeColor(const QColor &)));
|
||||
* QColor myColor;
|
||||
* dialog.setColor(myColor);
|
||||
* int result = dialog.exec();
|
||||
*
|
||||
* if ( result == KColorDialog::Accepted )
|
||||
* changeColor( dialog.color() );
|
||||
* else
|
||||
* temporarilyChangeColor(myColor); //change back to original color
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* @image html kcolordialog.png "KDE Color Dialog"
|
||||
*
|
||||
* The color dialog is really a collection of several widgets which can
|
||||
* you can also use separately: the quadratic plane in the top left of
|
||||
* the dialog is a KXYSelector. Right next to it is a KHSSelector
|
||||
* for choosing hue/saturation.
|
||||
*
|
||||
* On the right side of the dialog you see a KColorTable showing
|
||||
* a number of colors with a combo box which offers several predefined
|
||||
* palettes or a palette configured by the user. The small field showing
|
||||
* the currently selected color is a KColorPatch.
|
||||
*
|
||||
**/
|
||||
class KDEUI_EXPORT KColorDialog : public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isAlphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled)
|
||||
Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor)
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs a color selection dialog.
|
||||
*/
|
||||
explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
|
||||
/**
|
||||
* Destroys the color selection dialog.
|
||||
*/
|
||||
~KColorDialog();
|
||||
|
||||
/**
|
||||
* Returns the currently selected color.
|
||||
**/
|
||||
QColor color() const;
|
||||
|
||||
/**
|
||||
* Creates a modal color dialog, let the user choose a
|
||||
* color, and returns when the dialog is closed.
|
||||
*
|
||||
* The selected color is returned in the argument @p theColor.
|
||||
*
|
||||
* @param theColor if valid, specifies the color to be initially selected. On
|
||||
* return, holds the selected color.
|
||||
* @returns QDialog::result().
|
||||
*/
|
||||
static int getColor( QColor &theColor, QWidget *parent=0L );
|
||||
|
||||
/**
|
||||
* Creates a modal color dialog, lets the user choose a
|
||||
* color, and returns when the dialog is closed.
|
||||
*
|
||||
* The selected color is returned in the argument @p theColor.
|
||||
*
|
||||
* This version takes a @p defaultColor argument, which sets the color
|
||||
* selected by the "default color" checkbox. When this checkbox is checked,
|
||||
* the invalid color (QColor()) is returned into @p theColor.
|
||||
*
|
||||
* @param theColor if valid, specifies the color to be initially selected. On
|
||||
* return, holds the selected color.
|
||||
* @param defaultColor color selected by the "default color" checkbox
|
||||
* @returns QDialog::result().
|
||||
*/
|
||||
static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
|
||||
|
||||
/**
|
||||
* Gets the color from the pixel at point p on the screen.
|
||||
*/
|
||||
static QColor grabColor(const QPoint &p);
|
||||
|
||||
/**
|
||||
* Call this to make the dialog show a "Default Color" checkbox.
|
||||
* If this checkbox is selected, the dialog will return an "invalid" color (QColor()).
|
||||
* This can be used to mean "the default text color", for instance,
|
||||
* the one with the KDE text color on screen, but black when printing.
|
||||
*/
|
||||
void setDefaultColor( const QColor& defaultCol );
|
||||
|
||||
/**
|
||||
* @return the value passed to setDefaultColor
|
||||
*/
|
||||
QColor defaultColor() const;
|
||||
|
||||
/**
|
||||
* When set to true, the user is allowed to change the alpha component of the color.
|
||||
* The default value is false.
|
||||
* @since 4.5
|
||||
*/
|
||||
void setAlphaChannelEnabled(bool alpha);
|
||||
|
||||
/**
|
||||
* Returns true when the user can change the alpha channel.
|
||||
* @since 4.5
|
||||
*/
|
||||
bool isAlphaChannelEnabled() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Preselects a color.
|
||||
*/
|
||||
void setColor( const QColor &col );
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted when a color is selected.
|
||||
* Connect to this to monitor the color as it as selected if you are
|
||||
* not running modal.
|
||||
*/
|
||||
void colorSelected( const QColor &col );
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
|
||||
Q_PRIVATE_SLOT(d, void slotAlphaChanged( void ))
|
||||
Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
|
||||
Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
|
||||
Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
|
||||
Q_PRIVATE_SLOT(d, void slotVChanged( int ))
|
||||
Q_PRIVATE_SLOT(d, void slotAChanged( int ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorPicker())
|
||||
Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
|
||||
Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
|
||||
Q_PRIVATE_SLOT(d, void slotModeChanged( int id ))
|
||||
|
||||
/**
|
||||
* Write the settings of the dialog to config file.
|
||||
**/
|
||||
Q_PRIVATE_SLOT(d, void slotWriteSettings())
|
||||
|
||||
private:
|
||||
/**
|
||||
* Read the settings for the dialog from config file.
|
||||
**/
|
||||
void readSettings();
|
||||
|
||||
protected:
|
||||
virtual void mouseMoveEvent( QMouseEvent * );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * );
|
||||
virtual void keyPressEvent( QKeyEvent * );
|
||||
virtual bool eventFilter( QObject *obj, QEvent *ev );
|
||||
|
||||
private:
|
||||
class KColorDialogPrivate;
|
||||
KColorDialogPrivate *const d;
|
||||
|
||||
Q_DISABLE_COPY(KColorDialog)
|
||||
};
|
||||
|
||||
#endif // KCOLORDIALOG_H
|
|
@ -1,72 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2007 Olivier Goffart
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KCOLORDIALOGP_H
|
||||
#define KCOLORDIALOGP_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace KDEPrivate {
|
||||
|
||||
/**
|
||||
* A color palette in table form.
|
||||
*
|
||||
* @author Waldo Bastian <bastian@kde.org>
|
||||
**/
|
||||
class KColorTable : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KColorTable( QWidget *parent, int minWidth=210, int cols = 16);
|
||||
~KColorTable();
|
||||
|
||||
void addToCustomColors( const QColor &);
|
||||
void addToRecentColors( const QColor &);
|
||||
|
||||
QString name() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setColors(const QString &collectionName);
|
||||
|
||||
Q_SIGNALS:
|
||||
void colorSelected( const QColor &, const QString & );
|
||||
void colorDoubleClicked( const QColor &, const QString & );
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(d, void slotColorCellSelected( int index , const QColor& ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorCellDoubleClicked( int index , const QColor& ))
|
||||
Q_PRIVATE_SLOT(d, void slotColorTextSelected( const QString &colorText ))
|
||||
Q_PRIVATE_SLOT(d, void slotSetColors( const QString &_collectionName ))
|
||||
|
||||
void readNamedColor( void );
|
||||
|
||||
private:
|
||||
virtual void setPalette(const QPalette& p) { QWidget::setPalette(p); }
|
||||
|
||||
private:
|
||||
class KColorTablePrivate;
|
||||
friend class KColorTablePrivate;
|
||||
KColorTablePrivate *const d;
|
||||
|
||||
Q_DISABLE_COPY(KColorTable)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -78,12 +78,12 @@ public:
|
|||
*
|
||||
* Example code:
|
||||
* \code
|
||||
* void KColorCells::mousePressEvent( QMouseEvent *e )
|
||||
* void KColorButton::mousePressEvent( QMouseEvent *e )
|
||||
* {
|
||||
* mOldPos = e->pos();
|
||||
* }
|
||||
*
|
||||
* void KColorCells::mouseMoveEvent( QMouseEvent *e )
|
||||
* void KColorButton::mouseMoveEvent( QMouseEvent *e )
|
||||
* {
|
||||
* if( !(e->state() && LeftButton)) return;
|
||||
*
|
||||
|
|
|
@ -56,7 +56,6 @@ KDEUI_UNIT_TESTS(
|
|||
kselectaction_unittest
|
||||
klistwidgetsearchlinetest
|
||||
kconfigdialog_unittest
|
||||
kcolorbuttontest
|
||||
kglobalshortcuttest
|
||||
klinkitemselectionmodeltest
|
||||
kstandardactiontest
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
Copyright 2013 Albert Astals Cid <aacid@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QtTestGui>
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "kcolorbuttontest.h"
|
||||
#include "qtest_kde.h"
|
||||
#include "kcolorbutton.h"
|
||||
#include "kcolordialog.h"
|
||||
#include "kstandarddirs.h"
|
||||
|
||||
QTEST_KDEMAIN(KColorButtonTest, GUI)
|
||||
|
||||
#include "moc_kcolorbuttontest.cpp"
|
||||
|
||||
void KColorButtonTest::initTestCase()
|
||||
{
|
||||
if (KStandardDirs::locate("config", "colors/40.colors").isEmpty()) {
|
||||
// e.g. kdelibs not installed
|
||||
QSKIP("40.colors not found", SkipAll);
|
||||
}
|
||||
|
||||
black40Colors.setHsv(-1, 0, 0);
|
||||
}
|
||||
|
||||
void KColorButtonTest::testChangeAndCancel()
|
||||
{
|
||||
KColorButton colorButton(Qt::red);
|
||||
colorButton.show();
|
||||
QVERIFY(QTest::qWaitForWindowShown(&colorButton));
|
||||
QTest::mouseClick(&colorButton, Qt::LeftButton);
|
||||
KColorDialog *dialog = colorButton.findChild<KColorDialog*>();
|
||||
QVERIFY(dialog != NULL);
|
||||
QVERIFY(QTest::qWaitForWindowShown(dialog));
|
||||
KColorCells *cells = dialog->findChild<KColorCells*>();
|
||||
QVERIFY(cells != NULL);
|
||||
QTest::mouseClick(cells->viewport(), Qt::LeftButton, 0, QPoint(1, 1));
|
||||
QCOMPARE(dialog->color(), black40Colors);
|
||||
dialog->reject();
|
||||
QCOMPARE(colorButton.color(), QColor(Qt::red));
|
||||
}
|
||||
|
||||
void KColorButtonTest::testDoubleClickChange()
|
||||
{
|
||||
KColorButton colorButton(Qt::red);
|
||||
colorButton.show();
|
||||
QVERIFY(QTest::qWaitForWindowShown(&colorButton));
|
||||
QTest::mouseClick(&colorButton, Qt::LeftButton);
|
||||
KColorDialog *dialog = colorButton.findChild<KColorDialog*>();
|
||||
QVERIFY(dialog != NULL);
|
||||
QVERIFY(QTest::qWaitForWindowShown(dialog));
|
||||
KColorCells *cells = dialog->findChild<KColorCells*>();
|
||||
QVERIFY(cells != NULL);
|
||||
QTest::mouseDClick(cells->viewport(), Qt::LeftButton, 0, QPoint(1, 1));
|
||||
QCOMPARE(colorButton.color(), black40Colors);
|
||||
}
|
||||
|
||||
void KColorButtonTest::testOkChange()
|
||||
{
|
||||
KColorButton colorButton(Qt::red);
|
||||
colorButton.show();
|
||||
QVERIFY(QTest::qWaitForWindowShown(&colorButton));
|
||||
QTest::mouseClick(&colorButton, Qt::LeftButton);
|
||||
KColorDialog *dialog = colorButton.findChild<KColorDialog*>();
|
||||
QVERIFY(dialog != NULL);
|
||||
QVERIFY(QTest::qWaitForWindowShown(dialog));
|
||||
KColorCells *cells = dialog->findChild<KColorCells*>();
|
||||
QVERIFY(cells != NULL);
|
||||
QTest::mouseClick(cells->viewport(), Qt::LeftButton, 0, QPoint(1, 1));
|
||||
QCOMPARE(dialog->color(), black40Colors);
|
||||
|
||||
QSignalSpy okClickedSpy(dialog, SIGNAL(okClicked()));
|
||||
const QDialogButtonBox *buttonBox = dialog->findChild<QDialogButtonBox*>();
|
||||
const QList<QAbstractButton *> buttons = buttonBox->buttons();
|
||||
foreach(QAbstractButton *button, buttons) {
|
||||
if (buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||
QTest::mouseClick(button, Qt::LeftButton);
|
||||
break;
|
||||
}
|
||||
}
|
||||
QCOMPARE(okClickedSpy.count(), 1);
|
||||
|
||||
QCOMPARE(colorButton.color(), black40Colors);
|
||||
}
|
||||
|
||||
void KColorButtonTest::testRecentColorsPick()
|
||||
{
|
||||
KColorButton colorButton(Qt::red);
|
||||
colorButton.show();
|
||||
QVERIFY(QTest::qWaitForWindowShown(&colorButton));
|
||||
QTest::mouseClick(&colorButton, Qt::LeftButton);
|
||||
KColorDialog *dialog = colorButton.findChild<KColorDialog*>();
|
||||
QVERIFY(dialog != NULL);
|
||||
QVERIFY(QTest::qWaitForWindowShown(dialog));
|
||||
|
||||
QComboBox *combo = dialog->findChild<QComboBox*>();
|
||||
combo->setFocus();
|
||||
QTest::keyPress(combo, Qt::Key_Up);
|
||||
QTest::keyPress(combo, Qt::Key_Up);
|
||||
|
||||
KColorCells *cells = dialog->findChild<KColorCells*>();
|
||||
QVERIFY(cells != NULL);
|
||||
QTest::mouseMove(cells->viewport(), QPoint(1, 1));
|
||||
QTest::mouseClick(cells->viewport(), Qt::LeftButton, 0, QPoint(30, 1));
|
||||
const QColor color = dialog->color();
|
||||
dialog->accept();
|
||||
QCOMPARE(colorButton.color(), color);
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
Copyright 2013 Albert Astals Cid <aacid@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KCOLORBUTTONTEST_H
|
||||
#define KCOLORBUTTONTEST_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
class KColorButtonTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testChangeAndCancel();
|
||||
void testDoubleClickChange();
|
||||
void testOkChange();
|
||||
void testRecentColorsPick();
|
||||
|
||||
private:
|
||||
QColor black40Colors;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
// KDE includes
|
||||
#include <kactioncollection.h>
|
||||
#include <kcolordialog.h>
|
||||
#include <kcolorscheme.h>
|
||||
#include <kfontaction.h>
|
||||
#include <kfontsizeaction.h>
|
||||
|
@ -30,8 +29,9 @@
|
|||
#include <ktoggleaction.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
// Qt includes
|
||||
// Katie includes
|
||||
#include <QtGui/QTextList>
|
||||
#include <QtGui/QColorDialog>
|
||||
|
||||
#include "klinkdialog.h"
|
||||
|
||||
|
@ -637,13 +637,14 @@ void KRichTextWidget::Private::_k_updateMiscActions()
|
|||
void KRichTextWidget::Private::_k_setTextForegroundColor()
|
||||
{
|
||||
QColor currentTextForegroundColor = q->textColor();
|
||||
|
||||
const int result = KColorDialog::getColor(currentTextForegroundColor, KColorScheme(QPalette::Active, KColorScheme::View).foreground().color() , q);
|
||||
if (result != QDialog::Accepted)
|
||||
return;
|
||||
if (!currentTextForegroundColor.isValid())
|
||||
currentTextForegroundColor = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color() ;
|
||||
|
||||
const QColor colorSchemeColor = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
|
||||
if (!currentTextForegroundColor.isValid()) {
|
||||
currentTextForegroundColor = colorSchemeColor;
|
||||
}
|
||||
currentTextForegroundColor = QColorDialog::getColor(currentTextForegroundColor, q, KDialog::makeStandardCaption(i18n("Select Color"), q));
|
||||
if (!currentTextForegroundColor.isValid()) {
|
||||
currentTextForegroundColor = colorSchemeColor;
|
||||
}
|
||||
q->setTextForegroundColor(currentTextForegroundColor);
|
||||
|
||||
}
|
||||
|
@ -652,13 +653,14 @@ void KRichTextWidget::Private::_k_setTextBackgroundColor()
|
|||
{
|
||||
QTextCharFormat fmt = q->textCursor().charFormat();
|
||||
QColor currentTextBackgroundColor = fmt.background().color();
|
||||
|
||||
const int result = KColorDialog::getColor(currentTextBackgroundColor, KColorScheme(QPalette::Active, KColorScheme::View).foreground().color() , q);
|
||||
if (result != QDialog::Accepted)
|
||||
return;
|
||||
if (!currentTextBackgroundColor.isValid())
|
||||
currentTextBackgroundColor = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color() ;
|
||||
|
||||
const QColor colorSchemeColor = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
|
||||
if (!currentTextBackgroundColor.isValid()) {
|
||||
currentTextBackgroundColor = colorSchemeColor;
|
||||
}
|
||||
currentTextBackgroundColor = QColorDialog::getColor(currentTextBackgroundColor, q, KDialog::makeStandardCaption(i18n("Select Color"), q));
|
||||
if (!currentTextBackgroundColor.isValid()) {
|
||||
currentTextBackgroundColor = colorSchemeColor;
|
||||
}
|
||||
q->setTextBackgroundColor(currentTextBackgroundColor);
|
||||
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
* Action to change the text color of the currently selected text. If no
|
||||
* text is selected, the text color of the word under the cursor is
|
||||
* changed.
|
||||
* Opens a KColorDialog to select the color.
|
||||
* Opens a QColorDialog to select the color.
|
||||
*/
|
||||
SupportTextForegroundColor = 0x40,
|
||||
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
* Action to change the background color of the currently selected text. If no
|
||||
* text is selected, the backgound color of the word under the cursor is
|
||||
* changed.
|
||||
* Opens a KColorDialog to select the color.
|
||||
* Opens a QColorDialog to select the color.
|
||||
*/
|
||||
SupportTextBackgroundColor = 0x80,
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ using KDEPrivate::fillOpaqueRect;
|
|||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
* 1D value selector with contents drawn by derived class.
|
||||
* See KColorDialog for example.
|
||||
*/
|
||||
|
||||
#define ARROWSIZE 5
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
* KXYSelector is the base class for other widgets which
|
||||
* provides the ability to choose from a two-dimensional
|
||||
* range of values. The currently chosen value is indicated
|
||||
* by a cross. An example is the KHSSelector which
|
||||
* allows to choose from a range of colors, and which is
|
||||
* used in KColorDialog.
|
||||
* by a cross.
|
||||
*
|
||||
* A custom drawing routine for the widget surface has
|
||||
* to be provided by the subclass.
|
||||
|
|
|
@ -29,22 +29,10 @@ ToolTip=Color Chooser Button (KDE)
|
|||
WhatsThis=A button that allows selecting a color
|
||||
Group=Graphics (KDE)
|
||||
|
||||
[KColorCells]
|
||||
IncludeFile=kcolordialog.h
|
||||
ToolTip=Color Table (KDE)
|
||||
Group=Input (KDE)
|
||||
ConstructorArgs=(parent, 3, 5)
|
||||
|
||||
[KColorCombo]
|
||||
ToolTip=Color Combo Box (KDE)
|
||||
Group=Graphics (KDE)
|
||||
|
||||
[KColorPatch]
|
||||
IncludeFile=kcolordialog.h
|
||||
ToolTip=The KColorPatch widget is a (usually small) widget showing a selected color.
|
||||
Group=Display (KDE)
|
||||
ConstructorArgs=(parent)
|
||||
|
||||
[KColorValueSelector]
|
||||
IncludeFile=kcolorvalueselector.h
|
||||
ToolTip=Color Value Selector (KDE)
|
||||
|
|
Loading…
Add table
Reference in a new issue