IntelliPhoto  1
IntelliPhotoGui.cpp
Go to the documentation of this file.
1 // ---------- IntelliPhotoGui.cpp ----------
2 
3 #include "IntelliPhotoGui.h"
4 #include "Layer/PaintingArea.h"
5 
6 #include <QEvent>
7 #include <QCloseEvent>
8 #include <QDebug>
9 #include <string>
10 #include <QScreen>
11 #include <QGuiApplication>
12 
13 // IntelliPhotoGui constructor
15  // create Gui elements and lay them out
16  createGui();
17  // Create actions
18  createActions();
19  // create Menus
20  createMenus();
21  // set style of the gui
22  setIntelliStyle();
23  // Size the app
24  resize(600,600);
25  showMaximized();
26  setDefaultValues();
27 }
28 
29 // User tried to close the app
30 void IntelliPhotoGui::closeEvent(QCloseEvent*event){
31  // If they try to close maybeSave() returns true
32  // if no changes have been made and the app closes
33  if (maybeSave()) {
34  event->accept();
35  } else {
36  // If there have been changes ignore the event
37  event->ignore();
38  }
39 }
40 
41 // Check if the current image has been changed and then
42 // open a dialog to open a file
43 void IntelliPhotoGui::slotOpen(){
44  // Check if changes have been made since last save
45  // maybeSave() returns true if no changes have been made
46  if (maybeSave()) {
47 
48  // Get the file to open from a dialog
49  // tr sets the window title to Open File
50  // QDir opens the current dirctory
51  QString fileName = QFileDialog::getOpenFileName(this,
52  tr("Open File"), QDir::currentPath(), nullptr, nullptr, QFileDialog::DontUseNativeDialog);
53 
54  // If we have a file name load the image and place
55  // it in the paintingArea
56  if (!fileName.isEmpty()) {
57  bool rightFileType = true;
58  if(fileName.size()>=4) {
59  QString endung(".idf");
60  int length = fileName.size();
61  for(int i = 0; i<4; i++) {
62  if(endung[i]!=fileName[length - 4 + i]) {
63  rightFileType = false;
64  break;
65  }
66  }
67  }
68 
69  if(rightFileType) {
70  IntelliDatamanager::loadProject(paintingArea,fileName);
71  UpdateGui();
72 
73  }
74  else{
75  paintingArea->open(fileName);
76  }
77  }
78  }
79 }
80 
81 // Called when the user clicks Save As in the menu
82 void IntelliPhotoGui::slotSave(){
83  // A QAction represents the action of the user clicking
84  QAction*action = qobject_cast<QAction*>(sender());
85 
86  // Stores the array of bytes of the users data
87  QByteArray fileFormat = action->data().toByteArray();
88 
89  // Pass it to be saved
90  saveFile(fileFormat);
91 }
92 
93 // Opens a dialog that allows the user to create a New RASTER Layer
94 void IntelliPhotoGui::slotCreateNewRasterLayer(){
95  // Stores button value
96  bool ok1, ok2;
97 
98  // "New Layer" is the title of the window
99  // the next tr is the text to display
100  // Define the standard Value, min, max, step and ok button
101  int width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
102 
103  int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
104 
105  // Create New Layer
106  if (ok1&&ok2) {
107  paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
108  paintingArea->historyadd();
109  UpdateGui();
110  }
111 }
112 
113 // Opens a dialog that allows the user to create a New SHAPED Layer
114 void IntelliPhotoGui::slotCreateNewShapedLayer(){
115  // Stores button value
116  bool ok1, ok2;
117 
118  // "New Layer" is the title of the window
119  // the next tr is the text to display
120  // Define the standard Value, min, max, step and ok button
121  int width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
122 
123  int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
124 
125  // Create New Layer
126  if (ok1&&ok2) {
127  paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
128  paintingArea->historyadd();
129  UpdateGui();
130  }
131 }
132 
133 // Opens a dialog that allows the user to change Dimension
134 void IntelliPhotoGui::slotChangeDim(){
135  // Stores button value
136  bool ok1, ok2;
137 
138  // "change Dimension" is the title of the window
139  // the next tr is the text to display
140  // Define the standard Value, min, step and ok button
141  int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000, 1, &ok1);
142 
143  int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2);
144 
145 
146  // Change dimension
147  if (ok1&&ok2) {
148  paintingArea->setCanvasDimensions(width,height);
149  UpdateGui();
150  }
151 }
152 
153 // Opens a dialog that allows the user to delete a Layer
154 void IntelliPhotoGui::slotDeleteLayer(){
155 
156  bool ok1;
157  // "delete Layer" is the title of the window
158  // the next tr is the text to display
159  // Define the standard Value, min, max, step and ok button
160  int layerNumber = IntelliInputDialog::getInt("Delete Layer", "Number:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
161 
162  // Create New Layer
163  if(ok1) {
164  paintingArea->deleteLayer(layerNumber - 1);
165  paintingArea->historyadd();
166  UpdateGui();
167  }
168 }
169 
170 void IntelliPhotoGui::slotSetActiveAlpha(){
171 
172  bool ok1, ok2;
173  // "Layer to set on" is the title of the window
174  // the next tr is the text to display
175  // Define the standard Value, min, max, step and ok button
176 
177  int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
178 
179  // "New Alpha" is the title of the window
180  int alpha = IntelliInputDialog::getInt("Layer to set on", "Alpha:", 255, 0, 255, 1, &ok2);
181 
182  if (ok1&&ok2)
183  {
184  paintingArea->setLayerAlpha(layer - 1,alpha);
185  UpdateGui();
186  }
187 }
188 
189 void IntelliPhotoGui::slotSetPolygon(){
190  // Stores button value
191  bool ok1;
192 
193  // "Layer to set on" is the title of the window
194  // the next tr is the text to display
195  // Define the standard Value, min, max, step and ok button
196  int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
197 
198  if (ok1)
199  {
200  paintingArea->setPolygon(layer - 1);
201  UpdateGui();
202  }
203 }
204 
205 void IntelliPhotoGui::slotPositionMoveUp(){
206  paintingArea->movePositionActive(0,-20);
207  update();
208 }
209 
210 void IntelliPhotoGui::slotPositionMoveDown(){
211  paintingArea->movePositionActive(0,20);
212  update();
213 }
214 
215 void IntelliPhotoGui::slotPositionMoveLeft(){
216  paintingArea->movePositionActive(-20,0);
217  update();
218 }
219 
220 void IntelliPhotoGui::slotPositionMoveRight(){
221  paintingArea->movePositionActive(20,0);
222  update();
223 }
224 
225 void IntelliPhotoGui::slotMoveLayerUp(){
226  paintingArea->moveActiveLayer(1);
227  update();
228 }
229 
230 void IntelliPhotoGui::slotMoveLayerDown(){
231  paintingArea->moveActiveLayer(-1);
232  update();
233 }
234 
235 void IntelliPhotoGui::slotSetActiveLayer(){
236  bool ok1;
237  // "Layer to set on" is the title of the window
238  // the next tr is the text to display
239  // Define the standard Value, min, max, step and ok button
240  int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
241 
242  if(ok1) {
243  paintingArea->setLayerActive(layer - 1);
244  UpdateGui();
245  }
246 }
247 
248 void IntelliPhotoGui::slotUpdateFastRenderSettingsOn(){
249  paintingArea->setRenderSettings(true);
250  FastRendererLabel->setText("Fast Render: On");
251  UpdateGui();
252 }
253 
254 void IntelliPhotoGui::slotUpdateFastRenderSettingsOff(){
255  paintingArea->setRenderSettings(false);
256  FastRendererLabel->setText("Fast Render: Off");
257  UpdateGui();
258 }
259 
260 void IntelliPhotoGui::slotSetFirstColor(){
261  paintingArea->colorPickerSetFirstColor();
262  UpdateGui();
263 }
264 
265 void IntelliPhotoGui::slotSetSecondColor(){
266  paintingArea->colorPickerSetSecondColor();
267  UpdateGui();
268 }
269 
270 void IntelliPhotoGui::slotSwapColor(){
271  paintingArea->colorPickerSwapColors();
272  UpdateGui();
273 }
274 
275 void IntelliPhotoGui::slotCreatePenTool(){
276  PenButton->setChecked(true);
277  paintingArea->createPenTool();
278 }
279 
280 void IntelliPhotoGui::slotCreatePlainTool(){
281  PlainButton->setChecked(true);
282  paintingArea->createPlainTool();
283 }
284 
285 void IntelliPhotoGui::slotCreateLineTool(){
286  LineButton->setChecked(true);
287  paintingArea->createLineTool();
288 }
289 
290 void IntelliPhotoGui::slotCreateRectangleTool(){
291  RectangleButton->setChecked(true);
292  paintingArea->createRectangleTool();
293 }
294 
295 void IntelliPhotoGui::slotCreateCircleTool(){
296  CircleButton->setChecked(true);
297  paintingArea->createCircleTool();
298 }
299 
300 void IntelliPhotoGui::slotCreatePolygonTool(){
301  PolygonButton->setChecked(true);
302  paintingArea->createPolygonTool();
303 }
304 
305 void IntelliPhotoGui::slotCreateFloodFillTool(){
306  FloodFillButton->setChecked(true);
307  paintingArea->createFloodFillTool();
308 }
309 
310 void IntelliPhotoGui::slotCreateGradientTool(){
311  GradientButton->setChecked(true);
312  paintingArea->createGradientTool();
313 }
314 
315 // Open an about dialog
316 void IntelliPhotoGui::slotAboutDialog(){
317  // Window title and text to display
318  QMessageBox::about(this, tr("About Us"),
319  tr("<h1>About IntelliPhoto</h1><p>Version: v1.0<br>Developed by: Team 7<br>Interactive painting tool with layering and drawing capabilities.</p>"));
320 }
321 
322 void IntelliPhotoGui::slotEnterPressed(){
323  QString string = EditLineWidth->text();
324  if(string.toInt() > 50) {
325  EditLineWidth->setText("50");
326  }
327  paintingArea->Toolsettings.setLineWidth(string.toInt());
328  string = EditLineInnerAlpha->text();
329  if(string.toInt() > 255) {
330  EditLineInnerAlpha->setText("255");
331  }
332  paintingArea->Toolsettings.setInnerAlpha(string.toInt());
333 }
334 
335 void IntelliPhotoGui::slotResetToolButtons(){
336  CircleButton->setChecked(false);
337  FloodFillButton->setChecked(false);
338  GradientButton->setChecked(false);
339  LineButton->setChecked(false);
340  PenButton->setChecked(false);
341  PlainButton->setChecked(false);
342  PolygonButton->setChecked(false);
343  RectangleButton->setChecked(false);
344 }
345 
346 void IntelliPhotoGui::slotSetWidth(){
347  bool ok1;
348  int temp = IntelliInputDialog::getInt("Toolsettings", "Width:", 5, 1, 50, 1, &ok1);
349  if(ok1) {
350  paintingArea->Toolsettings.setLineWidth(temp);
351  EditLineWidth->setText(QString("%1").arg(temp));
352  }
353 }
354 
355 void IntelliPhotoGui::slotSetInnerAlpha(){
356  bool ok1;
357  int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1);
358  if(ok1) {
359  paintingArea->Toolsettings.setInnerAlpha(temp);
360  EditLineInnerAlpha->setText(QString("%1").arg(temp));
361  }
362 }
363 
364 void IntelliPhotoGui::slotGoBack(){
365  paintingArea->historyGoBack();
366 }
367 
368 void IntelliPhotoGui::slotGoForward(){
369  paintingArea->historyGoForward();
370 }
371 
372 // Define menu actions that call functions
373 void IntelliPhotoGui::createActions(){
374  // Get a list of the supported file formats
375  // QImageWriter is used to write images to files
376  foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
377  QString text = tr("%1...").arg(QString(format).toUpper());
378 
379  // Create an action for each file format
380  QAction*action = new QAction(text, this);
381 
382  // Set an action for each file format
383  action->setData(format);
384 
385  // When clicked call IntelliPhotoGui::save()
386  connect(action, SIGNAL(triggered()), this, SLOT(slotSave()));
387 
388  // Attach each file format option menu item to Save As
389  actionSaveAs.append(action);
390  }
391 
392  // Set exporter to actions
393  QAction*pngSaveAction = new QAction("PNG-8...", this);
394  pngSaveAction->setData("PNG");
395  // When clicked call IntelliPhotoGui::save()
396  connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
397  // Attach each PNG in save Menu
398  actionSaveAs.append(pngSaveAction);
399  pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
400 
401  // Create exit action and tie to IntelliPhotoGui::close()
402  actionExit = new QAction(tr("&Exit"), this);
403  actionExit->setShortcuts(QKeySequence::Quit);
404  connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
405 
406  actionOpen = new QAction(tr("&Open"), this);
407  actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
408  connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
409 
410  // Create New RASTER Layer action and tie to IntelliPhotoGui::newLayer()
411  actionCreateNewRasterLayer = new QAction(tr("&Raster Image"), this);
412  actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
413  connect(actionCreateNewRasterLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewRasterLayer()));
414 
415 
416  // Create New SHAPED Layer action and tie to IntelliPhotoGui::newLayer()
417  actionCreateNewShapedLayer = new QAction(tr("&Shaped Image"), this);
418  actionCreateNewShapedLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N + Qt::ALT));
419  connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer()));
420 
421  // Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
422  actionDeleteLayer = new QAction(tr("&Delete Layer"), this);
423  actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
424  connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
425 
426  actionChangeDim = new QAction(tr("&Change Dimension"), this);
427  actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X));
428  connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
429  connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim()));
430 
431  actionSetActiveLayer = new QAction(tr("&Set Active"), this);
432  actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
433  connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
434 
435  actionSetActiveAlpha = new QAction(tr("&Set Alpha"), this);
436  actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
437  connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
438 
439  actionSetPolygon = new QAction(tr("&Set Polygon Data"), this);
440  actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P));
441  connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon()));
442 
443  actionMovePositionUp = new QAction(tr("&Move Up"), this);
444  actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
445  connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
446 
447  actionMovePositionDown = new QAction(tr("&Move Down"), this);
448  actionMovePositionDown->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
449  connect(actionMovePositionDown, SIGNAL(triggered()), this, SLOT(slotPositionMoveDown()));
450 
451  actionMovePositionLeft = new QAction(tr("&Move Left"), this);
452  actionMovePositionLeft->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
453  connect(actionMovePositionLeft, SIGNAL(triggered()), this, SLOT(slotPositionMoveLeft()));
454 
455  actionMovePositionRight = new QAction(tr("&Move Right"), this);
456  actionMovePositionRight->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right));
457  connect(actionMovePositionRight, SIGNAL(triggered()), this, SLOT(slotPositionMoveRight()));
458 
459  actionMoveLayerUp = new QAction(tr("&Move Forth"), this);
460  actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up));
461  connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp()));
462 
463  actionMoveLayerDown = new QAction(tr("&Move Back"), this);
464  actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
465  connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
466 
467  // Create Update RenderSettings Actions here
468  actionUpdateFastRenderSettingsOn = new QAction(tr("&On"), this);
469  actionUpdateFastRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A));
470  connect(actionUpdateFastRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOn()));
471 
472  actionUpdateFastRenderSettingsOff = new QAction(tr("&Off"), this);
473  actionUpdateFastRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D));
474  connect(actionUpdateFastRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOff()));
475 
476  // Create Color Actions here
477  actionColorPickerFirstColor = new QAction(tr("&Main"), this);
478  actionColorPickerFirstColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_N));
479  connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
480  connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor()));
481 
482  actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
483  actionColorPickerSecondColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_M));
484  connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor()));
485  connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor()));
486 
487  actionColorSwap = new QAction(tr("&Switch"), this);
488  actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
489  connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor()));
490  connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor()));
491 
492  // Create Tool actions down here
493  actionCreatePlainTool = new QAction(tr("&Plain"), this);
494  actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_P));
495  connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
496  connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
497 
498 
499  actionCreatePenTool = new QAction(tr("&Pen"),this);
500  actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_S));
501  connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
502  connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
503 
504  actionCreateLineTool = new QAction(tr("&Line"), this);
505  actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_L));
506  connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
507  connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
508 
509  actionCreateCircleTool = new QAction(tr("&Circle"), this);
510  actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_C));
511  connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
512  connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
513 
514  actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
515  actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_R));
516  connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
517  connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
518 
519  actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
520  actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_V));
521  connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
522  connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
523 
524  actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
525  actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_F));
526  connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
527  connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
528 
529  actionCreateGradientTool = new QAction(tr("&Gradient"),this);
530  actionCreateGradientTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_G));
531  connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
532  connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool()));
533 
534  // Create about action and tie to IntelliPhotoGui::about()
535  actionAboutDialog = new QAction(tr("&About"), this);
536  connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
537 
538  // Create about Qt action and tie to IntelliPhotoGui::aboutQt()
539  actionAboutQtDialog = new QAction(tr("About &Qt"), this);
540  connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
541 
542  connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
543  connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
544 
545  connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
546  connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool()));
547 
548  connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
549  connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool()));
550 
551  connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
552  connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool()));
553 
554  connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
555  connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool()));
556 
557  connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
558  connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool()));
559 
560  connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
561  connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool()));
562 
563  connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
564  connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool()));
565 
566  connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
567  connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
568 
569  actionSetWidth = new QAction(tr("&Set Width"),this);
570  actionSetWidth->setShortcut(QKeySequence(Qt::ALT + Qt::Key_W));
571  connect(actionSetWidth, SIGNAL(triggered()), this, SLOT(slotSetWidth()));
572 
573  actionSetInnerAlpha = new QAction(tr("&Set Inner Alpha"),this);
574  actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
575  connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha()));
576 
577  actionGoBack = new QAction(tr("&Undo"),this);
578  actionGoBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
579  connect(actionGoBack, SIGNAL(triggered()), this, SLOT(slotGoBack()));
580 
581  actionGoForward = new QAction(tr("&Redo"),this);
582  actionGoForward->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
583  connect(actionGoForward, SIGNAL(triggered()), this, SLOT(slotGoForward()));
584 }
585 
586 // Create the menubar
587 void IntelliPhotoGui::createMenus(){
588  // Create Save As option and the list of file types
589  saveAsMenu = new QMenu(tr("&Export As"), this);
590  foreach (QAction * action, actionSaveAs)
591  saveAsMenu->addAction(action);
592 
593  // Attach all actions to file menu
594  fileMenu = new QMenu(tr("&File"), this);
595  fileMenu->addAction(actionOpen);
596  fileMenu->addMenu(saveAsMenu);
597  fileMenu->addSeparator();
598  fileMenu->addAction(actionExit);
599 
600  // Attach the save project option to file menu
601  QAction*projectSaveAction = new QAction("Save Project", this);
602  projectSaveAction->setData("idf");
603  connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
604  projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
605  fileMenu->addAction(projectSaveAction);
606 
607  // Attach all actions to Render Settings
608  renderMenu = new QMenu(tr("&Fast Renderer"), this);
609  renderMenu->addAction(actionUpdateFastRenderSettingsOn);
610  renderMenu->addAction(actionUpdateFastRenderSettingsOff);
611 
612  // Attach all Layer Creations to Menu
613  layerCreationMenu = new QMenu(tr("&Create Layer"), this);
614  layerCreationMenu->addAction(actionCreateNewRasterLayer);
615  layerCreationMenu->addAction(actionCreateNewShapedLayer);
616 
617  // Attach all actions to Layer
618  layerMenu = new QMenu(tr("&Layer"), this);
619  layerMenu->addMenu(layerCreationMenu);
620  layerMenu->addSeparator();
621  layerMenu->addAction(actionSetActiveAlpha);
622  layerMenu->addAction(actionSetActiveLayer);
623  layerMenu->addAction(actionSetPolygon);
624  layerMenu->addSeparator();
625  layerMenu->addAction(actionMovePositionUp);
626  layerMenu->addAction(actionMovePositionDown);
627  layerMenu->addAction(actionMovePositionLeft);
628  layerMenu->addAction(actionMovePositionRight);
629  layerMenu->addAction(actionMoveLayerUp);
630  layerMenu->addAction(actionMoveLayerDown);
631  layerMenu->addSeparator();
632  layerMenu->addAction(actionDeleteLayer);
633 
634  // Attach all Color Options
635  colorMenu = new QMenu(tr("&Color"), this);
636  colorMenu->addAction(actionColorPickerFirstColor);
637  colorMenu->addAction(actionColorPickerSecondColor);
638  colorMenu->addAction(actionColorSwap);
639 
640  // Attach all Tool Creation Actions
641  toolCreationMenu = new QMenu(tr("&Tool Selection"), this);
642  toolCreationMenu->addAction(actionCreateCircleTool);
643  toolCreationMenu->addAction(actionCreateFloodFillTool);
644  toolCreationMenu->addAction(actionCreateGradientTool);
645  toolCreationMenu->addAction(actionCreateLineTool);
646  toolCreationMenu->addAction(actionCreatePenTool);
647  toolCreationMenu->addAction(actionCreatePlainTool);
648  toolCreationMenu->addAction(actionCreatePolygonTool);
649  toolCreationMenu->addAction(actionCreateRectangleTool);
650 
651  // Attach all Tool Setting Actions
652  toolSettingsMenu = new QMenu(tr("&Tool Settings"), this);
653  toolSettingsMenu->addAction(actionSetWidth);
654  toolSettingsMenu->addAction(actionSetInnerAlpha);
655 
656  // Attach all Tool Options
657  toolMenu = new QMenu(tr("&Tools"), this);
658  toolMenu->addMenu(toolCreationMenu);
659  toolMenu->addMenu(toolSettingsMenu);
660 
661  // Attach all actions to Options
662  optionMenu = new QMenu(tr("&Options"), this);
663  optionMenu->addAction(actionGoBack);
664  optionMenu->addAction(actionGoForward);
665  optionMenu->addSeparator();
666  optionMenu->addMenu(renderMenu);
667  optionMenu->addAction(actionChangeDim);
668 
669  // Attach all actions to Help
670  helpMenu = new QMenu(tr("&Help"), this);
671  helpMenu->addAction(actionAboutDialog);
672  helpMenu->addAction(actionAboutQtDialog);
673 
674  // Add menu items to the menubar
675  menuBar()->addMenu(fileMenu);
676  menuBar()->addMenu(optionMenu);
677  menuBar()->addMenu(layerMenu);
678  menuBar()->addMenu(toolMenu);
679  menuBar()->addMenu(colorMenu);
680  menuBar()->addMenu(helpMenu);
681 }
682 
683 void IntelliPhotoGui::createGui(){
684  // create a central widget to work on
685  centralGuiWidget = new QWidget(this);
686  setCentralWidget(centralGuiWidget);
687 
688  // create the grid for the layout
689  mainLayout = new QGridLayout(centralGuiWidget);
690  centralGuiWidget->setLayout(mainLayout);
691 
692  // create Gui elements
693  // get and set max width and height
694  paintingArea = new PaintingArea(1280, 720);
695  paintingArea->guiReference = this;
696 
697  QScreen*screen = QGuiApplication::primaryScreen();
698  QRect screenGeometry = screen->geometry();
699  Buttonsize.setWidth(screenGeometry.width() / 20);
700  Buttonsize.setHeight(screenGeometry.height() / 20);
701 
702  preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
703  CircleButton = new QPushButton();
704  CircleButton->setFixedSize(Buttonsize);
705  CircleButton->setIcon(preview);
706  CircleButton->setIconSize(Buttonsize);
707  CircleButton->setCheckable(true);
708 
709  preview = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
710  FloodFillButton = new QPushButton();
711  FloodFillButton->setFixedSize(Buttonsize);
712  FloodFillButton->setIcon(preview);
713  FloodFillButton->setIconSize(Buttonsize);
714  FloodFillButton->setCheckable(true);
715 
716  preview = QPixmap(":/Icons/Buttons/icons/gradient-tool.svg");
717  GradientButton = new QPushButton();
718  GradientButton->setFixedSize(Buttonsize);
719  GradientButton->setIcon(preview);
720  GradientButton->setIconSize(Buttonsize);
721  GradientButton->setCheckable(true);
722 
723  preview = QPixmap(":/Icons/Buttons/icons/line-tool.svg");
724  LineButton = new QPushButton();
725  LineButton->setFixedSize(Buttonsize);
726  LineButton->setIcon(preview);
727  LineButton->setIconSize(Buttonsize);
728  LineButton->setCheckable(true);
729 
730  preview = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
731  PenButton = new QPushButton();
732  PenButton->setFixedSize(Buttonsize);
733  PenButton->setIcon(preview);
734  PenButton->setIconSize(Buttonsize);
735  PenButton->setCheckable(true);
736 
737  preview = QPixmap(":/Icons/Buttons/icons/plain-tool.svg");
738  PlainButton = new QPushButton();
739  PlainButton->setFixedSize(Buttonsize);
740  PlainButton->setIcon(preview);
741  PlainButton->setIconSize(Buttonsize);
742  PlainButton->setCheckable(true);
743 
744  preview = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
745  PolygonButton = new QPushButton();
746  PolygonButton->setFixedSize(Buttonsize);
747  PolygonButton->setIcon(preview);
748  PolygonButton->setIconSize(Buttonsize);
749  PolygonButton->setCheckable(true);
750 
751  preview = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
752  RectangleButton = new QPushButton();
753  RectangleButton->setFixedSize(Buttonsize);
754  RectangleButton->setIcon(preview);
755  RectangleButton->setIconSize(Buttonsize);
756  RectangleButton->setCheckable(true);
757 
758  WidthLine = new QLabel();
759  WidthLine->setText("Width");
760  WidthLine->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
761 
762  EditLineWidth = new QLineEdit();
763  EditLineWidth->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
764  EditLineWidth->setText("5");
765  ValidatorLineWidth = new QIntValidator();
766  ValidatorLineWidth->setTop(99);
767  ValidatorLineWidth->setBottom(1);
768  EditLineWidth->setValidator(ValidatorLineWidth);
769 
770  innerAlphaLine = new QLabel();
771  innerAlphaLine->setText("Inner Alpha");
772  innerAlphaLine->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
773 
774  EditLineInnerAlpha = new QLineEdit();
775  EditLineInnerAlpha->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
776  EditLineInnerAlpha->setText("255");
777  ValidatorInnerAlpha = new QIntValidator();
778  ValidatorInnerAlpha->setTop(999);
779  ValidatorInnerAlpha->setBottom(0);
780  EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
781 
782  FirstColorButton = new QPushButton();
783  FirstColorButton->setFixedSize(Buttonsize);
784 
785  SecondColorButton = new QPushButton();
786  SecondColorButton->setFixedSize(Buttonsize);
787 
788  preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
789  SwitchColorButton = new QPushButton();
790  SwitchColorButton->setFixedSize(Buttonsize.width() * 2,Buttonsize.height());
791  SwitchColorButton->setIcon(preview);
792  SwitchColorButton->setIconSize(QSize(Buttonsize.width() * 2,Buttonsize.height()));
793 
794  ActiveLayerLabel = new QLabel();
795  QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1);
796  ActiveLayerLabel->setText(string);
797  ActiveLayerLabel->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3);
798 
799  IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
800  if(activePicture) {
801  preview = preview.fromImage(activePicture->getImageData());
802  }else{
803  QImage tmp(1,1,QImage::Format_ARGB32);
804  tmp.fill(Qt::transparent);
805  preview = preview.fromImage(tmp);
806  }
807 
808  ActiveLayerImageLabel = new QLabel();
809  ActiveLayerImageLabel->setFixedSize(Buttonsize * 2);
810  ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
811 
812  dimActive = new QPushButton();
813  dimActive->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2);
814  dimActive->setText("0x0");
815 
816  dimCanvas = new QPushButton();
817  dimCanvas->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2);
818  QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
819  dimCanvas->setText(String);
820 
821  FastRendererLabel = new QLabel();
822  FastRendererLabel->setFixedSize(Buttonsize.width() * 2 + 15,(Buttonsize.height() * 2) / 3);
823  FastRendererLabel->setText("Fast Render: On");
824 
825  ScrollArea = new QScrollArea(this);
826  ScrollArea->setBackgroundRole(QPalette::Dark);
827  ScrollArea->setWidget(paintingArea);
828  ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
829  ScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
830 
831  // set gui elements
832  mainLayout->addWidget(ScrollArea,1,1,20,1);
833  mainLayout->addWidget(CircleButton,1,2,1,1);
834  mainLayout->addWidget(FloodFillButton,1,3,1,1);
835  mainLayout->addWidget(LineButton,2,2,1,1);
836  mainLayout->addWidget(PenButton,2,3,1,1);
837  mainLayout->addWidget(PlainButton,3,2,1,1);
838  mainLayout->addWidget(PolygonButton,3,3,1,1);
839  mainLayout->addWidget(RectangleButton,4,2,1,1);
840  mainLayout->addWidget(GradientButton,4,3,1,1);
841  mainLayout->addWidget(WidthLine,5,2,1,2);
842  mainLayout->addWidget(EditLineWidth,6,2,1,2);
843  mainLayout->addWidget(innerAlphaLine,7,2,1,2);
844  mainLayout->addWidget(EditLineInnerAlpha,8,2,1,2);
845  mainLayout->addWidget(FirstColorButton,9,2,1,1);
846  mainLayout->addWidget(SecondColorButton,9,3,1,1);
847  mainLayout->addWidget(SwitchColorButton,10,2,1,2);
848  mainLayout->addWidget(ActiveLayerLabel,11,2,1,2);
849  mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
850  mainLayout->addWidget(dimActive,13,2,1,2);
851  mainLayout->addWidget(dimCanvas,14,2,1,2);
852  mainLayout->addWidget(FastRendererLabel,15,2,1,2);
853  mainLayout->setHorizontalSpacing(0);
854 
855 }
856 
857 void IntelliPhotoGui::setIntelliStyle(){
858  // Set the title
859  setWindowTitle("IntelliPhoto v1.0");
860  // Set style sheet
861  this->setStyleSheet("color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);");
862 
863  QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
864  FirstColorButton->setStyleSheet(string);
865  string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
866  SecondColorButton->setStyleSheet(string);
867 }
868 
869 bool IntelliPhotoGui::maybeSave(){
870  // Check for changes since last save
871 #ifdef QT_NO_DEBUG
872  QMessageBox::StandardButton ret;
873 
874  // Painting is the title of the window
875  // Add text and the buttons
876  ret = QMessageBox::warning(this, tr("Painting"),
877  tr("The image has been modified.\n"
878  "Do you want to save your changes?"),
879  QMessageBox::Save | QMessageBox::Discard
880  | QMessageBox::Cancel);
881 
882  // If save button clicked call for file to be saved
883  if (ret == QMessageBox::Save) {
884  return saveFile("png");
885 
886  // If cancel do nothing
887  } else if (ret == QMessageBox::Cancel) {
888  return false;
889  }
890 #endif
891  return true;
892 }
893 
894 bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
895  // Define path, name and default file type
896  QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
897 
898  // Get selected file from dialog
899  // Add the proper file formats and extensions
900  QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
901  initialPath,
902  tr("%1 Files (*.%2);;All Files (*)")
903  .arg(QString::fromLatin1(fileFormat.toUpper()))
904  .arg(QString::fromLatin1(fileFormat)), nullptr, QFileDialog::DontUseNativeDialog);
905 
906  // If no file do nothing
907  if (fileName.isEmpty()) {
908  return false;
909  } else {
910  // Call for the file to be saved
911  if(fileFormat == "idf") {
912  return IntelliDatamanager::saveProject(paintingArea, fileName);
913 
914  }
915  return paintingArea->save(fileName, fileFormat.constData());
916  }
917 }
918 
919 void IntelliPhotoGui::setDefaultValues(){
920  slotEnterPressed();
921 }
922 
924  if(value < 1) {
925  value = 1;
926  }else if(value > 50) {
927  value = 50;
928  }
929  EditLineWidth->setText(QString("%1").arg(value));
930 }
931 
933  QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1);
934  ActiveLayerLabel->setText(string);
935 
936  IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
937  if(activePicture) {
938  preview = preview.fromImage(activePicture->getImageData());
939  }else{
940  QImage tmp(1,1,QImage::Format_ARGB32);
941  tmp.fill(Qt::transparent);
942  preview = preview.fromImage(tmp);
943  }
944 
945 
946  ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
947 
948  string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
949  FirstColorButton->setStyleSheet(string);
950  string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
951  SecondColorButton->setStyleSheet(string);
952 
953  string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
954  dimCanvas->setText(string);
955 
956  if(paintingArea->layerBundle.size() != 0) {
957  string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<size_t>
958  (paintingArea->getIndexOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<size_t>
959  (paintingArea->getIndexOfActiveLayer())].height);
960  dimActive->setText(string);
961  }
962  else{
963  dimActive->setText("0x0");
964  }
965 }
PaintingArea::createCircleTool
void createCircleTool()
createCircleTool creates a Circle Tool.
Definition: PaintingArea.cpp:263
IntelliColorPicker::getFirstColor
QColor getFirstColor() const
A function to read the primary selected color.
Definition: IntelliColorPicker.cpp:15
ImageType::RASTERIMAGE
@ RASTERIMAGE
PaintingArea::setRenderSettings
void setRenderSettings(bool isFastRenderingOn)
setRenderSettings updates all Images to the new Rendersetting.
Definition: PaintingArea.cpp:51
PaintingArea::getImageOfActiveLayer
IntelliImage * getImageOfActiveLayer()
getImageOfActiveLayer returns the image of the active Layer.
Definition: PaintingArea.cpp:471
PaintingArea::createRectangleTool
void createRectangleTool()
createRectangleTool creates a Rectangle Tool.
Definition: PaintingArea.cpp:258
PaintingArea::getMaxWidth
int getMaxWidth()
getMaxWidth gets the max width of the Canvas.
Definition: PaintingArea.cpp:290
PaintingArea::save
bool save(const QString &filePath, const char *fileFormat)
The save method is used for exporting the current project as one picture.
Definition: PaintingArea.cpp:181
PaintingArea::setLayerAlpha
void setLayerAlpha(int idx, int alpha)
The setAlphaOfLayer method sets the alpha value of a specific layer.
Definition: PaintingArea.cpp:143
IntelliDatamanager::loadProject
bool loadProject(PaintingArea *Canvas, QString filePath="unnamed.idf")
loadProject loads a project from a file, closes current project.
Definition: IntelliDatamanager.cpp:50
PaintingArea::setLayerActive
void setLayerActive(int idx)
The setLayerToActive method marks a specific layer as active.
Definition: PaintingArea.cpp:136
PaintingArea::getMaxHeight
int getMaxHeight()
getMaxHeight gets the max height of the Canvas.
Definition: PaintingArea.cpp:294
PaintingArea::deleteLayer
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
Definition: PaintingArea.cpp:113
PaintingArea::createPlainTool
void createPlainTool()
createPlainTool creates a Plain Tool.
Definition: PaintingArea.cpp:248
IntelliPhotoGui::IntelliPhotoGui
IntelliPhotoGui()
The IntelliPhotoGui method is the constructor and is used to create a new instance of the main progra...
Definition: IntelliPhotoGui.cpp:14
PaintingArea
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:57
PaintingArea::createPenTool
void createPenTool()
createPenTool creates a Pen Tool.
Definition: PaintingArea.cpp:243
IntelliColorPicker::getSecondColor
QColor getSecondColor() const
A function to read the secondary selected color.
Definition: IntelliColorPicker.cpp:19
PaintingArea::getIndexOfActiveLayer
int getIndexOfActiveLayer()
getIndexOfActiveLayer returns the index of athe active Layer.
Definition: PaintingArea.cpp:467
PaintingArea::historyGoBack
void historyGoBack()
historyGoBack go back in hisotry
Definition: PaintingArea.cpp:519
PaintingArea::createLineTool
void createLineTool()
createLineTool creates a Line Tool.
Definition: PaintingArea.cpp:253
PaintingArea::colorPickerSetSecondColor
void colorPickerSetSecondColor()
The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color.
Definition: PaintingArea.cpp:234
PaintingArea::colorPickerSetFirstColor
void colorPickerSetFirstColor()
The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color.
Definition: PaintingArea.cpp:229
IntelliInputDialog::getInt
static int getInt(QString Title=nullptr, QString Label=nullptr, int value=5, int minValue=-2147483647, int maxValue=2147483647, int step=1, bool *ok=nullptr)
getInt is a static funktion ยด, which creates an Input Dialog and gets an Integer.
Definition: IntelliInputDialog.cpp:16
IntelliPhotoGui.h
IntelliPhotoGui::closeEvent
void closeEvent(QCloseEvent *event) override
The closeEvent function handles closing events.
Definition: IntelliPhotoGui.cpp:30
IntelliImage::getImageData
virtual QImage getImageData()
getImageData returns the data of the current image (Note: It will allways return a ARGB32bit QImage!...
Definition: IntelliImage.cpp:135
ImageType::SHAPEDIMAGE
@ SHAPEDIMAGE
IntelliPhotoGui::setToolWidth
void setToolWidth(int value)
setToolWidth stes a width to the tool
Definition: IntelliPhotoGui.cpp:923
PaintingArea::open
bool open(const QString &filePath)
The open method is used for loading a picture into the current layer.
Definition: PaintingArea.cpp:162
PaintingArea::createPolygonTool
void createPolygonTool()
createPolygonTool creates a Polygon Tool.
Definition: PaintingArea.cpp:267
PaintingArea::moveActiveLayer
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
Definition: PaintingArea.cpp:211
PaintingArea::colorPicker
IntelliColorPicker colorPicker
colorPicker a class to manage Tool color.
Definition: PaintingArea.h:286
PaintingArea.h
PaintingArea::createFloodFillTool
void createFloodFillTool()
createFloodFillTool creates a Floodfill Tool.
Definition: PaintingArea.cpp:272
IntelliToolsettings::setInnerAlpha
void setInnerAlpha(int innerAlpha)
setInnerAlpha sets the inner alpha attribute of the Tool.
Definition: IntelliToolsettings.cpp:32
PaintingArea::setCanvasDimensions
void setCanvasDimensions(int newMaxWidth, int newMaxHeight)
setCanvasDimensions sets the dimension of the Canvas
Definition: PaintingArea.cpp:72
IntelliDatamanager::saveProject
bool saveProject(PaintingArea *Canvas, QString filePath="unnamed.idf")
saveProject saves the current project to a file.
Definition: IntelliDatamanager.cpp:4
IntelliPhotoGui::UpdateGui
void UpdateGui()
UpdateGui a function to update all gui elements.
Definition: IntelliPhotoGui.cpp:932
PaintingArea::Toolsettings
IntelliToolsettings Toolsettings
Toolsettings - a class to manage Tool settings.
Definition: PaintingArea.h:281
PaintingArea::setPolygon
void setPolygon(int idx)
setPolygon is used for setting polygondata, it only works on RASTER images
Definition: PaintingArea.cpp:150
IntelliToolsettings::setLineWidth
void setLineWidth(int LineWidth)
setLineWidth sets the width attribute of the line.
Definition: IntelliToolsettings.cpp:18
PaintingArea::colorPickerSwapColors
void colorPickerSwapColors()
The colorPickerSwitchColor swaps the primary color with the secondary drawing color.
Definition: PaintingArea.cpp:239
PaintingArea::movePositionActive
void movePositionActive(int x, int y)
The movePositionActive method moves the active layer to certain position.
Definition: PaintingArea.cpp:204
IntelliImage
An abstract class which manages the basic IntelliImage operations.
Definition: IntelliImage.h:30
PaintingArea::addLayer
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, int alpha=255, ImageType type=ImageType::RASTERIMAGE)
The addLayer adds a layer to the current project/ painting area.
Definition: PaintingArea.cpp:94
PaintingArea::historyGoForward
void historyGoForward()
historyGoForward a function to undo the return of the previous state of the project.
Definition: PaintingArea.cpp:528
PaintingArea::historyadd
void historyadd()
historyadd adds an hisotry step
Definition: PaintingArea.cpp:512
PaintingArea::createGradientTool
void createGradientTool()
createGradientTool creates a Gradient Tool.
Definition: PaintingArea.cpp:277