-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdevelopwindow.h
More file actions
593 lines (483 loc) · 17 KB
/
developwindow.h
File metadata and controls
593 lines (483 loc) · 17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
/*
* File: developwindow.h
* ------------------------
* This file is the header file for the main window of the
* software. It can be triggered by the hello window. It consists
* of all the tools that users will use with this image editor.
* It defines a class called developWindow and an enum that
* contains all the adjustments.
*/
#ifndef DEVELOPWINDOW_H
#define DEVELOPWINDOW_H
#include <QMainWindow>
#include <QImage>
#include <QLabel>
#include <QTextCodec>
#include<cv.h>
#include <vector>
#include<opencv2/opencv.hpp>
#include "main_pic.h"
using namespace std;
/*
* enum: adjust
* ------------
* This enum stores all the adjustments which apply the
* Qslider. It helps with previously used adjustments.
*/
enum adjust {
Set, // undefined adjust
Hue,
Satuation,
Brightness,
HSL_adj,
Geo_up,
Geo_down,
Contrast,
Brightness_2,
Rotate_adj,
Shadow_adj,
Highlight_adj,
Warmth_adj,
Satuation_2_adj,
Blur_adj,
Sharpen_adj
};
enum button {
Architecture,
Black_white,
Plant,
Portrait,
Remove_flaw,
Sketch,
Waterscape,
Vintage,
Border,
Whitebalance,
Rotate_left,
Rotate_right,
Flip,
};
namespace Ui {
/*
* Class: developWindow
* --------------------
* The is the main window for the software.
* It can be triggered by hello window.
*/
class developWindow;
}
class developWindow : public QMainWindow
{
Q_OBJECT
public:
/*
* Constructor: developWindow
* ------------------------------
* Initializes the developWindow.
*/
explicit developWindow(QWidget *parent = 0);
/*
* Destructor: ~developWindow
* --------------------------
* Destruct the developWindow
*/
~developWindow();
private slots:
// Functions that have no connection with image
// adjustment
/*
* Method: on_actionUndo_triggered
* Usage on_actionUndo_triggered();
* --------------------------------
* This is a private slot for the undo button
* in the menubar. It discards the latest change
* and show the previous image.
*/
void on_actionUndo_triggered();
/*
* Method: on_actionRecover_triggered
* Usage on_actionRecover_triggered();
* ----------------------------------
* This is a private slot for the Recover button
* in the menubar. It discards all changes and reture
* the image to its original form and all
* sliders to its original position
*/
void on_actionRecover_triggered();
/*
* Method: on_actionOrginal_triggered
* Usage on_actionOrginal_triggered();
* ----------------------------------
* This is a private slot for the Original button
* in the menubar. It shows the original compressed
* image
*/
void on_actionOrginal_triggered();
/*
* Method: on_actionPresent_triggered
* Usage on_actionPresent_triggered();
* ----------------------------------
* This is a private slot for the Present button
* in the menubar. It shows the latest version
* of image that user has changed.
*/
void on_actionPresent_triggered();
/*
* Method: on_Donebutton_clicked
* Usage on_Donebutton_clicked();
* ------------------------------
* This is a private slot for the Done button
* in main window. It applies the latest change
* to the large picture and returns all the sliders
* to their original position.
*/
void on_Donebutton_clicked();
/*
* Method: on_actionOpen_file_triggered
* Usage on_actionOpen_file_triggered();
* ----------------------------------
* This is a private slot for the Open button
* in the menubar. It opens the image and creates
* the small image.
*/
void on_actionOpen_file_triggered();
/*
* Method: on_actionSave_triggered
* Usage on_actionSave_triggered();
* --------------------------------
* This is a private slot for the Save button
* in the menubar. It Save the large image to the disk.
*/
void on_actionSave_triggered();
/*
* Method: on_actionfull_picture_triggered
* Usage on_actionfull_picture_triggered();
* ----------------------------------
* This is a private slot for the full picture button
* in the menubar. It shows the latest large image.
*/
void on_actionfull_picture_triggered();
// adjustment methods
/*
* Method: on_satuation_valueChanged
* Usage on_satuation_valueChanged(value);
* ----------------------------------
* This is a private slot for the satuation slider
* belonging to the HSL function. It delivers the
* value to the satuation function and apply it
* to the dst image.
*/
void on_satuation_valueChanged(int value);
/*
* Method: on_hue_valueChanged
* Usage on_hue_valueChanged(value);
* ----------------------------------
* This is a private slot for the hue slider
* belonging to the HSL function. It delivers the
* value to the hue function and apply it
* to the dst image.
*/
void on_hue_valueChanged(int value);
/*
* Method: on_brightness_valueChanged
* Usage on_brightness_valueChanged(value);
* ----------------------------------
* This is a private slot for the brightness slider
* belonging to the HSL function. It delivers the
* value to the brightness function and apply it
* to the dst image.
*/
void on_brightness_valueChanged(int value);
/*
* Method: on_colour_choose_valueChanged
* Usage on_colour_choose_valueChanged(value);
* ----------------------------------
* This is a private slot for the colour slider
* belonging to the HSL function. It chooses the
* colour for the modification of the HSL function
*/
void on_colour_choose_valueChanged(int value);
/*
* Method: on_geometry_valueChanged
* Usage on_geometry_valueChanged(value);
* ----------------------------------
* This is a private slot for the geometry transform
* slider. It applies the affine transformation using
* the upper two position points.
*/
void on_geometry_valueChanged(int value);
/*
* Method: on_geometric_below_valueChanged
* Usage on_geometric_below_valueChanged(value);
* ----------------------------------
* This is a private slot for the geometry transform
* slider. It applies the affine transformation using
* the lower two position points.
*/
void on_geometric_below_valueChanged(int value);
/*
* Method: on_contrast_valueChanged
* Usage on_contrast_valueChanged(value);
* ----------------------------------
* This is a private slot for the contrast
* slider. It changes the contrast value for
* the small image.
*/
void on_contrast_valueChanged(int value);
/*
* Method: on_brightness_2_valueChanged
* Usage on_brightness_2_valueChanged(value);
* ----------------------------------
* This is a private slot for the brightness_2
* slider. It changes the general brightness value
* for the small image.
*/
void on_brightness_2_valueChanged(int value);
/*
* Method: on_whitebalance_clicked
* Usage on_whitebalance_clicked();
* ----------------------------------
* This is a private slot for the whitebalance
* button. It automatically changes the general
* whitebalance value for the small image and the
* large image.
*/
void on_whitebalance_clicked();
/*
* Method: on_rotation_valueChanged
* Usage on_rotation_valueChanged(value);
* ----------------------------------
* This is a private slot for the rotation
* slider. It ratates the small image clockwisely
* according to the input value as the angle.
*/
void on_rotation_valueChanged(int value);
/*
* Method: on_actionflip_triggered
* Usage on_actionflip_triggered();
* ----------------------------------
* This is a private slot for the flip button in
* the menubar. It horizontally flips the small image
* and the large image.
*/
void on_actionflip_triggered();
/*
* Method: on_actionrotateright_triggered
* Usage on_actionrotateright_triggered();
* ----------------------------------
* This is a private slot for the rotateright
* button in the menubar. It clockwisely rotates
* the small image and the large image
* for 90 degrees.
*/
void on_actionrotateright_triggered();
/*
* Method: on_actionrotateleft_triggered
* Usage on_actionrotateleft_triggered();
* ----------------------------------
* This is a private slot for the rotateleft
* button in the menubar. It anticlockwisely rotates
* the small image and the large image
* for 90 degrees.
*/
void on_actionrotateleft_triggered();
/*
* Method: on_actioncrop_pic_triggered
* Usage on_actioncrop_pic_triggered();
* ----------------------------------
* This is a private slot for the Crop
* button. It creates a new window and asks
* the user to draw a rectangle and crops that
* part of the image. Then both the large and
* the small pictures are cropped.
*/
void on_actioncrop_pic_triggered();
/*
* Method: on_actionPortrait_triggered
* Usage on_actionPortrait_triggered();
* ----------------------------------
* This is a private slot for the portrait filter
* button in the menubar. It applies the protrait
* filter to the large and the small images.
*/
void on_actionPortrait_triggered();
/*
* Method: on_actionRemoveFlaw_triggered
* Usage on_actionRemoveFlaw_triggered();
* ----------------------------------
* This is a private slot for the removeFlaw filter
* button in the menubar. It applies the removeFlaw
* filter to the large and the small images.
*/
void on_actionRemoveFlaw_triggered();
/*
* Method: on_actionWaterscape_triggered
* Usage on_actionWaterscape_triggered();
* ----------------------------------
* This is a private slot for the Waterscape filter
* button in the menubar. It applies the Waterscape
* filter to the large and the small images.
*/
void on_actionWaterscape_triggered();
/*
* Method: on_actionArchitecture_triggered
* Usage on_actionArchitecture_triggered();
* ----------------------------------
* This is a private slot for the Architecture filter
* button in the menubar. It applies the Architecture
* filter to the large and the small images.
*/
void on_actionArchitecture_triggered();
/*
* Method: on_actionVintage_triggered
* Usage on_actionVintage_triggered();
* ----------------------------------
* This is a private slot for the Vintage filter
* button in the menubar. It applies the Vintage
* filter to the large and the small images.
*/
void on_actionVintage_triggered();
/*
* Method: on_actionSketch_triggered
* Usage on_actionSketch_triggered();
* ----------------------------------
* This is a private slot for the Sketch filter
* button in the menubar. It applies the Sketch
* filter to the large and the small images.
*/
void on_actionSketch_triggered();
/*
* Method: on_actionBlackAndWhite_triggered
* Usage on_actionBlackAndWhite_triggered();
* ----------------------------------
* This is a private slot for the BlackAndWhite filter
* button in the menubar. It applies the BlackAndWhite
* filter to the large and the small images.
*/
void on_actionBlackAndWhite_triggered();
/*
* Method: on_actionPlant_triggered
* Usage on_actionPlant_triggered();
* ----------------------------------
* This is a private slot for the Plant filter
* button in the menubar. It applies the plant
* filter to the large and the small images.
*/
void on_actionPlant_triggered();
/*
* Method: on_actionBorder_triggered
* Usage on_actionBorder_triggered();
* ----------------------------------
* This is a private slot for the Border filter
* button in the menubar. It applies the Border
* filter to the large and the small images.
*/
void on_actionBorder_triggered();
/*
* Method: on_shadow_valueChanged
* Usage on_shadow_valueChanged(value);
* ----------------------------------
* This is a private slot for the shadow slider
* in the main window. It changes the shadow of
* the small image according to the given value.
*/
void on_shadow_valueChanged(int value);
/*
* Method: on_highlight_valueChanged
* Usage on_highlight_valueChanged(value);
* ----------------------------------
* This is a private slot for the highlight slider
* in the main window. It changes the highlight of
* the small image according to the given value.
*/
void on_highlight_valueChanged(int value);
/*
* Method: on_highlight_valueChanged
* Usage on_highlight_valueChanged(value);
* ----------------------------------
* This is a private slot for the highlight slider
* in the main window. It changes the highlight of
* the small image according to the given value.
*/
void on_warmth_valueChanged(int value);
/*
* Method: on_satuation_full_valueChanged
* Usage on_satuation_full_valueChanged(value);
* ----------------------------------
* This is a private slot for the satuation_full slider
* in the main window. It changes the overall satuation of
* the small image according to the given value.
*/
void on_satuation_full_valueChanged(int value);
/*
* Method: on_blur_valueChanged
* Usage on_blur_valueChanged(value);
* ----------------------------------
* This is a private slot for the highlight slider
* in the main window. It changes the highlight of
* the small image according to the given value.
*/
void on_blur_valueChanged(int value);
/*
* Method: on_sharpen_valueChanged
* Usage on_sharpen_valueChanged(value);
* ----------------------------------
* This is a private slot for the sharpen slider
* in the main window. It sharpens the small image
* according to the given value.
*/
void on_sharpen_valueChanged(int value);
void slider_change(int value, adjust present_adjust);
void button_change(button Button_click);
// help function
/*
* Method: check_done
* Usage test = check_done(present_adjust);
* ----------------------------------
* This function checks whether the user
* has press the done button after he has
* moved one slider and now is moving another
* slider. If he has not pressed the done
* button, the function returns false.
*/
bool check_done(adjust present_adjust);
/*
* Method: slider_recover
* Usage slider_recover();
* ----------------------------------
* This function recovers every slider to its
* original position.
*/
void slider_recover();
void on_actionGo_Help_Page_triggered();
private:
Ui::developWindow *ui;
// current_adjust records all steps that involves moving slider.
vector<adjust> current_adjust = {Set};
// done_already indicates whether the software is read for the
// user to move another slider.
bool done_already = true;
// response indicates whether slider should respond to value change.
bool response = true;
// colour for hsl change.
int colour = 0;
//another indicator for colour of hsl.
int present_colour = 0;
// color_vec records all hsl data with its previously set value
vector<vector<int>> color_vec = {{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0}};
// initializing picture
cv::Mat pict = cv::Mat(2, 2, CV_8UC3, cv::Scalar::all(1));
// a frequently changed small picture, which is shown every time
cv::Mat dst = cv::Mat(2, 2, CV_8UC3, cv::Scalar::all(1));
// large picture which is changed when done is pressed.
cv::Mat dst_large = cv::Mat(2, 2, CV_8UC3, cv::Scalar::all(1));
// all picture data for manipulation.
main_pic main_picture;
};
#endif // DEVELOPWINDOW_H