/usr/include/qmmpui/filedialog.h is in qmmp 1.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | /**************************************************************************
* Copyright (C) 2008-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef FILEDIALOG_H
#define FILEDIALOG_H
#include <QString>
#include <QStringList>
#include <QFileDialog>
#include <QHash>
#include "filedialogfactory.h"
class QmmpUiPluginCache;
/*! @brief The FileDialog class is the base interface class of the file dialogs.
* @author Vladimir Kuznetsov <vovanec@gmail.com>
*/
class FileDialog : public QObject
{
Q_OBJECT
public:
/*!
* Returns a list of registered file dialog factories.
*/
static QList <FileDialogFactory*> factories();
/*!
* Selects current file dialog factory.
*/
static void setEnabled(FileDialogFactory *factory);
/*!
* Returns \b true if file dialog \b factory is used by default, otherwise returns \b false
*/
static bool isEnabled(FileDialogFactory *factory);
/*!
* Returns plugin file path.
* @param factory File dialog plugin factory.
*/
static QString file(FileDialogFactory *factory);
/*!
* Enum of available file dialog modes
*/
enum Mode
{
AddFile = 0, /*!< Get existing file */
AddDir, /*!< Get existing directory */
AddFiles, /*!< Get existing files */
AddDirs, /*!< Get existing directories */
AddDirsFiles, /*!< Get existing files and directories */
SaveFile /*!< Get existing or non-existing file */
};
/*!
* This is a static function that will open modal file dialog and
* return an existing directory selected by the user.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
*/
static QString getExistingDirectory(QWidget *parent = 0,
const QString &caption = QString(),
const QString &dir = QString());
/*!
* This is a static function that will open modal file dialog and
* return an existing file selected by the user.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter
*/
static QString getOpenFileName(QWidget *parent = 0,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
QString *selectedFilter = 0);
/*!
* This is a static function that will open modal file dialog and
* return an existing file selected by the user.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter.
*/
static QStringList getOpenFileNames(QWidget *parent = 0,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
QString *selectedFilter = 0);
/*!
* This is a static function that will open modal file dialog and
* return a file name selected by the user. The file does not have to exist.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter.
*/
static QString getSaveFileName (QWidget *parent = 0,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
QString *selectedFilter = 0);
/*!
* Opens nonmodal file dialog. Selected file dialog should support nonmodal mode.
* Otherwise this function creates modal dialog.
* @param parent Parent widget.
* @param mode File dialog mode.
* @param dir Default directory.
* @param receiver Receiver QObject.
* @param member Receiver slot.
* @param caption Dialog title.
* @param filters Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
*
* Usage: FileDialog::popup(this, FileDialog::AddDirs, &m_lastDir,
* m_playListModel, SLOT(addFileList(const QStringList&)),
* tr("Choose a directory"));
*/
static void popup(QWidget *parent = 0,
Mode mode = AddFiles,
QString *dir = 0,
QObject *receiver = 0,
const char *member = 0,
const QString &caption = QString(),
const QString &filters = QString());
signals:
/*!
* Emitted when the add button has pressed. Subclass should emit this signal.
*/
void filesAdded(const QStringList&);
protected:
/*!
* Object constructor.
*/
FileDialog();
/*!
* This is a function that will open modal file dialog and
* return an existing directory selected by the user.
*
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
*/
virtual QString existingDirectory(QWidget *parent,
const QString &caption,
const QString &dir);
/*!
* This is a function that will open modal file dialog and
* return an existing file selected by the user.
* Subclass should reimplement this function.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter
*/
virtual QString openFileName( QWidget *parent,
const QString &caption,
const QString &dir,
const QString &filter,
QString *selectedFilter);
/*!
* This is a function that will open modal file dialog and
* return an existing files selected by the user.
* Subclass should reimplement this function.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter
*/
virtual QStringList openFileNames(QWidget *parent,
const QString &caption,
const QString &dir,
const QString &filter,
QString *selectedFilter);
/*!
* This is a function that will open modal file dialog and
* return a file name selected by the user. The file does not have to exist.
* Subclass should reimplement this function.
* @param parent Parent widget.
* @param caption Dialog title.
* @param dir Default directory.
* @param filter Filer used by file dialog
* (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)").
* @param selectedFilter Default selected filter.
*/
virtual QString saveFileName (QWidget *parent, const QString &caption, const QString &dir,
const QString &filter, QString *selectedFilter);
/*!
* Object destructor
*/
virtual ~FileDialog();
/*!
* Opens nonmodal file dialog. Selected file dialog should support nonmodal mode.
* Otherwise this function does nothing.
* Nonmodal dialog subclass should reimplement this function.
* @param dir Default directory.
* @param mode File dialog mode.
* @param caption Dialog title.
* @param mask Filer used by file dialog
*/
virtual void raise(const QString &dir = QString(), Mode mode = AddFiles,
const QString &caption = QString(), const QStringList &mask = QStringList());
private slots:
void updateLastDir(const QStringList&);
private:
static void loadPlugins();
static FileDialog* instance();
static FileDialog* createDefault();
static FileDialogFactory *m_currentFactory;
static FileDialog* m_instance;
static QList<QmmpUiPluginCache*> *m_cache;
void init(QObject* receiver, const char* member, QString *dir);
bool m_initialized;
QString *m_lastDir;
};
#endif
|