File indexing completed on 2024-05-12 15:27:58

0001 /***************************************************************************
0002     File                 : CartesianPlotLegendDock.h
0003     Project              : LabPlot
0004     --------------------------------------------------------------------
0005     Copyright            : (C) 2013-2020 Alexander Semke (alexander.semke@web.de)
0006     Description          : widget for cartesian legend properties
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 CARTESIANPLOTLEGENDDOCK_H
0030 #define CARTESIANPLOTLEGENDDOCK_H
0031 
0032 #include "ui_cartesianplotlegenddock.h"
0033 #include "backend/worksheet/plots/PlotArea.h"
0034 #include "backend/worksheet/plots/cartesian/CartesianPlotLegend.h"
0035 #include "kdefrontend/dockwidgets/BaseDock.h"
0036 
0037 #include <QList>
0038 #include <KConfig>
0039 
0040 class LabelWidget;
0041 
0042 class CartesianPlotLegendDock : public BaseDock {
0043     Q_OBJECT
0044 
0045 public:
0046     explicit CartesianPlotLegendDock(QWidget*);
0047 
0048     void setLegends(QList<CartesianPlotLegend*>);
0049     void activateTitleTab() const;
0050     void updateLocale() override;
0051     void updateUnits() override;
0052 
0053 private:
0054     Ui::CartesianPlotLegendDock ui;
0055     QList<CartesianPlotLegend*> m_legendList;
0056     CartesianPlotLegend* m_legend{nullptr};
0057     LabelWidget* labelWidget{nullptr};
0058 
0059     void load();
0060     void loadConfig(KConfig&);
0061 
0062 private slots:
0063     void init();
0064     void retranslateUi();
0065 
0066     //SLOTs for changes triggered in CartesianPlotLegendDock
0067     //"General"-tab
0068     void visibilityChanged(bool);
0069     void labelFontChanged(const QFont&);
0070     void labelColorChanged(const QColor&);
0071     void labelOrderChanged(int);
0072     void lineSymbolWidthChanged(double);
0073     void positionXChanged(int);
0074     void positionYChanged(int);
0075     void customPositionXChanged(double);
0076     void customPositionYChanged(double);
0077     void rotationChanged(int value);
0078 
0079     //"Background"-tab
0080     void backgroundTypeChanged(int);
0081     void backgroundColorStyleChanged(int);
0082     void backgroundImageStyleChanged(int);
0083     void backgroundBrushStyleChanged(int);
0084     void backgroundFirstColorChanged(const QColor&);
0085     void backgroundSecondColorChanged(const QColor&);
0086     void selectFile();
0087     void fileNameChanged();
0088     void backgroundOpacityChanged(int);
0089     void borderStyleChanged(int);
0090     void borderColorChanged(const QColor&);
0091     void borderWidthChanged(double);
0092     void borderCornerRadiusChanged(double);
0093     void borderOpacityChanged(int);
0094 
0095     //"Layout"-tab
0096     void layoutTopMarginChanged(double);
0097     void layoutBottomMarginChanged(double);
0098     void layoutRightMarginChanged(double);
0099     void layoutLeftMarginChanged(double);
0100     void layoutHorizontalSpacingChanged(double);
0101     void layoutVerticalSpacingChanged(double);
0102     void layoutColumnCountChanged(int);
0103 
0104     //SLOTs for changes triggered in CartesianPlotLegend
0105     void legendDescriptionChanged(const AbstractAspect*);
0106     void legendLabelFontChanged(QFont&);
0107     void legendLabelColorChanged(QColor&);
0108     void legendLabelOrderChanged(bool);
0109     void legendLineSymbolWidthChanged(float);
0110     void legendPositionChanged(const CartesianPlotLegend::PositionWrapper&);
0111     void legendRotationAngleChanged(qreal);
0112     void legendVisibilityChanged(bool);
0113 
0114     void legendBackgroundTypeChanged(PlotArea::BackgroundType);
0115     void legendBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle);
0116     void legendBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle);
0117     void legendBackgroundBrushStyleChanged(Qt::BrushStyle);
0118     void legendBackgroundFirstColorChanged(QColor&);
0119     void legendBackgroundSecondColorChanged(QColor&);
0120     void legendBackgroundFileNameChanged(QString&);
0121     void legendBackgroundOpacityChanged(float);
0122 
0123     void legendBorderPenChanged(QPen&);
0124     void legendBorderCornerRadiusChanged(float);
0125     void legendBorderOpacityChanged(float);
0126 
0127     void legendLayoutTopMarginChanged(float);
0128     void legendLayoutBottomMarginChanged(float);
0129     void legendLayoutLeftMarginChanged(float);
0130     void legendLayoutRightMarginChanged(float);
0131     void legendLayoutVerticalSpacingChanged(float);
0132     void legendLayoutHorizontalSpacingChanged(float);
0133     void legendLayoutColumnCountChanged(int);
0134 
0135     //save/load template
0136     void loadConfigFromTemplate(KConfig&);
0137     void saveConfigAsTemplate(KConfig&);
0138 
0139 signals:
0140     void info(const QString&);
0141 };
0142 
0143 #endif