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

0001 /***************************************************************************
0002     File                 : ReferenceLineDock.h
0003     Project              : LabPlot
0004     Description          : Dock widget for the reference line on the plot
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2020 Alexander Semke (alexander.semke@web.de)
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *  This program is free software; you can redistribute it and/or modify   *
0012  *  it under the terms of the GNU General Public License as published by   *
0013  *  the Free Software Foundation; either version 2 of the License, or      *
0014  *  (at your option) any later version.                                    *
0015  *                                                                         *
0016  *  This program is distributed in the hope that it will be useful,        *
0017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0019  *  GNU General Public License for more details.                           *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program; if not, write to the Free Software           *
0023  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0024  *   Boston, MA  02110-1301  USA                                           *
0025  *                                                                         *
0026  ***************************************************************************/
0027 
0028 #ifndef REFERENCELINEDOCK_H
0029 #define REFERENCELINEDOCK_H
0030 
0031 #include "kdefrontend/dockwidgets/BaseDock.h"
0032 #include "backend/worksheet/plots/cartesian/ReferenceLine.h"
0033 #include "ui_referencelinedock.h"
0034 
0035 class AbstractAspect;
0036 class ReferenceLine;
0037 class KConfig;
0038 
0039 class ReferenceLineDock : public BaseDock {
0040     Q_OBJECT
0041 
0042 public:
0043     explicit ReferenceLineDock(QWidget *);
0044     void setReferenceLines(QList<ReferenceLine*>);
0045     void updateLocale() override;
0046 
0047 private:
0048     Ui::ReferenceLineDock ui;
0049     QList<ReferenceLine*> m_linesList;
0050     ReferenceLine* m_line{nullptr};
0051 
0052     void load();
0053     void loadConfig(KConfig&);
0054 
0055 private slots:
0056     //SLOTs for changes triggered in ReferenceLineDock
0057     void visibilityChanged(bool);
0058 
0059     //Position
0060     void orientationChanged(int);
0061     void positionChanged();
0062 
0063     //Line
0064     void styleChanged(int);
0065     void colorChanged(const QColor&);
0066     void widthChanged(double);
0067     void opacityChanged(int);
0068 
0069     //SLOTs for changes triggered in ReferenceLine
0070     void lineDescriptionChanged(const AbstractAspect*);
0071     void lineVisibilityChanged(bool);
0072 
0073     //Position
0074     void linePositionChanged(double);
0075     void lineOrientationChanged(ReferenceLine::Orientation);
0076 
0077     //Line
0078     void linePenChanged(const QPen&);
0079     void lineOpacityChanged(qreal);
0080 };
0081 
0082 #endif