File indexing completed on 2024-05-12 09:53:12
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 <kurlrequester.h> 0027 0028 #include <QCheckBox> 0029 #include <QComboBox> 0030 #include <QDialog> 0031 0032 #include "ui_imageproperties.h" 0033 0034 class CImagePropertiesDialog : public QDialog, public Ui::ImageProperties { 0035 Q_OBJECT 0036 public: 0037 enum { 0038 BASIC = 0x00, 0039 POS = 0x01, 0040 SCALE = 0x02, 0041 BORDER = 0x04 0042 }; 0043 0044 CImagePropertiesDialog(const QString &title, QWidget *parent, int props); 0045 0046 bool run(); 0047 void set(const QString &file, int width=-1, int height=-1, 0048 int pos=1, bool onWindowBorder=false); 0049 QSize sizeHint() const override; 0050 0051 QString 0052 fileName() 0053 { 0054 return fileRequester->url().toLocalFile(); 0055 } 0056 int 0057 imgWidth() 0058 { 0059 return ((properties & SCALE) && scaleImage->isChecked() ? 0060 scaleWidth->value() : 0); 0061 } 0062 int 0063 imgHeight() 0064 { 0065 return ((properties & SCALE) && scaleImage->isChecked() ? 0066 scaleHeight->value() : 0); 0067 } 0068 int 0069 imgPos() 0070 { 0071 return (properties & POS) ? posCombo->currentIndex() : 0; 0072 } 0073 bool 0074 onWindowBorder() 0075 { 0076 return (properties & BORDER) && onBorder->isChecked(); 0077 } 0078 private: 0079 int properties; 0080 }; 0081 0082 #endif