19 setDefaultToolValue();
36 void IntelliPhotoGui::slotOpen(){
44 QString fileName = QFileDialog::getOpenFileName(
this,
45 tr(
"Open File"), QDir::currentPath(),
nullptr,
nullptr, QFileDialog::DontUseNativeDialog);
49 if (!fileName.isEmpty()) {
50 paintingArea->
open(fileName);
57 void IntelliPhotoGui::slotSave(){
59 QAction*action = qobject_cast<QAction*>(sender());
62 QByteArray fileFormat = action->data().toByteArray();
69 void IntelliPhotoGui::slotCreateNewRasterLayer(){
88 void IntelliPhotoGui::slotCreateNewShapedLayer(){
107 void IntelliPhotoGui::slotDeleteLayer(){
122 void IntelliPhotoGui::slotSetActiveAlpha(){
141 void IntelliPhotoGui::slotSetPolygon(){
157 void IntelliPhotoGui::slotPositionMoveUp(){
162 void IntelliPhotoGui::slotPositionMoveDown(){
167 void IntelliPhotoGui::slotPositionMoveLeft(){
172 void IntelliPhotoGui::slotPositionMoveRight(){
177 void IntelliPhotoGui::slotMoveLayerUp(){
182 void IntelliPhotoGui::slotMoveLayerDown(){
187 void IntelliPhotoGui::slotSetActiveLayer(){
192 int layer =
IntelliInputDialog::getInt(
"Layer to set on",
"Layer:", 1, 1,
static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
200 void IntelliPhotoGui::slotUpdateRenderSettingsOn(){
205 void IntelliPhotoGui::slotUpdateRenderSettingsOff(){
210 void IntelliPhotoGui::slotSetFirstColor(){
215 void IntelliPhotoGui::slotSetSecondColor(){
220 void IntelliPhotoGui::slotSwapColor(){
225 void IntelliPhotoGui::slotCreatePenTool(){
226 PenButton->setChecked(
true);
230 void IntelliPhotoGui::slotCreatePlainTool(){
231 PlainButton->setChecked(
true);
235 void IntelliPhotoGui::slotCreateLineTool(){
236 LineButton->setChecked(
true);
240 void IntelliPhotoGui::slotCreateRectangleTool(){
241 RectangleButton->setChecked(
true);
245 void IntelliPhotoGui::slotCreateCircleTool(){
246 CircleButton->setChecked(
true);
250 void IntelliPhotoGui::slotCreatePolygonTool(){
251 PolygonButton->setChecked(
true);
255 void IntelliPhotoGui::slotCreateFloodFillTool(){
256 FloodFillButton->setChecked(
true);
261 void IntelliPhotoGui::slotAboutDialog(){
263 QMessageBox::about(
this, tr(
"About Painting"),
264 tr(
"<p><b>IntelliPhoto - </b>A Pretty basic editor.</p> <br>Developed by Team 7."));
267 void IntelliPhotoGui::slotEnterPressed(){
268 QString
string = EditLineWidth->text();
269 if(
string.toInt() > 50) {
270 EditLineWidth->setText(
"50");
273 string = EditLineInnerAlpha->text();
274 if(
string.toInt() > 255) {
275 EditLineInnerAlpha->setText(
"255");
280 void IntelliPhotoGui::slotResetTools(){
281 CircleButton->setChecked(
false);
282 FloodFillButton->setChecked(
false);
283 LineButton->setChecked(
false);
284 PenButton->setChecked(
false);
285 PlainButton->setChecked(
false);
286 PolygonButton->setChecked(
false);
287 RectangleButton->setChecked(
false);
290 void IntelliPhotoGui::slotSetWidth(){
295 EditLineWidth->setText(QString(
"%1").arg(temp));
299 void IntelliPhotoGui::slotSetInnerAlpha(){
304 EditLineInnerAlpha->setText(QString(
"%1").arg(temp));
309 void IntelliPhotoGui::createActions(){
312 foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
313 QString text = tr(
"%1...").arg(QString(format).toUpper());
316 QAction*action =
new QAction(text,
this);
319 action->setData(format);
322 connect(action, SIGNAL(triggered()),
this, SLOT(slotSave()));
325 actionSaveAs.append(action);
329 QAction*pngSaveAction =
new QAction(
"PNG-8",
this);
330 pngSaveAction->setData(
"PNG");
332 connect(pngSaveAction, SIGNAL(triggered()),
this, SLOT(slotSave()));
334 actionSaveAs.append(pngSaveAction);
335 pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
338 actionExit =
new QAction(tr(
"&Exit"),
this);
339 actionExit->setShortcuts(QKeySequence::Quit);
340 connect(actionExit, SIGNAL(triggered()),
this, SLOT(close()));
342 actionOpen =
new QAction(tr(
"&Open"),
this);
343 actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
344 connect(actionOpen, SIGNAL(triggered()),
this, SLOT(slotOpen()));
347 actionCreateNewRasterLayer =
new QAction(tr(
"&Raster Image"),
this);
348 actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
349 connect(actionCreateNewRasterLayer, SIGNAL(triggered()),
this, SLOT(slotCreateNewRasterLayer()));
353 actionCreateNewShapedLayer =
new QAction(tr(
"&Shaped Image"),
this);
354 actionCreateNewShapedLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N + Qt::ALT));
355 connect(actionCreateNewShapedLayer, SIGNAL(triggered()),
this, SLOT(slotCreateNewShapedLayer()));
358 actionDeleteLayer =
new QAction(tr(
"&Delete Layer..."),
this);
359 actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
360 connect(actionDeleteLayer, SIGNAL(triggered()),
this, SLOT(slotDeleteLayer()));
362 actionSetActiveLayer =
new QAction(tr(
"&set Active"),
this);
363 actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
364 connect(actionSetActiveLayer, SIGNAL(triggered()),
this, SLOT(slotSetActiveLayer()));
366 actionSetActiveAlpha =
new QAction(tr(
"&set Alpha"),
this);
367 actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
368 connect(actionSetActiveAlpha, SIGNAL(triggered()),
this, SLOT(slotSetActiveAlpha()));
370 actionSetPolygon =
new QAction(tr(
"&set new Polygondata"),
this);
371 actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P));
372 connect(actionSetPolygon, SIGNAL(triggered()),
this, SLOT(slotSetPolygon()));
374 actionMovePositionUp =
new QAction(tr(
"&move Up"),
this);
375 actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
376 connect(actionMovePositionUp, SIGNAL(triggered()),
this, SLOT(slotPositionMoveUp()));
378 actionMovePositionDown =
new QAction(tr(
"&move Down"),
this);
379 actionMovePositionDown->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
380 connect(actionMovePositionDown, SIGNAL(triggered()),
this, SLOT(slotPositionMoveDown()));
382 actionMovePositionLeft =
new QAction(tr(
"&move Left"),
this);
383 actionMovePositionLeft->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
384 connect(actionMovePositionLeft, SIGNAL(triggered()),
this, SLOT(slotPositionMoveLeft()));
386 actionMovePositionRight =
new QAction(tr(
"&move Right"),
this);
387 actionMovePositionRight->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right));
388 connect(actionMovePositionRight, SIGNAL(triggered()),
this, SLOT(slotPositionMoveRight()));
390 actionMoveLayerUp =
new QAction(tr(
"&move Layer Up"),
this);
391 actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up));
392 connect(actionMoveLayerUp, SIGNAL(triggered()),
this, SLOT(slotMoveLayerUp()));
394 actionMoveLayerDown =
new QAction(tr(
"&move Layer Down"),
this);
395 actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
396 connect(actionMoveLayerDown, SIGNAL(triggered()),
this, SLOT(slotMoveLayerDown()));
399 actionUpdateRenderSettingsOn =
new QAction(tr(
"&On"),
this);
400 actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A));
401 connect(actionUpdateRenderSettingsOn, SIGNAL(triggered()),
this, SLOT(slotUpdateRenderSettingsOn()));
403 actionUpdateRenderSettingsOff =
new QAction(tr(
"&Off"),
this);
404 actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D));
405 connect(actionUpdateRenderSettingsOff, SIGNAL(triggered()),
this, SLOT(slotUpdateRenderSettingsOff()));
408 actionColorPickerFirstColor =
new QAction(tr(
"&Main"),
this);
409 actionColorPickerFirstColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_N));
410 connect(actionColorPickerFirstColor, SIGNAL(triggered()),
this, SLOT(slotSetFirstColor()));
411 connect(FirstColorButton, SIGNAL(clicked()),
this, SLOT(slotSetFirstColor()));
413 actionColorPickerSecondColor =
new QAction(tr(
"&Secondary"),
this);
414 actionColorPickerSecondColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_M));
415 connect(actionColorPickerSecondColor, SIGNAL(triggered()),
this, SLOT(slotSetSecondColor()));
416 connect(SecondColorButton, SIGNAL(clicked()),
this, SLOT(slotSetSecondColor()));
418 actionColorSwap =
new QAction(tr(
"&Switch"),
this);
419 actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
420 connect(actionColorSwap, SIGNAL(triggered()),
this, SLOT(slotSwapColor()));
421 connect(SwitchColorButton, SIGNAL(clicked()),
this, SLOT(slotSwapColor()));
424 actionCreatePlainTool =
new QAction(tr(
"&Plain"),
this);
425 actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_P));
426 connect(actionCreatePlainTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
427 connect(actionCreatePlainTool, SIGNAL(triggered()),
this, SLOT(slotCreatePlainTool()));
430 actionCreatePenTool =
new QAction(tr(
"&Pen"),
this);
431 actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_S));
432 connect(actionCreatePenTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
433 connect(actionCreatePenTool, SIGNAL(triggered()),
this, SLOT(slotCreatePenTool()));
435 actionCreateLineTool =
new QAction(tr(
"&Line"),
this);
436 actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_L));
437 connect(actionCreateLineTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
438 connect(actionCreateLineTool, SIGNAL(triggered()),
this, SLOT(slotCreateLineTool()));
440 actionCreateCircleTool =
new QAction(tr(
"&Circle"),
this);
441 actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_C));
442 connect(actionCreateCircleTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
443 connect(actionCreateCircleTool, SIGNAL(triggered()),
this, SLOT(slotCreateCircleTool()));
445 actionCreateRectangleTool =
new QAction(tr(
"&Rectangle"),
this);
446 actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_R));
447 connect(actionCreateRectangleTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
448 connect(actionCreateRectangleTool, SIGNAL(triggered()),
this, SLOT(slotCreateRectangleTool()));
450 actionCreatePolygonTool =
new QAction(tr(
"&Polygon"),
this);
451 actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_V));
452 connect(actionCreatePolygonTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
453 connect(actionCreatePolygonTool, SIGNAL(triggered()),
this, SLOT(slotCreatePolygonTool()));
455 actionCreateFloodFillTool =
new QAction(tr(
"&FloodFill"),
this);
456 actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_F));
457 connect(actionCreateFloodFillTool, SIGNAL(triggered()),
this, SLOT(slotResetTools()));
458 connect(actionCreateFloodFillTool, SIGNAL(triggered()),
this, SLOT(slotCreateFloodFillTool()));
461 actionAboutDialog =
new QAction(tr(
"&About"),
this);
462 actionAboutDialog->setShortcut(Qt::Key_F2);
463 connect(actionAboutDialog, SIGNAL(triggered()),
this, SLOT(slotAboutDialog()));
466 actionAboutQtDialog =
new QAction(tr(
"About &Qt"),
this);
467 actionAboutQtDialog->setShortcut(Qt::Key_F3);
468 connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
470 connect(EditLineWidth, SIGNAL(returnPressed()),
this, SLOT(slotEnterPressed()));
471 connect(EditLineInnerAlpha, SIGNAL(returnPressed()),
this, SLOT(slotEnterPressed()));
473 connect(CircleButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
474 connect(CircleButton, SIGNAL(clicked()),
this, SLOT(slotCreateCircleTool()));
476 connect(FloodFillButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
477 connect(FloodFillButton, SIGNAL(clicked()),
this, SLOT(slotCreateFloodFillTool()));
479 connect(LineButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
480 connect(LineButton, SIGNAL(clicked()),
this, SLOT(slotCreateLineTool()));
482 connect(PenButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
483 connect(PenButton, SIGNAL(clicked()),
this, SLOT(slotCreatePenTool()));
485 connect(PlainButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
486 connect(PlainButton, SIGNAL(clicked()),
this, SLOT(slotCreatePlainTool()));
488 connect(PolygonButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
489 connect(PolygonButton, SIGNAL(clicked()),
this, SLOT(slotCreatePolygonTool()));
491 connect(RectangleButton,SIGNAL(pressed()),
this, SLOT(slotResetTools()));
492 connect(RectangleButton, SIGNAL(clicked()),
this, SLOT(slotCreateRectangleTool()));
494 actionSetWidth =
new QAction(tr(
"&Set Width"),
this);
495 actionSetWidth->setShortcut(QKeySequence(Qt::ALT + Qt::Key_W));
496 connect(actionSetWidth, SIGNAL(triggered()),
this, SLOT(slotSetWidth()));
498 actionSetInnerAlpha =
new QAction(tr(
"&Set Inner Alpha"),
this);
499 actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
500 connect(actionSetInnerAlpha, SIGNAL(triggered()),
this, SLOT(slotSetInnerAlpha()));
504 void IntelliPhotoGui::createMenus(){
506 saveAsMenu =
new QMenu(tr(
"&Save As"),
this);
507 foreach (QAction * action, actionSaveAs)
508 saveAsMenu->addAction(action);
511 fileMenu =
new QMenu(tr(
"&File"),
this);
512 fileMenu->addAction(actionOpen);
513 fileMenu->addMenu(saveAsMenu);
514 fileMenu->addSeparator();
515 fileMenu->addAction(actionExit);
518 renderMenu =
new QMenu(tr(
"&Fast Renderer"),
this);
519 renderMenu->addAction(actionUpdateRenderSettingsOn);
520 renderMenu->addAction(actionUpdateRenderSettingsOff);
523 layerCreationMenu =
new QMenu(tr(
"&Create new Layer"),
this);
524 layerCreationMenu->addAction(actionCreateNewRasterLayer);
525 layerCreationMenu->addAction(actionCreateNewShapedLayer);
527 layerMenu =
new QMenu(tr(
"&Layer"),
this);
528 layerMenu->addMenu(layerCreationMenu);
529 layerMenu->addSeparator();
530 layerMenu->addAction(actionSetActiveAlpha);
531 layerMenu->addAction(actionSetActiveLayer);
532 layerMenu->addAction(actionSetPolygon);
533 layerMenu->addSeparator();
534 layerMenu->addAction(actionMovePositionUp);
535 layerMenu->addAction(actionMovePositionDown);
536 layerMenu->addAction(actionMovePositionLeft);
537 layerMenu->addAction(actionMovePositionRight);
538 layerMenu->addAction(actionMoveLayerUp);
539 layerMenu->addAction(actionMoveLayerDown);
540 layerMenu->addSeparator();
541 layerMenu->addAction(actionDeleteLayer);
544 colorMenu =
new QMenu(tr(
"&Color"),
this);
545 colorMenu->addAction(actionColorPickerFirstColor);
546 colorMenu->addAction(actionColorPickerSecondColor);
547 colorMenu->addAction(actionColorSwap);
550 toolCreationMenu =
new QMenu(tr(
"&Drawingtools"),
this);
551 toolCreationMenu->addAction(actionCreateCircleTool);
552 toolCreationMenu->addAction(actionCreateFloodFillTool);
553 toolCreationMenu->addAction(actionCreateLineTool);
554 toolCreationMenu->addAction(actionCreatePenTool);
555 toolCreationMenu->addAction(actionCreatePlainTool);
556 toolCreationMenu->addAction(actionCreatePolygonTool);
557 toolCreationMenu->addAction(actionCreateRectangleTool);
560 toolSettingsMenu =
new QMenu(tr(
"&Toolsettings"),
this);
561 toolSettingsMenu->addAction(actionSetWidth);
562 toolSettingsMenu->addAction(actionSetInnerAlpha);
565 toolMenu =
new QMenu(tr(
"&Tools"),
this);
566 toolMenu->addMenu(toolCreationMenu);
567 toolMenu->addMenu(toolSettingsMenu);
568 toolMenu->addSeparator();
569 toolMenu->addMenu(colorMenu);
572 optionMenu =
new QMenu(tr(
"&Options"),
this);
573 optionMenu->addMenu(layerMenu);
574 optionMenu->addMenu(toolMenu);
575 optionMenu->addSeparator();
576 optionMenu->addMenu(renderMenu);
579 helpMenu =
new QMenu(tr(
"&Help"),
this);
580 helpMenu->addAction(actionAboutDialog);
581 helpMenu->addAction(actionAboutQtDialog);
584 menuBar()->addMenu(fileMenu);
585 menuBar()->addMenu(optionMenu);
586 menuBar()->addMenu(helpMenu);
589 void IntelliPhotoGui::createGui(){
591 centralGuiWidget =
new QWidget(
this);
592 setCentralWidget(centralGuiWidget);
595 mainLayout =
new QGridLayout(centralGuiWidget);
596 centralGuiWidget->setLayout(mainLayout);
600 paintingArea->DummyGui =
this;
602 preview = QPixmap(
":/Icons/Buttons/icons/circle-tool.svg");
603 CircleButton =
new QPushButton();
604 CircleButton->setFixedSize(Buttonsize);
605 CircleButton->setIcon(preview);
606 CircleButton->setIconSize(Buttonsize);
607 CircleButton->setCheckable(
true);
609 preview = QPixmap(
":/Icons/Buttons/icons/flood-fill-tool.svg");
610 FloodFillButton =
new QPushButton();
611 FloodFillButton->setFixedSize(Buttonsize);
612 FloodFillButton->setIcon(preview);
613 FloodFillButton->setIconSize(Buttonsize);
614 FloodFillButton->setCheckable(
true);
616 preview = QPixmap(
":/Icons/Buttons/icons/line-tool.svg");
617 LineButton =
new QPushButton();
618 LineButton->setFixedSize(Buttonsize);
619 LineButton->setIcon(preview);
620 LineButton->setIconSize(Buttonsize);
621 LineButton->setCheckable(
true);
623 preview = QPixmap(
":/Icons/Buttons/icons/pen-tool.svg");
624 PenButton =
new QPushButton();
625 PenButton->setFixedSize(Buttonsize);
626 PenButton->setIcon(preview);
627 PenButton->setIconSize(Buttonsize);
628 PenButton->setCheckable(
true);
630 preview = QPixmap(
":/Icons/Buttons/icons/plain-tool.svg");
631 PlainButton =
new QPushButton();
632 PlainButton->setFixedSize(Buttonsize);
633 PlainButton->setIcon(preview);
634 PlainButton->setIconSize(Buttonsize);
635 PlainButton->setCheckable(
true);
637 preview = QPixmap(
":/Icons/Buttons/icons/polygon-tool.svg");
638 PolygonButton =
new QPushButton();
639 PolygonButton->setFixedSize(Buttonsize);
640 PolygonButton->setIcon(preview);
641 PolygonButton->setIconSize(Buttonsize);
642 PolygonButton->setCheckable(
true);
644 preview = QPixmap(
":/Icons/Buttons/icons/rectangle-tool.svg");
645 RectangleButton =
new QPushButton();
646 RectangleButton->setFixedSize(Buttonsize);
647 RectangleButton->setIcon(preview);
648 RectangleButton->setIconSize(Buttonsize);
649 RectangleButton->setCheckable(
true);
651 WidthLine =
new QLabel();
652 WidthLine->setText(
"Width");
653 WidthLine->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
655 EditLineWidth =
new QLineEdit();
656 EditLineWidth->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
657 EditLineWidth->setText(
"5");
658 ValidatorLineWidth =
new QIntValidator();
659 ValidatorLineWidth->setTop(99);
660 ValidatorLineWidth->setBottom(1);
661 EditLineWidth->setValidator(ValidatorLineWidth);
663 innerAlphaLine =
new QLabel();
664 innerAlphaLine->setText(
"Inner Alpha");
665 innerAlphaLine->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
667 EditLineInnerAlpha =
new QLineEdit();
668 EditLineInnerAlpha->setFixedSize(Buttonsize.width() * 2,(Buttonsize.height() * 2) / 3);
669 EditLineInnerAlpha->setText(
"255");
670 ValidatorInnerAlpha =
new QIntValidator();
671 ValidatorInnerAlpha->setTop(999);
672 ValidatorInnerAlpha->setBottom(0);
673 EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
675 FirstColorButton =
new QPushButton();
676 FirstColorButton->setFixedSize(Buttonsize);
678 SecondColorButton =
new QPushButton();
679 SecondColorButton->setFixedSize(Buttonsize);
681 preview = QPixmap(
":/Icons/Buttons/icons/Wechselpfeile.png");
682 SwitchColorButton =
new QPushButton();
683 SwitchColorButton->setFixedSize(Buttonsize.width() * 2,Buttonsize.height());
684 SwitchColorButton->setIcon(preview);
685 SwitchColorButton->setIconSize(QSize(Buttonsize.width() * 2,Buttonsize.height()));
687 ActiveLayerLine =
new QLabel();
689 ActiveLayerLine->setText(
string);
690 ActiveLayerLine->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3);
694 preview = preview.fromImage(activePicture->
getImageData());
696 QImage tmp(1,1,QImage::Format_ARGB32);
697 tmp.fill(Qt::transparent);
698 preview = preview.fromImage(tmp);
701 ActiveLayerImageLabel =
new QLabel();
702 ActiveLayerImageLabel->setFixedSize(Buttonsize * 2);
703 ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
706 mainLayout->addWidget(paintingArea,1,1,20,1);
707 mainLayout->addWidget(CircleButton,1,2,1,1);
708 mainLayout->addWidget(FloodFillButton,1,3,1,1);
709 mainLayout->addWidget(LineButton,2,2,1,1);
710 mainLayout->addWidget(PenButton,2,3,1,1);
711 mainLayout->addWidget(PlainButton,3,2,1,1);
712 mainLayout->addWidget(PolygonButton,3,3,1,1);
713 mainLayout->addWidget(RectangleButton,4,2,1,1);
714 mainLayout->addWidget(WidthLine,5,2,1,2);
715 mainLayout->addWidget(EditLineWidth,6,2,1,2);
716 mainLayout->addWidget(innerAlphaLine,7,2,1,2);
717 mainLayout->addWidget(EditLineInnerAlpha,8,2,1,2);
718 mainLayout->addWidget(FirstColorButton,9,2,1,1);
719 mainLayout->addWidget(SecondColorButton,9,3,1,1);
720 mainLayout->addWidget(SwitchColorButton,10,2,1,2);
721 mainLayout->addWidget(ActiveLayerLine,11,2,1,2);
722 mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
723 mainLayout->setHorizontalSpacing(0);
726 void IntelliPhotoGui::setIntelliStyle(){
728 setWindowTitle(
"IntelliPhoto Prototype");
730 this->setStyleSheet(
"color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);");
733 FirstColorButton->setStyleSheet(
string);
735 SecondColorButton->setStyleSheet(
string);
738 bool IntelliPhotoGui::maybeSave(){
743 QMessageBox::StandardButton ret;
747 ret = QMessageBox::warning(
this, tr(
"Painting"),
748 tr(
"The image has been modified.\n"
749 "Do you want to save your changes?"),
750 QMessageBox::Save | QMessageBox::Discard
751 | QMessageBox::Cancel);
754 if (ret == QMessageBox::Save) {
755 return saveFile(
"png");
758 }
else if (ret == QMessageBox::Cancel) {
765 bool IntelliPhotoGui::saveFile(
const QByteArray &fileFormat){
767 QString initialPath = QDir::currentPath() +
"/untitled." + fileFormat;
771 QString fileName = QFileDialog::getSaveFileName(
this, tr(
"Save As"),
773 tr(
"%1 Files (*.%2);;All Files (*)")
774 .arg(QString::fromLatin1(fileFormat.toUpper()))
775 .arg(QString::fromLatin1(fileFormat)),
nullptr, QFileDialog::DontUseNativeDialog);
778 if (fileName.isEmpty()) {
782 return paintingArea->
save(fileName, fileFormat.constData());
786 void IntelliPhotoGui::setDefaultToolValue(){
793 }
else if(value > 50) {
796 EditLineWidth->setText(QString(
"%1").arg(value));
801 ActiveLayerLine->setText(
string);
805 preview = preview.fromImage(activePicture->
getImageData());
807 QImage tmp(1,1,QImage::Format_ARGB32);
808 tmp.fill(Qt::transparent);
809 preview = preview.fromImage(tmp);
811 ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
814 FirstColorButton->setStyleSheet(
string);
816 SecondColorButton->setStyleSheet(
string);