mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +02:00
Merge branch 'dev' into 'master'
Readme Update See merge request creyd/intelliphoto!18
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# Presentation Links
|
||||
|
||||
- 0.3 https://prezi.com/view/M593VBJhmfwQzuqt3t6f/
|
||||
21
README.md
21
README.md
@@ -1,3 +1,22 @@
|
||||
# IntelliPhoto
|
||||
|
||||
For the user manual see docs/manual.pdf
|
||||
For the user manual see `docs/manual.pdf`
|
||||
|
||||
## Content
|
||||
|
||||
- `src` - Source Code
|
||||
- `docs` - Documentation of the source code and user manual
|
||||
- `Examples` - Temporary folder for example pictures
|
||||
- `Abgabe` - Files that were submitted
|
||||
|
||||
## Pesentations
|
||||
|
||||
- 0.3 https://prezi.com/view/M593VBJhmfwQzuqt3t6f/
|
||||
|
||||
## Branching
|
||||
|
||||
- `master` branch: current state of the program, pull requests only by maintainers or developers
|
||||
- `dev` branch: state of development for next week, will be merged every Thursday, pushable for maintainers, pull requests for everyone
|
||||
- `dev-X` branches: feature development branches which will be merged into dev, when tested
|
||||
|
||||
Every Thursday dev and master will be merged and tagged with the current version.
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include "Layer/PaintingArea.h"
|
||||
|
||||
// IntelliPhotoGui constructor
|
||||
IntelliPhotoGui::IntelliPhotoGui()
|
||||
{
|
||||
IntelliPhotoGui::IntelliPhotoGui(){
|
||||
//create Gui elements and lay them out
|
||||
createGui();
|
||||
// Create actions
|
||||
@@ -22,10 +21,8 @@ IntelliPhotoGui::IntelliPhotoGui()
|
||||
showMaximized();
|
||||
}
|
||||
|
||||
|
||||
// User tried to close the app
|
||||
void IntelliPhotoGui::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
void IntelliPhotoGui::closeEvent(QCloseEvent *event){
|
||||
// If they try to close maybeSave() returns true
|
||||
// if no changes have been made and the app closes
|
||||
if (maybeSave()) {
|
||||
@@ -39,8 +36,7 @@ void IntelliPhotoGui::closeEvent(QCloseEvent *event)
|
||||
|
||||
// Check if the current image has been changed and then
|
||||
// open a dialog to open a file
|
||||
void IntelliPhotoGui::slotOpen()
|
||||
{
|
||||
void IntelliPhotoGui::slotOpen(){
|
||||
// Check if changes have been made since last save
|
||||
// maybeSave() returns true if no changes have been made
|
||||
if (maybeSave()) {
|
||||
@@ -59,8 +55,7 @@ void IntelliPhotoGui::slotOpen()
|
||||
}
|
||||
|
||||
// Called when the user clicks Save As in the menu
|
||||
void IntelliPhotoGui::slotSave()
|
||||
{
|
||||
void IntelliPhotoGui::slotSave(){
|
||||
// A QAction represents the action of the user clicking
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
|
||||
@@ -72,8 +67,7 @@ void IntelliPhotoGui::slotSave()
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to create a New Layer
|
||||
void IntelliPhotoGui::slotCreateNewLayer()
|
||||
{
|
||||
void IntelliPhotoGui::slotCreateNewLayer(){
|
||||
// Stores button value
|
||||
bool ok1, ok2;
|
||||
|
||||
@@ -95,8 +89,7 @@ void IntelliPhotoGui::slotCreateNewLayer()
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to delete a Layer
|
||||
void IntelliPhotoGui::slotDeleteLayer()
|
||||
{
|
||||
void IntelliPhotoGui::slotDeleteLayer(){
|
||||
// Stores button value
|
||||
bool ok;
|
||||
|
||||
@@ -119,7 +112,6 @@ void slotCreateFloodFillTool(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IntelliPhotoGui::slotSetActiveAlpha(){
|
||||
// Stores button value
|
||||
bool ok1, ok2;
|
||||
@@ -239,18 +231,14 @@ void IntelliPhotoGui::slotCreateLineTool(){
|
||||
}
|
||||
|
||||
// Open an about dialog
|
||||
void IntelliPhotoGui::slotAboutDialog()
|
||||
{
|
||||
void IntelliPhotoGui::slotAboutDialog(){
|
||||
// Window title and text to display
|
||||
QMessageBox::about(this, tr("About Painting"),
|
||||
tr("<p><b>IntelliPhoto</b> Some nice ass looking software</p>"));
|
||||
}
|
||||
|
||||
// Define menu actions that call functions
|
||||
void IntelliPhotoGui::createActions()
|
||||
{
|
||||
|
||||
|
||||
void IntelliPhotoGui::createActions(){
|
||||
// Get a list of the supported file formats
|
||||
// QImageWriter is used to write images to files
|
||||
foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
|
||||
@@ -277,8 +265,6 @@ void IntelliPhotoGui::createActions()
|
||||
// Attach each PNG in save Menu
|
||||
actionSaveAs.append(pngSaveAction);
|
||||
|
||||
|
||||
|
||||
// Create exit action and tie to IntelliPhotoGui::close()
|
||||
actionExit = new QAction(tr("&Exit"), this);
|
||||
actionExit->setShortcuts(QKeySequence::Quit);
|
||||
@@ -357,8 +343,7 @@ void IntelliPhotoGui::createActions()
|
||||
}
|
||||
|
||||
// Create the menubar
|
||||
void IntelliPhotoGui::createMenus()
|
||||
{
|
||||
void IntelliPhotoGui::createMenus(){
|
||||
// Create Save As option and the list of file types
|
||||
saveAsMenu = new QMenu(tr("&Save As"), this);
|
||||
foreach (QAction *action, actionSaveAs)
|
||||
@@ -440,8 +425,7 @@ void IntelliPhotoGui::setIntelliStyle(){
|
||||
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
||||
}
|
||||
|
||||
bool IntelliPhotoGui::maybeSave()
|
||||
{
|
||||
bool IntelliPhotoGui::maybeSave(){
|
||||
// Check for changes since last save
|
||||
|
||||
//TODO insert variable for modified status here to make an save exit message
|
||||
@@ -468,8 +452,7 @@ bool IntelliPhotoGui::maybeSave()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
|
||||
{
|
||||
bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
|
||||
// Define path, name and default file type
|
||||
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
|
||||
|
||||
@@ -485,9 +468,7 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
|
||||
if (fileName.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
// Call for the file to be saved
|
||||
return paintingArea->save(fileName, fileFormat.constData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ class IntelliTool;
|
||||
|
||||
class IntelliColorPicker;
|
||||
|
||||
class IntelliPhotoGui : public QMainWindow
|
||||
{
|
||||
class IntelliPhotoGui : public QMainWindow{
|
||||
// Declares our class as a QObject which is the base class
|
||||
// for all Qt objects
|
||||
// QObjects handle events
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
#include"IntelliHelper.h"
|
||||
#include<algorithm>
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ public:
|
||||
return (p1.x()-p3.x())*(p2.y()-p3.y())-(p2.x()-p3.x())*(p1.y()-p3.y());
|
||||
}
|
||||
|
||||
|
||||
static inline bool isInTriangle(QPoint& A, QPoint& B, QPoint& C, QPoint& P){
|
||||
float val1, val2, val3;
|
||||
bool neg, pos;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "Tool/IntelliToolPlain.h"
|
||||
#include "Tool/IntelliToolLine.h"
|
||||
|
||||
|
||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
||||
:QWidget(parent){
|
||||
this->Tool = nullptr;
|
||||
@@ -40,7 +39,6 @@ PaintingArea::~PaintingArea(){
|
||||
delete Tool;
|
||||
}
|
||||
|
||||
|
||||
void PaintingArea::setUp(int maxWidth, int maxHeight){
|
||||
//set standart parameter
|
||||
this->maxWidth = maxWidth;
|
||||
@@ -85,7 +83,7 @@ void PaintingArea::slotDeleteActiveLayer(){
|
||||
}
|
||||
}
|
||||
|
||||
void PaintingArea::setLayerToActive(int index) {
|
||||
void PaintingArea::setLayerToActive(int index){
|
||||
if(index>=0&&index<static_cast<int>(layerBundle.size())){
|
||||
this->activeLayer=index;
|
||||
}
|
||||
@@ -97,10 +95,8 @@ void PaintingArea::setAlphaOfLayer(int index, int alpha){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Used to load the image and place it in the widget
|
||||
bool PaintingArea::open(const QString &fileName)
|
||||
{
|
||||
bool PaintingArea::open(const QString &fileName){
|
||||
if(this->activeLayer==-1){
|
||||
return false;
|
||||
}
|
||||
@@ -112,8 +108,7 @@ bool PaintingArea::open(const QString &fileName)
|
||||
}
|
||||
|
||||
// Save the current image
|
||||
bool PaintingArea::save(const QString &fileName, const char *fileFormat)
|
||||
{
|
||||
bool PaintingArea::save(const QString &fileName, const char *fileFormat){
|
||||
if(layerBundle.size()==0){
|
||||
return false;
|
||||
}
|
||||
@@ -136,7 +131,6 @@ bool PaintingArea::save(const QString &fileName, const char *fileFormat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Color the image area with white
|
||||
void PaintingArea::floodFill(int r, int g, int b, int a){
|
||||
if(this->activeLayer==-1){
|
||||
@@ -198,8 +192,7 @@ void PaintingArea::createLineTool(){
|
||||
// If a mouse button is pressed check if it was the
|
||||
// left button and if so store the current position
|
||||
// Set that we are currently drawing
|
||||
void PaintingArea::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
void PaintingArea::mousePressEvent(QMouseEvent *event){
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
@@ -212,12 +205,10 @@ void PaintingArea::mousePressEvent(QMouseEvent *event)
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
// When the mouse moves if the left button is clicked
|
||||
// we call the drawline function which draws a line
|
||||
// from the last position to the current
|
||||
void PaintingArea::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
void PaintingArea::mouseMoveEvent(QMouseEvent *event){
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
@@ -227,8 +218,7 @@ void PaintingArea::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
// If the button is released we set variables to stop drawing
|
||||
void PaintingArea::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
void PaintingArea::mouseReleaseEvent(QMouseEvent *event){
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
@@ -244,8 +234,7 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent *event)
|
||||
// QPainter provides functions to draw on the widget
|
||||
// The QPaintEvent is sent to widgets that need to
|
||||
// update themselves
|
||||
void PaintingArea::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
void PaintingArea::paintEvent(QPaintEvent *event){
|
||||
this->assembleLayers();
|
||||
|
||||
QPainter painter(this);
|
||||
@@ -256,13 +245,11 @@ void PaintingArea::paintEvent(QPaintEvent *event)
|
||||
|
||||
// Resize the image to slightly larger then the main window
|
||||
// to cut down on the need to resize the image
|
||||
void PaintingArea::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
void PaintingArea::resizeEvent(QResizeEvent *event){
|
||||
//TODO wait till tool works
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void PaintingArea::resizeImage(QImage *image_res, const QSize &newSize){
|
||||
//TODO implement
|
||||
}
|
||||
@@ -281,7 +268,6 @@ void PaintingArea::activateLowerLayer(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PaintingArea::assembleLayers(bool forSaving){
|
||||
if(forSaving){
|
||||
Canvas->fill(Qt::GlobalColor::transparent);
|
||||
|
||||
@@ -10,8 +10,7 @@ enum class LineStyle{
|
||||
DOTTED_LINE
|
||||
};
|
||||
|
||||
class IntelliToolLine : public IntelliTool
|
||||
{
|
||||
class IntelliToolLine : public IntelliTool{
|
||||
QPoint start;
|
||||
int lineWidth;
|
||||
LineStyle lineStyle;
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "IntelliTool.h"
|
||||
#include "QColor"
|
||||
|
||||
class IntelliToolPlainTool : public IntelliTool
|
||||
{
|
||||
class IntelliToolPlainTool : public IntelliTool{
|
||||
public:
|
||||
IntelliToolPlainTool(PaintingArea *Area, IntelliColorPicker* colorPicker);
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]){
|
||||
// The main application
|
||||
QApplication app(argc, argv);
|
||||
|
||||
@@ -14,7 +13,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user