mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 21:00:37 +02:00
Merge branch 'dev-colorpalette' into dev
This commit is contained in:
86
src/GUI/IntelliInputDialog.cpp
Normal file
86
src/GUI/IntelliInputDialog.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
#include "IntelliInputDialog.h"
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
|
||||||
|
IntelliInputDialog::IntelliInputDialog(QString Title, QString Label, int value, int minValue, int maxValue, int step, bool* ok)
|
||||||
|
{
|
||||||
|
this->valueInt = value;
|
||||||
|
this->notClosed = ok;
|
||||||
|
if(notClosed != nullptr){
|
||||||
|
*notClosed = false;
|
||||||
|
}
|
||||||
|
createInputBox(Title, Label, value, minValue, maxValue, step);
|
||||||
|
createConnections();
|
||||||
|
setInputBoxStyle();
|
||||||
|
this->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
int IntelliInputDialog::getInt(QString Title, QString Label, int value, int minValue, int maxValue, int step, bool* ok){
|
||||||
|
IntelliInputDialog dialog(Title, Label, value, minValue, maxValue, step, ok);
|
||||||
|
return dialog.valueInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliInputDialog::createInputBox(QString Title, QString Label, int value, int minValue, int maxValue, int step){
|
||||||
|
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
if(Title == nullptr) {
|
||||||
|
this->setWindowTitle("Input Box");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this->setWindowTitle(Title);
|
||||||
|
}
|
||||||
|
this->Layout = new QGridLayout();
|
||||||
|
this->ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
this->InputLabel = new QLabel();
|
||||||
|
if(Label == nullptr) {
|
||||||
|
this->InputLabel->setText("Width:");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this->InputLabel->setText(Label);
|
||||||
|
}
|
||||||
|
this->InputLabel->setFixedSize(Linesize);
|
||||||
|
|
||||||
|
this->Input = new QSpinBox();
|
||||||
|
this->Input->setFixedSize(Linesize);
|
||||||
|
this->Input->setRange(minValue,maxValue);
|
||||||
|
this->Input->setSingleStep(step);
|
||||||
|
this->Input->setValue(value);
|
||||||
|
|
||||||
|
this->okButton = ButtonBox->button(QDialogButtonBox::Ok);
|
||||||
|
this->okButton->setFixedSize(Buttonsize);
|
||||||
|
this->okButton->setAutoDefault(false);
|
||||||
|
this->okButton->setDefault(false);
|
||||||
|
|
||||||
|
this->cancelButton = ButtonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
this->cancelButton->setFixedSize(Buttonsize);
|
||||||
|
this->cancelButton->setAutoDefault(false);
|
||||||
|
this->cancelButton->setDefault(false);
|
||||||
|
|
||||||
|
Layout->addWidget(InputLabel,1,1,1,1);
|
||||||
|
Layout->addWidget(Input,2,1,1,1);
|
||||||
|
Layout->addWidget(ButtonBox,3,1,1,1);
|
||||||
|
this->setLayout(Layout);
|
||||||
|
this->resize(172,94);
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliInputDialog::createConnections(){
|
||||||
|
connect(okButton, SIGNAL(clicked()), this, SLOT(slotEingabe()));
|
||||||
|
connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCloseEvent()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliInputDialog::setInputBoxStyle(){
|
||||||
|
this->setStyleSheet("color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);");
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliInputDialog::slotCloseEvent(){
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliInputDialog::slotEingabe(){
|
||||||
|
valueInt = QString("%1").arg(Input->value()).toInt();
|
||||||
|
if(notClosed != nullptr){
|
||||||
|
*notClosed = true;
|
||||||
|
}
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
39
src/GUI/IntelliInputDialog.h
Normal file
39
src/GUI/IntelliInputDialog.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef INTELLIINPUTDIALOG_H
|
||||||
|
#define INTELLIINPUTDIALOG_H
|
||||||
|
|
||||||
|
#include <QtWidgets>
|
||||||
|
|
||||||
|
class IntelliInputDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IntelliInputDialog(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool* ok = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
static int getInt(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool* ok = nullptr);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotCloseEvent();
|
||||||
|
void slotEingabe();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void createInputBox(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
||||||
|
void createConnections();
|
||||||
|
void setInputBoxStyle();
|
||||||
|
|
||||||
|
int valueInt;
|
||||||
|
|
||||||
|
QGridLayout* Layout;
|
||||||
|
QDialogButtonBox* ButtonBox;
|
||||||
|
QEventLoop loop;
|
||||||
|
bool* notClosed;
|
||||||
|
|
||||||
|
const QSize Linesize = QSize(150,20);
|
||||||
|
const QSize Buttonsize = QSize(72,20);
|
||||||
|
QLabel* InputLabel;
|
||||||
|
QSpinBox* Input;
|
||||||
|
QPushButton* okButton;
|
||||||
|
QPushButton* cancelButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INTELLIINPUTDIALOG_H
|
||||||
@@ -15,7 +15,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
|
|||||||
setIntelliStyle();
|
setIntelliStyle();
|
||||||
// Size the app
|
// Size the app
|
||||||
resize(600,600);
|
resize(600,600);
|
||||||
showMaximized();
|
//showMaximized();
|
||||||
setDefaultToolValue();
|
setDefaultToolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,16 +73,10 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
|||||||
// "New Layer" is the title of the window
|
// "New Layer" 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
|
||||||
QInputDialog Input;
|
int width = IntelliInputDialog::getInt("New Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
|
||||||
Input.setPalette(Palette);
|
|
||||||
|
|
||||||
int width = Input.getInt(this, tr("New Layer"),
|
int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
|
||||||
tr("Width:"),
|
|
||||||
200,1, 500, 1, &ok1);
|
|
||||||
|
|
||||||
int height = QInputDialog::getInt(this, tr("New Layer"),
|
|
||||||
tr("Height:"),
|
|
||||||
200,1, 500, 1, &ok2);
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok1&&ok2) {
|
if (ok1&&ok2) {
|
||||||
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
||||||
@@ -98,12 +92,10 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
|||||||
// "New Layer" is the title of the window
|
// "New Layer" 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
|
||||||
QInputDialog Input;
|
int width = IntelliInputDialog::getInt("New Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
|
||||||
Input.setPalette(Palette);
|
|
||||||
|
|
||||||
int width = Input.getInt(this, tr("New Layer"), tr("Width:"), 200, 1, 500, 1, &ok1);
|
int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
|
||||||
|
|
||||||
int height = QInputDialog::getInt(this, tr("New Layer"), tr("Height:"), 200, 1, 500, 1, &ok2);
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok1&&ok2) {
|
if (ok1&&ok2) {
|
||||||
paintingArea->addLayer(width, height, 0, 0, IntelliImage::ImageType::SHAPEDIMAGE);
|
paintingArea->addLayer(width, height, 0, 0, IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
@@ -113,36 +105,32 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
|||||||
|
|
||||||
// Opens a dialog that allows the user to delete a Layer
|
// Opens a dialog that allows the user to delete a Layer
|
||||||
void IntelliPhotoGui::slotDeleteLayer(){
|
void IntelliPhotoGui::slotDeleteLayer(){
|
||||||
// Stores button value
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
|
bool ok1;
|
||||||
// "delete Layer" is the title of the window
|
// "delete Layer" 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 layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
|
int layerNumber = IntelliInputDialog::getInt("Delete Layer", "Number:", paintingArea->getNumberOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
|
||||||
tr("Number:"),
|
|
||||||
paintingArea->getNumberOfActiveLayer() + 1,1, 501, 1, &ok);
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok) {
|
if(ok1) {
|
||||||
paintingArea->deleteLayer(layerNumber - 1);
|
paintingArea->deleteLayer(layerNumber - 1);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetActiveAlpha(){
|
void IntelliPhotoGui::slotSetActiveAlpha(){
|
||||||
// Stores button value
|
|
||||||
bool ok1, ok2;
|
|
||||||
|
|
||||||
|
bool ok1, ok2;
|
||||||
// "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"),
|
|
||||||
tr("Layer:"),
|
int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getNumberOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
|
||||||
1,1,500,1, &ok1);
|
|
||||||
// "New Alpha" is the title of the window
|
// "New Alpha" is the title of the window
|
||||||
int alpha = QInputDialog::getInt(this, tr("New Alpha"),
|
int alpha = IntelliInputDialog::getInt("Layer to set on", "Alpha:", 255, 0, 255, 1, &ok2);
|
||||||
tr("Alpha:"),
|
|
||||||
255,0, 255, 1, &ok2);
|
|
||||||
if (ok1&&ok2)
|
if (ok1&&ok2)
|
||||||
{
|
{
|
||||||
paintingArea->setLayerAlpha(layer - 1,alpha);
|
paintingArea->setLayerAlpha(layer - 1,alpha);
|
||||||
@@ -157,9 +145,7 @@ void IntelliPhotoGui::slotSetPolygon(){
|
|||||||
// "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 = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getNumberOfActiveLayer() + 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
|
||||||
tr("Layer:"),
|
|
||||||
1,1,500,1, &ok1);
|
|
||||||
|
|
||||||
if (ok1)
|
if (ok1)
|
||||||
{
|
{
|
||||||
@@ -199,17 +185,13 @@ void IntelliPhotoGui::slotMoveLayerDown(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetActiveLayer(){
|
void IntelliPhotoGui::slotSetActiveLayer(){
|
||||||
// Stores button value
|
|
||||||
bool ok1;
|
bool ok1;
|
||||||
|
|
||||||
// "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 = IntelliInputDialog::getInt("Layer to set on", "Layer:", 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
|
||||||
tr("Layer:"),
|
|
||||||
1, 1, 500, 1, &ok1);
|
if(ok1) {
|
||||||
if (ok1)
|
|
||||||
{
|
|
||||||
paintingArea->setLayerActive(layer - 1);
|
paintingArea->setLayerActive(layer - 1);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
@@ -306,13 +288,21 @@ void IntelliPhotoGui::slotResetTools(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetWidth(){
|
void IntelliPhotoGui::slotSetWidth(){
|
||||||
paintingArea->Toolsettings.setLineWidth();
|
bool ok1;
|
||||||
EditLineWidth->setText(QString("%1").arg(paintingArea->Toolsettings.getLineWidth()));
|
int temp = IntelliInputDialog::getInt("Toolsettings", "Width:", 5, 1, 50, 1, &ok1);
|
||||||
|
if(ok1) {
|
||||||
|
paintingArea->Toolsettings.setLineWidth(temp);
|
||||||
|
EditLineWidth->setText(QString("%1").arg(temp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetInnerAlpha(){
|
void IntelliPhotoGui::slotSetInnerAlpha(){
|
||||||
paintingArea->Toolsettings.setInnerAlpha();
|
bool ok1;
|
||||||
EditLineInnerAlpha->setText(QString("%1").arg(paintingArea->Toolsettings.getInnerAlpha()));
|
int temp = IntelliInputDialog::getInt("Toolsettings", "Width:", 5, 1, 50, 1, &ok1);
|
||||||
|
if(ok1) {
|
||||||
|
paintingArea->Toolsettings.setInnerAlpha(temp);
|
||||||
|
EditLineInnerAlpha->setText(QString("%1").arg(temp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define menu actions that call functions
|
// Define menu actions that call functions
|
||||||
@@ -517,7 +507,6 @@ void IntelliPhotoGui::createMenus(){
|
|||||||
foreach (QAction * action, actionSaveAs)
|
foreach (QAction * action, actionSaveAs)
|
||||||
saveAsMenu->addAction(action);
|
saveAsMenu->addAction(action);
|
||||||
|
|
||||||
|
|
||||||
// Attach all actions to File
|
// Attach all actions to File
|
||||||
fileMenu = new QMenu(tr("&File"), this);
|
fileMenu = new QMenu(tr("&File"), this);
|
||||||
fileMenu->addAction(actionOpen);
|
fileMenu->addAction(actionOpen);
|
||||||
@@ -661,10 +650,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);
|
||||||
@@ -673,10 +662,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);
|
||||||
@@ -684,21 +673,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) {
|
||||||
@@ -709,63 +698,36 @@ 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(){
|
||||||
// Set the title
|
// Set the title
|
||||||
setWindowTitle("IntelliPhoto Prototype");
|
setWindowTitle("IntelliPhoto Prototype");
|
||||||
Palette.setBrush(QPalette::HighlightedText, QColor(200, 10, 10));
|
|
||||||
Palette.setBrush(QPalette::Highlight, QColor(100, 5, 5));
|
|
||||||
Palette.setBrush(QPalette::ButtonText, QColor(255, 255, 255));
|
|
||||||
Palette.setBrush(QPalette::Button, QColor(64, 64, 64));
|
|
||||||
Palette.setBrush(QPalette::Window, QColor(0, 0, 0));
|
|
||||||
Palette.setBrush(QPalette::WindowText, QColor(255, 255, 255));
|
|
||||||
Palette.setBrush(QPalette::PlaceholderText, QColor(255, 255, 255));
|
|
||||||
Palette.setBrush(QPalette::ToolTipText, QColor(255, 255, 255));
|
|
||||||
Palette.setBrush(QPalette::Text, QColor(255, 255, 255));
|
|
||||||
// Set style sheet
|
// Set style sheet
|
||||||
this->setStyleSheet("background-color:rgb(64,64,64)");
|
this->setStyleSheet("color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);");
|
||||||
this->menuBar()->setPalette(Palette);
|
|
||||||
this->fileMenu->setPalette(Palette);
|
|
||||||
this->saveAsMenu->setPalette(Palette);
|
|
||||||
this->optionMenu->setPalette(Palette);
|
|
||||||
this->helpMenu->setPalette(Palette);
|
|
||||||
this->renderMenu->setPalette(Palette);
|
|
||||||
this->toolMenu->setPalette(Palette);
|
|
||||||
this->layerCreationMenu->setPalette(Palette);
|
|
||||||
this->layerMenu->setPalette(Palette);
|
|
||||||
this->colorMenu->setPalette(Palette);
|
|
||||||
this->toolCreationMenu->setPalette(Palette);
|
|
||||||
this->toolSettingsMenu->setPalette(Palette);
|
|
||||||
|
|
||||||
this->WidthLine->setPalette(Palette);
|
|
||||||
this->EditLineWidth->setPalette(Palette);
|
|
||||||
this->innerAlphaLine->setPalette(Palette);
|
|
||||||
this->EditLineInnerAlpha->setPalette(Palette);
|
|
||||||
this->ActiveLayerLine->setPalette(Palette);
|
|
||||||
|
|
||||||
QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
||||||
FirstColorButton->setStyleSheet(string);
|
FirstColorButton->setStyleSheet(string);
|
||||||
@@ -825,6 +787,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);
|
||||||
@@ -837,7 +808,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);
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
#include "IntelliInputDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
// PaintingArea used to paint the image
|
||||||
class PaintingArea;
|
class PaintingArea;
|
||||||
|
|
||||||
class IntelliTool;
|
class IntelliTool;
|
||||||
@@ -30,6 +34,8 @@ IntelliPhotoGui();
|
|||||||
|
|
||||||
void UpdateGui();
|
void UpdateGui();
|
||||||
|
|
||||||
|
void setToolWidth(int value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief The closeEvent function handles closing events
|
* \brief The closeEvent function handles closing events
|
||||||
@@ -95,7 +101,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;
|
||||||
@@ -116,9 +122,7 @@ QPushButton* SecondColorButton;
|
|||||||
QPushButton* SwitchColorButton;
|
QPushButton* SwitchColorButton;
|
||||||
|
|
||||||
QLabel* ActiveLayerLine;
|
QLabel* ActiveLayerLine;
|
||||||
QLabel* ActiveLayerImageLine;
|
QLabel* ActiveLayerImageLabel;
|
||||||
|
|
||||||
QPalette Palette;
|
|
||||||
|
|
||||||
// The menu widgets
|
// The menu widgets
|
||||||
QMenu*saveAsMenu;
|
QMenu*saveAsMenu;
|
||||||
|
|||||||
@@ -15,34 +15,26 @@ int IntelliToolsettings::getLineWidth(){
|
|||||||
return lineWidth;
|
return lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setLineWidth(){
|
|
||||||
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntelliToolsettings::setLineWidth(int LineWidth){
|
void IntelliToolsettings::setLineWidth(int LineWidth){
|
||||||
if(LineWidth < 1) {
|
if(LineWidth < 1){
|
||||||
LineWidth = 1;
|
LineWidth = 1;
|
||||||
}
|
}
|
||||||
else if(LineWidth > 50) {
|
else if(LineWidth > 50){
|
||||||
LineWidth = 50;
|
LineWidth = 50;
|
||||||
}
|
}
|
||||||
lineWidth = LineWidth;
|
lineWidth = LineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IntelliToolsettings::getInnerAlpha(){
|
int IntelliToolsettings::getInnerAlpha(){
|
||||||
return this->innerAlpha;
|
return this->innerAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setInnerAlpha(){
|
|
||||||
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntelliToolsettings::setInnerAlpha(int innerAlpha){
|
void IntelliToolsettings::setInnerAlpha(int innerAlpha){
|
||||||
if(innerAlpha < 0) {
|
if(innerAlpha < 0){
|
||||||
innerAlpha = 0;
|
innerAlpha = 0;
|
||||||
}
|
}
|
||||||
else if(innerAlpha > 255) {
|
else if(innerAlpha > 255){
|
||||||
innerAlpha = 255;
|
innerAlpha = 255;
|
||||||
}
|
}
|
||||||
this->innerAlpha = innerAlpha;
|
this->innerAlpha = innerAlpha;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ public:
|
|||||||
IntelliToolsettings();
|
IntelliToolsettings();
|
||||||
virtual ~IntelliToolsettings();
|
virtual ~IntelliToolsettings();
|
||||||
int getLineWidth();
|
int getLineWidth();
|
||||||
void setLineWidth();
|
|
||||||
void setLineWidth(int LineWidth);
|
void setLineWidth(int LineWidth);
|
||||||
int getInnerAlpha();
|
int getInnerAlpha();
|
||||||
void setInnerAlpha();
|
|
||||||
void setInnerAlpha(int innerAlpha);
|
void setInnerAlpha(int innerAlpha);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
GUI/IntelliInputDialog.cpp \
|
||||||
GUI/IntelliPhotoGui.cpp \
|
GUI/IntelliPhotoGui.cpp \
|
||||||
Image/IntelliImage.cpp \
|
Image/IntelliImage.cpp \
|
||||||
Image/IntelliRasterImage.cpp \
|
Image/IntelliRasterImage.cpp \
|
||||||
@@ -36,6 +37,7 @@ SOURCES += \
|
|||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
GUI/IntelliInputDialog.h \
|
||||||
GUI/IntelliPhotoGui.h \
|
GUI/IntelliPhotoGui.h \
|
||||||
Image/IntelliImage.h \
|
Image/IntelliImage.h \
|
||||||
Image/IntelliRasterImage.h \
|
Image/IntelliRasterImage.h \
|
||||||
@@ -70,3 +72,5 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
Bilder.qrc
|
Bilder.qrc
|
||||||
|
|
||||||
|
DISTFILES +=
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ PaintingArea::~PaintingArea(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
||||||
if(isFastRenderingOn != renderSettings.isFastRenderering()) {
|
if(isFastRenderingOn != renderSettings.isFastRenderering() && !Tool->getIsDrawing()) {
|
||||||
renderSettings.setFastRendering(isFastRenderingOn);
|
renderSettings.setFastRendering(isFastRenderingOn);
|
||||||
for(auto& layer : layerBundle) {
|
for(auto& layer : layerBundle) {
|
||||||
layer.image->updateRendererSetting(isFastRenderingOn);
|
layer.image->updateRendererSetting(isFastRenderingOn);
|
||||||
@@ -110,6 +110,7 @@ void PaintingArea::setPolygon(int idx){
|
|||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
|
this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
|
||||||
isSettingPolygon = true;
|
isSettingPolygon = true;
|
||||||
|
this->DummyGui->setToolWidth(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +164,7 @@ void PaintingArea::moveActiveLayer(int idx){
|
|||||||
}else if(idx==-1) {
|
}else if(idx==-1) {
|
||||||
this->selectLayerDown();
|
this->selectLayerDown();
|
||||||
}
|
}
|
||||||
|
DummyGui->UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::slotActivateLayer(int a){
|
void PaintingArea::slotActivateLayer(int a){
|
||||||
@@ -228,6 +230,14 @@ int PaintingArea::getHeightOfActive(){
|
|||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PaintingArea::getMaxWidth(){
|
||||||
|
return this->maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaintingArea::getMaxHeight(){
|
||||||
|
return this->maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){
|
IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){
|
||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getTypeOfImage();
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getTypeOfImage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ int getWidthOfActive();
|
|||||||
*/
|
*/
|
||||||
int getHeightOfActive();
|
int getHeightOfActive();
|
||||||
|
|
||||||
|
int getMaxWidth();
|
||||||
|
|
||||||
|
int getMaxHeight();
|
||||||
|
|
||||||
IntelliImage::ImageType getTypeOfImageRealLayer();
|
IntelliImage::ImageType getTypeOfImageRealLayer();
|
||||||
|
|
||||||
std::vector<QPoint> getPolygonDataOfRealLayer();
|
std::vector<QPoint> getPolygonDataOfRealLayer();
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ 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(){
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* c
|
|||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
isInside = false;
|
isInside = false;
|
||||||
this->isSettingPolygon = isSettingPolygon;
|
this->isSettingPolygon = isSettingPolygon;
|
||||||
|
if(isSettingPolygon){
|
||||||
|
Toolsettings->setLineWidth(5);
|
||||||
|
}
|
||||||
this->ActiveType = Tooltype::POLYGON;
|
this->ActiveType = Tooltype::POLYGON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,14 +124,18 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onWheelScrolled(int value){
|
void IntelliToolPolygon::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
if(!isSettingPolygon){
|
||||||
if(!isDrawing) {
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
|
if(!isDrawing) {
|
||||||
}
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseMoved(int x, int y){
|
void IntelliToolPolygon::onMouseMoved(int x, int y){
|
||||||
IntelliTool::onMouseMoved(x,y);
|
if(!isSettingPolygon){
|
||||||
|
IntelliTool::onMouseMoved(x,y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int main(int argc, char*argv[]){
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Create and open the main window
|
// Create and open the main window
|
||||||
IntelliPhotoGui window;
|
IntelliPhotoGui window;
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|||||||
Reference in New Issue
Block a user