2001-06-14 08:20:41 +00:00
|
|
|
// -*- C++ -*-
|
2001-03-07 14:25:31 +00:00
|
|
|
/**
|
|
|
|
* \file FileDialog.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-07 14:25:31 +00:00
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-03-07 14:25:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FILEDIALOG_H
|
|
|
|
#define FILEDIALOG_H
|
|
|
|
|
2008-03-05 23:10:53 +00:00
|
|
|
#include <QString>
|
2001-03-07 14:25:31 +00:00
|
|
|
|
2008-03-05 23:10:53 +00:00
|
|
|
#include <utility>
|
2001-03-07 14:25:31 +00:00
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
/**
|
|
|
|
* \class FileDialog
|
|
|
|
* \brief GUI-I definition of file dialog interface
|
|
|
|
*/
|
|
|
|
class FileDialog
|
|
|
|
{
|
2015-09-20 17:43:06 +00:00
|
|
|
/// noncopyable
|
|
|
|
FileDialog(FileDialog const &);
|
|
|
|
void operator=(FileDialog const &);
|
2001-03-07 14:25:31 +00:00
|
|
|
public:
|
|
|
|
/// label, directory path button
|
2008-03-05 23:10:53 +00:00
|
|
|
typedef std::pair<QString, QString> Button;
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
/// result type
|
|
|
|
enum ResultType {
|
|
|
|
Later, /**< modeless chooser, no result */
|
|
|
|
Chosen /**< string contains filename */
|
|
|
|
};
|
|
|
|
|
|
|
|
/// result return
|
2008-03-05 23:10:53 +00:00
|
|
|
typedef std::pair<FileDialog::ResultType, QString> Result;
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
/**
|
2003-02-21 12:22:25 +00:00
|
|
|
* Constructs a file dialog with title \param title.
|
2001-03-07 14:25:31 +00:00
|
|
|
*
|
2002-01-10 10:05:45 +00:00
|
|
|
* Up to two optional extra buttons are allowed for specifying
|
|
|
|
* additional directories in the navigation (an empty
|
2007-12-16 10:18:00 +00:00
|
|
|
* directory is interpreted as FileName::getcwd())
|
2001-03-07 14:25:31 +00:00
|
|
|
*/
|
2014-04-21 14:50:56 +00:00
|
|
|
FileDialog(QString const & title);
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
~FileDialog();
|
|
|
|
|
2008-03-05 23:10:53 +00:00
|
|
|
void setButton1(QString const & label, QString const & dir);
|
|
|
|
void setButton2(QString const & label, QString const & dir);
|
2007-10-28 16:32:20 +00:00
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
/// Choose a file for opening, starting in directory \c path.
|
2008-04-20 19:56:01 +00:00
|
|
|
Result open(QString const & path, QStringList const & filters,
|
2008-03-05 23:10:53 +00:00
|
|
|
QString const & suggested = QString());
|
2003-02-25 13:17:01 +00:00
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
/// Choose a directory, starting in directory \c path.
|
2008-03-05 23:10:53 +00:00
|
|
|
Result opendir(QString const & path = QString(),
|
|
|
|
QString const & suggested = QString());
|
2001-03-07 14:25:31 +00:00
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
/// Choose a file for saving, starting in directory \c path.
|
2008-04-20 19:56:01 +00:00
|
|
|
Result save(QString const & path, QStringList const & filters,
|
2008-03-05 23:10:53 +00:00
|
|
|
QString const & suggested = QString());
|
2001-03-07 14:25:31 +00:00
|
|
|
|
2011-10-15 13:32:14 +00:00
|
|
|
/// Also retrieve the selected filter (selectedFilter can be 0 if
|
|
|
|
/// that output is not needed).
|
2011-10-06 13:47:42 +00:00
|
|
|
Result save(QString const & path, QStringList const & filters,
|
2011-10-15 13:32:14 +00:00
|
|
|
QString const & suggested, QString *selectedFilter);
|
2011-10-06 13:47:42 +00:00
|
|
|
|
2006-07-09 17:27:17 +00:00
|
|
|
private:
|
2001-03-07 14:25:31 +00:00
|
|
|
class Private;
|
|
|
|
friend class Private;
|
|
|
|
Private * private_;
|
|
|
|
|
|
|
|
/// the dialog title
|
2008-03-05 23:10:53 +00:00
|
|
|
QString title_;
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
#endif // FILEDIALOG_H
|