| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #ifndef __QNAPIOPENDIALOG__H__ |
| 16 | #define __QNAPIOPENDIALOG__H__ |
| 17 | |
| 18 | #include "config/staticconfig.h" |
| 19 | |
| 20 | #include <QDesktopWidget> |
| 21 | #include <QDir> |
| 22 | #include <QFileDialog> |
| 23 | #include <QFileInfo> |
| 24 | #include <QSharedPointer> |
| 25 | #include <QString> |
| 26 | #include <QStringList> |
| 27 | #include <QUrl> |
| 28 | |
| 29 | class QNapiOpenDialog : public QFileDialog { |
| 30 | Q_OBJECT |
| 31 | public: |
| 32 | enum FilterMode { None, Movies, Subtitles }; |
| 33 | |
| 34 | QNapiOpenDialog(QWidget* parent = 0, const QString& caption = QString(), |
| 35 | const QString& init_path = QString(), |
| 36 | FilterMode filterMode = None); |
| 37 | |
| 38 | bool selectFile(); |
| 39 | bool selectFiles(); |
| 40 | bool selectDirectory(); |
| 41 | |
| 42 | #if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
| 43 | QStringList selectedFiles() const; |
| 44 | #endif |
| 45 | |
| 46 | private: |
| 47 | bool placeWindow(); |
| 48 | |
| 49 | QSharedPointer<const StaticConfig> staticConfig; |
| 50 | |
| 51 | #if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
| 52 | QStringList files; |
| 53 | #endif |
| 54 | }; |
| 55 | |
| 56 | #endif |