added Dimension

added the change and get dimesions stuff
This commit is contained in:
Mienek
2020-01-16 16:35:30 +01:00
parent 3359975b1f
commit 58f679a0b6
2 changed files with 54 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
// set style of the gui
setIntelliStyle();
// Size the app
resize(600,600);
resize(600,600);
//showMaximized();
setDefaultToolValue();
}
@@ -103,6 +103,25 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
}
}
// Opens a dialog that allows the user to change Dimension
void IntelliPhotoGui::slotChangeDim(){
// Stores button value
bool ok1, ok2;
// "change Dimension" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, step and ok button
int width = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1, 50000 , 1, &ok1);
int height = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1, 50000, 1, &ok2);
// Change dimension
if (ok1&&ok2) {
paintingArea->setLayerDimensions(height,width);
UpdateGui();
}
}
// Opens a dialog that allows the user to delete a Layer
void IntelliPhotoGui::slotDeleteLayer(){
@@ -264,6 +283,15 @@ void IntelliPhotoGui::slotAboutDialog(){
tr("<p><b>IntelliPhoto - </b>A Pretty basic editor.</p> <br>Developed by Team 7."));
}
// Open an dialog about the dimensions
void IntelliPhotoGui::slotGetDim(){
// Window dimesnion display
QMessageBox::about(this, tr("Dimension"),
tr("Width: %1\nHeight: %2").arg(paintingArea->getMaxWidth()).arg(paintingArea->getMaxHeight()));
}
void IntelliPhotoGui::slotEnterPressed(){
QString string = EditLineWidth->text();
if(string.toInt() > 50) {
@@ -298,7 +326,7 @@ void IntelliPhotoGui::slotSetWidth(){
void IntelliPhotoGui::slotSetInnerAlpha(){
bool ok1;
int temp = IntelliInputDialog::getInt("Toolsettings", "Width:", 5, 1, 50, 1, &ok1);
int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1);
if(ok1) {
paintingArea->Toolsettings.setInnerAlpha(temp);
EditLineInnerAlpha->setText(QString("%1").arg(temp));
@@ -359,6 +387,14 @@ void IntelliPhotoGui::createActions(){
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
actionChangeDim = new QAction(tr("&Change Dimension"), this);
actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X));
connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
actionGetDim = new QAction(tr("&Get Dimension"), this);
actionGetDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Y));
connect(actionGetDim, SIGNAL(triggered()), this, SLOT(slotGetDim()));
actionSetActiveLayer = new QAction(tr("&set Active"), this);
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
@@ -515,9 +551,9 @@ void IntelliPhotoGui::createMenus(){
fileMenu->addAction(actionExit);
//Attach all actions to Render Settings
renderMenu = new QMenu(tr("&Fast Renderer"), this);
renderMenu->addAction(actionUpdateRenderSettingsOn);
renderMenu->addAction(actionUpdateRenderSettingsOff);
renderMenu = new QMenu(tr("&Fast Renderer"), this);
renderMenu->addAction(actionUpdateRenderSettingsOn);
renderMenu->addAction(actionUpdateRenderSettingsOff);
//Attach all Layer Creations to Menu
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
@@ -574,6 +610,8 @@ void IntelliPhotoGui::createMenus(){
optionMenu->addMenu(toolMenu);
optionMenu->addSeparator();
optionMenu->addMenu(renderMenu);
optionMenu->addAction(actionChangeDim);
optionMenu->addAction(actionGetDim);
// Attach all actions to Help
helpMenu = new QMenu(tr("&Help"), this);
@@ -596,7 +634,10 @@ void IntelliPhotoGui::createGui(){
centralGuiWidget->setLayout(mainLayout);
// create Gui elements
paintingArea = new PaintingArea();
// get and set max width and height
int maxHeight = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1);
int maxWidth = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1);
paintingArea = new PaintingArea(maxWidth, maxHeight);
paintingArea->DummyGui = this;
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");

View File

@@ -77,6 +77,9 @@ void slotCreateFloodFillTool();
void slotAboutDialog();
void slotChangeDim();
void slotGetDim();
void slotEnterPressed();
void slotSetWidth();
@@ -160,6 +163,10 @@ QAction*actionCreateCircleTool;
QAction*actionCreatePolygonTool;
QAction*actionCreateFloodFillTool;
// dimension actions
QAction*actionChangeDim;
QAction*actionGetDim;
// dialog actions
QAction*actionAboutDialog;
QAction*actionAboutQtDialog;