QSapecNG
 All Classes Functions Enumerations Properties
qsapecngwindow.h
00001 /*
00002     QSapecNG - Qt based SapecNG GUI front-end
00003     Copyright (C) 2009, Michele Caini
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef QSAPECNGWINDOW_H
00021 #define QSAPECNGWINDOW_H
00022 
00023 
00024 #include <QtGui/QMainWindow>
00025 #include <QtCore/QModelIndex>
00026 
00027 #include "gui/workplane/workplane.h"
00028 
00029 
00030 class QWidget;
00031 
00032 class QProgressBar;
00033 
00034 class QMdiArea;
00035 class QMdiSubWindow;
00036 
00037 class QTabWidget;
00038 
00039 class QTextEdit;
00040 class QLineEdit;
00041 class QPushButton;
00042 class QAction;
00043 class QMenu;
00044 
00045 class QToolBar;
00046 class QDockWidget;
00047 
00048 class QSignalMapper;
00049 
00050 class QtTreePropertyBrowser;
00051 
00052 class QUndoView;
00053 class QUndoGroup;
00054 
00055 class QFileSystemModel;
00056 class QTreeView;
00057 
00058 
00059 namespace qsapecng
00060 {
00061 
00062 
00063 class QLogPolicy;
00064 
00065 class SchematicEditor;
00066 class SideBarModel;
00067 class SideBarView;
00068 
00069 class Item;
00070 
00071 
00072 class QSapecNGWindow: public QMainWindow
00073 {
00074 
00075   Q_OBJECT
00076 
00077 public:
00078   QSapecNGWindow();
00079   
00080   friend QSapecNGWindow& operator<<(
00081       QSapecNGWindow& window,
00082       const QString& str
00083     );
00084 
00085 protected:
00086   void closeEvent(QCloseEvent* event);
00087 
00088 private slots:
00089   void toggleScreenMode();
00090 
00091   void configDialog();
00092   void changeWorkspace();
00093 
00094   void zoomIn();
00095   void zoomOut();
00096   void zoomNormal();
00097   void fit();
00098 
00099   void wave();
00100   void assignNodes();
00101   void resolve();
00102   void plot(int f);
00103   void xAxisLogScale(bool log);
00104   void yAxisLogScale(bool log);
00105   void replot();
00106 
00107   void newFile();
00108   void open(const QString& fileName);
00109   void open();
00110   void openRecent();
00111   void save();
00112   void saveAs();
00113   void print();
00114 
00115   void props();
00116 
00117   void bin();
00118   void cut();
00119   void copy();
00120   void paste();
00121   void rotate();
00122   void mirror();
00123   void bringToFront();
00124   void sendToBack();
00125 
00126   void license();
00127   void about();
00128 
00129   void userDefRequested();
00130   void connectedWireSessionRequested();
00131   void disconnectedWireSessionRequested();
00132   void groundSessionRequested();
00133   void portSessionRequested();
00134   void outSessionRequested();
00135   void voltmeterSessionRequested();
00136   void ammeterSessionRequested();
00137   void labelSessionRequested();
00138   void clearSessionRequested();
00139 
00140   void activated(const QModelIndex& index);
00141   void sceneSelectionChanged();
00142   void updateMenus();
00143   void updateWindowMenu();
00144   void updatePropertyBrowser();
00145   void updateDocks();
00146 
00147   void setActiveSubWindow(QWidget* window);
00148   void subWindowActivated(QMdiSubWindow* window);
00149   void stackEditor(SchematicEditor* editor);
00150   
00151 signals:
00152   void toggleGrid(bool visible);
00153 
00154 private:
00155   void createLogger();
00156   void createActions();
00157   void createDockWidgets();
00158   void createMenus();
00159   void createToolBars();
00160   void createStatusBar();
00161 
00162   void createSideBarDockLayout();
00163   void createPropertyDockLayout();
00164   void createMessageDockLayout();
00165   void createUndoRedoDockLayout();
00166   void createWorkspaceDockLayout();
00167 
00168   void readSettings();
00169   void writeSettings();
00170 
00171   SchematicEditor* activeEditor();
00172   QMdiSubWindow* findEditor(const QString& fileName);
00173   SchematicEditor* createSchematicEditor();
00174   void setupSchematicEditor(SchematicEditor* editor);
00175 
00176   void updateRecentFileList(const QString& fileName);
00177   void loadRecentFileList();
00178 
00179 private:
00180   QProgressBar* progressBar_;
00181 
00182   SideBarModel* sideBarModel_;
00183   SideBarView* sideBarView_;
00184 
00185   QtTreePropertyBrowser* treeBrowser_;
00186 
00187   QLogPolicy* policy_;
00188   QTextEdit* logViewer_;
00189 
00190   QUndoView* undoRedoView_;
00191   QUndoGroup* undoRedoGroup_;
00192 
00193   QLineEdit* workspace_;
00194   QFileSystemModel* wfsModel_;
00195   QTreeView* wfsView_;
00196 
00197   QMdiArea* mdiArea_;
00198   QSignalMapper* windowMapper_;
00199 
00200   WorkPlane* workplane_;
00201 
00202   QTabWidget* central_;
00203 
00204   QMenu* fileMenu_;
00205   QMenu* recentMenu_;
00206   QMenu* editMenu_;
00207   QMenu* viewMenu_;
00208   QMenu* runMenu_;
00209   QMenu* workplaneMenu_;
00210   QMenu* toolMenu_;
00211   QMenu* settingMenu_;
00212   QMenu* toolbarMenu_;
00213   QMenu* windowMenu_;
00214   QMenu* showMenu_;
00215   QMenu* helpMenu_;
00216   QMenu* sceneMenu_;
00217 
00218   QToolBar* fileToolBar_;
00219   QToolBar* viewToolBar_;
00220   QToolBar* runToolBar_;
00221   QToolBar* toolToolBar_;
00222 
00223   QDockWidget* sideBarDock_;
00224   QDockWidget* propertyDock_;
00225   QDockWidget* messageDock_;
00226   QDockWidget* undoRedoDock_;
00227   QDockWidget* workspaceDock_;
00228 
00229   QAction* newAct_;
00230   QAction* openAct_;
00231   QAction* saveAct_;
00232   QAction* saveAsAct_;
00233   QAction* printAct_;
00234   QAction* quitAct_;
00235   QAction* binAct_;
00236   QAction* undoAct_;
00237   QAction* redoAct_;
00238   QAction* propsAct_;
00239   QAction* cutAct_;
00240   QAction* copyAct_;
00241   QAction* pasteAct_;
00242   QAction* rotateAct_;
00243   QAction* mirrorAct_;
00244   QAction* bringToFrontAct_;
00245   QAction* sendToBackAct_;
00246   QAction* zoomInAct_;
00247   QAction* zoomOutAct_;
00248   QAction* zoomNormalAct_;
00249   QAction* fitAct_;
00250   QAction* nodeAct_;
00251   QAction* resolveAct_;
00252   QAction* waveAct_;
00253   QAction* toggleScreenModeAct_;
00254   QAction* configureAppAct_;
00255   QAction* closeAct_;
00256   QAction* closeAllAct_;
00257   QAction* tileAct_;
00258   QAction* cascadeAct_;
00259   QAction* nextAct_;
00260   QAction* previousAct_;
00261   QAction* separatorAct_;
00262   QAction* licenseAct_;
00263   QAction* aboutAct_;
00264   QAction* aboutQtAct_;
00265   QAction* userdefAct_;
00266   QAction* connectedWireSessionAct_;
00267   QAction* disconnectedWireSessionAct_;
00268   QAction* groundSessionAct_;
00269   QAction* portSessionAct_;
00270   QAction* outSessionAct_;
00271   QAction* voltmeterSessionAct_;
00272   QAction* ammeterSessionAct_;
00273   QAction* labelSessionAct_;
00274   QAction* cursorAct_;
00275   QAction* toggleGridAct_;
00276 
00277   QSignalMapper* fMapper_;
00278   QAction* magnitudeAct_;
00279   QAction* magnitudeRadAct_;
00280   QAction* phaseAct_;
00281   QAction* phaseRadAct_;
00282   QAction* gainAct_;
00283   QAction* gainRadAct_;
00284   QAction* lossAct_;
00285   QAction* lossRadAct_;
00286   QAction* zerosPolesAct_;
00287   /* plotter noop acts */
00288   QAction* xLogAct_;
00289   QAction* yLogAct_;
00290   QAction* replotAct_;
00291 
00292   enum { maxRecentFiles = 10 };
00293   QAction* openRecentActs_[maxRecentFiles];
00294 
00295 };
00296 
00297 
00298 }
00299 
00300 
00301 #endif // QSAPECNGWINDOW_H
 All Classes Functions Enumerations Properties