File indexing completed on 2024-05-05 05:40:57
0001 /*************************************************************************** 0002 * Copyright (C) 2015 by Renaud Guezennec * 0003 * https://rolisteam.org/contact * 0004 * * 0005 * This file is part of rcm * 0006 * * 0007 * Rolisteam is free software; you can redistribute it and/or modify * 0008 * it under the terms of the GNU General Public License as published by * 0009 * the Free Software Foundation; either version 2 of the License, or * 0010 * (at your option) any later version. * 0011 * * 0012 * This program is distributed in the hope that it will be useful, * 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0015 * GNU General Public License for more details. * 0016 * * 0017 * You should have received a copy of the GNU General Public License * 0018 * along with this program; if not, write to the * 0019 * Free Software Foundation, Inc., * 0020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0021 ***************************************************************************/ 0022 #ifndef IMAGESELECTORDIALOG_H 0023 #define IMAGESELECTORDIALOG_H 0024 0025 #include "rwidgets_global.h" 0026 #include <QDialog> 0027 #include <QLabel> 0028 #include <QPointer> 0029 #include <memory> 0030 class Overlay; 0031 namespace Ui 0032 { 0033 class ImageSelectorDialog; 0034 } 0035 class ImageSelectorController; 0036 class QDragEnterEvent; 0037 class QDropEvent; 0038 class RWIDGET_EXPORT ImageSelectorDialog : public QDialog 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 explicit ImageSelectorDialog(ImageSelectorController* ctrl, QWidget* parent= nullptr, const QString &defaultPath={}); 0044 virtual ~ImageSelectorDialog(); 0045 0046 private slots: 0047 void openImage(); 0048 0049 protected: 0050 void resizeLabel(); 0051 void resizeEvent(QResizeEvent* event) override; 0052 0053 void dragEnterEvent(QDragEnterEvent* event) override; 0054 void dropEvent(QDropEvent* event) override; 0055 void showEvent(QShowEvent* event) override; 0056 0057 private: 0058 QPointer<ImageSelectorController> m_ctrl; 0059 Ui::ImageSelectorDialog* ui; 0060 std::unique_ptr<Overlay> m_overlay; 0061 0062 qreal m_ratio= 1.; 0063 qreal m_zoomLevel= 1.0; 0064 QLabel* m_imageViewerLabel; 0065 QString m_postingStr; 0066 }; 0067 0068 #endif // IMAGESELECTORDIALOG_H