File indexing completed on 2024-05-12 15:28:00

0001 /***************************************************************************
0002     File                 : ImageDock.h
0003     Project              : LabPlot
0004     Description          : widget for image properties
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2019-2020 by Alexander Semke (alexander.semke@web.de)
0007 
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *  This program is free software; you can redistribute it and/or modify   *
0013  *  it under the terms of the GNU General Public License as published by   *
0014  *  the Free Software Foundation; either version 2 of the License, or      *
0015  *  (at your option) any later version.                                    *
0016  *                                                                         *
0017  *  This program is distributed in the hope that it will be useful,        *
0018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0020  *  GNU General Public License for more details.                           *
0021  *                                                                         *
0022  *   You should have received a copy of the GNU General Public License     *
0023  *   along with this program; if not, write to the Free Software           *
0024  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0025  *   Boston, MA  02110-1301  USA                                           *
0026  *                                                                         *
0027  ***************************************************************************/
0028 
0029 #ifndef IMAGEDOCK_H
0030 #define IMAGEDOCK_H
0031 
0032 #include "kdefrontend/dockwidgets/BaseDock.h"
0033 #include "backend/worksheet/TextLabel.h"
0034 #include "ui_imagedock.h"
0035 
0036 class AbstractAspect;
0037 class Image;
0038 class KConfig;
0039 
0040 class ImageDock : public BaseDock {
0041     Q_OBJECT
0042 
0043 public:
0044     explicit ImageDock(QWidget*);
0045     void setImages(QList<Image*>);
0046     void updateLocale() override;
0047     void updateUnits() override;
0048 
0049 private:
0050     Ui::ImageDock ui;
0051     QList<Image*> m_imageList;
0052     Image* m_image{nullptr};
0053 
0054     void load();
0055     void loadConfig(KConfig&);
0056 
0057 private slots:
0058     //SLOTs for changes triggered in ImageDock
0059     void selectFile();
0060     void fileNameChanged();
0061     void opacityChanged(int);
0062 
0063     //geometry
0064     void sizeChanged(int);
0065     void widthChanged(double);
0066     void heightChanged(double);
0067     void keepRatioChanged(int);
0068     void positionXChanged(int);
0069     void positionYChanged(int);
0070     void customPositionXChanged(double);
0071     void customPositionYChanged(double);
0072     void horizontalAlignmentChanged(int);
0073     void verticalAlignmentChanged(int);
0074     void rotationChanged(int);
0075 
0076     //border
0077     void borderStyleChanged(int);
0078     void borderColorChanged(const QColor&);
0079     void borderWidthChanged(double);
0080     void borderOpacityChanged(int);
0081 
0082     void visibilityChanged(bool);
0083 
0084     //SLOTs for changes triggered in Image
0085     void imageDescriptionChanged(const AbstractAspect*);
0086     void imageFileNameChanged(const QString&);
0087     void imageOpacityChanged(float);
0088     void imageWidthChanged(int);
0089     void imageHeightChanged(int);
0090     void imageKeepRatioChanged(bool);
0091 
0092     void imagePositionChanged(const WorksheetElement::PositionWrapper&);
0093     void imageHorizontalAlignmentChanged(WorksheetElement::HorizontalAlignment);
0094     void imageVerticalAlignmentChanged(WorksheetElement::VerticalAlignment);
0095     void imageRotationAngleChanged(qreal);
0096 
0097     void imageBorderPenChanged(const QPen&);
0098     void imageBorderOpacityChanged(float);
0099 
0100     void imageVisibleChanged(bool);
0101 
0102 signals:
0103     void info(const QString&);
0104 };
0105 
0106 #endif // WORKSHEETDOCK_H