Files
lcd-image-converter/classes/imageeditor/toolsmanager.h
2017-12-13 12:01:54 +05:00

89 lines
2.3 KiB
C++

/*
* LCD Image Converter. Converts images and fonts for embedded applications.
* Copyright (C) 2015 riuson
* mailto: riuson@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/
*/
#ifndef TOOLSMANAGER_H
#define TOOLSMANAGER_H
#include <QObject>
#include "iimageeditorparams.h"
#include "iimageselection.h"
class QAction;
template <class T1> class QList;
namespace ImageEditor
{
namespace Tools
{
class IImageEditorTool;
class ToolZoom;
class ToolColor;
class ToolSelect;
class ToolsManager : public QObject, public IImageEditorParams, public IImageSelection
{
Q_OBJECT
Q_INTERFACES(ImageEditor::IImageEditorParams)
Q_INTERFACES(ImageEditor::IImageSelection)
public:
explicit ToolsManager(QObject *parent = 0);
virtual ~ToolsManager();
const QList <IImageEditorTool *> *tools() const;
const QList<QAction *> *toolsActions() const;
int scale() const Q_DECL_OVERRIDE;
const QColor foreColor() const Q_DECL_OVERRIDE;
const QColor backColor() const Q_DECL_OVERRIDE;
QWidget *parentWidget() const Q_DECL_OVERRIDE;
const QPainterPath &selectedPath() const Q_DECL_OVERRIDE;
public slots:
void setScale(int value);
signals:
void toolChanged(int toolIndex);
void scaleChanged(int value);
void selectionChanged(const QPainterPath &value) Q_DECL_OVERRIDE;
private:
QList <IImageEditorTool *> *mTools;
QList <QAction *> *mToolsActions;
IImageEditorTool *mSelectedTool;
ToolZoom *mZoomer;
ToolColor *mColors;
ToolSelect *mSelectionTool;
QWidget *mParentWidget;
void initializeTools();
void initializeActions();
void selectTool(IImageEditorTool *tool);
private slots:
void on_toolAction_triggered();
};
} // namespace Tools
} // namespace ImageEditor
#endif // TOOLSMANAGER_H