mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 11:50:31 +02:00
implemented creation of certain image type and alo button for setting poylgon data
TODO implement setPolygon function
This commit is contained in:
@@ -65,8 +65,8 @@ void IntelliPhotoGui::slotSave(){
|
||||
saveFile(fileFormat);
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to create a New Layer
|
||||
void IntelliPhotoGui::slotCreateNewLayer(){
|
||||
// Opens a dialog that allows the user to create a New RASTER Layer
|
||||
void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
||||
// Stores button value
|
||||
bool ok1, ok2;
|
||||
|
||||
@@ -85,11 +85,36 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
||||
200,1, 500, 1, &ok2);
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width,height,0,0);
|
||||
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to create a New SHAPED Layer
|
||||
void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
||||
// Stores button value
|
||||
bool ok1, ok2;
|
||||
|
||||
// "New Layer" is the title of the window
|
||||
// the next tr is the text to display
|
||||
// Define the standard Value, min, max, step and ok button
|
||||
QInputDialog Input;
|
||||
Input.setPalette(Palette);
|
||||
|
||||
int width = Input.getInt(this, tr("New Layer"),
|
||||
tr("Width:"),
|
||||
200,1, 500, 1, &ok1);
|
||||
|
||||
int height = QInputDialog::getInt(this, tr("New Layer"),
|
||||
tr("Height:"),
|
||||
200,1, 500, 1, &ok2);
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to delete a Layer
|
||||
void IntelliPhotoGui::slotDeleteLayer(){
|
||||
// Stores button value
|
||||
@@ -129,6 +154,24 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliPhotoGui::slotSetPolygon(){
|
||||
// Stores button value
|
||||
bool ok1;
|
||||
|
||||
// "Layer to set on" is the title of the window
|
||||
// the next tr is the text to display
|
||||
// Define the standard Value, min, max, step and ok button
|
||||
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
||||
tr("Layer:"),
|
||||
1,1,500,1, &ok1);
|
||||
|
||||
if (ok1)
|
||||
{
|
||||
paintingArea->setPolygon(layer-1);
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliPhotoGui::slotPositionMoveUp(){
|
||||
paintingArea->movePositionActive(0,-20);
|
||||
update();
|
||||
@@ -343,10 +386,16 @@ void IntelliPhotoGui::createActions(){
|
||||
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
||||
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
|
||||
|
||||
// Create New Layer action and tie to IntelliPhotoGui::newLayer()
|
||||
actionCreateNewLayer = new QAction(tr("&New Layer..."), this);
|
||||
actionCreateNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||
connect(actionCreateNewLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewLayer()));
|
||||
// Create New RASTER Layer action and tie to IntelliPhotoGui::newLayer()
|
||||
actionCreateNewRasterLayer = new QAction(tr("&Raster Image"), this);
|
||||
actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||
connect(actionCreateNewRasterLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewRasterLayer()));
|
||||
|
||||
|
||||
// Create New SHAPED Layer action and tie to IntelliPhotoGui::newLayer()
|
||||
actionCreateNewShapedLayer = new QAction(tr("&Shaped Image"), this);
|
||||
actionCreateNewShapedLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N + Qt::ALT));
|
||||
connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer()));
|
||||
|
||||
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
||||
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
||||
@@ -361,6 +410,10 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
||||
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
||||
|
||||
actionSetPolygon = new QAction(tr("&set new Polygondata"), this);
|
||||
actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P));
|
||||
connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon()));
|
||||
|
||||
actionMovePositionUp = new QAction(tr("&move Up"), this);
|
||||
actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
|
||||
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
|
||||
@@ -510,12 +563,17 @@ void IntelliPhotoGui::createMenus(){
|
||||
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
||||
renderMenu->addAction(actionUpdateRenderSettingsOff);
|
||||
|
||||
//Attach all Layer Creations to Menu
|
||||
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
|
||||
layerCreationMenu->addAction(actionCreateNewRasterLayer);
|
||||
layerCreationMenu->addAction(actionCreateNewShapedLayer);
|
||||
// Attach all actions to Layer
|
||||
layerMenu = new QMenu(tr("&Layer"), this);
|
||||
layerMenu->addAction(actionCreateNewLayer);
|
||||
layerMenu->addMenu(layerCreationMenu);
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionSetActiveAlpha);
|
||||
layerMenu->addAction(actionSetActiveLayer);
|
||||
layerMenu->addAction(actionSetPolygon);
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionMovePositionUp);
|
||||
layerMenu->addAction(actionMovePositionDown);
|
||||
|
||||
Reference in New Issue
Block a user