SeExpr
ExprFileDialog.h
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 */
17 
18 // NOTE: This is based on Dan's paint3d FileDialog
19 
20 #ifndef EXPRFILEDIALOG_H
21 #define EXPRFILEDIALOG_H
22 
23 #include <QtGui/QLabel>
24 #include <QtGui/QComboBox>
25 #include <QtGui/QCheckBox>
26 #include <QtGui/QLineEdit>
27 #include <QtGui/QPixmap>
28 #include <QtGui/QFileDialog>
29 #include <QtGui/QVBoxLayout>
30 #include <QtGui/QPushButton>
31 
32 
33 class ExprPreviewWidget : public QWidget
34 {
35 public:
36  ExprPreviewWidget( QWidget *parent );
37  void makePreview(const QString& path);
38  void reset() { _pm->setPixmap(QPixmap()); }
39 
40 private:
41  QLabel* _pm;
42 };
43 
44 
45 class ExprFileDialog : public QFileDialog
46 {
47  Q_OBJECT
48  public:
49  ExprFileDialog( QWidget* parent = 0 );
50  void addLookInEntries(QStringList paths);
51  void saveLookInEntries();
52  void restoreLookInEntries();
53  QString getOpenFileName( const QString & caption = QString::null,
54  const QString & startWith = QString::null,
55  const QString & filter = QString::null );
56  QString getExistingDirectory( const QString & caption = QString::null,
57  const QString & startWith = QString::null,
58  const QString & filter = QString::null );
59  QString getExistingOrNewDirectory( const QString & caption = QString::null,
60  const QString & startWith = QString::null,
61  const QString & filter = QString::null );
62  QStringList getOpenFileNames( const QString & caption = QString::null,
63  const QString & startWith = QString::null,
64  const QString & filter = QString::null );
65  QString getSaveFileName( const QString & caption = QString::null,
66  const QString & startWith = QString::null,
67  const QString & filter = QString::null );
68  void setPreview();
69  void resetPreview();
70  void addCheckBox(QString s);
71  void addFavoritesButton(QString dirname, QString linkname, QString linkdir);
72  bool checkBoxStatus();
73  void showCheckBox();
74  void hideCheckBox();
75  void addComboBox(QString s, QStringList sl);
76  void showComboBox();
77  void hideComboBox();
78  QComboBox* getComboBox() { return _combo; }
79  void setButtonName(const QString& str);
80  void addSidebarShortcut(const QString& s);
81 
82  private slots:
83  void handleOk();
84  void editReturnPress();
85  void gotoFavorites();
86  void selChanged(const QString& path);
87  void resetDir()
88  { if (!_temppath.isEmpty()) setDirectory(_temppath); _temppath = ""; }
89 
90  private:
92  QString _temppath;
93  QStringList _lookInList;
94  QLineEdit* _nameEdit;
95  QPushButton* _okButton;
96  bool _createDir;
98  QCheckBox* _cb;
99  QLabel* _combolabel;
100  QComboBox* _combo;
101 };
102 
103 #endif
void selChanged(const QString &path)
void addFavoritesButton(QString dirname, QString linkname, QString linkdir)
void addCheckBox(QString s)
QString _workingDirectory
QString getExistingOrNewDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
QLabel * _combolabel
void addLookInEntries(QStringList paths)
ExprPreviewWidget * _pw
QString getExistingDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
QComboBox * getComboBox()
void addComboBox(QString s, QStringList sl)
void makePreview(const QString &path)
void restoreLookInEntries()
QStringList getOpenFileNames(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
void addSidebarShortcut(const QString &s)
void setButtonName(const QString &str)
QPushButton * _okButton
ExprFileDialog(QWidget *parent=0)
QString getSaveFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
QComboBox * _combo
QLineEdit * _nameEdit
QString getOpenFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
ExprPreviewWidget(QWidget *parent)
QStringList _lookInList
QCheckBox * _cb