Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mohammad O Hamdan
EasyPaint2
Commits
bfa9242f
Commit
bfa9242f
authored
5 years ago
by
Mohammad O Hamdan
Browse files
Options
Download
Email Patches
Plain Diff
create Triangle branch and add source code
parent
452ae75c
Triangle
No related merge requests found
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
157 additions
and
340 deletions
+157
-340
CMakeLists.txt
CMakeLists.txt
+3
-2
sources/easypaint.pro
sources/easypaint.pro
+3
-0
sources/easypaintenums.h
sources/easypaintenums.h
+1
-0
sources/imagearea.cpp
sources/imagearea.cpp
+2
-5
sources/imagearea.h
sources/imagearea.h
+1
-2
sources/instruments/triangleinstrument.cpp
sources/instruments/triangleinstrument.cpp
+104
-0
sources/instruments/triangleinstrument.h
sources/instruments/triangleinstrument.h
+23
-0
sources/mainwindow.cpp
sources/mainwindow.cpp
+13
-296
sources/mainwindow.h
sources/mainwindow.h
+1
-3
sources/media/instruments-icons/triangleWidget.png
sources/media/instruments-icons/triangleWidget.png
+0
-0
sources/resources.qrc
sources/resources.qrc
+1
-0
sources/widgets/palettebutton.cpp
sources/widgets/palettebutton.cpp
+0
-28
sources/widgets/palettebutton.h
sources/widgets/palettebutton.h
+0
-1
sources/widgets/toolbar.cpp
sources/widgets/toolbar.cpp
+4
-2
sources/widgets/toolbar.h
sources/widgets/toolbar.h
+1
-1
No files found.
CMakeLists.txt
View file @
bfa9242f
...
...
@@ -55,7 +55,7 @@ set (HEADERS
sources/instruments/curvelineinstrument.h
sources/instruments/textinstrument.h
sources/instruments/signaturetool.h
)
sources/instrumnets/triangleinstrument.h
)
#------- sources --------
set
(
SOURCES
sources/main.cpp
...
...
@@ -97,7 +97,8 @@ set (SOURCES
sources/instruments/colorpickerinstrument.cpp
sources/instruments/curvelineinstrument.cpp
sources/instruments/textinstrument.cpp
sources/instruments/signaturetool.cpp
)
sources/instruments/signaturetool.cpp
sources/instrumnets/triangleinstrument.cpp
)
#------- resources -------
set
(
RESOURCE_PATH
...
...
This diff is collapsed.
Click to expand it.
sources/easypaint.pro
View file @
bfa9242f
...
...
@@ -17,6 +17,7 @@ UI_DIR = build
SOURCES
+=
main
.
cpp
\
instruments
/
signaturetool
.
cpp
\
instruments
/
triangleinstrument
.
cpp
\
mainwindow
.
cpp
\
imagearea
.
cpp
\
datasingleton
.
cpp
\
...
...
@@ -62,6 +63,7 @@ HEADERS += mainwindow.h \
datasingleton
.
h
\
additionaltools
.
h
\
instruments
/
signaturetool
.
h
\
instruments
/
triangleinstrument
.
h
\
undocommand
.
h
\
widgets
/
toolbar
.
h
\
widgets
/
colorchooser
.
h
\
...
...
@@ -170,6 +172,7 @@ DISTFILES += \
media/instruments-icons/rectangle.png \
media/instruments-icons/spray.png \
media/instruments-icons/text.png \
media/instruments-icons/triangleWidget.png \
media/logo/easypaint_512.png \
media/logo/easypaint_srs.cdr \
media/signature/yoursignature.png \
...
...
This diff is collapsed.
Click to expand it.
sources/easypaintenums.h
View file @
bfa9242f
...
...
@@ -46,6 +46,7 @@ typedef enum
CURVELINE
,
TEXT
,
SIGNATURE
,
TRIANGLE
,
// Don't use it. (Used to know count of current instrument)
INSTRUMENTS_COUNT
...
...
This diff is collapsed.
Click to expand it.
sources/imagearea.cpp
100755 → 100644
View file @
bfa9242f
...
...
@@ -63,6 +63,7 @@
#include <QImageWriter>
#include <QUndoStack>
#include "instruments/triangleinstrument.h"
#include "instruments/signaturetool.h"
ImageArea
::
ImageArea
(
const
bool
&
isOpen
,
const
QString
&
filePath
,
QWidget
*
parent
)
:
...
...
@@ -128,6 +129,7 @@ ImageArea::ImageArea(const bool &isOpen, const QString &filePath, QWidget *paren
mInstrumentsHandlers
[
CURVELINE
]
=
new
CurveLineInstrument
(
this
);
mInstrumentsHandlers
[
TEXT
]
=
new
TextInstrument
(
this
);
mInstrumentsHandlers
[
SIGNATURE
]
=
new
SignatureTool
(
this
);
mInstrumentsHandlers
[
TRIANGLE
]
=
new
TriangleInstrument
(
this
);
// Effects handlers
mEffectsHandlers
.
fill
(
0
,
(
int
)
EFFECTS_COUNT
);
...
...
@@ -274,11 +276,6 @@ void ImageArea::resizeImage()
emit
sendNewImageSize
(
mImage
->
size
());
}
void
ImageArea
::
resizeCanvas
(
int
w
,
int
h
)
{
mAdditionalTools
->
resizeCanvas
(
w
,
h
,
false
);
emit
sendNewImageSize
(
mImage
->
size
());
}
void
ImageArea
::
resizeCanvas
()
{
mAdditionalTools
->
resizeCanvas
(
mImage
->
width
(),
mImage
->
height
(),
true
);
...
...
This diff is collapsed.
Click to expand it.
sources/imagearea.h
100755 → 100644
View file @
bfa9242f
...
...
@@ -78,8 +78,7 @@ public:
* @brief Resize image.
*
*/
void
resizeImage
();
void
resizeCanvas
(
int
width
,
int
height
);
void
resizeImage
();
/**
* @brief Resize canvas using resize dialog.
*
...
...
This diff is collapsed.
Click to expand it.
sources/instruments/triangleinstrument.cpp
0 → 100644
View file @
bfa9242f
#include <QPen>
#include <QPainter>
#include "../imagearea.h"
#include "../datasingleton.h"
#include "triangleinstrument.h"
TriangleInstrument
::
TriangleInstrument
(
QObject
*
parent
)
:
AbstractInstrument
(
parent
)
{
}
void
TriangleInstrument
::
mousePressEvent
(
QMouseEvent
*
e
,
ImageArea
&
image
)
{
//when either right button or left button is pressed
//do init the starting and ending points
if
(
e
->
button
()
==
Qt
::
RightButton
||
e
->
button
()
==
Qt
::
LeftButton
)
{
this
->
mStartPoint
=
e
->
pos
();
this
->
mEndPoint
=
e
->
pos
();
image
.
setIsPaint
(
true
);
this
->
mImageCopy
=
*
image
.
getImage
();
makeUndoCommand
(
image
);
}
}
void
TriangleInstrument
::
mouseMoveEvent
(
QMouseEvent
*
event
,
ImageArea
&
imageArea
)
{
//make sure the paint is true and not false
if
(
imageArea
.
isPaint
()
!=
false
)
{
//init the end point when pressed then set the image copy
mEndPoint
=
event
->
pos
();
imageArea
.
setImage
(
mImageCopy
);
//if right button is the event then paint image is true
if
(
event
->
buttons
()
&
Qt
::
RightButton
)
{
paint
(
imageArea
,
true
);
}
//if left button is the event then paint image is true
if
(
event
->
buttons
()
&
Qt
::
LeftButton
)
{
paint
(
imageArea
,
false
);
}
}
else
{
//if paint is false out put
std
::
cout
<<
"in mouseMoveEvent: paint is false"
<<
std
::
endl
;
}
}
void
TriangleInstrument
::
mouseReleaseEvent
(
QMouseEvent
*
e
,
ImageArea
&
image
)
{
//if image is not false then do a mouse release
if
(
image
.
isPaint
()
!=
false
)
{
//set the image to the image copy
image
.
setImage
(
mImageCopy
);
//when left button is pressed paint
if
(
e
->
button
()
==
Qt
::
LeftButton
)
{
paint
(
image
,
false
);
}
// when the right buttons is pressed do paint
if
(
e
->
button
()
==
Qt
::
RightButton
)
{
paint
(
image
,
true
);
}
image
.
setIsPaint
(
false
);
}
}
//paint function should be like the rest of the other paint functions in the instruments
void
TriangleInstrument
::
paint
(
ImageArea
&
imageArea
,
bool
isSecondaryColor
,
bool
)
{
//grab a copy of the image and start the drawing
QPainter
painting
(
imageArea
.
getImage
());
painting
.
setPen
(
QPen
(
DataSingleton
::
Instance
()
->
getPrimaryColor
(),
DataSingleton
::
Instance
()
->
getPenSize
()
*
imageArea
.
getZoomFactor
(),
Qt
::
SolidLine
,
Qt
::
RoundCap
,
Qt
::
RoundJoin
));
//make sure the start point is not the same as endpoint for the drawing
if
(
this
->
mStartPoint
!=
this
->
mEndPoint
)
{
//init a polygon variable
QPolygon
polygon
;
//calculate the polygon with the start and end points
//
polygon
<<
this
->
mStartPoint
<<
this
->
mEndPoint
<<
QPoint
(
this
->
mStartPoint
.
x
()
-
this
->
mEndPoint
.
x
(),
this
->
mStartPoint
.
y
());
//when calculated then draw the polygon on paint
painting
.
drawPolygon
(
polygon
);
}
//if secondary color is not false then set brush
if
(
isSecondaryColor
!=
false
)
{
painting
.
setBrush
(
QBrush
(
DataSingleton
::
Instance
()
->
getSecondaryColor
()));
}
imageArea
.
setEdited
(
true
);
painting
.
end
();
imageArea
.
update
();
}
This diff is collapsed.
Click to expand it.
sources/instruments/triangleinstrument.h
0 → 100644
View file @
bfa9242f
#ifndef TRIANGLEINSTRUMENT_H
#define TRIANGLEINSTRUMENT_H
#include <iostream>
#include <QtCore/QObject>
#include "abstractinstrument.h"
class
TriangleInstrument
:
public
AbstractInstrument
{
Q_OBJECT
public:
explicit
TriangleInstrument
(
QObject
*
parent
=
0
);
void
mousePressEvent
(
QMouseEvent
*
event
,
ImageArea
&
imageArea
);
void
mouseMoveEvent
(
QMouseEvent
*
event
,
ImageArea
&
imageArea
);
void
mouseReleaseEvent
(
QMouseEvent
*
event
,
ImageArea
&
imageArea
);
protected:
void
paint
(
ImageArea
&
imageArea
,
bool
isSecondaryColor
=
false
,
bool
additionalFlag
=
false
);
};
#endif // TRIANGLEINSTRUMENT_H
This diff is collapsed.
Click to expand it.
sources/mainwindow.cpp
View file @
bfa9242f
...
...
@@ -35,7 +35,6 @@
#include <QMenu>
#include <QMenuBar>
#include <QStatusBar>
#include <QSlider> // QSlider
#include <QMessageBox>
#include <QScrollArea>
#include <QLabel>
...
...
@@ -145,7 +144,6 @@ void MainWindow::initializeNewTab(const bool &isOpen, const QString &filePath)
void
MainWindow
::
initializeMainMenu
()
{
//<<<<<<< sources/mainwindow.cpp
QMenu
*
fileMenu
=
menuBar
()
->
addMenu
(
tr
(
"&File"
));
mNewAction
=
new
QAction
(
tr
(
"&New"
),
this
);
...
...
@@ -338,6 +336,17 @@ void MainWindow::initializeMainMenu()
mInstrumentsMenu
->
addAction
(
mSignatureToolAction
);
mInstrumentsActMap
.
insert
(
SIGNATURE
,
mSignatureToolAction
);
//triable instrument action goes here
QAction
*
mTriAction
=
new
QAction
(
tr
(
"Triangle"
),
this
);
//see if its checked and set Icon as well
mTriAction
->
setIcon
(
QIcon
(
":/media/instruments-icons/triangleWidget.png"
));
mTriAction
->
setCheckable
(
true
);
//when clicked make a connection
connect
(
mTriAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
instumentsAct
(
bool
)));
mInstrumentsMenu
->
addAction
(
mTriAction
);
mInstrumentsActMap
.
insert
(
TRIANGLE
,
mTriAction
);
mEffectsMenu
=
menuBar
()
->
addMenu
(
tr
(
"E&ffects"
));
QAction
*
grayEfAction
=
new
QAction
(
tr
(
"Gray"
),
this
);
...
...
@@ -383,268 +392,8 @@ void MainWindow::initializeMainMenu()
QAction
*
resizeCanAction
=
new
QAction
(
tr
(
"Canvas size"
),
this
);
connect
(
resizeCanAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
resizeCanvasAct
()));
mToolsMenu
->
addAction
(
resizeImAction
);
QMenu
*
canvasSize
=
new
QMenu
(
tr
(
"CanvasSize"
));
QAction
*
Resolution1
=
new
QAction
(
tr
(
"800 x 600"
),
this
);
connect
(
Resolution1
,
&
QAction
::
triggered
,
this
,
[
=
]()
{
this
->
resizeCanvasAct
(
800
,
600
);
});
canvasSize
->
addAction
(
Resolution1
);
QAction
*
Resolution2
=
new
QAction
(
tr
(
"1024 x 768"
),
this
);
connect
(
Resolution2
,
&
QAction
::
triggered
,
this
,
[
=
]()
{
this
->
resizeCanvasAct
(
1024
,
768
);
});
canvasSize
->
addAction
(
Resolution2
);
QAction
*
Resolution3
=
new
QAction
(
tr
(
"1280 x 720"
),
this
);
connect
(
Resolution3
,
&
QAction
::
triggered
,
this
,
[
=
]()
{
this
->
resizeCanvasAct
(
1280
,
720
);
});
canvasSize
->
addAction
(
Resolution3
);
mToolsMenu
->
addMenu
(
canvasSize
);
/*
mToolsMenu
->
addAction
(
resizeCanAction
);
QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
mNewAction = new QAction(tr("&New"), this);
mNewAction->setIcon(QIcon::fromTheme("document-new", QIcon(":/media/actions-icons/document-new.png")));
mNewAction->setIconVisibleInMenu(true);
connect(mNewAction, SIGNAL(triggered()), this, SLOT(newAct()));
fileMenu->addAction(mNewAction);
mOpenAction = new QAction(tr("&Open"), this);
mOpenAction->setIcon(QIcon::fromTheme("document-open", QIcon(":/media/actions-icons/document-open.png")));
mOpenAction->setIconVisibleInMenu(true);
connect(mOpenAction, SIGNAL(triggered()), this, SLOT(openAct()));
fileMenu->addAction(mOpenAction);
mSaveAction = new QAction(tr("&Save"), this);
mSaveAction->setIcon(QIcon::fromTheme("document-save", QIcon(":/media/actions-icons/document-save.png")));
mSaveAction->setIconVisibleInMenu(true);
connect(mSaveAction, SIGNAL(triggered()), this, SLOT(saveAct()));
fileMenu->addAction(mSaveAction);
mSaveAsAction = new QAction(tr("Save as..."), this);
mSaveAsAction->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/media/actions-icons/document-save-as.png")));
mSaveAsAction->setIconVisibleInMenu(true);
connect(mSaveAsAction, SIGNAL(triggered()), this, SLOT(saveAsAct()));
fileMenu->addAction(mSaveAsAction);
mCloseAction = new QAction(tr("&Close"), this);
mCloseAction->setIcon(QIcon::fromTheme("window-close", QIcon(":/media/actions-icons/window-close.png")));
mCloseAction->setIconVisibleInMenu(true);
connect(mCloseAction, SIGNAL(triggered()), this, SLOT(closeTabAct()));
fileMenu->addAction(mCloseAction);
fileMenu->addSeparator();
mPrintAction = new QAction(tr("&Print"), this);
mPrintAction->setIcon(QIcon::fromTheme("document-print", QIcon(":/media/actions-icons/document-print.png")));
mPrintAction->setIconVisibleInMenu(true);
connect(mPrintAction, SIGNAL(triggered()), this, SLOT(printAct()));
fileMenu->addAction(mPrintAction);
fileMenu->addSeparator();
mExitAction = new QAction(tr("&Exit"), this);
mExitAction->setIcon(QIcon::fromTheme("application-exit", QIcon(":/media/actions-icons/application-exit.png")));
mExitAction->setIconVisibleInMenu(true);
connect(mExitAction, SIGNAL(triggered()), SLOT(close()));
fileMenu->addAction(mExitAction);
QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
mUndoAction = mUndoStackGroup->createUndoAction(this, tr("&Undo"));
mUndoAction->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/media/actions-icons/edit-undo.png")));
mUndoAction->setIconVisibleInMenu(true);
mUndoAction->setEnabled(false);
editMenu->addAction(mUndoAction);
mRedoAction = mUndoStackGroup->createRedoAction(this, tr("&Redo"));
mRedoAction->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/media/actions-icons/edit-redo.png")));
mRedoAction->setIconVisibleInMenu(true);
mRedoAction->setEnabled(false);
editMenu->addAction(mRedoAction);
editMenu->addSeparator();
mCopyAction = new QAction(tr("&Copy"), this);
mCopyAction->setIcon(QIcon::fromTheme("edit-copy", QIcon(":/media/actions-icons/edit-copy.png")));
mCopyAction->setIconVisibleInMenu(true);
mCopyAction->setEnabled(false);
connect(mCopyAction, SIGNAL(triggered()), this, SLOT(copyAct()));
editMenu->addAction(mCopyAction);
mPasteAction = new QAction(tr("&Paste"), this);
mPasteAction->setIcon(QIcon::fromTheme("edit-paste", QIcon(":/media/actions-icons/edit-paste.png")));
mPasteAction->setIconVisibleInMenu(true);
connect(mPasteAction, SIGNAL(triggered()), this, SLOT(pasteAct()));
editMenu->addAction(mPasteAction);
mCutAction = new QAction(tr("C&ut"), this);
mCutAction->setIcon(QIcon::fromTheme("edit-cut", QIcon(":/media/actions-icons/edit-cut.png")));
mCutAction->setIconVisibleInMenu(true);
mCutAction->setEnabled(false);
connect(mCutAction, SIGNAL(triggered()), this, SLOT(cutAct()));
editMenu->addAction(mCutAction);
editMenu->addSeparator();
QAction* settingsAction = new QAction(tr("&Settings"), this);
settingsAction->setShortcut(QKeySequence::Preferences);
settingsAction->setIcon(QIcon::fromTheme("document-properties", QIcon(":/media/actions-icons/document-properties.png")));
settingsAction->setIconVisibleInMenu(true);
connect(settingsAction, SIGNAL(triggered()), this, SLOT(settingsAct()));
editMenu->addAction(settingsAction);
mInstrumentsMenu = menuBar()->addMenu(tr("&Instruments"));
QAction* mCursorAction = new QAction(tr("Selection"), this);
mCursorAction->setCheckable(true);
mCursorAction->setIcon(QIcon(":/media/instruments-icons/cursor.png"));
connect(mCursorAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mCursorAction);
mInstrumentsActMap.insert(CURSOR, mCursorAction);
QAction* mEraserAction = new QAction(tr("Eraser"), this);
mEraserAction->setCheckable(true);
mEraserAction->setIcon(QIcon(":/media/instruments-icons/lastic.png"));
connect(mEraserAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mEraserAction);
mInstrumentsActMap.insert(ERASER, mEraserAction);
QAction* mColorPickerAction = new QAction(tr("Color picker"), this);
mColorPickerAction->setCheckable(true);
mColorPickerAction->setIcon(QIcon(":/media/instruments-icons/pipette.png"));
connect(mColorPickerAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mColorPickerAction);
mInstrumentsActMap.insert(COLORPICKER, mColorPickerAction);
QAction* mMagnifierAction = new QAction(tr("Magnifier"), this);
mMagnifierAction->setCheckable(true);
mMagnifierAction->setIcon(QIcon(":/media/instruments-icons/loupe.png"));
connect(mMagnifierAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mMagnifierAction);
mInstrumentsActMap.insert(MAGNIFIER, mMagnifierAction);
QAction* mPenAction = new QAction(tr("Pen"), this);
mPenAction->setCheckable(true);
mPenAction->setIcon(QIcon(":/media/instruments-icons/pencil.png"));
connect(mPenAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mPenAction);
mInstrumentsActMap.insert(PEN, mPenAction);
QAction* mLineAction = new QAction(tr("Line"), this);
mLineAction->setCheckable(true);
mLineAction->setIcon(QIcon(":/media/instruments-icons/line.png"));
connect(mLineAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mLineAction);
mInstrumentsActMap.insert(LINE, mLineAction);
QAction* mSprayAction = new QAction(tr("Spray"), this);
mSprayAction->setCheckable(true);
mSprayAction->setIcon(QIcon(":/media/instruments-icons/spray.png"));
connect(mSprayAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mSprayAction);
mInstrumentsActMap.insert(SPRAY, mSprayAction);
QAction* mFillAction = new QAction(tr("Fill"), this);
mFillAction->setCheckable(true);
mFillAction->setIcon(QIcon(":/media/instruments-icons/fill.png"));
connect(mFillAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mFillAction);
mInstrumentsActMap.insert(FILL, mFillAction);
QAction* mRectangleAction = new QAction(tr("Rectangle"), this);
mRectangleAction->setCheckable(true);
mRectangleAction->setIcon(QIcon(":/media/instruments-icons/rectangle.png"));
connect(mRectangleAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mRectangleAction);
mInstrumentsActMap.insert(RECTANGLE, mRectangleAction);
QAction* mEllipseAction = new QAction(tr("Ellipse"), this);
mEllipseAction->setCheckable(true);
mEllipseAction->setIcon(QIcon(":/media/instruments-icons/ellipse.png"));
connect(mEllipseAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mEllipseAction);
mInstrumentsActMap.insert(ELLIPSE, mEllipseAction);
QAction* curveLineAction = new QAction(tr("Curve"), this);
curveLineAction->setCheckable(true);
curveLineAction->setIcon(QIcon(":/media/instruments-icons/curve.png"));
connect(curveLineAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(curveLineAction);
mInstrumentsActMap.insert(CURVELINE, curveLineAction);
QAction* mTextAction = new QAction(tr("Text"), this);
mTextAction->setCheckable(true);
mTextAction->setIcon(QIcon(":/media/instruments-icons/text.png"));
connect(mTextAction, SIGNAL(triggered(bool)), this, SLOT(instumentsAct(bool)));
mInstrumentsMenu->addAction(mTextAction);
mInstrumentsActMap.insert(TEXT, mTextAction);
// TODO: Add new instrument action here
mEffectsMenu = menuBar()->addMenu(tr("E&ffects"));
QAction* grayEfAction = new QAction(tr("Gray"), this);
connect(grayEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(grayEfAction);
mEffectsActMap.insert(GRAY, grayEfAction);
QAction* negativeEfAction = new QAction(tr("Negative"), this);
connect(negativeEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(negativeEfAction);
mEffectsActMap.insert(NEGATIVE, negativeEfAction);
QAction* binarizationEfAction = new QAction(tr("Binarization"), this);
connect(binarizationEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(binarizationEfAction);
mEffectsActMap.insert(BINARIZATION, binarizationEfAction);
QAction* gaussianBlurEfAction = new QAction(tr("Gaussian Blur"), this);
connect(gaussianBlurEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(gaussianBlurEfAction);
mEffectsActMap.insert(GAUSSIANBLUR, gaussianBlurEfAction);
QAction* gammaEfAction = new QAction(tr("Gamma"), this);
connect(gammaEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(gammaEfAction);
mEffectsActMap.insert(GAMMA, gammaEfAction);
QAction* sharpenEfAction = new QAction(tr("Sharpen"), this);
connect(sharpenEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(sharpenEfAction);
mEffectsActMap.insert(SHARPEN, sharpenEfAction);
QAction* customEfAction = new QAction(tr("Custom"), this);
connect(customEfAction, SIGNAL(triggered()), this, SLOT(effectsAct()));
mEffectsMenu->addAction(customEfAction);
mEffectsActMap.insert(CUSTOM, customEfAction);
mToolsMenu = menuBar()->addMenu(tr("&Tools"));
QAction* resizeImAction = new QAction(tr("Image size"), this);
connect(resizeImAction, SIGNAL(triggered()), this, SLOT(resizeImageAct()));
mToolsMenu->addAction(resizeImAction);
QMenu* canvasSize = new QMenu(tr("CanvasSize"));
QAction *Resolution1 = new QAction(tr("800 x 600"), this);
connect(Resolution1, &QAction::triggered, this, [=]() {this->resizeCanvasAct(800, 600); });
canvasSize->addAction(Resolution1);
QAction* Resolution2 = new QAction(tr("1024 x 768"), this);
connect(Resolution2, &QAction::triggered, this, [=]() {this->resizeCanvasAct(1024, 768); });
canvasSize->addAction(Resolution2);
QAction* Resolution3 = new QAction(tr("1280 x 720"), this);
connect(Resolution3, &QAction::triggered, this, [=]() {this->resizeCanvasAct(1280, 720); });
canvasSize->addAction(Resolution3);
mToolsMenu->addMenu(canvasSize);
*/
QMenu
*
rotateMenu
=
new
QMenu
(
tr
(
"Rotate"
));
QAction
*
rotateLAction
=
new
QAction
(
tr
(
"Counter-clockwise"
),
this
);
...
...
@@ -698,23 +447,6 @@ void MainWindow::initializeMainMenu()
updateShortcuts
();
}
//zoomSlider function
void
MainWindow
::
zoomSlider
(
int
zoomsb
)
{
qDebug
(
"zoomSlider() called, zoomsb==%d"
,
zoomsb
);
//Shows actual values
if
(
zoomsb
==
0
)
{
getCurrentImageArea
()
->
zoomImage
(
0.25
);
getCurrentImageArea
()
->
setZoomFactor
(
0.25
);
}
else
{
getCurrentImageArea
()
->
zoomImage
(
zoomsb
*
1.25
);
getCurrentImageArea
()
->
setZoomFactor
(
zoomsb
*
1.25
);
}
}
void
MainWindow
::
initializeStatusBar
()
{
mStatusBar
=
new
QStatusBar
();
...
...
@@ -729,16 +461,6 @@ void MainWindow::initializeStatusBar()
mStatusBar
->
addPermanentWidget
(
mPosLabel
,
1
);
mStatusBar
->
addPermanentWidget
(
mColorPreviewLabel
);
mStatusBar
->
addPermanentWidget
(
mColorRGBLabel
,
-
1
);
//Qslider
QSlider
*
zoomSlider
=
new
QSlider
(
Qt
::
Horizontal
,
this
);
zoomSlider
->
setTickPosition
(
QSlider
::
TicksBothSides
);
zoomSlider
->
setInvertedAppearance
(
false
);
// Slider not inverted
zoomSlider
->
setRange
(
0
,
4
);
// Minimum value to maximum value
zoomSlider
->
setValue
(
2
);
// Initial Value of Slider Bar
mStatusBar
->
addPermanentWidget
(
zoomSlider
,
1
);
// Add the widget at the bottom (status bar)
connect
(
zoomSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
zoomSlider
(
int
)));
}
void
MainWindow
::
initializeToolBar
()
...
...
@@ -862,7 +584,7 @@ void MainWindow::settingsAct()
void
MainWindow
::
copyAct
()
{
if
(
ImageArea
*
imageArea
=
getCurrentImageArea
())
if
(
ImageArea
*
imageArea
=
getCurrentImageArea
())
imageArea
->
copyImage
();
}
...
...
@@ -931,11 +653,6 @@ void MainWindow::resizeCanvasAct()
getCurrentImageArea
()
->
resizeCanvas
();
}
void
MainWindow
::
resizeCanvasAct
(
int
w
,
int
h
)
{
getCurrentImageArea
()
->
resizeCanvas
(
w
,
h
);
}
void
MainWindow
::
rotateLeftImageAct
()
{
getCurrentImageArea
()
->
rotateImage
(
false
);
...
...
This diff is collapsed.
Click to expand it.
sources/mainwindow.h
100755 → 100644
View file @
bfa9242f
...
...
@@ -125,8 +125,7 @@ private slots:
void
settingsAct
();
void
effectsAct
();
void
resizeImageAct
();
void
resizeCanvasAct
(
int
w
,
int
h
);
void
resizeCanvasAct
();
void
resizeCanvasAct
();
void
rotateLeftImageAct
();
void
rotateRightImageAct
();
void
zoomInAct
();
...
...
@@ -135,7 +134,6 @@ private slots:
void
closeTabAct
();
void
closeTab
(
int
index
);
void
setAllInstrumentsUnchecked
(
QAction
*
action
);
void
zoomSlider
(
int
zoomsb
);
//zoomSlider
/**
* @brief Instruments buttons handler.
*
...
...
This diff is collapsed.
Click to expand it.
sources/media/instruments-icons/triangleWidget.png
0 → 100644
View file @
bfa9242f
3.34 KB
This diff is collapsed.
Click to expand it.
sources/resources.qrc
View file @
bfa9242f
...
...
@@ -38,5 +38,6 @@
<file>media/instruments-icons/curve.png</file>
<file>media/actions-icons/clear-gray.png</file>
<file>media/signature/yoursignature.png</file>
<file>media/instruments-icons/triangleWidget.png</file>
</qresource>
</RCC>
This diff is collapsed.
Click to expand it.
sources/widgets/palettebutton.cpp
View file @
bfa9242f
#include "palettebutton.h"
#include <QMouseEvent>
#include <QColorDialog>
PaletteButton
::
PaletteButton
(
const
QColor
&
color
)
{
...
...
@@ -23,30 +22,3 @@ void PaletteButton::mousePressEvent(QMouseEvent *event)
emit
colorPicked
();
}
void
PaletteButton
::
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
//if the user double clicks the left button
if
(
event
->
button
()
==
Qt
::
LeftButton
)
{
/* Here we get the color chosen from the pop up dialog*/
QColor
color
=
QColorDialog
::
getColor
(
mColor
,
this
);
/*if the color is valid, the primary color should be set to the new picked color and then emit the signal*/
if
(
color
.
isValid
())
{
DataSingleton
::
Instance
()
->
setPrimaryColor
(
color
);
emit
colorPicked
();
}
}
/*Repeat the same process for the right button click event*/
else
if
(
event
->
button
()
==
Qt
::
RightButton
)
{
QColor
color
=
QColorDialog
::
getColor
(
mColor
,
this
);
if
(
color
.
isValid
())
{
DataSingleton
::
Instance
()
->
setSecondaryColor
(
color
);
emit
colorPicked
();
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sources/widgets/palettebutton.h
View file @
bfa9242f
...
...
@@ -20,7 +20,6 @@ private:
protected:
void
mousePressEvent
(
QMouseEvent
*
event
);
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
);
};
#endif // QPALETTEBUTTON_H
This diff is collapsed.
Click to expand it.
sources/widgets/toolbar.cpp
View file @
bfa9242f
...
...
@@ -65,7 +65,8 @@ void ToolBar::initializeItems()
mEllipseButton
=
createToolButton
(
mActMap
[
ELLIPSE
]);
mCurveButton
=
createToolButton
(
mActMap
[
CURVELINE
]);
mTextButton
=
createToolButton
(
mActMap
[
TEXT
]);
//make a triangle button
TriButton
=
createToolButton
(
mActMap
[
TRIANGLE
]);
//create a signature button
signBtn
=
createToolButton
(
mActMap
[
SIGNATURE
]);
...
...
@@ -83,7 +84,8 @@ void ToolBar::initializeItems()
bLayout
->
addWidget
(
mEllipseButton
,
4
,
1
);
bLayout
->
addWidget
(
mCurveButton
,
5
,
0
);
bLayout
->
addWidget
(
mTextButton
,
5
,
1
);
//add triangle button widget next to sign button
bLayout
->
addWidget
(
TriButton
,
6
,
0
);
//add the signature button widget to the GUI
bLayout
->
addWidget
(
signBtn
,
6
,
1
);
...
...
This diff is collapsed.
Click to expand it.
sources/widgets/toolbar.h
View file @
bfa9242f
...
...
@@ -63,7 +63,7 @@ private:
QToolButton
*
mCursorButton
,
*
mEraserButton
,
*
mPenButton
,
*
mLineButton
,
*
mColorPickerButton
,
*
mMagnifierButton
,
*
mSprayButton
,
*
mFillButton
,
*
mRectangleButton
,
*
mEllipseButton
,
*
mCurveButton
,
*
mTextButton
,
*
signBtn
;
*
mRectangleButton
,
*
mEllipseButton
,
*
mCurveButton
,
*
mTextButton
,
*
signBtn
,
*
TriButton
;
ColorChooser
*
mPColorChooser
,
*
mSColorChooser
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment