File indexing completed on 2024-05-12 05:49:26
0001 /***************************************************************************** 0002 * Copyright 2010 Craig Drummond <craig.p.drummond@gmail.com> * 0003 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Lesser General Public License as * 0007 * published by the Free Software Foundation; either version 2.1 of the * 0008 * License, or (at your option) version 3, or any later version accepted * 0009 * by the membership of KDE e.V. (or its successor approved by the * 0010 * membership of KDE e.V.), which shall act as a proxy defined in * 0011 * Section 6 of version 3 of the license. * 0012 * * 0013 * This program is distributed in the hope that it will be useful, * 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0016 * Lesser General Public License for more details. * 0017 * * 0018 * You should have received a copy of the GNU Lesser General Public * 0019 * License along with this library. If not, * 0020 * see <http://www.gnu.org/licenses/>. * 0021 *****************************************************************************/ 0022 0023 #ifndef __IMAGE_PROPERTIES_DIALOG_H__ 0024 #define __IMAGE_PROPERTIES_DIALOG_H__ 0025 0026 #include <KDE/KDialog> 0027 #include <KDE/KIntSpinBox> 0028 #include <KDE/KUrlRequester> 0029 #include <KDE/KUrl> 0030 #include <QCheckBox> 0031 #include <QComboBox> 0032 0033 #include "ui_imageproperties.h" 0034 0035 class CImagePropertiesDialog : public KDialog, public Ui::ImageProperties 0036 { 0037 public: 0038 0039 enum 0040 { 0041 BASIC = 0x00, 0042 POS = 0x01, 0043 SCALE = 0x02, 0044 BORDER = 0x04 0045 }; 0046 0047 CImagePropertiesDialog(const QString &title, QWidget *parent, int props); 0048 0049 bool run(); 0050 void set(const QString &file, int width=-1, int height=-1, int pos=1, bool onWindowBorder=false); 0051 QSize sizeHint() const; 0052 0053 QString fileName() { return fileRequester->url().toLocalFile(); } 0054 int imgWidth() { return (properties&SCALE) && scaleImage->isChecked() ? scaleWidth->value() : 0; } 0055 int imgHeight() { return (properties&SCALE) && scaleImage->isChecked() ? scaleHeight->value() : 0; } 0056 int imgPos() { return (properties&POS) ? posCombo->currentIndex() : 0; } 0057 bool onWindowBorder() { return (properties&BORDER) && onBorder->isChecked(); } 0058 0059 private: 0060 0061 int properties; 0062 }; 0063 0064 #endif