[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 3 |
|
---|
| 4 | This program is free software; you can redistribute it and/or modify
|
---|
| 5 | it under the terms of the GNU General Public License as published by
|
---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 7 | (at your option) any later version.
|
---|
| 8 |
|
---|
| 9 | This program is distributed in the hope that it will be useful,
|
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 12 | GNU General Public License for more details.
|
---|
| 13 |
|
---|
| 14 | You should have received a copy of the GNU General Public License
|
---|
| 15 | along with this program; if not, write to the Free Software
|
---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 17 | */
|
---|
| 18 |
|
---|
[176] | 19 | #ifndef FILECHOOSER_H
|
---|
| 20 | #define FILECHOOSER_H
|
---|
[112] | 21 |
|
---|
[124] | 22 | #include "lineedit_with_icon.h"
|
---|
[112] | 23 | #include <QFileDialog>
|
---|
| 24 |
|
---|
[124] | 25 | class QToolButton;
|
---|
| 26 |
|
---|
| 27 | class FileChooser : public LineEditWithIcon
|
---|
[112] | 28 | {
|
---|
| 29 | Q_OBJECT
|
---|
| 30 | Q_PROPERTY(QString text READ text WRITE setText)
|
---|
| 31 | Q_PROPERTY(QString caption READ caption WRITE setCaption)
|
---|
| 32 | Q_PROPERTY(QString filter READ filter WRITE setFilter)
|
---|
| 33 | Q_PROPERTY(DialogType dialogType READ dialogType WRITE setDialogType)
|
---|
| 34 | Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions)
|
---|
| 35 |
|
---|
| 36 | public:
|
---|
| 37 | enum DialogType { GetFileName = 0, GetDirectory = 1 };
|
---|
| 38 |
|
---|
| 39 | FileChooser( QWidget* parent = 0 );
|
---|
| 40 | ~FileChooser();
|
---|
| 41 |
|
---|
| 42 | QString caption() const { return _caption; };
|
---|
| 43 | QString filter() const { return _filter; };
|
---|
| 44 | DialogType dialogType() const { return _type; };
|
---|
| 45 | QFileDialog::Options options() const { return _options; };
|
---|
| 46 |
|
---|
| 47 | public slots:
|
---|
| 48 | void setCaption(const QString & caption) { _caption = caption; };
|
---|
| 49 | void setFilter(const QString & filter) { _filter = filter; };
|
---|
| 50 | void setDialogType( DialogType type) { _type = type; };
|
---|
| 51 | void setOptions( QFileDialog::Options options) { _options = options; };
|
---|
| 52 |
|
---|
| 53 | signals:
|
---|
| 54 | void fileChanged(QString file);
|
---|
| 55 |
|
---|
[124] | 56 | protected:
|
---|
| 57 | virtual void setupButton();
|
---|
| 58 |
|
---|
[112] | 59 | protected slots:
|
---|
[124] | 60 | virtual void openFileDialog();
|
---|
[112] | 61 |
|
---|
| 62 | protected:
|
---|
| 63 | QString _caption;
|
---|
| 64 | QString _filter;
|
---|
| 65 | DialogType _type;
|
---|
| 66 | QFileDialog::Options _options;
|
---|
[124] | 67 |
|
---|
| 68 | static QString last_dir;
|
---|
[112] | 69 | };
|
---|
| 70 |
|
---|
| 71 | #endif
|
---|