CombiView.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2009 Jürgen Riegel <juergen.riegel@web.de>              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00027 
00028 #include "CombiView.h"
00029 #include "BitmapFactory.h"
00030 #include "iisTaskPanel/include/iisTaskPanel"
00031 #include "PropertyView.h"
00032 #include "Application.h"
00033 #include "Document.h"
00034 #include "Tree.h"
00035 #include "TaskView/TaskView.h"
00036 #include "propertyeditor/PropertyEditor.h"
00037 
00038 using namespace Gui;
00039 using namespace Gui::DockWnd;
00040 
00041 
00042 /* TRANSLATOR Gui::DockWnd::CombiView */
00043 
00044 CombiView::CombiView(Gui::Document* pcDocument, QWidget *parent)
00045   : DockWindow(pcDocument,parent), oldTabIndex(0)
00046 {
00047     setWindowTitle(tr("CombiView"));
00048 
00049     QGridLayout* pLayout = new QGridLayout(this); 
00050     pLayout->setSpacing( 0 );
00051     pLayout->setMargin ( 0 );
00052 
00053     // tabs to switch between Tree/Properties and TaskPanel
00054     tabs = new QTabWidget ();
00055     tabs->setObjectName(QString::fromUtf8("combiTab"));
00056     tabs->setTabPosition(QTabWidget::North);
00057     //tabs->setTabShape(QTabWidget::Triangular);
00058     pLayout->addWidget( tabs, 0, 0 );
00059 
00060     // splitter between tree and property view
00061     QSplitter *splitter = new QSplitter();
00062     splitter->setOrientation(Qt::Vertical);
00063 
00064     // tree widget
00065     tree =  new TreeWidget(this);
00066     //tree->setRootIsDecorated(false);
00067     splitter->addWidget(tree);
00068 
00069     // property view
00070     prop = new PropertyView(this);
00071     splitter->addWidget(prop);
00072 
00073     tabs->addTab(splitter,trUtf8("Project"));
00074 
00075     // task panel
00076     taskPanel = new Gui::TaskView::TaskView(this);
00077     tabs->addTab(taskPanel, trUtf8("Tasks"));
00078 }
00079 
00080 CombiView::~CombiView()
00081 {
00082 }
00083 
00084 void CombiView::showDialog(Gui::TaskView::TaskDialog *dlg)
00085 {
00086     // switch to the TaskView tab
00087     oldTabIndex = tabs->currentIndex();
00088     tabs->setCurrentIndex(1);
00089     // set the dialog
00090     taskPanel->showDialog(dlg);
00091 }
00092 
00093 void CombiView::closeDialog()
00094 {
00095     // close the dialog
00096     taskPanel->removeDialog();
00097 }
00098 
00099 void CombiView::closedDialog()
00100 {
00101     // dialog has been closed
00102     tabs->setCurrentIndex(oldTabIndex);
00103 }
00104 
00105 void CombiView::showTreeView()
00106 {
00107     // switch to the tree view
00108     tabs->setCurrentIndex(0);
00109 }
00110 
00111 void CombiView::showTaskView()
00112 {
00113     // switch to the task view
00114     tabs->setCurrentIndex(1);
00115 }
00116 
00117 void CombiView::changeEvent(QEvent *e)
00118 {
00119     if (e->type() == QEvent::LanguageChange) {
00120         tabs->setTabText(0, trUtf8("Project"));
00121         tabs->setTabText(1, trUtf8("Tasks"));
00122     }
00123 
00124     DockWindow::changeEvent(e);
00125 }
00126 
00127 
00128 #include "moc_CombiView.cpp"

Generated on Wed Nov 23 19:00:01 2011 for FreeCAD by  doxygen 1.6.1