00001 /* 00002 * (c) Disney Enterprises, Inc. All rights reserved. 00003 * 00004 * This file is licensed under the terms of the Microsoft Public License (MS-PL) 00005 * as defined at: http://opensource.org/licenses/MS-PL. 00006 * 00007 * A complete copy of this license is included in this distribution as the file 00008 * LICENSE. 00009 * 00010 * @file SeExprEdBrowser.h 00011 * @brief Browser for a library of expressions from a tree of files 00012 * @author aselle 00013 */ 00014 #ifndef SeExprEdBrowser_h 00015 #define SeExprEdBrowser_h 00016 00017 00018 #include <QtGui/QWidget> 00019 #include <QtCore/QAbstractItemModel> 00020 00021 #include <iostream> 00022 #include <fstream> 00023 #include <sstream> 00024 00025 class QLineEdit; 00026 class QTreeWidget; 00027 class QTreeView; 00028 class QTreeWidgetItem; 00029 class QTextBrowser; 00030 class SeExprEditor; 00031 class QSortFilterProxyModel; 00032 class QDir; 00033 00034 class SeExprEdTreeModel; 00035 class SeExprEdTreeFilterModel; 00036 00037 class SeExprEdBrowser : public QWidget 00038 { 00039 Q_OBJECT 00040 00041 SeExprEditor* editor; 00042 QList<QString> labels; 00043 QList<QString> paths; 00044 SeExprEdTreeModel* treeModel; 00045 SeExprEdTreeFilterModel* proxyModel; 00046 QTreeView* treeNew; 00047 QLineEdit* exprFilter; 00048 std::string _userExprDir; 00049 std::string _localExprDir; 00050 std::string _context; 00051 std::string _searchPath; 00052 00053 public: 00054 SeExprEdBrowser(QWidget* parent, SeExprEditor* editor); 00055 ~SeExprEdBrowser(); 00056 void addPath(const std::string& name,const std::string& path); 00057 std::string getSelectedPath(); 00058 void selectPath(const char * path); 00059 bool getExpressionDirs(); 00060 bool getExpressionDirs(const std::string& context); 00061 void setSearchPath(const QString& context, const QString& path); 00062 void expandAll(); 00063 public slots: 00064 void handleSelection(const QModelIndex& current,const QModelIndex& previous); 00065 void update(); 00066 void clear(); 00067 void clearSelection(); 00068 void saveExpression(); 00069 void saveLocalExpressionAs(); 00070 void saveExpressionAs(); 00071 private slots: 00072 void clearFilter(); 00073 void filterChanged(const QString& str); 00074 00075 }; 00076 00077 #endif