mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-16 13:20:33 +02:00
Merge branch 'Merge' into 'dev-colorpalette'
Merge See merge request creyd/intelliphoto!40
This commit is contained in:
@@ -12,11 +12,11 @@ IntelliPhotoGui::IntelliPhotoGui(){
|
|||||||
// create Menus
|
// create Menus
|
||||||
createMenus();
|
createMenus();
|
||||||
// set style of the gui
|
// set style of the gui
|
||||||
setIntelliStyle();
|
setIntelliStyle();
|
||||||
// Size the app
|
// Size the app
|
||||||
resize(600,600);
|
resize(600,600);
|
||||||
showMaximized();
|
showMaximized();
|
||||||
setDefaultToolValue();
|
setDefaultToolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// User tried to close the app
|
// User tried to close the app
|
||||||
@@ -194,11 +194,11 @@ void IntelliPhotoGui::slotSetActiveLayer(){
|
|||||||
|
|
||||||
// "Layer to set on" is the title of the window
|
// "Layer to set on" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
||||||
tr("Layer:"),
|
tr("Layer:"),
|
||||||
1,1,500,1, &ok1);
|
1,1,500,1, &ok1);
|
||||||
if (ok1)
|
if (ok1)
|
||||||
{
|
{
|
||||||
paintingArea->setLayerActive(layer-1);
|
paintingArea->setLayerActive(layer-1);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
@@ -587,9 +587,9 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
||||||
CircleButton = new QPushButton();
|
CircleButton = new QPushButton();
|
||||||
CircleButton->setFixedSize(Buttonsize);
|
CircleButton->setFixedSize(Buttonsize);
|
||||||
CircleButton->setIcon(preview);
|
CircleButton->setIcon(preview);
|
||||||
CircleButton->setIconSize(Buttonsize);
|
CircleButton->setIconSize(Buttonsize);
|
||||||
CircleButton->setCheckable(true);
|
CircleButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
|
||||||
@@ -636,10 +636,10 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
WidthLine = new QLabel();
|
WidthLine = new QLabel();
|
||||||
WidthLine->setText("Width");
|
WidthLine->setText("Width");
|
||||||
WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
WidthLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
EditLineWidth = new QLineEdit();
|
EditLineWidth = new QLineEdit();
|
||||||
EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
EditLineWidth->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
EditLineWidth->setText("5");
|
EditLineWidth->setText("5");
|
||||||
ValidatorLineWidth = new QIntValidator();
|
ValidatorLineWidth = new QIntValidator();
|
||||||
ValidatorLineWidth->setTop(99);
|
ValidatorLineWidth->setTop(99);
|
||||||
@@ -648,10 +648,10 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
innerAlphaLine = new QLabel();
|
innerAlphaLine = new QLabel();
|
||||||
innerAlphaLine->setText("Inner Alpha");
|
innerAlphaLine->setText("Inner Alpha");
|
||||||
innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
innerAlphaLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
EditLineInnerAlpha = new QLineEdit();
|
EditLineInnerAlpha = new QLineEdit();
|
||||||
EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
EditLineInnerAlpha->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
EditLineInnerAlpha->setText("255");
|
EditLineInnerAlpha->setText("255");
|
||||||
ValidatorInnerAlpha = new QIntValidator();
|
ValidatorInnerAlpha = new QIntValidator();
|
||||||
ValidatorInnerAlpha->setTop(999);
|
ValidatorInnerAlpha->setTop(999);
|
||||||
@@ -659,21 +659,21 @@ void IntelliPhotoGui::createGui(){
|
|||||||
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
||||||
|
|
||||||
FirstColorButton = new QPushButton();
|
FirstColorButton = new QPushButton();
|
||||||
FirstColorButton->setFixedSize(Buttonsize/2);
|
FirstColorButton->setFixedSize(Buttonsize);
|
||||||
|
|
||||||
SecondColorButton = new QPushButton();
|
SecondColorButton = new QPushButton();
|
||||||
SecondColorButton->setFixedSize(Buttonsize/2);
|
SecondColorButton->setFixedSize(Buttonsize);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
|
preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
|
||||||
SwitchColorButton = new QPushButton();
|
SwitchColorButton = new QPushButton();
|
||||||
SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2);
|
SwitchColorButton->setFixedSize(Buttonsize.width()*2,Buttonsize.height());
|
||||||
SwitchColorButton->setIcon(preview);
|
SwitchColorButton->setIcon(preview);
|
||||||
SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2));
|
SwitchColorButton->setIconSize(QSize(Buttonsize.width()*2,Buttonsize.height()));
|
||||||
|
|
||||||
ActiveLayerLine = new QLabel();
|
ActiveLayerLine = new QLabel();
|
||||||
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
|
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
|
||||||
ActiveLayerLine->setText(string);
|
ActiveLayerLine->setText(string);
|
||||||
ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3);
|
ActiveLayerLine->setFixedSize(Buttonsize.width()*2+10,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
||||||
if(activePicture){
|
if(activePicture){
|
||||||
@@ -684,29 +684,30 @@ void IntelliPhotoGui::createGui(){
|
|||||||
preview = preview.fromImage(tmp);
|
preview = preview.fromImage(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveLayerImageLine = new QLabel();
|
ActiveLayerImageLabel = new QLabel();
|
||||||
ActiveLayerImageLine->setFixedSize(Buttonsize);
|
ActiveLayerImageLabel->setFixedSize(Buttonsize*2);
|
||||||
ActiveLayerImageLine->setPixmap(preview.scaled(Buttonsize));
|
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize*2));
|
||||||
|
|
||||||
// set gui elements
|
// set gui elements
|
||||||
|
|
||||||
mainLayout->addWidget(paintingArea,1,1,20,1);
|
mainLayout->addWidget(paintingArea,1,1,20,1);
|
||||||
mainLayout->addWidget(CircleButton,1,2,1,2);
|
mainLayout->addWidget(CircleButton,1,2,1,1);
|
||||||
mainLayout->addWidget(FloodFillButton,2,2,1,2);
|
mainLayout->addWidget(FloodFillButton,1,3,1,1);
|
||||||
mainLayout->addWidget(LineButton,3,2,1,2);
|
mainLayout->addWidget(LineButton,2,2,1,1);
|
||||||
mainLayout->addWidget(PenButton,4,2,1,2);
|
mainLayout->addWidget(PenButton,2,3,1,1);
|
||||||
mainLayout->addWidget(PlainButton,5,2,1,2);
|
mainLayout->addWidget(PlainButton,3,2,1,1);
|
||||||
mainLayout->addWidget(PolygonButton,6,2,1,2);
|
mainLayout->addWidget(PolygonButton,3,3,1,1);
|
||||||
mainLayout->addWidget(RectangleButton,7,2,1,2);
|
mainLayout->addWidget(RectangleButton,4,2,1,1);
|
||||||
mainLayout->addWidget(WidthLine,8,2,1,2);
|
mainLayout->addWidget(WidthLine,5,2,1,2);
|
||||||
mainLayout->addWidget(EditLineWidth,9,2,1,2);
|
mainLayout->addWidget(EditLineWidth,6,2,1,2);
|
||||||
mainLayout->addWidget(innerAlphaLine,10,2,1,2);
|
mainLayout->addWidget(innerAlphaLine,7,2,1,2);
|
||||||
mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2);
|
mainLayout->addWidget(EditLineInnerAlpha,8,2,1,2);
|
||||||
mainLayout->addWidget(FirstColorButton,12,2,1,1);
|
mainLayout->addWidget(FirstColorButton,9,2,1,1);
|
||||||
mainLayout->addWidget(SecondColorButton,12,3,1,1);
|
mainLayout->addWidget(SecondColorButton,9,3,1,1);
|
||||||
mainLayout->addWidget(SwitchColorButton,13,2,1,2);
|
mainLayout->addWidget(SwitchColorButton,10,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerLine,14,2,1,2);
|
mainLayout->addWidget(ActiveLayerLine,11,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerImageLine,15,2,1,2);
|
mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
|
||||||
|
mainLayout->setHorizontalSpacing(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setIntelliStyle(){
|
void IntelliPhotoGui::setIntelliStyle(){
|
||||||
@@ -799,6 +800,15 @@ void IntelliPhotoGui::setDefaultToolValue(){
|
|||||||
slotEnterPressed();
|
slotEnterPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntelliPhotoGui::setToolWidth(int value){
|
||||||
|
if(value < 1){
|
||||||
|
value = 1;
|
||||||
|
}else if(value > 50){
|
||||||
|
value = 50;
|
||||||
|
}
|
||||||
|
EditLineWidth->setText(QString("%1").arg(value));
|
||||||
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::UpdateGui(){
|
void IntelliPhotoGui::UpdateGui(){
|
||||||
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
|
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
|
||||||
ActiveLayerLine->setText(string);
|
ActiveLayerLine->setText(string);
|
||||||
@@ -811,7 +821,7 @@ void IntelliPhotoGui::UpdateGui(){
|
|||||||
tmp.fill(Qt::transparent);
|
tmp.fill(Qt::transparent);
|
||||||
preview = preview.fromImage(tmp);
|
preview = preview.fromImage(tmp);
|
||||||
}
|
}
|
||||||
ActiveLayerImageLine->setPixmap(preview.scaled(Buttonsize));
|
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize*2));
|
||||||
|
|
||||||
string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
||||||
FirstColorButton->setStyleSheet(string);
|
FirstColorButton->setStyleSheet(string);
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ IntelliPhotoGui();
|
|||||||
|
|
||||||
void UpdateGui();
|
void UpdateGui();
|
||||||
|
|
||||||
|
void setToolWidth(int value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Function used to close an event
|
// Function used to close an event
|
||||||
void closeEvent(QCloseEvent*event) override;
|
void closeEvent(QCloseEvent*event) override;
|
||||||
@@ -103,7 +105,7 @@ void setDefaultToolValue();
|
|||||||
// What we'll draw on
|
// What we'll draw on
|
||||||
PaintingArea* paintingArea;
|
PaintingArea* paintingArea;
|
||||||
|
|
||||||
const QSize Buttonsize = QSize(70,70);
|
const QSize Buttonsize = QSize(35,35);
|
||||||
QPixmap preview;
|
QPixmap preview;
|
||||||
QPushButton* CircleButton;
|
QPushButton* CircleButton;
|
||||||
QPushButton* FloodFillButton;
|
QPushButton* FloodFillButton;
|
||||||
@@ -124,7 +126,7 @@ QPushButton* SecondColorButton;
|
|||||||
QPushButton* SwitchColorButton;
|
QPushButton* SwitchColorButton;
|
||||||
|
|
||||||
QLabel* ActiveLayerLine;
|
QLabel* ActiveLayerLine;
|
||||||
QLabel* ActiveLayerImageLine;
|
QLabel* ActiveLayerImageLabel;
|
||||||
|
|
||||||
QPalette Palette;
|
QPalette Palette;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ void IntelliTool::onMouseMoved(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::onWheelScrolled(int value){
|
void IntelliTool::onWheelScrolled(int value){
|
||||||
//if needed for future general tasks implement in here
|
//if needed for future general tasks implement in here
|
||||||
|
Area->DummyGui->setToolWidth(value+Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliTool::createToolLayer(){
|
bool IntelliTool::createToolLayer(){
|
||||||
|
|||||||
@@ -58,6 +58,6 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolRectangle::onWheelScrolled(int value){
|
void IntelliToolRectangle::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user