mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 21:00:37 +02:00
Uncrustifyed Status
This commit is contained in:
@@ -2,98 +2,98 @@
|
|||||||
|
|
||||||
IntelliInputDialog::IntelliInputDialog(Speichereinheit &Speicher, QEventLoop* Loop, IntelliInputDialog* Dialog, QString Title, QString Label, int value, int minValue, int maxValue, int step)
|
IntelliInputDialog::IntelliInputDialog(Speichereinheit &Speicher, QEventLoop* Loop, IntelliInputDialog* Dialog, QString Title, QString Label, int value, int minValue, int maxValue, int step)
|
||||||
{
|
{
|
||||||
this->Dialog = Dialog;
|
this->Dialog = Dialog;
|
||||||
createInputBox(Title, Label, value, minValue, maxValue, step);
|
createInputBox(Title, Label, value, minValue, maxValue, step);
|
||||||
createConnections(Loop);
|
createConnections(Loop);
|
||||||
setValuesOfPalette();
|
setValuesOfPalette();
|
||||||
setInputBoxStyle();
|
setInputBoxStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::createInputBox(QString Title, QString Label, int value, int minValue, int maxValue, int step){
|
void IntelliInputDialog::createInputBox(QString Title, QString Label, int value, int minValue, int maxValue, int step){
|
||||||
this->Dialog = new QDialog();
|
this->Dialog = new QDialog();
|
||||||
Dialog->setWindowFlags(Dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
Dialog->setWindowFlags(Dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
if(Title == nullptr){
|
if(Title == nullptr) {
|
||||||
Dialog->setWindowTitle("Input Box");
|
Dialog->setWindowTitle("Input Box");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Dialog->setWindowTitle(Title);
|
Dialog->setWindowTitle(Title);
|
||||||
}
|
}
|
||||||
Layout = new QGridLayout();
|
Layout = new QGridLayout();
|
||||||
ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
InputLabel = new QLabel();
|
InputLabel = new QLabel();
|
||||||
if(Label == nullptr){
|
if(Label == nullptr) {
|
||||||
InputLabel->setText("Width:");
|
InputLabel->setText("Width:");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
InputLabel->setText(Label);
|
InputLabel->setText(Label);
|
||||||
}
|
}
|
||||||
InputLabel->setFixedSize(Linesize);
|
InputLabel->setFixedSize(Linesize);
|
||||||
|
|
||||||
Input = new QSpinBox();
|
Input = new QSpinBox();
|
||||||
Input->setFixedSize(Linesize);
|
Input->setFixedSize(Linesize);
|
||||||
Input->setRange(minValue,maxValue);
|
Input->setRange(minValue,maxValue);
|
||||||
Input->setValue(value);
|
Input->setValue(value);
|
||||||
|
|
||||||
okButton = ButtonBox->button(QDialogButtonBox::Ok);
|
okButton = ButtonBox->button(QDialogButtonBox::Ok);
|
||||||
okButton->setFixedSize(Buttonsize);
|
okButton->setFixedSize(Buttonsize);
|
||||||
okButton->setAutoDefault(false);
|
okButton->setAutoDefault(false);
|
||||||
okButton->setDefault(false);
|
okButton->setDefault(false);
|
||||||
|
|
||||||
cancelButton = ButtonBox->button(QDialogButtonBox::Cancel);
|
cancelButton = ButtonBox->button(QDialogButtonBox::Cancel);
|
||||||
cancelButton->setFixedSize(Buttonsize);
|
cancelButton->setFixedSize(Buttonsize);
|
||||||
cancelButton->setAutoDefault(false);
|
cancelButton->setAutoDefault(false);
|
||||||
cancelButton->setDefault(false);
|
cancelButton->setDefault(false);
|
||||||
|
|
||||||
Layout->addWidget(InputLabel,1,1,1,1);
|
Layout->addWidget(InputLabel,1,1,1,1);
|
||||||
Layout->addWidget(Input,2,1,1,1);
|
Layout->addWidget(Input,2,1,1,1);
|
||||||
Layout->addWidget(ButtonBox,3,1,1,1);
|
Layout->addWidget(ButtonBox,3,1,1,1);
|
||||||
Dialog->setLayout(Layout);
|
Dialog->setLayout(Layout);
|
||||||
Dialog->resize(172,94);
|
Dialog->resize(172,94);
|
||||||
Dialog->show();
|
Dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::createConnections(QEventLoop* Loop){
|
void IntelliInputDialog::createConnections(QEventLoop* Loop){
|
||||||
connect(okButton, SIGNAL(clicked()), this, SLOT(slotEingabe(Speicher)));
|
connect(okButton, SIGNAL(clicked()), this, SLOT(slotEingabe(Speicher)));
|
||||||
connect(okButton, SIGNAL(clicked()), Loop, SLOT(quit()));
|
connect(okButton, SIGNAL(clicked()), Loop, SLOT(quit()));
|
||||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCloseEvent()));
|
connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCloseEvent()));
|
||||||
connect(cancelButton, SIGNAL(clicked()), Loop, SLOT(quit()));
|
connect(cancelButton, SIGNAL(clicked()), Loop, SLOT(quit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::setInputBoxStyle(){
|
void IntelliInputDialog::setInputBoxStyle(){
|
||||||
InputLabel->setPalette(Palette);
|
InputLabel->setPalette(Palette);
|
||||||
Input->setPalette(Palette);
|
Input->setPalette(Palette);
|
||||||
okButton->setPalette(Palette);
|
okButton->setPalette(Palette);
|
||||||
cancelButton->setPalette(Palette);
|
cancelButton->setPalette(Palette);
|
||||||
Dialog->setStyleSheet("background-color:rgb(64,64,64)");
|
Dialog->setStyleSheet("background-color:rgb(64,64,64)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::setValuesOfPalette(){
|
void IntelliInputDialog::setValuesOfPalette(){
|
||||||
Palette.setBrush(QPalette::HighlightedText, QColor(200, 10, 10));
|
Palette.setBrush(QPalette::HighlightedText, QColor(200, 10, 10));
|
||||||
Palette.setBrush(QPalette::Highlight, QColor(100, 5, 5));
|
Palette.setBrush(QPalette::Highlight, QColor(100, 5, 5));
|
||||||
Palette.setBrush(QPalette::ButtonText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::ButtonText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::Button, QColor(64, 64, 64));
|
Palette.setBrush(QPalette::Button, QColor(64, 64, 64));
|
||||||
Palette.setBrush(QPalette::Window, QColor(64, 64, 64));
|
Palette.setBrush(QPalette::Window, QColor(64, 64, 64));
|
||||||
Palette.setBrush(QPalette::WindowText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::WindowText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::PlaceholderText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::PlaceholderText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::ToolTipText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::ToolTipText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::Text, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::Text, QColor(255, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::slotCloseEvent(){
|
void IntelliInputDialog::slotCloseEvent(){
|
||||||
Dialog->close();
|
Dialog->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::slotEingabe(Speichereinheit &Speicher){
|
void IntelliInputDialog::slotEingabe(Speichereinheit &Speicher){
|
||||||
qDebug() << Input->value();
|
qDebug() << Input->value();
|
||||||
SetValueToGUI();
|
SetValueToGUI();
|
||||||
Dialog->close();
|
Dialog->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::SetValueToGUI(){
|
void IntelliInputDialog::SetValueToGUI(){
|
||||||
Input->value();
|
Input->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliInputDialog::getIntInput(Speichereinheit &Speicher, QEventLoop* Loop, IntelliInputDialog* Dialog, QString Title, QString Label, int value, int minValue, int maxValue, int step){
|
void IntelliInputDialog::getIntInput(Speichereinheit &Speicher, QEventLoop* Loop, IntelliInputDialog* Dialog, QString Title, QString Label, int value, int minValue, int maxValue, int step){
|
||||||
this->Dialog = new IntelliInputDialog(Speicher, Loop, Dialog, Title, Label, value, minValue, maxValue, step);
|
this->Dialog = new IntelliInputDialog(Speicher, Loop, Dialog, Title, Label, value, minValue, maxValue, step);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,42 +5,42 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "IntelliPhotoGui.h"
|
#include "IntelliPhotoGui.h"
|
||||||
|
|
||||||
class Speichereinheit{
|
class Speichereinheit {
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IntelliInputDialog : public QDialog
|
class IntelliInputDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IntelliInputDialog(Speichereinheit &Speicher, QEventLoop* Loop = nullptr, IntelliInputDialog* Dialog = nullptr, QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
IntelliInputDialog(Speichereinheit &Speicher, QEventLoop* Loop = nullptr, IntelliInputDialog* Dialog = nullptr, QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
||||||
|
|
||||||
void getIntInput(Speichereinheit &Speicher, QEventLoop* Loop = nullptr, IntelliInputDialog* Dialog = nullptr, QString Title = "InputBox", QString Label = "Weight:", int value = 0, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
void getIntInput(Speichereinheit &Speicher, QEventLoop* Loop = nullptr, IntelliInputDialog* Dialog = nullptr, QString Title = "InputBox", QString Label = "Weight:", int value = 0, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotCloseEvent();
|
void slotCloseEvent();
|
||||||
void slotEingabe(Speichereinheit &Speicher);
|
void slotEingabe(Speichereinheit &Speicher);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createInputBox(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
void createInputBox(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1);
|
||||||
void createConnections(QEventLoop* Loop = nullptr);
|
void createConnections(QEventLoop* Loop = nullptr);
|
||||||
void setValuesOfPalette();
|
void setValuesOfPalette();
|
||||||
void setInputBoxStyle();
|
void setInputBoxStyle();
|
||||||
|
|
||||||
void SetValueToGUI();
|
void SetValueToGUI();
|
||||||
|
|
||||||
QDialog* Dialog;
|
QDialog* Dialog;
|
||||||
|
|
||||||
QGridLayout* Layout;
|
QGridLayout* Layout;
|
||||||
QDialogButtonBox* ButtonBox;
|
QDialogButtonBox* ButtonBox;
|
||||||
|
|
||||||
const QSize Linesize = QSize(150,20);
|
const QSize Linesize = QSize(150,20);
|
||||||
const QSize Buttonsize = QSize(72,20);
|
const QSize Buttonsize = QSize(72,20);
|
||||||
QPalette Palette;
|
QPalette Palette;
|
||||||
QLabel* InputLabel;
|
QLabel* InputLabel;
|
||||||
QSpinBox* Input;
|
QSpinBox* Input;
|
||||||
QPushButton* okButton;
|
QPushButton* okButton;
|
||||||
QPushButton* cancelButton;
|
QPushButton* cancelButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTELLIINPUTDIALOG_H
|
#endif // INTELLIINPUTDIALOG_H
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
// IntelliPhotoGui constructor
|
// IntelliPhotoGui constructor
|
||||||
IntelliPhotoGui::IntelliPhotoGui(IntelliInputDialog* InputDialog){
|
IntelliPhotoGui::IntelliPhotoGui(IntelliInputDialog* InputDialog){
|
||||||
//this->InputDialog = InputDialog;
|
//this->InputDialog = InputDialog;
|
||||||
// create Gui elements and lay them out
|
// create Gui elements and lay them out
|
||||||
createGui();
|
createGui();
|
||||||
// Create actions
|
// Create actions
|
||||||
@@ -13,11 +13,11 @@ IntelliPhotoGui::IntelliPhotoGui(IntelliInputDialog* InputDialog){
|
|||||||
// 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
|
||||||
@@ -47,10 +47,10 @@ void IntelliPhotoGui::slotOpen(){
|
|||||||
|
|
||||||
// If we have a file name load the image and place
|
// If we have a file name load the image and place
|
||||||
// it in the paintingArea
|
// it in the paintingArea
|
||||||
if (!fileName.isEmpty()){
|
if (!fileName.isEmpty()) {
|
||||||
paintingArea->open(fileName);
|
paintingArea->open(fileName);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,18 +73,18 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
|||||||
// "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
|
||||||
Speichereinheit Speicher;
|
Speichereinheit Speicher;
|
||||||
this->InputDialog->getIntInput(Speicher, &Loop, this->InputDialog, "New Layer", "Width:", 5, 0, 5000, 1);
|
this->InputDialog->getIntInput(Speicher, &Loop, this->InputDialog, "New Layer", "Width:", 5, 0, 5000, 1);
|
||||||
|
|
||||||
int width = returnValueOfInputDialog;
|
int width = returnValueOfInputDialog;
|
||||||
|
|
||||||
qDebug() << width;
|
qDebug() << width;
|
||||||
|
|
||||||
int height = 25;//QInputDialog::getInt(this, tr("New Layer"),tr("Height:"),200,1, 500, 1, &ok2);
|
int height = 25;//QInputDialog::getInt(this, tr("New Layer"),tr("Height:"),200,1, 500, 1, &ok2);
|
||||||
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
paintingArea->addLayer(width,height,0,0);
|
paintingArea->addLayer(width,height,0,0);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens a dialog that allows the user to delete a Layer
|
// Opens a dialog that allows the user to delete a Layer
|
||||||
@@ -97,10 +97,10 @@ void IntelliPhotoGui::slotDeleteLayer(){
|
|||||||
// 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 = QInputDialog::getInt(this, tr("delete Layer"),
|
||||||
tr("Number:"),
|
tr("Number:"),
|
||||||
paintingArea->getNumberOfActiveLayer()+1,1, 501, 1, &ok);
|
paintingArea->getNumberOfActiveLayer()+1,1, 501, 1, &ok);
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok) {
|
if (ok) {
|
||||||
paintingArea->deleteLayer(layerNumber-1);
|
paintingArea->deleteLayer(layerNumber-1);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,14 +114,14 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
|
|||||||
// 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);
|
||||||
// "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 = QInputDialog::getInt(this, tr("New Alpha"),
|
||||||
tr("Alpha:"),
|
tr("Alpha:"),
|
||||||
255,0, 255, 1, &ok2);
|
255,0, 255, 1, &ok2);
|
||||||
if (ok1&&ok2)
|
if (ok1&&ok2)
|
||||||
{
|
{
|
||||||
paintingArea->setLayerAlpha(layer-1,alpha);
|
paintingArea->setLayerAlpha(layer-1,alpha);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,22 +194,22 @@ void IntelliPhotoGui::slotSetActiveLayer(){
|
|||||||
// 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotUpdateRenderSettingsOn(){
|
void IntelliPhotoGui::slotUpdateRenderSettingsOn(){
|
||||||
paintingArea->setRenderSettings(true);
|
paintingArea->setRenderSettings(true);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotUpdateRenderSettingsOff(){
|
void IntelliPhotoGui::slotUpdateRenderSettingsOff(){
|
||||||
paintingArea->setRenderSettings(false);
|
paintingArea->setRenderSettings(false);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetFirstColor(){
|
void IntelliPhotoGui::slotSetFirstColor(){
|
||||||
@@ -266,7 +266,7 @@ void IntelliPhotoGui::slotCreateFloodFillTool(){
|
|||||||
void IntelliPhotoGui::slotAboutDialog(){
|
void IntelliPhotoGui::slotAboutDialog(){
|
||||||
// Window title and text to display
|
// Window title and text to display
|
||||||
QMessageBox::about(this, tr("About Painting"),
|
QMessageBox::about(this, tr("About Painting"),
|
||||||
tr("<p><b>IntelliPhoto - </b>A Pretty basic editor.</p> <br>Developed by Team 7."));
|
tr("<p><b>IntelliPhoto - </b>A Pretty basic editor.</p> <br>Developed by Team 7."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotEnterPressed(){
|
void IntelliPhotoGui::slotEnterPressed(){
|
||||||
@@ -293,13 +293,13 @@ void IntelliPhotoGui::slotResetTools(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetWidth(){
|
void IntelliPhotoGui::slotSetWidth(){
|
||||||
paintingArea->Toolsettings.setLineWidth();
|
paintingArea->Toolsettings.setLineWidth();
|
||||||
EditLineWidth->setText(QString("%1").arg(paintingArea->Toolsettings.getLineWidth()));
|
EditLineWidth->setText(QString("%1").arg(paintingArea->Toolsettings.getLineWidth()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetInnerAlpha(){
|
void IntelliPhotoGui::slotSetInnerAlpha(){
|
||||||
paintingArea->Toolsettings.setInnerAlpha();
|
paintingArea->Toolsettings.setInnerAlpha();
|
||||||
EditLineInnerAlpha->setText(QString("%1").arg(paintingArea->Toolsettings.getInnerAlpha()));
|
EditLineInnerAlpha->setText(QString("%1").arg(paintingArea->Toolsettings.getInnerAlpha()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define menu actions that call functions
|
// Define menu actions that call functions
|
||||||
@@ -329,7 +329,7 @@ void IntelliPhotoGui::createActions(){
|
|||||||
connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||||
// Attach each PNG in save Menu
|
// Attach each PNG in save Menu
|
||||||
actionSaveAs.append(pngSaveAction);
|
actionSaveAs.append(pngSaveAction);
|
||||||
pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
||||||
|
|
||||||
// Create exit action and tie to IntelliPhotoGui::close()
|
// Create exit action and tie to IntelliPhotoGui::close()
|
||||||
actionExit = new QAction(tr("&Exit"), this);
|
actionExit = new QAction(tr("&Exit"), this);
|
||||||
@@ -347,15 +347,15 @@ void IntelliPhotoGui::createActions(){
|
|||||||
|
|
||||||
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
||||||
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
||||||
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
|
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
|
||||||
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
|
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
|
||||||
|
|
||||||
actionSetActiveLayer = new QAction(tr("&set Active"), this);
|
actionSetActiveLayer = new QAction(tr("&set Active"), this);
|
||||||
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
|
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
|
||||||
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
|
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
|
||||||
|
|
||||||
actionSetActiveAlpha = new QAction(tr("&set Alpha"), this);
|
actionSetActiveAlpha = new QAction(tr("&set Alpha"), this);
|
||||||
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
||||||
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
||||||
|
|
||||||
actionMovePositionUp = new QAction(tr("&move Up"), this);
|
actionMovePositionUp = new QAction(tr("&move Up"), this);
|
||||||
@@ -382,76 +382,76 @@ void IntelliPhotoGui::createActions(){
|
|||||||
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
|
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
|
||||||
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
|
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
|
||||||
|
|
||||||
//Create Update RenderSettings Actions here
|
//Create Update RenderSettings Actions here
|
||||||
actionUpdateRenderSettingsOn = new QAction(tr("&On"), this);
|
actionUpdateRenderSettingsOn = new QAction(tr("&On"), this);
|
||||||
actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_A));
|
actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_A));
|
||||||
connect(actionUpdateRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOn()));
|
connect(actionUpdateRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOn()));
|
||||||
|
|
||||||
actionUpdateRenderSettingsOff = new QAction(tr("&Off"), this);
|
actionUpdateRenderSettingsOff = new QAction(tr("&Off"), this);
|
||||||
actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_D));
|
actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_D));
|
||||||
connect(actionUpdateRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOff()));
|
connect(actionUpdateRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOff()));
|
||||||
|
|
||||||
//Create Color Actions here
|
//Create Color Actions here
|
||||||
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
|
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
|
||||||
actionColorPickerFirstColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_N));
|
actionColorPickerFirstColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_N));
|
||||||
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
|
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
|
||||||
connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor()));
|
connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor()));
|
||||||
|
|
||||||
actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
|
actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
|
||||||
actionColorPickerSecondColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_M));
|
actionColorPickerSecondColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_M));
|
||||||
connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor()));
|
connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor()));
|
||||||
connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor()));
|
connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor()));
|
||||||
|
|
||||||
actionColorSwap = new QAction(tr("&Switch"), this);
|
actionColorSwap = new QAction(tr("&Switch"), this);
|
||||||
actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
|
actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
|
||||||
connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor()));
|
connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor()));
|
||||||
connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor()));
|
connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor()));
|
||||||
|
|
||||||
//Create Tool actions down here
|
//Create Tool actions down here
|
||||||
actionCreatePlainTool = new QAction(tr("&Plain"), this);
|
actionCreatePlainTool = new QAction(tr("&Plain"), this);
|
||||||
actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_P));
|
actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_P));
|
||||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
|
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
|
||||||
|
|
||||||
|
|
||||||
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
||||||
actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_S));
|
actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_S));
|
||||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
||||||
|
|
||||||
actionCreateLineTool = new QAction(tr("&Line"), this);
|
actionCreateLineTool = new QAction(tr("&Line"), this);
|
||||||
actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_L));
|
actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_L));
|
||||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
|
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
|
||||||
|
|
||||||
actionCreateCircleTool = new QAction(tr("&Circle"), this);
|
actionCreateCircleTool = new QAction(tr("&Circle"), this);
|
||||||
actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_C));
|
actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_C));
|
||||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
|
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
|
||||||
|
|
||||||
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
|
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
|
||||||
actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_R));
|
actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_R));
|
||||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
|
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
|
||||||
|
|
||||||
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
|
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
|
||||||
actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_V));
|
actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_V));
|
||||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
|
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
|
||||||
|
|
||||||
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
|
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
|
||||||
actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_F));
|
actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_F));
|
||||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
||||||
|
|
||||||
// Create about action and tie to IntelliPhotoGui::about()
|
// Create about action and tie to IntelliPhotoGui::about()
|
||||||
actionAboutDialog = new QAction(tr("&About"), this);
|
actionAboutDialog = new QAction(tr("&About"), this);
|
||||||
actionAboutDialog->setShortcut(Qt::Key_F2);
|
actionAboutDialog->setShortcut(Qt::Key_F2);
|
||||||
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
|
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
|
||||||
|
|
||||||
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
|
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
|
||||||
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
||||||
actionAboutQtDialog->setShortcut(Qt::Key_F3);
|
actionAboutQtDialog->setShortcut(Qt::Key_F3);
|
||||||
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
|
|
||||||
connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
||||||
@@ -478,13 +478,13 @@ void IntelliPhotoGui::createActions(){
|
|||||||
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
|
connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
|
||||||
|
|
||||||
actionSetWidth = new QAction(tr("&Set Width"),this);
|
actionSetWidth = new QAction(tr("&Set Width"),this);
|
||||||
actionSetWidth->setShortcut(QKeySequence(Qt::ALT + Qt::Key_W));
|
actionSetWidth->setShortcut(QKeySequence(Qt::ALT + Qt::Key_W));
|
||||||
connect(actionSetWidth, SIGNAL(triggered()), this, SLOT(slotSetWidth()));
|
connect(actionSetWidth, SIGNAL(triggered()), this, SLOT(slotSetWidth()));
|
||||||
|
|
||||||
actionSetInnerAlpha = new QAction(tr("&Set Inner Alpha"),this);
|
actionSetInnerAlpha = new QAction(tr("&Set Inner Alpha"),this);
|
||||||
actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
|
actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
|
||||||
connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha()));
|
connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the menubar
|
// Create the menubar
|
||||||
@@ -501,61 +501,61 @@ void IntelliPhotoGui::createMenus(){
|
|||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(actionExit);
|
fileMenu->addAction(actionExit);
|
||||||
|
|
||||||
//Attach all actions to Render Settings
|
//Attach all actions to Render Settings
|
||||||
renderMenu = new QMenu(tr("&Fast Renderer"), this);
|
renderMenu = new QMenu(tr("&Fast Renderer"), this);
|
||||||
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
||||||
renderMenu->addAction(actionUpdateRenderSettingsOff);
|
renderMenu->addAction(actionUpdateRenderSettingsOff);
|
||||||
|
|
||||||
// Attach all actions to Layer
|
// Attach all actions to Layer
|
||||||
layerMenu = new QMenu(tr("&Layer"), this);
|
layerMenu = new QMenu(tr("&Layer"), this);
|
||||||
layerMenu->addAction(actionCreateNewLayer);
|
layerMenu->addAction(actionCreateNewLayer);
|
||||||
layerMenu->addSeparator();
|
layerMenu->addSeparator();
|
||||||
layerMenu->addAction(actionSetActiveAlpha);
|
layerMenu->addAction(actionSetActiveAlpha);
|
||||||
layerMenu->addAction(actionSetActiveLayer);
|
layerMenu->addAction(actionSetActiveLayer);
|
||||||
layerMenu->addSeparator();
|
layerMenu->addSeparator();
|
||||||
layerMenu->addAction(actionMovePositionUp);
|
layerMenu->addAction(actionMovePositionUp);
|
||||||
layerMenu->addAction(actionMovePositionDown);
|
layerMenu->addAction(actionMovePositionDown);
|
||||||
layerMenu->addAction(actionMovePositionLeft);
|
layerMenu->addAction(actionMovePositionLeft);
|
||||||
layerMenu->addAction(actionMovePositionRight);
|
layerMenu->addAction(actionMovePositionRight);
|
||||||
layerMenu->addAction(actionMoveLayerUp);
|
layerMenu->addAction(actionMoveLayerUp);
|
||||||
layerMenu->addAction(actionMoveLayerDown);
|
layerMenu->addAction(actionMoveLayerDown);
|
||||||
layerMenu->addSeparator();
|
layerMenu->addSeparator();
|
||||||
layerMenu->addAction(actionDeleteLayer);
|
layerMenu->addAction(actionDeleteLayer);
|
||||||
|
|
||||||
//Attach all Color Options
|
//Attach all Color Options
|
||||||
colorMenu = new QMenu(tr("&Color"), this);
|
colorMenu = new QMenu(tr("&Color"), this);
|
||||||
colorMenu->addAction(actionColorPickerFirstColor);
|
colorMenu->addAction(actionColorPickerFirstColor);
|
||||||
colorMenu->addAction(actionColorPickerSecondColor);
|
colorMenu->addAction(actionColorPickerSecondColor);
|
||||||
colorMenu->addAction(actionColorSwap);
|
colorMenu->addAction(actionColorSwap);
|
||||||
|
|
||||||
//Attach all Tool Creation Actions
|
//Attach all Tool Creation Actions
|
||||||
toolCreationMenu = new QMenu(tr("&Drawingtools"), this);
|
toolCreationMenu = new QMenu(tr("&Drawingtools"), this);
|
||||||
toolCreationMenu->addAction(actionCreateCircleTool);
|
toolCreationMenu->addAction(actionCreateCircleTool);
|
||||||
toolCreationMenu->addAction(actionCreateFloodFillTool);
|
toolCreationMenu->addAction(actionCreateFloodFillTool);
|
||||||
toolCreationMenu->addAction(actionCreateLineTool);
|
toolCreationMenu->addAction(actionCreateLineTool);
|
||||||
toolCreationMenu->addAction(actionCreatePenTool);
|
toolCreationMenu->addAction(actionCreatePenTool);
|
||||||
toolCreationMenu->addAction(actionCreatePlainTool);
|
toolCreationMenu->addAction(actionCreatePlainTool);
|
||||||
toolCreationMenu->addAction(actionCreatePolygonTool);
|
toolCreationMenu->addAction(actionCreatePolygonTool);
|
||||||
toolCreationMenu->addAction(actionCreateRectangleTool);
|
toolCreationMenu->addAction(actionCreateRectangleTool);
|
||||||
|
|
||||||
//Attach all Tool Setting Actions
|
//Attach all Tool Setting Actions
|
||||||
toolSettingsMenu = new QMenu(tr("&Toolsettings"), this);
|
toolSettingsMenu = new QMenu(tr("&Toolsettings"), this);
|
||||||
toolSettingsMenu->addAction(actionSetWidth);
|
toolSettingsMenu->addAction(actionSetWidth);
|
||||||
toolSettingsMenu->addAction(actionSetInnerAlpha);
|
toolSettingsMenu->addAction(actionSetInnerAlpha);
|
||||||
|
|
||||||
//Attach all Tool Options
|
//Attach all Tool Options
|
||||||
toolMenu = new QMenu(tr("&Tools"), this);
|
toolMenu = new QMenu(tr("&Tools"), this);
|
||||||
toolMenu->addMenu(toolCreationMenu);
|
toolMenu->addMenu(toolCreationMenu);
|
||||||
toolMenu->addMenu(toolSettingsMenu);
|
toolMenu->addMenu(toolSettingsMenu);
|
||||||
toolMenu->addSeparator();
|
toolMenu->addSeparator();
|
||||||
toolMenu->addMenu(colorMenu);
|
toolMenu->addMenu(colorMenu);
|
||||||
|
|
||||||
// Attach all actions to Options
|
// Attach all actions to Options
|
||||||
optionMenu = new QMenu(tr("&Options"), this);
|
optionMenu = new QMenu(tr("&Options"), this);
|
||||||
optionMenu->addMenu(layerMenu);
|
optionMenu->addMenu(layerMenu);
|
||||||
optionMenu->addMenu(toolMenu);
|
optionMenu->addMenu(toolMenu);
|
||||||
optionMenu->addSeparator();
|
optionMenu->addSeparator();
|
||||||
optionMenu->addMenu(renderMenu);
|
optionMenu->addMenu(renderMenu);
|
||||||
|
|
||||||
// Attach all actions to Help
|
// Attach all actions to Help
|
||||||
helpMenu = new QMenu(tr("&Help"), this);
|
helpMenu = new QMenu(tr("&Help"), this);
|
||||||
@@ -579,63 +579,63 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
// create Gui elements
|
// create Gui elements
|
||||||
paintingArea = new PaintingArea();
|
paintingArea = new PaintingArea();
|
||||||
paintingArea->DummyGui = this;
|
paintingArea->DummyGui = this;
|
||||||
|
|
||||||
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");
|
||||||
FloodFillButton = new QPushButton();
|
FloodFillButton = new QPushButton();
|
||||||
FloodFillButton->setFixedSize(Buttonsize);
|
FloodFillButton->setFixedSize(Buttonsize);
|
||||||
FloodFillButton->setIcon(preview);
|
FloodFillButton->setIcon(preview);
|
||||||
FloodFillButton->setIconSize(Buttonsize);
|
FloodFillButton->setIconSize(Buttonsize);
|
||||||
FloodFillButton->setCheckable(true);
|
FloodFillButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/line-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/line-tool.svg");
|
||||||
LineButton = new QPushButton();
|
LineButton = new QPushButton();
|
||||||
LineButton->setFixedSize(Buttonsize);
|
LineButton->setFixedSize(Buttonsize);
|
||||||
LineButton->setIcon(preview);
|
LineButton->setIcon(preview);
|
||||||
LineButton->setIconSize(Buttonsize);
|
LineButton->setIconSize(Buttonsize);
|
||||||
LineButton->setCheckable(true);
|
LineButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
|
||||||
PenButton = new QPushButton();
|
PenButton = new QPushButton();
|
||||||
PenButton->setFixedSize(Buttonsize);
|
PenButton->setFixedSize(Buttonsize);
|
||||||
PenButton->setIcon(preview);
|
PenButton->setIcon(preview);
|
||||||
PenButton->setIconSize(Buttonsize);
|
PenButton->setIconSize(Buttonsize);
|
||||||
PenButton->setCheckable(true);
|
PenButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/plain-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/plain-tool.svg");
|
||||||
PlainButton = new QPushButton();
|
PlainButton = new QPushButton();
|
||||||
PlainButton->setFixedSize(Buttonsize);
|
PlainButton->setFixedSize(Buttonsize);
|
||||||
PlainButton->setIcon(preview);
|
PlainButton->setIcon(preview);
|
||||||
PlainButton->setIconSize(Buttonsize);
|
PlainButton->setIconSize(Buttonsize);
|
||||||
PlainButton->setCheckable(true);
|
PlainButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
|
||||||
PolygonButton = new QPushButton();
|
PolygonButton = new QPushButton();
|
||||||
PolygonButton->setFixedSize(Buttonsize);
|
PolygonButton->setFixedSize(Buttonsize);
|
||||||
PolygonButton->setIcon(preview);
|
PolygonButton->setIcon(preview);
|
||||||
PolygonButton->setIconSize(Buttonsize);
|
PolygonButton->setIconSize(Buttonsize);
|
||||||
PolygonButton->setCheckable(true);
|
PolygonButton->setCheckable(true);
|
||||||
|
|
||||||
preview = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
|
preview = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
|
||||||
RectangleButton = new QPushButton();
|
RectangleButton = new QPushButton();
|
||||||
RectangleButton->setFixedSize(Buttonsize);
|
RectangleButton->setFixedSize(Buttonsize);
|
||||||
RectangleButton->setIcon(preview);
|
RectangleButton->setIcon(preview);
|
||||||
RectangleButton->setIconSize(Buttonsize);
|
RectangleButton->setIconSize(Buttonsize);
|
||||||
RectangleButton->setCheckable(true);
|
RectangleButton->setCheckable(true);
|
||||||
|
|
||||||
WidthLine = new QLabel();
|
WidthLine = new QLabel();
|
||||||
WidthLine->setText("Width");
|
WidthLine->setText("Width");
|
||||||
WidthLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
WidthLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
EditLineWidth = new QLineEdit();
|
EditLineWidth = new QLineEdit();
|
||||||
EditLineWidth->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/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);
|
||||||
@@ -644,10 +644,10 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
innerAlphaLine = new QLabel();
|
innerAlphaLine = new QLabel();
|
||||||
innerAlphaLine->setText("Inner Alpha");
|
innerAlphaLine->setText("Inner Alpha");
|
||||||
innerAlphaLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
innerAlphaLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
EditLineInnerAlpha = new QLineEdit();
|
EditLineInnerAlpha = new QLineEdit();
|
||||||
EditLineInnerAlpha->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/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);
|
||||||
@@ -655,87 +655,87 @@ void IntelliPhotoGui::createGui(){
|
|||||||
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
||||||
|
|
||||||
FirstColorButton = new QPushButton();
|
FirstColorButton = new QPushButton();
|
||||||
FirstColorButton->setFixedSize(Buttonsize);
|
FirstColorButton->setFixedSize(Buttonsize);
|
||||||
|
|
||||||
SecondColorButton = new QPushButton();
|
SecondColorButton = new QPushButton();
|
||||||
SecondColorButton->setFixedSize(Buttonsize);
|
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()*2,Buttonsize.height());
|
SwitchColorButton->setFixedSize(Buttonsize.width()*2,Buttonsize.height());
|
||||||
SwitchColorButton->setIcon(preview);
|
SwitchColorButton->setIcon(preview);
|
||||||
SwitchColorButton->setIconSize(QSize(Buttonsize.width()*2,Buttonsize.height()));
|
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()*2+10,(Buttonsize.height()*2)/3);
|
ActiveLayerLine->setFixedSize(Buttonsize.width()*2+10,(Buttonsize.height()*2)/3);
|
||||||
|
|
||||||
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
||||||
if(activePicture){
|
if(activePicture) {
|
||||||
preview = preview.fromImage(activePicture->getImageData());
|
preview = preview.fromImage(activePicture->getImageData());
|
||||||
}else{
|
}else{
|
||||||
QImage tmp(1,1,QImage::Format_ARGB32);
|
QImage tmp(1,1,QImage::Format_ARGB32);
|
||||||
tmp.fill(Qt::transparent);
|
tmp.fill(Qt::transparent);
|
||||||
preview = preview.fromImage(tmp);
|
preview = preview.fromImage(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveLayerImageLabel = new QLabel();
|
ActiveLayerImageLabel = new QLabel();
|
||||||
ActiveLayerImageLabel->setFixedSize(Buttonsize*2);
|
ActiveLayerImageLabel->setFixedSize(Buttonsize*2);
|
||||||
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize*2));
|
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,1);
|
mainLayout->addWidget(CircleButton,1,2,1,1);
|
||||||
mainLayout->addWidget(FloodFillButton,1,3,1,1);
|
mainLayout->addWidget(FloodFillButton,1,3,1,1);
|
||||||
mainLayout->addWidget(LineButton,2,2,1,1);
|
mainLayout->addWidget(LineButton,2,2,1,1);
|
||||||
mainLayout->addWidget(PenButton,2,3,1,1);
|
mainLayout->addWidget(PenButton,2,3,1,1);
|
||||||
mainLayout->addWidget(PlainButton,3,2,1,1);
|
mainLayout->addWidget(PlainButton,3,2,1,1);
|
||||||
mainLayout->addWidget(PolygonButton,3,3,1,1);
|
mainLayout->addWidget(PolygonButton,3,3,1,1);
|
||||||
mainLayout->addWidget(RectangleButton,4,2,1,1);
|
mainLayout->addWidget(RectangleButton,4,2,1,1);
|
||||||
mainLayout->addWidget(WidthLine,5,2,1,2);
|
mainLayout->addWidget(WidthLine,5,2,1,2);
|
||||||
mainLayout->addWidget(EditLineWidth,6,2,1,2);
|
mainLayout->addWidget(EditLineWidth,6,2,1,2);
|
||||||
mainLayout->addWidget(innerAlphaLine,7,2,1,2);
|
mainLayout->addWidget(innerAlphaLine,7,2,1,2);
|
||||||
mainLayout->addWidget(EditLineInnerAlpha,8,2,1,2);
|
mainLayout->addWidget(EditLineInnerAlpha,8,2,1,2);
|
||||||
mainLayout->addWidget(FirstColorButton,9,2,1,1);
|
mainLayout->addWidget(FirstColorButton,9,2,1,1);
|
||||||
mainLayout->addWidget(SecondColorButton,9,3,1,1);
|
mainLayout->addWidget(SecondColorButton,9,3,1,1);
|
||||||
mainLayout->addWidget(SwitchColorButton,10,2,1,2);
|
mainLayout->addWidget(SwitchColorButton,10,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerLine,11,2,1,2);
|
mainLayout->addWidget(ActiveLayerLine,11,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
|
mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
|
||||||
mainLayout->setHorizontalSpacing(0);
|
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::HighlightedText, QColor(200, 10, 10));
|
||||||
Palette.setBrush(QPalette::Highlight, QColor(100, 5, 5));
|
Palette.setBrush(QPalette::Highlight, QColor(100, 5, 5));
|
||||||
Palette.setBrush(QPalette::ButtonText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::ButtonText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::Button, QColor(64, 64, 64));
|
Palette.setBrush(QPalette::Button, QColor(64, 64, 64));
|
||||||
Palette.setBrush(QPalette::Window, QColor(64, 64, 64));
|
Palette.setBrush(QPalette::Window, QColor(64, 64, 64));
|
||||||
Palette.setBrush(QPalette::WindowText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::WindowText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::PlaceholderText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::PlaceholderText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::ToolTipText, QColor(255, 255, 255));
|
Palette.setBrush(QPalette::ToolTipText, QColor(255, 255, 255));
|
||||||
Palette.setBrush(QPalette::Text, 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("background-color:rgb(64,64,64)");
|
||||||
this->menuBar()->setPalette(Palette);
|
this->menuBar()->setPalette(Palette);
|
||||||
this->fileMenu->setPalette(Palette);
|
this->fileMenu->setPalette(Palette);
|
||||||
this->saveAsMenu->setPalette(Palette);
|
this->saveAsMenu->setPalette(Palette);
|
||||||
this->optionMenu->setPalette(Palette);
|
this->optionMenu->setPalette(Palette);
|
||||||
this->helpMenu->setPalette(Palette);
|
this->helpMenu->setPalette(Palette);
|
||||||
this->renderMenu->setPalette(Palette);
|
this->renderMenu->setPalette(Palette);
|
||||||
this->toolMenu->setPalette(Palette);
|
this->toolMenu->setPalette(Palette);
|
||||||
this->layerMenu->setPalette(Palette);
|
this->layerMenu->setPalette(Palette);
|
||||||
this->colorMenu->setPalette(Palette);
|
this->colorMenu->setPalette(Palette);
|
||||||
this->toolCreationMenu->setPalette(Palette);
|
this->toolCreationMenu->setPalette(Palette);
|
||||||
this->toolSettingsMenu->setPalette(Palette);
|
this->toolSettingsMenu->setPalette(Palette);
|
||||||
|
|
||||||
this->WidthLine->setPalette(Palette);
|
this->WidthLine->setPalette(Palette);
|
||||||
this->EditLineWidth->setPalette(Palette);
|
this->EditLineWidth->setPalette(Palette);
|
||||||
this->innerAlphaLine->setPalette(Palette);
|
this->innerAlphaLine->setPalette(Palette);
|
||||||
this->EditLineInnerAlpha->setPalette(Palette);
|
this->EditLineInnerAlpha->setPalette(Palette);
|
||||||
this->ActiveLayerLine->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);
|
||||||
@@ -796,27 +796,27 @@ void IntelliPhotoGui::setDefaultToolValue(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setToolWidth(int value){
|
void IntelliPhotoGui::setToolWidth(int value){
|
||||||
if(value < 1){
|
if(value < 1) {
|
||||||
value = 1;
|
value = 1;
|
||||||
}else if(value > 50){
|
}else if(value > 50) {
|
||||||
value = 50;
|
value = 50;
|
||||||
}
|
}
|
||||||
EditLineWidth->setText(QString("%1").arg(value));
|
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);
|
||||||
|
|
||||||
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
||||||
if(activePicture){
|
if(activePicture) {
|
||||||
preview = preview.fromImage(activePicture->getImageData());
|
preview = preview.fromImage(activePicture->getImageData());
|
||||||
}else{
|
}else{
|
||||||
QImage tmp(1,1,QImage::Format_ARGB32);
|
QImage tmp(1,1,QImage::Format_ARGB32);
|
||||||
tmp.fill(Qt::transparent);
|
tmp.fill(Qt::transparent);
|
||||||
preview = preview.fromImage(tmp);
|
preview = preview.fromImage(tmp);
|
||||||
}
|
}
|
||||||
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize*2));
|
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);
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
IntelliImage::IntelliImage(int width, int height, bool fastRendererOn)
|
IntelliImage::IntelliImage(int width, int height, bool fastRendererOn)
|
||||||
: imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){
|
: imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){
|
||||||
if(fastRendererOn){
|
if(fastRendererOn) {
|
||||||
imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
imageData.fill(QColor(255,255,255,255));
|
imageData.fill(QColor(255,255,255,255));
|
||||||
if(fastRendererOn){
|
if(fastRendererOn) {
|
||||||
imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
this->fastRenderering = fastRendererOn;
|
this->fastRenderering = fastRendererOn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ bool IntelliImage::loadImage(const QString &filePath){
|
|||||||
// scaled Image to size of Layer
|
// scaled Image to size of Layer
|
||||||
loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
|
loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
|
||||||
|
|
||||||
imageData = loadedImage.convertToFormat(fastRenderering ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
imageData = loadedImage.convertToFormat(fastRenderering ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,19 +46,19 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
|
|||||||
// Draw the image
|
// Draw the image
|
||||||
QPainter painter(&newImage);
|
QPainter painter(&newImage);
|
||||||
painter.drawImage(QPoint(0, 0), *image);
|
painter.drawImage(QPoint(0, 0), *image);
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
*image = newImage.convertToFormat(QImage::Format_Indexed8);
|
*image = newImage.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
*image = newImage;
|
*image = newImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
@@ -66,32 +66,32 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
|||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter.drawPoint(p1);
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter.drawPoint(p1);
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
@@ -99,53 +99,53 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
|||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawLine(p1, p2);
|
painter.drawLine(p1, p2);
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPlain(const QColor& color){
|
void IntelliImage::drawPlain(const QColor& color){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
imageData.fill(color);
|
imageData.fill(color);
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
QColor IntelliImage::getPixelColor(QPoint& point){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
return copy.pixelColor(point);
|
return copy.pixelColor(point);
|
||||||
}
|
}
|
||||||
return imageData.pixelColor(point);
|
return imageData.pixelColor(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage IntelliImage::getImageData(){
|
QImage IntelliImage::getImageData(){
|
||||||
QImage copy = imageData;
|
QImage copy = imageData;
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::setImageData(const QImage& newData){
|
void IntelliImage::setImageData(const QImage& newData){
|
||||||
imageData = newData;
|
imageData = newData;
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||||
this->fastRenderering = fastRendererOn;
|
this->fastRenderering = fastRendererOn;
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
|
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
|
||||||
: IntelliImage(width, height, fastRendererOn){
|
: IntelliImage(width, height, fastRendererOn){
|
||||||
TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
||||||
this->fastRenderering = fastRendererOn;
|
this->fastRenderering = fastRendererOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliRasterImage::~IntelliRasterImage(){
|
IntelliRasterImage::~IntelliRasterImage(){
|
||||||
@@ -30,9 +30,9 @@ QImage IntelliRasterImage::getDisplayable(int alpha){
|
|||||||
|
|
||||||
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||||
QImage copy = imageData;
|
QImage copy = imageData;
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
for(int y = 0; y<copy.height(); y++) {
|
for(int y = 0; y<copy.height(); y++) {
|
||||||
for(int x = 0; x<copy.width(); x++) {
|
for(int x = 0; x<copy.width(); x++) {
|
||||||
QColor clr = copy.pixelColor(x,y);
|
QColor clr = copy.pixelColor(x,y);
|
||||||
@@ -40,9 +40,9 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
copy.setPixelColor(x,y, clr);
|
copy.setPixelColor(x,y, clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
|
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
|
||||||
: IntelliRasterImage(width, height, fastRendererOn){
|
: IntelliRasterImage(width, height, fastRendererOn){
|
||||||
TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
||||||
this->fastRenderering = fastRendererOn;
|
this->fastRenderering = fastRendererOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliShapedImage::~IntelliShapedImage(){
|
IntelliShapedImage::~IntelliShapedImage(){
|
||||||
@@ -27,9 +27,9 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliShapedImage::calculateVisiblity(){
|
void IntelliShapedImage::calculateVisiblity(){
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(polygonData.size()<=2) {
|
if(polygonData.size()<=2) {
|
||||||
QColor clr;
|
QColor clr;
|
||||||
@@ -40,9 +40,9 @@ void IntelliShapedImage::calculateVisiblity(){
|
|||||||
imageData.setPixelColor(x,y,clr);
|
imageData.setPixelColor(x,y,clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QColor clr;
|
QColor clr;
|
||||||
@@ -59,16 +59,16 @@ void IntelliShapedImage::calculateVisiblity(){
|
|||||||
imageData.setPixelColor(x,y,clr);
|
imageData.setPixelColor(x,y,clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||||
QImage copy = imageData;
|
QImage copy = imageData;
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
for(int y = 0; y<copy.height(); y++) {
|
for(int y = 0; y<copy.height(); y++) {
|
||||||
for(int x = 0; x<copy.width(); x++) {
|
for(int x = 0; x<copy.width(); x++) {
|
||||||
QColor clr = copy.pixelColor(x,y);
|
QColor clr = copy.pixelColor(x,y);
|
||||||
@@ -76,9 +76,9 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
copy.setPixelColor(x,y, clr);
|
copy.setPixelColor(x,y, clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fastRenderering){
|
if(fastRenderering) {
|
||||||
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ IntelliRenderSettings::IntelliRenderSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliRenderSettings::setFastRendering(bool Updatedsetting){
|
void IntelliRenderSettings::setFastRendering(bool Updatedsetting){
|
||||||
this->fastRenderering = Updatedsetting;
|
this->fastRenderering = Updatedsetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliRenderSettings::isFastRenderering(){
|
bool IntelliRenderSettings::isFastRenderering(){
|
||||||
return fastRenderering;
|
return fastRenderering;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,12 @@ PaintingArea::~PaintingArea(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
||||||
if(isFastRenderingOn != renderSettings.isFastRenderering()){
|
if(isFastRenderingOn != renderSettings.isFastRenderering()) {
|
||||||
renderSettings.setFastRendering(isFastRenderingOn);
|
renderSettings.setFastRendering(isFastRenderingOn);
|
||||||
for(auto& layer : layerBundle){
|
for(auto& layer : layerBundle) {
|
||||||
layer.image->updateRendererSetting(isFastRenderingOn);
|
layer.image->updateRendererSetting(isFastRenderingOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
||||||
@@ -68,10 +68,10 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
|
|||||||
newLayer.height = height;
|
newLayer.height = height;
|
||||||
newLayer.widthOffset = widthOffset;
|
newLayer.widthOffset = widthOffset;
|
||||||
newLayer.heightOffset = heightOffset;
|
newLayer.heightOffset = heightOffset;
|
||||||
if(type==IntelliImage::ImageType::RASTERIMAGE) {
|
if(type==IntelliImage::ImageType::RASTERIMAGE) {
|
||||||
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
|
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
|
||||||
}else if(type==IntelliImage::ImageType::SHAPEDIMAGE) {
|
}else if(type==IntelliImage::ImageType::SHAPEDIMAGE) {
|
||||||
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
|
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
|
||||||
}
|
}
|
||||||
newLayer.alpha = 255;
|
newLayer.alpha = 255;
|
||||||
this->layerBundle.push_back(newLayer);
|
this->layerBundle.push_back(newLayer);
|
||||||
@@ -83,12 +83,12 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
|
|||||||
void PaintingArea::deleteLayer(int idx){
|
void PaintingArea::deleteLayer(int idx){
|
||||||
if(idx<static_cast<int>(layerBundle.size())) {
|
if(idx<static_cast<int>(layerBundle.size())) {
|
||||||
this->layerBundle.erase(layerBundle.begin()+idx);
|
this->layerBundle.erase(layerBundle.begin()+idx);
|
||||||
if(activeLayer>=idx) {
|
if(activeLayer>=idx) {
|
||||||
activeLayer--;
|
activeLayer--;
|
||||||
}
|
}
|
||||||
if(activeLayer < 0 && layerBundle.size()){
|
if(activeLayer < 0 && layerBundle.size()) {
|
||||||
activeLayer=0;
|
activeLayer=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,9 +265,9 @@ std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
|
|||||||
// left button and if so store the current position
|
// left button and if so store the current position
|
||||||
// Set that we are currently drawing
|
// Set that we are currently drawing
|
||||||
void PaintingArea::mousePressEvent(QMouseEvent*event){
|
void PaintingArea::mousePressEvent(QMouseEvent*event){
|
||||||
if(this->activeLayer < 0){
|
if(this->activeLayer < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
@@ -284,9 +284,9 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){
|
|||||||
// we call the drawline function which draws a line
|
// we call the drawline function which draws a line
|
||||||
// from the last position to the current
|
// from the last position to the current
|
||||||
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
||||||
if(this->activeLayer < 0){
|
if(this->activeLayer < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
@@ -297,9 +297,9 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
|||||||
|
|
||||||
// If the button is released we set variables to stop drawing
|
// If the button is released we set variables to stop drawing
|
||||||
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
||||||
if(this->activeLayer < 0)
|
if(this->activeLayer < 0)
|
||||||
return;
|
return;
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
||||||
@@ -312,9 +312,9 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::wheelEvent(QWheelEvent*event){
|
void PaintingArea::wheelEvent(QWheelEvent*event){
|
||||||
if(this->activeLayer < 0)
|
if(this->activeLayer < 0)
|
||||||
return;
|
return;
|
||||||
if(this->Tool != nullptr) {
|
if(this->Tool != nullptr) {
|
||||||
QPoint numDegrees = event->angleDelta() / 8;
|
QPoint numDegrees = event->angleDelta() / 8;
|
||||||
if(!numDegrees.isNull()) {
|
if(!numDegrees.isNull()) {
|
||||||
QPoint numSteps = numDegrees / 15;
|
QPoint numSteps = numDegrees / 15;
|
||||||
@@ -405,9 +405,9 @@ bool PaintingArea::createTempTopLayer(int idx){
|
|||||||
newLayer.widthOffset = layerBundle[static_cast<unsigned long long>(idx)].widthOffset;
|
newLayer.widthOffset = layerBundle[static_cast<unsigned long long>(idx)].widthOffset;
|
||||||
newLayer.image = layerBundle[static_cast<unsigned long long>(idx)].image->getDeepCopy();
|
newLayer.image = layerBundle[static_cast<unsigned long long>(idx)].image->getDeepCopy();
|
||||||
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
|
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliTool* PaintingArea::copyActiveTool(){
|
IntelliTool* PaintingArea::copyActiveTool(){
|
||||||
@@ -428,8 +428,8 @@ int PaintingArea::getNumberOfActiveLayer(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntelliImage* PaintingArea::getImageOfActiveLayer(){
|
IntelliImage* PaintingArea::getImageOfActiveLayer(){
|
||||||
if(activeLayer<0){
|
if(activeLayer<0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return layerBundle[activeLayer].image;
|
return layerBundle[activeLayer].image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,142 +43,142 @@ Q_OBJECT
|
|||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
friend IntelliPhotoGui;
|
friend IntelliPhotoGui;
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment
|
* \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment
|
||||||
* \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px)
|
* \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px)
|
||||||
* \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px)
|
* \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px)
|
||||||
* \param parent - The parent window of the main window (default=nullptr)
|
* \param parent - The parent window of the main window (default=nullptr)
|
||||||
*/
|
*/
|
||||||
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr);
|
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget*parent = nullptr);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This deconstructor is used to clear up the memory and remove the currently active window
|
* \brief This deconstructor is used to clear up the memory and remove the currently active window
|
||||||
*/
|
*/
|
||||||
~PaintingArea() override;
|
~PaintingArea() override;
|
||||||
|
|
||||||
// Handles all events
|
// Handles all events
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief setRenderSettings updates all Images to the new Rendersetting.
|
* \brief setRenderSettings updates all Images to the new Rendersetting.
|
||||||
* \param isFastRenderingOn is the new given flag for the FastRenderer.
|
* \param isFastRenderingOn is the new given flag for the FastRenderer.
|
||||||
*/
|
*/
|
||||||
void setRenderSettings(bool isFastRenderingOn);
|
void setRenderSettings(bool isFastRenderingOn);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The open method is used for loading a picture into the current layer
|
* \brief The open method is used for loading a picture into the current layer
|
||||||
* \param fileName - Path and filename which are used to determine where the to-be-opened file is stored
|
* \param fileName - Path and filename which are used to determine where the to-be-opened file is stored
|
||||||
* \return Returns a boolean variable whether the file was successfully opened or not
|
* \return Returns a boolean variable whether the file was successfully opened or not
|
||||||
*/
|
*/
|
||||||
bool open(const QString &filePath);
|
bool open(const QString &filePath);
|
||||||
/*!
|
/*!
|
||||||
* \brief The save method is used for exporting the current project as one picture
|
* \brief The save method is used for exporting the current project as one picture
|
||||||
* \param fileName
|
* \param fileName
|
||||||
* \param fileFormat
|
* \param fileFormat
|
||||||
* \return Returns a boolean variable, true if the file was saved successfully, false if not
|
* \return Returns a boolean variable, true if the file was saved successfully, false if not
|
||||||
*/
|
*/
|
||||||
bool save(const QString &filePath, const char *fileFormat);
|
bool save(const QString &filePath, const char*fileFormat);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The addLayer adds a layer to the current project/ painting area
|
* \brief The addLayer adds a layer to the current project/ painting area
|
||||||
* \param width - Width of the layer in pixles
|
* \param width - Width of the layer in pixles
|
||||||
* \param height - Height of the layer in pixles
|
* \param height - Height of the layer in pixles
|
||||||
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
||||||
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
||||||
* \param type - Defining the ImageType of the new layer
|
* \param type - Defining the ImageType of the new layer
|
||||||
* \return Returns the number of layers in the project
|
* \return Returns the number of layers in the project
|
||||||
*/
|
*/
|
||||||
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
|
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
|
||||||
/*!
|
/*!
|
||||||
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
|
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
|
||||||
* \param idx - Index of the position the new layer should be added
|
* \param idx - Index of the position the new layer should be added
|
||||||
* \param width - Width of the layer in pixles
|
* \param width - Width of the layer in pixles
|
||||||
* \param height - Height of the layer in pixles
|
* \param height - Height of the layer in pixles
|
||||||
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
||||||
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
||||||
* \param type - Defining the ImageType of the new layer
|
* \param type - Defining the ImageType of the new layer
|
||||||
* \return Returns the id of the layer position
|
* \return Returns the id of the layer position
|
||||||
*/
|
*/
|
||||||
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
|
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
|
||||||
/*!
|
/*!
|
||||||
* \brief The deleteLayer method removes a layer at a given idx
|
* \brief The deleteLayer method removes a layer at a given idx
|
||||||
* \param idx - The index of the layer to be removed
|
* \param idx - The index of the layer to be removed
|
||||||
*/
|
*/
|
||||||
void deleteLayer(int idx);
|
void deleteLayer(int idx);
|
||||||
/*!
|
/*!
|
||||||
* \brief The setLayerToActive method marks a specific layer as active
|
* \brief The setLayerToActive method marks a specific layer as active
|
||||||
* \param idx - The index of the layer to be active
|
* \param idx - The index of the layer to be active
|
||||||
*/
|
*/
|
||||||
void setLayerActive(int idx);
|
void setLayerActive(int idx);
|
||||||
/*!
|
/*!
|
||||||
* \brief The setAlphaOfLayer method sets the alpha value of a specific layer
|
* \brief The setAlphaOfLayer method sets the alpha value of a specific layer
|
||||||
* \param idx - The index of the layer where the change should be applied
|
* \param idx - The index of the layer where the change should be applied
|
||||||
* \param alpha - New alpha value of the layer
|
* \param alpha - New alpha value of the layer
|
||||||
*/
|
*/
|
||||||
void setLayerAlpha(int idx, int alpha);
|
void setLayerAlpha(int idx, int alpha);
|
||||||
/*!
|
/*!
|
||||||
* \brief The floodFill method fills a the active layer with a given color
|
* \brief The floodFill method fills a the active layer with a given color
|
||||||
* \param r - Red value of the color the layer should be filled with
|
* \param r - Red value of the color the layer should be filled with
|
||||||
* \param g - Green value of the color the layer should be filled with
|
* \param g - Green value of the color the layer should be filled with
|
||||||
* \param b - Blue value of the color the layer should be filled with
|
* \param b - Blue value of the color the layer should be filled with
|
||||||
* \param a - Alpha value of the color the layer should be filled with
|
* \param a - Alpha value of the color the layer should be filled with
|
||||||
*/
|
*/
|
||||||
void floodFill(int r, int g, int b, int a);
|
void floodFill(int r, int g, int b, int a);
|
||||||
/*!
|
/*!
|
||||||
* \brief The movePositionActive method moves the active layer to certain position
|
* \brief The movePositionActive method moves the active layer to certain position
|
||||||
* \param x - The x value the new center of the layer should be at
|
* \param x - The x value the new center of the layer should be at
|
||||||
* \param y - The y value the new center of the layer should be at
|
* \param y - The y value the new center of the layer should be at
|
||||||
*/
|
*/
|
||||||
void movePositionActive(int x, int y);
|
void movePositionActive(int x, int y);
|
||||||
/*!
|
/*!
|
||||||
* \brief The moveActiveLayer moves the active layer to a specific position in the layer stack
|
* \brief The moveActiveLayer moves the active layer to a specific position in the layer stack
|
||||||
* \param idx - The index of the new position the layer should be in
|
* \param idx - The index of the new position the layer should be in
|
||||||
*/
|
*/
|
||||||
void moveActiveLayer(int idx);
|
void moveActiveLayer(int idx);
|
||||||
|
|
||||||
//change properties of colorPicker
|
//change properties of colorPicker
|
||||||
/*!
|
/*!
|
||||||
* \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color
|
* \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color
|
||||||
*/
|
*/
|
||||||
void colorPickerSetFirstColor();
|
void colorPickerSetFirstColor();
|
||||||
/*!
|
/*!
|
||||||
* \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color
|
* \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color
|
||||||
*/
|
*/
|
||||||
void colorPickerSetSecondColor();
|
void colorPickerSetSecondColor();
|
||||||
/*!
|
/*!
|
||||||
* \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color
|
* \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color
|
||||||
*/
|
*/
|
||||||
void colorPickerSwapColors();
|
void colorPickerSwapColors();
|
||||||
|
|
||||||
// Create tools
|
// Create tools
|
||||||
void createPenTool();
|
void createPenTool();
|
||||||
void createPlainTool();
|
void createPlainTool();
|
||||||
void createLineTool();
|
void createLineTool();
|
||||||
void createRectangleTool();
|
void createRectangleTool();
|
||||||
void createCircleTool();
|
void createCircleTool();
|
||||||
void createPolygonTool();
|
void createPolygonTool();
|
||||||
void createFloodFillTool();
|
void createFloodFillTool();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The getWidthOfActive gets the horizontal dimensions of the active layer
|
* \brief The getWidthOfActive gets the horizontal dimensions of the active layer
|
||||||
* \return Returns the horizontal pixle count of the active layer
|
* \return Returns the horizontal pixle count of the active layer
|
||||||
*/
|
*/
|
||||||
int getWidthOfActive();
|
int getWidthOfActive();
|
||||||
/*!
|
/*!
|
||||||
* \brief The getHeightOfActive gets the vertical dimensions of the active layer
|
* \brief The getHeightOfActive gets the vertical dimensions of the active layer
|
||||||
* \return Returns the vertical pixle count of the active layer
|
* \return Returns the vertical pixle count of the active layer
|
||||||
*/
|
*/
|
||||||
int getHeightOfActive();
|
int getHeightOfActive();
|
||||||
|
|
||||||
IntelliImage::ImageType getTypeOfImageRealLayer();
|
IntelliImage::ImageType getTypeOfImageRealLayer();
|
||||||
|
|
||||||
std::vector<QPoint> getPolygonDataOfRealLayer();
|
std::vector<QPoint> getPolygonDataOfRealLayer();
|
||||||
|
|
||||||
int getNumberOfActiveLayer();
|
int getNumberOfActiveLayer();
|
||||||
|
|
||||||
IntelliImage* getImageOfActiveLayer();
|
IntelliImage* getImageOfActiveLayer();
|
||||||
|
|
||||||
IntelliToolsettings Toolsettings;
|
IntelliToolsettings Toolsettings;
|
||||||
IntelliColorPicker colorPicker;
|
IntelliColorPicker colorPicker;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Events to handle
|
// Events to handle
|
||||||
@@ -226,8 +226,8 @@ void drawLayers(bool forSaving=false);
|
|||||||
|
|
||||||
void resizeLayer(QImage*image_res, const QSize &newSize);
|
void resizeLayer(QImage*image_res, const QSize &newSize);
|
||||||
|
|
||||||
// Helper for Tool
|
// Helper for Tool
|
||||||
bool createTempTopLayer(int idx);
|
bool createTempTopLayer(int idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ void IntelliTool::onMouseRightReleased(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::onMouseLeftPressed(int x, int y){
|
void IntelliTool::onMouseLeftPressed(int x, int y){
|
||||||
this->isDrawing=this->createToolLayer();
|
this->isDrawing=this->createToolLayer();
|
||||||
if(isDrawing){
|
if(isDrawing) {
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::onMouseLeftReleased(int x, int y){
|
void IntelliTool::onMouseLeftReleased(int x, int y){
|
||||||
@@ -45,27 +45,27 @@ 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());
|
Area->DummyGui->setToolWidth(value+Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliTool::createToolLayer(){
|
bool IntelliTool::createToolLayer(){
|
||||||
if(Area->createTempTopLayer(Area->activeLayer)){
|
if(Area->createTempTopLayer(Area->activeLayer)) {
|
||||||
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
||||||
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::mergeToolLayer(){
|
void IntelliTool::mergeToolLayer(){
|
||||||
QColor clr_0;
|
QColor clr_0;
|
||||||
QColor clr_1;
|
QColor clr_1;
|
||||||
QImage updatedImage = activeLayer->image->getImageData();
|
QImage updatedImage = activeLayer->image->getImageData();
|
||||||
|
|
||||||
for(int y=0; y<activeLayer->height; y++) {
|
for(int y=0; y<activeLayer->height; y++) {
|
||||||
for(int x=0; x<activeLayer->width; x++) {
|
for(int x=0; x<activeLayer->width; x++) {
|
||||||
clr_0=updatedImage.pixelColor(x,y);
|
clr_0=updatedImage.pixelColor(x,y);
|
||||||
clr_1=Canvas->image->imageData.pixelColor(x,y);
|
clr_1=Canvas->image->imageData.pixelColor(x,y);
|
||||||
float t = static_cast<float>(clr_1.alpha())/255.f;
|
float t = static_cast<float>(clr_1.alpha())/255.f;
|
||||||
int r =static_cast<int>(static_cast<float>(clr_1.red())*(t)+static_cast<float>(clr_0.red())*(1.f-t)+0.5f);
|
int r =static_cast<int>(static_cast<float>(clr_1.red())*(t)+static_cast<float>(clr_0.red())*(1.f-t)+0.5f);
|
||||||
@@ -77,11 +77,11 @@ void IntelliTool::mergeToolLayer(){
|
|||||||
clr_0.setBlue(b);
|
clr_0.setBlue(b);
|
||||||
clr_0.setAlpha(a);
|
clr_0.setAlpha(a);
|
||||||
|
|
||||||
updatedImage.setPixelColor(x, y, clr_0);
|
updatedImage.setPixelColor(x, y, clr_0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activeLayer->image->setImageData(updatedImage);
|
activeLayer->image->setImageData(updatedImage);
|
||||||
Area->DummyGui->UpdateGui();
|
Area->DummyGui->UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::deleteToolLayer(){
|
void IntelliTool::deleteToolLayer(){
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void IntelliToolCircle::drawCircle(int radius){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement circle drawing algorithm bresenham
|
//TODO implement circle drawing algorithm bresenham
|
||||||
radius = static_cast<int>(radius +(Toolsettings->getLineWidth()/2.));
|
radius = static_cast<int>(radius +(Toolsettings->getLineWidth()/2.));
|
||||||
yMin = (centerPoint.y()-radius);
|
yMin = (centerPoint.y()-radius);
|
||||||
yMax = (centerPoint.y()+radius);
|
yMax = (centerPoint.y()+radius);
|
||||||
for(int i=yMin; i<=yMax; i++) {
|
for(int i=yMin; i<=yMax; i++) {
|
||||||
@@ -56,12 +56,12 @@ void IntelliToolCircle::onMouseRightReleased(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolCircle::onMouseLeftPressed(int x, int y){
|
void IntelliToolCircle::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
if(this->isDrawing){
|
if(this->isDrawing) {
|
||||||
this->centerPoint=QPoint(x,y);
|
this->centerPoint=QPoint(x,y);
|
||||||
int radius = 1;
|
int radius = 1;
|
||||||
drawCircle(radius);
|
drawCircle(radius);
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolCircle::onMouseLeftReleased(int x, int y){
|
void IntelliToolCircle::onMouseLeftReleased(int x, int y){
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void IntelliToolLine::onMouseMoved(int x, int y){
|
|||||||
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
|
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
|
||||||
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
|
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
|
||||||
int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
|
int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
|
||||||
//TODO implement dotted algorithm
|
//TODO implement dotted algorithm
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ int main(int argc, char*argv[]){
|
|||||||
// The main application
|
// The main application
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
IntelliInputDialog* InputDialog;
|
IntelliInputDialog* InputDialog;
|
||||||
|
|
||||||
// Create and open the main window
|
// Create and open the main window
|
||||||
IntelliPhotoGui window(InputDialog);
|
IntelliPhotoGui window(InputDialog);
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user