File indexing completed on 2025-01-19 13:26:34

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef IMAGEEXPORTOPTIONSWIDGET_H
0021 #define IMAGEEXPORTOPTIONSWIDGET_H
0022 
0023 #include "ui_ImageExportOptionsWidget.h"
0024 
0025 #include <QWidget>
0026 
0027 class KarbonDocument;
0028 class KoPAPageBase;
0029 
0030 class ImageExportOptionsWidget : public QWidget
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit ImageExportOptionsWidget(KarbonDocument *doc, QWidget *parent = 0);
0036 
0037     /// Sets the initial unit to use
0038     void setUnit(const KoUnit &unit);
0039 
0040     /// Returns the chosen export size in pixel
0041     QSize pixelSize() const;
0042 
0043     /// Returns the chosen export size in point
0044     QSizeF pointSize() const;
0045 
0046     /// Sets the background color
0047     void setBackgroundColor(const QColor &color);
0048 
0049     /// Returns the chosen background color
0050     QColor backgroundColor() const;
0051 
0052     /// Enables/disables setting the background opacity
0053     void enableBackgroundOpacity(bool enable);
0054 
0055     KoPAPageBase *page() const;
0056 
0057 private Q_SLOTS:
0058     void unitWidthChanged(qreal);
0059     void unitHeightChanged(qreal);
0060     void pxWidthChanged(int);
0061     void pxHeightChanged(int);
0062     void dpiChanged(int);
0063     void unitChanged(int);
0064     void aspectChanged(bool);
0065     void setPage(int idx);
0066 private:
0067     void updateFromPointSize(const QSizeF &pointSize);
0068     void updateFromPixelSize(const QSize &pixelSize);
0069 
0070     void blockChildSignals(bool block);
0071 
0072     Ui_ImageExportOptionsWidget widget;
0073     QSizeF m_pointSize;
0074 
0075     KarbonDocument *m_doc;
0076 };
0077 
0078 #endif // IMAGEEXPORTOPTIONSWIDGET_H