Optika GUI Toolik Version of the Day
Optika_metawindow.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //         Optika: A Tool For Developing Parameter Obtaining GUIs
00005 //                Copyright (2009) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, with Sandia Corporation, the 
00008 // U.S. Government retains certain rights in this software.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Kurtis Nusbaum (klnusbaum@gmail.com) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 #ifndef METAWINDOW_HPP_
00029 #define METAWINDOW_HPP_
00030 #include <QMainWindow>
00031 #include <QDialog>
00032 #include <QModelIndex>
00033 #include "Optika_treeview.hpp"
00034 
00035 class QAction;
00036 class QMenu;
00037 class QLabel;
00038 class QPushButton;
00039 class QLineEdit;
00040 namespace Optika{
00041 
00046 class SearchWidget : public QDialog{
00047   Q_OBJECT
00048 public:
00056   SearchWidget(TreeModel *treeModel, TreeView *treeView, QWidget *parent=0);
00057 
00058 private slots:
00063   void search();
00064 
00069   void next();
00070 
00075   void previous();
00076 
00077 private:
00088   QModelIndexList removeHiddenItems(QModelIndexList& items);
00089 
00093   QPushButton *searchButton, *closeButton, *nextButton, *previousButton;
00094   QLineEdit *searchTermsEdit;
00095   QLabel *matchesLabel;
00096   TreeModel *treeModel;
00097   TreeView *treeView;
00098 
00102   QList<QModelIndex> currentSearchResults;
00103 
00107   QList<QModelIndex>::const_iterator currentSearchIterator;
00108 
00109 };
00110 
00115 class MetaWindow : public QMainWindow{
00116   Q_OBJECT
00117 public:
00125   MetaWindow(Teuchos::RCP<Teuchos::ParameterList> validParameters, 
00126   QString fileName=QString());
00127 
00136   MetaWindow(Teuchos::RCP<Teuchos::ParameterList> validParameters, 
00137   void (*customFunc)(Teuchos::RCP<const Teuchos::ParameterList>),
00138   QString fileName=QString());
00139 
00149   MetaWindow(Teuchos::RCP<Teuchos::ParameterList> validParameters, 
00150   Teuchos::RCP<DependencySheet> dependencySheet,
00151   QString fileName=QString());
00152 
00163   MetaWindow(Teuchos::RCP<Teuchos::ParameterList> validParameters, 
00164   Teuchos::RCP<DependencySheet> dependencySheet,
00165   void (*customFunc)(Teuchos::RCP<const Teuchos::ParameterList>),
00166   QString fileName=QString());
00167 
00171   ~MetaWindow();
00172 
00178    void setAboutInfo(QString aboutInfo);
00179 
00185    QString getAboutInfo();
00186 
00187 
00188 protected:
00194   void closeEvent(QCloseEvent *event);
00195 
00196 
00197 private:
00201   SearchWidget *searchWidget;
00202   QAction *resetAct, *loadAct, *saveAct, *saveAsAct, *quitAct, *aboutAct, *searchAct;
00203   QMenu *fileMenu, *recentMenu, *helpMenu;
00204 
00208   QString aboutInfo;
00209 
00210   /*
00211    * The custom function to run when the user hits the submit button.
00212    */
00213   void (*customFunc)(Teuchos::RCP<const Teuchos::ParameterList>);
00214 
00218   QString currentLoadDir, currentSaveDir;
00219 
00223   QStringList recentDocsList;
00224 
00228   TreeView *view;
00229 
00233   TreeModel *model;
00234 
00238   Delegate *delegate;
00239 
00245   void initilization(void (*customFunc)(Teuchos::RCP<const Teuchos::ParameterList>)=0);
00246 
00250   void createMenus();
00251 
00255   void createActions();
00256 
00260   void load();
00261 
00265   void loadLastSettings();
00266 
00270   void saveSettings();
00271 
00275   void addRecentDocument(QString recentDocument);
00276 
00280   void updateRecentDocsMenu();
00281 
00282 private slots:
00286   void resetModel();
00287 
00291   bool saveFileAs();
00292 
00296   void saveFile();
00297 
00301   void loadFile();
00302 
00307   bool saveCurrentUnsavedFile();
00308 
00312   void loadRecentDoc();
00313 
00317   void showAbout();
00318 
00322   void initiateSearch();
00323   
00327   void submit();
00328 };
00329 
00330 
00331 
00332 }
00333 #endif /* METAWINDOW_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends