diff --git a/desktop-app/CMakeLists.txt b/desktop-app/CMakeLists.txt index b805c79..ea0c454 100644 --- a/desktop-app/CMakeLists.txt +++ b/desktop-app/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.21) -project(untitled1) +project(Marple-Tilt-Map-Creator) set(CMAKE_CXX_STANDARD 14) set(CMAKE_AUTOMOC ON) @@ -15,8 +15,8 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED) -add_executable(untitled1 main.cpp window.h window.cpp map.h map.cpp Tab1Content.cpp Tab1Content.h Tab3Content.cpp Tab3Content.h Tab2Content.cpp Tab2Content.h Paint.cpp Paint.h) -target_link_libraries(untitled1 +add_executable(Marple-Tilt-Map-Creator main.cpp window.h window.cpp map.h map.cpp Tab1Content.cpp Tab1Content.h Tab3Content.cpp Tab3Content.h Tab2Content.cpp Tab2Content.h Paint.cpp Paint.h paintTab.cpp paintTab.h ImageInfo.cpp ImageInfo.h ColourPick.h ColourPick.cpp) +target_link_libraries(Marple-Tilt-Map-Creator Qt5::Core Qt5::Gui Qt5::Widgets @@ -40,6 +40,9 @@ if (WIN32) COMMAND ${CMAKE_COMMAND} -E copy "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll" "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/maps/") endif () foreach (QT_LIB Core Gui Widgets) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD diff --git a/desktop-app/ColourPick.cpp b/desktop-app/ColourPick.cpp new file mode 100644 index 0000000..68c03d9 --- /dev/null +++ b/desktop-app/ColourPick.cpp @@ -0,0 +1,23 @@ +// +// Created by Ali on 11/04/2022. +// + +#include "ColourPick.h" + +ColourPick::ColourPick(QWidget *parent) : + QWidget(parent) { + + +} + +QColor ColourPick::onColour() +{ + QColor colour = QColorDialog::getColor(Qt::yellow, this ); + if( colour.isValid() ) + { + return colour; + } + else{ + return Qt::black; + } +} diff --git a/desktop-app/ColourPick.h b/desktop-app/ColourPick.h new file mode 100644 index 0000000..2aa8879 --- /dev/null +++ b/desktop-app/ColourPick.h @@ -0,0 +1,25 @@ +// +// Created by Ali on 08/04/2022. +// + +#ifndef UNTITLED1_COLOURPICK_H +#define UNTITLED1_COLOURPICK_H + +#include +#include +#include + +class ColourPick : public QWidget +{ +Q_OBJECT +public: + explicit ColourPick(QWidget *parent); + + +signals: +public slots: + QColor onColour(); + +}; + +#endif //UNTITLED1_COLOURPICK_H diff --git a/desktop-app/ImageInfo.cpp b/desktop-app/ImageInfo.cpp new file mode 100644 index 0000000..2ca41d0 --- /dev/null +++ b/desktop-app/ImageInfo.cpp @@ -0,0 +1,5 @@ +// +// Created by Ali on 04/04/2022. +// + +#include "ImageInfo.h" diff --git a/desktop-app/ImageInfo.h b/desktop-app/ImageInfo.h new file mode 100644 index 0000000..e13e567 --- /dev/null +++ b/desktop-app/ImageInfo.h @@ -0,0 +1,30 @@ +// +// Created by Ali on 04/04/2022. +// + +#ifndef UNTITLED1_IMAGEINFO_H +#define UNTITLED1_IMAGEINFO_H + + +class ImageInfo { +private: + int *pixGrid[64][64]; + +public: + ImageInfo(){ + for(int i; i<64; i++){ + for(int j; j<64; j++){ + pixGrid[64][64] = 0; + } + } + } + int* readPixGrid(int x, int y){ + return pixGrid[x][y]; + } + void writePixGrid(int x, int y, int element){ + pixGrid[x][y] = &element; + } +}; + + +#endif //UNTITLED1_IMAGEINFO_H diff --git a/desktop-app/Paint.h b/desktop-app/Paint.h index c214d38..31ff29d 100644 --- a/desktop-app/Paint.h +++ b/desktop-app/Paint.h @@ -7,20 +7,94 @@ #include #include #include -#endif //UNTITLED1_PAINT_H +#include +#include "ImageInfo.h" +#include +#include +#include +#include +#include +#include +#include + + class Paint : public QWidget { Q_OBJECT public: Paint(QWidget *parent = 0) : QWidget(parent), pressed(0) { - color = Qt::black; + color, brushColor = Qt::black; pixmap = new QPixmap(64, 64); pixmap->fill(); resize(640, 640); + coordinates = new QVector(); + brushSize = 1; + + } ~Paint() { if (pixmap) delete pixmap; } + int element = 0; + + + + struct coord { + int x; + int y; + int el; + int key = 0; + }; + + + QVector *coordinates; + + + + void setElement(int el){ + if(el == 0){ + color = brushColor; + } + element = el; + } + + void setColour(QColor colour){ + color = colour; + } + + void setBrushColour(QColor colour){ + brushColor = colour; + } + + int getElement(){ + return element; + } + + void setBrushSize(int i){ + brushSize = i; + } + + void borderIn(){ + border(); + } + + void setMarpleSize(int mSize){ + marpleSize = mSize; + for(int i = 0; i<20; i++){ + resetElements(); + } + + } + + void resetAll(){ + for(int i = 0; i<20; i++){ + resetElements(); + } + pixmap->fill(); + repaint(); + } + + protected: void paintEvent(QPaintEvent *) { QPainter painter(this); @@ -29,8 +103,8 @@ Q_OBJECT } void mousePressEvent(QMouseEvent *e) { - if (e->button() == Qt::RightButton) - color = color == Qt::black ? Qt::blue : Qt::black; + if (e->button() == Qt::RightButton){} + else { pressed = 1; draw(e); @@ -38,7 +112,13 @@ Q_OBJECT } void mouseReleaseEvent(QMouseEvent *) { pressed = 0; } - void mouseMoveEvent(QMouseEvent *e) { draw(e); } + void mouseMoveEvent(QMouseEvent *e) { + if(element == 0 or element == 4){ + draw(e); + } + } + + private: void draw(QMouseEvent *e) { @@ -47,12 +127,199 @@ Q_OBJECT painter.setPen(color); int x = e->pos().x()/10; int y = e->pos().y()/10; - painter.drawPoint(x, y); + if(element == 4){ + for(int i = 0; i < brushSize; i++){ + for(int j = 0; j < brushSize; j++){ + painter.drawPoint(x+i, y-j); + } + } + if(itemCheck(x,y)){ + int key = 0; + for(int i = 0; i < coordinates->size(); i++){ + if((coordinates->at(i).x == x) && (coordinates->at(i).y == y)){ + key = coordinates->at(i).key; + } + } + for(int i = 0; i < coordinates->size(); i++){ + std::cout << key; + std::cout << coordinates->at(i).key; + std::cout << "\n"; + if(coordinates->at(i).key == key){ + painter.drawPoint(coordinates->at(i).x, coordinates->at(i).y); + coordinates->remove(i); + } + } + } + + + } + + else{ + bool check = false; + + for(int i = 0; i < brushSize; i++){ + for(int j = 0; j < brushSize; j++){ + if(itemCheck(x+i,y-j)){ + check = true; + } + } + } + + if(element == 0){ + if(!check){ + for(int i = 0; i < brushSize; i++){ + for(int j = 0; j < brushSize; j++){ + painter.drawPoint(x+i, y-j); + } + } + } + }else{ + for(int i = 0; i < marpleSize; i++){ + for(int j = 0; j < marpleSize; j++){ + if(itemCheck(x+i,y-j)){ + check = true; + } + } + } + if(!check){ + for(int i = 0; i < marpleSize; i++){ + for(int j = 0; j < marpleSize; j++){ + painter.drawPoint(x+i, y-j); + updateMap(x+i,y-j); + } + } + itemKey ++; + } + } + } repaint(); } } + void updateMap(int x, int y){ + coord coordinate; + coordinate.x = x; + coordinate.y = y; + coordinate.el = element; + coordinate.key = itemKey; + coordinates->append(coordinate); + } + + bool itemCheck(int x, int y){ + bool check = false; + + for(int i = 0; i < coordinates->size(); i++){ + if((coordinates->at(i).x == x) && (coordinates->at(i).y == y)){ + check = true; + } + } + return check; + } + + void border(){ + QPainter painter(pixmap); + painter.setPen(color); + for(int i = 0; i < 64; i++){ + for(int j = 0; j < brushSize; j++){ + painter.drawPoint(0+j, 0+j+i); + painter.drawPoint(0+j+i, 0+j); + painter.drawPoint(63-j-i, 63-j); + painter.drawPoint(63-j, 63-j-i); + } + + } + + repaint(); + } + + void resetElements(){ + QColor colorStore = color; + color = "#ffffff"; + QPainter painter(pixmap); + painter.setPen(color); + int x = 0; + int y = 0; + for(int i = 0; i < coordinates->size(); i++){ + x = coordinates->at(i).x; + y = coordinates->at(i).y; + painter.drawPoint(x,y); + coordinates->remove(i); + } + color = colorStore; + repaint(); + + } + QColor color; + QColor brushColor; QPixmap *pixmap; bool pressed; -}; \ No newline at end of file + int marpleSize = 3; + int itemKey = 1; + int brushSize; + +signals: +public slots: + void writeFile(){ + QPixmap map = pixmap->scaled(64, 64); + QImage im = map.toImage(); + coord coordinate; + char en = 'W'; + std::string size = std::to_string(marpleSize); + bool isElement = false; + bool ok; + QString mapName = "map"; + QString text = QInputDialog::getText(this, tr("Write"), tr("File-Name:"), QLineEdit::Normal, mapName, &ok); + if (ok && !text.isEmpty()){ + mapName = text; + } + + std::ofstream outFile; + outFile.open("maps/"+mapName.toStdString()+".csv"); //"C:/Marple-Tilt-Maps/"+ + for(int i = 0; i < 64; i++){ + for(int j = 0; j <64; j++){ + for(int n = 0; n < coordinates->size(); n++){ + coordinate = coordinates->at(n); + if(coordinate.x == j && coordinate.y == i){ + if(coordinate.el == 1){ + en = 'H'; + isElement = true; + + } + if(coordinate.el == 2){ + en = 'S'; + isElement = true; + } + if(coordinate.el == 3){ + en = 'E'; + isElement = true; + } + } + } + + QColor p = im.pixelColor(j,i); + QString name = p.name(); + if(name.toStdString() == "#ffffff"){ + en = 'N'; + } + QString outP = name.insert(0,en); + std::string outPut = outP.toStdString(); + if(isElement){ + outPut = outPut.append(size); + } + + std::cout << outPut; + std::cout << " "; + outFile << outPut + ","; + en = 'W'; + isElement = false; + } + + std::cout << '\n'; + outFile << "\n"; + } + outFile.close(); + } +}; + +#endif //UNTITLED1_PAINT_H diff --git a/desktop-app/Tab1Content.cpp b/desktop-app/Tab1Content.cpp index c43b53a..4a66aba 100644 --- a/desktop-app/Tab1Content.cpp +++ b/desktop-app/Tab1Content.cpp @@ -8,45 +8,55 @@ #include #include "Paint.cpp" -Tab1Content::Tab1Content(QWidget *parent) : +Tab1Content::Tab1Content(Window *parent, Paint *painter) : QWidget(parent) { QGridLayout *frame = new QGridLayout(this); - QWidget *left = new QWidget; + //QWidget *left = new QWidget; - QWidget *right= new QWidget; - QGridLayout *leftFrame = new QGridLayout(left); - leftFrame->setSpacing(0); - leftFrame->setContentsMargins(0, 80, 0, 80); - frame->addWidget(left, 0, 0); - frame->addWidget(right, 0,1); + //QWidget *right= new QWidget; + //QGridLayout *leftFrame = new QGridLayout(left); + //leftFrame->setSpacing(0); + //leftFrame->setContentsMargins(0, 80, 0, 80); + //frame->addWidget(left, 0, 0); + //frame->addWidget(right, 0,1); - Paint *painter = new Paint(right); + q_button1 = new QPushButton(this); + q_button1->setFixedSize(300,300); + q_button1->setStyleSheet("background-color: #d7d6d5"); + q_button1->setText("1x1"); + connect(q_button1, &QPushButton::released, this, std::bind(&Tab1Content::setMarpleSize, this, 1, painter)); + q_button2 = new QPushButton(this); + q_button2->setFixedSize(300,300); + q_button2->setStyleSheet("background-color: #d7d6d5"); + q_button2->setText("2x2"); + connect(q_button2, &QPushButton::released, this, std::bind(&Tab1Content::setMarpleSize, this, 2, painter)); + q_button3 = new QPushButton(this); + q_button3->setFixedSize(300,300); + q_button3->setStyleSheet("background-color: #d7d6d5"); + q_button3->setText("3x3"); + connect(q_button3, &QPushButton::released, this, std::bind(&Tab1Content::setMarpleSize, this, 3, painter)); + q_button4 = new QPushButton(this); + q_button4->setFixedSize(300,300); + q_button4->setStyleSheet("background-color: #d7d6d5"); + q_button4->setText("4x4"); + connect(q_button4, &QPushButton::released, this, std::bind(&Tab1Content::setMarpleSize, this, 4, painter)); - q_buttonA1 = new QPushButton(this); - q_buttonA1->setFixedSize(300,300); - q_buttonA1->setStyleSheet("background-color: #d7d6d5"); - q_buttonA2 = new QPushButton(this); - q_buttonA2->setFixedSize(300,300); - q_buttonA2->setStyleSheet("background-color: #d7d6d5"); - q_buttonB1 = new QPushButton(this); - q_buttonB1->setFixedSize(300,300); - q_buttonB1->setStyleSheet("background-color: #d7d6d5"); - q_buttonB2 = new QPushButton(this); - q_buttonB2->setFixedSize(300,300); - q_buttonB2->setStyleSheet("background-color: #d7d6d5"); + frame->addWidget(q_button1, 0, 0, Qt::AlignCenter); + frame->addWidget(q_button2, 0, 1, Qt::AlignCenter); + frame->addWidget(q_button3, 1, 0, Qt::AlignCenter); + frame->addWidget(q_button4, 1, 1, Qt::AlignCenter); - leftFrame->addWidget(q_buttonA1, 0, 0, Qt::AlignCenter); - leftFrame->addWidget(q_buttonA2, 0, 1, Qt::AlignCenter); - leftFrame->addWidget(q_buttonB1, 1, 0, Qt::AlignCenter); - leftFrame->addWidget(q_buttonB2, 1, 1, Qt::AlignCenter); +} +void::Tab1Content::setMarpleSize(int size, Paint *painter){ + painter->setMarpleSize(size); -} +} \ No newline at end of file diff --git a/desktop-app/Tab1Content.h b/desktop-app/Tab1Content.h index 351ec0c..b972085 100644 --- a/desktop-app/Tab1Content.h +++ b/desktop-app/Tab1Content.h @@ -5,21 +5,25 @@ #ifndef UNTITLED1_TAB1CONTENT_H #define UNTITLED1_TAB1CONTENT_H #include +#include "window.h" +#include "Paint.h" class QPushButton; class Tab1Content: public QWidget { Q_OBJECT public: - explicit Tab1Content(QWidget *parent); + explicit Tab1Content(Window *parent, Paint *painter); + int marpleSize = 0; private: - QPushButton *q_buttonA1; - QPushButton *q_buttonA2; - QPushButton *q_buttonB1; - QPushButton *q_buttonB2; + QPushButton *q_button1; + QPushButton *q_button2; + QPushButton *q_button3; + QPushButton *q_button4; signals: public slots: + void setMarpleSize(int size, Paint *painter); private slots: }; diff --git a/desktop-app/paintTab.cpp b/desktop-app/paintTab.cpp new file mode 100644 index 0000000..c748a86 --- /dev/null +++ b/desktop-app/paintTab.cpp @@ -0,0 +1,214 @@ +// +// Created by Ali on 04/04/2022. +// + +#include "paintTab.h" +#include +#include "Paint.h" +#include +#include +#include +#include "ColourPick.h" + +paintTab::paintTab(QWidget *parent) : + QWidget(parent) { + + QGridLayout *frame = new QGridLayout(this); + + QWidget *left = new QWidget; + left->setFixedSize(640, 640); + + QWidget *right= new QWidget; + right->setStyleSheet("background-color: #d7d6f0"); + + + QGridLayout *rightFrame = new QGridLayout(right); + rightFrame->setSpacing(0); + rightFrame->setContentsMargins(0, 80, 0, 80); + + + Paint *painter = new Paint(left); + + ColourPick *colourPicker = new ColourPick(right); + + QPushButton *wall = new QPushButton(right); + wall->setText("Wall"); + wall->setStyleSheet("background-color: #61d5ff"); + wall->setFixedSize(120,60); + connect(wall, &QPushButton::released, this, std::bind(&paintTab::wallMode, this, painter)); + QPushButton *hole = new QPushButton(right); + hole->setText("Hole"); + hole->setStyleSheet("background-color: #9c9c9c"); + hole->setFixedSize(120,60); + connect(hole, &QPushButton::released, this, std::bind(&paintTab::holeMode, this, painter)); + QPushButton *start = new QPushButton(right); + start->setText("Marple-Start"); + start->setStyleSheet("background-color: #84dd3c"); + start->setFixedSize(120,60); + connect(start, &QPushButton::released, this, std::bind(&paintTab::startMode, this, painter)); + QPushButton *end = new QPushButton(right); + end->setText("End-Goal"); + end->setStyleSheet("background-color: #c15e60"); + end->setFixedSize(120,60); + connect(end, &QPushButton::released, this, std::bind(&paintTab::endMode, this, painter)); + + QPushButton *paintButton = new QPushButton(right); + connect(paintButton, &QPushButton::released, colourPicker, std::bind(&paintTab::selectColour, this, painter, colourPicker, wall)); + paintButton->setStyleSheet("background-color: #ffaa7f"); + paintButton->setText("Change Colour"); + paintButton->setFixedSize(120,60); + + QPushButton *eraser = new QPushButton(right); + connect(eraser, &QPushButton::released, this, std::bind(&paintTab::erase, this, painter)); + eraser->setStyleSheet("background-color: #fff0ca"); + eraser->setText("Eraser"); + eraser->setFixedSize(120,60); + + rightFrame->addWidget(wall, 0, 0, Qt::AlignCenter); + rightFrame->addWidget(hole, 1, 0, Qt::AlignCenter); + rightFrame->addWidget(start, 2, 0, Qt::AlignCenter); + rightFrame->addWidget(end, 3, 0, Qt::AlignCenter); + rightFrame->addWidget(eraser, 4, 0, Qt::AlignCenter); + rightFrame->addWidget(paintButton,4,1,Qt::AlignCenter); + + frame->addWidget(left, 0, 0); + frame->addWidget(right, 0,1); + + QPushButton *writeFileButton = new QPushButton(this); + connect(writeFileButton, &QPushButton::released, painter, &Paint::writeFile); + writeFileButton->setStyleSheet("background-color: #7fa0de"); + writeFileButton->setText("Save to File"); + + QFrame *brushFrame = new QFrame(right); + brushFrame->setWindowIconText("Brush Size"); + rightFrame->addWidget(brushFrame, 0, 1, Qt::AlignCenter); + QGridLayout *brushSize = new QGridLayout(brushFrame); + QLabel *brushLabel = new QLabel(brushFrame); + brushLabel->setText("Brush Size"); + QPushButton *oneB = new QPushButton(right); + oneB->setText("1"); + oneB->setStyleSheet("background-color: #d5ccf0"); + QPushButton *twoB = new QPushButton(right); + twoB->setText("2"); + twoB->setStyleSheet("background-color: #d5ccf0"); + QPushButton *threeB = new QPushButton(right); + threeB->setText("3"); + threeB->setStyleSheet("background-color: #d5ccf0"); + QPushButton *fourB = new QPushButton(right); + fourB->setText("4"); + fourB->setStyleSheet("background-color: #d5ccf0"); + brushSize->addWidget(oneB, 0, 0, Qt::AlignCenter); + brushSize->addWidget(twoB, 0, 1, Qt::AlignCenter); + brushSize->addWidget(threeB, 0, 2, Qt::AlignCenter); + brushSize->addWidget(fourB, 0, 3, Qt::AlignCenter); + brushSize->addWidget(brushLabel, 1, 1, Qt::AlignRight); + + connect(oneB, &QPushButton::released, this, std::bind(&paintTab::setBrushSize, this, painter, 1)); + connect(twoB, &QPushButton::released, this, std::bind(&paintTab::setBrushSize, this, painter, 2)); + connect(threeB, &QPushButton::released, this, std::bind(&paintTab::setBrushSize, this, painter, 3)); + connect(fourB, &QPushButton::released, this, std::bind(&paintTab::setBrushSize, this, painter, 4)); + + QPushButton *borderPush = new QPushButton(right); + borderPush->setText("Draw Border"); + borderPush->setStyleSheet("background-color: #ffdf6b"); + borderPush->setFixedSize(120,60); + rightFrame->addWidget(borderPush, 2, 1, Qt::AlignCenter); + connect(borderPush, &QPushButton::released, this, std::bind(&paintTab::border, this, painter)); + + QFrame *msFrame = new QFrame(right); + msFrame->setWindowIconText("Brush Size"); + rightFrame->addWidget(msFrame, 1, 1, Qt::AlignCenter); + QGridLayout *mSize = new QGridLayout(msFrame); + QLabel *mLabel = new QLabel(msFrame); + mLabel->setText("Marple-Size: "); + QLabel *wLabel = new QLabel(msFrame); + wLabel->setText("(!Will reset non"); + QLabel *dLabel = new QLabel(msFrame); + dLabel->setText("-wall elements!)"); + + QPushButton *oneM = new QPushButton(right); + oneM->setText("1"); + oneM->setStyleSheet("background-color: #d5ccf0"); + QPushButton *twoM = new QPushButton(right); + twoM->setText("2"); + twoM->setStyleSheet("background-color: #d5ccf0"); + QPushButton *threeM = new QPushButton(right); + threeM->setText("3"); + threeM->setStyleSheet("background-color: #d5ccf0"); + QPushButton *fourM = new QPushButton(right); + fourM->setText("4"); + fourM->setStyleSheet("background-color: #d5ccf0"); + mSize->addWidget(oneM, 0, 0, Qt::AlignCenter); + mSize->addWidget(twoM, 0, 1, Qt::AlignCenter); + mSize->addWidget(threeM, 0, 2, Qt::AlignCenter); + mSize->addWidget(fourM, 0, 3, Qt::AlignCenter); + mSize->addWidget(mLabel, 1, 1, Qt::AlignRight); + mSize->addWidget(wLabel, 1, 2, Qt::AlignLeft); + mSize->addWidget(dLabel, 1, 3, Qt::AlignLeft); + + connect(oneM, &QPushButton::released, this, std::bind(&paintTab::setMarpleSize, this, painter, 1)); + connect(twoM, &QPushButton::released, this, std::bind(&paintTab::setMarpleSize, this, painter, 2)); + connect(threeM, &QPushButton::released, this, std::bind(&paintTab::setMarpleSize, this, painter, 3)); + connect(fourM, &QPushButton::released, this, std::bind(&paintTab::setMarpleSize, this, painter, 4)); + + QPushButton *resetButton = new QPushButton(right); + resetButton->setText("Clear Map"); + resetButton->setStyleSheet("background-color: #c788b3"); + resetButton->setFixedSize(120,60); + rightFrame->addWidget(resetButton, 3, 1, Qt::AlignCenter); + connect(resetButton, &QPushButton::released, this, std::bind(&paintTab::resetAll, this, painter)); + + + +} + +void::paintTab::wallMode(Paint *painter){ + painter->setElement(0); +} + +void::paintTab::holeMode(Paint *painter){ + painter->setElement(1); + painter->setColour("#000000"); +} + +void::paintTab::startMode(Paint *painter){ + painter->setElement(2); + painter->setColour("#84dd3c"); +} + +void::paintTab::endMode(Paint *painter){ + painter->setElement(3); + painter->setColour("#c15e60"); +} + +void::paintTab::selectColour(Paint *painter, ColourPick *picker, QPushButton *wall){ + int element = painter->getElement(); + if(element != 4){ + QColor colour = picker->onColour(); + painter->setColour(colour); + painter->setBrushColour(colour); + wall->setStyleSheet("background-color: "+colour.name()); + } +} + +void::paintTab::erase(Paint *painter){ + painter->setColour("#ffffff"); + painter->setElement(4); +} + +void::paintTab::setBrushSize(Paint *painter, int i){ + painter->setBrushSize(i); + +} + +void::paintTab::border(Paint *painter){ + painter->borderIn(); +} + +void::paintTab::setMarpleSize(Paint *painter, int i){ + painter->setMarpleSize(i); +} + +void::paintTab::resetAll(Paint *painter){ + painter->resetAll(); +} diff --git a/desktop-app/paintTab.h b/desktop-app/paintTab.h new file mode 100644 index 0000000..3fda636 --- /dev/null +++ b/desktop-app/paintTab.h @@ -0,0 +1,47 @@ +// +// Created by Ali on 04/04/2022. +// + + +#ifndef UNTITLED1_PAINTTAB_H +#define UNTITLED1_PAINTTAB_H +#include +#include "Paint.h" +#include "ImageInfo.h" +#include +#include "ColourPick.h" + +class Paint; +class ColourPick; +class QPushButton; +class paintTab: public QWidget { +Q_OBJECT +public: + explicit paintTab(QWidget *parent); + Paint *painter; + ColourPick *colourPicker; + + + +private: + + + +signals: +public slots: + void writeFile(){painter->writeFile();} + +private slots: + void wallMode(Paint *painter); + void holeMode(Paint *painter); + void startMode(Paint *painter); + void endMode(Paint *painter); + void selectColour(Paint *painter, ColourPick *picker, QPushButton *wall); + void erase(Paint *painter); + void setBrushSize(Paint *painter, int i); + void border(Paint *painter); + void setMarpleSize(Paint *painter, int i); + void resetAll(Paint *painter); +}; + +#endif //UNTITLED1_PAINTTAB_H diff --git a/desktop-app/untitled1.pro b/desktop-app/untitled1.pro deleted file mode 100644 index 7e62739..0000000 --- a/desktop-app/untitled1.pro +++ /dev/null @@ -1,25 +0,0 @@ -###################################################################### -# Automatically generated by qmake (3.1) Mon Feb 21 16:18:46 2022 -###################################################################### - -TEMPLATE = app -TARGET = untitled1 -INCLUDEPATH += . - -# You can make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# Please consult the documentation of the deprecated API in order to know -# how to port your code away from it. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -# Input -SOURCES += main.cpp \ - cmake-build-debug/untitled1_autogen/mocs_compilation.cpp \ - cmake-build-debug/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c \ - cmake-build-debug/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp \ - cmake-build-debug-mingw/CMakeFiles/3.21.1/CompilerIdC/CMakeCCompilerId.c \ - cmake-build-debug-mingw/CMakeFiles/3.21.1/CompilerIdCXX/CMakeCXXCompilerId.cpp - - -QT += widgets \ No newline at end of file diff --git a/desktop-app/window.cpp b/desktop-app/window.cpp index 6b85166..4d1610a 100644 --- a/desktop-app/window.cpp +++ b/desktop-app/window.cpp @@ -8,6 +8,9 @@ #include "Tab2Content.h" #include "Tab3Content.h" #include "Paint.h" +#include "paintTab.h" +#include "ImageInfo.h" +#include Window::Window(QWidget *parent) : QWidget(parent) { @@ -16,23 +19,25 @@ Window::Window(QWidget *parent) : this->setWindowTitle("Marple Tilt Map Creator"); + QMenuBar *menuBar = new QMenuBar(this); - QMenu *fileMenu = menuBar->addMenu(tr("&File")); + QTabWidget *tabBar = new QTabWidget(this); - Tab1Content *tab1 = new Tab1Content(this); - QWidget *tab2 = new Tab2Content(this); - QWidget *tab3 = new Tab3Content(this); - QWidget *tab4 = new Paint(this); + tabBar->setStyleSheet("background-color: #c0bcde"); tabBar->setVisible(true); tabBar->setGeometry(0, 20, 1200, 800); - tabBar->insertTab(0, tab1, "1"); - tabBar->insertTab(1, tab2, "2"); - tabBar->insertTab(2, tab3, "3"); - tabBar->insertTab(3, tab4, "4"); + paintTab *painterTab = new paintTab(this); + painterTab->setStyleSheet("background-color: #c0bcde"); + tabBar->insertTab(1, painterTab, "Paint"); + //Tab1Content *tab1 = new Tab1Content(this, painterTab->painter); + //tabBar->insertTab(0, tab1, "Marple Size"); + + + +} -} \ No newline at end of file diff --git a/desktop-app/window.h b/desktop-app/window.h index 1ad5043..c67721f 100644 --- a/desktop-app/window.h +++ b/desktop-app/window.h @@ -7,14 +7,17 @@ #include #include "map.h" +#include "ImageInfo.h" #include class QPushButton; class QMenuBar; +class paintTab; class Window : public QWidget { Q_OBJECT public: explicit Window(QWidget *parent = 0); + paintTab *painterTab; private: QMenuBar *menuBar; QPushButton *q_button; @@ -25,6 +28,10 @@ Q_OBJECT signals: public slots: + + +private slots: + }; #endif // WINDOW_H \ No newline at end of file