SeExpr
ExprBrowser.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 * @file ExprBrowser.h
18 * @brief Browser for a library of expressions from a tree of files
19 * @author aselle
20 */
21 #ifndef ExprBrowser_h
22 #define ExprBrowser_h
23 
24 #include <QWidget>
25 #include <QAbstractItemModel>
26 
27 #include <iostream>
28 #include <fstream>
29 #include <sstream>
30 
31 class QLineEdit;
32 class QTreeWidget;
33 class QTreeView;
34 class QTreeWidgetItem;
35 class QTextBrowser;
36 class ExprEditor;
37 class QSortFilterProxyModel;
38 class QDir;
39 
40 class ExprTreeModel;
42 
43 class ExprBrowser : public QWidget {
44  Q_OBJECT
45 
47  QList<QString> labels;
48  QList<QString> paths;
51  QTreeView* treeNew;
52  QLineEdit* exprFilter;
53  std::string _userExprDir;
54  std::string _localExprDir;
55  std::string _context;
56  std::string _searchPath;
58 
59  public:
60  ExprBrowser(QWidget* parent, ExprEditor* editor);
61  ~ExprBrowser();
62  void addPath(const std::string& name, const std::string& path);
63  std::string getSelectedPath();
64  void selectPath(const char* path);
65  void addUserExpressionPath(const std::string& context);
66  bool getExpressionDirs();
67  bool getExpressionDirs(const std::string& context);
68  void setSearchPath(const QString& context, const QString& path);
69  void expandAll();
70  void expandToDepth(int depth);
71  void setApplyOnSelect(bool on) { _applyOnSelect = on; }
72  public
73 slots:
74  void handleSelection(const QModelIndex& current, const QModelIndex& previous);
75  void update();
76  void clear();
77  void clearSelection();
78  void saveExpression();
79  void saveLocalExpressionAs();
80  void saveExpressionAs();
81  private
82 slots:
83  void clearFilter();
84  void filterChanged(const QString& str);
85 };
86 
87 #endif
ExprBrowser::clearSelection
void clearSelection()
Definition: ExprBrowser.cpp:327
ExprBrowser::_localExprDir
std::string _localExprDir
Definition: ExprBrowser.h:54
ExprEditor
Definition: ExprEditor.h:94
ExprBrowser::expandAll
void expandAll()
Definition: ExprBrowser.cpp:394
ExprBrowser
Definition: ExprBrowser.h:43
ExprBrowser::filterChanged
void filterChanged(const QString &str)
Definition: ExprBrowser.cpp:331
ExprBrowser::update
void update()
Definition: ExprBrowser.cpp:300
ExprBrowser::saveLocalExpressionAs
void saveLocalExpressionAs()
Definition: ExprBrowser.cpp:359
ExprBrowser::saveExpressionAs
void saveExpressionAs()
Definition: ExprBrowser.cpp:341
ExprBrowser::_applyOnSelect
bool _applyOnSelect
Definition: ExprBrowser.h:57
ExprBrowser::handleSelection
void handleSelection(const QModelIndex &current, const QModelIndex &previous)
Definition: ExprBrowser.cpp:305
ExprBrowser::setSearchPath
void setSearchPath(const QString &context, const QString &path)
Definition: ExprBrowser.cpp:280
ExprBrowser::expandToDepth
void expandToDepth(int depth)
Definition: ExprBrowser.cpp:396
ExprBrowser::proxyModel
ExprTreeFilterModel * proxyModel
Definition: ExprBrowser.h:50
ExprBrowser::treeNew
QTreeView * treeNew
Definition: ExprBrowser.h:51
ExprBrowser::_searchPath
std::string _searchPath
Definition: ExprBrowser.h:56
ExprBrowser::saveExpression
void saveExpression()
Definition: ExprBrowser.cpp:377
ExprBrowser::_context
std::string _context
Definition: ExprBrowser.h:55
ExprBrowser::ExprBrowser
ExprBrowser(QWidget *parent, ExprEditor *editor)
Definition: ExprBrowser.cpp:242
ExprBrowser::labels
QList< QString > labels
Definition: ExprBrowser.h:47
ExprBrowser::_userExprDir
std::string _userExprDir
Definition: ExprBrowser.h:53
ExprTreeFilterModel
Definition: ExprBrowser.cpp:216
ExprBrowser::selectPath
void selectPath(const char *path)
Definition: ExprBrowser.cpp:295
ExprBrowser::setApplyOnSelect
void setApplyOnSelect(bool on)
Definition: ExprBrowser.h:71
ExprBrowser::getSelectedPath
std::string getSelectedPath()
Definition: ExprBrowser.cpp:285
ExprBrowser::paths
QList< QString > paths
Definition: ExprBrowser.h:48
ExprBrowser::clearFilter
void clearFilter()
Definition: ExprBrowser.cpp:329
ExprBrowser::addPath
void addPath(const std::string &name, const std::string &path)
Definition: ExprBrowser.cpp:274
ExprBrowser::getExpressionDirs
bool getExpressionDirs()
Definition: ExprBrowser.cpp:415
context
If a scalar is used in a vector context
Definition: userdoc.txt:436
ExprBrowser::clear
void clear()
Definition: ExprBrowser.cpp:319
ExprBrowser::exprFilter
QLineEdit * exprFilter
Definition: ExprBrowser.h:52
ExprTreeModel
Definition: ExprBrowser.cpp:129
ExprBrowser::addUserExpressionPath
void addUserExpressionPath(const std::string &context)
Definition: ExprBrowser.cpp:399
ExprBrowser::~ExprBrowser
~ExprBrowser()
Definition: ExprBrowser.cpp:240
ExprBrowser::editor
ExprEditor * editor
Definition: ExprBrowser.h:46
ExprBrowser::treeModel
ExprTreeModel * treeModel
Definition: ExprBrowser.h:49