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
32 class 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
42 class ExprFileDialog : public QFileDialog {
43 Q_OBJECT
44 public:
45 ExprFileDialog(QWidget* parent = 0);
46 void addLookInEntries(QStringList paths);
47 void saveLookInEntries();
48 void restoreLookInEntries();
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
79 slots:
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:
90 QString _workingDirectory, _favDir;
91 QString _temppath;
92 QStringList _lookInList;
93 QLineEdit* _nameEdit;
94 QPushButton* _okButton;
95 bool _createDir;
96 ExprPreviewWidget* _pw;
97 QCheckBox* _cb;
98 QLabel* _combolabel;
99 QComboBox* _combo;
100 };
101
102 #endif
ExprFileDialog::resetPreview
void resetPreview()
Definition: ExprFileDialog.cpp:337
ExprFileDialog::_okButton
QPushButton * _okButton
Definition: ExprFileDialog.h:94
ExprPreviewWidget::ExprPreviewWidget
ExprPreviewWidget(QWidget *parent)
Definition: ExprFileDialog.cpp:63
ExprFileDialog::saveLookInEntries
void saveLookInEntries()
Definition: ExprFileDialog.cpp:210
ExprFileDialog::restoreLookInEntries
void restoreLookInEntries()
Definition: ExprFileDialog.cpp:212
ExprFileDialog::_cb
QCheckBox * _cb
Definition: ExprFileDialog.h:97
ExprFileDialog::getComboBox
QComboBox * getComboBox()
Definition: ExprFileDialog.h:74
ExprFileDialog::handleOk
void handleOk()
Definition: ExprFileDialog.cpp:113
ExprFileDialog::hideComboBox
void hideComboBox()
Definition: ExprFileDialog.cpp:385
ExprFileDialog::_combo
QComboBox * _combo
Definition: ExprFileDialog.h:99
ExprFileDialog::getExistingOrNewDirectory
QString getExistingOrNewDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
Definition: ExprFileDialog.cpp:295
ExprFileDialog::getExistingDirectory
QString getExistingDirectory(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
Definition: ExprFileDialog.cpp:274
ExprFileDialog::addSidebarShortcut
void addSidebarShortcut(const QString &s)
Definition: ExprFileDialog.cpp:398
ExprFileDialog::getSaveFileName
QString getSaveFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
Definition: ExprFileDialog.cpp:305
ExprFileDialog::hideCheckBox
void hideCheckBox()
Definition: ExprFileDialog.cpp:360
ExprFileDialog::_temppath
QString _temppath
Definition: ExprFileDialog.h:91
ExprFileDialog::getOpenFileNames
QStringList getOpenFileNames(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
Definition: ExprFileDialog.cpp:251
ExprFileDialog::_lookInList
QStringList _lookInList
Definition: ExprFileDialog.h:92
ExprFileDialog::_pw
ExprPreviewWidget * _pw
Definition: ExprFileDialog.h:96
ExprFileDialog::_workingDirectory
QString _workingDirectory
Definition: ExprFileDialog.h:90
ExprPreviewWidget::makePreview
void makePreview(const QString &path)
Definition: ExprFileDialog.cpp:39
ExprFileDialog::_createDir
bool _createDir
Definition: ExprFileDialog.h:95
ExprFileDialog::showComboBox
void showComboBox()
Definition: ExprFileDialog.cpp:380
ExprFileDialog::resetDir
void resetDir()
Definition: ExprFileDialog.h:84
ExprFileDialog::_combolabel
QLabel * _combolabel
Definition: ExprFileDialog.h:98
ExprPreviewWidget::reset
void reset()
Definition: ExprFileDialog.h:36
ExprFileDialog::addFavoritesButton
void addFavoritesButton(QString dirname, QString linkname, QString linkdir)
Definition: ExprFileDialog.cpp:165
ExprFileDialog::setButtonName
void setButtonName(const QString &str)
Definition: ExprFileDialog.cpp:394
ExprFileDialog::getOpenFileName
QString getOpenFileName(const QString &caption=QString::null, const QString &startWith=QString::null, const QString &filter=QString::null)
Definition: ExprFileDialog.cpp:229
ExprFileDialog::selChanged
void selChanged(const QString &path)
Definition: ExprFileDialog.cpp:390
ExprFileDialog::addCheckBox
void addCheckBox(QString s)
Definition: ExprFileDialog.cpp:341
ExprFileDialog::addLookInEntries
void addLookInEntries(QStringList paths)
Definition: ExprFileDialog.cpp:200
ExprFileDialog::addComboBox
void addComboBox(QString s, QStringList sl)
Definition: ExprFileDialog.cpp:364
ExprFileDialog
Definition: ExprFileDialog.h:42
ExprFileDialog::showCheckBox
void showCheckBox()
Definition: ExprFileDialog.cpp:356
ExprFileDialog::_nameEdit
QLineEdit * _nameEdit
Definition: ExprFileDialog.h:93
ExprFileDialog::editReturnPress
void editReturnPress()
Definition: ExprFileDialog.cpp:134
ExprPreviewWidget::_pm
QLabel * _pm
Definition: ExprFileDialog.h:39
ExprFileDialog::ExprFileDialog
ExprFileDialog(QWidget *parent=0)
Definition: ExprFileDialog.cpp:75
ExprFileDialog::_favDir
QString _favDir
Definition: ExprFileDialog.h:90
ExprFileDialog::setPreview
void setPreview()
Definition: ExprFileDialog.cpp:327
ExprPreviewWidget
Definition: ExprFileDialog.h:32
ExprFileDialog::gotoFavorites
void gotoFavorites()
Definition: ExprFileDialog.cpp:196
ExprFileDialog::checkBoxStatus
bool checkBoxStatus()
Definition: ExprFileDialog.cpp:351