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 <QLabel>
24#include <QComboBox>
25#include <QCheckBox>
26#include <QLineEdit>
27#include <QPixmap>
28#include <QFileDialog>
29#include <QVBoxLayout>
30#include <QPushButton>
31
32class ExprPreviewWidget : public QWidget {
33 public:
34 ExprPreviewWidget(QWidget* parent);
35 void makePreview(const QString& path);
36 void reset() { _pm->setPixmap(QPixmap()); }
37
38 private:
39 QLabel* _pm;
40};
41
42class ExprFileDialog : public QFileDialog {
43 Q_OBJECT
44 public:
45 ExprFileDialog(QWidget* parent = 0);
46 void addLookInEntries(QStringList paths);
47 void saveLookInEntries();
49 QString getOpenFileName(const QString& caption = QString::null,
50 const QString& startWith = QString::null,
51 const QString& filter = QString::null);
52 QString getExistingDirectory(const QString& caption = QString::null,
53 const QString& startWith = QString::null,
54 const QString& filter = QString::null);
55 QString getExistingOrNewDirectory(const QString& caption = QString::null,
56 const QString& startWith = QString::null,
57 const QString& filter = QString::null);
58 QStringList getOpenFileNames(const QString& caption = QString::null,
59 const QString& startWith = QString::null,
60 const QString& filter = QString::null);
61 QString getSaveFileName(const QString& caption = QString::null,
62 const QString& startWith = QString::null,
63 const QString& filter = QString::null);
64 void setPreview();
65 void resetPreview();
66 void addCheckBox(QString s);
67 void addFavoritesButton(QString dirname, QString linkname, QString linkdir);
68 bool checkBoxStatus();
69 void showCheckBox();
70 void hideCheckBox();
71 void addComboBox(QString s, QStringList sl);
72 void showComboBox();
73 void hideComboBox();
74 QComboBox* getComboBox() { return _combo; }
75 void setButtonName(const QString& str);
76 void addSidebarShortcut(const QString& s);
77
78 private
79slots:
80 void handleOk();
81 void editReturnPress();
82 void gotoFavorites();
83 void selChanged(const QString& path);
84 void resetDir() {
85 if (!_temppath.isEmpty()) setDirectory(_temppath);
86 _temppath = "";
87 }
88
89 private:
91 QString _temppath;
92 QStringList _lookInList;
93 QLineEdit* _nameEdit;
94 QPushButton* _okButton;
97 QCheckBox* _cb;
98 QLabel* _combolabel;
99 QComboBox* _combo;
100};
101
102#endif
QString _workingDirectory
void addLookInEntries(QStringList paths)
QString getExistingOrNewDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
QString getOpenFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
QStringList getOpenFileNames(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
void addCheckBox(QString s)
ExprPreviewWidget * _pw
QComboBox * _combo
QLabel * _combolabel
void setButtonName(const QString &str)
void addSidebarShortcut(const QString &s)
QString getExistingDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
void restoreLookInEntries()
void addComboBox(QString s, QStringList sl)
QLineEdit * _nameEdit
QStringList _lookInList
QPushButton * _okButton
QCheckBox * _cb
QString getSaveFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
void addFavoritesButton(QString dirname, QString linkname, QString linkdir)
QComboBox * getComboBox()
void selChanged(const QString &path)
void makePreview(const QString &path)